@operato/scene-excel 9.0.0-beta.1 → 9.0.0-beta.15

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.
package/dist/excel.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /*
2
2
  * Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
+ var Excel_1;
5
+ import { __decorate } from "tslib";
4
6
  import * as XLSX from 'xlsx';
5
- import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
7
+ import { DataSource, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene';
6
8
  const NATURE = {
7
9
  mutable: false,
8
10
  resizable: true,
@@ -51,13 +53,13 @@ async function fetchData(url) {
51
53
  console.log('result', result);
52
54
  return result;
53
55
  }
54
- export default class Excel extends DataSource(RectPath(Shape)) {
56
+ let Excel = Excel_1 = class Excel extends DataSource(RectPath(Shape)) {
55
57
  static get image() {
56
- if (!Excel._image) {
57
- Excel._image = new Image();
58
- Excel._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href;
58
+ if (!Excel_1._image) {
59
+ Excel_1._image = new Image();
60
+ Excel_1._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href;
59
61
  }
60
- return Excel._image;
62
+ return Excel_1._image;
61
63
  }
62
64
  dispose() {
63
65
  this._stopRepeater();
@@ -72,7 +74,7 @@ export default class Excel extends DataSource(RectPath(Shape)) {
72
74
  render(context) {
73
75
  var { left, top, width, height } = this.bounds;
74
76
  context.beginPath();
75
- this.drawImage(context, Excel.image, left, top, width, height);
77
+ this.drawImage(context, Excel_1.image, left, top, width, height);
76
78
  }
77
79
  get nature() {
78
80
  return NATURE;
@@ -120,6 +122,9 @@ export default class Excel extends DataSource(RectPath(Shape)) {
120
122
  this._initInterval();
121
123
  }
122
124
  }
123
- }
124
- Component.register('excel', Excel);
125
+ };
126
+ Excel = Excel_1 = __decorate([
127
+ sceneComponent('excel')
128
+ ], Excel);
129
+ export default Excel;
125
130
  //# sourceM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,IAAI,CAAC,WAAW;YAAE,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAEpD,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,UAAU,CAAC,UAAe,EAAE,KAAU;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBACnB,OAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,aAAa,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as XLSX from 'xlsx'\n\nimport { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'attachment-selector',\n label: 'src',\n name: 'src',\n placeholder: 'Excel File URL'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'seconds'\n }\n ],\n help: 'scene/component/excel'\n}\n\nasync function fetchData(url: string) {\n if (!url.startsWith('data:')) {\n // prevent read from cache\n if (url.indexOf('?') !== -1) {\n url = url + `&ts=${Date.now()}`\n } else {\n url = url + `?ts=${Date.now()}`\n }\n }\n\n const file = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/xlsx'\n },\n credentials: 'include'\n })\n\n const workbook: XLSX.WorkBook = XLSX.read(await file.arrayBuffer(), { type: 'array' })\n\n var result: { [key: string]: unknown } = {}\n workbook.SheetNames.forEach((sheet: string) => {\n var roa = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])\n if (roa.length) {\n result[sheet] = roa\n }\n })\n\n console.log('result', result)\n return result\n}\n\nexport default class Excel extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Excel._image) {\n Excel._image = new Image()\n Excel._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href\n }\n\n return Excel._image\n }\n\n private repeatTimer?: NodeJS.Timeout\n private src?: string\n\n dispose() {\n this._stopRepeater()\n super.dispose()\n }\n\n ready() {\n const { src } = this.state\n\n if (src) {\n this._initInterval()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Excel.image, left, top, width, height)\n }\n\n get nature() {\n return NATURE\n }\n\n _initInterval() {\n this._stopRepeater()\n this._startRepeater()\n }\n\n _startRepeater() {\n var { src, period } = this.state\n period = Number(period)\n\n var fetchable = true\n\n if (period && this.app.isViewMode) {\n this.repeatTimer = setInterval(() => {\n fetchable &&\n this.repeatTimer &&\n requestAnimationFrame(() => {\n fetchable = true\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n })\n fetchable = false\n }, period * 1000)\n }\n\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n }\n\n _stopRepeater() {\n if (this.repeatTimer) clearTimeout(this.repeatTimer)\n\n delete this.repeatTimer\n }\n\n ondropfile(transfered: any, files: any) {\n for (let i = 0; i < transfered.length; i++) {\n if (/\\.xlsx?$/.test(transfered[i].name)) {\n this.src = files[i]\n return\n }\n }\n }\n\n onchange(after: Properties, before: Properties) {\n if ('period' in after || 'src' in after) {\n this._initInterval()\n }\n }\n}\n\nComponent.register('excel', Excel)\n"]}
1
+ {"version":3,"file":"excel.js","sourceRoot":"","sources":["../src/excel.ts"],"names":[],"mappings":"A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C;IAED,UAAU,CAAC,UAAe,EAAE,KAAU;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBACnB,OAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,aAAa,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CACF,CAAA;AAzFoB,KAAK;IADzB,cAAc,CAAC,OAAO,CAAC;GACH,KAAK,CAyFzB;eAzFoB,KAAK","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as XLSX from 'xlsx'\n\nimport {\n Component,\n ComponentNature,\n DataSource,\n Properties,\n RectPath,\n Shape,\n sceneComponent\n} from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'attachment-selector',\n label: 'src',\n name: 'src',\n placeholder: 'Excel File URL'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'seconds'\n }\n ],\n help: 'scene/component/excel'\n}\n\nasync function fetchData(url: string) {\n if (!url.startsWith('data:')) {\n // prevent read from cache\n if (url.indexOf('?') !== -1) {\n url = url + `&ts=${Date.now()}`\n } else {\n url = url + `?ts=${Date.now()}`\n }\n }\n\n const file = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/xlsx'\n },\n credentials: 'include'\n })\n\n const workbook: XLSX.WorkBook = XLSX.read(await file.arrayBuffer(), { type: 'array' })\n\n var result: { [key: string]: unknown } = {}\n workbook.SheetNames.forEach((sheet: string) => {\n var roa = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])\n if (roa.length) {\n result[sheet] = roa\n }\n })\n\n console.log('result', result)\n return result\n}\n\n@sceneComponent('excel')\nexport default class Excel extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Excel._image) {\n Excel._image = new Image()\n Excel._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href\n }\n\n return Excel._image\n }\n\n private repeatTimer?: NodeJS.Timeout\n private src?: string\n\n dispose() {\n this._stopRepeater()\n super.dispose()\n }\n\n ready() {\n const { src } = this.state\n\n if (src) {\n this._initInterval()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Excel.image, left, top, width, height)\n }\n\n get nature() {\n return NATURE\n }\n\n _initInterval() {\n this._stopRepeater()\n this._startRepeater()\n }\n\n _startRepeater() {\n var { src, period } = this.state\n period = Number(period)\n\n var fetchable = true\n\n if (period && this.app.isViewMode) {\n this.repeatTimer = setInterval(() => {\n fetchable &&\n this.repeatTimer &&\n requestAnimationFrame(() => {\n fetchable = true\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n })\n fetchable = false\n }, period * 1000)\n }\n\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n }\n\n _stopRepeater() {\n if (this.repeatTimer) clearTimeout(this.repeatTimer)\n\n delete this.repeatTimer\n }\n\n ondropfile(transfered: any, files: any) {\n for (let i = 0; i < transfered.length; i++) {\n if (/\\.xlsx?$/.test(transfered[i].name)) {\n this.src = files[i]\n return\n }\n }\n }\n\n onchange(after: Properties, before: Properties) {\n if ('period' in after || 'src' in after) {\n this._initInterval()\n }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import Excel from './excel';
1
+ import Excel from './excel.js';
2
2
  declare const _default: (typeof Excel)[];
3
3
  export default _default;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import Excel from './excel';
1
+ import Excel from './excel.js';
2
2
  export default [Excel];
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,eAAe,CAAC,KAAK,CAAC,CAAA","sourcesContent":["import Excel from './excel'\n\nexport default [Excel]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,eAAe,CAAC,KAAK,CAAC,CAAA","sourcesContent":["import Excel from './excel.js'\n\nexport default [Excel]\n"]}
@@ -1,3 +1,3 @@
1
- import excel from './excel';
1
+ import excel from './excel.js';
2
2
  export default [excel];
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,eAAe,CAAC,KAAK,CAAC,CAAA","sourcesContent":["import excel from './excel'\n\nexport default [excel]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,eAAe,CAAC,KAAK,CAAC,CAAA","sourcesContent":["import excel from './excel.js'\n\nexport default [excel]\n"]}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@operato/scene-excel",
3
3
  "description": "Excel integration component for things-scene",
4
- "version": "9.0.0-beta.1",
4
+ "version": "9.0.0-beta.15",
5
+ "type": "module",
5
6
  "author": "heartyoh",
6
7
  "main": "dist/index.js",
7
8
  "module": "dist/index.js",
@@ -38,8 +39,8 @@
38
39
  "@typescript-eslint/parser": "^4.33.0",
39
40
  "@web/dev-server": "^0.1.28",
40
41
  "concurrently": "^8.0.1",
41
- "eslint": "^8.39.0",
42
- "eslint-config-prettier": "^8.3.0",
42
+ "eslint": "^9.18.0",
43
+ "eslint-config-prettier": "^10.0.1",
43
44
  "husky": "^8.0.3",
44
45
  "lint-staged": "^13.2.2",
45
46
  "prettier": "^2.4.1",
@@ -58,5 +59,5 @@
58
59
  "prettier --write"
59
60
  ]
60
61
  },
61
- "gitHead": "6c745ed97d64cb720df566cba0f809f2041b09e8"
62
+ "gitHead": "3a94a8a9ee8cb8de82ad331cb08b9e48d6625d31"
62
63
  }
@@ -1,4 +1,4 @@
1
- import templates from './dist/templates'
1
+ import templates from './dist/templates/index.js'
2
2
 
3
3
  export default {
4
4
  templates