initial release of S [ci skip]
This commit is contained in:
parent
458575184d
commit
e3c5eac99c
1
packages/s/.gitignore
vendored
Normal file
1
packages/s/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.cache
|
8
packages/s/.npmignore
Normal file
8
packages/s/.npmignore
Normal file
@ -0,0 +1,8 @@
|
||||
.cache/
|
||||
src/
|
||||
misc/
|
||||
tsconfig/
|
||||
*.tgz
|
||||
test.ts
|
||||
Makefile
|
||||
tsconfig.*
|
201
packages/s/LICENSE
Normal file
201
packages/s/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright (C) 2019-present SheetJS LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
23
packages/s/Makefile
Normal file
23
packages/s/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
.PHONY: all
|
||||
all: cjs esm mjs S types
|
||||
|
||||
.PHONY: cjs esm types
|
||||
cjs esm types: %: ./tsconfig/tsconfig.%.json ./src/
|
||||
@tsc -p ./tsconfig/tsconfig.$@.json
|
||||
|
||||
.PHONY: mjs
|
||||
mjs: esm
|
||||
@./misc/make_mjs.sh
|
||||
|
||||
.PHONY: S
|
||||
S: cjs
|
||||
@webpack-cli --config misc/webpack.config.js misc/standalone.js --output-filename S.js --display-modules --display-reasons --profile
|
||||
|
||||
.PHONY: test
|
||||
test: mjs cjs S
|
||||
@node misc/require_test.njs
|
||||
@node --experimental-modules --es-module-specifier-resolution=node misc/import_test.mjs
|
||||
@cp dist/S.js misc && node misc/puppetsta.js
|
||||
@concurrently --kill-others -s first "http-server -s -p 7262" "node misc/puppetmjs.js"
|
||||
@parcel build misc/parcel.html -d misc/parcel -o parcelout.html --public-url "./" && node misc/puppetpcl.js
|
||||
@mocha -r ts-node/register test.ts
|
12
packages/s/README.md
Normal file
12
packages/s/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# s
|
||||
|
||||
TypeScript/JavaScript wrapper closely aligned with the OfficeJS Excel API in the
|
||||
MIT-licensed <https://github.com/OfficeDev/office-js-docs-reference>
|
||||
|
||||
The `1.x.x` releases should not be treated as stable. `0.x.x` releases serve to
|
||||
preserve the original use of the `S` module.
|
||||
|
||||
## License
|
||||
|
||||
Please consult the attached LICENSE file for details. All rights not explicitly
|
||||
granted by the Apache 2.0 License are reserved by the Original Author.
|
11
packages/s/dist/S.js
vendored
Normal file
11
packages/s/dist/S.js
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
var S=function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var o=r(1);t.exports=o},function(t,e,r){"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
let o;function n(){return o}function s(t){o=t}r.r(e),"undefined"!=typeof XLSX&&(o=XLSX);
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
class i{constructor(t){this._wb=t}}
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
class u{constructor(t){this._name=t}get raw(){return this._name}}
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
class a{constructor(t){this._wb=t}get items(){return this._wb.Workbook&&this._wb.Workbook.Names?this._wb.Workbook.Names.filter(t=>{t.Sheet}).map(t=>new u(t)):[]}getName(t){if(this._wb.Workbook&&this._wb.Workbook.Names){const e=this._wb.Workbook.Names;for(let r=0;r<e.length;++r)if(e[r].Name.toLowerCase()==t.toLowerCase()&&null==e[r].Sheet)return new u(e[r])}throw new Error(`Cannot find defined name |${t}|`)}get count(){return this._wb.Workbook&&this._wb.Workbook.Names?this._wb.Workbook.Names.filter(t=>{t.Sheet}).length:0}add(t,e,r){try{return this.getName(t)}catch(o){const n={Name:t,Ref:e.toString(),Comment:r||""};return this._wb.Workbook||(this._wb.Workbook={}),this._wb.Workbook.Names||(this._wb.Workbook.Names=[]),this._wb.Workbook.Names.push(n),new u(n)}}}
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
class b{constructor(t){this._wb=t||n().utils.book_new(),this._ws=new i(this._wb),this._names=new a(this._wb)}get wb(){return this._wb}get names(){return this._names}get worksheets(){return this._ws}}r.d(e,"Workbook",function(){return b}),r.d(e,"get_XLSX",function(){return n}),r.d(e,"set_XLSX",function(){return s})}]);
|
10
packages/s/dist/cjs/index.js
vendored
Normal file
10
packages/s/dist/cjs/index.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Workbook_1 = require("./s/Workbook");
|
||||
exports.Workbook = Workbook_1.Workbook;
|
||||
var XLSXWrapper_1 = require("./s/XLSXWrapper");
|
||||
exports.get_XLSX = XLSXWrapper_1.get_XLSX;
|
||||
exports.set_XLSX = XLSXWrapper_1.set_XLSX;
|
||||
//# sourceMappingURL=index.js.map
|
1
packages/s/dist/cjs/index.js.map
vendored
Normal file
1
packages/s/dist/cjs/index.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB,yCAAwC;AAA/B,8BAAA,QAAQ,CAAA;AACjB,+CAAqD;AAA5C,iCAAA,QAAQ,CAAA;AAAE,iCAAA,QAAQ,CAAA"}
|
12
packages/s/dist/cjs/s/Range.js
vendored
Normal file
12
packages/s/dist/cjs/s/Range.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Range = /** @class */ (function () {
|
||||
function Range() {
|
||||
}
|
||||
return Range;
|
||||
}());
|
||||
exports.Range = Range;
|
||||
;
|
||||
//# sourceMappingURL=Range.js.map
|
1
packages/s/dist/cjs/s/Range.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/Range.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Range.js","sourceRoot":"../src/","sources":["s/Range.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB;IAAA;IACA,CAAC;IAAD,YAAC;AAAD,CAAC,AADD,IACC;AADY,sBAAK;AACjB,CAAC"}
|
37
packages/s/dist/cjs/s/Workbook.js
vendored
Normal file
37
packages/s/dist/cjs/s/Workbook.js
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
var XLSXWrapper_1 = require("./XLSXWrapper");
|
||||
var WorksheetCollection_1 = require("./worksheet/WorksheetCollection");
|
||||
var WorkbookDefinedNameCollection_1 = require("./names/WorkbookDefinedNameCollection");
|
||||
var Workbook = /** @class */ (function () {
|
||||
function Workbook(wb) {
|
||||
this._wb = wb || XLSXWrapper_1.get_XLSX().utils.book_new();
|
||||
this._ws = new WorksheetCollection_1.WorksheetCollection(this._wb);
|
||||
this._names = new WorkbookDefinedNameCollection_1.WorkbookDefinedNameCollection(this._wb);
|
||||
}
|
||||
;
|
||||
Object.defineProperty(Workbook.prototype, "wb", {
|
||||
get: function () { return this._wb; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
;
|
||||
Object.defineProperty(Workbook.prototype, "names", {
|
||||
get: function () { return this._names; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Workbook.prototype, "worksheets", {
|
||||
get: function () { return this._ws; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
;
|
||||
return Workbook;
|
||||
}());
|
||||
exports.Workbook = Workbook;
|
||||
;
|
||||
//# sourceMappingURL=Workbook.js.map
|
1
packages/s/dist/cjs/s/Workbook.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/Workbook.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Workbook.js","sourceRoot":"../src/","sources":["s/Workbook.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB,oCAAoC;AAEpC,6CAAyC;AACzC,uEAAsE;AAEtE,uFAAsF;AAEtF;IAKE,kBAAY,EAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,sBAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,6DAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAAA,CAAC;IAEF,sBAAI,wBAAE;aAAN,cAA0B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;;OAAA;IAAA,CAAC;IAE7C,sBAAI,2BAAK;aAAT,cAAqC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;;OAAA;IAE1D,sBAAI,gCAAU;aAAd,cAAwC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;;OAAA;IAAA,CAAC;IAE7D,eAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,4BAAQ;AAiBpB,CAAC"}
|
15
packages/s/dist/cjs/s/XLSXWrapper.js
vendored
Normal file
15
packages/s/dist/cjs/s/XLSXWrapper.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
var _XLSX;
|
||||
if (typeof XLSX !== "undefined")
|
||||
_XLSX = XLSX;
|
||||
function get_XLSX() { return _XLSX; }
|
||||
exports.get_XLSX = get_XLSX;
|
||||
;
|
||||
function set_XLSX(xlsx) { _XLSX = xlsx; }
|
||||
exports.set_XLSX = set_XLSX;
|
||||
;
|
||||
//# sourceMappingURL=XLSXWrapper.js.map
|
1
packages/s/dist/cjs/s/XLSXWrapper.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/XLSXWrapper.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"XLSXWrapper.js","sourceRoot":"../src/","sources":["s/XLSXWrapper.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB,oCAAoC;AAEpC,IAAI,KAAkB,CAAC;AACvB,IAAG,OAAO,IAAI,KAAK,WAAW;IAAE,KAAK,GAAG,IAAI,CAAC;AAE7C,SAAgB,QAAQ,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;AAA5C,4BAA4C;AAAA,CAAC;AAC7C,SAAgB,QAAQ,CAAC,IAAiB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AAA7D,4BAA6D;AAAA,CAAC"}
|
21
packages/s/dist/cjs/s/names/DefinedName.js
vendored
Normal file
21
packages/s/dist/cjs/s/names/DefinedName.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
var DefinedName = /** @class */ (function () {
|
||||
function DefinedName(name) {
|
||||
this._name = name;
|
||||
}
|
||||
;
|
||||
Object.defineProperty(DefinedName.prototype, "raw", {
|
||||
get: function () { return this._name; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
;
|
||||
return DefinedName;
|
||||
}());
|
||||
exports.DefinedName = DefinedName;
|
||||
;
|
||||
//# sourceMappingURL=DefinedName.js.map
|
1
packages/s/dist/cjs/s/names/DefinedName.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/names/DefinedName.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedName.js","sourceRoot":"../src/","sources":["s/names/DefinedName.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB,uCAAuC;AAEvC;IAGE,qBAAY,IAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAAA,CAAC;IAEF,sBAAI,4BAAG;aAAP,cAA8B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;;;OAAA;IAAA,CAAC;IAErD,kBAAC;AAAD,CAAC,AATD,IASC;AATY,kCAAW;AASvB,CAAC"}
|
6
packages/s/dist/cjs/s/names/DefinedNameCollection.js
vendored
Normal file
6
packages/s/dist/cjs/s/names/DefinedNameCollection.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
;
|
||||
//# sourceMappingURL=DefinedNameCollection.js.map
|
1
packages/s/dist/cjs/s/names/DefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/names/DefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/DefinedNameCollection.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAUnB,CAAC"}
|
81
packages/s/dist/cjs/s/names/WorkbookDefinedNameCollection.js
vendored
Normal file
81
packages/s/dist/cjs/s/names/WorkbookDefinedNameCollection.js
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var DefinedName_1 = require("./DefinedName");
|
||||
//import { Range } from "../Range";
|
||||
var WorkbookDefinedNameCollection = /** @class */ (function () {
|
||||
function WorkbookDefinedNameCollection(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
Object.defineProperty(WorkbookDefinedNameCollection.prototype, "items", {
|
||||
/**
|
||||
* Get read-only array of global defined names
|
||||
*/
|
||||
get: function () {
|
||||
if (!this._wb.Workbook)
|
||||
return [];
|
||||
if (!this._wb.Workbook.Names)
|
||||
return [];
|
||||
return this._wb.Workbook.Names.filter(function (name) { name.Sheet == null; }).map(function (name) { return new DefinedName_1.DefinedName(name); });
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
;
|
||||
/**
|
||||
* Get defined name object
|
||||
*/
|
||||
WorkbookDefinedNameCollection.prototype.getName = function (name) {
|
||||
if (this._wb.Workbook && this._wb.Workbook.Names) {
|
||||
var names = this._wb.Workbook.Names;
|
||||
for (var i = 0; i < names.length; ++i) {
|
||||
if (names[i].Name.toLowerCase() != name.toLowerCase())
|
||||
continue;
|
||||
if (names[i].Sheet != null)
|
||||
continue;
|
||||
return new DefinedName_1.DefinedName(names[i]);
|
||||
}
|
||||
}
|
||||
throw new Error("Cannot find defined name |" + name + "|");
|
||||
};
|
||||
Object.defineProperty(WorkbookDefinedNameCollection.prototype, "count", {
|
||||
/**
|
||||
* Number of global defined names
|
||||
*/
|
||||
get: function () {
|
||||
if (!this._wb.Workbook)
|
||||
return 0;
|
||||
if (!this._wb.Workbook.Names)
|
||||
return 0;
|
||||
return this._wb.Workbook.Names.filter(function (name) { typeof name.Sheet == "undefined"; }).length;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
/**
|
||||
* Add or update defined name
|
||||
* @param name String name
|
||||
* @param ref Range object or string range/formula
|
||||
* @param comment Optional comment
|
||||
*/
|
||||
WorkbookDefinedNameCollection.prototype.add = function (name, ref /*TODO: | Range */, comment) {
|
||||
try {
|
||||
return this.getName(name);
|
||||
}
|
||||
catch (e) {
|
||||
var nm = { Name: name, Ref: ref.toString(), Comment: comment || "" };
|
||||
if (!this._wb.Workbook)
|
||||
this._wb.Workbook = {};
|
||||
if (!this._wb.Workbook.Names)
|
||||
this._wb.Workbook.Names = [];
|
||||
this._wb.Workbook.Names.push(nm);
|
||||
return new DefinedName_1.DefinedName(nm);
|
||||
}
|
||||
};
|
||||
return WorkbookDefinedNameCollection;
|
||||
}());
|
||||
exports.WorkbookDefinedNameCollection = WorkbookDefinedNameCollection;
|
||||
;
|
||||
//# sourceMappingURL=WorkbookDefinedNameCollection.js.map
|
1
packages/s/dist/cjs/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorkbookDefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/WorkbookDefinedNameCollection.ts"],"names":[],"mappings":"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"}
|
15
packages/s/dist/cjs/s/worksheet/WorksheetCollection.js
vendored
Normal file
15
packages/s/dist/cjs/s/worksheet/WorksheetCollection.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
var WorksheetCollection = /** @class */ (function () {
|
||||
function WorksheetCollection(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
return WorksheetCollection;
|
||||
}());
|
||||
exports.WorksheetCollection = WorksheetCollection;
|
||||
;
|
||||
//# sourceMappingURL=WorksheetCollection.js.map
|
1
packages/s/dist/cjs/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
1
packages/s/dist/cjs/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorksheetCollection.js","sourceRoot":"../src/","sources":["s/worksheet/WorksheetCollection.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;AAEpB,uCAAuC;AAEvC;IAGE,6BAAY,EAAiB;QAC3B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAAA,CAAC;IACJ,0BAAC;AAAD,CAAC,AAND,IAMC;AANY,kDAAmB;AAM/B,CAAC"}
|
9
packages/s/dist/cjs/umd.js
vendored
Normal file
9
packages/s/dist/cjs/umd.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./index"));
|
||||
//# sourceMappingURL=umd.js.map
|
1
packages/s/dist/cjs/umd.js.map
vendored
Normal file
1
packages/s/dist/cjs/umd.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"umd.js","sourceRoot":"../src/","sources":["umd.ts"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,oBAAoB;;;;;AAEpB,6BAAwB"}
|
5
packages/s/dist/esm/index.js
vendored
Normal file
5
packages/s/dist/esm/index.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export { Workbook } from "./s/Workbook";
|
||||
export { get_XLSX, set_XLSX } from "./s/XLSXWrapper";
|
||||
//# sourceMappingURL=index.js.map
|
1
packages/s/dist/esm/index.js.map
vendored
Normal file
1
packages/s/dist/esm/index.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
6
packages/s/dist/esm/s/Range.js
vendored
Normal file
6
packages/s/dist/esm/s/Range.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export class Range {
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=Range.js.map
|
1
packages/s/dist/esm/s/Range.js.map
vendored
Normal file
1
packages/s/dist/esm/s/Range.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Range.js","sourceRoot":"../src/","sources":["s/Range.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,MAAM,OAAO,KAAK;CACjB;AAAA,CAAC"}
|
21
packages/s/dist/esm/s/Workbook.js
vendored
Normal file
21
packages/s/dist/esm/s/Workbook.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
import { get_XLSX } from "./XLSXWrapper";
|
||||
import { WorksheetCollection } from "./worksheet/WorksheetCollection";
|
||||
import { WorkbookDefinedNameCollection } from "./names/WorkbookDefinedNameCollection";
|
||||
export class Workbook {
|
||||
constructor(wb) {
|
||||
this._wb = wb || get_XLSX().utils.book_new();
|
||||
this._ws = new WorksheetCollection(this._wb);
|
||||
this._names = new WorkbookDefinedNameCollection(this._wb);
|
||||
}
|
||||
;
|
||||
get wb() { return this._wb; }
|
||||
;
|
||||
get names() { return this._names; }
|
||||
get worksheets() { return this._ws; }
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=Workbook.js.map
|
1
packages/s/dist/esm/s/Workbook.js.map
vendored
Normal file
1
packages/s/dist/esm/s/Workbook.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Workbook.js","sourceRoot":"../src/","sources":["s/Workbook.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,oCAAoC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,MAAM,OAAO,QAAQ;IAKnB,YAAY,EAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAAA,CAAC;IAEF,IAAI,EAAE,KAAoB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAAA,CAAC;IAE7C,IAAI,KAAK,KAA4B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D,IAAI,UAAU,KAA0B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAAA,CAAC;CAE5D;AAAA,CAAC"}
|
11
packages/s/dist/esm/s/XLSXWrapper.js
vendored
Normal file
11
packages/s/dist/esm/s/XLSXWrapper.js
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
let _XLSX;
|
||||
if (typeof XLSX !== "undefined")
|
||||
_XLSX = XLSX;
|
||||
export function get_XLSX() { return _XLSX; }
|
||||
;
|
||||
export function set_XLSX(xlsx) { _XLSX = xlsx; }
|
||||
;
|
||||
//# sourceMappingURL=XLSXWrapper.js.map
|
1
packages/s/dist/esm/s/XLSXWrapper.js.map
vendored
Normal file
1
packages/s/dist/esm/s/XLSXWrapper.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"XLSXWrapper.js","sourceRoot":"../src/","sources":["s/XLSXWrapper.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,oCAAoC;AAEpC,IAAI,KAAkB,CAAC;AACvB,IAAG,OAAO,IAAI,KAAK,WAAW;IAAE,KAAK,GAAG,IAAI,CAAC;AAE7C,MAAM,UAAU,QAAQ,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;AAAA,CAAC;AAC7C,MAAM,UAAU,QAAQ,CAAC,IAAiB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC"}
|
13
packages/s/dist/esm/s/names/DefinedName.js
vendored
Normal file
13
packages/s/dist/esm/s/names/DefinedName.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
export class DefinedName {
|
||||
constructor(name) {
|
||||
this._name = name;
|
||||
}
|
||||
;
|
||||
get raw() { return this._name; }
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=DefinedName.js.map
|
1
packages/s/dist/esm/s/names/DefinedName.js.map
vendored
Normal file
1
packages/s/dist/esm/s/names/DefinedName.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedName.js","sourceRoot":"../src/","sources":["s/names/DefinedName.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,uCAAuC;AAEvC,MAAM,OAAO,WAAW;IAGtB,YAAY,IAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAAA,CAAC;IAEF,IAAI,GAAG,KAAuB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAAA,CAAC;CAEpD;AAAA,CAAC"}
|
4
packages/s/dist/esm/s/names/DefinedNameCollection.js
vendored
Normal file
4
packages/s/dist/esm/s/names/DefinedNameCollection.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
;
|
||||
//# sourceMappingURL=DefinedNameCollection.js.map
|
1
packages/s/dist/esm/s/names/DefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/esm/s/names/DefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/DefinedNameCollection.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAUnB,CAAC"}
|
69
packages/s/dist/esm/s/names/WorkbookDefinedNameCollection.js
vendored
Normal file
69
packages/s/dist/esm/s/names/WorkbookDefinedNameCollection.js
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
import { DefinedName } from "./DefinedName";
|
||||
//import { Range } from "../Range";
|
||||
export class WorkbookDefinedNameCollection {
|
||||
constructor(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
/**
|
||||
* Get read-only array of global defined names
|
||||
*/
|
||||
get items() {
|
||||
if (!this._wb.Workbook)
|
||||
return [];
|
||||
if (!this._wb.Workbook.Names)
|
||||
return [];
|
||||
return this._wb.Workbook.Names.filter((name) => { name.Sheet == null; }).map((name) => new DefinedName(name));
|
||||
}
|
||||
;
|
||||
/**
|
||||
* Get defined name object
|
||||
*/
|
||||
getName(name) {
|
||||
if (this._wb.Workbook && this._wb.Workbook.Names) {
|
||||
const names = this._wb.Workbook.Names;
|
||||
for (let i = 0; i < names.length; ++i) {
|
||||
if (names[i].Name.toLowerCase() != name.toLowerCase())
|
||||
continue;
|
||||
if (names[i].Sheet != null)
|
||||
continue;
|
||||
return new DefinedName(names[i]);
|
||||
}
|
||||
}
|
||||
throw new Error(`Cannot find defined name |${name}|`);
|
||||
}
|
||||
/**
|
||||
* Number of global defined names
|
||||
*/
|
||||
get count() {
|
||||
if (!this._wb.Workbook)
|
||||
return 0;
|
||||
if (!this._wb.Workbook.Names)
|
||||
return 0;
|
||||
return this._wb.Workbook.Names.filter((name) => { typeof name.Sheet == "undefined"; }).length;
|
||||
}
|
||||
/**
|
||||
* Add or update defined name
|
||||
* @param name String name
|
||||
* @param ref Range object or string range/formula
|
||||
* @param comment Optional comment
|
||||
*/
|
||||
add(name, ref /*TODO: | Range */, comment) {
|
||||
try {
|
||||
return this.getName(name);
|
||||
}
|
||||
catch (e) {
|
||||
const nm = { Name: name, Ref: ref.toString(), Comment: comment || "" };
|
||||
if (!this._wb.Workbook)
|
||||
this._wb.Workbook = {};
|
||||
if (!this._wb.Workbook.Names)
|
||||
this._wb.Workbook.Names = [];
|
||||
this._wb.Workbook.Names.push(nm);
|
||||
return new DefinedName(nm);
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=WorkbookDefinedNameCollection.js.map
|
1
packages/s/dist/esm/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/esm/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorkbookDefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/WorkbookDefinedNameCollection.ts"],"names":[],"mappings":"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"}
|
11
packages/s/dist/esm/s/worksheet/WorksheetCollection.js
vendored
Normal file
11
packages/s/dist/esm/s/worksheet/WorksheetCollection.js
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
export class WorksheetCollection {
|
||||
constructor(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=WorksheetCollection.js.map
|
1
packages/s/dist/esm/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
1
packages/s/dist/esm/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorksheetCollection.js","sourceRoot":"../src/","sources":["s/worksheet/WorksheetCollection.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,uCAAuC;AAEvC,MAAM,OAAO,mBAAmB;IAG9B,YAAY,EAAiB;QAC3B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAAA,CAAC;CACH;AAAA,CAAC"}
|
4
packages/s/dist/esm/umd.js
vendored
Normal file
4
packages/s/dist/esm/umd.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export * from "./index";
|
||||
//# sourceMappingURL=umd.js.map
|
1
packages/s/dist/esm/umd.js.map
vendored
Normal file
1
packages/s/dist/esm/umd.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"umd.js","sourceRoot":"../src/","sources":["umd.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,cAAc,SAAS,CAAC"}
|
1
packages/s/dist/mjs/index.js.map
vendored
Normal file
1
packages/s/dist/mjs/index.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
5
packages/s/dist/mjs/index.mjs
vendored
Normal file
5
packages/s/dist/mjs/index.mjs
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export { Workbook } from "./s/Workbook.mjs";
|
||||
export { get_XLSX, set_XLSX } from "./s/XLSXWrapper.mjs";
|
||||
//# sourceMappingURL=index.js.map
|
1
packages/s/dist/mjs/s/Range.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/Range.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Range.js","sourceRoot":"../src/","sources":["s/Range.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,MAAM,OAAO,KAAK;CACjB;AAAA,CAAC"}
|
6
packages/s/dist/mjs/s/Range.mjs
vendored
Normal file
6
packages/s/dist/mjs/s/Range.mjs
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export class Range {
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=Range.js.map
|
1
packages/s/dist/mjs/s/Workbook.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/Workbook.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Workbook.js","sourceRoot":"../src/","sources":["s/Workbook.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,oCAAoC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,MAAM,OAAO,QAAQ;IAKnB,YAAY,EAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAAA,CAAC;IAEF,IAAI,EAAE,KAAoB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAAA,CAAC;IAE7C,IAAI,KAAK,KAA4B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D,IAAI,UAAU,KAA0B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAAA,CAAC;CAE5D;AAAA,CAAC"}
|
21
packages/s/dist/mjs/s/Workbook.mjs
vendored
Normal file
21
packages/s/dist/mjs/s/Workbook.mjs
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
import { get_XLSX } from "./XLSXWrapper.mjs";
|
||||
import { WorksheetCollection } from "./worksheet/WorksheetCollection.mjs";
|
||||
import { WorkbookDefinedNameCollection } from "./names/WorkbookDefinedNameCollection.mjs";
|
||||
export class Workbook {
|
||||
constructor(wb) {
|
||||
this._wb = wb || get_XLSX().utils.book_new();
|
||||
this._ws = new WorksheetCollection(this._wb);
|
||||
this._names = new WorkbookDefinedNameCollection(this._wb);
|
||||
}
|
||||
;
|
||||
get wb() { return this._wb; }
|
||||
;
|
||||
get names() { return this._names; }
|
||||
get worksheets() { return this._ws; }
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=Workbook.js.map
|
1
packages/s/dist/mjs/s/XLSXWrapper.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/XLSXWrapper.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"XLSXWrapper.js","sourceRoot":"../src/","sources":["s/XLSXWrapper.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,oCAAoC;AAEpC,IAAI,KAAkB,CAAC;AACvB,IAAG,OAAO,IAAI,KAAK,WAAW;IAAE,KAAK,GAAG,IAAI,CAAC;AAE7C,MAAM,UAAU,QAAQ,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;AAAA,CAAC;AAC7C,MAAM,UAAU,QAAQ,CAAC,IAAiB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC"}
|
11
packages/s/dist/mjs/s/XLSXWrapper.mjs
vendored
Normal file
11
packages/s/dist/mjs/s/XLSXWrapper.mjs
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../xlsx.d.ts"/>
|
||||
let _XLSX;
|
||||
if (typeof XLSX !== "undefined")
|
||||
_XLSX = XLSX;
|
||||
export function get_XLSX() { return _XLSX; }
|
||||
;
|
||||
export function set_XLSX(xlsx) { _XLSX = xlsx; }
|
||||
;
|
||||
//# sourceMappingURL=XLSXWrapper.js.map
|
1
packages/s/dist/mjs/s/names/DefinedName.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/names/DefinedName.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedName.js","sourceRoot":"../src/","sources":["s/names/DefinedName.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,uCAAuC;AAEvC,MAAM,OAAO,WAAW;IAGtB,YAAY,IAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAAA,CAAC;IAEF,IAAI,GAAG,KAAuB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAAA,CAAC;CAEpD;AAAA,CAAC"}
|
13
packages/s/dist/mjs/s/names/DefinedName.mjs
vendored
Normal file
13
packages/s/dist/mjs/s/names/DefinedName.mjs
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
export class DefinedName {
|
||||
constructor(name) {
|
||||
this._name = name;
|
||||
}
|
||||
;
|
||||
get raw() { return this._name; }
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=DefinedName.js.map
|
1
packages/s/dist/mjs/s/names/DefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/names/DefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/DefinedNameCollection.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAUnB,CAAC"}
|
4
packages/s/dist/mjs/s/names/DefinedNameCollection.mjs
vendored
Normal file
4
packages/s/dist/mjs/s/names/DefinedNameCollection.mjs
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
;
|
||||
//# sourceMappingURL=DefinedNameCollection.js.map
|
1
packages/s/dist/mjs/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/names/WorkbookDefinedNameCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorkbookDefinedNameCollection.js","sourceRoot":"../src/","sources":["s/names/WorkbookDefinedNameCollection.ts"],"names":[],"mappings":"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"}
|
69
packages/s/dist/mjs/s/names/WorkbookDefinedNameCollection.mjs
vendored
Normal file
69
packages/s/dist/mjs/s/names/WorkbookDefinedNameCollection.mjs
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
import { DefinedName } from "./DefinedName.mjs";
|
||||
//import { Range } from "../Range.mjs";
|
||||
export class WorkbookDefinedNameCollection {
|
||||
constructor(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
/**
|
||||
* Get read-only array of global defined names
|
||||
*/
|
||||
get items() {
|
||||
if (!this._wb.Workbook)
|
||||
return [];
|
||||
if (!this._wb.Workbook.Names)
|
||||
return [];
|
||||
return this._wb.Workbook.Names.filter((name) => { name.Sheet == null; }).map((name) => new DefinedName(name));
|
||||
}
|
||||
;
|
||||
/**
|
||||
* Get defined name object
|
||||
*/
|
||||
getName(name) {
|
||||
if (this._wb.Workbook && this._wb.Workbook.Names) {
|
||||
const names = this._wb.Workbook.Names;
|
||||
for (let i = 0; i < names.length; ++i) {
|
||||
if (names[i].Name.toLowerCase() != name.toLowerCase())
|
||||
continue;
|
||||
if (names[i].Sheet != null)
|
||||
continue;
|
||||
return new DefinedName(names[i]);
|
||||
}
|
||||
}
|
||||
throw new Error(`Cannot find defined name |${name}|`);
|
||||
}
|
||||
/**
|
||||
* Number of global defined names
|
||||
*/
|
||||
get count() {
|
||||
if (!this._wb.Workbook)
|
||||
return 0;
|
||||
if (!this._wb.Workbook.Names)
|
||||
return 0;
|
||||
return this._wb.Workbook.Names.filter((name) => { typeof name.Sheet == "undefined"; }).length;
|
||||
}
|
||||
/**
|
||||
* Add or update defined name
|
||||
* @param name String name
|
||||
* @param ref Range object or string range/formula
|
||||
* @param comment Optional comment
|
||||
*/
|
||||
add(name, ref /*TODO: | Range */, comment) {
|
||||
try {
|
||||
return this.getName(name);
|
||||
}
|
||||
catch (e) {
|
||||
const nm = { Name: name, Ref: ref.toString(), Comment: comment || "" };
|
||||
if (!this._wb.Workbook)
|
||||
this._wb.Workbook = {};
|
||||
if (!this._wb.Workbook.Names)
|
||||
this._wb.Workbook.Names = [];
|
||||
this._wb.Workbook.Names.push(nm);
|
||||
return new DefinedName(nm);
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=WorkbookDefinedNameCollection.js.map
|
1
packages/s/dist/mjs/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
1
packages/s/dist/mjs/s/worksheet/WorksheetCollection.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorksheetCollection.js","sourceRoot":"../src/","sources":["s/worksheet/WorksheetCollection.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,uCAAuC;AAEvC,MAAM,OAAO,mBAAmB;IAG9B,YAAY,EAAiB;QAC3B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAAA,CAAC;CACH;AAAA,CAAC"}
|
11
packages/s/dist/mjs/s/worksheet/WorksheetCollection.mjs
vendored
Normal file
11
packages/s/dist/mjs/s/worksheet/WorksheetCollection.mjs
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/// <reference path="../../xlsx.d.ts"/>
|
||||
export class WorksheetCollection {
|
||||
constructor(wb) {
|
||||
this._wb = wb;
|
||||
}
|
||||
;
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=WorksheetCollection.js.map
|
1
packages/s/dist/mjs/umd.js.map
vendored
Normal file
1
packages/s/dist/mjs/umd.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"umd.js","sourceRoot":"../src/","sources":["umd.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,oBAAoB;AAEpB,cAAc,SAAS,CAAC"}
|
4
packages/s/dist/mjs/umd.mjs
vendored
Normal file
4
packages/s/dist/mjs/umd.mjs
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
export * from "./index.mjs";
|
||||
//# sourceMappingURL=umd.js.map
|
3
packages/s/dist/typings/index.d.ts
vendored
Normal file
3
packages/s/dist/typings/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
export { Workbook } from "./s/Workbook";
|
||||
export { get_XLSX, set_XLSX } from "./s/XLSXWrapper";
|
3
packages/s/dist/typings/s/Range.d.ts
vendored
Normal file
3
packages/s/dist/typings/s/Range.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
export declare class Range {
|
||||
}
|
13
packages/s/dist/typings/s/Workbook.d.ts
vendored
Normal file
13
packages/s/dist/typings/s/Workbook.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/// <reference path="../../../src/xlsx.d.ts" />
|
||||
import { WorksheetCollection } from "./worksheet/WorksheetCollection";
|
||||
import { DefinedNameCollection } from "./names/DefinedNameCollection";
|
||||
export declare class Workbook {
|
||||
private readonly _wb;
|
||||
private readonly _ws;
|
||||
private readonly _names;
|
||||
constructor(wb?: XLSX.WorkBook);
|
||||
readonly wb: XLSX.WorkBook;
|
||||
readonly names: DefinedNameCollection;
|
||||
readonly worksheets: WorksheetCollection;
|
||||
}
|
4
packages/s/dist/typings/s/XLSXWrapper.d.ts
vendored
Normal file
4
packages/s/dist/typings/s/XLSXWrapper.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/// <reference path="../../../src/xlsx.d.ts" />
|
||||
export declare function get_XLSX(): typeof XLSX;
|
||||
export declare function set_XLSX(xlsx: typeof XLSX): void;
|
7
packages/s/dist/typings/s/names/DefinedName.d.ts
vendored
Normal file
7
packages/s/dist/typings/s/names/DefinedName.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/// <reference path="../../../../src/xlsx.d.ts" />
|
||||
export declare class DefinedName {
|
||||
readonly _name: XLSX.DefinedName;
|
||||
constructor(name: XLSX.DefinedName);
|
||||
readonly raw: XLSX.DefinedName;
|
||||
}
|
9
packages/s/dist/typings/s/names/DefinedNameCollection.d.ts
vendored
Normal file
9
packages/s/dist/typings/s/names/DefinedNameCollection.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
import { DefinedName } from "./DefinedName";
|
||||
import { Range } from "../Range";
|
||||
export interface DefinedNameCollection {
|
||||
readonly items: DefinedName[];
|
||||
readonly count: number;
|
||||
add(name: string, ref: string | Range, comment?: string): DefinedName;
|
||||
getName(name: string): DefinedName;
|
||||
}
|
27
packages/s/dist/typings/s/names/WorkbookDefinedNameCollection.d.ts
vendored
Normal file
27
packages/s/dist/typings/s/names/WorkbookDefinedNameCollection.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/// <reference path="../../../../src/xlsx.d.ts" />
|
||||
import { DefinedNameCollection } from "./DefinedNameCollection";
|
||||
import { DefinedName } from "./DefinedName";
|
||||
export declare class WorkbookDefinedNameCollection implements DefinedNameCollection {
|
||||
private readonly _wb;
|
||||
constructor(wb: XLSX.WorkBook);
|
||||
/**
|
||||
* Get read-only array of global defined names
|
||||
*/
|
||||
readonly items: DefinedName[];
|
||||
/**
|
||||
* Get defined name object
|
||||
*/
|
||||
getName(name: string): DefinedName;
|
||||
/**
|
||||
* Number of global defined names
|
||||
*/
|
||||
readonly count: number;
|
||||
/**
|
||||
* Add or update defined name
|
||||
* @param name String name
|
||||
* @param ref Range object or string range/formula
|
||||
* @param comment Optional comment
|
||||
*/
|
||||
add(name: string, ref: string, comment?: string): DefinedName;
|
||||
}
|
6
packages/s/dist/typings/s/worksheet/WorksheetCollection.d.ts
vendored
Normal file
6
packages/s/dist/typings/s/worksheet/WorksheetCollection.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/// <reference path="../../../../src/xlsx.d.ts" />
|
||||
export declare class WorksheetCollection {
|
||||
private readonly _wb;
|
||||
constructor(wb: XLSX.WorkBook);
|
||||
}
|
2
packages/s/dist/typings/umd.d.ts
vendored
Normal file
2
packages/s/dist/typings/umd.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
export * from "./index";
|
4
packages/s/esm.mjs
Normal file
4
packages/s/esm.mjs
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
|
||||
export * from "./dist/mjs/index.mjs";
|
4
packages/s/index.js
Normal file
4
packages/s/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
|
||||
module.exports = require('./dist/cjs/');
|
2
packages/s/misc/.gitignore
vendored
Normal file
2
packages/s/misc/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
S.js
|
||||
parcel/
|
15
packages/s/misc/import_test.mjs
Normal file
15
packages/s/misc/import_test.mjs
Normal file
@ -0,0 +1,15 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
|
||||
import assert from "assert";
|
||||
import * as S from "../esm";
|
||||
|
||||
/* song and dance for node 12 esm */
|
||||
import { createRequire } from 'module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const XLSX = require("../../../");
|
||||
|
||||
assert(S != null);
|
||||
S.set_XLSX(XLSX);
|
||||
assert(S.get_XLSX() == XLSX);
|
||||
assert(S.get_XLSX().version);
|
8
packages/s/misc/make_mjs.sh
Executable file
8
packages/s/misc/make_mjs.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
rm -rf dist/mjs/
|
||||
cp -r dist/esm dist/mjs
|
||||
find dist/mjs -name '*.js' | while read x; do
|
||||
<"$x" awk '/(im|ex)port / { gsub(/";/, ".mjs\";"); } 1' > "${x%.js}.mjs"
|
||||
rm -f "$x"
|
||||
done
|
||||
|
8
packages/s/misc/parcel.js
Normal file
8
packages/s/misc/parcel.js
Normal file
@ -0,0 +1,8 @@
|
||||
import * as S from "../esm";
|
||||
const XLSX = require("./xlsx.mini.min.js");
|
||||
function assert(x) { if(!x) throw "assert failed"; }
|
||||
|
||||
assert(S != null);
|
||||
S.set_XLSX(XLSX);
|
||||
assert(S.get_XLSX() == XLSX);
|
||||
assert(S.get_XLSX().version);
|
15
packages/s/misc/puppetmjs.js
Normal file
15
packages/s/misc/puppetmjs.js
Normal file
@ -0,0 +1,15 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const path = require("path");
|
||||
|
||||
const target = "http://localhost:7262/misc/module.html";
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.waitFor(1000);
|
||||
console.log("page");
|
||||
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
|
||||
page.on('error', (err) => { console.error(err); process.exit(1); });
|
||||
page.on('pageerror', (err) => { console.error(err); process.exit(2); });
|
||||
await page.goto(target);
|
||||
await browser.close();
|
||||
})();
|
14
packages/s/misc/puppetpcl.js
Normal file
14
packages/s/misc/puppetpcl.js
Normal file
@ -0,0 +1,14 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const path = require("path");
|
||||
|
||||
const target = `file://${path.resolve(`${__dirname}/parcel/parcelout.html`)}`;
|
||||
console.log(target);
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
|
||||
page.on('error', (err) => { console.error(err); process.exit(1); });
|
||||
page.on('pageerror', (err) => { console.error(err); process.exit(2); });
|
||||
await page.goto(target);
|
||||
await browser.close();
|
||||
})();
|
14
packages/s/misc/puppetsta.js
Normal file
14
packages/s/misc/puppetsta.js
Normal file
@ -0,0 +1,14 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const path = require("path");
|
||||
|
||||
const target = `file://${path.resolve(`${__dirname}/standalone.html`)}`;
|
||||
console.log(target);
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
|
||||
page.on('error', (err) => { console.error(err); process.exit(1); });
|
||||
page.on('pageerror', (err) => { console.error(err); process.exit(2); });
|
||||
await page.goto(target);
|
||||
await browser.close();
|
||||
})();
|
11
packages/s/misc/require_test.njs
Normal file
11
packages/s/misc/require_test.njs
Normal file
@ -0,0 +1,11 @@
|
||||
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
|
||||
var assert = require("assert");
|
||||
var XLSX = require("../../../");
|
||||
var S = require("../");
|
||||
|
||||
assert(S != null);
|
||||
S.set_XLSX(XLSX);
|
||||
assert(S.get_XLSX() == XLSX);
|
||||
assert(S.get_XLSX().version);
|
2
packages/s/misc/standalone.js
Normal file
2
packages/s/misc/standalone.js
Normal file
@ -0,0 +1,2 @@
|
||||
var S = require("../");
|
||||
module.exports = S;
|
10
packages/s/misc/webpack.config.js
Normal file
10
packages/s/misc/webpack.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
output: {
|
||||
libraryTarget: "var",
|
||||
library: "S"
|
||||
},
|
||||
node: {
|
||||
process: false,
|
||||
browser: false
|
||||
}
|
||||
}
|
1
packages/s/misc/xlsx.mini.min.js
vendored
Symbolic link
1
packages/s/misc/xlsx.mini.min.js
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../../dist/xlsx.mini.min.js
|
53
packages/s/package.json
Normal file
53
packages/s/package.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "s",
|
||||
"version": "1.0.0",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet Helper Library",
|
||||
"keywords": [
|
||||
"excel",
|
||||
"office",
|
||||
"spreadsheet"
|
||||