@progress/kendo-angular-upload 16.3.0-develop.1 → 16.3.0-develop.11
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/common/base.d.ts +161 -0
- package/common/util.d.ts +1 -1
- package/esm2020/common/base.mjs +247 -0
- package/esm2020/common/util.mjs +1 -1
- package/esm2020/fileselect.component.mjs +36 -204
- package/esm2020/navigation.service.mjs +23 -34
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/rendering/file-list-item-action-button.component.mjs +50 -103
- package/esm2020/rendering/file-list-item.mjs +5 -5
- package/esm2020/rendering/file-list.component.mjs +22 -7
- package/esm2020/upload.component.mjs +23 -212
- package/fesm2015/progress-kendo-angular-upload.mjs +406 -576
- package/fesm2020/progress-kendo-angular-upload.mjs +406 -576
- package/fileselect.component.d.ts +17 -114
- package/navigation.service.d.ts +4 -3
- package/package.json +7 -7
- package/rendering/file-list-item-action-button.component.d.ts +0 -5
- package/rendering/file-list.component.d.ts +1 -0
- package/schematics/ngAdd/index.js +3 -3
- package/upload.component.d.ts +13 -120
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
6
|
import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { EventEmitter, Injectable, Directive,
|
|
8
|
+
import { EventEmitter, Injectable, Directive, ElementRef, ContentChild, ViewChild, Input, HostBinding, Output, Inject, HostListener, Component, ViewChildren, forwardRef, isDevMode, NgModule } from '@angular/core';
|
|
9
9
|
import { guid, Keys, isControlRequired, isDocumentAvailable, KendoInput, isChanged } from '@progress/kendo-angular-common';
|
|
10
10
|
import { fileAudioIcon, fileVideoIcon, fileImageIcon, fileTxtIcon, filePresentationIcon, fileDataIcon, fileProgrammingIcon, filePdfIcon, fileConfigIcon, fileZipIcon, fileDiscImageIcon, arrowRotateCwSmallIcon, playSmIcon, pauseSmIcon, cancelIcon, xIcon, copyIcon, fileIcon, checkIcon, exclamationCircleIcon, uploadIcon } from '@progress/kendo-svg-icons';
|
|
11
|
-
import {
|
|
11
|
+
import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
12
12
|
import * as i1$1 from '@progress/kendo-angular-l10n';
|
|
13
13
|
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
14
14
|
import { fromEvent, merge } from 'rxjs';
|
|
@@ -827,7 +827,7 @@ const IGNORE_TARGET_CLASSES = 'k-icon k-select k-input k-multiselect-wrap';
|
|
|
827
827
|
/**
|
|
828
828
|
* @hidden
|
|
829
829
|
*/
|
|
830
|
-
const UPLOAD_CLASSES = 'k-upload-button k-clear-selected k-upload-selected k-upload-action';
|
|
830
|
+
const UPLOAD_CLASSES = 'k-upload-button k-clear-selected k-upload-selected k-upload-action k-file';
|
|
831
831
|
const isVisible = (element) => {
|
|
832
832
|
const rect = element.getBoundingClientRect();
|
|
833
833
|
return !!(rect.width && rect.height) && window.getComputedStyle(element).visibility !== 'hidden';
|
|
@@ -1340,7 +1340,9 @@ class NavigationService {
|
|
|
1340
1340
|
this.onWrapperFocus = new EventEmitter();
|
|
1341
1341
|
this.onSelectButtonFocus = new EventEmitter();
|
|
1342
1342
|
this.actionButtonsVisible = false;
|
|
1343
|
+
this.fileListVisible = false;
|
|
1343
1344
|
this.focused = false;
|
|
1345
|
+
this.focusedFileIndex = 0;
|
|
1344
1346
|
this._focusedIndex = -1;
|
|
1345
1347
|
}
|
|
1346
1348
|
action(event) {
|
|
@@ -1359,9 +1361,9 @@ class NavigationService {
|
|
|
1359
1361
|
[Keys.Enter]: () => this.handleEnter(),
|
|
1360
1362
|
[Keys.Escape]: () => this.handleEscape(),
|
|
1361
1363
|
[Keys.Delete]: () => this.handleDelete(),
|
|
1362
|
-
[Keys.Tab]: (event, component) => this.handleTab(event
|
|
1363
|
-
[Keys.ArrowUp]: (event) => this.
|
|
1364
|
-
[Keys.ArrowDown]: (event) => this.
|
|
1364
|
+
[Keys.Tab]: (event, component) => this.handleTab(event, component),
|
|
1365
|
+
[Keys.ArrowUp]: (event) => this.handleUpDown(event, -1),
|
|
1366
|
+
[Keys.ArrowDown]: (event) => this.handleUpDown(event, 1)
|
|
1365
1367
|
};
|
|
1366
1368
|
}
|
|
1367
1369
|
focusSelectButton() {
|
|
@@ -1389,10 +1391,13 @@ class NavigationService {
|
|
|
1389
1391
|
this.zone.run(() => this.onFileAction.emit(Keys.Escape));
|
|
1390
1392
|
}
|
|
1391
1393
|
}
|
|
1392
|
-
handleTab(
|
|
1394
|
+
handleTab(event, component) {
|
|
1395
|
+
const shifted = event.shiftKey;
|
|
1393
1396
|
/* Select Files button is focused */
|
|
1394
|
-
if (this.focusedIndex === -1 && this.
|
|
1395
|
-
this.focusedIndex = this.
|
|
1397
|
+
if (this.focusedIndex === -1 && this.fileListVisible && !shifted) {
|
|
1398
|
+
this.focusedIndex = this.focusedFileIndex;
|
|
1399
|
+
event.preventDefault();
|
|
1400
|
+
this.onFileFocus.emit(this.focusedFileIndex);
|
|
1396
1401
|
return;
|
|
1397
1402
|
}
|
|
1398
1403
|
/* File in the list is focused */
|
|
@@ -1407,7 +1412,11 @@ class NavigationService {
|
|
|
1407
1412
|
}
|
|
1408
1413
|
/* Clear button is focused */
|
|
1409
1414
|
if (this.focusedIndex === this.lastFileIndex + 1) {
|
|
1410
|
-
this.focusedIndex = shifted ?
|
|
1415
|
+
this.focusedIndex = shifted ? this.focusedFileIndex : this.lastIndex;
|
|
1416
|
+
if (shifted) {
|
|
1417
|
+
event.preventDefault();
|
|
1418
|
+
this.onFileFocus.emit(this.focusedFileIndex);
|
|
1419
|
+
}
|
|
1411
1420
|
return;
|
|
1412
1421
|
}
|
|
1413
1422
|
/* Upload button is focused */
|
|
@@ -1417,35 +1426,15 @@ class NavigationService {
|
|
|
1417
1426
|
}
|
|
1418
1427
|
this.onTabOut.emit();
|
|
1419
1428
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1429
|
+
handleUpDown(event, direction) {
|
|
1430
|
+
const focusOnFileList = this.focusedIndex > -1 && this.uploadService.files.count >= 0;
|
|
1431
|
+
const nextFocusableIndexInBoundaries = direction > 0 ? this.focusedFileIndex < this.lastFileIndex : this.focusedFileIndex > 0;
|
|
1432
|
+
const focusNextFile = focusOnFileList && nextFocusableIndexInBoundaries;
|
|
1433
|
+
if (focusNextFile) {
|
|
1422
1434
|
event.preventDefault();
|
|
1423
1435
|
this.zone.run(() => {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1427
|
-
return;
|
|
1428
|
-
}
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
handleUp(event) {
|
|
1433
|
-
if (this.lastIndex >= 0 && this.focusedIndex > -1) {
|
|
1434
|
-
event.preventDefault();
|
|
1435
|
-
this.zone.run(() => {
|
|
1436
|
-
this.focusedIndex -= 1;
|
|
1437
|
-
if (this.focusedIndex === -1) {
|
|
1438
|
-
this.onSelectButtonFocus.emit();
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
if (this.focusedIndex <= this.lastFileIndex) {
|
|
1442
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
if (this.actionButtonsVisible && this.focusedIndex <= this.lastIndex) {
|
|
1446
|
-
this.focusedIndex = this.lastFileIndex;
|
|
1447
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1448
|
-
}
|
|
1436
|
+
this.focusedIndex += direction;
|
|
1437
|
+
this.focusedFileIndex += direction;
|
|
1449
1438
|
});
|
|
1450
1439
|
}
|
|
1451
1440
|
}
|
|
@@ -1509,8 +1498,8 @@ const packageMetadata = {
|
|
|
1509
1498
|
name: '@progress/kendo-angular-upload',
|
|
1510
1499
|
productName: 'Kendo UI for Angular',
|
|
1511
1500
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
1512
|
-
publishDate:
|
|
1513
|
-
version: '16.3.0-develop.
|
|
1501
|
+
publishDate: 1718783866,
|
|
1502
|
+
version: '16.3.0-develop.11',
|
|
1514
1503
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
1515
1504
|
};
|
|
1516
1505
|
|
|
@@ -1548,6 +1537,240 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1548
1537
|
}]
|
|
1549
1538
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
1550
1539
|
|
|
1540
|
+
/**
|
|
1541
|
+
* @hidden
|
|
1542
|
+
*/
|
|
1543
|
+
class UploadFileSelectBase {
|
|
1544
|
+
constructor(uploadService, navigation, cdr, injector, zone) {
|
|
1545
|
+
this.uploadService = uploadService;
|
|
1546
|
+
this.navigation = navigation;
|
|
1547
|
+
this.cdr = cdr;
|
|
1548
|
+
this.injector = injector;
|
|
1549
|
+
this.zone = zone;
|
|
1550
|
+
/**
|
|
1551
|
+
* Disables the component.
|
|
1552
|
+
*
|
|
1553
|
+
* @default false
|
|
1554
|
+
*/
|
|
1555
|
+
this.disabled = false;
|
|
1556
|
+
/**
|
|
1557
|
+
* Enables the selection of multiple files
|
|
1558
|
+
* If set to `false`, only one file can be selected at a time.
|
|
1559
|
+
* @default true
|
|
1560
|
+
*/
|
|
1561
|
+
this.multiple = true;
|
|
1562
|
+
/**
|
|
1563
|
+
* Toggles the visibility of the file list.
|
|
1564
|
+
* @default true
|
|
1565
|
+
*/
|
|
1566
|
+
this.showFileList = true;
|
|
1567
|
+
/**
|
|
1568
|
+
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
1569
|
+
* @default 0
|
|
1570
|
+
*/
|
|
1571
|
+
this.tabindex = 0;
|
|
1572
|
+
/**
|
|
1573
|
+
* @hidden
|
|
1574
|
+
*/
|
|
1575
|
+
this.focusableId = `k-${guid()}`;
|
|
1576
|
+
/**
|
|
1577
|
+
* @hidden
|
|
1578
|
+
*/
|
|
1579
|
+
this.hostDefaultClasses = true;
|
|
1580
|
+
/**
|
|
1581
|
+
* Fires when the user navigates outside the component.
|
|
1582
|
+
*/
|
|
1583
|
+
this.onBlur = new EventEmitter();
|
|
1584
|
+
/**
|
|
1585
|
+
* Fires when the component is focused.
|
|
1586
|
+
*/
|
|
1587
|
+
this.onFocus = new EventEmitter();
|
|
1588
|
+
/**
|
|
1589
|
+
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
1590
|
+
*/
|
|
1591
|
+
this.select = new EventEmitter();
|
|
1592
|
+
/**
|
|
1593
|
+
* Fires when a file is about to be removed. If prevented, the file will remain in the list.
|
|
1594
|
+
*/
|
|
1595
|
+
this.remove = new EventEmitter();
|
|
1596
|
+
/**
|
|
1597
|
+
* @hidden
|
|
1598
|
+
*/
|
|
1599
|
+
this._restrictions = {
|
|
1600
|
+
allowedExtensions: [],
|
|
1601
|
+
maxFileSize: 0,
|
|
1602
|
+
minFileSize: 0
|
|
1603
|
+
};
|
|
1604
|
+
this.onTouchedCallback = (_) => { };
|
|
1605
|
+
this.onChangeCallback = (_) => { };
|
|
1606
|
+
this.fileList = this.uploadService.files;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Sets the restrictions for selected files.
|
|
1610
|
+
*/
|
|
1611
|
+
set restrictions(restrictions) {
|
|
1612
|
+
const parsedRestrictions = Object.assign({}, this.restrictions, restrictions);
|
|
1613
|
+
this._restrictions = parsedRestrictions;
|
|
1614
|
+
}
|
|
1615
|
+
get restrictions() {
|
|
1616
|
+
return this._restrictions;
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* @hidden
|
|
1620
|
+
*/
|
|
1621
|
+
get hostDisabledClass() {
|
|
1622
|
+
return this.disabled;
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* @hidden
|
|
1626
|
+
*/
|
|
1627
|
+
get formControl() {
|
|
1628
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
1629
|
+
return (ngControl === null || ngControl === void 0 ? void 0 : ngControl.control) || null;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* @hidden
|
|
1633
|
+
*/
|
|
1634
|
+
get isControlRequired() {
|
|
1635
|
+
return isControlRequired(this.formControl);
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* @hidden
|
|
1639
|
+
*/
|
|
1640
|
+
get hasFileList() {
|
|
1641
|
+
const hasFileList = this.showFileList && this.fileList.count > 0;
|
|
1642
|
+
this.navigation.fileListVisible = hasFileList;
|
|
1643
|
+
return hasFileList;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* @hidden
|
|
1647
|
+
*/
|
|
1648
|
+
writeValue(newValue, validation, callback) {
|
|
1649
|
+
let isValid = true;
|
|
1650
|
+
if (newValue instanceof Array) {
|
|
1651
|
+
newValue.forEach((file) => {
|
|
1652
|
+
if (!validation(file)) {
|
|
1653
|
+
isValid = false;
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
if (isValid) {
|
|
1657
|
+
this.uploadService[callback](newValue);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
if (newValue === null) {
|
|
1661
|
+
this.fileList.clear();
|
|
1662
|
+
}
|
|
1663
|
+
this.cdr.markForCheck();
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* @hidden
|
|
1667
|
+
*/
|
|
1668
|
+
registerOnChange(fn) {
|
|
1669
|
+
this.onChangeCallback = fn;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* @hidden
|
|
1673
|
+
*/
|
|
1674
|
+
registerOnTouched(fn) {
|
|
1675
|
+
this.onTouchedCallback = fn;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* @hidden
|
|
1679
|
+
*/
|
|
1680
|
+
setDisabledState(isDisabled) {
|
|
1681
|
+
this.disabled = isDisabled;
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* @hidden
|
|
1685
|
+
*/
|
|
1686
|
+
onFileSelectButtonFocus() {
|
|
1687
|
+
if (!this.navigation.focused) {
|
|
1688
|
+
this.navigation.focusedIndex = -1;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Focuses the component's `Select files` button.
|
|
1693
|
+
*/
|
|
1694
|
+
focus() {
|
|
1695
|
+
this.zone.runOutsideAngular(() => {
|
|
1696
|
+
setTimeout(() => {
|
|
1697
|
+
this.fileSelectButton.nativeElement.focus();
|
|
1698
|
+
this.navigation.focused = true;
|
|
1699
|
+
});
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* @hidden
|
|
1704
|
+
* @deprecated
|
|
1705
|
+
*/
|
|
1706
|
+
focusComponent() {
|
|
1707
|
+
this.focus();
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Blurs the component if it was previously focused.
|
|
1711
|
+
*/
|
|
1712
|
+
blur() {
|
|
1713
|
+
if (this.navigation.focused) {
|
|
1714
|
+
this.navigation.focused = false;
|
|
1715
|
+
document.activeElement.blur();
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* @hidden
|
|
1720
|
+
* @deprecated
|
|
1721
|
+
*/
|
|
1722
|
+
blurComponent() {
|
|
1723
|
+
this.blur();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
UploadFileSelectBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UploadFileSelectBase, deps: [{ token: UploadService }, { token: NavigationService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1727
|
+
UploadFileSelectBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: UploadFileSelectBase, inputs: { accept: "accept", disabled: "disabled", multiple: "multiple", showFileList: "showFileList", tabindex: "tabindex", restrictions: "restrictions", zoneId: "zoneId", focusableId: "focusableId" }, outputs: { onBlur: "blur", onFocus: "focus", select: "select", remove: "remove" }, host: { properties: { "class.k-upload": "this.hostDefaultClasses", "class.k-disabled": "this.hostDisabledClass" } }, queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true }, { propertyName: "fileInfoTemplate", first: true, predicate: FileInfoTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "fileSelectButton", first: true, predicate: ["fileSelectButton"], descendants: true, read: ElementRef, static: true }], ngImport: i0 });
|
|
1728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UploadFileSelectBase, decorators: [{
|
|
1729
|
+
type: Directive,
|
|
1730
|
+
args: [{}]
|
|
1731
|
+
}], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: i0.NgZone }]; }, propDecorators: { fileTemplate: [{
|
|
1732
|
+
type: ContentChild,
|
|
1733
|
+
args: [FileTemplateDirective]
|
|
1734
|
+
}], fileInfoTemplate: [{
|
|
1735
|
+
type: ContentChild,
|
|
1736
|
+
args: [FileInfoTemplateDirective]
|
|
1737
|
+
}], fileSelectButton: [{
|
|
1738
|
+
type: ViewChild,
|
|
1739
|
+
args: ['fileSelectButton', { static: true, read: ElementRef }]
|
|
1740
|
+
}], accept: [{
|
|
1741
|
+
type: Input
|
|
1742
|
+
}], disabled: [{
|
|
1743
|
+
type: Input
|
|
1744
|
+
}], multiple: [{
|
|
1745
|
+
type: Input
|
|
1746
|
+
}], showFileList: [{
|
|
1747
|
+
type: Input
|
|
1748
|
+
}], tabindex: [{
|
|
1749
|
+
type: Input
|
|
1750
|
+
}], restrictions: [{
|
|
1751
|
+
type: Input
|
|
1752
|
+
}], zoneId: [{
|
|
1753
|
+
type: Input
|
|
1754
|
+
}], focusableId: [{
|
|
1755
|
+
type: Input
|
|
1756
|
+
}], hostDefaultClasses: [{
|
|
1757
|
+
type: HostBinding,
|
|
1758
|
+
args: ['class.k-upload']
|
|
1759
|
+
}], hostDisabledClass: [{
|
|
1760
|
+
type: HostBinding,
|
|
1761
|
+
args: ['class.k-disabled']
|
|
1762
|
+
}], onBlur: [{
|
|
1763
|
+
type: Output,
|
|
1764
|
+
args: ['blur']
|
|
1765
|
+
}], onFocus: [{
|
|
1766
|
+
type: Output,
|
|
1767
|
+
args: ['focus']
|
|
1768
|
+
}], select: [{
|
|
1769
|
+
type: Output
|
|
1770
|
+
}], remove: [{
|
|
1771
|
+
type: Output
|
|
1772
|
+
}] } });
|
|
1773
|
+
|
|
1551
1774
|
/**
|
|
1552
1775
|
* @hidden
|
|
1553
1776
|
*/
|
|
@@ -1775,7 +1998,7 @@ class FileListItemDirective {
|
|
|
1775
1998
|
return this.files[0].uid;
|
|
1776
1999
|
}
|
|
1777
2000
|
get tabIndex() {
|
|
1778
|
-
return
|
|
2001
|
+
return this.navigationService.focusedFileIndex === this.index ? '0' : '-1';
|
|
1779
2002
|
}
|
|
1780
2003
|
get kFileError() {
|
|
1781
2004
|
return this.files[0].state === FileState.Failed;
|
|
@@ -1804,8 +2027,8 @@ class FileListItemDirective {
|
|
|
1804
2027
|
this.focused = false;
|
|
1805
2028
|
}
|
|
1806
2029
|
onClick(event) {
|
|
1807
|
-
if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
|
|
1808
|
-
this.navigationService.focusedIndex = this.index;
|
|
2030
|
+
if ((!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) || !!event.target.closest('.k-upload-action')) {
|
|
2031
|
+
this.navigationService.focusedIndex = this.navigationService.focusedFileIndex = this.index;
|
|
1809
2032
|
}
|
|
1810
2033
|
}
|
|
1811
2034
|
}
|
|
@@ -1846,10 +2069,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1846
2069
|
args: ['class.k-focus']
|
|
1847
2070
|
}], onFocus: [{
|
|
1848
2071
|
type: HostListener,
|
|
1849
|
-
args: [
|
|
2072
|
+
args: ['focus']
|
|
1850
2073
|
}], onBlur: [{
|
|
1851
2074
|
type: HostListener,
|
|
1852
|
-
args: [
|
|
2075
|
+
args: ['blur']
|
|
1853
2076
|
}], onClick: [{
|
|
1854
2077
|
type: HostListener,
|
|
1855
2078
|
args: ['click', ['$event']]
|
|
@@ -1904,37 +2127,12 @@ class FileListItemActionButtonComponent {
|
|
|
1904
2127
|
this.uploadService = uploadService;
|
|
1905
2128
|
this.localization = localization;
|
|
1906
2129
|
this.navigation = navigation;
|
|
1907
|
-
this.actionFocused = false;
|
|
1908
|
-
this.retryFocused = false;
|
|
1909
|
-
this.pauseResumeFocused = false;
|
|
1910
2130
|
this.retrySVGIcon = arrowRotateCwSmallIcon;
|
|
1911
2131
|
this.playSVGIcon = playSmIcon;
|
|
1912
2132
|
this.pauseSVGIcon = pauseSmIcon;
|
|
1913
2133
|
this.cancelSVGIcon = cancelIcon;
|
|
1914
2134
|
this.deleteSVGIcon = xIcon;
|
|
1915
2135
|
}
|
|
1916
|
-
onFocus(type) {
|
|
1917
|
-
if (type === 'action') {
|
|
1918
|
-
this.actionFocused = true;
|
|
1919
|
-
}
|
|
1920
|
-
if (type === 'retry') {
|
|
1921
|
-
this.retryFocused = true;
|
|
1922
|
-
}
|
|
1923
|
-
if (type === 'pauseResume') {
|
|
1924
|
-
this.pauseResumeFocused = true;
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
onBlur(type) {
|
|
1928
|
-
if (type === 'retry') {
|
|
1929
|
-
this.retryFocused = false;
|
|
1930
|
-
}
|
|
1931
|
-
if (type === 'action') {
|
|
1932
|
-
this.actionFocused = false;
|
|
1933
|
-
}
|
|
1934
|
-
if (type === 'pauseResume') {
|
|
1935
|
-
this.pauseResumeFocused = false;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
2136
|
onRetryClick() {
|
|
1939
2137
|
if (this.disabled) {
|
|
1940
2138
|
return;
|
|
@@ -2012,64 +2210,50 @@ FileListItemActionButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion
|
|
|
2012
2210
|
|
|
2013
2211
|
<button
|
|
2014
2212
|
*ngIf="isFailed"
|
|
2213
|
+
kendoButton
|
|
2015
2214
|
type="button"
|
|
2016
|
-
class="k-
|
|
2017
|
-
|
|
2215
|
+
class="k-upload-action k-retry"
|
|
2216
|
+
fillMode="flat"
|
|
2018
2217
|
[attr.tabIndex]="-1"
|
|
2019
2218
|
[attr.aria-hidden]="true"
|
|
2020
|
-
|
|
2021
|
-
|
|
2219
|
+
[attr.title]="retryButtonTitle"
|
|
2220
|
+
[svgIcon]="retrySVGIcon"
|
|
2221
|
+
icon="refresh-sm"
|
|
2222
|
+
(pointerdown)="$event.preventDefault()"
|
|
2022
2223
|
(click)="onRetryClick()"
|
|
2023
|
-
>
|
|
2024
|
-
<kendo-icon-wrapper
|
|
2025
|
-
name="refresh-sm"
|
|
2026
|
-
[svgIcon]="retrySVGIcon"
|
|
2027
|
-
innerCssClass="k-retry"
|
|
2028
|
-
[attr.aria-label]="retryButtonTitle"
|
|
2029
|
-
[attr.title]="retryButtonTitle"
|
|
2030
|
-
></kendo-icon-wrapper>
|
|
2031
|
-
</button>
|
|
2224
|
+
></button>
|
|
2032
2225
|
|
|
2033
2226
|
<button
|
|
2034
2227
|
*ngIf="isResumable"
|
|
2228
|
+
kendoButton
|
|
2035
2229
|
type="button"
|
|
2036
|
-
class="k-
|
|
2037
|
-
|
|
2230
|
+
class="k-upload-action"
|
|
2231
|
+
fillMode="flat"
|
|
2038
2232
|
[attr.tabIndex]="-1"
|
|
2039
2233
|
[attr.aria-hidden]="true"
|
|
2040
|
-
|
|
2041
|
-
|
|
2234
|
+
[attr.title]="pauseResumeButtonTitle"
|
|
2235
|
+
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2236
|
+
[icon]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2237
|
+
(pointerdown)="$event.preventDefault()"
|
|
2042
2238
|
(click)="onPauseResumeClick()"
|
|
2043
|
-
>
|
|
2044
|
-
<kendo-icon-wrapper
|
|
2045
|
-
[name]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2046
|
-
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2047
|
-
[attr.aria-label]='pauseResumeButtonTitle'
|
|
2048
|
-
[attr.title]='pauseResumeButtonTitle'
|
|
2049
|
-
></kendo-icon-wrapper>
|
|
2050
|
-
</button>
|
|
2239
|
+
></button>
|
|
2051
2240
|
|
|
2052
2241
|
<button
|
|
2053
2242
|
*ngIf="isActionButtonVisible"
|
|
2054
|
-
|
|
2243
|
+
kendoButton
|
|
2244
|
+
class="k-upload-action"
|
|
2245
|
+
[class.k-delete]="!isUploading"
|
|
2246
|
+
fillMode="flat"
|
|
2055
2247
|
type="button"
|
|
2056
2248
|
[attr.tabIndex]="-1"
|
|
2057
2249
|
[attr.aria-hidden]="true"
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
[
|
|
2250
|
+
[attr.title]="actionButtonTitle"
|
|
2251
|
+
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2252
|
+
[icon]="isUploading ? 'cancel' : 'x'"
|
|
2061
2253
|
(click)="onRemoveCancelClick($event)"
|
|
2062
|
-
>
|
|
2063
|
-
<kendo-icon-wrapper
|
|
2064
|
-
[name]="isUploading ? 'cancel' : 'x'"
|
|
2065
|
-
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2066
|
-
[innerCssClass]="!isUploading ? 'k-delete' : ''"
|
|
2067
|
-
[attr.aria-label]='actionButtonTitle'
|
|
2068
|
-
[attr.title]='actionButtonTitle'
|
|
2069
|
-
></kendo-icon-wrapper>
|
|
2070
|
-
</button>
|
|
2254
|
+
></button>
|
|
2071
2255
|
</span>
|
|
2072
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i3.
|
|
2256
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i10.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
2073
2257
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileListItemActionButtonComponent, decorators: [{
|
|
2074
2258
|
type: Component,
|
|
2075
2259
|
args: [{
|
|
@@ -2080,62 +2264,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2080
2264
|
|
|
2081
2265
|
<button
|
|
2082
2266
|
*ngIf="isFailed"
|
|
2267
|
+
kendoButton
|
|
2083
2268
|
type="button"
|
|
2084
|
-
class="k-
|
|
2085
|
-
|
|
2269
|
+
class="k-upload-action k-retry"
|
|
2270
|
+
fillMode="flat"
|
|
2086
2271
|
[attr.tabIndex]="-1"
|
|
2087
2272
|
[attr.aria-hidden]="true"
|
|
2088
|
-
|
|
2089
|
-
|
|
2273
|
+
[attr.title]="retryButtonTitle"
|
|
2274
|
+
[svgIcon]="retrySVGIcon"
|
|
2275
|
+
icon="refresh-sm"
|
|
2276
|
+
(pointerdown)="$event.preventDefault()"
|
|
2090
2277
|
(click)="onRetryClick()"
|
|
2091
|
-
>
|
|
2092
|
-
<kendo-icon-wrapper
|
|
2093
|
-
name="refresh-sm"
|
|
2094
|
-
[svgIcon]="retrySVGIcon"
|
|
2095
|
-
innerCssClass="k-retry"
|
|
2096
|
-
[attr.aria-label]="retryButtonTitle"
|
|
2097
|
-
[attr.title]="retryButtonTitle"
|
|
2098
|
-
></kendo-icon-wrapper>
|
|
2099
|
-
</button>
|
|
2278
|
+
></button>
|
|
2100
2279
|
|
|
2101
2280
|
<button
|
|
2102
2281
|
*ngIf="isResumable"
|
|
2282
|
+
kendoButton
|
|
2103
2283
|
type="button"
|
|
2104
|
-
class="k-
|
|
2105
|
-
|
|
2284
|
+
class="k-upload-action"
|
|
2285
|
+
fillMode="flat"
|
|
2106
2286
|
[attr.tabIndex]="-1"
|
|
2107
2287
|
[attr.aria-hidden]="true"
|
|
2108
|
-
|
|
2109
|
-
|
|
2288
|
+
[attr.title]="pauseResumeButtonTitle"
|
|
2289
|
+
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2290
|
+
[icon]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2291
|
+
(pointerdown)="$event.preventDefault()"
|
|
2110
2292
|
(click)="onPauseResumeClick()"
|
|
2111
|
-
>
|
|
2112
|
-
<kendo-icon-wrapper
|
|
2113
|
-
[name]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2114
|
-
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2115
|
-
[attr.aria-label]='pauseResumeButtonTitle'
|
|
2116
|
-
[attr.title]='pauseResumeButtonTitle'
|
|
2117
|
-
></kendo-icon-wrapper>
|
|
2118
|
-
</button>
|
|
2293
|
+
></button>
|
|
2119
2294
|
|
|
2120
2295
|
<button
|
|
2121
2296
|
*ngIf="isActionButtonVisible"
|
|
2122
|
-
|
|
2297
|
+
kendoButton
|
|
2298
|
+
class="k-upload-action"
|
|
2299
|
+
[class.k-delete]="!isUploading"
|
|
2300
|
+
fillMode="flat"
|
|
2123
2301
|
type="button"
|
|
2124
2302
|
[attr.tabIndex]="-1"
|
|
2125
2303
|
[attr.aria-hidden]="true"
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
[
|
|
2304
|
+
[attr.title]="actionButtonTitle"
|
|
2305
|
+
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2306
|
+
[icon]="isUploading ? 'cancel' : 'x'"
|
|
2129
2307
|
(click)="onRemoveCancelClick($event)"
|
|
2130
|
-
>
|
|
2131
|
-
<kendo-icon-wrapper
|
|
2132
|
-
[name]="isUploading ? 'cancel' : 'x'"
|
|
2133
|
-
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2134
|
-
[innerCssClass]="!isUploading ? 'k-delete' : ''"
|
|
2135
|
-
[attr.aria-label]='actionButtonTitle'
|
|
2136
|
-
[attr.title]='actionButtonTitle'
|
|
2137
|
-
></kendo-icon-wrapper>
|
|
2138
|
-
</button>
|
|
2308
|
+
></button>
|
|
2139
2309
|
</span>
|
|
2140
2310
|
`
|
|
2141
2311
|
}]
|
|
@@ -2485,6 +2655,7 @@ class FileListComponent {
|
|
|
2485
2655
|
constructor(uploadService, navigation) {
|
|
2486
2656
|
this.uploadService = uploadService;
|
|
2487
2657
|
this.navigation = navigation;
|
|
2658
|
+
this.fileListRole = 'list';
|
|
2488
2659
|
this.onItemFocus();
|
|
2489
2660
|
this.onItemAction();
|
|
2490
2661
|
}
|
|
@@ -2500,7 +2671,9 @@ class FileListComponent {
|
|
|
2500
2671
|
}
|
|
2501
2672
|
itemActionHandler(key) {
|
|
2502
2673
|
const index = this.navigation.focusedIndex;
|
|
2503
|
-
const
|
|
2674
|
+
const filesArray = this.fileListItems.toArray();
|
|
2675
|
+
const numberOfFiles = filesArray.length;
|
|
2676
|
+
const item = filesArray[index];
|
|
2504
2677
|
const uid = item.uidAttribute;
|
|
2505
2678
|
const files = this.uploadService.files.get(uid);
|
|
2506
2679
|
if (key === Keys.Escape && files[0].state === FileState.Uploading) {
|
|
@@ -2519,7 +2692,16 @@ class FileListComponent {
|
|
|
2519
2692
|
else if (this.hasDelete(item)) {
|
|
2520
2693
|
this.uploadService.removeFiles(uid);
|
|
2521
2694
|
}
|
|
2522
|
-
|
|
2695
|
+
if (index < numberOfFiles - 1) {
|
|
2696
|
+
filesArray[index + 1].focus();
|
|
2697
|
+
}
|
|
2698
|
+
else if (numberOfFiles === 1) {
|
|
2699
|
+
this.navigation.focusSelectButton();
|
|
2700
|
+
}
|
|
2701
|
+
else if (index === numberOfFiles - 1) {
|
|
2702
|
+
this.navigation.focusedIndex = this.navigation.focusedFileIndex = index - 1;
|
|
2703
|
+
filesArray[index - 1].focus();
|
|
2704
|
+
}
|
|
2523
2705
|
}
|
|
2524
2706
|
const isUploadChunk = this.uploadService.async.chunk;
|
|
2525
2707
|
const canTogglePauseResume = key === Keys.Space && files[0].state !== FileState.Uploaded;
|
|
@@ -2533,7 +2715,7 @@ class FileListComponent {
|
|
|
2533
2715
|
}
|
|
2534
2716
|
}
|
|
2535
2717
|
hasDelete(item) {
|
|
2536
|
-
return item.element.nativeElement.getElementsByClassName('k-
|
|
2718
|
+
return item.element.nativeElement.getElementsByClassName('k-svg-i-x').length > 0;
|
|
2537
2719
|
}
|
|
2538
2720
|
ngOnDestroy() {
|
|
2539
2721
|
this.focusSubscription.unsubscribe();
|
|
@@ -2541,12 +2723,12 @@ class FileListComponent {
|
|
|
2541
2723
|
}
|
|
2542
2724
|
}
|
|
2543
2725
|
FileListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileListComponent, deps: [{ token: UploadService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2544
|
-
FileListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FileListComponent, selector: "[kendo-upload-file-list]", inputs: { disabled: "disabled", fileList: "fileList", fileTemplate: "fileTemplate", fileInfoTemplate: "fileInfoTemplate" }, viewQueries: [{ propertyName: "fileListItems", predicate: FileListItemDirective, descendants: true }], ngImport: i0, template: `
|
|
2726
|
+
FileListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FileListComponent, selector: "[kendo-upload-file-list]", inputs: { disabled: "disabled", fileList: "fileList", fileTemplate: "fileTemplate", fileInfoTemplate: "fileInfoTemplate" }, host: { properties: { "attr.role": "this.fileListRole" } }, viewQueries: [{ propertyName: "fileListItems", predicate: FileListItemDirective, descendants: true }], ngImport: i0, template: `
|
|
2545
2727
|
<ng-template ngFor
|
|
2546
2728
|
[ngForOf]="fileList"
|
|
2547
2729
|
let-files
|
|
2548
2730
|
let-index="index">
|
|
2549
|
-
<li kendoUploadFileListItem [files]='files' [index]='index'>
|
|
2731
|
+
<li kendoUploadFileListItem [files]='files' [index]='index' role="listitem">
|
|
2550
2732
|
<kendo-upload-file-list-single-item
|
|
2551
2733
|
class='k-file-single'
|
|
2552
2734
|
*ngIf='files.length === 1 && !fileTemplate'
|
|
@@ -2577,7 +2759,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2577
2759
|
[ngForOf]="fileList"
|
|
2578
2760
|
let-files
|
|
2579
2761
|
let-index="index">
|
|
2580
|
-
<li kendoUploadFileListItem [files]='files' [index]='index'>
|
|
2762
|
+
<li kendoUploadFileListItem [files]='files' [index]='index' role="listitem">
|
|
2581
2763
|
<kendo-upload-file-list-single-item
|
|
2582
2764
|
class='k-file-single'
|
|
2583
2765
|
*ngIf='files.length === 1 && !fileTemplate'
|
|
@@ -2611,6 +2793,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2611
2793
|
}], fileListItems: [{
|
|
2612
2794
|
type: ViewChildren,
|
|
2613
2795
|
args: [FileListItemDirective]
|
|
2796
|
+
}], fileListRole: [{
|
|
2797
|
+
type: HostBinding,
|
|
2798
|
+
args: ['attr.role']
|
|
2614
2799
|
}] } });
|
|
2615
2800
|
|
|
2616
2801
|
/**
|
|
@@ -2823,8 +3008,9 @@ const FILESELECT_VALUE_ACCESSOR = {
|
|
|
2823
3008
|
useExisting: forwardRef(() => FileSelectComponent)
|
|
2824
3009
|
};
|
|
2825
3010
|
let idx$1 = 0;
|
|
2826
|
-
class FileSelectComponent {
|
|
3011
|
+
class FileSelectComponent extends UploadFileSelectBase {
|
|
2827
3012
|
constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper, injector) {
|
|
3013
|
+
super(uploadService, navigation, cdr, injector, ngZone);
|
|
2828
3014
|
this.uploadService = uploadService;
|
|
2829
3015
|
this.localization = localization;
|
|
2830
3016
|
this.navigation = navigation;
|
|
@@ -2833,54 +3019,10 @@ class FileSelectComponent {
|
|
|
2833
3019
|
this.renderer = renderer;
|
|
2834
3020
|
this.cdr = cdr;
|
|
2835
3021
|
this.injector = injector;
|
|
2836
|
-
/**
|
|
2837
|
-
* Disables the FileSelect.
|
|
2838
|
-
* To learn how to disable the component in reactive forms, refer to the article on [Forms Support](slug:formssupport_fileselect#toc-managing-the-fileselect-disabled-state-in-reactive-forms).
|
|
2839
|
-
* @default false
|
|
2840
|
-
*/
|
|
2841
|
-
this.disabled = false;
|
|
2842
|
-
/**
|
|
2843
|
-
* Enables the selection of multiple files
|
|
2844
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
|
|
2845
|
-
* If set to `false`, only one file can be selected at a time.
|
|
2846
|
-
* @default true
|
|
2847
|
-
*/
|
|
2848
|
-
this.multiple = true;
|
|
2849
|
-
/**
|
|
2850
|
-
* Toggles the visibility of the file list.
|
|
2851
|
-
* @default true
|
|
2852
|
-
*/
|
|
2853
|
-
this.showFileList = true;
|
|
2854
|
-
/**
|
|
2855
|
-
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
|
|
2856
|
-
* @default 0
|
|
2857
|
-
*/
|
|
2858
|
-
this.tabindex = 0;
|
|
2859
|
-
/**
|
|
2860
|
-
* @hidden
|
|
2861
|
-
*/
|
|
2862
|
-
this.focusableId = `k-${guid()}`;
|
|
2863
|
-
/**
|
|
2864
|
-
* Fires when the user navigates outside the component.
|
|
2865
|
-
*/
|
|
2866
|
-
this.onBlur = new EventEmitter();
|
|
2867
|
-
/**
|
|
2868
|
-
* Fires when the component is focused.
|
|
2869
|
-
*/
|
|
2870
|
-
this.onFocus = new EventEmitter();
|
|
2871
|
-
/**
|
|
2872
|
-
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
2873
|
-
*/
|
|
2874
|
-
this.select = new EventEmitter();
|
|
2875
|
-
/**
|
|
2876
|
-
* Fires when a file is about to be removed. If prevented, the file will remain in the list.
|
|
2877
|
-
*/
|
|
2878
|
-
this.remove = new EventEmitter();
|
|
2879
3022
|
/**
|
|
2880
3023
|
* Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
|
|
2881
3024
|
*/
|
|
2882
3025
|
this.valueChange = new EventEmitter();
|
|
2883
|
-
this.hostDefaultClasses = true;
|
|
2884
3026
|
/**
|
|
2885
3027
|
* @hidden
|
|
2886
3028
|
*/
|
|
@@ -2889,13 +3031,10 @@ class FileSelectComponent {
|
|
|
2889
3031
|
maxFileSize: 0,
|
|
2890
3032
|
minFileSize: 0
|
|
2891
3033
|
};
|
|
2892
|
-
this.onTouchedCallback = (_) => { };
|
|
2893
|
-
this.onChangeCallback = (_) => { };
|
|
2894
3034
|
validatePackage(packageMetadata);
|
|
2895
3035
|
this.wrapper = wrapper.nativeElement;
|
|
2896
3036
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
2897
3037
|
this.navigation.computeKeys();
|
|
2898
|
-
this.fileList = this.uploadService.files;
|
|
2899
3038
|
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
|
|
2900
3039
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
2901
3040
|
});
|
|
@@ -2904,6 +3043,9 @@ class FileSelectComponent {
|
|
|
2904
3043
|
this.attachEventHandlers();
|
|
2905
3044
|
this.setDefaultSettings();
|
|
2906
3045
|
}
|
|
3046
|
+
get dir() {
|
|
3047
|
+
return this.direction;
|
|
3048
|
+
}
|
|
2907
3049
|
/**
|
|
2908
3050
|
* Sets the `name` attribute of the `input` element of the FileSelect.
|
|
2909
3051
|
*/
|
|
@@ -2913,42 +3055,10 @@ class FileSelectComponent {
|
|
|
2913
3055
|
get name() {
|
|
2914
3056
|
return this.uploadService.async.saveField;
|
|
2915
3057
|
}
|
|
2916
|
-
/**
|
|
2917
|
-
* Sets the restrictions for selected files.
|
|
2918
|
-
*/
|
|
2919
|
-
set restrictions(restrictions) {
|
|
2920
|
-
const parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
|
|
2921
|
-
this._restrictions = parsedRestrictions;
|
|
2922
|
-
}
|
|
2923
|
-
get restrictions() {
|
|
2924
|
-
return this._restrictions;
|
|
2925
|
-
}
|
|
2926
|
-
get hostDisabledClass() {
|
|
2927
|
-
return this.disabled;
|
|
2928
|
-
}
|
|
2929
|
-
get dir() {
|
|
2930
|
-
return this.direction;
|
|
2931
|
-
}
|
|
2932
|
-
get hostRole() {
|
|
2933
|
-
return 'application';
|
|
2934
|
-
}
|
|
2935
|
-
/**
|
|
2936
|
-
* @hidden
|
|
2937
|
-
*/
|
|
2938
|
-
get formControl() {
|
|
2939
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
2940
|
-
return (ngControl === null || ngControl === void 0 ? void 0 : ngControl.control) || null;
|
|
2941
|
-
}
|
|
2942
|
-
/**
|
|
2943
|
-
* @hidden
|
|
2944
|
-
*/
|
|
2945
|
-
get isControlRequired() {
|
|
2946
|
-
return isControlRequired(this.formControl);
|
|
2947
|
-
}
|
|
2948
3058
|
ngOnInit() {
|
|
2949
|
-
const { buttonId,
|
|
3059
|
+
const { buttonId, fileListId } = this.getIds();
|
|
2950
3060
|
this.focusableId = buttonId;
|
|
2951
|
-
this.
|
|
3061
|
+
this.fileListId = fileListId;
|
|
2952
3062
|
if (this.zoneId) {
|
|
2953
3063
|
this.dropZoneService.addComponent(this, this.zoneId);
|
|
2954
3064
|
}
|
|
@@ -2966,80 +3076,24 @@ class FileSelectComponent {
|
|
|
2966
3076
|
* @hidden
|
|
2967
3077
|
*/
|
|
2968
3078
|
textFor(key) {
|
|
2969
|
-
return this.localization.get(key);
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
this.
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
this.
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
this.wrapperFocusSubscription.unsubscribe();
|
|
2988
|
-
}
|
|
2989
|
-
if (this.selectButtonFocusSubscription) {
|
|
2990
|
-
this.selectButtonFocusSubscription.unsubscribe();
|
|
2991
|
-
}
|
|
2992
|
-
if (this.localizationChangeSubscription) {
|
|
2993
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
2994
|
-
}
|
|
2995
|
-
if (this.subs) {
|
|
2996
|
-
this.subs.unsubscribe();
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
/**
|
|
3000
|
-
* @hidden
|
|
3001
|
-
*/
|
|
3002
|
-
writeValue(newValue) {
|
|
3003
|
-
let isValid = true;
|
|
3004
|
-
if (newValue instanceof Array) {
|
|
3005
|
-
newValue.forEach((file) => {
|
|
3006
|
-
if (!validateInitialFileSelectFile(file)) {
|
|
3007
|
-
isValid = false;
|
|
3008
|
-
}
|
|
3009
|
-
});
|
|
3010
|
-
if (isValid) {
|
|
3011
|
-
this.uploadService.addInitialFileSelectFiles(newValue);
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
if (newValue === null) {
|
|
3015
|
-
this.fileList.clear();
|
|
3016
|
-
}
|
|
3017
|
-
this.cdr.markForCheck();
|
|
3018
|
-
}
|
|
3019
|
-
/**
|
|
3020
|
-
* @hidden
|
|
3021
|
-
*/
|
|
3022
|
-
registerOnChange(fn) {
|
|
3023
|
-
this.onChangeCallback = fn;
|
|
3024
|
-
}
|
|
3025
|
-
/**
|
|
3026
|
-
* @hidden
|
|
3027
|
-
*/
|
|
3028
|
-
registerOnTouched(fn) {
|
|
3029
|
-
this.onTouchedCallback = fn;
|
|
3030
|
-
}
|
|
3031
|
-
/**
|
|
3032
|
-
* @hidden
|
|
3033
|
-
*/
|
|
3034
|
-
setDisabledState(isDisabled) {
|
|
3035
|
-
this.disabled = isDisabled;
|
|
3036
|
-
}
|
|
3037
|
-
/**
|
|
3038
|
-
* @hidden
|
|
3039
|
-
*/
|
|
3040
|
-
onFileSelectButtonFocus() {
|
|
3041
|
-
if (!this.navigation.focused) {
|
|
3042
|
-
this.navigation.focusedIndex = -1;
|
|
3079
|
+
return this.localization.get(key);
|
|
3080
|
+
}
|
|
3081
|
+
ngOnDestroy() {
|
|
3082
|
+
this.fileList.clear();
|
|
3083
|
+
if (this.blurSubscription) {
|
|
3084
|
+
this.blurSubscription.unsubscribe();
|
|
3085
|
+
}
|
|
3086
|
+
if (this.wrapperFocusSubscription) {
|
|
3087
|
+
this.wrapperFocusSubscription.unsubscribe();
|
|
3088
|
+
}
|
|
3089
|
+
if (this.selectButtonFocusSubscription) {
|
|
3090
|
+
this.selectButtonFocusSubscription.unsubscribe();
|
|
3091
|
+
}
|
|
3092
|
+
if (this.localizationChangeSubscription) {
|
|
3093
|
+
this.localizationChangeSubscription.unsubscribe();
|
|
3094
|
+
}
|
|
3095
|
+
if (this.subs) {
|
|
3096
|
+
this.subs.unsubscribe();
|
|
3043
3097
|
}
|
|
3044
3098
|
}
|
|
3045
3099
|
/**
|
|
@@ -3080,8 +3134,14 @@ class FileSelectComponent {
|
|
|
3080
3134
|
getIds() {
|
|
3081
3135
|
const id = ++idx$1;
|
|
3082
3136
|
const buttonId = `k-fileselect-button-${id}`;
|
|
3083
|
-
const
|
|
3084
|
-
return { buttonId,
|
|
3137
|
+
const fileListId = `k-fileselect-file-list-${id}`;
|
|
3138
|
+
return { buttonId, fileListId };
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* @hidden
|
|
3142
|
+
*/
|
|
3143
|
+
writeValue(newValue) {
|
|
3144
|
+
super.writeValue(newValue, validateInitialFileSelectFile, 'addInitialFileSelectFiles');
|
|
3085
3145
|
}
|
|
3086
3146
|
subscribeBlur() {
|
|
3087
3147
|
if (!isDocumentAvailable()) {
|
|
@@ -3156,7 +3216,7 @@ class FileSelectComponent {
|
|
|
3156
3216
|
}
|
|
3157
3217
|
}
|
|
3158
3218
|
FileSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileSelectComponent, deps: [{ token: UploadService }, { token: i1$1.LocalizationService }, { token: NavigationService }, { token: DropZoneService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
3159
|
-
FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FileSelectComponent, selector: "kendo-fileselect", inputs: {
|
|
3219
|
+
FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FileSelectComponent, selector: "kendo-fileselect", inputs: { name: "name" }, outputs: { valueChange: "valueChange" }, host: { properties: { "attr.dir": "this.dir" } }, providers: [
|
|
3160
3220
|
LocalizationService,
|
|
3161
3221
|
NavigationService,
|
|
3162
3222
|
UploadService,
|
|
@@ -3170,7 +3230,7 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3170
3230
|
provide: KendoInput,
|
|
3171
3231
|
useExisting: forwardRef(() => FileSelectComponent)
|
|
3172
3232
|
}
|
|
3173
|
-
],
|
|
3233
|
+
], viewQueries: [{ propertyName: "fileSelectInput", first: true, predicate: ["fileSelectInput"], descendants: true, static: true }], exportAs: ["kendoFileSelect"], usesInheritance: true, ngImport: i0, template: `
|
|
3174
3234
|
<ng-container kendoFileSelectLocalizedMessages
|
|
3175
3235
|
i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
|
|
3176
3236
|
dropFilesHere="Drop files here to select"
|
|
@@ -3207,12 +3267,12 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3207
3267
|
[id]="focusableId"
|
|
3208
3268
|
[attr.aria-label]="textFor('select')"
|
|
3209
3269
|
[attr.tabindex]="tabindex"
|
|
3210
|
-
[attr.aria-
|
|
3270
|
+
[attr.aria-expanded]="hasFileList"
|
|
3271
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
3211
3272
|
>
|
|
3212
3273
|
{{textFor('select')}}
|
|
3213
3274
|
</button>
|
|
3214
3275
|
<input kendoFileSelect #fileSelectInput
|
|
3215
|
-
[id]="inputElementId"
|
|
3216
3276
|
[dir]="direction"
|
|
3217
3277
|
[accept]="accept"
|
|
3218
3278
|
[restrictions]="restrictions"
|
|
@@ -3225,11 +3285,12 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3225
3285
|
</div>
|
|
3226
3286
|
<ul kendo-upload-file-list
|
|
3227
3287
|
class="k-upload-files k-reset"
|
|
3228
|
-
*ngIf="
|
|
3288
|
+
*ngIf="hasFileList"
|
|
3229
3289
|
[disabled]="disabled"
|
|
3230
3290
|
[fileList]="fileList.files"
|
|
3231
3291
|
[fileTemplate]="fileTemplate"
|
|
3232
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
3292
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
3293
|
+
[id]="fileListId">
|
|
3233
3294
|
</ul>
|
|
3234
3295
|
`, isInline: true, dependencies: [{ kind: "directive", type: DropZoneInternalDirective, selector: "\n [kendoUploadInternalDropZone],\n [kendoFileSelectInternalDropZone]\n ", inputs: ["disabled", "multiple", "restrictions"] }, { kind: "component", type: FileListComponent, selector: "[kendo-upload-file-list]", inputs: ["disabled", "fileList", "fileTemplate", "fileInfoTemplate"] }, { kind: "directive", type: FileSelectDirective, selector: "[kendoFileSelect]", inputs: ["dir", "disabled", "multiple", "restrictions", "accept", "required"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n " }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i10.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
3235
3296
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileSelectComponent, decorators: [{
|
|
@@ -3289,12 +3350,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3289
3350
|
[id]="focusableId"
|
|
3290
3351
|
[attr.aria-label]="textFor('select')"
|
|
3291
3352
|
[attr.tabindex]="tabindex"
|
|
3292
|
-
[attr.aria-
|
|
3353
|
+
[attr.aria-expanded]="hasFileList"
|
|
3354
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
3293
3355
|
>
|
|
3294
3356
|
{{textFor('select')}}
|
|
3295
3357
|
</button>
|
|
3296
3358
|
<input kendoFileSelect #fileSelectInput
|
|
3297
|
-
[id]="inputElementId"
|
|
3298
3359
|
[dir]="direction"
|
|
3299
3360
|
[accept]="accept"
|
|
3300
3361
|
[restrictions]="restrictions"
|
|
@@ -3307,68 +3368,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3307
3368
|
</div>
|
|
3308
3369
|
<ul kendo-upload-file-list
|
|
3309
3370
|
class="k-upload-files k-reset"
|
|
3310
|
-
*ngIf="
|
|
3371
|
+
*ngIf="hasFileList"
|
|
3311
3372
|
[disabled]="disabled"
|
|
3312
3373
|
[fileList]="fileList.files"
|
|
3313
3374
|
[fileTemplate]="fileTemplate"
|
|
3314
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
3375
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
3376
|
+
[id]="fileListId">
|
|
3315
3377
|
</ul>
|
|
3316
3378
|
`
|
|
3317
3379
|
}]
|
|
3318
|
-
}], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }, { type: DropZoneService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Injector }]; }, propDecorators: {
|
|
3319
|
-
type: Input
|
|
3320
|
-
}], disabled: [{
|
|
3321
|
-
type: Input
|
|
3322
|
-
}], multiple: [{
|
|
3323
|
-
type: Input
|
|
3324
|
-
}], name: [{
|
|
3325
|
-
type: Input
|
|
3326
|
-
}], showFileList: [{
|
|
3327
|
-
type: Input
|
|
3328
|
-
}], tabindex: [{
|
|
3329
|
-
type: Input
|
|
3330
|
-
}], restrictions: [{
|
|
3331
|
-
type: Input
|
|
3332
|
-
}], zoneId: [{
|
|
3333
|
-
type: Input
|
|
3334
|
-
}], focusableId: [{
|
|
3335
|
-
type: Input
|
|
3336
|
-
}], fileTemplate: [{
|
|
3337
|
-
type: ContentChild,
|
|
3338
|
-
args: [FileTemplateDirective]
|
|
3339
|
-
}], fileInfoTemplate: [{
|
|
3340
|
-
type: ContentChild,
|
|
3341
|
-
args: [FileInfoTemplateDirective]
|
|
3342
|
-
}], fileSelectInput: [{
|
|
3380
|
+
}], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }, { type: DropZoneService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Injector }]; }, propDecorators: { fileSelectInput: [{
|
|
3343
3381
|
type: ViewChild,
|
|
3344
3382
|
args: ['fileSelectInput', { static: true }]
|
|
3345
|
-
}], fileSelectButton: [{
|
|
3346
|
-
type: ViewChild,
|
|
3347
|
-
args: ['fileSelectButton', { static: true, read: ElementRef }]
|
|
3348
|
-
}], onBlur: [{
|
|
3349
|
-
type: Output,
|
|
3350
|
-
args: ['blur']
|
|
3351
|
-
}], onFocus: [{
|
|
3352
|
-
type: Output,
|
|
3353
|
-
args: ['focus']
|
|
3354
|
-
}], select: [{
|
|
3355
|
-
type: Output
|
|
3356
|
-
}], remove: [{
|
|
3357
|
-
type: Output
|
|
3358
|
-
}], valueChange: [{
|
|
3359
|
-
type: Output
|
|
3360
|
-
}], hostDefaultClasses: [{
|
|
3361
|
-
type: HostBinding,
|
|
3362
|
-
args: ['class.k-upload']
|
|
3363
|
-
}], hostDisabledClass: [{
|
|
3364
|
-
type: HostBinding,
|
|
3365
|
-
args: ['class.k-disabled']
|
|
3366
3383
|
}], dir: [{
|
|
3367
3384
|
type: HostBinding,
|
|
3368
3385
|
args: ['attr.dir']
|
|
3369
|
-
}],
|
|
3370
|
-
type:
|
|
3371
|
-
|
|
3386
|
+
}], name: [{
|
|
3387
|
+
type: Input
|
|
3388
|
+
}], valueChange: [{
|
|
3389
|
+
type: Output
|
|
3372
3390
|
}] } });
|
|
3373
3391
|
|
|
3374
3392
|
/**
|
|
@@ -3611,8 +3629,9 @@ let idx = 0;
|
|
|
3611
3629
|
/**
|
|
3612
3630
|
* Represents the [Kendo UI Upload component for Angular]({% slug overview_upload %}).
|
|
3613
3631
|
*/
|
|
3614
|
-
class UploadComponent {
|
|
3632
|
+
class UploadComponent extends UploadFileSelectBase {
|
|
3615
3633
|
constructor(uploadService, localization, navigation, dropZoneService, zone, renderer, cdr, wrapper, injector) {
|
|
3634
|
+
super(uploadService, navigation, cdr, injector, zone);
|
|
3616
3635
|
this.uploadService = uploadService;
|
|
3617
3636
|
this.localization = localization;
|
|
3618
3637
|
this.navigation = navigation;
|
|
@@ -3627,41 +3646,15 @@ class UploadComponent {
|
|
|
3627
3646
|
* @default false
|
|
3628
3647
|
*/
|
|
3629
3648
|
this.chunkable = false;
|
|
3630
|
-
/**
|
|
3631
|
-
* Enables the selection of multiple files
|
|
3632
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
|
|
3633
|
-
* If set to `false`, only one file can be selected at a time.
|
|
3634
|
-
* @default true
|
|
3635
|
-
*/
|
|
3636
|
-
this.multiple = true;
|
|
3637
|
-
/**
|
|
3638
|
-
* Disables the Upload ([see example]({% slug disabledstate_upload %})).
|
|
3639
|
-
* To learn how to disable the component in reactive forms, refer to the article on [Forms Support](slug:formssupport_upload#toc-managing-the-upload-disabled-state-in-reactive-forms).
|
|
3640
|
-
* @default false
|
|
3641
|
-
*/
|
|
3642
|
-
this.disabled = false;
|
|
3643
3649
|
/**
|
|
3644
3650
|
* Toggles the visibility of the file list.
|
|
3645
3651
|
* @default true
|
|
3646
3652
|
*/
|
|
3647
3653
|
this.showFileList = true;
|
|
3648
|
-
/**
|
|
3649
|
-
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
3650
|
-
* @default 0
|
|
3651
|
-
*/
|
|
3652
|
-
this.tabindex = 0;
|
|
3653
|
-
/**
|
|
3654
|
-
* @hidden
|
|
3655
|
-
*/
|
|
3656
|
-
this.focusableId = `k-${guid()}`;
|
|
3657
3654
|
/**
|
|
3658
3655
|
* Specifies the possible layout of the action buttons.
|
|
3659
3656
|
*/
|
|
3660
3657
|
this.actionsLayout = 'end';
|
|
3661
|
-
/**
|
|
3662
|
-
* Fires when the user navigates outside the component.
|
|
3663
|
-
*/
|
|
3664
|
-
this.onBlur = new EventEmitter();
|
|
3665
3658
|
/**
|
|
3666
3659
|
* Fires when the upload is canceled while in progress.
|
|
3667
3660
|
*/
|
|
@@ -3678,26 +3671,14 @@ class UploadComponent {
|
|
|
3678
3671
|
* Fires when an `upload` or `remove` operation has failed.
|
|
3679
3672
|
*/
|
|
3680
3673
|
this.error = new EventEmitter();
|
|
3681
|
-
/**
|
|
3682
|
-
* Fires when the component is focused.
|
|
3683
|
-
*/
|
|
3684
|
-
this.onFocus = new EventEmitter();
|
|
3685
3674
|
/**
|
|
3686
3675
|
* Fires when the upload of a file has been paused.
|
|
3687
3676
|
*/
|
|
3688
3677
|
this.pause = new EventEmitter();
|
|
3689
|
-
/**
|
|
3690
|
-
* Fires when an uploaded file is about to be removed. If prevented, the files will remain in the list.
|
|
3691
|
-
*/
|
|
3692
|
-
this.remove = new EventEmitter();
|
|
3693
3678
|
/**
|
|
3694
3679
|
* Fires when the upload of a file has been resumed.
|
|
3695
3680
|
*/
|
|
3696
3681
|
this.resume = new EventEmitter();
|
|
3697
|
-
/**
|
|
3698
|
-
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
3699
|
-
*/
|
|
3700
|
-
this.select = new EventEmitter();
|
|
3701
3682
|
/**
|
|
3702
3683
|
* Fires when an `upload` or `remove` operation is successfully completed.
|
|
3703
3684
|
*/
|
|
@@ -3714,17 +3695,6 @@ class UploadComponent {
|
|
|
3714
3695
|
* Fires when the value of the component has changed as a result of a successful `upload`, `remove` or `clear` operation.
|
|
3715
3696
|
*/
|
|
3716
3697
|
this.valueChange = new EventEmitter();
|
|
3717
|
-
this.hostDefaultClasses = true;
|
|
3718
|
-
/**
|
|
3719
|
-
* @hidden
|
|
3720
|
-
*/
|
|
3721
|
-
this._restrictions = {
|
|
3722
|
-
allowedExtensions: [],
|
|
3723
|
-
maxFileSize: 0,
|
|
3724
|
-
minFileSize: 0
|
|
3725
|
-
};
|
|
3726
|
-
this.onTouchedCallback = (_) => { };
|
|
3727
|
-
this.onChangeCallback = (_) => { };
|
|
3728
3698
|
validatePackage(packageMetadata);
|
|
3729
3699
|
this.fileList = this.uploadService.files;
|
|
3730
3700
|
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
|
|
@@ -3882,42 +3852,14 @@ class UploadComponent {
|
|
|
3882
3852
|
get tabIndex() {
|
|
3883
3853
|
return this.tabindex;
|
|
3884
3854
|
}
|
|
3885
|
-
/**
|
|
3886
|
-
* Sets the restrictions for selected files ([see example]({% slug api_upload_filerestrictions %})).
|
|
3887
|
-
*/
|
|
3888
|
-
set restrictions(restrictions) {
|
|
3889
|
-
const parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
|
|
3890
|
-
this._restrictions = parsedRestrictions;
|
|
3891
|
-
}
|
|
3892
|
-
get restrictions() {
|
|
3893
|
-
return this._restrictions;
|
|
3894
|
-
}
|
|
3895
|
-
get hostRole() {
|
|
3896
|
-
return 'application';
|
|
3897
|
-
}
|
|
3898
|
-
get hostDisabledClass() {
|
|
3899
|
-
return this.disabled;
|
|
3900
|
-
}
|
|
3901
3855
|
get dir() {
|
|
3902
3856
|
return this.direction;
|
|
3903
3857
|
}
|
|
3904
|
-
/**
|
|
3905
|
-
* @hidden
|
|
3906
|
-
*/
|
|
3907
|
-
get formControl() {
|
|
3908
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
3909
|
-
return (ngControl === null || ngControl === void 0 ? void 0 : ngControl.control) || null;
|
|
3910
|
-
}
|
|
3911
|
-
/**
|
|
3912
|
-
* @hidden
|
|
3913
|
-
*/
|
|
3914
|
-
get isControlRequired() {
|
|
3915
|
-
return isControlRequired(this.formControl);
|
|
3916
|
-
}
|
|
3917
3858
|
ngOnInit() {
|
|
3918
3859
|
this.verifySettings();
|
|
3919
|
-
const { buttonId } = this.getIds();
|
|
3860
|
+
const { buttonId, fileListId } = this.getIds();
|
|
3920
3861
|
this.focusableId = buttonId;
|
|
3862
|
+
this.fileListId = fileListId;
|
|
3921
3863
|
this.uploadService.setChunkSettings(this.chunkable);
|
|
3922
3864
|
if (this.zoneId) {
|
|
3923
3865
|
this.dropZoneService.addComponent(this, this.zoneId);
|
|
@@ -3960,47 +3902,7 @@ class UploadComponent {
|
|
|
3960
3902
|
* @hidden
|
|
3961
3903
|
*/
|
|
3962
3904
|
writeValue(newValue) {
|
|
3963
|
-
|
|
3964
|
-
if (newValue instanceof Array) {
|
|
3965
|
-
newValue.forEach((file) => {
|
|
3966
|
-
if (!validateInitialFileInfo(file)) {
|
|
3967
|
-
isValid = false;
|
|
3968
|
-
}
|
|
3969
|
-
});
|
|
3970
|
-
if (isValid) {
|
|
3971
|
-
this.uploadService.addInitialFiles(newValue);
|
|
3972
|
-
}
|
|
3973
|
-
}
|
|
3974
|
-
if (newValue === null) {
|
|
3975
|
-
this.fileList.clear();
|
|
3976
|
-
}
|
|
3977
|
-
this.cdr.markForCheck();
|
|
3978
|
-
}
|
|
3979
|
-
/**
|
|
3980
|
-
* @hidden
|
|
3981
|
-
*/
|
|
3982
|
-
registerOnChange(fn) {
|
|
3983
|
-
this.onChangeCallback = fn;
|
|
3984
|
-
}
|
|
3985
|
-
/**
|
|
3986
|
-
* @hidden
|
|
3987
|
-
*/
|
|
3988
|
-
registerOnTouched(fn) {
|
|
3989
|
-
this.onTouchedCallback = fn;
|
|
3990
|
-
}
|
|
3991
|
-
/**
|
|
3992
|
-
* @hidden
|
|
3993
|
-
*/
|
|
3994
|
-
setDisabledState(isDisabled) {
|
|
3995
|
-
this.disabled = isDisabled;
|
|
3996
|
-
}
|
|
3997
|
-
/**
|
|
3998
|
-
* @hidden
|
|
3999
|
-
*/
|
|
4000
|
-
onFileSelectButtonFocus() {
|
|
4001
|
-
if (!this.navigation.focused) {
|
|
4002
|
-
this.navigation.focusedIndex = -1;
|
|
4003
|
-
}
|
|
3905
|
+
super.writeValue(newValue, validateInitialFileInfo, 'addInitialFiles');
|
|
4004
3906
|
}
|
|
4005
3907
|
/**
|
|
4006
3908
|
* @hidden
|
|
@@ -4047,42 +3949,8 @@ class UploadComponent {
|
|
|
4047
3949
|
getIds() {
|
|
4048
3950
|
const id = ++idx;
|
|
4049
3951
|
const buttonId = `k-upload-button-${id}`;
|
|
4050
|
-
const
|
|
4051
|
-
return { buttonId,
|
|
4052
|
-
}
|
|
4053
|
-
/**
|
|
4054
|
-
* Focuses the underlying input element.
|
|
4055
|
-
*/
|
|
4056
|
-
focus() {
|
|
4057
|
-
setTimeout(() => {
|
|
4058
|
-
this.fileSelectButton.nativeElement.focus();
|
|
4059
|
-
this.navigation.focused = true;
|
|
4060
|
-
this.onFocus.emit();
|
|
4061
|
-
});
|
|
4062
|
-
}
|
|
4063
|
-
/**
|
|
4064
|
-
* @hidden
|
|
4065
|
-
* @deprecated
|
|
4066
|
-
*/
|
|
4067
|
-
focusComponent() {
|
|
4068
|
-
this.focus();
|
|
4069
|
-
}
|
|
4070
|
-
/**
|
|
4071
|
-
* Blurs the Upload if it was previously focused.
|
|
4072
|
-
*/
|
|
4073
|
-
blur() {
|
|
4074
|
-
if (this.navigation.focused) {
|
|
4075
|
-
this.navigation.focused = false;
|
|
4076
|
-
document.activeElement.blur();
|
|
4077
|
-
this.onBlur.emit();
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
/**
|
|
4081
|
-
* @hidden
|
|
4082
|
-
* @deprecated
|
|
4083
|
-
*/
|
|
4084
|
-
blurComponent() {
|
|
4085
|
-
this.blur();
|
|
3952
|
+
const fileListId = `k-upload-file-list-${id}`;
|
|
3953
|
+
return { buttonId, fileListId };
|
|
4086
3954
|
}
|
|
4087
3955
|
/**
|
|
4088
3956
|
* Pauses the upload process of a file that is currently uploading.
|
|
@@ -4240,7 +4108,7 @@ class UploadComponent {
|
|
|
4240
4108
|
}
|
|
4241
4109
|
}
|
|
4242
4110
|
UploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UploadComponent, deps: [{ token: UploadService }, { token: i1$1.LocalizationService }, { token: NavigationService }, { token: DropZoneService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
4243
|
-
UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: UploadComponent, selector: "kendo-upload", inputs: { autoUpload: "autoUpload", batch: "batch", withCredentials: "withCredentials", saveField: "saveField", saveHeaders: "saveHeaders", saveMethod: "saveMethod", saveUrl: "saveUrl", responseType: "responseType", removeField: "removeField", removeHeaders: "removeHeaders", removeMethod: "removeMethod", removeUrl: "removeUrl", chunkable: "chunkable", concurrent: "concurrent",
|
|
4111
|
+
UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: UploadComponent, selector: "kendo-upload", inputs: { autoUpload: "autoUpload", batch: "batch", withCredentials: "withCredentials", saveField: "saveField", saveHeaders: "saveHeaders", saveMethod: "saveMethod", saveUrl: "saveUrl", responseType: "responseType", removeField: "removeField", removeHeaders: "removeHeaders", removeMethod: "removeMethod", removeUrl: "removeUrl", chunkable: "chunkable", concurrent: "concurrent", showFileList: "showFileList", tabIndex: "tabIndex", actionsLayout: "actionsLayout" }, outputs: { cancel: "cancel", clear: "clear", complete: "complete", error: "error", pause: "pause", resume: "resume", success: "success", upload: "upload", uploadProgress: "uploadProgress", valueChange: "valueChange" }, host: { properties: { "attr.dir": "this.dir" } }, providers: [
|
|
4244
4112
|
LocalizationService,
|
|
4245
4113
|
NavigationService,
|
|
4246
4114
|
UploadService,
|
|
@@ -4254,7 +4122,7 @@ UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
4254
4122
|
provide: KendoInput,
|
|
4255
4123
|
useExisting: forwardRef(() => UploadComponent)
|
|
4256
4124
|
}
|
|
4257
|
-
],
|
|
4125
|
+
], viewQueries: [{ propertyName: "fileSelectInput", first: true, predicate: ["fileSelectInput"], descendants: true, static: true }], exportAs: ["kendoUpload"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
4258
4126
|
<ng-container kendoUploadLocalizedMessages
|
|
4259
4127
|
i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
|
|
4260
4128
|
cancel="Cancel"
|
|
@@ -4328,12 +4196,13 @@ UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
4328
4196
|
#fileSelectButton
|
|
4329
4197
|
class="k-upload-button"
|
|
4330
4198
|
type="button"
|
|
4331
|
-
role="button"
|
|
4332
4199
|
(click)="fileSelectInput.click()"
|
|
4333
4200
|
(focus)="onFileSelectButtonFocus()"
|
|
4334
4201
|
[id]="focusableId"
|
|
4335
4202
|
[attr.aria-label]="textFor('select')"
|
|
4336
4203
|
[attr.tabindex]="tabindex"
|
|
4204
|
+
[attr.aria-expanded]="hasFileList"
|
|
4205
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
4337
4206
|
>
|
|
4338
4207
|
{{textFor('select')}}
|
|
4339
4208
|
</button>
|
|
@@ -4351,12 +4220,13 @@ UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
4351
4220
|
</kendo-upload-status-total>
|
|
4352
4221
|
<div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
|
|
4353
4222
|
</div>
|
|
4354
|
-
<ul kendo-upload-file-list *ngIf="
|
|
4223
|
+
<ul kendo-upload-file-list *ngIf="hasFileList"
|
|
4355
4224
|
class="k-upload-files k-reset"
|
|
4356
4225
|
[disabled]="disabled"
|
|
4357
4226
|
[fileList]="fileList.files"
|
|
4358
4227
|
[fileTemplate]="fileTemplate"
|
|
4359
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
4228
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
4229
|
+
[id]="fileListId">
|
|
4360
4230
|
</ul>
|
|
4361
4231
|
<kendo-upload-action-buttons
|
|
4362
4232
|
*ngIf="showActionButtons"
|
|
@@ -4458,12 +4328,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4458
4328
|
#fileSelectButton
|
|
4459
4329
|
class="k-upload-button"
|
|
4460
4330
|
type="button"
|
|
4461
|
-
role="button"
|
|
4462
4331
|
(click)="fileSelectInput.click()"
|
|
4463
4332
|
(focus)="onFileSelectButtonFocus()"
|
|
4464
4333
|
[id]="focusableId"
|
|
4465
4334
|
[attr.aria-label]="textFor('select')"
|
|
4466
4335
|
[attr.tabindex]="tabindex"
|
|
4336
|
+
[attr.aria-expanded]="hasFileList"
|
|
4337
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
4467
4338
|
>
|
|
4468
4339
|
{{textFor('select')}}
|
|
4469
4340
|
</button>
|
|
@@ -4481,12 +4352,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4481
4352
|
</kendo-upload-status-total>
|
|
4482
4353
|
<div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
|
|
4483
4354
|
</div>
|
|
4484
|
-
<ul kendo-upload-file-list *ngIf="
|
|
4355
|
+
<ul kendo-upload-file-list *ngIf="hasFileList"
|
|
4485
4356
|
class="k-upload-files k-reset"
|
|
4486
4357
|
[disabled]="disabled"
|
|
4487
4358
|
[fileList]="fileList.files"
|
|
4488
4359
|
[fileTemplate]="fileTemplate"
|
|
4489
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
4360
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
4361
|
+
[id]="fileListId">
|
|
4490
4362
|
</ul>
|
|
4491
4363
|
<kendo-upload-action-buttons
|
|
4492
4364
|
*ngIf="showActionButtons"
|
|
@@ -4523,42 +4395,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4523
4395
|
type: Input
|
|
4524
4396
|
}], concurrent: [{
|
|
4525
4397
|
type: Input
|
|
4526
|
-
}], multiple: [{
|
|
4527
|
-
type: Input
|
|
4528
|
-
}], disabled: [{
|
|
4529
|
-
type: Input
|
|
4530
4398
|
}], showFileList: [{
|
|
4531
4399
|
type: Input
|
|
4532
|
-
}], tabindex: [{
|
|
4533
|
-
type: Input
|
|
4534
|
-
}], zoneId: [{
|
|
4535
|
-
type: Input
|
|
4536
4400
|
}], tabIndex: [{
|
|
4537
4401
|
type: Input,
|
|
4538
4402
|
args: ['tabIndex']
|
|
4539
|
-
}], accept: [{
|
|
4540
|
-
type: Input
|
|
4541
|
-
}], restrictions: [{
|
|
4542
|
-
type: Input
|
|
4543
|
-
}], focusableId: [{
|
|
4544
|
-
type: Input
|
|
4545
4403
|
}], actionsLayout: [{
|
|
4546
4404
|
type: Input
|
|
4547
|
-
}], fileTemplate: [{
|
|
4548
|
-
type: ContentChild,
|
|
4549
|
-
args: [FileTemplateDirective]
|
|
4550
|
-
}], fileInfoTemplate: [{
|
|
4551
|
-
type: ContentChild,
|
|
4552
|
-
args: [FileInfoTemplateDirective]
|
|
4553
4405
|
}], fileSelectInput: [{
|
|
4554
4406
|
type: ViewChild,
|
|
4555
4407
|
args: ['fileSelectInput', { static: true }]
|
|
4556
|
-
}], fileSelectButton: [{
|
|
4557
|
-
type: ViewChild,
|
|
4558
|
-
args: ['fileSelectButton', { static: true, read: ElementRef }]
|
|
4559
|
-
}], onBlur: [{
|
|
4560
|
-
type: Output,
|
|
4561
|
-
args: ['blur']
|
|
4562
4408
|
}], cancel: [{
|
|
4563
4409
|
type: Output
|
|
4564
4410
|
}], clear: [{
|
|
@@ -4567,17 +4413,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4567
4413
|
type: Output
|
|
4568
4414
|
}], error: [{
|
|
4569
4415
|
type: Output
|
|
4570
|
-
}], onFocus: [{
|
|
4571
|
-
type: Output,
|
|
4572
|
-
args: ['focus']
|
|
4573
4416
|
}], pause: [{
|
|
4574
4417
|
type: Output
|
|
4575
|
-
}], remove: [{
|
|
4576
|
-
type: Output
|
|
4577
4418
|
}], resume: [{
|
|
4578
4419
|
type: Output
|
|
4579
|
-
}], select: [{
|
|
4580
|
-
type: Output
|
|
4581
4420
|
}], success: [{
|
|
4582
4421
|
type: Output
|
|
4583
4422
|
}], upload: [{
|
|
@@ -4586,15 +4425,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4586
4425
|
type: Output
|
|
4587
4426
|
}], valueChange: [{
|
|
4588
4427
|
type: Output
|
|
4589
|
-
}], hostDefaultClasses: [{
|
|
4590
|
-
type: HostBinding,
|
|
4591
|
-
args: ['class.k-upload']
|
|
4592
|
-
}], hostRole: [{
|
|
4593
|
-
type: HostBinding,
|
|
4594
|
-
args: ['attr.role']
|
|
4595
|
-
}], hostDisabledClass: [{
|
|
4596
|
-
type: HostBinding,
|
|
4597
|
-
args: ['class.k-disabled']
|
|
4598
4428
|
}], dir: [{
|
|
4599
4429
|
type: HostBinding,
|
|
4600
4430
|
args: ['attr.dir']
|