ixbrl-viewer 1.4.9__py3-none-any.whl → 1.4.10__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.

Potentially problematic release.


This version of ixbrl-viewer might be problematic. Click here for more details.

Files changed (25) hide show
  1. iXBRLViewerPlugin/_version.py +2 -2
  2. iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js +1 -1
  3. iXBRLViewerPlugin/viewer/src/js/aspect.js +1 -1
  4. iXBRLViewerPlugin/viewer/src/js/aspect.test.js +2 -1
  5. iXBRLViewerPlugin/viewer/src/js/chart.js +1 -1
  6. iXBRLViewerPlugin/viewer/src/js/chart.test.js +2 -2
  7. iXBRLViewerPlugin/viewer/src/js/concept.test.js +2 -2
  8. iXBRLViewerPlugin/viewer/src/js/fact.js +11 -24
  9. iXBRLViewerPlugin/viewer/src/js/fact.test.js +6 -11
  10. iXBRLViewerPlugin/viewer/src/js/factset.test.js +2 -4
  11. iXBRLViewerPlugin/viewer/src/js/inspector.test.js +2 -3
  12. iXBRLViewerPlugin/viewer/src/js/outline.test.js +3 -3
  13. iXBRLViewerPlugin/viewer/src/js/report.js +7 -3
  14. iXBRLViewerPlugin/viewer/src/js/report.test.js +2 -1
  15. iXBRLViewerPlugin/viewer/src/js/reportset.test.js +3 -3
  16. iXBRLViewerPlugin/viewer/src/js/unit.js +15 -33
  17. iXBRLViewerPlugin/viewer/src/js/unit.test.js +17 -24
  18. iXBRLViewerPlugin/viewer/src/js/util.js +18 -0
  19. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/METADATA +6 -2
  20. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/RECORD +25 -25
  21. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/LICENSE +0 -0
  22. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/NOTICE +0 -0
  23. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/WHEEL +0 -0
  24. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/entry_points.txt +0 -0
  25. {ixbrl_viewer-1.4.9.dist-info → ixbrl_viewer-1.4.10.dist-info}/top_level.txt +0 -0
@@ -56,7 +56,7 @@ export class Aspect {
56
56
  return this._report.getLabel(this._value, rolePrefix) || this._value;
57
57
  }
58
58
  else if (this._aspect === 'u') {
59
- return this._report.reportSet.getUnit(this._value).measureLabel();
59
+ return this._report.reportSet.getUnit(this._value).label();
60
60
  }
61
61
  else if (this._aspect === 'p') {
62
62
  const p = new Period(this._value);
@@ -3,11 +3,12 @@
3
3
  import { Aspect, AspectSet } from "./aspect.js";
4
4
  import { ReportSet } from "./reportset.js";
5
5
  import { TestInspector } from "./test-utils.js";
6
+ import { NAMESPACE_ISO4217 } from "./util";
6
7
 
7
8
  const 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
  },
12
13
  "facts" : {},
13
14
  "concepts": {
@@ -97,7 +97,7 @@ export class IXBRLChart extends Dialog {
97
97
  const uv2 = set2av.uniqueValues();
98
98
 
99
99
  const scale = this._chooseMultiplier(facts);
100
- const yLabel = fact.measureLabel() + " " + this._multiplierDescription(scale);
100
+ const yLabel = fact.unitLabel() + " " + this._multiplierDescription(scale);
101
101
  const labels = [];
102
102
 
103
103
  const dataSets = [];
@@ -1,14 +1,14 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import { Fact } from "./fact.js";
4
3
  import { IXBRLChart } from "./chart.js";
5
4
  import { ReportSet } from "./reportset.js";
6
5
  import { TestInspector } from "./test-utils.js";
6
+ import { NAMESPACE_ISO4217 } from "./util";
7
7
 
8
8
  var testReportData = {
9
9
  "prefixes": {
10
10
  "eg": "http://www.example.com",
11
- "iso4217": "http://www.xbrl.org/2003/iso4217",
11
+ "iso4217": NAMESPACE_ISO4217,
12
12
  "e": "http://example.com/entity",
13
13
  },
14
14
  "concepts": {
@@ -1,12 +1,12 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import { XBRLReport } from "./report.js";
4
3
  import { ReportSet } from "./reportset.js";
4
+ import { NAMESPACE_ISO4217 } from "./util";
5
5
 
6
6
  const testReportData = {
7
7
  "prefixes": {
8
8
  "eg": "http://www.example.com",
9
- "iso4217": "http://www.xbrl.org/2003/iso4217",
9
+ "iso4217": NAMESPACE_ISO4217,
10
10
  "e": "http://example.com/entity",
11
11
  },
12
12
  "concepts": {
@@ -78,10 +78,10 @@ export class Fact {
78
78
  formattedNumber = formatNumber(v, d);
79
79
  }
80
80
  if (this.isMonetaryValue()) {
81
- v = this.measureLabel() + " " + formattedNumber;
81
+ v = this.unitLabel() + " " + formattedNumber;
82
82
  }
83
83
  else {
84
- v = formattedNumber + " " + this.measureLabel();
84
+ v = formattedNumber + " " + this.unitLabel();
85
85
  }
86
86
  }
87
87
  else if (this.isNil()) {
@@ -108,22 +108,6 @@ export class Fact {
108
108
  return v;
109
109
  }
110
110
 
111
- /**
112
- * Returns the qname of the first numerator in the fact's unit
113
- * @return {String} QName string of a measure
114
- */
115
- measure() {
116
- return this.unit()?.measure();
117
- }
118
-
119
- /**
120
- * Returns a readable label representing the first numerator in the fact's unit
121
- * @return {String} Label representing measure
122
- */
123
- measureLabel() {
124
- return this.unit()?.measureLabel() ?? i18next.t("factDetails.noUnit");
125
- }
126
-
127
111
  /**
128
112
  * Returns details about this fact's unit
129
113
  * @return {Unit} Unit instance
@@ -139,6 +123,14 @@ export class Fact {
139
123
  return this._unit;
140
124
  }
141
125
 
126
+ /**
127
+ * Returns a readable label representing the fact's unit
128
+ * @return {String} Label representing unit
129
+ */
130
+ unitLabel() {
131
+ return this.unit()?.label() ?? i18next.t("factDetails.noUnit");
132
+ }
133
+
142
134
  getConceptPrefix() {
143
135
  return this.conceptName().split(':')[0];
144
136
  }
@@ -264,17 +256,12 @@ export class Fact {
264
256
  }
265
257
 
266
258
  getScaleLabel(value, isAccuracy=false) {
267
- let measure = this.measure() ?? '';
268
- if (measure) {
269
- measure = this.report.qname(measure).localname;
270
- }
271
259
  return this.report.getScaleLabel(
272
260
  // We use the same table of labels for scale and accuracy,
273
261
  // but decimals means "accurate to 10^-N" whereas scale means 10^N,
274
262
  // so invert N for accuracy.
275
263
  isAccuracy ? -value : value,
276
- this.isMonetaryValue(),
277
- measure
264
+ this.unit()
278
265
  );
279
266
  }
280
267
 
@@ -3,11 +3,12 @@
3
3
  import { Fact } from "./fact.js";
4
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
  },
13
14
  "concepts": {
@@ -108,7 +109,6 @@ describe("Simple fact properties", () => {
108
109
  expect(f.isMonetaryValue()).toBeTruthy();
109
110
  expect(f.readableValue()).toEqual("US $ 1,000");
110
111
  expect(f.unit().value()).toEqual("iso4217:USD");
111
- expect(f.measure()).toEqual("iso4217:USD");
112
112
  expect(f.conceptQName().prefix).toEqual("eg");
113
113
  expect(f.conceptQName().localname).toEqual("Concept1");
114
114
  expect(f.conceptQName().namespace).toEqual("http://www.example.com");
@@ -128,9 +128,8 @@ describe("Simple fact properties", () => {
128
128
  expect(f.isNumeric()).toBeTruthy();
129
129
  expect(f.decimals()).toEqual(-3);
130
130
  expect(f.isMonetaryValue()).toBeFalsy();
131
- expect(f.readableValue()).toEqual("1,000 eg:USD");
131
+ expect(f.readableValue()).toEqual("1,000 USD");
132
132
  expect(f.unit().value()).toEqual("eg:USD");
133
- expect(f.measure()).toEqual("eg:USD");
134
133
  expect(f.conceptQName().prefix).toEqual("eg");
135
134
  expect(f.conceptQName().localname).toEqual("Concept1");
136
135
  expect(f.conceptQName().namespace).toEqual("http://www.example.com");
@@ -149,9 +148,8 @@ describe("Simple fact properties", () => {
149
148
  expect(f.decimals()).toBeUndefined();
150
149
  expect(f.isNumeric()).toBeTruthy();
151
150
  expect(f.isMonetaryValue()).toBeFalsy();
152
- expect(f.readableValue()).toEqual("1,000,000.0125 eg:USD");
151
+ expect(f.readableValue()).toEqual("1,000,000.0125 USD");
153
152
  expect(f.unit().value()).toEqual("eg:USD");
154
- expect(f.measure()).toEqual("eg:USD");
155
153
  expect(f.conceptQName().prefix).toEqual("eg");
156
154
  expect(f.conceptQName().localname).toEqual("Concept1");
157
155
  expect(f.conceptQName().namespace).toEqual("http://www.example.com");
@@ -539,7 +537,7 @@ describe("Readable value", () => {
539
537
  test("Other numeric", () => {
540
538
 
541
539
  expect(testFact({ "v": "10", d: -2, a: { u: "xbrli:foo" } }).readableValue())
542
- .toBe("10 xbrli:foo");
540
+ .toBe("10 foo");
543
541
 
544
542
  });
545
543
 
@@ -635,8 +633,7 @@ describe("Unit aspect handling", () => {
635
633
  expect(f.isNumeric()).toBeTruthy();
636
634
  expect(f.isMonetaryValue()).toBeFalsy();
637
635
  expect(f.unit()).toBeUndefined();
638
- expect(f.measure()).toBeUndefined();
639
- expect(f.measureLabel()).toBe("<NOUNIT>");
636
+ expect(f.unitLabel()).toBe("<NOUNIT>");
640
637
  });
641
638
 
642
639
  test("Non-numeric, no unit", () => {
@@ -647,7 +644,6 @@ describe("Unit aspect handling", () => {
647
644
  });
648
645
  expect(f.isNumeric()).toBeFalsy();
649
646
  expect(f.unit()).toBeUndefined();
650
- expect(f.measure()).toBeUndefined();
651
647
  });
652
648
  });
653
649
 
@@ -707,7 +703,6 @@ describe("Fact errors", () => {
707
703
  expect(f.isMonetaryValue()).toBeTruthy();
708
704
  expect(f.readableValue()).toEqual("Invalid value");
709
705
  expect(f.unit().value()).toEqual("iso4217:USD");
710
- expect(f.measure()).toEqual("iso4217:USD");
711
706
  expect(f.conceptQName().prefix).toEqual("eg");
712
707
  expect(f.conceptQName().localname).toEqual("Concept1");
713
708
  expect(f.conceptQName().namespace).toEqual("http://www.example.com");
@@ -1,9 +1,7 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import { Fact } from "./fact.js";
4
3
  import { FactSet } from "./factset.js";
5
- import { viewerUniqueId } from "./util.js";
6
- import { XBRLReport } from "./report.js";
4
+ import { NAMESPACE_ISO4217, viewerUniqueId } from "./util.js";
7
5
  import { ReportSet } from "./reportset.js";
8
6
 
9
7
  var i = 0;
@@ -11,7 +9,7 @@ var i = 0;
11
9
  var testReportData = {
12
10
  "prefixes": {
13
11
  "eg": "http://www.example.com",
14
- "iso4217": "http://www.xbrl.org/2003/iso4217",
12
+ "iso4217": NAMESPACE_ISO4217,
15
13
  "e": "http://example.com/entity",
16
14
  },
17
15
  "concepts": {
@@ -1,15 +1,14 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import { Fact } from "./fact.js";
4
3
  import { ReportSet } from "./reportset.js";
5
4
  import { TestInspector } from "./test-utils.js";
6
- import { SHOW_FACT, viewerUniqueId } from "./util.js";
5
+ import { NAMESPACE_ISO4217, SHOW_FACT, viewerUniqueId } from "./util.js";
7
6
 
8
7
 
9
8
  const testReportData = {
10
9
  "prefixes": {
11
10
  "eg": "http://www.example.com",
12
- "iso4217": "http://www.xbrl.org/2003/iso4217",
11
+ "iso4217": NAMESPACE_ISO4217,
13
12
  "e": "http://example.com/entity",
14
13
  },
15
14
  "concepts": {
@@ -2,14 +2,14 @@
2
2
 
3
3
  import $ from 'jquery'
4
4
  import { ReportSet } from "./reportset.js";
5
- import { ReportSetOutline, DocumentOutline } from "./outline.js";
5
+ import { DocumentOutline } from "./outline.js";
6
6
  import { IXNode } from "./ixnode.js";
7
- import { viewerUniqueId } from "./util.js";
7
+ import { NAMESPACE_ISO4217, viewerUniqueId } from "./util.js";
8
8
 
9
9
  const testReportData = {
10
10
  prefixes: {
11
11
  eg: "http://www.example.com",
12
- iso4217: "http://www.xbrl.org/2003/iso4217",
12
+ iso4217: NAMESPACE_ISO4217,
13
13
  e: "http://example.com/entity",
14
14
  },
15
15
  roles: {
@@ -179,10 +179,14 @@ export class XBRLReport {
179
179
  return this.reportSet.qname(v);
180
180
  }
181
181
 
182
- getScaleLabel(scale, isMonetaryValue, currency=null) {
182
+ getScaleLabel(scale, unit) {
183
183
  let label = i18next.t(`scale.${scale}`, {defaultValue:"noName"});
184
- if (isMonetaryValue && scale === -2) {
185
- label = i18next.t(`currencies:cents${currency}`, {defaultValue: label});
184
+ if (unit && unit.isMonetary() && scale === -2) {
185
+ let measure = unit.value() ?? '';
186
+ if (measure) {
187
+ measure = this.qname(measure).localname;
188
+ }
189
+ label = i18next.t(`currencies:cents${measure}`, {defaultValue: label});
186
190
  }
187
191
  if (label === "noName") {
188
192
  return null;
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { ReportSet } from "./reportset.js";
4
4
  import { ViewerOptions } from "./viewerOptions.js";
5
+ import { NAMESPACE_ISO4217 } from "./util";
5
6
 
6
7
  var testReportData = {
7
8
  "languages": {
@@ -10,7 +11,7 @@ var testReportData = {
10
11
  },
11
12
  "prefixes": {
12
13
  "eg": "http://www.example.com",
13
- "iso4217": "http://www.xbrl.org/2003/iso4217"
14
+ "iso4217": NAMESPACE_ISO4217
14
15
  },
15
16
  "roles": {
16
17
  "role1": "https://www.example.com/role1",
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { ReportSet } from "./reportset.js";
4
4
  import { ViewerOptions } from "./viewerOptions.js";
5
- import { viewerUniqueId } from "./util.js";
5
+ import { NAMESPACE_ISO4217, viewerUniqueId } from "./util.js";
6
6
  import { createNumericFact } from "./test-utils.js";
7
7
 
8
8
  function anchoringRelationShips(include) {
@@ -28,7 +28,7 @@ function multiReportTestData(withAnchoring) {
28
28
  },
29
29
  "prefixes": {
30
30
  "eg": "http://www.example.com",
31
- "iso4217": "http://www.xbrl.org/2003/iso4217"
31
+ "iso4217": NAMESPACE_ISO4217
32
32
  },
33
33
  "roles": {
34
34
  "role1": "https://www.example.com/role1",
@@ -131,7 +131,7 @@ function singleReportTestData() {
131
131
  },
132
132
  "prefixes": {
133
133
  "eg": "http://www.example.com",
134
- "iso4217": "http://www.xbrl.org/2003/iso4217"
134
+ "iso4217": NAMESPACE_ISO4217
135
135
  },
136
136
  "roles": {
137
137
  "role1": "https://www.example.com/role1",
@@ -1,29 +1,32 @@
1
1
  // See COPYRIGHT.md for copyright information
2
2
 
3
- import i18next from "i18next";
4
- import {titleCase} from "./util";
3
+ import { measureLabel, NAMESPACE_ISO4217 } from "./util";
5
4
 
6
5
  export class Unit {
7
6
 
8
- constructor(report, unitKey) {
9
- this._report = report;
7
+ constructor(reportSet, unitKey) {
8
+ this._reportSet = reportSet;
10
9
  this._value = unitKey;
11
10
  const split = unitKey
12
11
  .split(/[()]/ig).join('') // TODO: replace with .replaceAll(/[()]/ig,'') when no longer supporting node 14
13
12
  .split('/');
14
13
  this._numerators = split[0].split('*');
15
14
  this._denominators = split.length > 1 ? split[1].split('*') : [];
16
- this._isMonetary = Boolean(this._numerators.find(n => this._report.qname(n).namespace === "http://www.xbrl.org/2003/iso4217"));
17
- this._label = split.map(x => {
18
- const part = x.split('*').map(y => {
19
- return titleCase(y.split(':')[1]);
20
- }).join('*');
15
+ this._isMonetary =
16
+ this._denominators.length === 0 &&
17
+ this._numerators.length === 1 &&
18
+ this._reportSet.qname(this._numerators[0]).namespace === NAMESPACE_ISO4217;
19
+ this._label = split
20
+ .map(measure => {
21
+ const part = measure
22
+ .split('*')
23
+ .map(x => measureLabel(this._reportSet, x))
24
+ .join('*');
21
25
  return part.includes('*') ? `(${part})` : part;
22
- }).join('/');
23
- this._measure = this._numerators[0];
26
+ })
27
+ .join('/');
24
28
  }
25
29
 
26
-
27
30
  /**
28
31
  * Returns whether any of the numerators are an iso4217 monetary measure.
29
32
  * @return {Boolean}
@@ -40,27 +43,6 @@ export class Unit {
40
43
  return this._label;
41
44
  }
42
45
 
43
- /**
44
- * Returns the qname of the first numerator in the unit
45
- * @return {String} QName string of a measure
46
- */
47
- measure() {
48
- return this._measure;
49
- }
50
-
51
- /**
52
- * Returns a readable label representing the first numerator in the unit
53
- * @return {String} Label representing measure
54
- */
55
- measureLabel() {
56
- const measure = this.measure();
57
- const qname = this._report.qname(measure);
58
- if (qname.namespace === "http://www.xbrl.org/2003/iso4217") {
59
- return i18next.t(`currencies:unitFormat${qname.localname}`, {defaultValue: qname.localname});
60
- }
61
- return measure;
62
- }
63
-
64
46
  /**
65
47
  * Returns the OIM format string representing the unit
66
48
  * @return {String} OIM format unit string
@@ -3,11 +3,12 @@
3
3
  import { Unit } from "./unit.js";
4
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
  },
13
14
  "facts": {}
@@ -29,51 +30,39 @@ beforeAll(() => {
29
30
  describe("Unit label", () => {
30
31
  test("Unit label for simple unit", () => {
31
32
  var unit = new Unit(testReport(), 'iso4217:USD');
32
- expect(unit.label()).toEqual('USD');
33
+ expect(unit.label()).toEqual('US $');
33
34
  });
34
35
 
35
36
  test("Unit label for complex unit", () => {
36
37
  var unit = new Unit(testReport(), 'iso4217:USD/eg:share');
37
- expect(unit.label()).toEqual('USD/Share');
38
+ expect(unit.label()).toEqual('US $/share');
38
39
  });
39
40
 
40
41
  test("Unit label for complex unit with numerator parentheses", () => {
41
42
  var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
42
- expect(unit.label()).toEqual('(USD*Share)/Shareholder');
43
+ expect(unit.label()).toEqual('(US $*share)/shareholder');
43
44
  });
44
45
 
45
46
  test("Unit label for complex unit with denominator parentheses", () => {
46
47
  var unit = new Unit(testReport(), 'iso4217:USD/(eg:share*eg:shareholder)');
47
- expect(unit.label()).toEqual('USD/(Share*Shareholder)');
48
+ expect(unit.label()).toEqual('US $/(share*shareholder)');
48
49
  });
49
50
  });
50
51
 
51
- describe("Unit measure", () => {
52
- test("Unit measure is simple unit", () => {
53
- var unit = new Unit(testReport(), 'iso4217:USD');
54
- expect(unit.measure()).toEqual('iso4217:USD');
55
- });
56
-
57
- test("Unit measure is first numerator of complex unit", () => {
58
- var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
59
- expect(unit.measure()).toEqual('iso4217:USD');
60
- });
61
- });
62
-
63
- describe("Unit measure label", () => {
64
- test("Unit measure label - known currency", () => {
52
+ describe("Unit label", () => {
53
+ test("Unit label - known currency", () => {
65
54
  var unit = new Unit(testReport(), 'eg:share');
66
- expect(unit.measureLabel()).toEqual('eg:share');
55
+ expect(unit.label()).toEqual('share');
67
56
  });
68
57
 
69
- test("Unit measure label - known currency", () => {
58
+ test("Unit label - known currency", () => {
70
59
  var unit = new Unit(testReport(), 'iso4217:USD');
71
- expect(unit.measureLabel()).toEqual('US $');
60
+ expect(unit.label()).toEqual('US $');
72
61
  });
73
62
 
74
- test("Unit measure label - unknown", () => {
63
+ test("Unit label - unknown", () => {
75
64
  var unit = new Unit(testReport(), 'iso4217:ZAR');
76
- expect(unit.measureLabel()).toEqual('ZAR');
65
+ expect(unit.label()).toEqual('ZAR');
77
66
  });
78
67
  });
79
68
 
@@ -94,4 +83,8 @@ describe("Unit value", () => {
94
83
  var unit = new Unit(testReport(), '(iso4217:USD*eg:share)/eg:shareholder');
95
84
  expect(unit.value()).toEqual('(iso4217:USD*eg:share)/eg:shareholder');
96
85
  });
86
+ test("Unit value is simple unit", () => {
87
+ var unit = new Unit(testReport(), 'iso4217:USD');
88
+ expect(unit.value()).toEqual('iso4217:USD');
89
+ });
97
90
  });
@@ -2,10 +2,13 @@
2
2
 
3
3
  import moment from "moment";
4
4
  import Decimal from "decimal.js";
5
+ import i18next from "i18next";
5
6
 
6
7
 
7
8
  export const SHOW_FACT = 'SHOW_FACT';
8
9
 
10
+ export const NAMESPACE_ISO4217 = 'http://www.xbrl.org/2003/iso4217';
11
+
9
12
  /*
10
13
  * Takes a moment.js oject and converts it to a human readable date, or date
11
14
  * and time if the time component is not midnight. Adjust specifies that a
@@ -207,3 +210,18 @@ export function getIXHiddenLinkStyle(domNode) {
207
210
  }
208
211
  return null;
209
212
  }
213
+
214
+ /**
215
+ * Transforms measure qname into title case label (or currency symbol, if applicable).
216
+ * @return {String} Measure Label
217
+ */
218
+
219
+ export function measureLabel(report, measure) {
220
+ const qname = report.qname(measure);
221
+ if (qname.namespace === NAMESPACE_ISO4217) {
222
+ measure = i18next.t(`currencies:unitFormat${qname.localname}`, {defaultValue: qname.localname});
223
+ } else if (measure.includes(':')) {
224
+ measure = measure.split(':')[1];
225
+ }
226
+ return measure;
227
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ixbrl-viewer
3
- Version: 1.4.9
3
+ Version: 1.4.10
4
4
  Summary: The Arelle iXBRL Viewer allows iXBRL reports to be viewed interactively in a web browser.
5
5
  Author-email: "arelle.org" <support@arelle.org>
6
6
  License: Apache-2.0
@@ -29,10 +29,14 @@ Requires-Python: >=3.8
29
29
  Description-Content-Type: text/markdown
30
30
  License-File: LICENSE
31
31
  License-File: NOTICE
32
- Requires-Dist: arelle-release ==2.*
33
32
  Requires-Dist: lxml ==4.*
34
33
  Requires-Dist: pycountry ==22.*
34
+ Provides-Extra: arelle
35
+ Requires-Dist: arelle-release ==2.* ; extra == 'arelle'
35
36
  Provides-Extra: dev
37
+ Requires-Dist: flake8 ==6.1.0 ; extra == 'dev'
38
+ Requires-Dist: lxml-stubs ==0.4.0 ; extra == 'dev'
39
+ Requires-Dist: mypy ==1.7.0 ; extra == 'dev'
36
40
  Requires-Dist: nose2 ==0.14.0 ; extra == 'dev'
37
41
  Requires-Dist: typing-extensions ==4.8.0 ; extra == 'dev'
38
42