Skip to content

Commit a3e22e2

Browse files
author
Piotr Siatka
committed
Initial commit: Add FilePicker control.
Fix bugs. Refactor.
1 parent eb50ef4 commit a3e22e2

File tree

70 files changed

+6455
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6455
-431
lines changed

src/FilePicker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./controls/filePicker/index";

src/common/utilities/GeneralHelper.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,30 @@ export class GeneralHelper {
217217
return xml;
218218
}
219219

220+
/**
221+
* Returns absoulute domain URL.
222+
* @param url
223+
*/
224+
public static getAbsoluteDomainUrl(url: string): string {
225+
if (url !== undefined) {
226+
const myURL = new URL(url.toLowerCase());
227+
return myURL.protocol + "//" + myURL.host;
228+
} else {
229+
return undefined;
230+
}
231+
}
232+
233+
public static formatBytes(bytes, decimals) {
234+
if (bytes == 0) {
235+
return strings.EmptyFileSize;
236+
}
237+
238+
const k: number = 1024;
239+
const dm = decimals <= 0 ? 0 : decimals || 2;
240+
const i = Math.floor(Math.log(bytes) / Math.log(k));
241+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + strings.SizeUnit[i];
242+
}
243+
220244
private static _getEncodedChar(c): string {
221245
const o = {
222246
"<": "&lt;",
@@ -228,4 +252,4 @@ export class GeneralHelper {
228252
};
229253
return o[c];
230254
}
231-
}
255+
}

0 commit comments

Comments
 (0)