@formio/angular 5.5.0-rc.9 → 6.0.0-rc.2

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 (195) hide show
  1. package/FormioBaseComponent.d.ts +2 -1
  2. package/FormioBaseComponent.d.ts.map +1 -1
  3. package/auth/auth.service.d.ts.map +1 -1
  4. package/components/alerts/formio.alerts.component.d.ts +1 -1
  5. package/components/formbuilder/formbuilder.component.d.ts +3 -3
  6. package/components/formbuilder/formbuilder.component.d.ts.map +1 -1
  7. package/components/loader/formio.loader.component.d.ts +1 -1
  8. package/core.d.ts +1 -1
  9. package/core.d.ts.map +1 -1
  10. package/custom-component/create-custom-component.d.ts +11 -11
  11. package/custom-component/create-custom-component.d.ts.map +1 -1
  12. package/elements.common.d.ts +2 -2
  13. package/elements.common.d.ts.map +1 -1
  14. package/esm2022/FormioBaseComponent.mjs +561 -0
  15. package/esm2022/auth/auth.component.mjs +13 -0
  16. package/esm2022/auth/auth.config.mjs +22 -0
  17. package/esm2022/auth/auth.module.mjs +47 -0
  18. package/esm2022/auth/auth.service.mjs +191 -0
  19. package/esm2022/auth/login/login.component.mjs +18 -0
  20. package/esm2022/auth/register/register.component.mjs +18 -0
  21. package/esm2022/auth/resetpass/resetpass.component.mjs +18 -0
  22. package/esm2022/components/alerts/formio.alerts.component.mjs +29 -0
  23. package/esm2022/components/alerts/formio.alerts.mjs +13 -0
  24. package/esm2022/components/alerts/parse-html-content.pipe.mjs +20 -0
  25. package/esm2022/components/formbuilder/formbuilder.component.mjs +202 -0
  26. package/esm2022/components/formio/formio.component.mjs +43 -0
  27. package/esm2022/components/loader/formio.loader.component.mjs +16 -0
  28. package/esm2022/core.mjs +17 -0
  29. package/esm2022/custom-component/create-custom-component.mjs +144 -0
  30. package/esm2022/custom-component/custom-tags.service.mjs +15 -0
  31. package/{esm2020 → esm2022}/custom-component/register-custom-component.mjs +2 -2
  32. package/esm2022/elements.common.mjs +2 -0
  33. package/esm2022/formio-promise.service.mjs +36 -0
  34. package/esm2022/formio.common.mjs +11 -0
  35. package/esm2022/formio.config.mjs +15 -0
  36. package/esm2022/formio.module.mjs +55 -0
  37. package/esm2022/formio.service.mjs +62 -0
  38. package/esm2022/grid/GridBodyComponent.mjs +90 -0
  39. package/esm2022/grid/GridFooterComponent.mjs +45 -0
  40. package/esm2022/grid/GridHeaderComponent.mjs +35 -0
  41. package/esm2022/grid/form/FormGridBody.component.mjs +20 -0
  42. package/esm2022/grid/form/FormGridFooter.component.mjs +27 -0
  43. package/esm2022/grid/form/FormGridHeader.component.mjs +28 -0
  44. package/esm2022/grid/form/time-since.pipe.mjs +38 -0
  45. package/esm2022/grid/grid.component.mjs +258 -0
  46. package/esm2022/grid/grid.module.mjs +80 -0
  47. package/esm2022/grid/grid.service.mjs +19 -0
  48. package/esm2022/grid/submission/SubmissionGridBody.component.mjs +44 -0
  49. package/esm2022/grid/submission/SubmissionGridFooter.component.mjs +24 -0
  50. package/esm2022/grid/submission/SubmissionGridHeader.component.mjs +64 -0
  51. package/esm2022/manager/create/create.component.mjs +19 -0
  52. package/esm2022/manager/delete/delete.component.mjs +43 -0
  53. package/esm2022/manager/edit/edit.component.mjs +123 -0
  54. package/esm2022/manager/form/form.component.mjs +81 -0
  55. package/esm2022/manager/form-manager.config.mjs +19 -0
  56. package/esm2022/manager/form-manager.module.mjs +84 -0
  57. package/esm2022/manager/form-manager.service.mjs +189 -0
  58. package/{esm2020 → esm2022}/manager/index/index.component.mjs +13 -6
  59. package/esm2022/manager/submission/delete/delete.component.mjs +33 -0
  60. package/esm2022/manager/submission/edit/edit.component.mjs +26 -0
  61. package/esm2022/manager/submission/index/index.component.mjs +26 -0
  62. package/esm2022/manager/submission/submission/submission.component.mjs +30 -0
  63. package/esm2022/manager/submission/view/view.component.mjs +18 -0
  64. package/esm2022/manager/view/view.component.mjs +52 -0
  65. package/esm2022/resource/create/create.component.mjs +44 -0
  66. package/esm2022/resource/delete/delete.component.mjs +30 -0
  67. package/esm2022/resource/edit/edit.component.mjs +43 -0
  68. package/esm2022/resource/index/index.component.mjs +71 -0
  69. package/esm2022/resource/resource.component.mjs +51 -0
  70. package/esm2022/resource/resource.config.mjs +14 -0
  71. package/esm2022/resource/resource.module.mjs +63 -0
  72. package/{esm2020 → esm2022}/resource/resource.service.mjs +29 -7
  73. package/esm2022/resource/resources.service.mjs +26 -0
  74. package/esm2022/resource/view/view.component.mjs +26 -0
  75. package/{fesm2020 → fesm2022}/formio-angular-auth.mjs +68 -36
  76. package/fesm2022/formio-angular-auth.mjs.map +1 -0
  77. package/{fesm2020 → fesm2022}/formio-angular-grid.mjs +123 -73
  78. package/fesm2022/formio-angular-grid.mjs.map +1 -0
  79. package/{fesm2020 → fesm2022}/formio-angular-manager.mjs +147 -80
  80. package/fesm2022/formio-angular-manager.mjs.map +1 -0
  81. package/{fesm2020 → fesm2022}/formio-angular-resource.mjs +109 -58
  82. package/fesm2022/formio-angular-resource.mjs.map +1 -0
  83. package/fesm2022/formio-angular.mjs +1226 -0
  84. package/fesm2022/formio-angular.mjs.map +1 -0
  85. package/formio.common.d.ts +5 -5
  86. package/formio.common.d.ts.map +1 -1
  87. package/grid/GridBodyComponent.d.ts +1 -1
  88. package/grid/GridFooterComponent.d.ts +1 -1
  89. package/grid/GridHeaderComponent.d.ts +1 -1
  90. package/grid/grid.component.d.ts +1 -1
  91. package/grid/submission/SubmissionGridHeader.component.d.ts +1 -1
  92. package/grid/submission/SubmissionGridHeader.component.d.ts.map +1 -1
  93. package/manager/form-manager.service.d.ts +1 -1
  94. package/manager/form-manager.service.d.ts.map +1 -1
  95. package/manager/view/view.component.d.ts +1 -0
  96. package/manager/view/view.component.d.ts.map +1 -1
  97. package/package.json +21 -35
  98. package/resource/edit/edit.component.d.ts +1 -0
  99. package/resource/edit/edit.component.d.ts.map +1 -1
  100. package/esm2020/FormioBaseComponent.mjs +0 -529
  101. package/esm2020/auth/auth.component.mjs +0 -12
  102. package/esm2020/auth/auth.config.mjs +0 -15
  103. package/esm2020/auth/auth.module.mjs +0 -46
  104. package/esm2020/auth/auth.service.mjs +0 -166
  105. package/esm2020/auth/login/login.component.mjs +0 -16
  106. package/esm2020/auth/register/register.component.mjs +0 -16
  107. package/esm2020/auth/resetpass/resetpass.component.mjs +0 -16
  108. package/esm2020/components/alerts/formio.alerts.component.mjs +0 -29
  109. package/esm2020/components/alerts/formio.alerts.mjs +0 -15
  110. package/esm2020/components/alerts/parse-html-content.pipe.mjs +0 -19
  111. package/esm2020/components/formbuilder/formbuilder.component.mjs +0 -187
  112. package/esm2020/components/formio/formio.component.mjs +0 -40
  113. package/esm2020/components/loader/formio.loader.component.mjs +0 -14
  114. package/esm2020/core.mjs +0 -14
  115. package/esm2020/custom-component/create-custom-component.mjs +0 -144
  116. package/esm2020/custom-component/custom-tags.service.mjs +0 -16
  117. package/esm2020/elements.common.mjs +0 -2
  118. package/esm2020/formio-promise.service.mjs +0 -33
  119. package/esm2020/formio.common.mjs +0 -8
  120. package/esm2020/formio.config.mjs +0 -14
  121. package/esm2020/formio.module.mjs +0 -54
  122. package/esm2020/formio.service.mjs +0 -59
  123. package/esm2020/grid/GridBodyComponent.mjs +0 -81
  124. package/esm2020/grid/GridFooterComponent.mjs +0 -36
  125. package/esm2020/grid/GridHeaderComponent.mjs +0 -30
  126. package/esm2020/grid/form/FormGridBody.component.mjs +0 -19
  127. package/esm2020/grid/form/FormGridFooter.component.mjs +0 -26
  128. package/esm2020/grid/form/FormGridHeader.component.mjs +0 -26
  129. package/esm2020/grid/form/time-since.pipe.mjs +0 -37
  130. package/esm2020/grid/grid.component.mjs +0 -230
  131. package/esm2020/grid/grid.module.mjs +0 -79
  132. package/esm2020/grid/grid.service.mjs +0 -17
  133. package/esm2020/grid/submission/SubmissionGridBody.component.mjs +0 -43
  134. package/esm2020/grid/submission/SubmissionGridFooter.component.mjs +0 -23
  135. package/esm2020/grid/submission/SubmissionGridHeader.component.mjs +0 -61
  136. package/esm2020/manager/create/create.component.mjs +0 -18
  137. package/esm2020/manager/delete/delete.component.mjs +0 -37
  138. package/esm2020/manager/edit/edit.component.mjs +0 -109
  139. package/esm2020/manager/form/form.component.mjs +0 -70
  140. package/esm2020/manager/form-manager.config.mjs +0 -17
  141. package/esm2020/manager/form-manager.module.mjs +0 -83
  142. package/esm2020/manager/form-manager.service.mjs +0 -178
  143. package/esm2020/manager/submission/delete/delete.component.mjs +0 -28
  144. package/esm2020/manager/submission/edit/edit.component.mjs +0 -22
  145. package/esm2020/manager/submission/index/index.component.mjs +0 -22
  146. package/esm2020/manager/submission/submission/submission.component.mjs +0 -26
  147. package/esm2020/manager/submission/view/view.component.mjs +0 -16
  148. package/esm2020/manager/view/view.component.mjs +0 -42
  149. package/esm2020/resource/create/create.component.mjs +0 -37
  150. package/esm2020/resource/delete/delete.component.mjs +0 -26
  151. package/esm2020/resource/edit/edit.component.mjs +0 -36
  152. package/esm2020/resource/index/index.component.mjs +0 -61
  153. package/esm2020/resource/resource.component.mjs +0 -46
  154. package/esm2020/resource/resource.config.mjs +0 -15
  155. package/esm2020/resource/resource.module.mjs +0 -62
  156. package/esm2020/resource/resources.service.mjs +0 -22
  157. package/esm2020/resource/view/view.component.mjs +0 -23
  158. package/fesm2015/formio-angular-auth.mjs +0 -298
  159. package/fesm2015/formio-angular-auth.mjs.map +0 -1
  160. package/fesm2015/formio-angular-grid.mjs +0 -678
  161. package/fesm2015/formio-angular-grid.mjs.map +0 -1
  162. package/fesm2015/formio-angular-manager.mjs +0 -746
  163. package/fesm2015/formio-angular-manager.mjs.map +0 -1
  164. package/fesm2015/formio-angular-resource.mjs +0 -506
  165. package/fesm2015/formio-angular-resource.mjs.map +0 -1
  166. package/fesm2015/formio-angular.mjs +0 -1153
  167. package/fesm2015/formio-angular.mjs.map +0 -1
  168. package/fesm2020/formio-angular-auth.mjs.map +0 -1
  169. package/fesm2020/formio-angular-grid.mjs.map +0 -1
  170. package/fesm2020/formio-angular-manager.mjs.map +0 -1
  171. package/fesm2020/formio-angular-resource.mjs.map +0 -1
  172. package/fesm2020/formio-angular.mjs +0 -1172
  173. package/fesm2020/formio-angular.mjs.map +0 -1
  174. /package/{esm2020 → esm2022}/auth/auth.routes.mjs +0 -0
  175. /package/{esm2020 → esm2022}/auth/formio-angular-auth.mjs +0 -0
  176. /package/{esm2020 → esm2022}/auth/index.mjs +0 -0
  177. /package/{esm2020 → esm2022}/formio-angular.mjs +0 -0
  178. /package/{esm2020 → esm2022}/formio.utils.mjs +0 -0
  179. /package/{esm2020 → esm2022}/grid/form/index.mjs +0 -0
  180. /package/{esm2020 → esm2022}/grid/formio-angular-grid.mjs +0 -0
  181. /package/{esm2020 → esm2022}/grid/index.mjs +0 -0
  182. /package/{esm2020 → esm2022}/grid/submission/index.mjs +0 -0
  183. /package/{esm2020 → esm2022}/grid/types/grid-column.mjs +0 -0
  184. /package/{esm2020 → esm2022}/grid/types/grid-footer-positions.mjs +0 -0
  185. /package/{esm2020 → esm2022}/grid/types/grid-header.mjs +0 -0
  186. /package/{esm2020 → esm2022}/index.mjs +0 -0
  187. /package/{esm2020 → esm2022}/manager/form-manager.routes.mjs +0 -0
  188. /package/{esm2020 → esm2022}/manager/formio-angular-manager.mjs +0 -0
  189. /package/{esm2020 → esm2022}/manager/index.mjs +0 -0
  190. /package/{esm2020 → esm2022}/resource/formio-angular-resource.mjs +0 -0
  191. /package/{esm2020 → esm2022}/resource/index.mjs +0 -0
  192. /package/{esm2020 → esm2022}/resource/resource.routes.mjs +0 -0
  193. /package/{esm2020 → esm2022}/types/alerts-position.mjs +0 -0
  194. /package/{esm2020 → esm2022}/types/formio-metadata.mjs +0 -0
  195. /package/{esm2020 → esm2022}/types/formio-submission.mjs +0 -0
@@ -1,678 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, TemplateRef, Component, Input, Output, ViewChild, Injectable, Pipe, ViewEncapsulation, ViewContainerRef, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i2$1 from '@angular/forms';
6
- import { FormsModule } from '@angular/forms';
7
- import * as i2 from '@angular/router';
8
- import { RouterModule } from '@angular/router';
9
- import * as i1$1 from '@formio/angular';
10
- import { FormioPromiseService, FormioModule, FormioAlerts } from '@formio/angular';
11
- import { each, clone, get } from 'lodash';
12
- import { Components, Utils, Formio } from 'formiojs';
13
- import * as i3 from 'ngx-bootstrap/pagination';
14
- import { PaginationModule } from 'ngx-bootstrap/pagination';
15
-
16
- var GridFooterPositions;
17
- (function (GridFooterPositions) {
18
- GridFooterPositions[GridFooterPositions["bottom"] = 0] = "bottom";
19
- GridFooterPositions[GridFooterPositions["top"] = 1] = "top";
20
- GridFooterPositions[GridFooterPositions["both"] = 2] = "both";
21
- })(GridFooterPositions || (GridFooterPositions = {}));
22
-
23
- class GridHeaderComponent {
24
- constructor() {
25
- this.headers = [];
26
- this.sort = new EventEmitter();
27
- }
28
- get numHeaders() {
29
- return this.headers.length;
30
- }
31
- load(formio, query, columns) {
32
- return Promise.resolve([]);
33
- }
34
- }
35
- GridHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36
- GridHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: GridHeaderComponent, selector: "ng-component", inputs: { actionAllowed: "actionAllowed" }, outputs: { sort: "sort" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridHeaderComponent, decorators: [{
38
- type: Component,
39
- args: [{
40
- template: ''
41
- }]
42
- }], ctorParameters: function () { return []; }, propDecorators: { actionAllowed: [{
43
- type: Input
44
- }], sort: [{
45
- type: Output
46
- }], template: [{
47
- type: ViewChild,
48
- args: [TemplateRef, { static: true }]
49
- }] } });
50
-
51
- var SortType;
52
- (function (SortType) {
53
- SortType["ASC"] = "asc";
54
- SortType["DESC"] = "desc";
55
- })(SortType || (SortType = {}));
56
-
57
- class FormGridHeaderComponent extends GridHeaderComponent {
58
- load(formio) {
59
- this.header = {
60
- label: 'Title',
61
- key: 'title',
62
- sort: SortType.ASC
63
- };
64
- this.headers = [this.header];
65
- return Promise.resolve(this.headers);
66
- }
67
- get numHeaders() {
68
- return 2;
69
- }
70
- }
71
- FormGridHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridHeaderComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
72
- FormGridHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: FormGridHeaderComponent, selector: "form-grid-header", usesInheritance: true, ngImport: i0, template: "<ng-template>\n <thead>\n <tr>\n <th>\n <div class=\"row\">\n <div class=\"col-sm-8\">\n <a (click)=\"sort.emit(header)\">\n {{ header.label }}&nbsp;<span [ngClass]=\"{'glyphicon-triangle-top fa-caret-up': (header.sort === 'asc'), 'glyphicon-triangle-bottom fa-caret-down': (header.sort === 'desc')}\" class=\"glyphicon fa\" *ngIf=\"header.sort\"></span>\n </a>\n </div>\n <div class=\"col-sm-4\">\n Operations\n </div>\n </div>\n </th>\n </tr>\n </thead>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
73
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridHeaderComponent, decorators: [{
74
- type: Component,
75
- args: [{ selector: 'form-grid-header', template: "<ng-template>\n <thead>\n <tr>\n <th>\n <div class=\"row\">\n <div class=\"col-sm-8\">\n <a (click)=\"sort.emit(header)\">\n {{ header.label }}&nbsp;<span [ngClass]=\"{'glyphicon-triangle-top fa-caret-up': (header.sort === 'asc'), 'glyphicon-triangle-bottom fa-caret-down': (header.sort === 'desc')}\" class=\"glyphicon fa\" *ngIf=\"header.sort\"></span>\n </a>\n </div>\n <div class=\"col-sm-4\">\n Operations\n </div>\n </div>\n </th>\n </tr>\n </thead>\n</ng-template>\n" }]
76
- }] });
77
-
78
- class GridService {
79
- constructor() { }
80
- setRows(rows) {
81
- this.rows = rows;
82
- }
83
- getFormsPerPage() {
84
- var _a;
85
- return (_a = this.rows) === null || _a === void 0 ? void 0 : _a.length;
86
- }
87
- }
88
- GridService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
89
- GridService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridService });
90
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridService, decorators: [{
91
- type: Injectable
92
- }], ctorParameters: function () { return []; } });
93
-
94
- class GridBodyComponent {
95
- constructor(service) {
96
- this.service = service;
97
- this.firstItem = 0;
98
- this.lastItem = 0;
99
- this.skip = 0;
100
- this.limit = 0;
101
- this.total = 0;
102
- this.rowSelect = new EventEmitter();
103
- this.rowAction = new EventEmitter();
104
- this.loading = true;
105
- }
106
- load(formio, query) {
107
- return formio.loadForm(query);
108
- }
109
- onRowSelect(event, row) {
110
- event.preventDefault();
111
- this.rowSelect.emit(row);
112
- }
113
- onRowAction(event, row, action) {
114
- event.preventDefault();
115
- this.rowAction.emit({ row, action });
116
- }
117
- /**
118
- * Set the rows for this Grid body.
119
- *
120
- * @param query
121
- * @param items
122
- * @return any
123
- */
124
- setRows(query, items) {
125
- this.rows = [];
126
- if (typeof items !== 'object') {
127
- this.firstItem = 0;
128
- this.lastItem = 0;
129
- this.total = 0;
130
- this.skip = 0;
131
- this.loading = false;
132
- this.service.setRows(this.rows);
133
- return this.rows;
134
- }
135
- this.firstItem = query.skip + 1;
136
- this.lastItem = this.firstItem + items.length - 1;
137
- if (this.lastItem === 0) {
138
- this.firstItem = 0;
139
- }
140
- this.total = items.serverCount;
141
- this.limit = query.limit;
142
- this.skip = Math.floor(items.skip / query.limit) + 1;
143
- this.loading = false;
144
- each(items, (item) => {
145
- this.rows.push(clone(item));
146
- });
147
- this.service.setRows(this.rows);
148
- return this.rows;
149
- }
150
- }
151
- GridBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridBodyComponent, deps: [{ token: GridService }], target: i0.ɵɵFactoryTarget.Component });
152
- GridBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: GridBodyComponent, selector: "ng-component", inputs: { header: "header", actionAllowed: "actionAllowed" }, outputs: { rowSelect: "rowSelect", rowAction: "rowAction" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridBodyComponent, decorators: [{
154
- type: Component,
155
- args: [{
156
- template: ''
157
- }]
158
- }], ctorParameters: function () { return [{ type: GridService }]; }, propDecorators: { header: [{
159
- type: Input
160
- }], actionAllowed: [{
161
- type: Input
162
- }], rowSelect: [{
163
- type: Output
164
- }], rowAction: [{
165
- type: Output
166
- }], template: [{
167
- type: ViewChild,
168
- args: [TemplateRef, { static: true }]
169
- }] } });
170
-
171
- class TimeSince {
172
- transform(date) {
173
- const elapsed = (new Date().getTime() - new Date(date).getTime()) / 1000;
174
- let interval;
175
- if (interval >= 1) {
176
- return interval + ' year' + (interval > 1 ? 's' : '');
177
- }
178
- interval = Math.floor(elapsed / 2592000);
179
- if (interval >= 1) {
180
- return interval + ' month' + (interval > 1 ? 's' : '');
181
- }
182
- interval = Math.floor(elapsed / 86400);
183
- if (interval >= 1) {
184
- return interval + ' day' + (interval > 1 ? 's' : '');
185
- }
186
- interval = Math.floor(elapsed / 3600);
187
- if (interval >= 1) {
188
- return interval + ' hour' + (interval > 1 ? 's' : '');
189
- }
190
- interval = Math.floor(elapsed / 60);
191
- if (interval >= 1) {
192
- return interval + ' minute' + (interval > 1 ? 's' : '');
193
- }
194
- return Math.floor(elapsed) + ' second' + (elapsed > 1 ? 's' : '');
195
- }
196
- }
197
- TimeSince.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TimeSince, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
198
- TimeSince.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: TimeSince, name: "timeSince" });
199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TimeSince, decorators: [{
200
- type: Pipe,
201
- args: [{
202
- name: 'timeSince'
203
- }]
204
- }] });
205
-
206
- class FormGridBodyComponent extends GridBodyComponent {
207
- load(formio, query) {
208
- query = query || {};
209
- return formio.loadForms({ params: query }).then((forms) => this.setRows(query, forms));
210
- }
211
- }
212
- FormGridBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridBodyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
213
- FormGridBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: FormGridBodyComponent, selector: "form-grid-body", usesInheritance: true, ngImport: i0, template: "<ng-template>\n <tbody *ngIf=\"rows\">\n <tr *ngFor=\"let form of rows\">\n <td>\n <div class=\"row\">\n <div class=\"col-sm-8\">\n <a routerLink=\"{{form._id}}/view\" (click)=\"onRowSelect($event, form)\"><h5>{{ form.title }}</h5></a>\n <div class=\"form-updated small text-muted\">\n Updated {{ form.modified | timeSince }} ago\n </div>\n </div>\n <div class=\"col-sm-4\">\n <button *ngIf=\"actionAllowed('formView')\" class=\"btn btn-outline-secondary btn-sm form-btn form-btn-use\" (click)=\"onRowAction($event, form, 'view')\"><span class=\"fa fa-pencil bi bi-pencil\"></span> Enter Data</button>&nbsp;\n <button *ngIf=\"actionAllowed('formSubmission')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'submission')\"><span class=\"fa fa-list-alt bi bi-table\"></span> View Data</button>&nbsp;\n <button *ngIf=\"actionAllowed('formEdit')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'edit')\"><span class=\"fa fa-edit bi bi-pencil-square\"></span> Edit Form</button>&nbsp;\n <button *ngIf=\"actionAllowed('formPermission')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'permissions')\"><span class=\"fa fa-lock bi bi-database-lock\"></span> Permissions</button>&nbsp;\n <button *ngIf=\"actionAllowed('formDelete')\" class=\"btn btn-danger btn-sm form-btn form-btn-delete\" (click)=\"onRowAction($event, form, 'delete')\" title=\"Delete form\"><span class=\"fa fa-trash bi bi-trash\"></span></button>\n </div>\n </div>\n </td>\n </tr>\n </tbody>\n</ng-template>\n", styles: [".form-btn{font-size:.75rem;margin:2px 0}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: TimeSince, name: "timeSince" }] });
214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridBodyComponent, decorators: [{
215
- type: Component,
216
- args: [{ selector: 'form-grid-body', template: "<ng-template>\n <tbody *ngIf=\"rows\">\n <tr *ngFor=\"let form of rows\">\n <td>\n <div class=\"row\">\n <div class=\"col-sm-8\">\n <a routerLink=\"{{form._id}}/view\" (click)=\"onRowSelect($event, form)\"><h5>{{ form.title }}</h5></a>\n <div class=\"form-updated small text-muted\">\n Updated {{ form.modified | timeSince }} ago\n </div>\n </div>\n <div class=\"col-sm-4\">\n <button *ngIf=\"actionAllowed('formView')\" class=\"btn btn-outline-secondary btn-sm form-btn form-btn-use\" (click)=\"onRowAction($event, form, 'view')\"><span class=\"fa fa-pencil bi bi-pencil\"></span> Enter Data</button>&nbsp;\n <button *ngIf=\"actionAllowed('formSubmission')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'submission')\"><span class=\"fa fa-list-alt bi bi-table\"></span> View Data</button>&nbsp;\n <button *ngIf=\"actionAllowed('formEdit')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'edit')\"><span class=\"fa fa-edit bi bi-pencil-square\"></span> Edit Form</button>&nbsp;\n <button *ngIf=\"actionAllowed('formPermission')\" class=\"btn btn-outline-secondary btn-sm form-btn\" (click)=\"onRowAction($event, form, 'permissions')\"><span class=\"fa fa-lock bi bi-database-lock\"></span> Permissions</button>&nbsp;\n <button *ngIf=\"actionAllowed('formDelete')\" class=\"btn btn-danger btn-sm form-btn form-btn-delete\" (click)=\"onRowAction($event, form, 'delete')\" title=\"Delete form\"><span class=\"fa fa-trash bi bi-trash\"></span></button>\n </div>\n </div>\n </td>\n </tr>\n </tbody>\n</ng-template>\n", styles: [".form-btn{font-size:.75rem;margin:2px 0}\n"] }]
217
- }] });
218
-
219
- class GridFooterComponent {
220
- constructor() {
221
- this.footerPositions = GridFooterPositions;
222
- this.pageChanged = new EventEmitter();
223
- this.createItem = new EventEmitter();
224
- }
225
- }
226
- GridFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
227
- GridFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: GridFooterComponent, selector: "ng-component", inputs: { header: "header", body: "body", createText: "createText", size: "size", actionAllowed: "actionAllowed" }, outputs: { pageChanged: "pageChanged", createItem: "createItem" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GridFooterComponent, decorators: [{
229
- type: Component,
230
- args: [{
231
- template: ''
232
- }]
233
- }], ctorParameters: function () { return []; }, propDecorators: { header: [{
234
- type: Input
235
- }], body: [{
236
- type: Input
237
- }], createText: [{
238
- type: Input
239
- }], size: [{
240
- type: Input
241
- }], actionAllowed: [{
242
- type: Input
243
- }], pageChanged: [{
244
- type: Output
245
- }], createItem: [{
246
- type: Output
247
- }], template: [{
248
- type: ViewChild,
249
- args: [TemplateRef, { static: true }]
250
- }] } });
251
-
252
- class FormGridFooterComponent extends GridFooterComponent {
253
- constructor() {
254
- super();
255
- }
256
- ngOnInit() {
257
- if (!this.createText) {
258
- this.createText = 'Create Form';
259
- }
260
- if (!this.size) {
261
- this.size = 7;
262
- }
263
- }
264
- }
265
- FormGridFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
266
- FormGridFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: FormGridFooterComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ng-template #footer let-position=\"position\" let-label=\"label\">\n <thead class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.top\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\" [ngTemplateOutletContext]=\"{ label: label }\"></ng-container>\n </thead>\n <tfoot class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.bottom\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\" [ngTemplateOutletContext]=\"{ label: label }\"></ng-container>\n </tfoot>\n</ng-template>\n\n<ng-template let-label=\"label\" #defaultFooterTemplate>\n <tr>\n <td *ngIf=\"header\" [colSpan]=\"header.numHeaders\">\n <button *ngIf=\"actionAllowed('formCreate')\" class=\"btn btn-primary form-btn-use pull-left float-left\" (click)=\"createItem.emit('form')\"><em class=\"glyphicon glyphicon-plus fa fa-plus bi bi-plus\"></em> {{ createText }}</button>\n <span class=\"pull-right float-right item-counter\"><span class=\"page-num\">{{ body.firstItem }} - {{ body.lastItem }}</span> / {{ body.total }} total</span>\n <span [attr.aria-label]=\"label\" role=\"navigation\">\n <pagination [totalItems]=\"body.total\" [itemsPerPage]=\"body.limit\" [(ngModel)]=\"body.skip\" (pageChanged)=\"pageChanged.emit($event)\" [maxSize]=\"size\" class=\"justify-content-center pagination-sm\">\n </pagination>\n </span>\n </td>\n </tr>\n</ng-template>\n", styles: ["tfoot.formio-grid-footer td{padding:.3rem}tfoot.formio-grid-footer .page-num{font-size:1.4em}tfoot.formio-grid-footer ul.pagination{margin-top:5px;margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PaginationComponent, selector: "pagination", inputs: ["align", "maxSize", "boundaryLinks", "directionLinks", "firstText", "previousText", "nextText", "lastText", "rotate", "pageBtnClass", "disabled", "customPageTemplate", "customNextTemplate", "customPreviousTemplate", "customFirstTemplate", "customLastTemplate", "itemsPerPage", "totalItems"], outputs: ["numPages", "pageChanged"] }], encapsulation: i0.ViewEncapsulation.None });
267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormGridFooterComponent, decorators: [{
268
- type: Component,
269
- args: [{ encapsulation: ViewEncapsulation.None, template: "<ng-template #footer let-position=\"position\" let-label=\"label\">\n <thead class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.top\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\" [ngTemplateOutletContext]=\"{ label: label }\"></ng-container>\n </thead>\n <tfoot class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.bottom\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\" [ngTemplateOutletContext]=\"{ label: label }\"></ng-container>\n </tfoot>\n</ng-template>\n\n<ng-template let-label=\"label\" #defaultFooterTemplate>\n <tr>\n <td *ngIf=\"header\" [colSpan]=\"header.numHeaders\">\n <button *ngIf=\"actionAllowed('formCreate')\" class=\"btn btn-primary form-btn-use pull-left float-left\" (click)=\"createItem.emit('form')\"><em class=\"glyphicon glyphicon-plus fa fa-plus bi bi-plus\"></em> {{ createText }}</button>\n <span class=\"pull-right float-right item-counter\"><span class=\"page-num\">{{ body.firstItem }} - {{ body.lastItem }}</span> / {{ body.total }} total</span>\n <span [attr.aria-label]=\"label\" role=\"navigation\">\n <pagination [totalItems]=\"body.total\" [itemsPerPage]=\"body.limit\" [(ngModel)]=\"body.skip\" (pageChanged)=\"pageChanged.emit($event)\" [maxSize]=\"size\" class=\"justify-content-center pagination-sm\">\n </pagination>\n </span>\n </td>\n </tr>\n</ng-template>\n", styles: ["tfoot.formio-grid-footer td{padding:.3rem}tfoot.formio-grid-footer .page-num{font-size:1.4em}tfoot.formio-grid-footer ul.pagination{margin-top:5px;margin-bottom:0}\n"] }]
270
- }], ctorParameters: function () { return []; } });
271
-
272
- var FormComponents = {
273
- header: FormGridHeaderComponent,
274
- body: FormGridBodyComponent,
275
- footer: FormGridFooterComponent
276
- };
277
-
278
- class SubmissionGridHeaderComponent extends GridHeaderComponent {
279
- load(formio, query, columns) {
280
- query = query || {};
281
- return formio.loadForm({ params: query }).then((form) => {
282
- this.headers = [];
283
- this.formComponents = new Map();
284
- this.setComponents(form.components);
285
- columns ? columns.forEach(column => {
286
- this.setHeader(this.getHeaderForColumn(column, this.formComponents.get(column.path)));
287
- }) : this.setComponentsHeaders(this.formComponents);
288
- return this.headers;
289
- });
290
- }
291
- setHeader(header) {
292
- this.headers.push(header);
293
- }
294
- getHeaderForColumn(column, component, sort) {
295
- return {
296
- label: column.label,
297
- key: column.path,
298
- sort: sort,
299
- component: component ? Components.create(component, null, null, true) : undefined,
300
- renderCell: column ? column.renderCell : undefined
301
- };
302
- }
303
- getHeaderForComponent(component, path, sort) {
304
- return {
305
- label: component.label,
306
- key: path,
307
- sort: sort,
308
- component: component ? Components.create(component, null, null, true) : undefined,
309
- };
310
- }
311
- // Set headers from components in case if columns are not provided
312
- setComponentsHeaders(components, sort) {
313
- components.forEach((component, path) => {
314
- if (component.input &&
315
- (!component.hasOwnProperty('tableView') || component.tableView)) {
316
- this.setHeader(this.getHeaderForComponent(component, path, sort));
317
- }
318
- });
319
- }
320
- // Map components
321
- setComponents(components) {
322
- Utils.eachComponent(components, (component, newPath) => {
323
- this.formComponents.set(`data.${newPath}`, component);
324
- });
325
- }
326
- }
327
- SubmissionGridHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridHeaderComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
328
- SubmissionGridHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: SubmissionGridHeaderComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ng-template>\n <thead>\n <tr>\n <th *ngFor=\"let header of headers\">\n <a (click)=\"sort.emit(header)\">\n {{ header.label }}&nbsp;<span [ngClass]=\"{'glyphicon-triangle-top': (header.sort === 'asc'), 'glyphicon-triangle-bottom': (header.sort === 'desc')}\" class=\"glyphicon\" *ngIf=\"header.sort\"></span>\n </a>\n </th>\n </tr>\n </thead>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
329
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridHeaderComponent, decorators: [{
330
- type: Component,
331
- args: [{ template: "<ng-template>\n <thead>\n <tr>\n <th *ngFor=\"let header of headers\">\n <a (click)=\"sort.emit(header)\">\n {{ header.label }}&nbsp;<span [ngClass]=\"{'glyphicon-triangle-top': (header.sort === 'asc'), 'glyphicon-triangle-bottom': (header.sort === 'desc')}\" class=\"glyphicon\" *ngIf=\"header.sort\"></span>\n </a>\n </th>\n </tr>\n </thead>\n</ng-template>\n" }]
332
- }] });
333
-
334
- class SubmissionGridBodyComponent extends GridBodyComponent {
335
- load(formio, query) {
336
- query = query || {};
337
- return formio.loadSubmissions({ params: query })
338
- .then((submissions) => this.setRows(query, submissions));
339
- }
340
- /**
341
- * Render the cell data.
342
- *
343
- * @param submission
344
- * @param header
345
- * @return any
346
- */
347
- view(submission, header) {
348
- const cellValue = get(submission, header.key);
349
- if (header.renderCell) {
350
- return header.renderCell(cellValue, header.component);
351
- }
352
- else {
353
- if (header.component) {
354
- if (header.component.getView) {
355
- return header.component.getView(cellValue);
356
- }
357
- return header.component.asString(cellValue);
358
- }
359
- else {
360
- return cellValue.toString();
361
- }
362
- }
363
- }
364
- }
365
- SubmissionGridBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridBodyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
366
- SubmissionGridBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: SubmissionGridBodyComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ng-template>\n <tbody>\n <tr *ngFor=\"let row of rows\" (click)=\"onRowSelect($event, row)\">\n <td *ngFor=\"let rowHeader of header.headers\" [innerHTML]=\"view(row, rowHeader)\"></td>\n </tr>\n </tbody>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridBodyComponent, decorators: [{
368
- type: Component,
369
- args: [{ template: "<ng-template>\n <tbody>\n <tr *ngFor=\"let row of rows\" (click)=\"onRowSelect($event, row)\">\n <td *ngFor=\"let rowHeader of header.headers\" [innerHTML]=\"view(row, rowHeader)\"></td>\n </tr>\n </tbody>\n</ng-template>\n" }]
370
- }] });
371
-
372
- class SubmissionGridFooterComponent extends GridFooterComponent {
373
- constructor() {
374
- super();
375
- }
376
- ngOnInit() {
377
- if (!this.size) {
378
- this.size = 7;
379
- }
380
- }
381
- }
382
- SubmissionGridFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
383
- SubmissionGridFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: SubmissionGridFooterComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ng-template #footer let-position=\"position\">\n <thead class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.top\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\"></ng-container>\n </thead>\n <tfoot class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.bottom\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\"></ng-container>\n </tfoot>\n</ng-template>\n\n<ng-template #defaultFooterTemplate>\n <tr>\n <td *ngIf=\"header\" [colSpan]=\"header.numHeaders\">\n <button *ngIf=\"actionAllowed('submissionCreate') && createText\" class=\"btn btn-primary pull-left float-left\" (click)=\"createItem.emit('form')\"><em class=\"glyphicon glyphicon-plus fa fa-plus bi bi-plus\"></em> {{ createText }}</button>\n <span class=\"pull-right float-right item-counter\"><span class=\"page-num\">{{ body.firstItem }} - {{ body.lastItem }}</span> / {{ body.total }} total</span>\n <pagination [totalItems]=\"body.total\" [itemsPerPage]=\"body.limit\" [(ngModel)]=\"body.skip\" (pageChanged)=\"pageChanged.emit($event)\" [maxSize]=\"size\" class=\"justify-content-center pagination-sm\"></pagination>\n </td>\n </tr>\n</ng-template>\n", styles: ["tfoot.formio-grid-footer td{padding:.3rem}tfoot.formio-grid-footer .page-num{font-size:1.4em}tfoot.formio-grid-footer ul.pagination{margin-top:5px;margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PaginationComponent, selector: "pagination", inputs: ["align", "maxSize", "boundaryLinks", "directionLinks", "firstText", "previousText", "nextText", "lastText", "rotate", "pageBtnClass", "disabled", "customPageTemplate", "customNextTemplate", "customPreviousTemplate", "customFirstTemplate", "customLastTemplate", "itemsPerPage", "totalItems"], outputs: ["numPages", "pageChanged"] }], encapsulation: i0.ViewEncapsulation.None });
384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SubmissionGridFooterComponent, decorators: [{
385
- type: Component,
386
- args: [{ encapsulation: ViewEncapsulation.None, template: "<ng-template #footer let-position=\"position\">\n <thead class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.top\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\"></ng-container>\n </thead>\n <tfoot class=\"formio-grid-footer\" *ngIf=\"position === footerPositions.bottom\">\n <ng-container [ngTemplateOutlet]=\"defaultFooterTemplate\"></ng-container>\n </tfoot>\n</ng-template>\n\n<ng-template #defaultFooterTemplate>\n <tr>\n <td *ngIf=\"header\" [colSpan]=\"header.numHeaders\">\n <button *ngIf=\"actionAllowed('submissionCreate') && createText\" class=\"btn btn-primary pull-left float-left\" (click)=\"createItem.emit('form')\"><em class=\"glyphicon glyphicon-plus fa fa-plus bi bi-plus\"></em> {{ createText }}</button>\n <span class=\"pull-right float-right item-counter\"><span class=\"page-num\">{{ body.firstItem }} - {{ body.lastItem }}</span> / {{ body.total }} total</span>\n <pagination [totalItems]=\"body.total\" [itemsPerPage]=\"body.limit\" [(ngModel)]=\"body.skip\" (pageChanged)=\"pageChanged.emit($event)\" [maxSize]=\"size\" class=\"justify-content-center pagination-sm\"></pagination>\n </td>\n </tr>\n</ng-template>\n", styles: ["tfoot.formio-grid-footer td{padding:.3rem}tfoot.formio-grid-footer .page-num{font-size:1.4em}tfoot.formio-grid-footer ul.pagination{margin-top:5px;margin-bottom:0}\n"] }]
387
- }], ctorParameters: function () { return []; } });
388
-
389
- var SubmissionComponents = {
390
- header: SubmissionGridHeaderComponent,
391
- body: SubmissionGridBodyComponent,
392
- footer: SubmissionGridFooterComponent
393
- };
394
-
395
- class FormioGridComponent {
396
- constructor(alerts, resolver, ref) {
397
- this.alerts = alerts;
398
- this.resolver = resolver;
399
- this.ref = ref;
400
- this.footerPosition = GridFooterPositions.bottom;
401
- this.page = 0;
402
- this.isLoading = false;
403
- this.initialized = false;
404
- this.footerPositions = GridFooterPositions;
405
- this.select = this.rowSelect = new EventEmitter();
406
- this.rowAction = new EventEmitter();
407
- this.createItem = new EventEmitter();
408
- this.error = new EventEmitter();
409
- this.isLoading = true;
410
- }
411
- createComponent(property, component) {
412
- const factory = this.resolver.resolveComponentFactory(component);
413
- const componentRef = property.createComponent(factory);
414
- return componentRef.instance;
415
- }
416
- loadGrid(src) {
417
- // If no source is provided, then skip.
418
- if (!src && !this.formio) {
419
- return;
420
- }
421
- // Do not double load.
422
- if (this.formio && this.src && (src === this.src)) {
423
- return;
424
- }
425
- if (src) {
426
- this.src = src;
427
- this.formio = new FormioPromiseService(this.src, { formOnly: true });
428
- }
429
- // Load the header.
430
- this.header.load(this.formio, {}, this.columns)
431
- .then(() => this.setPage(0))
432
- .catch(error => this.onError(error));
433
- }
434
- ngOnInit() {
435
- // Create our components.
436
- const comps = this.components || ((this.gridType === 'form') ? FormComponents : SubmissionComponents);
437
- this.header = this.createComponent(this.headerElement, comps.header);
438
- this.header.actionAllowed = this.actionAllowed.bind(this);
439
- this.header.sort.subscribe(header => this.sortColumn(header));
440
- this.body = this.createComponent(this.bodyElement, comps.body);
441
- this.body.header = this.header;
442
- this.body.actionAllowed = this.actionAllowed.bind(this);
443
- this.body.rowSelect.subscribe(row => this.rowSelect.emit(row));
444
- this.body.rowAction.subscribe(action => this.rowAction.emit(action));
445
- this.footer = this.createComponent(this.footerElement, comps.footer);
446
- this.footer.header = this.header;
447
- this.footer.body = this.body;
448
- this.footer.actionAllowed = this.actionAllowed.bind(this);
449
- this.footer.createText = this.createText;
450
- this.footer.size = this.size;
451
- this.footer.pageChanged.subscribe(page => this.pageChanged(page));
452
- this.footer.createItem.subscribe(item => this.createItem.emit(item));
453
- }
454
- ngOnChanges(changes) {
455
- if (this.initialized) {
456
- if ((changes.src && changes.src.currentValue) ||
457
- (changes.formio && changes.formio.currentValue)) {
458
- this.loadGrid(changes.src.currentValue);
459
- }
460
- if (changes.items && changes.items.currentValue) {
461
- this.refreshGrid();
462
- }
463
- }
464
- if (this.footer &&
465
- (changes.createText && changes.createText.currentValue)) {
466
- this.footer.createText = changes.createText.currentValue;
467
- }
468
- }
469
- ngAfterViewInit() {
470
- this.alerts.setAlerts([]);
471
- this.query = this.query || {};
472
- if (this.refresh) {
473
- this.refresh.subscribe((query) => this.refreshGrid(query));
474
- }
475
- this.loadGrid(this.src);
476
- this.initialized = true;
477
- this.ref.detectChanges();
478
- }
479
- actionAllowed(action) {
480
- if (this.isActionAllowed) {
481
- return this.isActionAllowed(action);
482
- }
483
- else {
484
- return true;
485
- }
486
- }
487
- onError(error) {
488
- this.isLoading = false;
489
- this.error.emit(error);
490
- if (typeof error === 'string' || error.message) {
491
- this.alerts.setAlert({
492
- type: 'danger',
493
- message: error.message || error
494
- });
495
- }
496
- }
497
- refreshGrid(query) {
498
- this.alerts.setAlerts([]);
499
- this.query = query || this.query;
500
- if (!this.query.hasOwnProperty('limit')) {
501
- this.query.limit = 10;
502
- }
503
- if (!this.query.hasOwnProperty('skip')) {
504
- this.query.skip = 0;
505
- }
506
- this.isLoading = true;
507
- this.ref.detectChanges();
508
- Formio.cache = {};
509
- let loader = null;
510
- if (this.items) {
511
- loader = Promise.resolve(this.body.setRows(this.query, this.items));
512
- }
513
- else {
514
- loader = this.body.load(this.formio, this.query);
515
- }
516
- return loader.then(info => {
517
- this.isLoading = false;
518
- this.initialized = true;
519
- this.ref.detectChanges();
520
- }).catch(error => this.onError(error));
521
- }
522
- setPage(num = -1) {
523
- this.page = num !== -1 ? num : this.page;
524
- if (!this.query.hasOwnProperty('limit')) {
525
- this.query.limit = 10;
526
- }
527
- if (!this.query.hasOwnProperty('skip')) {
528
- this.query.skip = 0;
529
- }
530
- this.query.skip = this.page * this.query.limit;
531
- this.refreshGrid();
532
- }
533
- sortColumn(header) {
534
- // Reset all other column sorts.
535
- each(this.header.headers, (col) => {
536
- if (col.key !== header.key) {
537
- col.sort = '';
538
- }
539
- });
540
- switch (header.sort) {
541
- case 'asc':
542
- header.sort = SortType.DESC;
543
- this.query.sort = '-' + header.key;
544
- break;
545
- case 'desc':
546
- header.sort = undefined;
547
- delete this.query.sort;
548
- break;
549
- case undefined:
550
- header.sort = SortType.ASC;
551
- this.query.sort = header.key;
552
- break;
553
- }
554
- this.refreshGrid();
555
- }
556
- pageChanged(page) {
557
- this.setPage(page.page - 1);
558
- }
559
- }
560
- FormioGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormioGridComponent, deps: [{ token: i1$1.FormioAlerts }, { token: i0.ComponentFactoryResolver }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
561
- FormioGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: FormioGridComponent, selector: "formio-grid", inputs: { footerPosition: "footerPosition", src: "src", items: "items", onForm: "onForm", query: "query", refresh: "refresh", columns: "columns", gridType: "gridType", size: "size", components: "components", formio: "formio", label: "label", createText: "createText", isActionAllowed: "isActionAllowed" }, outputs: { select: "select", rowSelect: "rowSelect", rowAction: "rowAction", createItem: "createItem", error: "error" }, viewQueries: [{ propertyName: "headerElement", first: true, predicate: ["headerTemplate"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "bodyElement", first: true, predicate: ["bodyTemplate"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "footerElement", first: true, predicate: ["footerTemplate"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template #headerTemplate></ng-template>\n<ng-template #bodyTemplate></ng-template>\n<ng-template #footerTemplate></ng-template>\n<div class=\"formio-grid\">\n <formio-alerts [alerts]=\"alerts\"></formio-alerts>\n <table class=\"table table-bordered table-striped table-hover\">\n <ng-container *ngIf=\"initialized && [footerPositions.top, footerPositions.both].indexOf(footerPosition) !== -1\"\n [ngTemplateOutlet]=\"footer.template\" [ngTemplateOutletContext]=\"{ position: footerPositions.top, label: label }\">\n </ng-container>\n <ng-container *ngIf=\"initialized\"\n [ngTemplateOutlet]=\"header.template\"></ng-container>\n <formio-loader [isLoading]=\"isLoading\"></formio-loader>\n <ng-container *ngIf=\"initialized\" [ngTemplateOutlet]=\"body.template\"></ng-container>\n <ng-container *ngIf=\"initialized && [footerPositions.bottom, footerPositions.both].indexOf(footerPosition) !== -1\"\n [ngTemplateOutlet]=\"footer.template\" [ngTemplateOutletContext]=\"{ position: footerPositions.bottom, label: label }\">\n </ng-container>\n </table>\n</div>\n", styles: [".formio-grid{position:relative;width:100%}.grid-refresh{height:400px;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i1$1.FormioLoaderComponent, selector: "formio-loader", inputs: ["isLoading"] }, { kind: "component", type: i1$1.FormioAlertsComponent, selector: "formio-alerts", inputs: ["alerts"], outputs: ["focusComponent"] }] });
562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormioGridComponent, decorators: [{
563
- type: Component,
564
- args: [{ selector: 'formio-grid', template: "<ng-template #headerTemplate></ng-template>\n<ng-template #bodyTemplate></ng-template>\n<ng-template #footerTemplate></ng-template>\n<div class=\"formio-grid\">\n <formio-alerts [alerts]=\"alerts\"></formio-alerts>\n <table class=\"table table-bordered table-striped table-hover\">\n <ng-container *ngIf=\"initialized && [footerPositions.top, footerPositions.both].indexOf(footerPosition) !== -1\"\n [ngTemplateOutlet]=\"footer.template\" [ngTemplateOutletContext]=\"{ position: footerPositions.top, label: label }\">\n </ng-container>\n <ng-container *ngIf=\"initialized\"\n [ngTemplateOutlet]=\"header.template\"></ng-container>\n <formio-loader [isLoading]=\"isLoading\"></formio-loader>\n <ng-container *ngIf=\"initialized\" [ngTemplateOutlet]=\"body.template\"></ng-container>\n <ng-container *ngIf=\"initialized && [footerPositions.bottom, footerPositions.both].indexOf(footerPosition) !== -1\"\n [ngTemplateOutlet]=\"footer.template\" [ngTemplateOutletContext]=\"{ position: footerPositions.bottom, label: label }\">\n </ng-container>\n </table>\n</div>\n", styles: [".formio-grid{position:relative;width:100%}.grid-refresh{height:400px;width:100%}\n"] }]
565
- }], ctorParameters: function () { return [{ type: i1$1.FormioAlerts }, { type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { footerPosition: [{
566
- type: Input
567
- }], src: [{
568
- type: Input
569
- }], items: [{
570
- type: Input
571
- }], onForm: [{
572
- type: Input
573
- }], query: [{
574
- type: Input
575
- }], refresh: [{
576
- type: Input
577
- }], columns: [{
578
- type: Input
579
- }], gridType: [{
580
- type: Input
581
- }], size: [{
582
- type: Input
583
- }], components: [{
584
- type: Input
585
- }], formio: [{
586
- type: Input
587
- }], label: [{
588
- type: Input
589
- }], createText: [{
590
- type: Input
591
- }], isActionAllowed: [{
592
- type: Input
593
- }], select: [{
594
- type: Output
595
- }], rowSelect: [{
596
- type: Output
597
- }], rowAction: [{
598
- type: Output
599
- }], createItem: [{
600
- type: Output
601
- }], error: [{
602
- type: Output
603
- }], headerElement: [{
604
- type: ViewChild,
605
- args: ['headerTemplate', { read: ViewContainerRef, static: true }]
606
- }], bodyElement: [{
607
- type: ViewChild,
608
- args: ['bodyTemplate', { read: ViewContainerRef, static: true }]
609
- }], footerElement: [{
610
- type: ViewChild,
611
- args: ['footerTemplate', { read: ViewContainerRef, static: true }]
612
- }] } });
613
-
614
- class FormioGrid {
615
- }
616
- FormioGrid.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormioGrid, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
617
- FormioGrid.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: FormioGrid, declarations: [FormioGridComponent,
618
- FormGridHeaderComponent,
619
- FormGridBodyComponent,
620
- FormGridFooterComponent,
621
- SubmissionGridHeaderComponent,
622
- SubmissionGridBodyComponent,
623
- SubmissionGridFooterComponent,
624
- GridHeaderComponent,
625
- GridBodyComponent,
626
- GridFooterComponent,
627
- TimeSince], imports: [CommonModule,
628
- FormsModule,
629
- FormioModule,
630
- RouterModule, i3.PaginationModule], exports: [FormioGridComponent] });
631
- FormioGrid.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormioGrid, providers: [
632
- FormioAlerts,
633
- GridService
634
- ], imports: [CommonModule,
635
- FormsModule,
636
- FormioModule,
637
- RouterModule,
638
- PaginationModule.forRoot()] });
639
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: FormioGrid, decorators: [{
640
- type: NgModule,
641
- args: [{
642
- imports: [
643
- CommonModule,
644
- FormsModule,
645
- FormioModule,
646
- RouterModule,
647
- PaginationModule.forRoot()
648
- ],
649
- declarations: [
650
- FormioGridComponent,
651
- FormGridHeaderComponent,
652
- FormGridBodyComponent,
653
- FormGridFooterComponent,
654
- SubmissionGridHeaderComponent,
655
- SubmissionGridBodyComponent,
656
- SubmissionGridFooterComponent,
657
- GridHeaderComponent,
658
- GridBodyComponent,
659
- GridFooterComponent,
660
- TimeSince
661
- ],
662
- exports: [
663
- FormioGridComponent
664
- ],
665
- providers: [
666
- FormioAlerts,
667
- GridService
668
- ]
669
- }]
670
- }] });
671
-
672
- /**
673
- * Generated bundle index. Do not edit.
674
- */
675
-
676
- export { FormGridBodyComponent, FormGridFooterComponent, FormGridHeaderComponent, FormioGrid, FormioGridComponent, GridBodyComponent, GridFooterComponent, GridHeaderComponent, GridService, SubmissionGridBodyComponent, SubmissionGridFooterComponent, SubmissionGridHeaderComponent };
677
- //# sourceMappingURL=formio-angular-grid.mjs.map
678
- //# sourceMappingURL=formio-angular-grid.mjs.map