ixbrl-viewer 1.4.1__py3-none-any.whl → 1.4.86__py3-none-any.whl

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.
Files changed (190) hide show
  1. iXBRLViewerPlugin/__init__.py +231 -127
  2. iXBRLViewerPlugin/_version.py +33 -3
  3. iXBRLViewerPlugin/constants.py +96 -2
  4. iXBRLViewerPlugin/featureConfig.py +8 -1
  5. iXBRLViewerPlugin/iXBRLViewer.py +356 -214
  6. iXBRLViewerPlugin/plugin.py +12 -0
  7. iXBRLViewerPlugin/ui.py +81 -50
  8. iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js +1 -1
  9. iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js.LICENSE.txt +12 -5
  10. iXBRLViewerPlugin/viewer/i18next-parser.config.js +1 -1
  11. iXBRLViewerPlugin/viewer/src/data/utr.json +1244 -0
  12. iXBRLViewerPlugin/viewer/src/html/fact-details.html +69 -38
  13. iXBRLViewerPlugin/viewer/src/html/footer-logo.html +4 -0
  14. iXBRLViewerPlugin/viewer/src/html/footnote-details.html +2 -2
  15. iXBRLViewerPlugin/viewer/src/html/inspector.html +352 -197
  16. iXBRLViewerPlugin/viewer/src/i18n/cy/balancetypes.json +1 -0
  17. iXBRLViewerPlugin/viewer/src/i18n/cy/currencies.json +13 -0
  18. iXBRLViewerPlugin/viewer/src/i18n/cy/datatypes.json +9 -0
  19. iXBRLViewerPlugin/viewer/src/i18n/cy/labelroles.json +24 -0
  20. iXBRLViewerPlugin/viewer/src/i18n/cy/referenceparts.json +10 -0
  21. iXBRLViewerPlugin/viewer/src/i18n/cy/scale.json +16 -0
  22. iXBRLViewerPlugin/viewer/src/i18n/cy/tooltips.json +17 -0
  23. iXBRLViewerPlugin/viewer/src/i18n/cy/translation.json +179 -0
  24. iXBRLViewerPlugin/viewer/src/i18n/da/balancetypes.json +4 -0
  25. iXBRLViewerPlugin/viewer/src/i18n/da/currencies.json +13 -0
  26. iXBRLViewerPlugin/viewer/src/i18n/da/datatypes.json +9 -0
  27. iXBRLViewerPlugin/viewer/src/i18n/da/labelroles.json +24 -0
  28. iXBRLViewerPlugin/viewer/src/i18n/da/referenceparts.json +10 -0
  29. iXBRLViewerPlugin/viewer/src/i18n/da/scale.json +15 -0
  30. iXBRLViewerPlugin/viewer/src/i18n/da/tooltips.json +17 -0
  31. iXBRLViewerPlugin/viewer/src/i18n/da/translation.json +179 -0
  32. iXBRLViewerPlugin/viewer/src/i18n/de/balancetypes.json +4 -0
  33. iXBRLViewerPlugin/viewer/src/i18n/de/currencies.json +13 -0
  34. iXBRLViewerPlugin/viewer/src/i18n/de/datatypes.json +9 -0
  35. iXBRLViewerPlugin/viewer/src/i18n/de/labelroles.json +24 -0
  36. iXBRLViewerPlugin/viewer/src/i18n/de/referenceparts.json +10 -0
  37. iXBRLViewerPlugin/viewer/src/i18n/de/scale.json +15 -0
  38. iXBRLViewerPlugin/viewer/src/i18n/de/tooltips.json +17 -0
  39. iXBRLViewerPlugin/viewer/src/i18n/de/translation.json +179 -0
  40. iXBRLViewerPlugin/viewer/src/i18n/en/balancetypes.json +4 -0
  41. iXBRLViewerPlugin/viewer/src/i18n/en/datatypes.json +10 -0
  42. iXBRLViewerPlugin/viewer/src/i18n/en/labelroles.json +4 -0
  43. iXBRLViewerPlugin/viewer/src/i18n/en/scale.json +16 -0
  44. iXBRLViewerPlugin/viewer/src/i18n/en/tooltips.json +17 -0
  45. iXBRLViewerPlugin/viewer/src/i18n/en/translation.json +73 -23
  46. iXBRLViewerPlugin/viewer/src/i18n/es/balancetypes.json +4 -0
  47. iXBRLViewerPlugin/viewer/src/i18n/es/datatypes.json +10 -0
  48. iXBRLViewerPlugin/viewer/src/i18n/es/labelroles.json +24 -0
  49. iXBRLViewerPlugin/viewer/src/i18n/es/scale.json +16 -0
  50. iXBRLViewerPlugin/viewer/src/i18n/es/tooltips.json +17 -0
  51. iXBRLViewerPlugin/viewer/src/i18n/es/translation.json +87 -37
  52. iXBRLViewerPlugin/viewer/src/i18n/fr/balancetypes.json +4 -0
  53. iXBRLViewerPlugin/viewer/src/i18n/fr/currencies.json +13 -0
  54. iXBRLViewerPlugin/viewer/src/i18n/fr/datatypes.json +9 -0
  55. iXBRLViewerPlugin/viewer/src/i18n/fr/labelroles.json +24 -0
  56. iXBRLViewerPlugin/viewer/src/i18n/fr/referenceparts.json +10 -0
  57. iXBRLViewerPlugin/viewer/src/i18n/fr/scale.json +15 -0
  58. iXBRLViewerPlugin/viewer/src/i18n/fr/tooltips.json +17 -0
  59. iXBRLViewerPlugin/viewer/src/i18n/fr/translation.json +179 -0
  60. iXBRLViewerPlugin/viewer/src/i18n/nl/balancetypes.json +4 -0
  61. iXBRLViewerPlugin/viewer/src/i18n/nl/currencies.json +13 -0
  62. iXBRLViewerPlugin/viewer/src/i18n/nl/datatypes.json +9 -0
  63. iXBRLViewerPlugin/viewer/src/i18n/nl/labelroles.json +24 -0
  64. iXBRLViewerPlugin/viewer/src/i18n/nl/referenceparts.json +10 -0
  65. iXBRLViewerPlugin/viewer/src/i18n/nl/scale.json +15 -0
  66. iXBRLViewerPlugin/viewer/src/i18n/nl/tooltips.json +17 -0
  67. iXBRLViewerPlugin/viewer/src/i18n/nl/translation.json +179 -0
  68. iXBRLViewerPlugin/viewer/src/i18n/uk/balancetypes.json +4 -0
  69. iXBRLViewerPlugin/viewer/src/i18n/uk/currencies.json +13 -0
  70. iXBRLViewerPlugin/viewer/src/i18n/uk/datatypes.json +9 -0
  71. iXBRLViewerPlugin/viewer/src/i18n/uk/labelroles.json +24 -0
  72. iXBRLViewerPlugin/viewer/src/i18n/uk/referenceparts.json +10 -0
  73. iXBRLViewerPlugin/viewer/src/i18n/uk/scale.json +15 -0
  74. iXBRLViewerPlugin/viewer/src/i18n/uk/tooltips.json +17 -0
  75. iXBRLViewerPlugin/viewer/src/i18n/uk/translation.json +179 -0
  76. iXBRLViewerPlugin/viewer/src/icons/calculator.svg +13 -0
  77. iXBRLViewerPlugin/viewer/src/icons/circle-cross.svg +11 -0
  78. iXBRLViewerPlugin/viewer/src/icons/circle-tick.svg +11 -0
  79. iXBRLViewerPlugin/viewer/src/icons/dark-mode.svg +4 -0
  80. iXBRLViewerPlugin/viewer/src/icons/dimension.svg +1 -5
  81. iXBRLViewerPlugin/viewer/src/icons/member.svg +2 -5
  82. iXBRLViewerPlugin/viewer/src/icons/multi-tag.svg +10 -0
  83. iXBRLViewerPlugin/viewer/src/img/arelle-dark.svg +179 -0
  84. iXBRLViewerPlugin/viewer/src/img/inline-viewer-dark.svg +59 -0
  85. iXBRLViewerPlugin/viewer/src/js/accordian.js +5 -4
  86. iXBRLViewerPlugin/viewer/src/js/aspect.js +29 -10
  87. iXBRLViewerPlugin/viewer/src/js/aspect.test.js +40 -31
  88. iXBRLViewerPlugin/viewer/src/js/balance.js +14 -0
  89. iXBRLViewerPlugin/viewer/src/js/calculation.js +213 -0
  90. iXBRLViewerPlugin/viewer/src/js/calculation.test.js +306 -0
  91. iXBRLViewerPlugin/viewer/src/js/calculationInspector.js +187 -0
  92. iXBRLViewerPlugin/viewer/src/js/chart.js +26 -24
  93. iXBRLViewerPlugin/viewer/src/js/chart.test.js +10 -9
  94. iXBRLViewerPlugin/viewer/src/js/concept.js +37 -4
  95. iXBRLViewerPlugin/viewer/src/js/concept.test.js +30 -6
  96. iXBRLViewerPlugin/viewer/src/js/datatype.js +20 -0
  97. iXBRLViewerPlugin/viewer/src/js/datatype.test.js +62 -0
  98. iXBRLViewerPlugin/viewer/src/js/dialog.js +6 -4
  99. iXBRLViewerPlugin/viewer/src/js/docOrderIndex.js +7 -7
  100. iXBRLViewerPlugin/viewer/src/js/fact.js +156 -59
  101. iXBRLViewerPlugin/viewer/src/js/fact.test.js +160 -29
  102. iXBRLViewerPlugin/viewer/src/js/factset.js +64 -15
  103. iXBRLViewerPlugin/viewer/src/js/factset.test.js +102 -31
  104. iXBRLViewerPlugin/viewer/src/js/footnote.js +8 -2
  105. iXBRLViewerPlugin/viewer/src/js/index.js +11 -3
  106. iXBRLViewerPlugin/viewer/src/js/inspector.js +747 -221
  107. iXBRLViewerPlugin/viewer/src/js/inspector.test.js +143 -25
  108. iXBRLViewerPlugin/viewer/src/js/interval.js +70 -0
  109. iXBRLViewerPlugin/viewer/src/js/interval.test.js +153 -0
  110. iXBRLViewerPlugin/viewer/src/js/ixbrlviewer.js +391 -262
  111. iXBRLViewerPlugin/viewer/src/js/ixbrlviewer.test.js +134 -20
  112. iXBRLViewerPlugin/viewer/src/js/ixnode.js +1 -1
  113. iXBRLViewerPlugin/viewer/src/js/menu.js +25 -7
  114. iXBRLViewerPlugin/viewer/src/js/number-matcher.js +7 -3
  115. iXBRLViewerPlugin/viewer/src/js/number-matcher.test.js +4 -0
  116. iXBRLViewerPlugin/viewer/src/js/outline.js +34 -13
  117. iXBRLViewerPlugin/viewer/src/js/outline.test.js +97 -91
  118. iXBRLViewerPlugin/viewer/src/js/period.js +0 -1
  119. iXBRLViewerPlugin/viewer/src/js/report.js +260 -351
  120. iXBRLViewerPlugin/viewer/src/js/report.test.js +95 -27
  121. iXBRLViewerPlugin/viewer/src/js/reportset.js +264 -0
  122. iXBRLViewerPlugin/viewer/src/js/reportset.test.js +357 -0
  123. iXBRLViewerPlugin/viewer/src/js/search.js +72 -38
  124. iXBRLViewerPlugin/viewer/src/js/search.test.js +184 -84
  125. iXBRLViewerPlugin/viewer/src/js/summary.js +34 -8
  126. iXBRLViewerPlugin/viewer/src/js/summary.test.js +69 -25
  127. iXBRLViewerPlugin/viewer/src/js/tableExport.js +9 -9
  128. iXBRLViewerPlugin/viewer/src/js/taxonomynamer.js +34 -0
  129. iXBRLViewerPlugin/viewer/src/js/taxonomynamer.test.js +32 -0
  130. iXBRLViewerPlugin/viewer/src/js/test-utils.js +46 -0
  131. iXBRLViewerPlugin/viewer/src/js/theme.js +50 -0
  132. iXBRLViewerPlugin/viewer/src/js/unit.js +90 -32
  133. iXBRLViewerPlugin/viewer/src/js/unit.test.js +62 -25
  134. iXBRLViewerPlugin/viewer/src/js/util.js +94 -0
  135. iXBRLViewerPlugin/viewer/src/js/util.test.js +33 -1
  136. iXBRLViewerPlugin/viewer/src/js/utr.js +27 -0
  137. iXBRLViewerPlugin/viewer/src/js/viewer.js +205 -181
  138. iXBRLViewerPlugin/viewer/src/js/viewerOptions.js +0 -2
  139. iXBRLViewerPlugin/viewer/src/less/accordian.less +10 -6
  140. iXBRLViewerPlugin/viewer/src/less/block-list.less +16 -5
  141. iXBRLViewerPlugin/viewer/src/less/calculation-inspector.less +83 -0
  142. iXBRLViewerPlugin/viewer/src/less/chart.less +8 -5
  143. iXBRLViewerPlugin/viewer/src/less/colours-dark-mode.less +40 -0
  144. iXBRLViewerPlugin/viewer/src/less/colours.less +32 -20
  145. iXBRLViewerPlugin/viewer/src/less/common.less +3 -3
  146. iXBRLViewerPlugin/viewer/src/less/components.less +6 -4
  147. iXBRLViewerPlugin/viewer/src/less/core.less +2 -0
  148. iXBRLViewerPlugin/viewer/src/less/dialog.less +21 -14
  149. iXBRLViewerPlugin/viewer/src/less/form-controls.less +33 -11
  150. iXBRLViewerPlugin/viewer/src/less/inspector.less +1045 -726
  151. iXBRLViewerPlugin/viewer/src/less/loader.less +2 -2
  152. iXBRLViewerPlugin/viewer/src/less/menu.less +33 -15
  153. iXBRLViewerPlugin/viewer/src/less/summary.less +16 -6
  154. iXBRLViewerPlugin/viewer/src/less/tabs.less +9 -9
  155. iXBRLViewerPlugin/viewer/src/less/text-block-viewer.less +2 -0
  156. iXBRLViewerPlugin/viewer/src/less/text-mixins.less +2 -1
  157. iXBRLViewerPlugin/viewer/src/less/validation-report.less +2 -3
  158. iXBRLViewerPlugin/viewer/src/less/viewer.less +105 -74
  159. iXBRLViewerPlugin/viewer/webpack.common.js +19 -9
  160. iXBRLViewerPlugin/xhtmlserialize.py +59 -45
  161. {ixbrl_viewer-1.4.1.dist-info → ixbrl_viewer-1.4.86.dist-info}/METADATA +181 -50
  162. ixbrl_viewer-1.4.86.dist-info/RECORD +217 -0
  163. {ixbrl_viewer-1.4.1.dist-info → ixbrl_viewer-1.4.86.dist-info}/WHEEL +1 -1
  164. ixbrl_viewer-1.4.1.dist-info/LICENSE → ixbrl_viewer-1.4.86.dist-info/licenses/LICENSE.md +8 -14
  165. {ixbrl_viewer-1.4.1.dist-info → ixbrl_viewer-1.4.86.dist-info}/top_level.txt +0 -1
  166. iXBRLViewerPlugin/viewer/src/js/calculations.js +0 -111
  167. iXBRLViewerPlugin/viewer/src/js/interact.min.js +0 -6
  168. ixbrl_viewer-1.4.1.dist-info/RECORD +0 -155
  169. tests/__init__.py +0 -0
  170. tests/puppeteer/framework/core_elements.js +0 -117
  171. tests/puppeteer/framework/page_objects/doc_frame.js +0 -105
  172. tests/puppeteer/framework/page_objects/fact_details_panel.js +0 -80
  173. tests/puppeteer/framework/page_objects/search_panel.js +0 -76
  174. tests/puppeteer/framework/page_objects/toolbar.js +0 -18
  175. tests/puppeteer/framework/utils.js +0 -3
  176. tests/puppeteer/framework/viewer_page.js +0 -103
  177. tests/puppeteer/puppeteer_test_run_via_intellij.jpg +0 -0
  178. tests/puppeteer/test_filings/filing_documents_smoke_test.zip +0 -0
  179. tests/puppeteer/test_filings/highlights.zip +0 -0
  180. tests/puppeteer/tests/fact_properties.test.js +0 -78
  181. tests/puppeteer/tests/highlight.test.js +0 -186
  182. tests/puppeteer/tests/search.test.js +0 -86
  183. tests/puppeteer/tools/generate.sh +0 -15
  184. tests/unit_tests/__init__.py +0 -0
  185. tests/unit_tests/iXBRLViewerPlugin/__init__.py +0 -0
  186. tests/unit_tests/iXBRLViewerPlugin/mock_arelle.py +0 -39
  187. tests/unit_tests/iXBRLViewerPlugin/test_iXBRLViewer.py +0 -641
  188. tests/unit_tests/iXBRLViewerPlugin/test_xhtmlserialize.py +0 -310
  189. {ixbrl_viewer-1.4.1.dist-info → ixbrl_viewer-1.4.86.dist-info}/entry_points.txt +0 -0
  190. {ixbrl_viewer-1.4.1.dist-info → ixbrl_viewer-1.4.86.dist-info/licenses}/NOTICE +0 -0
@@ -1,21 +1,25 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
3
  import { Unit } from "./unit.js";
4
- import { iXBRLReport } from "./report.js";
4
+ import { ReportSet } from "./reportset.js";
5
5
  import { TestInspector } from "./test-utils.js";
6
+ import { NAMESPACE_ISO4217 } from "./util";
6
7
 
7
8
  var testReportData = {
8
9
  "prefixes": {
9
10
  "eg": "http://www.example.com",
10
- "iso4217": "http://www.xbrl.org/2003/iso4217",
11
+ "iso4217": NAMESPACE_ISO4217,
11
12
  "e": "http://example.com/entity",
12
- }
13
+ "utr": "http://www.xbrl.org/2009/utr",
14
+ "xbrli": "http://www.xbrl.org/2003/instance",
15
+ },
16
+ "facts": {},
13
17
  };
14
18
 
15
19
  function testReport() {
16
20
  // Deep copy of standing data
17
21
  const data = JSON.parse(JSON.stringify(testReportData));
18
- const report = new iXBRLReport(data);
22
+ const report = new ReportSet(data);
19
23
  report.setIXNodeMap({});
20
24
  return report;
21
25
  }
@@ -28,51 +32,80 @@ beforeAll(() => {
28
32
  describe("Unit label", () => {
29
33
  test("Unit label for simple unit", () => {
30
34
  var unit = new Unit(testReport(), 'iso4217:USD');
31
- expect(unit.label()).toEqual('USD');
35
+ expect(unit.label()).toEqual('US $');
32
36
  });
33
37
 
34
38
  test("Unit label for complex unit", () => {
35
39
  var unit = new Unit(testReport(), 'iso4217:USD/eg:share');
36
- expect(unit.label()).toEqual('USD/Share');
40
+ expect(unit.label()).toEqual('US $/share');
37
41
  });
38
42
 
39
43
  test("Unit label for complex unit with numerator parentheses", () => {
40
44
  var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
41
- expect(unit.label()).toEqual('(USD*Share)/Shareholder');
45
+ expect(unit.label()).toEqual('(US $*share)/shareholder');
42
46
  });
43
47
 
44
48
  test("Unit label for complex unit with denominator parentheses", () => {
45
49
  var unit = new Unit(testReport(), 'iso4217:USD/(eg:share*eg:shareholder)');
46
- expect(unit.label()).toEqual('USD/(Share*Shareholder)');
50
+ expect(unit.label()).toEqual('US $/(share*shareholder)');
47
51
  });
48
52
  });
49
53
 
50
- describe("Unit measure", () => {
51
- test("Unit measure is simple unit", () => {
54
+ describe("Unit label", () => {
55
+ test("Unit label - known currency", () => {
56
+ var unit = new Unit(testReport(), 'eg:share');
57
+ expect(unit.label()).toEqual('share');
58
+ });
59
+
60
+ test("Unit label - known currency", () => {
52
61
  var unit = new Unit(testReport(), 'iso4217:USD');
53
- expect(unit.measure()).toEqual('iso4217:USD');
62
+ // Note "US $" from i18n takes precedence over "USD $" generated from UTR
63
+ expect(unit.label()).toEqual('US $');
54
64
  });
55
65
 
56
- test("Unit measure is first numerator of complex unit", () => {
57
- var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
58
- expect(unit.measure()).toEqual('iso4217:USD');
66
+ test("Unit label - UTR currency", () => {
67
+ var unit = new Unit(testReport(), 'iso4217:THB');
68
+ expect(unit.label()).toEqual('฿');
59
69
  });
60
- });
61
70
 
62
- describe("Unit measure label", () => {
63
- test("Unit measure label - known currency", () => {
64
- var unit = new Unit(testReport(), 'eg:share');
65
- expect(unit.measureLabel()).toEqual('eg:share');
71
+ test("Unit label - UTR currency with '$' symbol", () => {
72
+ var unit = new Unit(testReport(), 'iso4217:SGD');
73
+ expect(unit.label()).toEqual('SGD $');
66
74
  });
67
75
 
68
- test("Unit measure label - known currency", () => {
69
- var unit = new Unit(testReport(), 'iso4217:USD');
70
- expect(unit.measureLabel()).toEqual('US $');
76
+ test("Unit label - UTR currency without symbol falls back to name", () => {
77
+ var unit = new Unit(testReport(), 'iso4217:YER');
78
+ expect(unit.label()).toEqual('Yemeni rial');
79
+ });
80
+
81
+ test("Unit label - UTR currency without symbol falls back to name", () => {
82
+ var unit = new Unit(testReport(), 'iso4217:XAU');
83
+ expect(unit.label()).toEqual('Gold');
71
84
  });
72
85
 
73
- test("Unit measure label - unknown", () => {
74
- var unit = new Unit(testReport(), 'iso4217:ZAR');
75
- expect(unit.measureLabel()).toEqual('ZAR');
86
+ test("Unit label - unknown", () => {
87
+ var unit = new Unit(testReport(), 'iso4217:ZZZZ');
88
+ expect(unit.label()).toEqual('ZZZZ');
89
+ });
90
+
91
+ test("Unit label - UTR non-currency symbol used", () => {
92
+ var unit = new Unit(testReport(), 'utr:m3');
93
+ expect(unit.label()).toEqual('m³');
94
+ });
95
+
96
+ test("Unit label - UTR non-currency symbol used", () => {
97
+ var unit = new Unit(testReport(), 'utr:sqkm');
98
+ expect(unit.label()).toEqual('km²');
99
+ });
100
+
101
+ test("Unit label - UTR non-currency symbol used", () => {
102
+ var unit = new Unit(testReport(), 'utr:F');
103
+ expect(unit.label()).toEqual('°F');
104
+ });
105
+
106
+ test("Unit label - UTR non-currency without symbol falls back to name", () => {
107
+ var unit = new Unit(testReport(), 'xbrli:shares');
108
+ expect(unit.label()).toEqual('Share');
76
109
  });
77
110
  });
78
111
 
@@ -93,4 +126,8 @@ describe("Unit value", () => {
93
126
  var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
94
127
  expect(unit.value()).toEqual('(iso4217:USD*eg:share)/eg:shareholder');
95
128
  });
129
+ test("Unit value is simple unit", () => {
130
+ var unit = new Unit(testReport(), 'iso4217:USD');
131
+ expect(unit.value()).toEqual('iso4217:USD');
132
+ });
96
133
  });
@@ -3,6 +3,38 @@
3
3
  import moment from "moment";
4
4
  import Decimal from "decimal.js";
5
5
 
6
+ export const SHOW_FACT = 'SHOW_FACT';
7
+
8
+ export const NAMESPACE_ISO4217 = 'http://www.xbrl.org/2003/iso4217';
9
+ export const NAMESPACE_XBRLI = 'http://www.xbrl.org/2003/instance';
10
+
11
+ export const CALC_ARCROLE = "calc";
12
+ export const CALC11_ARCROLE = "calc11";
13
+
14
+ export const GLOSSARY_URL = "https://xbrl.org/glossary/";
15
+
16
+ // The number of distinct highlight colors defined in inspector.less
17
+ export const HIGHLIGHT_COLORS = 6;
18
+
19
+ // Feature names
20
+ export const FEATURE_GUIDE_LINK = 'guide_link';
21
+ export const FEATURE_HOME_LINK_LABEL = 'home_link_label';
22
+ export const FEATURE_HOME_LINK_URL = 'home_link_url';
23
+ export const FEATURE_REVIEW = 'review';
24
+ export const FEATURE_SUPPORT_LINK = 'support_link';
25
+ export const FEATURE_SURVEY_LINK = 'survey_link';
26
+ export const FEATURE_SEARCH_ON_STARTUP = 'search_on_startup';
27
+ export const FEATURE_HIGHLIGHT_FACTS_ON_STARTUP = 'highlight_facts_on_startup';
28
+ export const FEATURE_HIDE_CALCULATION_MODE_OPTION = 'hide_calculation_mode_option';
29
+
30
+ export const IXBRL_VIEWER_DATASET_PREFIX = 'ixbrlViewer';
31
+
32
+ export const STORAGE_APP_LANGUAGE = "ixbrl-viewer-app-language";
33
+ export const STORAGE_THEME = "ixbrl-viewer-theme";
34
+ export const STORAGE_HIGHLIGHT_FACTS = "ixbrl-viewer-highlight-all-facts";
35
+ export const STORAGE_HOME_LINK_QUERY = "ixbrl-viewer-home-link-query";
36
+ export const USER_GUIDE_URL = "https://arelle-ixbrl-viewer.readthedocs.io/en/latest/user_guides/user_guide.html";
37
+
6
38
  /*
7
39
  * Takes a moment.js oject and converts it to a human readable date, or date
8
40
  * and time if the time component is not midnight. Adjust specifies that a
@@ -160,3 +192,65 @@ export function isTransparent(rgba) {
160
192
  const val = parseFloat(rgba.split(",")[3]);
161
193
  return !isNaN(val) && val < 0.1;
162
194
  }
195
+
196
+ /**
197
+ * Prefix an item ID with the index of the report document that it appears in,
198
+ * in order to generate an ID that is guaranteed to be unique within the
199
+ * viewer. This is already within an iXBRL Document Set, but not across
200
+ * separate iXBRL documents or document sets.
201
+ * @param {Number} sourceReportIndex - index of the report document containing the fact
202
+ * @param {String} localId - local ID of the fact
203
+ * @return {String} a viewer unique ID
204
+ */
205
+
206
+ export function viewerUniqueId(sourceReportIndex, localId) {
207
+ if (localId === null || localId === undefined) {
208
+ return null;
209
+ }
210
+ return sourceReportIndex.toString() + "-" + localId;
211
+ }
212
+
213
+ export function localId(viewerUniqueId) {
214
+ return viewerUniqueId.replace(/^\d+-/,"");
215
+ }
216
+
217
+ /**
218
+ * Parses fact IDs from -sec-ix-hidden and -esef-ix-hidden style
219
+ * attributes on a DOM node.
220
+ * Any returned ID should be the ID of a fact in ix:hidden corresponding
221
+ * to the content contained in the DOM node.
222
+ *
223
+ * @param {Node} domNode - DOM node to parse
224
+ * @return {String} A fact ID, or null if the element does not have
225
+ * a style attribute containing a custom CSS property in the required
226
+ * format.
227
+ */
228
+
229
+ export function getIXHiddenLinkStyle(domNode) {
230
+ if (domNode.hasAttribute('style')) {
231
+ const re = /(?:^|\s|;)(?:-sec|-esef)?-ix-hidden:\s*([^\s;]+)/;
232
+ const m = domNode.getAttribute('style').match(re);
233
+ if (m) {
234
+ return m[1];
235
+ }
236
+ }
237
+ return null;
238
+ }
239
+
240
+ /**
241
+ * Moves all attributes from one element to another, excluding data attributes created by the viewer application.
242
+ */
243
+ export function moveNonAppAttributes(fromElement, toElement) {
244
+ for (const attr of [...fromElement.attributes]) {
245
+ if (!attr.name.startsWith("data-")) {
246
+ toElement.setAttribute(attr.name, attr.value);
247
+ fromElement.removeAttribute(attr.name);
248
+ }
249
+ }
250
+ for (const [key, value] of Object.entries(fromElement.dataset)) {
251
+ if (!key.startsWith(IXBRL_VIEWER_DATASET_PREFIX)) {
252
+ toElement.dataset[key] = value;
253
+ delete fromElement.dataset[key];
254
+ }
255
+ }
256
+ }
@@ -1,6 +1,6 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import { xbrlDateToMoment, momentToHuman, formatNumber, wrapLabel, escapeRegex, truncateLabel } from "./util.js"
3
+ import { xbrlDateToMoment, momentToHuman, formatNumber, wrapLabel, escapeRegex, truncateLabel, getIXHiddenLinkStyle } from "./util.js"
4
4
  import moment from 'moment';
5
5
  import "./moment-jest.js";
6
6
 
@@ -144,3 +144,35 @@ describe("Regex escape", () => {
144
144
  expect(escapeRegex("a.b*{}")).toBe("a\\.b\\*\\{\\}")
145
145
  });
146
146
  });
147
+
148
+ describe("Get IX Hidden Link Style", () => {
149
+ it.each([
150
+ ["-ix-hidden:123", "123"],
151
+ ["-sec-ix-hidden:123", "123"],
152
+ ["-esef-ix-hidden:123", "123"],
153
+ ["-xxx-ix-hidden:123", null],
154
+ ["-sec-ix-hidden: 123", "123"],
155
+ ["-sec-ix-hidden:123 ", "123"],
156
+ ["-sec-ix-hidden:123;", "123"],
157
+ ["-sec-ix-hidden:123 abc", "123"],
158
+ ["xxx-sec-ix-hidden:123", null],
159
+ ["xxx;-sec-ix-hidden:123", "123"],
160
+ [" -sec-ix-hidden:123", "123"],
161
+ [";-sec-ix-hidden:123", "123"],
162
+ ["-sec-ix-Hidden:123", null],
163
+ ["-sec-ix-hidden:123;-sec-ix-hidden:abc", "123"],
164
+ ["", null],
165
+ [null, null],
166
+ ])("Style value %p returns %p", (style, result) => {
167
+ const domNode = document.createElement('div');
168
+ domNode.setAttribute("style", style);
169
+ const id = getIXHiddenLinkStyle(domNode);
170
+ expect(id).toEqual(result);
171
+ });
172
+
173
+ test("No style attribute returns null", () => {
174
+ const domNode = document.createElement('div');
175
+ const id = getIXHiddenLinkStyle(domNode);
176
+ expect(id).toEqual(null);
177
+ })
178
+ });
@@ -0,0 +1,27 @@
1
+ // See COPYRIGHT.md for copyright information
2
+
3
+ // Class to expose properties of Unit Type Registry entries from viewer data
4
+
5
+ export class UTREntry {
6
+
7
+ constructor(symbol, name) {
8
+ this.symbol = symbol;
9
+ this.name = name;
10
+ }
11
+ }
12
+
13
+ class UTR {
14
+ constructor() {
15
+ self.entries = require("../data/utr.json");
16
+ }
17
+
18
+ get(qname) {
19
+ const u = self.entries[qname.namespace]?.[qname.localname]
20
+ if (u === undefined) {
21
+ return undefined;
22
+ }
23
+ return new UTREntry(u.s, u.n)
24
+ }
25
+ }
26
+
27
+ export const utr = new UTR();