@progress/kendo-spreadsheet-common 1.2.9 → 1.2.10-develop.2

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/index-esm.js CHANGED
@@ -20532,7 +20532,7 @@ function UCS2(out, code) {
20532
20532
  if (code > 0xFFFF) {
20533
20533
  code -= 0x10000;
20534
20534
  out.push(code >>> 10 & 0x3FF | 0xD800,
20535
- 0xDC00 | code & 0x3FF);
20535
+ 0xDC00 | code & 0x3FF);
20536
20536
  } else {
20537
20537
  out.push(code);
20538
20538
  }
@@ -20559,7 +20559,7 @@ let UPPERCASE_X = CODE("X");
20559
20559
 
20560
20560
  let EXIT = {};
20561
20561
 
20562
- function parse$1(data, callbacks) {
20562
+ function parse$1(data, options) {
20563
20563
  let index = 0;
20564
20564
  let stack = [];
20565
20565
  let object = {
@@ -20577,24 +20577,102 @@ function parse$1(data, callbacks) {
20577
20577
  },
20578
20578
  stack: stack
20579
20579
  };
20580
+ let namespaces = null;
20581
+
20582
+ function nsPushFrame() {
20583
+ namespaces = Object.create(namespaces);
20584
+ }
20585
+
20586
+ function nsPopFrame() {
20587
+ namespaces = Object.getPrototypeOf(namespaces);
20588
+ }
20589
+
20590
+ function findNamespace(ns) {
20591
+ let uri = namespaces?.[ns];
20592
+ if (uri == null && ns !== "") {
20593
+ croak(`Undefined namespace ${ns}`);
20594
+ }
20595
+ return uri;
20596
+ }
20597
+
20598
+ function nsIntern(name, ns) {
20599
+ let url = findNamespace(ns);
20600
+ if (url != null) {
20601
+ let prefix = options.namespaces[url];
20602
+ if (prefix) {
20603
+ name = `${prefix}:${name}`;
20604
+ }
20605
+ }
20606
+ return name;
20607
+ }
20608
+
20609
+ // This does two things if `options.namespaces` was specified: (1) it looks for `xmlns` or `xmlns:foo`
20610
+ // attributes. If they are found, the `namespaces` environment is extended with the new definitions. (2) it
20611
+ // qualifies attribute names and $tag with the prefixes specified by the caller in `options.namespaces`, which
20612
+ // should map URL->prefix.
20613
+ //
20614
+ // For example if an XML would use:
20615
+ //
20616
+ // <stuff:workbook xmlns:stuff="http://schemas.openxmlformats.org/spreadsheetml/2006/main">...</stuff:workbook>
20617
+ //
20618
+ // and caller specified an empty prefix for this URL in `options.namespaces`, then tag name sent to the callbacks
20619
+ // will be just `workbook` (no prefix).
20620
+ function nsMaybeExtend(tagName, attrs) {
20621
+ if (!options.namespaces) {
20622
+ return false;
20623
+ }
20624
+ let newFrame = false;
20625
+ for (let [ attr, value ] of Object.entries(attrs)) {
20626
+ if (attr === "xmlns") {
20627
+ if (!newFrame) {
20628
+ nsPushFrame();
20629
+ newFrame = true;
20630
+ }
20631
+ namespaces[""] = value;
20632
+ } else {
20633
+ let m = /^([^:]+):(.*)$/.exec(attr);
20634
+ if (m) {
20635
+ let attrNS = m[1];
20636
+ if (attrNS === "xmlns") {
20637
+ let newNS = m[2];
20638
+ if (!newFrame) {
20639
+ nsPushFrame();
20640
+ newFrame = true;
20641
+ }
20642
+ namespaces[newNS] = value || null;
20643
+ } else if (/^xml/i.test(attrNS)) ; else {
20644
+ attrs[nsIntern(m[2], attrNS)] = value;
20645
+ }
20646
+ }
20647
+ }
20648
+ }
20649
+ let m = /^([^:]+):(.*)$/.exec(tagName);
20650
+ if (m) {
20651
+ tagName = nsIntern(m[2], m[1]);
20652
+ } else {
20653
+ tagName = nsIntern(tagName, "");
20654
+ }
20655
+ attrs.$tag = tagName;
20656
+ return newFrame;
20657
+ }
20580
20658
 
20581
20659
  function readChar(body) {
20582
20660
  let code = data[index++];
20583
20661
  if (!(code & 0xF0 ^ 0xF0)) {// 4 bytes
20584
20662
  UCS2(body,
20585
- ((code & 0x03) << 18) |
20586
- ((data[index++] & 0x3F) << 12) |
20587
- ((data[index++] & 0x3F) << 6) |
20588
- (data[index++] & 0x3F));
20663
+ ((code & 0x03) << 18) |
20664
+ ((data[index++] & 0x3F) << 12) |
20665
+ ((data[index++] & 0x3F) << 6) |
20666
+ (data[index++] & 0x3F));
20589
20667
  } else if (!(code & 0xE0 ^ 0xE0)) {// 3 bytes
20590
20668
  UCS2(body,
20591
- ((code & 0x0F) << 12) |
20592
- ((data[index++] & 0x3F) << 6) |
20593
- (data[index++] & 0x3F));
20669
+ ((code & 0x0F) << 12) |
20670
+ ((data[index++] & 0x3F) << 6) |
20671
+ (data[index++] & 0x3F));
20594
20672
  } else if (!(code & 0xC0 ^ 0xC0)) {// 2 bytes
20595
20673
  UCS2(body,
20596
- ((code & 0x1F) << 6) |
20597
- (data[index++] & 0x3F));
20674
+ ((code & 0x1F) << 6) |
20675
+ (data[index++] & 0x3F));
20598
20676
  } else {
20599
20677
  body.push(code);
20600
20678
  }
@@ -20647,19 +20725,19 @@ function parse$1(data, callbacks) {
20647
20725
 
20648
20726
  function isHexDigit(code) {
20649
20727
  return (code >= 48 && code <= 57) ||
20650
- ((code |= 32) >= 97 && code <= 102); // a..f or A..F
20728
+ ((code |= 32) >= 97 && code <= 102); // a..f or A..F
20651
20729
  }
20652
20730
 
20653
20731
  function isNameStart(code) {
20654
20732
  return code === 58 || // :
20655
- code === 95 || // _
20656
- ((code |= 32) >= 97 && code <= 122); // a..z or A..Z
20733
+ code === 95 || // _
20734
+ ((code |= 32) >= 97 && code <= 122); // a..z or A..Z
20657
20735
  }
20658
20736
 
20659
20737
  function isName(code) {
20660
20738
  return code === 45 || // -
20661
- isDigit(code) ||
20662
- isNameStart(code);
20739
+ isDigit(code) ||
20740
+ isNameStart(code);
20663
20741
  }
20664
20742
 
20665
20743
  function xmlComment() {
@@ -20681,20 +20759,24 @@ function parse$1(data, callbacks) {
20681
20759
  } else {
20682
20760
  name = xmlName();
20683
20761
  attrs = xmlAttrs(name);
20762
+ let nsframe = nsMaybeExtend(name, attrs);
20684
20763
  stack.push(attrs);
20685
20764
  if (eat(END_SHORT_TAG)) {
20686
- call("enter", name, attrs, true);
20765
+ call("enter", attrs.$tag, attrs, true);
20687
20766
  } else {
20688
20767
  skip(GREATER_THAN);
20689
- call("enter", name, attrs);
20768
+ call("enter", attrs.$tag, attrs);
20690
20769
  xmlContent(name);
20691
20770
  if (name !== xmlName()) {
20692
20771
  croak("Bad closing tag");
20693
20772
  }
20694
- call("leave", name, attrs);
20773
+ call("leave", attrs.$tag, attrs);
20695
20774
  skipWhitespace();
20696
20775
  skip(GREATER_THAN);
20697
20776
  }
20777
+ if (nsframe) {
20778
+ nsPopFrame();
20779
+ }
20698
20780
  stack.pop();
20699
20781
  }
20700
20782
  }
@@ -20789,7 +20871,7 @@ function parse$1(data, callbacks) {
20789
20871
  }
20790
20872
 
20791
20873
  function call(what, thing, arg1, arg2) {
20792
- let f = callbacks && callbacks[what];
20874
+ let f = options && options[what];
20793
20875
  if (f) {
20794
20876
  f.call(object, thing, arg1, arg2);
20795
20877
  }
@@ -20886,8 +20968,32 @@ class Deferred {
20886
20968
  /* eslint-disable complexity */
20887
20969
 
20888
20970
 
20889
- // WARNING: removing the following jshint declaration and turning
20890
- // == into === to make JSHint happy will break functionality.
20971
+ // This is a mapping of namespace URI -> prefix expected by our reader. If a
20972
+ // document uses different prefixes, `parseXML` will rename tags based on this
20973
+ // mapping, so our reader can still make sense of it.
20974
+ //
20975
+ // This list is based on what we have in kendo-ooxml. Not all of them are used
20976
+ // here.
20977
+ let NAMESPACES = {
20978
+ "http://schemas.openxmlformats.org/package/2006/relationships": "",
20979
+ "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties": "",
20980
+ "http://schemas.openxmlformats.org/package/2006/content-types": "",
20981
+ "http://schemas.openxmlformats.org/spreadsheetml/2006/main": "",
20982
+ "http://schemas.openxmlformats.org/package/2006/metadata/core-properties": "cp",
20983
+ "http://purl.org/dc/elements/1.1/": "dc",
20984
+ "http://purl.org/dc/terms/": "dcterms",
20985
+ "http://purl.org/dc/dcmitype/": "dcmitype",
20986
+ "http://www.w3.org/2001/XMLSchema-instance": "xsi",
20987
+ "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes": "vt",
20988
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships": "r",
20989
+ "http://schemas.openxmlformats.org/markup-compatibility/2006": "mc",
20990
+ "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac": "x14ac",
20991
+ "urn:schemas-microsoft-com:vml": "v",
20992
+ "urn:schemas-microsoft-com:office:office": "o",
20993
+ "urn:schemas-microsoft-com:office:excel": "x",
20994
+ "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing": "xdr",
20995
+ "http://schemas.openxmlformats.org/drawingml/2006/main": "a",
20996
+ };
20891
20997
 
20892
20998
  let MAP_EXCEL_OPERATOR = {
20893
20999
  // includes only what differs; key is Excel's operator, value
@@ -21135,6 +21241,7 @@ function sheetDimensions(bytes) {
21135
21241
  };
21136
21242
 
21137
21243
  parseXML(bytes, {
21244
+ namespaces: NAMESPACES,
21138
21245
  enter: function(tag, attrs) {
21139
21246
  if (tag === "dimension") {
21140
21247
  ref = calc.parseReference(attrs.ref);
@@ -21916,7 +22023,7 @@ function parse(zip, file, callbacks) {
21916
22023
  let obj = zip.file(file);
21917
22024
  if (obj) {
21918
22025
  obj.async("uint8array").then(bytes => {
21919
- parseXML(bytes, callbacks);
22026
+ parseXML(bytes, { namespaces: NAMESPACES, ...callbacks });
21920
22027
  resolve();
21921
22028
  });
21922
22029
  } else {
package/dist/index.js CHANGED
@@ -20533,7 +20533,7 @@
20533
20533
  if (code > 0xFFFF) {
20534
20534
  code -= 0x10000;
20535
20535
  out.push(code >>> 10 & 0x3FF | 0xD800,
20536
- 0xDC00 | code & 0x3FF);
20536
+ 0xDC00 | code & 0x3FF);
20537
20537
  } else {
20538
20538
  out.push(code);
20539
20539
  }
@@ -20560,7 +20560,7 @@
20560
20560
 
20561
20561
  let EXIT = {};
20562
20562
 
20563
- function parse$1(data, callbacks) {
20563
+ function parse$1(data, options) {
20564
20564
  let index = 0;
20565
20565
  let stack = [];
20566
20566
  let object = {
@@ -20578,24 +20578,102 @@
20578
20578
  },
20579
20579
  stack: stack
20580
20580
  };
20581
+ let namespaces = null;
20582
+
20583
+ function nsPushFrame() {
20584
+ namespaces = Object.create(namespaces);
20585
+ }
20586
+
20587
+ function nsPopFrame() {
20588
+ namespaces = Object.getPrototypeOf(namespaces);
20589
+ }
20590
+
20591
+ function findNamespace(ns) {
20592
+ let uri = namespaces?.[ns];
20593
+ if (uri == null && ns !== "") {
20594
+ croak(`Undefined namespace ${ns}`);
20595
+ }
20596
+ return uri;
20597
+ }
20598
+
20599
+ function nsIntern(name, ns) {
20600
+ let url = findNamespace(ns);
20601
+ if (url != null) {
20602
+ let prefix = options.namespaces[url];
20603
+ if (prefix) {
20604
+ name = `${prefix}:${name}`;
20605
+ }
20606
+ }
20607
+ return name;
20608
+ }
20609
+
20610
+ // This does two things if `options.namespaces` was specified: (1) it looks for `xmlns` or `xmlns:foo`
20611
+ // attributes. If they are found, the `namespaces` environment is extended with the new definitions. (2) it
20612
+ // qualifies attribute names and $tag with the prefixes specified by the caller in `options.namespaces`, which
20613
+ // should map URL->prefix.
20614
+ //
20615
+ // For example if an XML would use:
20616
+ //
20617
+ // <stuff:workbook xmlns:stuff="http://schemas.openxmlformats.org/spreadsheetml/2006/main">...</stuff:workbook>
20618
+ //
20619
+ // and caller specified an empty prefix for this URL in `options.namespaces`, then tag name sent to the callbacks
20620
+ // will be just `workbook` (no prefix).
20621
+ function nsMaybeExtend(tagName, attrs) {
20622
+ if (!options.namespaces) {
20623
+ return false;
20624
+ }
20625
+ let newFrame = false;
20626
+ for (let [ attr, value ] of Object.entries(attrs)) {
20627
+ if (attr === "xmlns") {
20628
+ if (!newFrame) {
20629
+ nsPushFrame();
20630
+ newFrame = true;
20631
+ }
20632
+ namespaces[""] = value;
20633
+ } else {
20634
+ let m = /^([^:]+):(.*)$/.exec(attr);
20635
+ if (m) {
20636
+ let attrNS = m[1];
20637
+ if (attrNS === "xmlns") {
20638
+ let newNS = m[2];
20639
+ if (!newFrame) {
20640
+ nsPushFrame();
20641
+ newFrame = true;
20642
+ }
20643
+ namespaces[newNS] = value || null;
20644
+ } else if (/^xml/i.test(attrNS)) ; else {
20645
+ attrs[nsIntern(m[2], attrNS)] = value;
20646
+ }
20647
+ }
20648
+ }
20649
+ }
20650
+ let m = /^([^:]+):(.*)$/.exec(tagName);
20651
+ if (m) {
20652
+ tagName = nsIntern(m[2], m[1]);
20653
+ } else {
20654
+ tagName = nsIntern(tagName, "");
20655
+ }
20656
+ attrs.$tag = tagName;
20657
+ return newFrame;
20658
+ }
20581
20659
 
20582
20660
  function readChar(body) {
20583
20661
  let code = data[index++];
20584
20662
  if (!(code & 0xF0 ^ 0xF0)) {// 4 bytes
20585
20663
  UCS2(body,
20586
- ((code & 0x03) << 18) |
20587
- ((data[index++] & 0x3F) << 12) |
20588
- ((data[index++] & 0x3F) << 6) |
20589
- (data[index++] & 0x3F));
20664
+ ((code & 0x03) << 18) |
20665
+ ((data[index++] & 0x3F) << 12) |
20666
+ ((data[index++] & 0x3F) << 6) |
20667
+ (data[index++] & 0x3F));
20590
20668
  } else if (!(code & 0xE0 ^ 0xE0)) {// 3 bytes
20591
20669
  UCS2(body,
20592
- ((code & 0x0F) << 12) |
20593
- ((data[index++] & 0x3F) << 6) |
20594
- (data[index++] & 0x3F));
20670
+ ((code & 0x0F) << 12) |
20671
+ ((data[index++] & 0x3F) << 6) |
20672
+ (data[index++] & 0x3F));
20595
20673
  } else if (!(code & 0xC0 ^ 0xC0)) {// 2 bytes
20596
20674
  UCS2(body,
20597
- ((code & 0x1F) << 6) |
20598
- (data[index++] & 0x3F));
20675
+ ((code & 0x1F) << 6) |
20676
+ (data[index++] & 0x3F));
20599
20677
  } else {
20600
20678
  body.push(code);
20601
20679
  }
@@ -20648,19 +20726,19 @@
20648
20726
 
20649
20727
  function isHexDigit(code) {
20650
20728
  return (code >= 48 && code <= 57) ||
20651
- ((code |= 32) >= 97 && code <= 102); // a..f or A..F
20729
+ ((code |= 32) >= 97 && code <= 102); // a..f or A..F
20652
20730
  }
20653
20731
 
20654
20732
  function isNameStart(code) {
20655
20733
  return code === 58 || // :
20656
- code === 95 || // _
20657
- ((code |= 32) >= 97 && code <= 122); // a..z or A..Z
20734
+ code === 95 || // _
20735
+ ((code |= 32) >= 97 && code <= 122); // a..z or A..Z
20658
20736
  }
20659
20737
 
20660
20738
  function isName(code) {
20661
20739
  return code === 45 || // -
20662
- isDigit(code) ||
20663
- isNameStart(code);
20740
+ isDigit(code) ||
20741
+ isNameStart(code);
20664
20742
  }
20665
20743
 
20666
20744
  function xmlComment() {
@@ -20682,20 +20760,24 @@
20682
20760
  } else {
20683
20761
  name = xmlName();
20684
20762
  attrs = xmlAttrs(name);
20763
+ let nsframe = nsMaybeExtend(name, attrs);
20685
20764
  stack.push(attrs);
20686
20765
  if (eat(END_SHORT_TAG)) {
20687
- call("enter", name, attrs, true);
20766
+ call("enter", attrs.$tag, attrs, true);
20688
20767
  } else {
20689
20768
  skip(GREATER_THAN);
20690
- call("enter", name, attrs);
20769
+ call("enter", attrs.$tag, attrs);
20691
20770
  xmlContent(name);
20692
20771
  if (name !== xmlName()) {
20693
20772
  croak("Bad closing tag");
20694
20773
  }
20695
- call("leave", name, attrs);
20774
+ call("leave", attrs.$tag, attrs);
20696
20775
  skipWhitespace();
20697
20776
  skip(GREATER_THAN);
20698
20777
  }
20778
+ if (nsframe) {
20779
+ nsPopFrame();
20780
+ }
20699
20781
  stack.pop();
20700
20782
  }
20701
20783
  }
@@ -20790,7 +20872,7 @@
20790
20872
  }
20791
20873
 
20792
20874
  function call(what, thing, arg1, arg2) {
20793
- let f = callbacks && callbacks[what];
20875
+ let f = options && options[what];
20794
20876
  if (f) {
20795
20877
  f.call(object, thing, arg1, arg2);
20796
20878
  }
@@ -20887,8 +20969,32 @@
20887
20969
  /* eslint-disable complexity */
20888
20970
 
20889
20971
 
20890
- // WARNING: removing the following jshint declaration and turning
20891
- // == into === to make JSHint happy will break functionality.
20972
+ // This is a mapping of namespace URI -> prefix expected by our reader. If a
20973
+ // document uses different prefixes, `parseXML` will rename tags based on this
20974
+ // mapping, so our reader can still make sense of it.
20975
+ //
20976
+ // This list is based on what we have in kendo-ooxml. Not all of them are used
20977
+ // here.
20978
+ let NAMESPACES = {
20979
+ "http://schemas.openxmlformats.org/package/2006/relationships": "",
20980
+ "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties": "",
20981
+ "http://schemas.openxmlformats.org/package/2006/content-types": "",
20982
+ "http://schemas.openxmlformats.org/spreadsheetml/2006/main": "",
20983
+ "http://schemas.openxmlformats.org/package/2006/metadata/core-properties": "cp",
20984
+ "http://purl.org/dc/elements/1.1/": "dc",
20985
+ "http://purl.org/dc/terms/": "dcterms",
20986
+ "http://purl.org/dc/dcmitype/": "dcmitype",
20987
+ "http://www.w3.org/2001/XMLSchema-instance": "xsi",
20988
+ "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes": "vt",
20989
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships": "r",
20990
+ "http://schemas.openxmlformats.org/markup-compatibility/2006": "mc",
20991
+ "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac": "x14ac",
20992
+ "urn:schemas-microsoft-com:vml": "v",
20993
+ "urn:schemas-microsoft-com:office:office": "o",
20994
+ "urn:schemas-microsoft-com:office:excel": "x",
20995
+ "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing": "xdr",
20996
+ "http://schemas.openxmlformats.org/drawingml/2006/main": "a",
20997
+ };
20892
20998
 
20893
20999
  let MAP_EXCEL_OPERATOR = {
20894
21000
  // includes only what differs; key is Excel's operator, value
@@ -21136,6 +21242,7 @@
21136
21242
  };
21137
21243
 
21138
21244
  parseXML(bytes, {
21245
+ namespaces: NAMESPACES,
21139
21246
  enter: function(tag, attrs) {
21140
21247
  if (tag === "dimension") {
21141
21248
  ref = calc.parseReference(attrs.ref);
@@ -21917,7 +22024,7 @@
21917
22024
  let obj = zip.file(file);
21918
22025
  if (obj) {
21919
22026
  obj.async("uint8array").then(bytes => {
21920
- parseXML(bytes, callbacks);
22027
+ parseXML(bytes, { namespaces: NAMESPACES, ...callbacks });
21921
22028
  resolve();
21922
22029
  });
21923
22030
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-spreadsheet-common",
3
3
  "description": "Kendo UI platform-independent Spreadsheet library",
4
- "version": "1.2.9",
4
+ "version": "1.2.10-develop.2",
5
5
  "keywords": [
6
6
  "Kendo UI"
7
7
  ],
@@ -49,8 +49,7 @@
49
49
  "husky": "^8.0.2",
50
50
  "jest-cli": "^29.0.0",
51
51
  "jest-environment-jsdom": "^29.5.0",
52
- "rollup": "^3.5.1",
53
- "semantic-release": "^24.2.3"
52
+ "rollup": "^3.5.1"
54
53
  },
55
54
  "repository": {
56
55
  "type": "git",
@@ -59,19 +58,6 @@
59
58
  "bugs": {
60
59
  "url": "https://github.com/telerik/kendo-angular"
61
60
  },
62
- "release": {
63
- "branches": [
64
- {
65
- "name": "master",
66
- "channel": "latest"
67
- },
68
- {
69
- "name": "develop",
70
- "prerelease": true,
71
- "channel": "dev"
72
- }
73
- ]
74
- },
75
61
  "publishConfig": {
76
62
  "access": "public"
77
63
  },