@ng-nest/ui 20.1.6 → 20.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attachments/index.d.ts +277 -0
- package/auto-complete/index.d.ts +11 -2
- package/card/index.d.ts +12 -2
- package/cascade/index.d.ts +2 -1
- package/collapse/index.d.ts +0 -3
- package/color-picker/index.d.ts +2 -1
- package/core/index.d.ts +41 -43
- package/date-picker/index.d.ts +20 -4
- package/dialog/index.d.ts +8 -10
- package/drawer/index.d.ts +10 -12
- package/dropdown/index.d.ts +32 -9
- package/fesm2022/ng-nest-ui-affix.mjs +11 -11
- package/fesm2022/ng-nest-ui-alert.mjs +13 -13
- package/fesm2022/ng-nest-ui-alert.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-anchor.mjs +18 -18
- package/fesm2022/ng-nest-ui-anchor.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-api.mjs +7 -7
- package/fesm2022/ng-nest-ui-api.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-attachments.mjs +331 -0
- package/fesm2022/ng-nest-ui-attachments.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-auto-complete.mjs +36 -26
- package/fesm2022/ng-nest-ui-auto-complete.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-avatar.mjs +18 -18
- package/fesm2022/ng-nest-ui-avatar.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-back-top.mjs +12 -12
- package/fesm2022/ng-nest-ui-back-top.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-badge.mjs +13 -13
- package/fesm2022/ng-nest-ui-badge.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-base-form.mjs +8 -8
- package/fesm2022/ng-nest-ui-bubble.mjs +20 -20
- package/fesm2022/ng-nest-ui-bubble.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-button.mjs +19 -19
- package/fesm2022/ng-nest-ui-button.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-calendar.mjs +11 -11
- package/fesm2022/ng-nest-ui-card.mjs +20 -14
- package/fesm2022/ng-nest-ui-card.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-carousel.mjs +21 -21
- package/fesm2022/ng-nest-ui-carousel.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-cascade.mjs +27 -25
- package/fesm2022/ng-nest-ui-cascade.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-checkbox.mjs +12 -12
- package/fesm2022/ng-nest-ui-checkbox.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-collapse.mjs +20 -28
- package/fesm2022/ng-nest-ui-collapse.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-color-picker.mjs +31 -29
- package/fesm2022/ng-nest-ui-color-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-color.mjs +11 -11
- package/fesm2022/ng-nest-ui-color.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-comment.mjs +18 -18
- package/fesm2022/ng-nest-ui-container.mjs +35 -35
- package/fesm2022/ng-nest-ui-container.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-core.mjs +48 -148
- package/fesm2022/ng-nest-ui-core.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-coversations.mjs +11 -11
- package/fesm2022/ng-nest-ui-crumb.mjs +11 -11
- package/fesm2022/ng-nest-ui-date-picker.mjs +92 -78
- package/fesm2022/ng-nest-ui-date-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-description.mjs +20 -20
- package/fesm2022/ng-nest-ui-description.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-dialog.mjs +68 -67
- package/fesm2022/ng-nest-ui-dialog.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-doc.mjs +7 -7
- package/fesm2022/ng-nest-ui-doc.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-drag.mjs +11 -11
- package/fesm2022/ng-nest-ui-drawer.mjs +67 -84
- package/fesm2022/ng-nest-ui-drawer.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-dropdown.mjs +182 -58
- package/fesm2022/ng-nest-ui-dropdown.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-empty.mjs +11 -11
- package/fesm2022/ng-nest-ui-examples.mjs +7 -7
- package/fesm2022/ng-nest-ui-examples.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-find.mjs +12 -12
- package/fesm2022/ng-nest-ui-find.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-form.mjs +19 -19
- package/fesm2022/ng-nest-ui-form.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-highlight.mjs +15 -15
- package/fesm2022/ng-nest-ui-highlight.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-i18n.mjs +14 -14
- package/fesm2022/ng-nest-ui-icon.mjs +14 -14
- package/fesm2022/ng-nest-ui-icon.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-image.mjs +22 -22
- package/fesm2022/ng-nest-ui-image.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-inner.mjs +11 -11
- package/fesm2022/ng-nest-ui-inner.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-input-number.mjs +12 -12
- package/fesm2022/ng-nest-ui-input-number.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-input.mjs +19 -19
- package/fesm2022/ng-nest-ui-input.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-keyword.mjs +11 -11
- package/fesm2022/ng-nest-ui-keyword.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-layout.mjs +18 -18
- package/fesm2022/ng-nest-ui-layout.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-link.mjs +12 -12
- package/fesm2022/ng-nest-ui-link.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-list.mjs +52 -28
- package/fesm2022/ng-nest-ui-list.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-loading.mjs +12 -12
- package/fesm2022/ng-nest-ui-loading.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-menu.mjs +18 -18
- package/fesm2022/ng-nest-ui-message-box.mjs +10 -10
- package/fesm2022/ng-nest-ui-message.mjs +10 -10
- package/fesm2022/ng-nest-ui-notification.mjs +10 -10
- package/fesm2022/ng-nest-ui-outlet.mjs +8 -8
- package/fesm2022/ng-nest-ui-page-header.mjs +11 -11
- package/fesm2022/ng-nest-ui-pagination.mjs +11 -11
- package/fesm2022/ng-nest-ui-pagination.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-pattern.mjs +7 -7
- package/fesm2022/ng-nest-ui-pattern.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-popconfirm.mjs +11 -11
- package/fesm2022/ng-nest-ui-popover.mjs +25 -21
- package/fesm2022/ng-nest-ui-popover.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-portal.mjs +7 -7
- package/fesm2022/ng-nest-ui-progress.mjs +11 -11
- package/fesm2022/ng-nest-ui-prompts.mjs +17 -12
- package/fesm2022/ng-nest-ui-prompts.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-radio.mjs +12 -12
- package/fesm2022/ng-nest-ui-radio.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-rate.mjs +12 -12
- package/fesm2022/ng-nest-ui-rate.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-resizable.mjs +11 -11
- package/fesm2022/ng-nest-ui-resizable.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-result.mjs +11 -11
- package/fesm2022/ng-nest-ui-ripple.mjs +11 -11
- package/fesm2022/ng-nest-ui-ripple.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-scrollable.mjs +8 -8
- package/fesm2022/ng-nest-ui-scrollable.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-select.mjs +37 -26
- package/fesm2022/ng-nest-ui-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-sender.mjs +19 -18
- package/fesm2022/ng-nest-ui-sender.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-skeleton.mjs +11 -11
- package/fesm2022/ng-nest-ui-slider-select.mjs +13 -13
- package/fesm2022/ng-nest-ui-slider-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-slider.mjs +12 -12
- package/fesm2022/ng-nest-ui-slider.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-statistic.mjs +18 -18
- package/fesm2022/ng-nest-ui-steps.mjs +11 -11
- package/fesm2022/ng-nest-ui-suggestion.mjs +110 -0
- package/fesm2022/ng-nest-ui-suggestion.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-switch.mjs +12 -12
- package/fesm2022/ng-nest-ui-switch.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-table-view.mjs +60 -60
- package/fesm2022/ng-nest-ui-table-view.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-table.mjs +58 -47
- package/fesm2022/ng-nest-ui-table.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tabs.mjs +30 -30
- package/fesm2022/ng-nest-ui-tabs.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tag.mjs +22 -18
- package/fesm2022/ng-nest-ui-tag.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-text-retract.mjs +11 -11
- package/fesm2022/ng-nest-ui-textarea.mjs +12 -12
- package/fesm2022/ng-nest-ui-textarea.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-theme.mjs +11 -11
- package/fesm2022/ng-nest-ui-thought-chain.mjs +121 -0
- package/fesm2022/ng-nest-ui-thought-chain.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-time-ago.mjs +7 -7
- package/fesm2022/ng-nest-ui-time-picker.mjs +31 -29
- package/fesm2022/ng-nest-ui-time-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-time-range.mjs +7 -7
- package/fesm2022/ng-nest-ui-timeline.mjs +36 -14
- package/fesm2022/ng-nest-ui-timeline.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tooltip.mjs +27 -74
- package/fesm2022/ng-nest-ui-tooltip.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-transfer.mjs +12 -12
- package/fesm2022/ng-nest-ui-transfer.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tree-file.mjs +11 -11
- package/fesm2022/ng-nest-ui-tree-select.mjs +27 -25
- package/fesm2022/ng-nest-ui-tree-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tree.mjs +23 -23
- package/fesm2022/ng-nest-ui-tree.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-typography.mjs +11 -11
- package/fesm2022/ng-nest-ui-upload.mjs +221 -24
- package/fesm2022/ng-nest-ui-upload.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-welcome.mjs +11 -11
- package/fesm2022/ng-nest-ui.mjs +4 -0
- package/fesm2022/ng-nest-ui.mjs.map +1 -1
- package/index.d.ts +4 -0
- package/list/index.d.ts +30 -18
- package/package.json +44 -32
- package/popover/index.d.ts +2 -1
- package/prompts/index.d.ts +17 -2
- package/select/index.d.ts +12 -2
- package/sender/index.d.ts +1 -0
- package/style/animates/base.scss +32 -0
- package/style/animates/conect.scss +32 -0
- package/style/animates/fade.scss +32 -0
- package/style/animates/index.scss +11 -0
- package/style/animates/move.scss +129 -0
- package/style/animates/opacity.scss +26 -0
- package/style/animates/slide.scss +113 -0
- package/style/core/index.css +353 -0
- package/style/core/index.css.map +1 -1
- package/style/core/index.scss +1 -6
- package/suggestion/index.d.ts +96 -0
- package/table/index.d.ts +15 -4
- package/table-view/index.d.ts +1 -1
- package/tag/index.d.ts +2 -1
- package/thought-chain/index.d.ts +107 -0
- package/time-picker/index.d.ts +2 -1
- package/timeline/index.d.ts +35 -19
- package/tooltip/index.d.ts +2 -12
- package/tree-select/index.d.ts +2 -1
- package/upload/index.d.ts +39 -2
|
@@ -25,13 +25,13 @@ class XTypographyProperty extends XProperty {
|
|
|
25
25
|
*/
|
|
26
26
|
this.text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : []));
|
|
27
27
|
}
|
|
28
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
29
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.
|
|
28
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
29
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.5", type: XTypographyProperty, isStandalone: true, selector: "x-typography-property", inputs: { font: { classPropertyName: "font", publicName: "font", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
30
30
|
}
|
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyProperty, decorators: [{
|
|
32
32
|
type: Component,
|
|
33
33
|
args: [{ selector: `${XTypographyPrefix}-property`, template: '' }]
|
|
34
|
-
}] });
|
|
34
|
+
}], propDecorators: { font: [{ type: i0.Input, args: [{ isSignal: true, alias: "font", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }] } });
|
|
35
35
|
|
|
36
36
|
class XTypographyComponent extends XTypographyProperty {
|
|
37
37
|
constructor() {
|
|
@@ -49,20 +49,20 @@ class XTypographyComponent extends XTypographyProperty {
|
|
|
49
49
|
if (text && text.length > 0)
|
|
50
50
|
this.firstText.set(text.slice(0, 1));
|
|
51
51
|
}
|
|
52
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
53
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
52
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
53
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.5", type: XTypographyComponent, isStandalone: true, selector: "x-typography", usesInheritance: true, ngImport: i0, template: "<h4>{{ font() }}</h4>\r\n<div class=\"x-typography-list\">\r\n <div class=\"x-typography-item\">\r\n <h1>{{ firstText() }}</h1>\r\n <p>\r\n <span>\u5E38\u89C4</span>\r\n <span class=\"x-typography-blod\">\u7C97\u4F53</span>\r\n </p>\r\n </div>\r\n <div class=\"x-typography-item\">\r\n <h1>Aa</h1>\r\n <p>\r\n <span>Regular</span>\r\n <span class=\"x-typography-blod\">Bold</span>\r\n </p>\r\n </div>\r\n</div>\r\n<p>{{ text() }}</p>\r\n<p>abcdefghijklmnopqrstuvwxyz</p>\r\n<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>\r\n<p>1234567890.:,;'\"(!?)+-*/=</p>\r\n", styles: [".x-typography{margin:0;padding:0}.x-typography{color:var(--x-text)}.x-typography h4,.x-typography h1,.x-typography p{margin:0;font-size:var(--x-font-size);line-height:1.5rem}.x-typography>h4{color:var(--x-text-300);font-weight:500}.x-typography-list{display:flex;margin:.5rem 0}.x-typography-item{display:flex;margin:.5rem 0 0 3rem}.x-typography-item:first-child{margin-left:0}.x-typography-item>h1{color:var(--x-text);font-size:3.75rem;font-weight:600}.x-typography-item>p{display:flex;flex-direction:column;padding:.75rem 0;margin-left:1.5rem}.x-typography-item>p>span{margin-top:.25rem}.x-typography-item>p>span:first-child{margin-top:0}.x-typography-blod{font-weight:600}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
54
54
|
}
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyComponent, decorators: [{
|
|
56
56
|
type: Component,
|
|
57
57
|
args: [{ selector: 'x-typography', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<h4>{{ font() }}</h4>\r\n<div class=\"x-typography-list\">\r\n <div class=\"x-typography-item\">\r\n <h1>{{ firstText() }}</h1>\r\n <p>\r\n <span>\u5E38\u89C4</span>\r\n <span class=\"x-typography-blod\">\u7C97\u4F53</span>\r\n </p>\r\n </div>\r\n <div class=\"x-typography-item\">\r\n <h1>Aa</h1>\r\n <p>\r\n <span>Regular</span>\r\n <span class=\"x-typography-blod\">Bold</span>\r\n </p>\r\n </div>\r\n</div>\r\n<p>{{ text() }}</p>\r\n<p>abcdefghijklmnopqrstuvwxyz</p>\r\n<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>\r\n<p>1234567890.:,;'\"(!?)+-*/=</p>\r\n", styles: [".x-typography{margin:0;padding:0}.x-typography{color:var(--x-text)}.x-typography h4,.x-typography h1,.x-typography p{margin:0;font-size:var(--x-font-size);line-height:1.5rem}.x-typography>h4{color:var(--x-text-300);font-weight:500}.x-typography-list{display:flex;margin:.5rem 0}.x-typography-item{display:flex;margin:.5rem 0 0 3rem}.x-typography-item:first-child{margin-left:0}.x-typography-item>h1{color:var(--x-text);font-size:3.75rem;font-weight:600}.x-typography-item>p{display:flex;flex-direction:column;padding:.75rem 0;margin-left:1.5rem}.x-typography-item>p>span{margin-top:.25rem}.x-typography-item>p>span:first-child{margin-top:0}.x-typography-blod{font-weight:600}\n"] }]
|
|
58
58
|
}] });
|
|
59
59
|
|
|
60
60
|
class XTypographyModule {
|
|
61
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
62
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
63
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
61
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
62
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.5", ngImport: i0, type: XTypographyModule, imports: [XTypographyComponent], exports: [XTypographyComponent] }); }
|
|
63
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyModule }); }
|
|
64
64
|
}
|
|
65
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTypographyModule, decorators: [{
|
|
66
66
|
type: NgModule,
|
|
67
67
|
args: [{
|
|
68
68
|
exports: [XTypographyComponent],
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { HttpClient, HttpRequest, HttpHeaders, HttpEventType } from '@angular/common/http';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, output, Component, computed, viewChild, signal, inject, Renderer2, ChangeDetectionStrategy, ViewEncapsulation, ViewContainerRef, NgModule } from '@angular/core';
|
|
4
|
-
import { XToBoolean, XToNumber, XClamp, XIsTemplateRef, XIsEmpty, XIsArray } from '@ng-nest/ui/core';
|
|
3
|
+
import { input, output, Component, computed, viewChild, signal, inject, Renderer2, ChangeDetectionStrategy, ViewEncapsulation, DOCUMENT as DOCUMENT$1, RendererFactory2, Injectable, ViewContainerRef, ElementRef, effect, untracked, HostBinding, NgModule } from '@angular/core';
|
|
4
|
+
import { XToBoolean, XToNumber, XClamp, XComputedStyle, XIsTemplateRef, XIsEmpty, XIsArray } from '@ng-nest/ui/core';
|
|
5
5
|
import { XFormControlFunction, XValueAccessor } from '@ng-nest/ui/base-form';
|
|
6
6
|
import { takeUntil, map } from 'rxjs/operators';
|
|
7
7
|
import { XI18nService, zh_CN } from '@ng-nest/ui/i18n';
|
|
8
8
|
import { XPortalService } from '@ng-nest/ui/portal';
|
|
9
9
|
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
10
|
-
import { Subject, fromEvent } from 'rxjs';
|
|
10
|
+
import { Subject, fromEvent, Subscription } from 'rxjs';
|
|
11
11
|
import { XIconComponent } from '@ng-nest/ui/icon';
|
|
12
12
|
import { XOutletDirective } from '@ng-nest/ui/outlet';
|
|
13
13
|
import { XButtonComponent } from '@ng-nest/ui/button';
|
|
14
14
|
import { XImageGroupComponent, XImageComponent } from '@ng-nest/ui/image';
|
|
15
15
|
import { XProgressComponent } from '@ng-nest/ui/progress';
|
|
16
16
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
17
|
+
import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
|
|
18
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Upload
|
|
@@ -38,6 +40,31 @@ class XUploadProperty extends XFormControlFunction(X_UPLOAD_CONFIG_NAME) {
|
|
|
38
40
|
* @en_US Request address
|
|
39
41
|
*/
|
|
40
42
|
this.action = input(...(ngDevMode ? [undefined, { debugName: "action" }] : []));
|
|
43
|
+
/**
|
|
44
|
+
* @zh_CN 可拖拽上传的区域
|
|
45
|
+
* @en_US Drag and drop upload area
|
|
46
|
+
*/
|
|
47
|
+
this.dropContainer = input(...(ngDevMode ? [undefined, { debugName: "dropContainer" }] : []));
|
|
48
|
+
/**
|
|
49
|
+
* @zh_CN 可拖拽上传的区域的图标
|
|
50
|
+
* @en_US Drag and drop upload area icon
|
|
51
|
+
*/
|
|
52
|
+
this.dropIcon = input(...(ngDevMode ? [undefined, { debugName: "dropIcon" }] : []));
|
|
53
|
+
/**
|
|
54
|
+
* @zh_CN 可拖拽上传的区域的标题
|
|
55
|
+
* @en_US Drag and drop upload area title
|
|
56
|
+
*/
|
|
57
|
+
this.dropTitle = input(...(ngDevMode ? [undefined, { debugName: "dropTitle" }] : []));
|
|
58
|
+
/**
|
|
59
|
+
* @zh_CN 可拖拽上传的区域的描述
|
|
60
|
+
* @en_US Drag and drop upload area description
|
|
61
|
+
*/
|
|
62
|
+
this.dropDescription = input(...(ngDevMode ? [undefined, { debugName: "dropDescription" }] : []));
|
|
63
|
+
/**
|
|
64
|
+
* @zh_CN 直接显示可拖拽上传的区域
|
|
65
|
+
* @en_US Show the drag and drop upload area directly
|
|
66
|
+
*/
|
|
67
|
+
this.showDrop = input(false, ...(ngDevMode ? [{ debugName: "showDrop", transform: XToBoolean }] : [{ transform: XToBoolean }]));
|
|
41
68
|
/**
|
|
42
69
|
* @zh_CN 上传文件类型,与原生的 input file 组件一致
|
|
43
70
|
* @en_US Upload file type, consistent with native input file component
|
|
@@ -114,13 +141,13 @@ class XUploadProperty extends XFormControlFunction(X_UPLOAD_CONFIG_NAME) {
|
|
|
114
141
|
*/
|
|
115
142
|
this.uploadError = output();
|
|
116
143
|
}
|
|
117
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
118
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.
|
|
144
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
145
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.5", type: XUploadProperty, isStandalone: true, selector: "x-upload-property", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, dropContainer: { classPropertyName: "dropContainer", publicName: "dropContainer", isSignal: true, isRequired: false, transformFunction: null }, dropIcon: { classPropertyName: "dropIcon", publicName: "dropIcon", isSignal: true, isRequired: false, transformFunction: null }, dropTitle: { classPropertyName: "dropTitle", publicName: "dropTitle", isSignal: true, isRequired: false, transformFunction: null }, dropDescription: { classPropertyName: "dropDescription", publicName: "dropDescription", isSignal: true, isRequired: false, transformFunction: null }, showDrop: { classPropertyName: "showDrop", publicName: "showDrop", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, imgFallback: { classPropertyName: "imgFallback", publicName: "imgFallback", isSignal: true, isRequired: false, transformFunction: null }, imgCut: { classPropertyName: "imgCut", publicName: "imgCut", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, download: { classPropertyName: "download", publicName: "download", isSignal: true, isRequired: false, transformFunction: null }, multipleModel: { classPropertyName: "multipleModel", publicName: "multipleModel", isSignal: true, isRequired: false, transformFunction: null }, filesTpl: { classPropertyName: "filesTpl", publicName: "filesTpl", isSignal: true, isRequired: false, transformFunction: null }, maxLimit: { classPropertyName: "maxLimit", publicName: "maxLimit", isSignal: true, isRequired: false, transformFunction: null }, headers: { classPropertyName: "headers", publicName: "headers", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { removeClick: "removeClick", uploadReady: "uploadReady", uploading: "uploading", uploadSuccess: "uploadSuccess", uploadError: "uploadError" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
119
146
|
}
|
|
120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadProperty, decorators: [{
|
|
121
148
|
type: Component,
|
|
122
149
|
args: [{ selector: `${XUploadPrefix}-property`, template: '' }]
|
|
123
|
-
}] });
|
|
150
|
+
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], dropContainer: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropContainer", required: false }] }], dropIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropIcon", required: false }] }], dropTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropTitle", required: false }] }], dropDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropDescription", required: false }] }], showDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDrop", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], imgFallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "imgFallback", required: false }] }], imgCut: [{ type: i0.Input, args: [{ isSignal: true, alias: "imgCut", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], download: [{ type: i0.Input, args: [{ isSignal: true, alias: "download", required: false }] }], multipleModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "multipleModel", required: false }] }], filesTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "filesTpl", required: false }] }], maxLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLimit", required: false }] }], headers: [{ type: i0.Input, args: [{ isSignal: true, alias: "headers", required: false }] }], removeClick: [{ type: i0.Output, args: ["removeClick"] }], uploadReady: [{ type: i0.Output, args: ["uploadReady"] }], uploading: [{ type: i0.Output, args: ["uploading"] }], uploadSuccess: [{ type: i0.Output, args: ["uploadSuccess"] }], uploadError: [{ type: i0.Output, args: ["uploadError"] }] } });
|
|
124
151
|
/**
|
|
125
152
|
* @zh_CN 上传显示窗口
|
|
126
153
|
* @en_US Upload portal
|
|
@@ -309,15 +336,98 @@ class XUploadPortalComponent {
|
|
|
309
336
|
});
|
|
310
337
|
};
|
|
311
338
|
}
|
|
312
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
313
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.
|
|
339
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadPortalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
340
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.5", type: XUploadPortalComponent, isStandalone: true, selector: "x-upload-portal", inputs: { file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closePortal: "closePortal", surePortal: "surePortal" }, viewQueries: [{ propertyName: "imgRef", first: true, predicate: ["imgRef"], descendants: true, isSignal: true }, { propertyName: "imgClipRef", first: true, predicate: ["imgClipRef"], descendants: true, isSignal: true }, { propertyName: "boundaryRef", first: true, predicate: ["boundaryRef"], descendants: true, isSignal: true }, { propertyName: "cutRef", first: true, predicate: ["cutRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"x-upload-portal {{ cutType() }}\" [class.x-upload-portal-ready]=\"ready()\">\r\n <div class=\"x-upload-portal-tools\">\r\n <div class=\"x-upload-portal-title\">\r\n <x-icon type=\"fto-image\"></x-icon>\r\n <span>{{ name() }}</span>\r\n </div>\r\n <x-icon class=\"x-upload-portal-close\" type=\"fto-x\" (click)=\"closePortal.emit()\"></x-icon>\r\n </div>\r\n <div class=\"x-upload-portal-img\">\r\n <img #imgRef class=\"x-upload-portal-full-img\" [src]=\"url()\" />\r\n <div #boundaryRef class=\"x-upload-portal-boundary\">\r\n <img #imgClipRef class=\"x-upload-portal-clip-img\" [src]=\"url()\" />\r\n <div #cutRef class=\"x-upload-portal-cut\">\r\n <div class=\"x-upload-portal-cut-top-start\"></div>\r\n <div class=\"x-upload-portal-cut-top\"></div>\r\n <div class=\"x-upload-portal-cut-top-end\"></div>\r\n <div class=\"x-upload-portal-cut-left\"></div>\r\n <div class=\"x-upload-portal-cut-right\"></div>\r\n <div class=\"x-upload-portal-cut-bottom-start\"></div>\r\n <div class=\"x-upload-portal-cut-bottom\"></div>\r\n <div class=\"x-upload-portal-cut-bottom-end\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"x-upload-portal-bottom-tools\">\r\n <x-icon class=\"x-upload-portal-close\" type=\"fto-check\" (click)=\"sure()\"></x-icon>\r\n </div>\r\n</div>\r\n", styles: ["x-upload-portal{width:100%;height:100%}.x-upload-portal{margin:0;padding:0}.x-upload-portal{display:flex;position:relative;width:100%;height:100%;flex-direction:column}.x-upload-portal-tools{width:100%;height:3.25rem;display:flex;align-items:center;justify-content:space-between;position:absolute;z-index:1;color:#fff}.x-upload-portal-bottom-tools{width:100%;height:3.25rem;position:absolute;display:flex;justify-content:center;align-items:center;z-index:1;color:#fff;bottom:0}.x-upload-portal-title{display:flex;align-items:center;margin:0 1rem}.x-upload-portal-title>x-icon{font-size:1.25rem}.x-upload-portal-title>span{margin-left:.5rem}.x-upload-portal-close{font-size:1.75rem;padding:0 1rem;color:#fffc;transition:color var(--x-animation-duration-base);cursor:pointer}.x-upload-portal-close:hover{color:#fff}.x-upload-portal-img{flex:1;width:100%;position:relative;overflow:auto}.x-upload-portal-full-img{max-width:85%;max-height:85%;width:auto;height:auto;position:absolute;left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.x-upload-portal-clip-img{position:absolute}.x-upload-portal-ready .x-upload-portal-full-img{max-width:inherit;max-height:inherit}.x-upload-portal-boundary{width:0;height:0;left:50%;top:50%;transform:translate3d(-50%,-50%,0);position:relative;background-color:#00000080}.x-upload-portal-cut{width:0;height:0;border:.125rem var(--x-border-style) rgba(255,255,255,.8);display:flex;align-items:center;justify-content:center;position:relative;cursor:move}.x-upload-portal-cut-top-start,.x-upload-portal-cut-top,.x-upload-portal-cut-top-end,.x-upload-portal-cut-left,.x-upload-portal-cut-right,.x-upload-portal-cut-bottom-start,.x-upload-portal-cut-bottom,.x-upload-portal-cut-bottom-end{width:.825rem;height:.825rem;background:#fff;position:absolute;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius)}.x-upload-portal-cut-top-start{top:-.4125rem;left:-.4125rem;cursor:se-resize}.x-upload-portal-cut-top{top:-.4125rem;cursor:s-resize}.x-upload-portal-cut-top-end{top:-.4125rem;right:-.4125rem;cursor:ne-resize}.x-upload-portal-cut-left{left:-.4125rem;cursor:w-resize}.x-upload-portal-cut-right{right:-.4125rem;cursor:w-resize}.x-upload-portal-cut-bottom-start{left:-.4125rem;bottom:-.4125rem;cursor:ne-resize}.x-upload-portal-cut-bottom{bottom:-.4125rem;cursor:s-resize}.x-upload-portal-cut-bottom-end{right:-.4125rem;bottom:-.4125rem;cursor:se-resize}.x-upload-portal-top-start{cursor:se-resize}.x-upload-portal-top{cursor:s-resize}.x-upload-portal-top-end{cursor:ne-resize}.x-upload-portal-left,.x-upload-portal-right{cursor:w-resize}.x-upload-portal-bottom-start{cursor:ne-resize}.x-upload-portal-bottom{cursor:s-resize}.x-upload-portal-bottom-end{cursor:se-resize}\n"], dependencies: [{ kind: "component", type: XIconComponent, selector: "x-icon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
314
341
|
}
|
|
315
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadPortalComponent, decorators: [{
|
|
316
343
|
type: Component,
|
|
317
344
|
args: [{ selector: `${XUploadPortalPrefix}`, imports: [XIconComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"x-upload-portal {{ cutType() }}\" [class.x-upload-portal-ready]=\"ready()\">\r\n <div class=\"x-upload-portal-tools\">\r\n <div class=\"x-upload-portal-title\">\r\n <x-icon type=\"fto-image\"></x-icon>\r\n <span>{{ name() }}</span>\r\n </div>\r\n <x-icon class=\"x-upload-portal-close\" type=\"fto-x\" (click)=\"closePortal.emit()\"></x-icon>\r\n </div>\r\n <div class=\"x-upload-portal-img\">\r\n <img #imgRef class=\"x-upload-portal-full-img\" [src]=\"url()\" />\r\n <div #boundaryRef class=\"x-upload-portal-boundary\">\r\n <img #imgClipRef class=\"x-upload-portal-clip-img\" [src]=\"url()\" />\r\n <div #cutRef class=\"x-upload-portal-cut\">\r\n <div class=\"x-upload-portal-cut-top-start\"></div>\r\n <div class=\"x-upload-portal-cut-top\"></div>\r\n <div class=\"x-upload-portal-cut-top-end\"></div>\r\n <div class=\"x-upload-portal-cut-left\"></div>\r\n <div class=\"x-upload-portal-cut-right\"></div>\r\n <div class=\"x-upload-portal-cut-bottom-start\"></div>\r\n <div class=\"x-upload-portal-cut-bottom\"></div>\r\n <div class=\"x-upload-portal-cut-bottom-end\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"x-upload-portal-bottom-tools\">\r\n <x-icon class=\"x-upload-portal-close\" type=\"fto-check\" (click)=\"sure()\"></x-icon>\r\n </div>\r\n</div>\r\n", styles: ["x-upload-portal{width:100%;height:100%}.x-upload-portal{margin:0;padding:0}.x-upload-portal{display:flex;position:relative;width:100%;height:100%;flex-direction:column}.x-upload-portal-tools{width:100%;height:3.25rem;display:flex;align-items:center;justify-content:space-between;position:absolute;z-index:1;color:#fff}.x-upload-portal-bottom-tools{width:100%;height:3.25rem;position:absolute;display:flex;justify-content:center;align-items:center;z-index:1;color:#fff;bottom:0}.x-upload-portal-title{display:flex;align-items:center;margin:0 1rem}.x-upload-portal-title>x-icon{font-size:1.25rem}.x-upload-portal-title>span{margin-left:.5rem}.x-upload-portal-close{font-size:1.75rem;padding:0 1rem;color:#fffc;transition:color var(--x-animation-duration-base);cursor:pointer}.x-upload-portal-close:hover{color:#fff}.x-upload-portal-img{flex:1;width:100%;position:relative;overflow:auto}.x-upload-portal-full-img{max-width:85%;max-height:85%;width:auto;height:auto;position:absolute;left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.x-upload-portal-clip-img{position:absolute}.x-upload-portal-ready .x-upload-portal-full-img{max-width:inherit;max-height:inherit}.x-upload-portal-boundary{width:0;height:0;left:50%;top:50%;transform:translate3d(-50%,-50%,0);position:relative;background-color:#00000080}.x-upload-portal-cut{width:0;height:0;border:.125rem var(--x-border-style) rgba(255,255,255,.8);display:flex;align-items:center;justify-content:center;position:relative;cursor:move}.x-upload-portal-cut-top-start,.x-upload-portal-cut-top,.x-upload-portal-cut-top-end,.x-upload-portal-cut-left,.x-upload-portal-cut-right,.x-upload-portal-cut-bottom-start,.x-upload-portal-cut-bottom,.x-upload-portal-cut-bottom-end{width:.825rem;height:.825rem;background:#fff;position:absolute;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius)}.x-upload-portal-cut-top-start{top:-.4125rem;left:-.4125rem;cursor:se-resize}.x-upload-portal-cut-top{top:-.4125rem;cursor:s-resize}.x-upload-portal-cut-top-end{top:-.4125rem;right:-.4125rem;cursor:ne-resize}.x-upload-portal-cut-left{left:-.4125rem;cursor:w-resize}.x-upload-portal-cut-right{right:-.4125rem;cursor:w-resize}.x-upload-portal-cut-bottom-start{left:-.4125rem;bottom:-.4125rem;cursor:ne-resize}.x-upload-portal-cut-bottom{bottom:-.4125rem;cursor:s-resize}.x-upload-portal-cut-bottom-end{right:-.4125rem;bottom:-.4125rem;cursor:se-resize}.x-upload-portal-top-start{cursor:se-resize}.x-upload-portal-top{cursor:s-resize}.x-upload-portal-top-end{cursor:ne-resize}.x-upload-portal-left,.x-upload-portal-right{cursor:w-resize}.x-upload-portal-bottom-start{cursor:ne-resize}.x-upload-portal-bottom{cursor:s-resize}.x-upload-portal-bottom-end{cursor:se-resize}\n"] }]
|
|
318
|
-
}] });
|
|
345
|
+
}], propDecorators: { file: [{ type: i0.Input, args: [{ isSignal: true, alias: "file", required: false }] }], imgRef: [{ type: i0.ViewChild, args: ['imgRef', { isSignal: true }] }], imgClipRef: [{ type: i0.ViewChild, args: ['imgClipRef', { isSignal: true }] }], boundaryRef: [{ type: i0.ViewChild, args: ['boundaryRef', { isSignal: true }] }], cutRef: [{ type: i0.ViewChild, args: ['cutRef', { isSignal: true }] }], closePortal: [{ type: i0.Output, args: ["closePortal"] }], surePortal: [{ type: i0.Output, args: ["surePortal"] }] } });
|
|
346
|
+
|
|
347
|
+
class XDragOverlayComponent {
|
|
348
|
+
constructor() {
|
|
349
|
+
this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
|
|
350
|
+
this.title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : []));
|
|
351
|
+
this.description = input(...(ngDevMode ? [undefined, { debugName: "description" }] : []));
|
|
352
|
+
this.iconString = computed(() => this.icon(), ...(ngDevMode ? [{ debugName: "iconString" }] : []));
|
|
353
|
+
}
|
|
354
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDragOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
355
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XDragOverlayComponent, isStandalone: true, selector: "x-drag-overlay", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"x-drag-overlay\">\r\n @if (icon()) {\r\n <div class=\"x-drag-overlay-icon\">\r\n <ng-container *xOutlet=\"icon()\">\r\n <x-icon [type]=\"iconString()\"></x-icon>\r\n </ng-container>\r\n </div>\r\n }\r\n @if (title()) {\r\n <div class=\"x-drag-overlay-title\">\r\n <ng-container *xOutlet=\"title()\">\r\n {{ title() }}\r\n </ng-container>\r\n </div>\r\n }\r\n @if (description()) {\r\n <div class=\"x-drag-overlay-description\">\r\n <ng-container *xOutlet=\"description()\">\r\n {{ description() }}\r\n </ng-container>\r\n </div>\r\n }\r\n</div>\r\n", styles: ["x-drag-overlay{width:100%;height:100%}.x-drag-overlay{margin:0;padding:0}.x-drag-overlay{position:absolute;inset:0;-webkit-backdrop-filter:blur(.25rem);backdrop-filter:blur(.25rem);border:var(--x-border-width) dashed var(--x-primary);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:1000}.x-drag-overlay-icon{font-size:2rem}.x-drag-overlay-title{font-size:1rem}.x-drag-overlay-description{color:var(--x-text-400)}\n"], dependencies: [{ kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
356
|
+
}
|
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDragOverlayComponent, decorators: [{
|
|
358
|
+
type: Component,
|
|
359
|
+
args: [{ selector: 'x-drag-overlay', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [XOutletDirective, XIconComponent], template: "<div class=\"x-drag-overlay\">\r\n @if (icon()) {\r\n <div class=\"x-drag-overlay-icon\">\r\n <ng-container *xOutlet=\"icon()\">\r\n <x-icon [type]=\"iconString()\"></x-icon>\r\n </ng-container>\r\n </div>\r\n }\r\n @if (title()) {\r\n <div class=\"x-drag-overlay-title\">\r\n <ng-container *xOutlet=\"title()\">\r\n {{ title() }}\r\n </ng-container>\r\n </div>\r\n }\r\n @if (description()) {\r\n <div class=\"x-drag-overlay-description\">\r\n <ng-container *xOutlet=\"description()\">\r\n {{ description() }}\r\n </ng-container>\r\n </div>\r\n }\r\n</div>\r\n", styles: ["x-drag-overlay{width:100%;height:100%}.x-drag-overlay{margin:0;padding:0}.x-drag-overlay{position:absolute;inset:0;-webkit-backdrop-filter:blur(.25rem);backdrop-filter:blur(.25rem);border:var(--x-border-width) dashed var(--x-primary);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:1000}.x-drag-overlay-icon{font-size:2rem}.x-drag-overlay-title{font-size:1rem}.x-drag-overlay-description{color:var(--x-text-400)}\n"] }]
|
|
360
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }] } });
|
|
361
|
+
|
|
362
|
+
class XDragOverlayService {
|
|
363
|
+
constructor() {
|
|
364
|
+
this.overlay = inject(Overlay);
|
|
365
|
+
this.document = inject(DOCUMENT$1);
|
|
366
|
+
this.overlayRef = null;
|
|
367
|
+
this.componentRef = null;
|
|
368
|
+
this.containerPosition = '';
|
|
369
|
+
this.factory = inject(RendererFactory2);
|
|
370
|
+
this.renderer = this.factory.createRenderer(null, null);
|
|
371
|
+
}
|
|
372
|
+
createOverlay(container, viewContainerRef, params) {
|
|
373
|
+
this.removeOverlay(container);
|
|
374
|
+
const isBodyOrWindow = container === this.document.body || container === this.document.documentElement;
|
|
375
|
+
this.containerPosition = container.style.position;
|
|
376
|
+
this.renderer.setStyle(container, 'position', 'relative');
|
|
377
|
+
const overlayConfig = new OverlayConfig({
|
|
378
|
+
positionStrategy: this.overlay.position().global(),
|
|
379
|
+
hasBackdrop: false,
|
|
380
|
+
scrollStrategy: this.overlay.scrollStrategies.block()
|
|
381
|
+
});
|
|
382
|
+
this.overlayRef = this.overlay.create(overlayConfig);
|
|
383
|
+
if (this.overlayRef && this.overlayRef.overlayElement) {
|
|
384
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'width', container.offsetWidth + 'px');
|
|
385
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'height', container.offsetHeight + 'px');
|
|
386
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'border-radius', XComputedStyle(container, 'border-radius'));
|
|
387
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'position', 'absolute');
|
|
388
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'pointer-events', 'none');
|
|
389
|
+
this.renderer.setStyle(this.overlayRef.overlayElement, 'z-index', 'none');
|
|
390
|
+
}
|
|
391
|
+
const portal = new ComponentPortal(XDragOverlayComponent, viewContainerRef);
|
|
392
|
+
this.componentRef = this.overlayRef.attach(portal);
|
|
393
|
+
this.componentRef.setInput('icon', params.icon);
|
|
394
|
+
this.componentRef.setInput('title', params.title);
|
|
395
|
+
this.componentRef.setInput('description', params.description);
|
|
396
|
+
if (this.overlayRef && this.overlayRef.overlayElement) {
|
|
397
|
+
if (!isBodyOrWindow) {
|
|
398
|
+
container.appendChild(this.overlayRef.overlayElement);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
removeOverlay(container) {
|
|
403
|
+
if (this.overlayRef) {
|
|
404
|
+
const resizeObserver = this.overlayRef.resizeObserver;
|
|
405
|
+
if (resizeObserver) {
|
|
406
|
+
resizeObserver.disconnect();
|
|
407
|
+
}
|
|
408
|
+
if (this.overlayRef.overlayElement && this.overlayRef.overlayElement.parentNode) {
|
|
409
|
+
this.overlayRef.overlayElement.parentNode.removeChild(this.overlayRef.overlayElement);
|
|
410
|
+
}
|
|
411
|
+
this.renderer.setStyle(container, 'position', this.containerPosition);
|
|
412
|
+
this.overlayRef.dispose();
|
|
413
|
+
this.overlayRef = null;
|
|
414
|
+
this.componentRef = null;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDragOverlayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
418
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDragOverlayService, providedIn: 'root' }); }
|
|
419
|
+
}
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDragOverlayService, decorators: [{
|
|
421
|
+
type: Injectable,
|
|
422
|
+
args: [{
|
|
423
|
+
providedIn: 'root'
|
|
424
|
+
}]
|
|
425
|
+
}], ctorParameters: () => [] });
|
|
319
426
|
|
|
320
427
|
class XUploadComponent extends XUploadProperty {
|
|
428
|
+
get getShowDrop() {
|
|
429
|
+
return this.showDrop();
|
|
430
|
+
}
|
|
321
431
|
writeValue(value) {
|
|
322
432
|
this.value.set(value);
|
|
323
433
|
this.setFiles();
|
|
@@ -328,6 +438,10 @@ class XUploadComponent extends XUploadProperty {
|
|
|
328
438
|
this.portalService = inject(XPortalService);
|
|
329
439
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
330
440
|
this.i18n = inject(XI18nService);
|
|
441
|
+
this.renderer = inject(Renderer2);
|
|
442
|
+
this.dragOverlayService = inject(XDragOverlayService);
|
|
443
|
+
this.dragCounter = 0;
|
|
444
|
+
this.elementRef = inject(ElementRef);
|
|
331
445
|
this.file = viewChild.required('file');
|
|
332
446
|
this.files = signal([], ...(ngDevMode ? [{ debugName: "files" }] : []));
|
|
333
447
|
this.showUpload = signal(false, ...(ngDevMode ? [{ debugName: "showUpload" }] : []));
|
|
@@ -343,6 +457,82 @@ class XUploadComponent extends XUploadProperty {
|
|
|
343
457
|
if (!this.http) {
|
|
344
458
|
throw new Error(`${XUploadPrefix}: Not found 'HttpClient', You can import 'HttpClientModule' in your root module.`);
|
|
345
459
|
}
|
|
460
|
+
effect(() => {
|
|
461
|
+
const container = this.dropContainer();
|
|
462
|
+
untracked(() => {
|
|
463
|
+
this.setupDropContainer(container);
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
ngAfterViewInit() {
|
|
468
|
+
if (this.showDrop() && this.dropContainer()) {
|
|
469
|
+
this.setupDropContainer(this.dropContainer());
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
ngOnDestory() {
|
|
473
|
+
if (this.dropSubscription) {
|
|
474
|
+
this.dropSubscription.unsubscribe();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
setupDropContainer(container) {
|
|
478
|
+
if (this.dropSubscription) {
|
|
479
|
+
this.dropSubscription.unsubscribe();
|
|
480
|
+
}
|
|
481
|
+
if (!container)
|
|
482
|
+
return;
|
|
483
|
+
const element = container instanceof ElementRef ? container.nativeElement : container;
|
|
484
|
+
const dragEnter$ = fromEvent(element, 'dragenter');
|
|
485
|
+
const dragOver$ = fromEvent(element, 'dragover');
|
|
486
|
+
const dragLeave$ = fromEvent(element, 'dragleave');
|
|
487
|
+
const drop$ = fromEvent(element, 'drop');
|
|
488
|
+
this.dropSubscription = new Subscription();
|
|
489
|
+
this.dropSubscription.add(dragEnter$.subscribe((event) => {
|
|
490
|
+
event.preventDefault();
|
|
491
|
+
this.dragCounter++;
|
|
492
|
+
if (this.dragCounter === 1) {
|
|
493
|
+
this.addDragOverStyle(element);
|
|
494
|
+
}
|
|
495
|
+
}));
|
|
496
|
+
this.dropSubscription.add(dragOver$.subscribe((event) => {
|
|
497
|
+
event.preventDefault();
|
|
498
|
+
event.stopPropagation();
|
|
499
|
+
}));
|
|
500
|
+
this.dropSubscription.add(dragLeave$.subscribe((event) => {
|
|
501
|
+
event.preventDefault();
|
|
502
|
+
this.dragCounter--;
|
|
503
|
+
if (this.dragCounter === 0) {
|
|
504
|
+
this.removeDragOverStyle(element);
|
|
505
|
+
}
|
|
506
|
+
}));
|
|
507
|
+
this.dropSubscription.add(drop$.subscribe((event) => {
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
event.stopPropagation();
|
|
510
|
+
this.dragCounter = 0;
|
|
511
|
+
this.removeDragOverStyle(element);
|
|
512
|
+
const files = event.dataTransfer?.files;
|
|
513
|
+
if (files && files.length > 0) {
|
|
514
|
+
this.handleFiles(files);
|
|
515
|
+
}
|
|
516
|
+
}));
|
|
517
|
+
}
|
|
518
|
+
addDragOverStyle(element) {
|
|
519
|
+
if (this.showDrop()) {
|
|
520
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'x-upload-drag-over');
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
const icon = this.dropIcon();
|
|
524
|
+
const title = this.dropTitle();
|
|
525
|
+
const description = this.dropDescription();
|
|
526
|
+
this.dragOverlayService.createOverlay(element, this.viewContainerRef, { icon, title, description });
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
removeDragOverStyle(element) {
|
|
530
|
+
if (this.showDrop()) {
|
|
531
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'x-upload-drag-over');
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this.dragOverlayService.removeOverlay(element);
|
|
535
|
+
}
|
|
346
536
|
}
|
|
347
537
|
setFiles() {
|
|
348
538
|
if (!Array.isArray(this.value()))
|
|
@@ -357,10 +547,14 @@ class XUploadComponent extends XUploadProperty {
|
|
|
357
547
|
let input = event.target;
|
|
358
548
|
if (typeof input === 'undefined' || input.files?.length === 0)
|
|
359
549
|
return;
|
|
550
|
+
this.handleFiles(input.files);
|
|
551
|
+
input.value = '';
|
|
552
|
+
}
|
|
553
|
+
handleFiles(fileList) {
|
|
360
554
|
let files = [];
|
|
361
|
-
let max = this.maxLimit() > -1 ? this.maxLimit() :
|
|
555
|
+
let max = this.maxLimit() > -1 ? this.maxLimit() : fileList.length;
|
|
362
556
|
for (let i = 0; i < max; i++) {
|
|
363
|
-
let file =
|
|
557
|
+
let file = fileList.item(i);
|
|
364
558
|
file.state = 'ready';
|
|
365
559
|
files = [...files, file];
|
|
366
560
|
}
|
|
@@ -375,7 +569,6 @@ class XUploadComponent extends XUploadProperty {
|
|
|
375
569
|
this.value.set(this.files());
|
|
376
570
|
this.onChange && this.onChange(this.value());
|
|
377
571
|
this.onUploading();
|
|
378
|
-
input.value = '';
|
|
379
572
|
}
|
|
380
573
|
remove(file, index) {
|
|
381
574
|
this.files.update((x) => {
|
|
@@ -514,10 +707,10 @@ class XUploadComponent extends XUploadProperty {
|
|
|
514
707
|
imgLoad(file) {
|
|
515
708
|
file.state = 'success';
|
|
516
709
|
}
|
|
517
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
518
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
710
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XUploadComponent, isStandalone: true, selector: "x-upload", host: { properties: { "class.x-upload-show-drop": "this.getShowDrop" } }, providers: [XValueAccessor(XUploadComponent), XDragOverlayService], viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #upload class=\"x-upload x-upload-{{ type() }}\" [class.x-disabled]=\"disabledComputed()\">\r\n <input\r\n class=\"x-upload-input\"\r\n type=\"file\"\r\n #file\r\n (change)=\"change($event)\"\r\n [attr.accept]=\"acceptSignal()\"\r\n [multiple]=\"multiple()\"\r\n style=\"display: none\"\r\n />\r\n\r\n @switch (type()) {\r\n @case ('list') {\r\n <ng-container *ngTemplateOutlet=\"uploadBtnTpl\"></ng-container>\r\n <ng-container *xOutlet=\"filesTpl(); context: { $files: files() }\">\r\n @if (files() && files().length > 0) {\r\n <ul class=\"x-upload-files\">\r\n @for (file of files(); track file; let i = $index) {\r\n <li [class.x-upload-disabled]=\"!download()\">\r\n @if (download()) {\r\n <a [href]=\"file.url\" target=\"_blank\" [title]=\"file.name\">\r\n <x-icon type=\"fto-file-text\"></x-icon>\r\n <span class=\"x-upload-filename\">{{ file.name }}</span>\r\n </a>\r\n } @else {\r\n <a>\r\n <x-icon type=\"fto-file-text\"></x-icon>\r\n <span class=\"x-upload-filename\">{{ file.name }}</span>\r\n </a>\r\n }\r\n\r\n @switch (file.state) {\r\n @case ('ready') {\r\n <x-icon class=\"x-upload-state\" type=\"fto-clock\"></x-icon>\r\n }\r\n @case ('uploading') {\r\n <span class=\"x-upload-percent\">{{ file.percent }}%</span>\r\n }\r\n @case ('success') {\r\n <x-icon class=\"x-upload-state success\" type=\"fto-check\"></x-icon>\r\n }\r\n @case ('error') {\r\n <x-icon class=\"x-upload-state error\" type=\"fto-info\"></x-icon>\r\n }\r\n }\r\n @if (file.state !== 'uploading') {\r\n <x-button icon=\"fto-x\" (click)=\"remove(file, i)\" closable onlyIcon flat size=\"mini\"></x-button>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </ng-container>\r\n }\r\n @case ('img') {\r\n <x-image-group>\r\n @for (file of files(); track file; let i = $index) {\r\n <x-image\r\n [src]=\"file.url\"\r\n (load)=\"imgLoad(file)\"\r\n (error)=\"imgError($event, file)\"\r\n class=\"{{ file.state }}\"\r\n [previewTpl]=\"previewTpl\"\r\n [fallback]=\"imgFallback()\"\r\n >\r\n </x-image>\r\n <ng-template #previewTpl let-image=\"$image\">\r\n @if (file.state == 'uploading') {\r\n <div class=\"x-upload-uploading\">\r\n <x-progress [percent]=\"file.percent!\" info=\"false\"></x-progress>\r\n </div>\r\n }\r\n <div class=\"x-image-overlay\">\r\n @switch (file.state) {\r\n @case ('ready') {\r\n <x-icon class=\"x-upload-state\" type=\"fto-clock\"></x-icon>\r\n }\r\n @case ('success') {\r\n <x-icon type=\"fto-eye\" (click)=\"image.onPreview()\"></x-icon>\r\n }\r\n }\r\n @if (imgCut() && file.state === 'success') {\r\n <x-icon type=\"fto-crop\" (click)=\"onImgCut(file, i)\"></x-icon>\r\n }\r\n @if (file.state !== 'uploading') {\r\n <x-icon type=\"fto-trash-2\" (click)=\"remove(file, i)\"></x-icon>\r\n }\r\n </div>\r\n </ng-template>\r\n }\r\n <ng-container *ngTemplateOutlet=\"uploadBtnTpl\"></ng-container>\r\n </x-image-group>\r\n }\r\n }\r\n</div>\r\n\r\n<ng-template #uploadBtnTpl>\r\n @if (showDrop()) {\r\n <x-drag-overlay\r\n class=\"x-upload-drag-overlay\"\r\n (click)=\"uploadClick()\"\r\n [icon]=\"dropIcon()\"\r\n [title]=\"dropTitle()\"\r\n [description]=\"dropDescription()\"\r\n ></x-drag-overlay>\r\n } @else {\r\n <div class=\"x-upload-buttons\" [class.x-upload-buttons-template]=\"isTemplateText()\" (click)=\"uploadClick()\">\r\n <ng-container *xOutlet=\"getText()\">\r\n <x-button icon=\"fto-upload\" class=\"x-upload-text\" [disabled]=\"disabledComputed()\" type=\"primary\">{{\r\n getText()\r\n }}</x-button>\r\n </ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".x-upload{margin:0;padding:0}.x-upload{color:var(--x-text);font-size:var(--x-font-size)}.x-upload-buttons{display:inline-flex}.x-upload-buttons>.x-button:not(:first-child){margin-left:.4rem}.x-upload-buttons-template{cursor:pointer}.x-upload-files{padding:0;margin:.4rem 0 0;list-style:none}.x-upload-files>li{margin:0;padding:0 .2rem;height:calc(var(--x-font-size) + .6rem);line-height:calc(var(--x-font-size) + .6rem);display:flex;align-items:center;overflow:hidden;cursor:pointer;border-radius:var(--x-border-radius)}.x-upload-files>li .x-icon{color:var(--x-text-400);font-size:1rem}.x-upload-files>li .x-icon.x-upload-state.success{color:var(--x-success)}.x-upload-files>li .x-icon.x-upload-state.error{color:var(--x-danger)}.x-upload-files>li a{flex:1;display:flex;align-items:center;height:calc(var(--x-font-size) + .6rem);line-height:calc(var(--x-font-size) + .6rem);color:inherit;text-decoration:none;overflow:hidden}.x-upload-files>li span.x-upload-filename{margin-left:.2rem;flex:1;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.x-upload-files>li span.x-upload-percent{color:var(--x-text-400)}.x-upload-files>li>.x-button{display:none;padding:0}.x-upload-files>li:not(:first-child){margin-top:.2rem}.x-upload-files>li.x-upload-disabled{cursor:default}.x-upload-files>li.x-upload-disabled>a{cursor:default}.x-upload-files>li:hover:not(.x-upload-disabled){color:var(--x-primary);background-color:var(--x-background)}.x-upload-files>li:hover>.x-button{display:inline-block}.x-upload-files>li:hover>.x-upload-state{display:none}.x-upload-img{display:flex;flex-wrap:wrap}.x-upload-img .x-upload-buttons-template{display:inline-flex;align-items:center;justify-content:center;flex-direction:column;width:6.25rem;height:6.25rem;margin-right:.5rem;margin-bottom:.5rem;border:var(--x-border-width) dashed var(--x-border);background:var(--x-background);border-radius:var(--x-border-radius);transition:border-color var(--x-animation-duration-base)}.x-upload-img .x-upload-buttons-template:hover{border-color:var(--x-primary)}.x-upload-img .x-image{height:6.25rem;width:6.25rem;padding:.325rem;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);transition:border-color var(--x-animation-duration-base);margin-right:.5rem;margin-bottom:.5rem;position:relative;display:flex;align-items:center;justify-content:center}.x-upload-img .x-image-overlay{border-radius:var(--x-border-radius)}.x-upload-img .x-image-overlay x-icon{font-size:1rem;color:#fffc;padding:.25rem;transition:color var(--x-animation-duration-base)}.x-upload-img .x-image-overlay x-icon:hover{color:#fff}.x-upload-img x-image.error .x-image{border-color:var(--x-danger)}.x-upload-img x-image.error .x-image-error-icon{color:var(--x-danger)}.x-upload-uploading{position:absolute;margin-top:3rem;width:calc(100% - 1rem)}.x-upload-show-drop{position:relative;display:block;width:100%;height:100%}.x-upload-drag-overlay .x-drag-overlay{border:var(--x-border-width) dashed var(--x-border);cursor:pointer;transition:all var(--x-animation-duration-base)}.x-upload-drag-overlay .x-drag-overlay:hover,.x-upload-drag-over .x-drag-overlay{border-color:var(--x-primary)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }, { kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XButtonComponent, selector: "x-button" }, { kind: "component", type: XImageGroupComponent, selector: "x-image-group" }, { kind: "component", type: XImageComponent, selector: "x-image" }, { kind: "component", type: XProgressComponent, selector: "x-progress" }, { kind: "component", type: XDragOverlayComponent, selector: "x-drag-overlay", inputs: ["icon", "title", "description"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
519
712
|
}
|
|
520
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadComponent, decorators: [{
|
|
521
714
|
type: Component,
|
|
522
715
|
args: [{ selector: `${XUploadPrefix}`, imports: [
|
|
523
716
|
NgTemplateOutlet,
|
|
@@ -526,16 +719,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
526
719
|
XButtonComponent,
|
|
527
720
|
XImageGroupComponent,
|
|
528
721
|
XImageComponent,
|
|
529
|
-
XProgressComponent
|
|
530
|
-
|
|
531
|
-
}],
|
|
722
|
+
XProgressComponent,
|
|
723
|
+
XDragOverlayComponent
|
|
724
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [XValueAccessor(XUploadComponent), XDragOverlayService], template: "<div #upload class=\"x-upload x-upload-{{ type() }}\" [class.x-disabled]=\"disabledComputed()\">\r\n <input\r\n class=\"x-upload-input\"\r\n type=\"file\"\r\n #file\r\n (change)=\"change($event)\"\r\n [attr.accept]=\"acceptSignal()\"\r\n [multiple]=\"multiple()\"\r\n style=\"display: none\"\r\n />\r\n\r\n @switch (type()) {\r\n @case ('list') {\r\n <ng-container *ngTemplateOutlet=\"uploadBtnTpl\"></ng-container>\r\n <ng-container *xOutlet=\"filesTpl(); context: { $files: files() }\">\r\n @if (files() && files().length > 0) {\r\n <ul class=\"x-upload-files\">\r\n @for (file of files(); track file; let i = $index) {\r\n <li [class.x-upload-disabled]=\"!download()\">\r\n @if (download()) {\r\n <a [href]=\"file.url\" target=\"_blank\" [title]=\"file.name\">\r\n <x-icon type=\"fto-file-text\"></x-icon>\r\n <span class=\"x-upload-filename\">{{ file.name }}</span>\r\n </a>\r\n } @else {\r\n <a>\r\n <x-icon type=\"fto-file-text\"></x-icon>\r\n <span class=\"x-upload-filename\">{{ file.name }}</span>\r\n </a>\r\n }\r\n\r\n @switch (file.state) {\r\n @case ('ready') {\r\n <x-icon class=\"x-upload-state\" type=\"fto-clock\"></x-icon>\r\n }\r\n @case ('uploading') {\r\n <span class=\"x-upload-percent\">{{ file.percent }}%</span>\r\n }\r\n @case ('success') {\r\n <x-icon class=\"x-upload-state success\" type=\"fto-check\"></x-icon>\r\n }\r\n @case ('error') {\r\n <x-icon class=\"x-upload-state error\" type=\"fto-info\"></x-icon>\r\n }\r\n }\r\n @if (file.state !== 'uploading') {\r\n <x-button icon=\"fto-x\" (click)=\"remove(file, i)\" closable onlyIcon flat size=\"mini\"></x-button>\r\n }\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </ng-container>\r\n }\r\n @case ('img') {\r\n <x-image-group>\r\n @for (file of files(); track file; let i = $index) {\r\n <x-image\r\n [src]=\"file.url\"\r\n (load)=\"imgLoad(file)\"\r\n (error)=\"imgError($event, file)\"\r\n class=\"{{ file.state }}\"\r\n [previewTpl]=\"previewTpl\"\r\n [fallback]=\"imgFallback()\"\r\n >\r\n </x-image>\r\n <ng-template #previewTpl let-image=\"$image\">\r\n @if (file.state == 'uploading') {\r\n <div class=\"x-upload-uploading\">\r\n <x-progress [percent]=\"file.percent!\" info=\"false\"></x-progress>\r\n </div>\r\n }\r\n <div class=\"x-image-overlay\">\r\n @switch (file.state) {\r\n @case ('ready') {\r\n <x-icon class=\"x-upload-state\" type=\"fto-clock\"></x-icon>\r\n }\r\n @case ('success') {\r\n <x-icon type=\"fto-eye\" (click)=\"image.onPreview()\"></x-icon>\r\n }\r\n }\r\n @if (imgCut() && file.state === 'success') {\r\n <x-icon type=\"fto-crop\" (click)=\"onImgCut(file, i)\"></x-icon>\r\n }\r\n @if (file.state !== 'uploading') {\r\n <x-icon type=\"fto-trash-2\" (click)=\"remove(file, i)\"></x-icon>\r\n }\r\n </div>\r\n </ng-template>\r\n }\r\n <ng-container *ngTemplateOutlet=\"uploadBtnTpl\"></ng-container>\r\n </x-image-group>\r\n }\r\n }\r\n</div>\r\n\r\n<ng-template #uploadBtnTpl>\r\n @if (showDrop()) {\r\n <x-drag-overlay\r\n class=\"x-upload-drag-overlay\"\r\n (click)=\"uploadClick()\"\r\n [icon]=\"dropIcon()\"\r\n [title]=\"dropTitle()\"\r\n [description]=\"dropDescription()\"\r\n ></x-drag-overlay>\r\n } @else {\r\n <div class=\"x-upload-buttons\" [class.x-upload-buttons-template]=\"isTemplateText()\" (click)=\"uploadClick()\">\r\n <ng-container *xOutlet=\"getText()\">\r\n <x-button icon=\"fto-upload\" class=\"x-upload-text\" [disabled]=\"disabledComputed()\" type=\"primary\">{{\r\n getText()\r\n }}</x-button>\r\n </ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".x-upload{margin:0;padding:0}.x-upload{color:var(--x-text);font-size:var(--x-font-size)}.x-upload-buttons{display:inline-flex}.x-upload-buttons>.x-button:not(:first-child){margin-left:.4rem}.x-upload-buttons-template{cursor:pointer}.x-upload-files{padding:0;margin:.4rem 0 0;list-style:none}.x-upload-files>li{margin:0;padding:0 .2rem;height:calc(var(--x-font-size) + .6rem);line-height:calc(var(--x-font-size) + .6rem);display:flex;align-items:center;overflow:hidden;cursor:pointer;border-radius:var(--x-border-radius)}.x-upload-files>li .x-icon{color:var(--x-text-400);font-size:1rem}.x-upload-files>li .x-icon.x-upload-state.success{color:var(--x-success)}.x-upload-files>li .x-icon.x-upload-state.error{color:var(--x-danger)}.x-upload-files>li a{flex:1;display:flex;align-items:center;height:calc(var(--x-font-size) + .6rem);line-height:calc(var(--x-font-size) + .6rem);color:inherit;text-decoration:none;overflow:hidden}.x-upload-files>li span.x-upload-filename{margin-left:.2rem;flex:1;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.x-upload-files>li span.x-upload-percent{color:var(--x-text-400)}.x-upload-files>li>.x-button{display:none;padding:0}.x-upload-files>li:not(:first-child){margin-top:.2rem}.x-upload-files>li.x-upload-disabled{cursor:default}.x-upload-files>li.x-upload-disabled>a{cursor:default}.x-upload-files>li:hover:not(.x-upload-disabled){color:var(--x-primary);background-color:var(--x-background)}.x-upload-files>li:hover>.x-button{display:inline-block}.x-upload-files>li:hover>.x-upload-state{display:none}.x-upload-img{display:flex;flex-wrap:wrap}.x-upload-img .x-upload-buttons-template{display:inline-flex;align-items:center;justify-content:center;flex-direction:column;width:6.25rem;height:6.25rem;margin-right:.5rem;margin-bottom:.5rem;border:var(--x-border-width) dashed var(--x-border);background:var(--x-background);border-radius:var(--x-border-radius);transition:border-color var(--x-animation-duration-base)}.x-upload-img .x-upload-buttons-template:hover{border-color:var(--x-primary)}.x-upload-img .x-image{height:6.25rem;width:6.25rem;padding:.325rem;border:var(--x-border-width) var(--x-border-style) var(--x-border);border-radius:var(--x-border-radius);transition:border-color var(--x-animation-duration-base);margin-right:.5rem;margin-bottom:.5rem;position:relative;display:flex;align-items:center;justify-content:center}.x-upload-img .x-image-overlay{border-radius:var(--x-border-radius)}.x-upload-img .x-image-overlay x-icon{font-size:1rem;color:#fffc;padding:.25rem;transition:color var(--x-animation-duration-base)}.x-upload-img .x-image-overlay x-icon:hover{color:#fff}.x-upload-img x-image.error .x-image{border-color:var(--x-danger)}.x-upload-img x-image.error .x-image-error-icon{color:var(--x-danger)}.x-upload-uploading{position:absolute;margin-top:3rem;width:calc(100% - 1rem)}.x-upload-show-drop{position:relative;display:block;width:100%;height:100%}.x-upload-drag-overlay .x-drag-overlay{border:var(--x-border-width) dashed var(--x-border);cursor:pointer;transition:all var(--x-animation-duration-base)}.x-upload-drag-overlay .x-drag-overlay:hover,.x-upload-drag-over .x-drag-overlay{border-color:var(--x-primary)}\n"] }]
|
|
725
|
+
}], ctorParameters: () => [], propDecorators: { getShowDrop: [{
|
|
726
|
+
type: HostBinding,
|
|
727
|
+
args: ['class.x-upload-show-drop']
|
|
728
|
+
}], file: [{ type: i0.ViewChild, args: ['file', { isSignal: true }] }] } });
|
|
532
729
|
|
|
533
730
|
class XUploadModule {
|
|
534
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
535
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
536
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
731
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
732
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.5", ngImport: i0, type: XUploadModule, imports: [XUploadComponent], exports: [XUploadComponent] }); }
|
|
733
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadModule, imports: [XUploadComponent] }); }
|
|
537
734
|
}
|
|
538
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XUploadModule, decorators: [{
|
|
539
736
|
type: NgModule,
|
|
540
737
|
args: [{
|
|
541
738
|
exports: [XUploadComponent],
|