@scifeon/sdk 0.118.0 → 0.119.0

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.
@@ -0,0 +1 @@
1
+ export * from "./test-helper";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./test-helper"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scifeon/sdk",
3
- "version": "0.118.0",
3
+ "version": "0.119.0",
4
4
  "description": "A tool for developing Apps for Scifeon.",
5
5
  "author": {
6
6
  "name": "Scifeon",
@@ -10,10 +10,17 @@
10
10
  "bin": {
11
11
  "scifeon-cli": "dist/sdk/src/index.js"
12
12
  },
13
+ "exports": {
14
+ "./utils": {
15
+ "types": "./dist/sdk/src/utils/index.d.ts",
16
+ "default": "./dist/sdk/src/utils/index.js"
17
+ }
18
+ },
13
19
  "files": [
14
20
  "bin",
15
21
  "dist",
16
- "resources"
22
+ "resources",
23
+ "src/utils"
17
24
  ],
18
25
  "scripts": {
19
26
  "prepublishOnly": "npm run build",
@@ -8,7 +8,7 @@
8
8
  <div class="page-panels">
9
9
  <p>Class property <o>message</o>: <b>${message}</b></p>
10
10
  <p>Input field for class property <o>message</o>: <input type="text" value.bind="message"/></p>
11
- <p><button click.trigger="button()">Call function!</button></p>
11
+ <p><button click.delegate="button()">Call function!</button></p>
12
12
  </div>
13
13
  </div>
14
14
  </template>
@@ -0,0 +1 @@
1
+ export * from "./test-helper";
@@ -0,0 +1,56 @@
1
+ // import { ParsingOptions, WorkBook } from "@scifeon/plugins/src/xlsx-types";
2
+ import * as fs from "fs";
3
+ import fetch from "node-fetch";
4
+
5
+ // const XLSX_URL = "https://unpkg.com/xlsx/dist/xlsx.full.min.js";
6
+ const XLSX_URL = "https://cdn.sheetjs.com/xlsx-0.20.0/package/dist/xlsx.full.min.js";
7
+
8
+ const requireCache = {};
9
+
10
+ const requireURL = async (url: string) => {
11
+ let script: string;
12
+
13
+ if (requireCache[url]) {
14
+ script = requireCache[url];
15
+ } else {
16
+ const response = await fetch(url);
17
+ script = await response.text();
18
+ requireCache[url] = script;
19
+ }
20
+
21
+ const m = module as any;
22
+
23
+ const _module = new m.constructor();
24
+ _module.filename = url;
25
+ _module._compile(script, url);
26
+
27
+ return _module.exports;
28
+ };
29
+
30
+ export class TestHelper {
31
+ public static async XLSX() {
32
+ return requireURL(XLSX_URL);
33
+ }
34
+
35
+ public static async fileToXLSX(filename: string, options: any/* ParsingOptions*/ = { cellDates: true })
36
+ : Promise<any/* WorkBook*/> {
37
+ const xlsx = await TestHelper.XLSX();
38
+
39
+ return xlsx.read(fs.readFileSync(filename), options);
40
+ }
41
+
42
+ public static async csvToXLSX(csv: any[][], options: any/* ParsingOptions*/ = { cellDates: true })
43
+ : Promise<any/* WorkBook*/> {
44
+ const xlsx = await TestHelper.XLSX();
45
+
46
+ const wb = xlsx.utils.book_new();
47
+
48
+ wb.SheetNames.push("Sheet1");
49
+
50
+ const ws = xlsx.utils.aoa_to_sheet(csv, { ...options });
51
+
52
+ wb.Sheets.Sheet1 = ws;
53
+
54
+ return wb;
55
+ }
56
+ }