@progress/kendo-angular-listview 3.0.2 → 4.0.0-next.202204010900

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.
Files changed (152) hide show
  1. package/bundles/kendo-angular-listview.umd.js +5 -0
  2. package/{dist/es2015/data-binding → data-binding}/data-binding.directive.d.ts +5 -1
  3. package/{dist/es2015/editing → editing}/commands/add-command.directive.d.ts +3 -0
  4. package/{dist/es2015/editing → editing}/commands/cancel-command.directive.d.ts +3 -0
  5. package/{dist/es2015/editing → editing}/commands/edit-command.directive.d.ts +3 -0
  6. package/{dist/es2015/editing → editing}/commands/remove-command.directive.d.ts +3 -0
  7. package/{dist/es2015/editing → editing}/commands/save-command.directive.d.ts +3 -0
  8. package/{dist/es2015/editing → editing}/edit-template.directive.d.ts +3 -0
  9. package/{dist/es2015/editing → editing}/edit.service.d.ts +6 -3
  10. package/{dist/es2015/editing → editing}/events/add-event-args.interface.d.ts +0 -0
  11. package/{dist/es2015/editing → editing}/events/cancel-event-args.interface.d.ts +0 -0
  12. package/{dist/es2015/editing → editing}/events/edit-event-args.interface.d.ts +0 -0
  13. package/{dist/es2015/editing → editing}/events/remove-event-args.interface.d.ts +0 -0
  14. package/{dist/es2015/editing → editing}/events/save-event-args.interface.d.ts +0 -0
  15. package/{dist/es2015 → esm2015}/data-binding/data-binding.directive.js +15 -16
  16. package/esm2015/editing/commands/add-command.directive.js +49 -0
  17. package/{dist/es2015 → esm2015}/editing/commands/cancel-command.directive.js +17 -23
  18. package/{dist/es2015 → esm2015}/editing/commands/edit-command.directive.js +17 -23
  19. package/{dist/es2015 → esm2015}/editing/commands/remove-command.directive.js +17 -23
  20. package/{dist/es2015 → esm2015}/editing/commands/save-command.directive.js +17 -23
  21. package/{dist/es2015 → esm2015}/editing/edit-template.directive.js +14 -12
  22. package/{dist/es2015 → esm2015}/editing/edit.service.js +9 -13
  23. package/{dist/es → esm2015}/editing/events/add-event-args.interface.js +1 -0
  24. package/{dist/es2015 → esm2015}/editing/events/cancel-event-args.interface.js +1 -0
  25. package/{dist/es2015 → esm2015}/editing/events/edit-event-args.interface.js +1 -0
  26. package/{dist/es2015 → esm2015}/editing/events/remove-event-args.interface.js +1 -0
  27. package/{dist/es → esm2015}/editing/events/save-event-args.interface.js +1 -0
  28. package/{dist/es/editing/events/remove-event-args.interface.js → esm2015/kendo-angular-listview.js} +4 -0
  29. package/{dist/es2015 → esm2015}/listview.component.js +242 -155
  30. package/{dist/es2015 → esm2015}/listview.module.js +56 -26
  31. package/{dist/es → esm2015}/main.js +5 -0
  32. package/{dist/es → esm2015}/models/listview-data-result.js +1 -0
  33. package/{dist/es → esm2015}/models/page-change-event.js +1 -0
  34. package/{dist/es2015 → esm2015}/models/page-size-change-event.js +0 -0
  35. package/{dist/es → esm2015}/models/page-size-item.js +1 -0
  36. package/{dist/es → esm2015}/models/pager-position.js +1 -0
  37. package/{dist/es → esm2015}/models/pager-settings.js +1 -0
  38. package/{dist/es → esm2015}/models/pager-type.js +1 -0
  39. package/{dist/es → esm2015}/models/scroll-bottom-event.js +1 -0
  40. package/{dist/es2015 → esm2015}/navigation/listview-navigable-item.directive.js +15 -18
  41. package/{dist/es2015 → esm2015}/navigation/navigation.service.js +8 -13
  42. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  43. package/esm2015/templates/footer-template.directive.js +24 -0
  44. package/esm2015/templates/header-template.directive.js +24 -0
  45. package/{dist/es2015 → esm2015}/templates/item-template.directive.js +12 -11
  46. package/esm2015/templates/loader-template.directive.js +24 -0
  47. package/esm2015/templates/template-context.directive.js +33 -0
  48. package/{dist/es2015 → esm2015}/utils.js +0 -0
  49. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-listview.js} +521 -417
  50. package/{dist/es/editing/events/cancel-event-args.interface.js → kendo-angular-listview.d.ts} +5 -0
  51. package/{dist/es2015/listview.component.d.ts → listview.component.d.ts} +13 -7
  52. package/listview.module.d.ts +39 -0
  53. package/{dist/es2015/main.d.ts → main.d.ts} +5 -0
  54. package/{dist/es2015/models → models}/listview-data-result.d.ts +0 -0
  55. package/{dist/es2015/models → models}/page-change-event.d.ts +0 -0
  56. package/{dist/es2015/models → models}/page-size-change-event.d.ts +0 -0
  57. package/{dist/es2015/models → models}/page-size-item.d.ts +0 -0
  58. package/{dist/es2015/models → models}/pager-position.d.ts +0 -0
  59. package/{dist/es2015/models → models}/pager-settings.d.ts +0 -0
  60. package/{dist/es2015/models → models}/pager-type.d.ts +0 -0
  61. package/{dist/es2015/models → models}/scroll-bottom-event.d.ts +0 -0
  62. package/{dist/es2015/navigation → navigation}/listview-navigable-item.directive.d.ts +3 -0
  63. package/{dist/es2015/navigation → navigation}/navigation.service.d.ts +5 -1
  64. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  65. package/package.json +36 -108
  66. package/schematics/ngAdd/index.js +5 -2
  67. package/schematics/ngAdd/index.js.map +1 -1
  68. package/{dist/es2015/templates → templates}/footer-template.directive.d.ts +3 -0
  69. package/{dist/es2015/templates → templates}/header-template.directive.d.ts +3 -0
  70. package/{dist/es2015/templates → templates}/item-template.directive.d.ts +3 -0
  71. package/{dist/es2015/templates → templates}/loader-template.directive.d.ts +3 -0
  72. package/{dist/es2015/templates → templates}/template-context.directive.d.ts +4 -1
  73. package/{dist/es2015/utils.d.ts → utils.d.ts} +0 -0
  74. package/dist/cdn/js/kendo-angular-listview.js +0 -20
  75. package/dist/cdn/main.js +0 -5
  76. package/dist/es/data-binding/data-binding.directive.js +0 -69
  77. package/dist/es/editing/commands/add-command.directive.js +0 -58
  78. package/dist/es/editing/commands/cancel-command.directive.js +0 -74
  79. package/dist/es/editing/commands/edit-command.directive.js +0 -62
  80. package/dist/es/editing/commands/remove-command.directive.js +0 -61
  81. package/dist/es/editing/commands/save-command.directive.js +0 -74
  82. package/dist/es/editing/edit-template.directive.js +0 -32
  83. package/dist/es/editing/edit.service.js +0 -136
  84. package/dist/es/editing/events/edit-event-args.interface.js +0 -4
  85. package/dist/es/index.js +0 -17
  86. package/dist/es/listview.component.js +0 -534
  87. package/dist/es/listview.module.js +0 -83
  88. package/dist/es/models/page-size-change-event.js +0 -18
  89. package/dist/es/navigation/listview-navigable-item.directive.js +0 -70
  90. package/dist/es/navigation/navigation.service.js +0 -162
  91. package/dist/es/package-metadata.js +0 -15
  92. package/dist/es/templates/footer-template.directive.js +0 -24
  93. package/dist/es/templates/header-template.directive.js +0 -24
  94. package/dist/es/templates/item-template.directive.js +0 -30
  95. package/dist/es/templates/loader-template.directive.js +0 -24
  96. package/dist/es/templates/template-context.directive.js +0 -40
  97. package/dist/es/utils.js +0 -103
  98. package/dist/es2015/editing/commands/add-command.directive.js +0 -55
  99. package/dist/es2015/editing/events/add-event-args.interface.js +0 -4
  100. package/dist/es2015/editing/events/save-event-args.interface.js +0 -4
  101. package/dist/es2015/index.d.ts +0 -17
  102. package/dist/es2015/index.js +0 -17
  103. package/dist/es2015/index.metadata.json +0 -1
  104. package/dist/es2015/listview.module.d.ts +0 -18
  105. package/dist/es2015/main.js +0 -13
  106. package/dist/es2015/models/listview-data-result.js +0 -4
  107. package/dist/es2015/models/page-change-event.js +0 -4
  108. package/dist/es2015/models/page-size-item.js +0 -4
  109. package/dist/es2015/models/pager-position.js +0 -4
  110. package/dist/es2015/models/pager-settings.js +0 -4
  111. package/dist/es2015/models/pager-type.js +0 -4
  112. package/dist/es2015/models/scroll-bottom-event.js +0 -4
  113. package/dist/es2015/templates/footer-template.directive.js +0 -23
  114. package/dist/es2015/templates/header-template.directive.js +0 -23
  115. package/dist/es2015/templates/loader-template.directive.js +0 -23
  116. package/dist/es2015/templates/template-context.directive.js +0 -35
  117. package/dist/fesm5/index.js +0 -1528
  118. package/dist/npm/data-binding/data-binding.directive.js +0 -71
  119. package/dist/npm/editing/commands/add-command.directive.js +0 -60
  120. package/dist/npm/editing/commands/cancel-command.directive.js +0 -76
  121. package/dist/npm/editing/commands/edit-command.directive.js +0 -64
  122. package/dist/npm/editing/commands/remove-command.directive.js +0 -63
  123. package/dist/npm/editing/commands/save-command.directive.js +0 -76
  124. package/dist/npm/editing/edit-template.directive.js +0 -34
  125. package/dist/npm/editing/edit.service.js +0 -140
  126. package/dist/npm/editing/events/add-event-args.interface.js +0 -6
  127. package/dist/npm/editing/events/cancel-event-args.interface.js +0 -6
  128. package/dist/npm/editing/events/edit-event-args.interface.js +0 -6
  129. package/dist/npm/editing/events/remove-event-args.interface.js +0 -6
  130. package/dist/npm/editing/events/save-event-args.interface.js +0 -6
  131. package/dist/npm/index.js +0 -29
  132. package/dist/npm/listview.component.js +0 -536
  133. package/dist/npm/listview.module.js +0 -85
  134. package/dist/npm/main.js +0 -24
  135. package/dist/npm/models/listview-data-result.js +0 -6
  136. package/dist/npm/models/page-change-event.js +0 -6
  137. package/dist/npm/models/page-size-change-event.js +0 -20
  138. package/dist/npm/models/page-size-item.js +0 -6
  139. package/dist/npm/models/pager-position.js +0 -6
  140. package/dist/npm/models/pager-settings.js +0 -6
  141. package/dist/npm/models/pager-type.js +0 -6
  142. package/dist/npm/models/scroll-bottom-event.js +0 -6
  143. package/dist/npm/navigation/listview-navigable-item.directive.js +0 -72
  144. package/dist/npm/navigation/navigation.service.js +0 -164
  145. package/dist/npm/package-metadata.js +0 -17
  146. package/dist/npm/templates/footer-template.directive.js +0 -26
  147. package/dist/npm/templates/header-template.directive.js +0 -26
  148. package/dist/npm/templates/item-template.directive.js +0 -32
  149. package/dist/npm/templates/loader-template.directive.js +0 -26
  150. package/dist/npm/templates/template-context.directive.js +0 -42
  151. package/dist/npm/utils.js +0 -105
  152. package/dist/systemjs/kendo-angular-listview.js +0 -5
@@ -1,71 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var rxjs_1 = require("rxjs");
10
- var listview_component_1 = require("../listview.component");
11
- /**
12
- * A directive that encapsulates the in-memory handling of paging
13
- * ([see example]({% slug paging_listview %}#toc-binding-directive)).
14
- */
15
- var DataBindingDirective = /** @class */ (function () {
16
- function DataBindingDirective(listView) {
17
- this.listView = listView;
18
- this.subscriptions = new rxjs_1.Subscription();
19
- }
20
- Object.defineProperty(DataBindingDirective.prototype, "data", {
21
- get: function () {
22
- return this._data;
23
- },
24
- /**
25
- * The array of data which will be used to populate the ListView.
26
- */
27
- set: function (data) {
28
- this._data = data || [];
29
- this.updateListViewData();
30
- },
31
- enumerable: true,
32
- configurable: true
33
- });
34
- DataBindingDirective.prototype.ngOnInit = function () {
35
- this.subscriptions.add(this.listView.pageChange.subscribe(this.handlePageChange.bind(this)));
36
- this.subscriptions.add(this.listView.pageSizeChange.subscribe(this.handlePageSizeChange.bind(this)));
37
- this.updateListViewData();
38
- };
39
- DataBindingDirective.prototype.ngOnDestroy = function () {
40
- this.subscriptions.unsubscribe();
41
- };
42
- DataBindingDirective.prototype.handlePageChange = function (event) {
43
- this.listView.skip = event.skip;
44
- this.listView.pageSize = event.take;
45
- this.updateListViewData();
46
- };
47
- DataBindingDirective.prototype.handlePageSizeChange = function (event) {
48
- this.listView.pageSize = Number(event.newPageSize);
49
- };
50
- DataBindingDirective.prototype.updateListViewData = function () {
51
- var from = this.listView.skip || 0;
52
- var to = from + (this.listView.pageSize || this.data.length);
53
- this.listView.data = {
54
- data: this.data.slice(from, to),
55
- total: this.data.length
56
- };
57
- };
58
- tslib_1.__decorate([
59
- core_1.Input('kendoListViewBinding'),
60
- tslib_1.__metadata("design:type", Array),
61
- tslib_1.__metadata("design:paramtypes", [Array])
62
- ], DataBindingDirective.prototype, "data", null);
63
- DataBindingDirective = tslib_1.__decorate([
64
- core_1.Directive({
65
- selector: '[kendoListViewBinding]'
66
- }),
67
- tslib_1.__metadata("design:paramtypes", [listview_component_1.ListViewComponent])
68
- ], DataBindingDirective);
69
- return DataBindingDirective;
70
- }());
71
- exports.DataBindingDirective = DataBindingDirective;
@@ -1,60 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
10
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
- var edit_service_1 = require("../edit.service");
12
- /**
13
- * Represents the command for adding a new item to the ListView. You can apply this directive to any
14
- * `button` element inside a [`HeaderTemplate`]({% slug api_listview_headertemplatedirective %}).
15
- * When an associated button with the directive is clicked, the
16
- * [`add`]({% slug api_listview_listviewcomponent %}#toc-add) event is triggered
17
- * ([see example]({% slug editing_listview %})).
18
- *
19
- * @example
20
- * ```html-no-run
21
- * <kendo-listview>
22
- * <ng-template kendoListViewHeaderTemplate>
23
- * <button kendoListViewAddCommand>Add new</button>
24
- * </ng-template>
25
- * </kendo-listview>
26
- * ```
27
- */
28
- var AddCommandDirective = /** @class */ (function (_super) {
29
- tslib_1.__extends(AddCommandDirective, _super);
30
- function AddCommandDirective(editService, element, renderer, localization, ngZone) {
31
- var _this = _super.call(this, element, renderer, null, localization, ngZone) || this;
32
- _this.editService = editService;
33
- return _this;
34
- }
35
- /**
36
- * @hidden
37
- */
38
- AddCommandDirective.prototype.clickHandler = function (e) {
39
- e.preventDefault();
40
- this.editService.beginAdd();
41
- };
42
- tslib_1.__decorate([
43
- core_1.HostListener('click', ['$event']),
44
- tslib_1.__metadata("design:type", Function),
45
- tslib_1.__metadata("design:paramtypes", [Object]),
46
- tslib_1.__metadata("design:returntype", void 0)
47
- ], AddCommandDirective.prototype, "clickHandler", null);
48
- AddCommandDirective = tslib_1.__decorate([
49
- core_1.Directive({
50
- selector: '[kendoListViewAddCommand]'
51
- }),
52
- tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService,
53
- core_1.ElementRef,
54
- core_1.Renderer2,
55
- kendo_angular_l10n_1.LocalizationService,
56
- core_1.NgZone])
57
- ], AddCommandDirective);
58
- return AddCommandDirective;
59
- }(kendo_angular_buttons_1.Button));
60
- exports.AddCommandDirective = AddCommandDirective;
@@ -1,76 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
10
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
- var edit_service_1 = require("../edit.service");
12
- var utils_1 = require("../../utils");
13
- /**
14
- * Represents the `cancel` command of the ListView. You can apply this directive to any `button`
15
- * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
16
- * When an associated button with the directive is clicked, the
17
- * [`cancel`]({% slug api_listview_listviewcomponent %}#toc-cancel) event
18
- * is triggered ([see example]({% slug editing_listview %})).
19
- *
20
- * @example
21
- * ```html-no-run
22
- * <kendo-listview>
23
- * <ng-template kendoListViewEditTemplate>
24
- * <button kendoListViewCancelCommand>Cancel changes</button>
25
- * </ng-template>
26
- * </kendo-listview>
27
- * ```
28
- *
29
- * You can control the content of the button based on the state of the item.
30
- *
31
- * @example
32
- * ```html-no-run
33
- * <kendo-listview>
34
- * <ng-template kendoListViewEditTemplate let-isNew="isNew">
35
- * <button kendoListViewCancelCommand>{{isNew ? 'Discard' : 'Cancel changes'}}</button>
36
- * </ng-template>
37
- * </kendo-listview>
38
- * ```
39
- */
40
- var CancelCommandDirective = /** @class */ (function (_super) {
41
- tslib_1.__extends(CancelCommandDirective, _super);
42
- function CancelCommandDirective(editService, element, renderer, localization, ngZone) {
43
- var _this = _super.call(this, element, renderer, null, localization, ngZone) || this;
44
- _this.editService = editService;
45
- _this.elementRef = element;
46
- return _this;
47
- }
48
- /**
49
- * @hidden
50
- */
51
- CancelCommandDirective.prototype.clickHandler = function (e) {
52
- e.preventDefault();
53
- var index = utils_1.getClosestListItemIndex(this.elementRef.nativeElement);
54
- if (this.editService.isEdited(index)) {
55
- this.editService.endEdit(index);
56
- }
57
- };
58
- tslib_1.__decorate([
59
- core_1.HostListener('click', ['$event']),
60
- tslib_1.__metadata("design:type", Function),
61
- tslib_1.__metadata("design:paramtypes", [Object]),
62
- tslib_1.__metadata("design:returntype", void 0)
63
- ], CancelCommandDirective.prototype, "clickHandler", null);
64
- CancelCommandDirective = tslib_1.__decorate([
65
- core_1.Directive({
66
- selector: '[kendoListViewCancelCommand]'
67
- }),
68
- tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService,
69
- core_1.ElementRef,
70
- core_1.Renderer2,
71
- kendo_angular_l10n_1.LocalizationService,
72
- core_1.NgZone])
73
- ], CancelCommandDirective);
74
- return CancelCommandDirective;
75
- }(kendo_angular_buttons_1.Button));
76
- exports.CancelCommandDirective = CancelCommandDirective;
@@ -1,64 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
10
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
- var edit_service_1 = require("../edit.service");
12
- var utils_1 = require("../../utils");
13
- /**
14
- * Represents the `edit` command of the ListView. You can apply this directive to any `button`
15
- * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
16
- * When an associated button with the directive is clicked, the
17
- * [`edit`]({% slug api_listview_listviewcomponent %}#toc-edit) event
18
- * is triggered ([see example]({% slug editing_listview %})).
19
- *
20
- * @example
21
- * ```html-no-run
22
- * <kendo-listview>
23
- * <ng-template kendoListViewEditTemplate>
24
- * <button kendoListViewEditCommand class="k-primary">Edit</button>
25
- * </ng-template>
26
- * </kendo-listview>
27
- * ```
28
- *
29
- */
30
- var EditCommandDirective = /** @class */ (function (_super) {
31
- tslib_1.__extends(EditCommandDirective, _super);
32
- function EditCommandDirective(editService, element, renderer, localization, ngZone) {
33
- var _this = _super.call(this, element, renderer, null, localization, ngZone) || this;
34
- _this.editService = editService;
35
- _this.elementRef = element;
36
- return _this;
37
- }
38
- /**
39
- * @hidden
40
- */
41
- EditCommandDirective.prototype.clickHandler = function (e) {
42
- e.preventDefault();
43
- var index = utils_1.getClosestListItemIndex(this.elementRef.nativeElement);
44
- this.editService.beginEdit(index);
45
- };
46
- tslib_1.__decorate([
47
- core_1.HostListener('click', ['$event']),
48
- tslib_1.__metadata("design:type", Function),
49
- tslib_1.__metadata("design:paramtypes", [Object]),
50
- tslib_1.__metadata("design:returntype", void 0)
51
- ], EditCommandDirective.prototype, "clickHandler", null);
52
- EditCommandDirective = tslib_1.__decorate([
53
- core_1.Directive({
54
- selector: '[kendoListViewEditCommand]'
55
- }),
56
- tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService,
57
- core_1.ElementRef,
58
- core_1.Renderer2,
59
- kendo_angular_l10n_1.LocalizationService,
60
- core_1.NgZone])
61
- ], EditCommandDirective);
62
- return EditCommandDirective;
63
- }(kendo_angular_buttons_1.Button));
64
- exports.EditCommandDirective = EditCommandDirective;
@@ -1,63 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
10
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
- var edit_service_1 = require("../edit.service");
12
- var utils_1 = require("../../utils");
13
- /**
14
- * Represents the `remove` command of the ListView. You can apply this directive to any `button` element
15
- * inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
16
- * When an associated button with the directive is clicked, the
17
- * [`remove` event]({% slug api_listview_listviewcomponent %}#toc-remove)
18
- * is triggered ([see example]({% slug editing_listview %})).
19
- *
20
- * @example
21
- * ```html-no-run
22
- * <kendo-listview>
23
- * <ng-template kendoListViewEditTemplate>
24
- * <button kendoListViewRemoveCommand>Remove item</button>
25
- * </ng-template>
26
- * </kendo-listview>
27
- * ```
28
- */
29
- var RemoveCommandDirective = /** @class */ (function (_super) {
30
- tslib_1.__extends(RemoveCommandDirective, _super);
31
- function RemoveCommandDirective(editService, element, renderer, localization, ngZone) {
32
- var _this = _super.call(this, element, renderer, null, localization, ngZone) || this;
33
- _this.editService = editService;
34
- _this.elementRef = element;
35
- return _this;
36
- }
37
- /**
38
- * @hidden
39
- */
40
- RemoveCommandDirective.prototype.clickHandler = function (e) {
41
- e.preventDefault();
42
- var index = utils_1.getClosestListItemIndex(this.elementRef.nativeElement);
43
- this.editService.remove(index);
44
- };
45
- tslib_1.__decorate([
46
- core_1.HostListener('click', ['$event']),
47
- tslib_1.__metadata("design:type", Function),
48
- tslib_1.__metadata("design:paramtypes", [Object]),
49
- tslib_1.__metadata("design:returntype", void 0)
50
- ], RemoveCommandDirective.prototype, "clickHandler", null);
51
- RemoveCommandDirective = tslib_1.__decorate([
52
- core_1.Directive({
53
- selector: '[kendoListViewRemoveCommand]'
54
- }),
55
- tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService,
56
- core_1.ElementRef,
57
- core_1.Renderer2,
58
- kendo_angular_l10n_1.LocalizationService,
59
- core_1.NgZone])
60
- ], RemoveCommandDirective);
61
- return RemoveCommandDirective;
62
- }(kendo_angular_buttons_1.Button));
63
- exports.RemoveCommandDirective = RemoveCommandDirective;
@@ -1,76 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
10
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
11
- var edit_service_1 = require("../edit.service");
12
- var utils_1 = require("../../utils");
13
- /**
14
- * Represents the `save` command of the ListView. You can apply this directive to any `button`
15
- * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
16
- * When an associated button with the directive is clicked, the
17
- * [`save`]({% slug api_listview_listviewcomponent %}#toc-save) event
18
- * is triggered ([see example]({% slug editing_listview %})).
19
- *
20
- * @example
21
- * ```html-no-run
22
- * <kendo-listview>
23
- * <ng-template kendoListViewEditTemplate>
24
- * <button kendoListViewSaveCommand>Save changes</button>
25
- * </ng-template>
26
- * </kendo-listview>
27
- * ```
28
- *
29
- * You can control the content of the button based on the state of the item.
30
- *
31
- * @example
32
- * ```html-no-run
33
- * <kendo-listview>
34
- * <ng-template kendoListViewEditTemplate let-isNew="isNew">
35
- * <button kendoListViewSaveCommand>{{isNew ? 'Add' : 'Update'}}</button>
36
- * </ng-template>
37
- * </kendo-listview>
38
- * ```
39
- */
40
- var SaveCommandDirective = /** @class */ (function (_super) {
41
- tslib_1.__extends(SaveCommandDirective, _super);
42
- function SaveCommandDirective(editService, element, renderer, localization, ngZone) {
43
- var _this = _super.call(this, element, renderer, null, localization, ngZone) || this;
44
- _this.editService = editService;
45
- _this.elementRef = element;
46
- return _this;
47
- }
48
- /**
49
- * @hidden
50
- */
51
- SaveCommandDirective.prototype.clickHandler = function (e) {
52
- e.preventDefault();
53
- var index = utils_1.getClosestListItemIndex(this.elementRef.nativeElement);
54
- if (this.editService.isEdited(index)) {
55
- this.editService.save(index);
56
- }
57
- };
58
- tslib_1.__decorate([
59
- core_1.HostListener('click', ['$event']),
60
- tslib_1.__metadata("design:type", Function),
61
- tslib_1.__metadata("design:paramtypes", [Object]),
62
- tslib_1.__metadata("design:returntype", void 0)
63
- ], SaveCommandDirective.prototype, "clickHandler", null);
64
- SaveCommandDirective = tslib_1.__decorate([
65
- core_1.Directive({
66
- selector: '[kendoListViewSaveCommand]'
67
- }),
68
- tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService,
69
- core_1.ElementRef,
70
- core_1.Renderer2,
71
- kendo_angular_l10n_1.LocalizationService,
72
- core_1.NgZone])
73
- ], SaveCommandDirective);
74
- return SaveCommandDirective;
75
- }(kendo_angular_buttons_1.Button));
76
- exports.SaveCommandDirective = SaveCommandDirective;
@@ -1,34 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- /**
10
- * Represents the edit template of the ListView ([see example]({% slug editing_template_forms_listview %})).
11
- * Helps to customize the content of the edited items. To define the template, nest an `<ng-template>`
12
- * tag with the `kendoListViewEditTemplate` directive inside a `<kendo-listview>` tag.
13
- *
14
- * The template context contains the following fields:
15
- * - `formGroup`&mdash;The current [`FormGroup`]({{ site.data.urls.angular['formgroupapi'] }}).
16
- * If you use the ListView inside [Template-Driven Forms]({{ site.data.urls.angular['forms'] }}), it will be `undefined`.
17
- * - `itemIndex`&mdash;The current item index. If inside a new item, `itemIndex` is `-1`.
18
- * - `dataItem`&mdash;The current data item.
19
- * - `isNew`&mdash;The state of the current item.
20
- */
21
- var EditTemplateDirective = /** @class */ (function () {
22
- function EditTemplateDirective(templateRef) {
23
- this.templateRef = templateRef;
24
- }
25
- EditTemplateDirective = tslib_1.__decorate([
26
- core_1.Directive({
27
- selector: '[kendoListViewEditTemplate]'
28
- }),
29
- tslib_1.__param(0, core_1.Optional()),
30
- tslib_1.__metadata("design:paramtypes", [core_1.TemplateRef])
31
- ], EditTemplateDirective);
32
- return EditTemplateDirective;
33
- }());
34
- exports.EditTemplateDirective = EditTemplateDirective;
@@ -1,140 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var forms_1 = require("@angular/forms");
10
- var utils_1 = require("../utils");
11
- var rxjs_1 = require("rxjs");
12
- var operators_1 = require("rxjs/operators");
13
- /**
14
- * @hidden
15
- */
16
- var isEqual = function (index) { return function (item) { return item.index === index; }; };
17
- var ɵ0 = isEqual;
18
- exports.ɵ0 = ɵ0;
19
- /**
20
- * @hidden
21
- */
22
- var isNotEqual = function (index) { return function (item) { return item.index !== index; }; };
23
- var ɵ1 = isNotEqual;
24
- exports.ɵ1 = ɵ1;
25
- /**
26
- * @hidden
27
- */
28
- var isNewItem = function (index) { return index === -1 || index === undefined; };
29
- var ɵ2 = isNewItem;
30
- exports.ɵ2 = ɵ2;
31
- /**
32
- * @hidden
33
- */
34
- var EditService = /** @class */ (function () {
35
- function EditService(ngZone) {
36
- var _this = this;
37
- this.ngZone = ngZone;
38
- this.changes = new core_1.EventEmitter();
39
- this.editedIndices = [];
40
- this.changedSource = new rxjs_1.Subject();
41
- this.changed = this.changedSource.asObservable().pipe(operators_1.switchMap(function () { return _this.ngZone.onStable.asObservable().pipe(operators_1.take(1)); }));
42
- }
43
- EditService.prototype.editItem = function (index, group) {
44
- if (group === void 0) { group = undefined; }
45
- this.editedIndices.push({ index: index, group: group });
46
- this.onChanged();
47
- };
48
- EditService.prototype.addItem = function (group) {
49
- this.newItem = { group: group };
50
- this.onChanged();
51
- };
52
- EditService.prototype.isEditing = function () {
53
- return this.editedIndices.length > 0;
54
- };
55
- Object.defineProperty(EditService.prototype, "hasNewItem", {
56
- get: function () {
57
- return utils_1.isPresent(this.newItem);
58
- },
59
- enumerable: true,
60
- configurable: true
61
- });
62
- Object.defineProperty(EditService.prototype, "newDataItem", {
63
- get: function () {
64
- if (this.hasNewItem) {
65
- return this.newItem.group.value;
66
- }
67
- return {};
68
- },
69
- enumerable: true,
70
- configurable: true
71
- });
72
- Object.defineProperty(EditService.prototype, "newItemGroup", {
73
- get: function () {
74
- if (this.hasNewItem) {
75
- return this.newItem.group;
76
- }
77
- return new forms_1.FormGroup({});
78
- },
79
- enumerable: true,
80
- configurable: true
81
- });
82
- EditService.prototype.editGroup = function (index) {
83
- return this.context(index).group;
84
- };
85
- EditService.prototype.close = function (index) {
86
- if (isNewItem(index)) {
87
- this.newItem = undefined;
88
- return;
89
- }
90
- this.editedIndices = this.editedIndices.filter(isNotEqual(index));
91
- this.onChanged();
92
- };
93
- EditService.prototype.context = function (index) {
94
- if (isNewItem(index)) {
95
- return this.newItem;
96
- }
97
- return this.findByIndex(index);
98
- };
99
- EditService.prototype.isEdited = function (index) {
100
- if (isNewItem(index) && utils_1.isPresent(this.newItem)) {
101
- return true;
102
- }
103
- return utils_1.isPresent(this.findByIndex(index));
104
- };
105
- EditService.prototype.hasEdited = function (index) {
106
- return utils_1.isPresent(this.context(index));
107
- };
108
- EditService.prototype.beginEdit = function (itemIndex) {
109
- this.changes.emit({ action: 'edit', itemIndex: itemIndex });
110
- };
111
- EditService.prototype.beginAdd = function () {
112
- this.changes.emit({ action: 'add' });
113
- };
114
- EditService.prototype.endEdit = function (itemIndex) {
115
- var formGroup = this.context(itemIndex).group;
116
- this.changes.emit({ action: 'cancel', itemIndex: itemIndex, formGroup: formGroup, isNew: isNewItem(itemIndex) });
117
- };
118
- EditService.prototype.save = function (itemIndex) {
119
- var formGroup = this.context(itemIndex).group;
120
- this.changes.emit({ action: 'save', itemIndex: itemIndex, formGroup: formGroup, isNew: isNewItem(itemIndex) });
121
- };
122
- EditService.prototype.remove = function (itemIndex) {
123
- this.changes.emit({ action: 'remove', itemIndex: itemIndex });
124
- };
125
- EditService.prototype.findByIndex = function (index) {
126
- return this.editedIndices.find(isEqual(index));
127
- };
128
- EditService.prototype.onChanged = function () {
129
- var _this = this;
130
- this.ngZone.runOutsideAngular(function () {
131
- _this.changedSource.next();
132
- });
133
- };
134
- EditService = tslib_1.__decorate([
135
- core_1.Injectable(),
136
- tslib_1.__metadata("design:paramtypes", [core_1.NgZone])
137
- ], EditService);
138
- return EditService;
139
- }());
140
- exports.EditService = EditService;
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/npm/index.js DELETED
@@ -1,29 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- /**
7
- * Generated bundle index. Do not edit.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- var tslib_1 = require("tslib");
11
- tslib_1.__exportStar(require("./main"), exports);
12
- var add_command_directive_1 = require("./editing/commands/add-command.directive");
13
- exports.AddCommandDirective = add_command_directive_1.AddCommandDirective
14
- var cancel_command_directive_1 = require("./editing/commands/cancel-command.directive");
15
- exports.CancelCommandDirective = cancel_command_directive_1.CancelCommandDirective
16
- var edit_command_directive_1 = require("./editing/commands/edit-command.directive");
17
- exports.EditCommandDirective = edit_command_directive_1.EditCommandDirective
18
- var remove_command_directive_1 = require("./editing/commands/remove-command.directive");
19
- exports.RemoveCommandDirective = remove_command_directive_1.RemoveCommandDirective
20
- var save_command_directive_1 = require("./editing/commands/save-command.directive");
21
- exports.SaveCommandDirective = save_command_directive_1.SaveCommandDirective
22
- var edit_service_1 = require("./editing/edit.service");
23
- exports.EditService = edit_service_1.EditService
24
- var listview_navigable_item_directive_1 = require("./navigation/listview-navigable-item.directive");
25
- exports.ListViewNavigableItemDirective = listview_navigable_item_directive_1.ListViewNavigableItemDirective
26
- var navigation_service_1 = require("./navigation/navigation.service");
27
- exports.NavigationService = navigation_service_1.NavigationService
28
- var template_context_directive_1 = require("./templates/template-context.directive");
29
- exports.TemplateContextDirective = template_context_directive_1.TemplateContextDirective