@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?.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
|
*/
|
|
@@ -1773,7 +1996,7 @@ class FileListItemDirective {
|
|
|
1773
1996
|
return this.files[0].uid;
|
|
1774
1997
|
}
|
|
1775
1998
|
get tabIndex() {
|
|
1776
|
-
return
|
|
1999
|
+
return this.navigationService.focusedFileIndex === this.index ? '0' : '-1';
|
|
1777
2000
|
}
|
|
1778
2001
|
get kFileError() {
|
|
1779
2002
|
return this.files[0].state === FileState.Failed;
|
|
@@ -1802,8 +2025,8 @@ class FileListItemDirective {
|
|
|
1802
2025
|
this.focused = false;
|
|
1803
2026
|
}
|
|
1804
2027
|
onClick(event) {
|
|
1805
|
-
if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
|
|
1806
|
-
this.navigationService.focusedIndex = this.index;
|
|
2028
|
+
if ((!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) || !!event.target.closest('.k-upload-action')) {
|
|
2029
|
+
this.navigationService.focusedIndex = this.navigationService.focusedFileIndex = this.index;
|
|
1807
2030
|
}
|
|
1808
2031
|
}
|
|
1809
2032
|
}
|
|
@@ -1844,10 +2067,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1844
2067
|
args: ['class.k-focus']
|
|
1845
2068
|
}], onFocus: [{
|
|
1846
2069
|
type: HostListener,
|
|
1847
|
-
args: [
|
|
2070
|
+
args: ['focus']
|
|
1848
2071
|
}], onBlur: [{
|
|
1849
2072
|
type: HostListener,
|
|
1850
|
-
args: [
|
|
2073
|
+
args: ['blur']
|
|
1851
2074
|
}], onClick: [{
|
|
1852
2075
|
type: HostListener,
|
|
1853
2076
|
args: ['click', ['$event']]
|
|
@@ -1902,37 +2125,12 @@ class FileListItemActionButtonComponent {
|
|
|
1902
2125
|
this.uploadService = uploadService;
|
|
1903
2126
|
this.localization = localization;
|
|
1904
2127
|
this.navigation = navigation;
|
|
1905
|
-
this.actionFocused = false;
|
|
1906
|
-
this.retryFocused = false;
|
|
1907
|
-
this.pauseResumeFocused = false;
|
|
1908
2128
|
this.retrySVGIcon = arrowRotateCwSmallIcon;
|
|
1909
2129
|
this.playSVGIcon = playSmIcon;
|
|
1910
2130
|
this.pauseSVGIcon = pauseSmIcon;
|
|
1911
2131
|
this.cancelSVGIcon = cancelIcon;
|
|
1912
2132
|
this.deleteSVGIcon = xIcon;
|
|
1913
2133
|
}
|
|
1914
|
-
onFocus(type) {
|
|
1915
|
-
if (type === 'action') {
|
|
1916
|
-
this.actionFocused = true;
|
|
1917
|
-
}
|
|
1918
|
-
if (type === 'retry') {
|
|
1919
|
-
this.retryFocused = true;
|
|
1920
|
-
}
|
|
1921
|
-
if (type === 'pauseResume') {
|
|
1922
|
-
this.pauseResumeFocused = true;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
onBlur(type) {
|
|
1926
|
-
if (type === 'retry') {
|
|
1927
|
-
this.retryFocused = false;
|
|
1928
|
-
}
|
|
1929
|
-
if (type === 'action') {
|
|
1930
|
-
this.actionFocused = false;
|
|
1931
|
-
}
|
|
1932
|
-
if (type === 'pauseResume') {
|
|
1933
|
-
this.pauseResumeFocused = false;
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
2134
|
onRetryClick() {
|
|
1937
2135
|
if (this.disabled) {
|
|
1938
2136
|
return;
|
|
@@ -2010,64 +2208,50 @@ FileListItemActionButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion
|
|
|
2010
2208
|
|
|
2011
2209
|
<button
|
|
2012
2210
|
*ngIf="isFailed"
|
|
2211
|
+
kendoButton
|
|
2013
2212
|
type="button"
|
|
2014
|
-
class="k-
|
|
2015
|
-
|
|
2213
|
+
class="k-upload-action k-retry"
|
|
2214
|
+
fillMode="flat"
|
|
2016
2215
|
[attr.tabIndex]="-1"
|
|
2017
2216
|
[attr.aria-hidden]="true"
|
|
2018
|
-
|
|
2019
|
-
|
|
2217
|
+
[attr.title]="retryButtonTitle"
|
|
2218
|
+
[svgIcon]="retrySVGIcon"
|
|
2219
|
+
icon="refresh-sm"
|
|
2220
|
+
(pointerdown)="$event.preventDefault()"
|
|
2020
2221
|
(click)="onRetryClick()"
|
|
2021
|
-
>
|
|
2022
|
-
<kendo-icon-wrapper
|
|
2023
|
-
name="refresh-sm"
|
|
2024
|
-
[svgIcon]="retrySVGIcon"
|
|
2025
|
-
innerCssClass="k-retry"
|
|
2026
|
-
[attr.aria-label]="retryButtonTitle"
|
|
2027
|
-
[attr.title]="retryButtonTitle"
|
|
2028
|
-
></kendo-icon-wrapper>
|
|
2029
|
-
</button>
|
|
2222
|
+
></button>
|
|
2030
2223
|
|
|
2031
2224
|
<button
|
|
2032
2225
|
*ngIf="isResumable"
|
|
2226
|
+
kendoButton
|
|
2033
2227
|
type="button"
|
|
2034
|
-
class="k-
|
|
2035
|
-
|
|
2228
|
+
class="k-upload-action"
|
|
2229
|
+
fillMode="flat"
|
|
2036
2230
|
[attr.tabIndex]="-1"
|
|
2037
2231
|
[attr.aria-hidden]="true"
|
|
2038
|
-
|
|
2039
|
-
|
|
2232
|
+
[attr.title]="pauseResumeButtonTitle"
|
|
2233
|
+
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2234
|
+
[icon]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2235
|
+
(pointerdown)="$event.preventDefault()"
|
|
2040
2236
|
(click)="onPauseResumeClick()"
|
|
2041
|
-
>
|
|
2042
|
-
<kendo-icon-wrapper
|
|
2043
|
-
[name]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2044
|
-
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2045
|
-
[attr.aria-label]='pauseResumeButtonTitle'
|
|
2046
|
-
[attr.title]='pauseResumeButtonTitle'
|
|
2047
|
-
></kendo-icon-wrapper>
|
|
2048
|
-
</button>
|
|
2237
|
+
></button>
|
|
2049
2238
|
|
|
2050
2239
|
<button
|
|
2051
2240
|
*ngIf="isActionButtonVisible"
|
|
2052
|
-
|
|
2241
|
+
kendoButton
|
|
2242
|
+
class="k-upload-action"
|
|
2243
|
+
[class.k-delete]="!isUploading"
|
|
2244
|
+
fillMode="flat"
|
|
2053
2245
|
type="button"
|
|
2054
2246
|
[attr.tabIndex]="-1"
|
|
2055
2247
|
[attr.aria-hidden]="true"
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
[
|
|
2248
|
+
[attr.title]="actionButtonTitle"
|
|
2249
|
+
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2250
|
+
[icon]="isUploading ? 'cancel' : 'x'"
|
|
2059
2251
|
(click)="onRemoveCancelClick($event)"
|
|
2060
|
-
>
|
|
2061
|
-
<kendo-icon-wrapper
|
|
2062
|
-
[name]="isUploading ? 'cancel' : 'x'"
|
|
2063
|
-
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2064
|
-
[innerCssClass]="!isUploading ? 'k-delete' : ''"
|
|
2065
|
-
[attr.aria-label]='actionButtonTitle'
|
|
2066
|
-
[attr.title]='actionButtonTitle'
|
|
2067
|
-
></kendo-icon-wrapper>
|
|
2068
|
-
</button>
|
|
2252
|
+
></button>
|
|
2069
2253
|
</span>
|
|
2070
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i3.
|
|
2254
|
+
`, 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"] }] });
|
|
2071
2255
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileListItemActionButtonComponent, decorators: [{
|
|
2072
2256
|
type: Component,
|
|
2073
2257
|
args: [{
|
|
@@ -2078,62 +2262,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2078
2262
|
|
|
2079
2263
|
<button
|
|
2080
2264
|
*ngIf="isFailed"
|
|
2265
|
+
kendoButton
|
|
2081
2266
|
type="button"
|
|
2082
|
-
class="k-
|
|
2083
|
-
|
|
2267
|
+
class="k-upload-action k-retry"
|
|
2268
|
+
fillMode="flat"
|
|
2084
2269
|
[attr.tabIndex]="-1"
|
|
2085
2270
|
[attr.aria-hidden]="true"
|
|
2086
|
-
|
|
2087
|
-
|
|
2271
|
+
[attr.title]="retryButtonTitle"
|
|
2272
|
+
[svgIcon]="retrySVGIcon"
|
|
2273
|
+
icon="refresh-sm"
|
|
2274
|
+
(pointerdown)="$event.preventDefault()"
|
|
2088
2275
|
(click)="onRetryClick()"
|
|
2089
|
-
>
|
|
2090
|
-
<kendo-icon-wrapper
|
|
2091
|
-
name="refresh-sm"
|
|
2092
|
-
[svgIcon]="retrySVGIcon"
|
|
2093
|
-
innerCssClass="k-retry"
|
|
2094
|
-
[attr.aria-label]="retryButtonTitle"
|
|
2095
|
-
[attr.title]="retryButtonTitle"
|
|
2096
|
-
></kendo-icon-wrapper>
|
|
2097
|
-
</button>
|
|
2276
|
+
></button>
|
|
2098
2277
|
|
|
2099
2278
|
<button
|
|
2100
2279
|
*ngIf="isResumable"
|
|
2280
|
+
kendoButton
|
|
2101
2281
|
type="button"
|
|
2102
|
-
class="k-
|
|
2103
|
-
|
|
2282
|
+
class="k-upload-action"
|
|
2283
|
+
fillMode="flat"
|
|
2104
2284
|
[attr.tabIndex]="-1"
|
|
2105
2285
|
[attr.aria-hidden]="true"
|
|
2106
|
-
|
|
2107
|
-
|
|
2286
|
+
[attr.title]="pauseResumeButtonTitle"
|
|
2287
|
+
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2288
|
+
[icon]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2289
|
+
(pointerdown)="$event.preventDefault()"
|
|
2108
2290
|
(click)="onPauseResumeClick()"
|
|
2109
|
-
>
|
|
2110
|
-
<kendo-icon-wrapper
|
|
2111
|
-
[name]="isPaused ? 'play-sm' : 'pause-sm'"
|
|
2112
|
-
[svgIcon]="isPaused ? playSVGIcon : pauseSVGIcon"
|
|
2113
|
-
[attr.aria-label]='pauseResumeButtonTitle'
|
|
2114
|
-
[attr.title]='pauseResumeButtonTitle'
|
|
2115
|
-
></kendo-icon-wrapper>
|
|
2116
|
-
</button>
|
|
2291
|
+
></button>
|
|
2117
2292
|
|
|
2118
2293
|
<button
|
|
2119
2294
|
*ngIf="isActionButtonVisible"
|
|
2120
|
-
|
|
2295
|
+
kendoButton
|
|
2296
|
+
class="k-upload-action"
|
|
2297
|
+
[class.k-delete]="!isUploading"
|
|
2298
|
+
fillMode="flat"
|
|
2121
2299
|
type="button"
|
|
2122
2300
|
[attr.tabIndex]="-1"
|
|
2123
2301
|
[attr.aria-hidden]="true"
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
[
|
|
2302
|
+
[attr.title]="actionButtonTitle"
|
|
2303
|
+
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2304
|
+
[icon]="isUploading ? 'cancel' : 'x'"
|
|
2127
2305
|
(click)="onRemoveCancelClick($event)"
|
|
2128
|
-
>
|
|
2129
|
-
<kendo-icon-wrapper
|
|
2130
|
-
[name]="isUploading ? 'cancel' : 'x'"
|
|
2131
|
-
[svgIcon]="isUploading ? cancelSVGIcon : deleteSVGIcon"
|
|
2132
|
-
[innerCssClass]="!isUploading ? 'k-delete' : ''"
|
|
2133
|
-
[attr.aria-label]='actionButtonTitle'
|
|
2134
|
-
[attr.title]='actionButtonTitle'
|
|
2135
|
-
></kendo-icon-wrapper>
|
|
2136
|
-
</button>
|
|
2306
|
+
></button>
|
|
2137
2307
|
</span>
|
|
2138
2308
|
`
|
|
2139
2309
|
}]
|
|
@@ -2483,6 +2653,7 @@ class FileListComponent {
|
|
|
2483
2653
|
constructor(uploadService, navigation) {
|
|
2484
2654
|
this.uploadService = uploadService;
|
|
2485
2655
|
this.navigation = navigation;
|
|
2656
|
+
this.fileListRole = 'list';
|
|
2486
2657
|
this.onItemFocus();
|
|
2487
2658
|
this.onItemAction();
|
|
2488
2659
|
}
|
|
@@ -2498,7 +2669,9 @@ class FileListComponent {
|
|
|
2498
2669
|
}
|
|
2499
2670
|
itemActionHandler(key) {
|
|
2500
2671
|
const index = this.navigation.focusedIndex;
|
|
2501
|
-
const
|
|
2672
|
+
const filesArray = this.fileListItems.toArray();
|
|
2673
|
+
const numberOfFiles = filesArray.length;
|
|
2674
|
+
const item = filesArray[index];
|
|
2502
2675
|
const uid = item.uidAttribute;
|
|
2503
2676
|
const files = this.uploadService.files.get(uid);
|
|
2504
2677
|
if (key === Keys.Escape && files[0].state === FileState.Uploading) {
|
|
@@ -2517,7 +2690,16 @@ class FileListComponent {
|
|
|
2517
2690
|
else if (this.hasDelete(item)) {
|
|
2518
2691
|
this.uploadService.removeFiles(uid);
|
|
2519
2692
|
}
|
|
2520
|
-
|
|
2693
|
+
if (index < numberOfFiles - 1) {
|
|
2694
|
+
filesArray[index + 1].focus();
|
|
2695
|
+
}
|
|
2696
|
+
else if (numberOfFiles === 1) {
|
|
2697
|
+
this.navigation.focusSelectButton();
|
|
2698
|
+
}
|
|
2699
|
+
else if (index === numberOfFiles - 1) {
|
|
2700
|
+
this.navigation.focusedIndex = this.navigation.focusedFileIndex = index - 1;
|
|
2701
|
+
filesArray[index - 1].focus();
|
|
2702
|
+
}
|
|
2521
2703
|
}
|
|
2522
2704
|
const isUploadChunk = this.uploadService.async.chunk;
|
|
2523
2705
|
const canTogglePauseResume = key === Keys.Space && files[0].state !== FileState.Uploaded;
|
|
@@ -2531,7 +2713,7 @@ class FileListComponent {
|
|
|
2531
2713
|
}
|
|
2532
2714
|
}
|
|
2533
2715
|
hasDelete(item) {
|
|
2534
|
-
return item.element.nativeElement.getElementsByClassName('k-
|
|
2716
|
+
return item.element.nativeElement.getElementsByClassName('k-svg-i-x').length > 0;
|
|
2535
2717
|
}
|
|
2536
2718
|
ngOnDestroy() {
|
|
2537
2719
|
this.focusSubscription.unsubscribe();
|
|
@@ -2539,12 +2721,12 @@ class FileListComponent {
|
|
|
2539
2721
|
}
|
|
2540
2722
|
}
|
|
2541
2723
|
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 });
|
|
2542
|
-
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: `
|
|
2724
|
+
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: `
|
|
2543
2725
|
<ng-template ngFor
|
|
2544
2726
|
[ngForOf]="fileList"
|
|
2545
2727
|
let-files
|
|
2546
2728
|
let-index="index">
|
|
2547
|
-
<li kendoUploadFileListItem [files]='files' [index]='index'>
|
|
2729
|
+
<li kendoUploadFileListItem [files]='files' [index]='index' role="listitem">
|
|
2548
2730
|
<kendo-upload-file-list-single-item
|
|
2549
2731
|
class='k-file-single'
|
|
2550
2732
|
*ngIf='files.length === 1 && !fileTemplate'
|
|
@@ -2575,7 +2757,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2575
2757
|
[ngForOf]="fileList"
|
|
2576
2758
|
let-files
|
|
2577
2759
|
let-index="index">
|
|
2578
|
-
<li kendoUploadFileListItem [files]='files' [index]='index'>
|
|
2760
|
+
<li kendoUploadFileListItem [files]='files' [index]='index' role="listitem">
|
|
2579
2761
|
<kendo-upload-file-list-single-item
|
|
2580
2762
|
class='k-file-single'
|
|
2581
2763
|
*ngIf='files.length === 1 && !fileTemplate'
|
|
@@ -2609,6 +2791,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2609
2791
|
}], fileListItems: [{
|
|
2610
2792
|
type: ViewChildren,
|
|
2611
2793
|
args: [FileListItemDirective]
|
|
2794
|
+
}], fileListRole: [{
|
|
2795
|
+
type: HostBinding,
|
|
2796
|
+
args: ['attr.role']
|
|
2612
2797
|
}] } });
|
|
2613
2798
|
|
|
2614
2799
|
/**
|
|
@@ -2821,8 +3006,9 @@ const FILESELECT_VALUE_ACCESSOR = {
|
|
|
2821
3006
|
useExisting: forwardRef(() => FileSelectComponent)
|
|
2822
3007
|
};
|
|
2823
3008
|
let idx$1 = 0;
|
|
2824
|
-
class FileSelectComponent {
|
|
3009
|
+
class FileSelectComponent extends UploadFileSelectBase {
|
|
2825
3010
|
constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper, injector) {
|
|
3011
|
+
super(uploadService, navigation, cdr, injector, ngZone);
|
|
2826
3012
|
this.uploadService = uploadService;
|
|
2827
3013
|
this.localization = localization;
|
|
2828
3014
|
this.navigation = navigation;
|
|
@@ -2831,54 +3017,10 @@ class FileSelectComponent {
|
|
|
2831
3017
|
this.renderer = renderer;
|
|
2832
3018
|
this.cdr = cdr;
|
|
2833
3019
|
this.injector = injector;
|
|
2834
|
-
/**
|
|
2835
|
-
* Disables the FileSelect.
|
|
2836
|
-
* 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).
|
|
2837
|
-
* @default false
|
|
2838
|
-
*/
|
|
2839
|
-
this.disabled = false;
|
|
2840
|
-
/**
|
|
2841
|
-
* Enables the selection of multiple files
|
|
2842
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
|
|
2843
|
-
* If set to `false`, only one file can be selected at a time.
|
|
2844
|
-
* @default true
|
|
2845
|
-
*/
|
|
2846
|
-
this.multiple = true;
|
|
2847
|
-
/**
|
|
2848
|
-
* Toggles the visibility of the file list.
|
|
2849
|
-
* @default true
|
|
2850
|
-
*/
|
|
2851
|
-
this.showFileList = true;
|
|
2852
|
-
/**
|
|
2853
|
-
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
|
|
2854
|
-
* @default 0
|
|
2855
|
-
*/
|
|
2856
|
-
this.tabindex = 0;
|
|
2857
|
-
/**
|
|
2858
|
-
* @hidden
|
|
2859
|
-
*/
|
|
2860
|
-
this.focusableId = `k-${guid()}`;
|
|
2861
|
-
/**
|
|
2862
|
-
* Fires when the user navigates outside the component.
|
|
2863
|
-
*/
|
|
2864
|
-
this.onBlur = new EventEmitter();
|
|
2865
|
-
/**
|
|
2866
|
-
* Fires when the component is focused.
|
|
2867
|
-
*/
|
|
2868
|
-
this.onFocus = new EventEmitter();
|
|
2869
|
-
/**
|
|
2870
|
-
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
2871
|
-
*/
|
|
2872
|
-
this.select = new EventEmitter();
|
|
2873
|
-
/**
|
|
2874
|
-
* Fires when a file is about to be removed. If prevented, the file will remain in the list.
|
|
2875
|
-
*/
|
|
2876
|
-
this.remove = new EventEmitter();
|
|
2877
3020
|
/**
|
|
2878
3021
|
* Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
|
|
2879
3022
|
*/
|
|
2880
3023
|
this.valueChange = new EventEmitter();
|
|
2881
|
-
this.hostDefaultClasses = true;
|
|
2882
3024
|
/**
|
|
2883
3025
|
* @hidden
|
|
2884
3026
|
*/
|
|
@@ -2887,13 +3029,10 @@ class FileSelectComponent {
|
|
|
2887
3029
|
maxFileSize: 0,
|
|
2888
3030
|
minFileSize: 0
|
|
2889
3031
|
};
|
|
2890
|
-
this.onTouchedCallback = (_) => { };
|
|
2891
|
-
this.onChangeCallback = (_) => { };
|
|
2892
3032
|
validatePackage(packageMetadata);
|
|
2893
3033
|
this.wrapper = wrapper.nativeElement;
|
|
2894
3034
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
2895
3035
|
this.navigation.computeKeys();
|
|
2896
|
-
this.fileList = this.uploadService.files;
|
|
2897
3036
|
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
|
|
2898
3037
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
2899
3038
|
});
|
|
@@ -2902,6 +3041,9 @@ class FileSelectComponent {
|
|
|
2902
3041
|
this.attachEventHandlers();
|
|
2903
3042
|
this.setDefaultSettings();
|
|
2904
3043
|
}
|
|
3044
|
+
get dir() {
|
|
3045
|
+
return this.direction;
|
|
3046
|
+
}
|
|
2905
3047
|
/**
|
|
2906
3048
|
* Sets the `name` attribute of the `input` element of the FileSelect.
|
|
2907
3049
|
*/
|
|
@@ -2911,42 +3053,10 @@ class FileSelectComponent {
|
|
|
2911
3053
|
get name() {
|
|
2912
3054
|
return this.uploadService.async.saveField;
|
|
2913
3055
|
}
|
|
2914
|
-
/**
|
|
2915
|
-
* Sets the restrictions for selected files.
|
|
2916
|
-
*/
|
|
2917
|
-
set restrictions(restrictions) {
|
|
2918
|
-
const parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
|
|
2919
|
-
this._restrictions = parsedRestrictions;
|
|
2920
|
-
}
|
|
2921
|
-
get restrictions() {
|
|
2922
|
-
return this._restrictions;
|
|
2923
|
-
}
|
|
2924
|
-
get hostDisabledClass() {
|
|
2925
|
-
return this.disabled;
|
|
2926
|
-
}
|
|
2927
|
-
get dir() {
|
|
2928
|
-
return this.direction;
|
|
2929
|
-
}
|
|
2930
|
-
get hostRole() {
|
|
2931
|
-
return 'application';
|
|
2932
|
-
}
|
|
2933
|
-
/**
|
|
2934
|
-
* @hidden
|
|
2935
|
-
*/
|
|
2936
|
-
get formControl() {
|
|
2937
|
-
const ngControl = this.injector.get(NgControl, null);
|
|
2938
|
-
return ngControl?.control || null;
|
|
2939
|
-
}
|
|
2940
|
-
/**
|
|
2941
|
-
* @hidden
|
|
2942
|
-
*/
|
|
2943
|
-
get isControlRequired() {
|
|
2944
|
-
return isControlRequired(this.formControl);
|
|
2945
|
-
}
|
|
2946
3056
|
ngOnInit() {
|
|
2947
|
-
const { buttonId,
|
|
3057
|
+
const { buttonId, fileListId } = this.getIds();
|
|
2948
3058
|
this.focusableId = buttonId;
|
|
2949
|
-
this.
|
|
3059
|
+
this.fileListId = fileListId;
|
|
2950
3060
|
if (this.zoneId) {
|
|
2951
3061
|
this.dropZoneService.addComponent(this, this.zoneId);
|
|
2952
3062
|
}
|
|
@@ -2964,80 +3074,24 @@ class FileSelectComponent {
|
|
|
2964
3074
|
* @hidden
|
|
2965
3075
|
*/
|
|
2966
3076
|
textFor(key) {
|
|
2967
|
-
return this.localization.get(key);
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
this.
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
this.
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
this.wrapperFocusSubscription.unsubscribe();
|
|
2986
|
-
}
|
|
2987
|
-
if (this.selectButtonFocusSubscription) {
|
|
2988
|
-
this.selectButtonFocusSubscription.unsubscribe();
|
|
2989
|
-
}
|
|
2990
|
-
if (this.localizationChangeSubscription) {
|
|
2991
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
2992
|
-
}
|
|
2993
|
-
if (this.subs) {
|
|
2994
|
-
this.subs.unsubscribe();
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
/**
|
|
2998
|
-
* @hidden
|
|
2999
|
-
*/
|
|
3000
|
-
writeValue(newValue) {
|
|
3001
|
-
let isValid = true;
|
|
3002
|
-
if (newValue instanceof Array) {
|
|
3003
|
-
newValue.forEach((file) => {
|
|
3004
|
-
if (!validateInitialFileSelectFile(file)) {
|
|
3005
|
-
isValid = false;
|
|
3006
|
-
}
|
|
3007
|
-
});
|
|
3008
|
-
if (isValid) {
|
|
3009
|
-
this.uploadService.addInitialFileSelectFiles(newValue);
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
if (newValue === null) {
|
|
3013
|
-
this.fileList.clear();
|
|
3014
|
-
}
|
|
3015
|
-
this.cdr.markForCheck();
|
|
3016
|
-
}
|
|
3017
|
-
/**
|
|
3018
|
-
* @hidden
|
|
3019
|
-
*/
|
|
3020
|
-
registerOnChange(fn) {
|
|
3021
|
-
this.onChangeCallback = fn;
|
|
3022
|
-
}
|
|
3023
|
-
/**
|
|
3024
|
-
* @hidden
|
|
3025
|
-
*/
|
|
3026
|
-
registerOnTouched(fn) {
|
|
3027
|
-
this.onTouchedCallback = fn;
|
|
3028
|
-
}
|
|
3029
|
-
/**
|
|
3030
|
-
* @hidden
|
|
3031
|
-
*/
|
|
3032
|
-
setDisabledState(isDisabled) {
|
|
3033
|
-
this.disabled = isDisabled;
|
|
3034
|
-
}
|
|
3035
|
-
/**
|
|
3036
|
-
* @hidden
|
|
3037
|
-
*/
|
|
3038
|
-
onFileSelectButtonFocus() {
|
|
3039
|
-
if (!this.navigation.focused) {
|
|
3040
|
-
this.navigation.focusedIndex = -1;
|
|
3077
|
+
return this.localization.get(key);
|
|
3078
|
+
}
|
|
3079
|
+
ngOnDestroy() {
|
|
3080
|
+
this.fileList.clear();
|
|
3081
|
+
if (this.blurSubscription) {
|
|
3082
|
+
this.blurSubscription.unsubscribe();
|
|
3083
|
+
}
|
|
3084
|
+
if (this.wrapperFocusSubscription) {
|
|
3085
|
+
this.wrapperFocusSubscription.unsubscribe();
|
|
3086
|
+
}
|
|
3087
|
+
if (this.selectButtonFocusSubscription) {
|
|
3088
|
+
this.selectButtonFocusSubscription.unsubscribe();
|
|
3089
|
+
}
|
|
3090
|
+
if (this.localizationChangeSubscription) {
|
|
3091
|
+
this.localizationChangeSubscription.unsubscribe();
|
|
3092
|
+
}
|
|
3093
|
+
if (this.subs) {
|
|
3094
|
+
this.subs.unsubscribe();
|
|
3041
3095
|
}
|
|
3042
3096
|
}
|
|
3043
3097
|
/**
|
|
@@ -3078,8 +3132,14 @@ class FileSelectComponent {
|
|
|
3078
3132
|
getIds() {
|
|
3079
3133
|
const id = ++idx$1;
|
|
3080
3134
|
const buttonId = `k-fileselect-button-${id}`;
|
|
3081
|
-
const
|
|
3082
|
-
return { buttonId,
|
|
3135
|
+
const fileListId = `k-fileselect-file-list-${id}`;
|
|
3136
|
+
return { buttonId, fileListId };
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* @hidden
|
|
3140
|
+
*/
|
|
3141
|
+
writeValue(newValue) {
|
|
3142
|
+
super.writeValue(newValue, validateInitialFileSelectFile, 'addInitialFileSelectFiles');
|
|
3083
3143
|
}
|
|
3084
3144
|
subscribeBlur() {
|
|
3085
3145
|
if (!isDocumentAvailable()) {
|
|
@@ -3154,7 +3214,7 @@ class FileSelectComponent {
|
|
|
3154
3214
|
}
|
|
3155
3215
|
}
|
|
3156
3216
|
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 });
|
|
3157
|
-
FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FileSelectComponent, selector: "kendo-fileselect", inputs: {
|
|
3217
|
+
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: [
|
|
3158
3218
|
LocalizationService,
|
|
3159
3219
|
NavigationService,
|
|
3160
3220
|
UploadService,
|
|
@@ -3168,7 +3228,7 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3168
3228
|
provide: KendoInput,
|
|
3169
3229
|
useExisting: forwardRef(() => FileSelectComponent)
|
|
3170
3230
|
}
|
|
3171
|
-
],
|
|
3231
|
+
], viewQueries: [{ propertyName: "fileSelectInput", first: true, predicate: ["fileSelectInput"], descendants: true, static: true }], exportAs: ["kendoFileSelect"], usesInheritance: true, ngImport: i0, template: `
|
|
3172
3232
|
<ng-container kendoFileSelectLocalizedMessages
|
|
3173
3233
|
i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
|
|
3174
3234
|
dropFilesHere="Drop files here to select"
|
|
@@ -3205,12 +3265,12 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3205
3265
|
[id]="focusableId"
|
|
3206
3266
|
[attr.aria-label]="textFor('select')"
|
|
3207
3267
|
[attr.tabindex]="tabindex"
|
|
3208
|
-
[attr.aria-
|
|
3268
|
+
[attr.aria-expanded]="hasFileList"
|
|
3269
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
3209
3270
|
>
|
|
3210
3271
|
{{textFor('select')}}
|
|
3211
3272
|
</button>
|
|
3212
3273
|
<input kendoFileSelect #fileSelectInput
|
|
3213
|
-
[id]="inputElementId"
|
|
3214
3274
|
[dir]="direction"
|
|
3215
3275
|
[accept]="accept"
|
|
3216
3276
|
[restrictions]="restrictions"
|
|
@@ -3223,11 +3283,12 @@ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
|
|
|
3223
3283
|
</div>
|
|
3224
3284
|
<ul kendo-upload-file-list
|
|
3225
3285
|
class="k-upload-files k-reset"
|
|
3226
|
-
*ngIf="
|
|
3286
|
+
*ngIf="hasFileList"
|
|
3227
3287
|
[disabled]="disabled"
|
|
3228
3288
|
[fileList]="fileList.files"
|
|
3229
3289
|
[fileTemplate]="fileTemplate"
|
|
3230
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
3290
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
3291
|
+
[id]="fileListId">
|
|
3231
3292
|
</ul>
|
|
3232
3293
|
`, 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"] }] });
|
|
3233
3294
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FileSelectComponent, decorators: [{
|
|
@@ -3287,12 +3348,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3287
3348
|
[id]="focusableId"
|
|
3288
3349
|
[attr.aria-label]="textFor('select')"
|
|
3289
3350
|
[attr.tabindex]="tabindex"
|
|
3290
|
-
[attr.aria-
|
|
3351
|
+
[attr.aria-expanded]="hasFileList"
|
|
3352
|
+
[attr.aria-controls]="hasFileList ? fileListId : undefined"
|
|
3291
3353
|
>
|
|
3292
3354
|
{{textFor('select')}}
|
|
3293
3355
|
</button>
|
|
3294
3356
|
<input kendoFileSelect #fileSelectInput
|
|
3295
|
-
[id]="inputElementId"
|
|
3296
3357
|
[dir]="direction"
|
|
3297
3358
|
[accept]="accept"
|
|
3298
3359
|
[restrictions]="restrictions"
|
|
@@ -3305,68 +3366,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3305
3366
|
</div>
|
|
3306
3367
|
<ul kendo-upload-file-list
|
|
3307
3368
|
class="k-upload-files k-reset"
|
|
3308
|
-
*ngIf="
|
|
3369
|
+
*ngIf="hasFileList"
|
|
3309
3370
|
[disabled]="disabled"
|
|
3310
3371
|
[fileList]="fileList.files"
|
|
3311
3372
|
[fileTemplate]="fileTemplate"
|
|
3312
|
-
[fileInfoTemplate]="fileInfoTemplate"
|
|
3373
|
+
[fileInfoTemplate]="fileInfoTemplate"
|
|
3374
|
+
[id]="fileListId">
|
|
3313
3375
|
</ul>
|
|
3314
3376
|
`
|
|
3315
3377
|
}]
|
|
3316
|
-
}], 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: {
|
|
3317
|
-
type: Input
|
|
3318
|
-
}], disabled: [{
|
|
3319
|
-
type: Input
|
|
3320
|
-
}], multiple: [{
|
|
3321
|
-
type: Input
|
|
3322
|
-
}], name: [{
|
|
3323
|
-
type: Input
|
|
3324
|
-
}], showFileList: [{
|
|
3325
|
-
type: Input
|
|
3326
|
-
}], tabindex: [{
|
|
3327
|
-
type: Input
|
|
3328
|
-
}], restrictions: [{
|
|
3329
|
-
type: Input
|
|
3330
|
-
}], zoneId: [{
|
|
3331
|
-
type: Input
|
|
3332
|
-
}], focusableId: [{
|
|
3333
|
-
type: Input
|
|
3334
|
-
}], fileTemplate: [{
|
|
3335
|
-
type: ContentChild,
|
|
3336
|
-
args: [FileTemplateDirective]
|
|
3337
|
-
}], fileInfoTemplate: [{
|
|
3338
|
-
type: ContentChild,
|
|
3339
|
-
args: [FileInfoTemplateDirective]
|
|
3340
|
-
}], fileSelectInput: [{
|
|
3378
|
+
}], 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: [{
|
|
3341
3379
|
type: ViewChild,
|
|
3342
3380
|
args: ['fileSelectInput', { static: true }]
|
|
3343
|
-
}], fileSelectButton: [{
|
|
3344
|
-
type: ViewChild,
|
|
3345
|
-
args: ['fileSelectButton', { static: true, read: ElementRef }]
|
|
3346
|
-
}], onBlur: [{
|
|
3347
|
-
type: Output,
|
|
3348
|
-
args: ['blur']
|
|
3349
|
-
}], onFocus: [{
|
|
3350
|
-
type: Output,
|
|
3351
|
-
args: ['focus']
|
|
3352
|
-
}], select: [{
|
|
3353
|
-
type: Output
|
|
3354
|
-
}], remove: [{
|
|
3355
|
-
type: Output
|
|
3356
|
-
}], valueChange: [{
|
|
3357
|
-
type: Output
|
|
3358
|
-
}], hostDefaultClasses: [{
|
|
3359
|
-
type: HostBinding,
|
|
3360
|
-
args: ['class.k-upload']
|
|
3361
|
-
}], hostDisabledClass: [{
|
|
3362
|
-
type: HostBinding,
|
|
3363
|
-
args: ['class.k-disabled']
|
|
3364
3381
|
}], dir: [{
|
|
3365
3382
|
type: HostBinding,
|
|
3366
3383
|
args: ['attr.dir']
|
|
3367
|
-
}],
|
|
3368
|
-
type:
|
|
3369
|
-
|
|
3384
|
+
}], name: [{
|
|
3385
|
+
type: Input
|
|
3386
|
+
}], valueChange: [{
|
|
3387
|
+
type: Output
|
|
3370
3388
|
}] } });
|
|
3371
3389
|
|
|
3372
3390
|
/**
|
|
@@ -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?.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']
|