-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
286 lines (241 loc) · 13.7 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"],{
/***/ "./src/$$_lazy_route_resource lazy recursive":
/*!**********************************************************!*\
!*** ./src/$$_lazy_route_resource lazy namespace object ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
function webpackEmptyAsyncContext(req) {
// Here Promise.resolve().then() is used instead of new Promise() to prevent
// uncaught exception popping up in devtools
return Promise.resolve().then(function() {
var e = new Error('Cannot find module "' + req + '".');
e.code = 'MODULE_NOT_FOUND';
throw e;
});
}
webpackEmptyAsyncContext.keys = function() { return []; };
webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
module.exports = webpackEmptyAsyncContext;
webpackEmptyAsyncContext.id = "./src/$$_lazy_route_resource lazy recursive";
/***/ }),
/***/ "./src/app/app.component.css":
/*!***********************************!*\
!*** ./src/app/app.component.css ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = ".custom{\r\n margin-top: 100px;\r\n}\r\n.center{\r\n text-align: center;\r\n}\r\n.text-style{\r\n font-size: 28px;\r\n padding: 15px;\r\n}\r\n.drop-container{\r\n padding-top: 20px;\r\n}\r\n.upload-table{\r\n padding-top: 20px;\r\n}"
/***/ }),
/***/ "./src/app/app.component.html":
/*!************************************!*\
!*** ./src/app/app.component.html ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = "<div class=\"container custom\">\r\n <div class=\"row\">\r\n <div class=\"center\">\r\n <span class=\"text-style\">Example of <a _ngcontent-c0=\"\" href=\"https://www.npmjs.com/package/ngx-file-drop\" target=\"_blank\">ngx-file-drop</a> library</span>\r\n <br>\r\n <span class=\"text-style\">Drag folder or file and the library will make the traverse for you</span>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"drop-container\">\r\n <file-drop headertext=\"Drop files here\" (onFileDrop)=\"dropped($event)\" >\r\n <span></span>\r\n </file-drop>\r\n <div class=\"upload-table\">\r\n <ng-table [config]=\"config\" (tableChanged)=\"onChangeTable(config)\" [rows]=\"rows\" [columns]=\"columns\">\r\n </ng-table>\r\n <pagination *ngIf=\"config.paging\" class=\"pagination-sm\" [(ngModel)]=\"page\" [totalItems]=\"length\" [itemsPerPage]=\"itemsPerPage\"\r\n [maxSize]=\"maxSize\" [boundaryLinks]=\"true\" [rotate]=\"false\" (pageChanged)=\"onChangeTable(config, $event)\" (numPages)=\"numPages = $event\">\r\n </pagination>\r\n </div>\r\n </div>\r\n </div>\r\n</div>"
/***/ }),
/***/ "./src/app/app.component.ts":
/*!**********************************!*\
!*** ./src/app/app.component.ts ***!
\**********************************/
/*! exports provided: AppComponent */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppComponent", function() { return AppComponent; });
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (undefined && undefined.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var AppComponent = /** @class */ (function () {
function AppComponent(ref) {
this.ref = ref;
this.title = 'app works!';
this.files = [];
this.data = [];
this.columns = [
{ title: 'Name', name: 'name' },
{ title: 'Size', name: 'size' },
{ title: 'Last Modified Date', name: 'modified' },
];
this.config = {
paging: true,
className: ['table-striped', 'table-bordered']
};
this.page = 1;
this.itemsPerPage = 10;
this.maxSize = 5;
this.numPages = 1;
this.length = 0;
this.rows = [];
this.units = [
'bytes',
'KB',
'MB',
'GB',
'TB',
'PB'
];
}
AppComponent.prototype.dropped = function (event) {
var _this = this;
console.log("dropped");
this.files = event.files;
this.data = [];
this.rows = [];
this.length = this.files.length;
var index = 0;
for (var _i = 0, _a = event.files; _i < _a.length; _i++) {
var droppedFile = _a[_i];
if (droppedFile.fileEntry.isFile) {
var fileEntry = droppedFile.fileEntry;
fileEntry.file(function (fileData) {
// console.log(fileData);
var modifiedDate = fileData.lastModified.toLocaleString();
_this.data.push({ name: _this.files[index].relativePath, size: _this.transform(fileData.size), modified: modifiedDate });
index++;
if (index == _this.files.length || index == _this.itemsPerPage) {
_this.rows = _this.data.slice(0, _this.itemsPerPage);
_this.length = _this.files.length;
_this.ref.markForCheck();
_this.ref.detectChanges();
}
});
}
else {
index++;
}
}
};
AppComponent.prototype.onChangeTable = function (config, page) {
if (page === void 0) { page = { page: this.page, itemsPerPage: this.itemsPerPage }; }
// let filteredData = this.changeFilter(this.files, this.config);
this.rows = page && config.paging ? this.changePage(page, this.data) : this.data;
this.length = this.files.length;
};
AppComponent.prototype.changePage = function (page, data) {
var start = (page.page - 1) * page.itemsPerPage;
var end = page.itemsPerPage > -1 ? (start + page.itemsPerPage) : data.length;
return data.slice(start, end);
};
AppComponent.prototype.transform = function (bytes, precision) {
if (bytes === void 0) { bytes = 0; }
if (precision === void 0) { precision = 2; }
if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes))
return '?';
var unit = 0;
while (bytes >= 1024) {
bytes /= 1024;
unit++;
}
return bytes.toFixed(+precision) + ' ' + this.units[unit];
};
AppComponent = __decorate([
Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
selector: 'app-root',
template: __webpack_require__(/*! ./app.component.html */ "./src/app/app.component.html"),
styles: [__webpack_require__(/*! ./app.component.css */ "./src/app/app.component.css")]
}),
__metadata("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"]])
], AppComponent);
return AppComponent;
}());
/***/ }),
/***/ "./src/app/app.module.ts":
/*!*******************************!*\
!*** ./src/app/app.module.ts ***!
\*******************************/
/*! exports provided: AppModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppModule", function() { return AppModule; });
/* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js");
/* harmony import */ var _angular_http__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/http */ "./node_modules/@angular/http/fesm5/http.js");
/* harmony import */ var _app_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./app.component */ "./src/app/app.component.ts");
/* harmony import */ var ngx_file_drop__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ngx-file-drop */ "./node_modules/ngx-file-drop/fesm5/ngx-file-drop.js");
/* harmony import */ var ng2_table_ng2_table__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ng2-table/ng2-table */ "./node_modules/ng2-table/ng2-table.js");
/* harmony import */ var ng2_table_ng2_table__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(ng2_table_ng2_table__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var ngx_bootstrap__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ngx-bootstrap */ "./node_modules/ngx-bootstrap/index.js");
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var AppModule = /** @class */ (function () {
function AppModule() {
}
AppModule = __decorate([
Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
declarations: [
_app_component__WEBPACK_IMPORTED_MODULE_4__["AppComponent"]
],
imports: [
_angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__["BrowserModule"],
_angular_forms__WEBPACK_IMPORTED_MODULE_2__["FormsModule"],
_angular_http__WEBPACK_IMPORTED_MODULE_3__["HttpModule"],
ngx_file_drop__WEBPACK_IMPORTED_MODULE_5__["FileDropModule"],
ng2_table_ng2_table__WEBPACK_IMPORTED_MODULE_6__["Ng2TableModule"],
ngx_bootstrap__WEBPACK_IMPORTED_MODULE_7__["PaginationModule"].forRoot()
],
providers: [],
bootstrap: [_app_component__WEBPACK_IMPORTED_MODULE_4__["AppComponent"]]
})
], AppModule);
return AppModule;
}());
/***/ }),
/***/ "./src/environments/environment.ts":
/*!*****************************************!*\
!*** ./src/environments/environment.ts ***!
\*****************************************/
/*! exports provided: environment */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "environment", function() { return environment; });
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
var environment = {
production: false
};
/***/ }),
/***/ "./src/main.ts":
/*!*********************!*\
!*** ./src/main.ts ***!
\*********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
/* harmony import */ var _angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/platform-browser-dynamic */ "./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js");
/* harmony import */ var _app_app_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app/app.module */ "./src/app/app.module.ts");
/* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./environments/environment */ "./src/environments/environment.ts");
if (_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].production) {
Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["enableProdMode"])();
}
Object(_angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__["platformBrowserDynamic"])().bootstrapModule(_app_app_module__WEBPACK_IMPORTED_MODULE_2__["AppModule"]);
/***/ }),
/***/ 0:
/*!***************************!*\
!*** multi ./src/main.ts ***!
\***************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! C:\prj\georgipeltekov.github.io\sources\src\main.ts */"./src/main.ts");
/***/ })
},[[0,"runtime","vendor"]]]);
//# sourceMappingURL=main.js.map