@gridsheet/react-core 1.4.0-alpha.2 → 1.4.0-alpha.4

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 (201) hide show
  1. package/dist/components/Cell.js +232 -0
  2. package/dist/components/Cell.js.map +1 -0
  3. package/dist/components/ContextMenu.js +297 -0
  4. package/dist/components/ContextMenu.js.map +1 -0
  5. package/dist/components/Editor.js +455 -0
  6. package/dist/components/Editor.js.map +1 -0
  7. package/dist/components/Emitter.js +26 -0
  8. package/dist/components/Emitter.js.map +1 -0
  9. package/dist/components/Fixed.js +17 -0
  10. package/dist/components/Fixed.js.map +1 -0
  11. package/dist/components/FormulaBar.js +149 -0
  12. package/dist/components/FormulaBar.js.map +1 -0
  13. package/dist/components/GridSheet.js +246 -0
  14. package/dist/components/GridSheet.js.map +1 -0
  15. package/dist/components/HeaderCellLeft.js +131 -0
  16. package/dist/components/HeaderCellLeft.js.map +1 -0
  17. package/dist/components/HeaderCellTop.js +132 -0
  18. package/dist/components/HeaderCellTop.js.map +1 -0
  19. package/dist/components/PluginBase.js +35 -0
  20. package/dist/components/PluginBase.js.map +1 -0
  21. package/dist/components/Resizer.js +98 -0
  22. package/dist/components/Resizer.js.map +1 -0
  23. package/dist/components/SearchBar.js +108 -0
  24. package/dist/components/SearchBar.js.map +1 -0
  25. package/dist/components/SheetProvider.js +56 -0
  26. package/dist/components/SheetProvider.js.map +1 -0
  27. package/dist/components/StoreInitializer.js +84 -0
  28. package/dist/components/StoreInitializer.js.map +1 -0
  29. package/dist/components/Tabular.js +308 -0
  30. package/dist/components/Tabular.js.map +1 -0
  31. package/dist/components/hooks.js +15 -0
  32. package/dist/components/hooks.js.map +1 -0
  33. package/dist/components/svg/Base.js +24 -0
  34. package/dist/components/svg/Base.js.map +1 -0
  35. package/dist/components/svg/CloseIcon.js +13 -0
  36. package/dist/components/svg/CloseIcon.js.map +1 -0
  37. package/dist/components/svg/SearchIcon.js +13 -0
  38. package/dist/components/svg/SearchIcon.js.map +1 -0
  39. package/dist/constants.js +43 -0
  40. package/dist/constants.js.map +1 -0
  41. package/dist/formula/evaluator.js +674 -0
  42. package/dist/formula/evaluator.js.map +1 -0
  43. package/dist/formula/functions/__base.js +19 -0
  44. package/dist/formula/functions/__base.js.map +1 -0
  45. package/dist/formula/functions/__utils.js +145 -0
  46. package/dist/formula/functions/__utils.js.map +1 -0
  47. package/dist/formula/functions/abs.js +24 -0
  48. package/dist/formula/functions/abs.js.map +1 -0
  49. package/dist/formula/functions/acos.js +32 -0
  50. package/dist/formula/functions/acos.js.map +1 -0
  51. package/dist/formula/functions/add.js +57 -0
  52. package/dist/formula/functions/add.js.map +1 -0
  53. package/dist/formula/functions/and.js +28 -0
  54. package/dist/formula/functions/and.js.map +1 -0
  55. package/dist/formula/functions/asin.js +32 -0
  56. package/dist/formula/functions/asin.js.map +1 -0
  57. package/dist/formula/functions/atan.js +29 -0
  58. package/dist/formula/functions/atan.js.map +1 -0
  59. package/dist/formula/functions/atan2.js +35 -0
  60. package/dist/formula/functions/atan2.js.map +1 -0
  61. package/dist/formula/functions/average.js +44 -0
  62. package/dist/formula/functions/average.js.map +1 -0
  63. package/dist/formula/functions/col.js +31 -0
  64. package/dist/formula/functions/col.js.map +1 -0
  65. package/dist/formula/functions/concat.js +27 -0
  66. package/dist/formula/functions/concat.js.map +1 -0
  67. package/dist/formula/functions/concatenate.js +28 -0
  68. package/dist/formula/functions/concatenate.js.map +1 -0
  69. package/dist/formula/functions/cos.js +29 -0
  70. package/dist/formula/functions/cos.js.map +1 -0
  71. package/dist/formula/functions/count.js +38 -0
  72. package/dist/formula/functions/count.js.map +1 -0
  73. package/dist/formula/functions/counta.js +38 -0
  74. package/dist/formula/functions/counta.js.map +1 -0
  75. package/dist/formula/functions/countif.js +32 -0
  76. package/dist/formula/functions/countif.js.map +1 -0
  77. package/dist/formula/functions/divide.js +33 -0
  78. package/dist/formula/functions/divide.js.map +1 -0
  79. package/dist/formula/functions/eq.js +29 -0
  80. package/dist/formula/functions/eq.js.map +1 -0
  81. package/dist/formula/functions/exp.js +29 -0
  82. package/dist/formula/functions/exp.js.map +1 -0
  83. package/dist/formula/functions/gt.js +29 -0
  84. package/dist/formula/functions/gt.js.map +1 -0
  85. package/dist/formula/functions/gte.js +29 -0
  86. package/dist/formula/functions/gte.js.map +1 -0
  87. package/dist/formula/functions/hlookup.js +75 -0
  88. package/dist/formula/functions/hlookup.js.map +1 -0
  89. package/dist/formula/functions/if.js +39 -0
  90. package/dist/formula/functions/if.js.map +1 -0
  91. package/dist/formula/functions/iferror.js +45 -0
  92. package/dist/formula/functions/iferror.js.map +1 -0
  93. package/dist/formula/functions/len.js +29 -0
  94. package/dist/formula/functions/len.js.map +1 -0
  95. package/dist/formula/functions/lenb.js +29 -0
  96. package/dist/formula/functions/lenb.js.map +1 -0
  97. package/dist/formula/functions/ln.js +32 -0
  98. package/dist/formula/functions/ln.js.map +1 -0
  99. package/dist/formula/functions/log.js +36 -0
  100. package/dist/formula/functions/log.js.map +1 -0
  101. package/dist/formula/functions/log10.js +32 -0
  102. package/dist/formula/functions/log10.js.map +1 -0
  103. package/dist/formula/functions/lt.js +29 -0
  104. package/dist/formula/functions/lt.js.map +1 -0
  105. package/dist/formula/functions/lte.js +29 -0
  106. package/dist/formula/functions/lte.js.map +1 -0
  107. package/dist/formula/functions/max.js +47 -0
  108. package/dist/formula/functions/max.js.map +1 -0
  109. package/dist/formula/functions/min.js +47 -0
  110. package/dist/formula/functions/min.js.map +1 -0
  111. package/dist/formula/functions/minus.js +57 -0
  112. package/dist/formula/functions/minus.js.map +1 -0
  113. package/dist/formula/functions/mod.js +33 -0
  114. package/dist/formula/functions/mod.js.map +1 -0
  115. package/dist/formula/functions/multiply.js +27 -0
  116. package/dist/formula/functions/multiply.js.map +1 -0
  117. package/dist/formula/functions/ne.js +29 -0
  118. package/dist/formula/functions/ne.js.map +1 -0
  119. package/dist/formula/functions/not.js +30 -0
  120. package/dist/formula/functions/not.js.map +1 -0
  121. package/dist/formula/functions/now.js +22 -0
  122. package/dist/formula/functions/now.js.map +1 -0
  123. package/dist/formula/functions/or.js +28 -0
  124. package/dist/formula/functions/or.js.map +1 -0
  125. package/dist/formula/functions/pi.js +22 -0
  126. package/dist/formula/functions/pi.js.map +1 -0
  127. package/dist/formula/functions/power.js +27 -0
  128. package/dist/formula/functions/power.js.map +1 -0
  129. package/dist/formula/functions/product.js +40 -0
  130. package/dist/formula/functions/product.js.map +1 -0
  131. package/dist/formula/functions/radians.js +29 -0
  132. package/dist/formula/functions/radians.js.map +1 -0
  133. package/dist/formula/functions/rand.js +22 -0
  134. package/dist/formula/functions/rand.js.map +1 -0
  135. package/dist/formula/functions/round.js +35 -0
  136. package/dist/formula/functions/round.js.map +1 -0
  137. package/dist/formula/functions/rounddown.js +35 -0
  138. package/dist/formula/functions/rounddown.js.map +1 -0
  139. package/dist/formula/functions/roundup.js +35 -0
  140. package/dist/formula/functions/roundup.js.map +1 -0
  141. package/dist/formula/functions/row.js +31 -0
  142. package/dist/formula/functions/row.js.map +1 -0
  143. package/dist/formula/functions/sin.js +29 -0
  144. package/dist/formula/functions/sin.js.map +1 -0
  145. package/dist/formula/functions/sqrt.js +32 -0
  146. package/dist/formula/functions/sqrt.js.map +1 -0
  147. package/dist/formula/functions/sum.js +47 -0
  148. package/dist/formula/functions/sum.js.map +1 -0
  149. package/dist/formula/functions/sumif.js +65 -0
  150. package/dist/formula/functions/sumif.js.map +1 -0
  151. package/dist/formula/functions/tan.js +29 -0
  152. package/dist/formula/functions/tan.js.map +1 -0
  153. package/dist/formula/functions/uminus.js +24 -0
  154. package/dist/formula/functions/uminus.js.map +1 -0
  155. package/dist/formula/functions/vlookup.js +75 -0
  156. package/dist/formula/functions/vlookup.js.map +1 -0
  157. package/dist/formula/mapping.js +118 -0
  158. package/dist/formula/mapping.js.map +1 -0
  159. package/dist/formula/solver.js +70 -0
  160. package/dist/formula/solver.js.map +1 -0
  161. package/dist/index.js +16 -9113
  162. package/dist/index.js.map +1 -1
  163. package/dist/lib/autofill.js +391 -0
  164. package/dist/lib/autofill.js.map +1 -0
  165. package/dist/lib/clipboard.js +46 -0
  166. package/dist/lib/clipboard.js.map +1 -0
  167. package/dist/lib/converters.js +141 -0
  168. package/dist/lib/converters.js.map +1 -0
  169. package/dist/lib/input.js +52 -0
  170. package/dist/lib/input.js.map +1 -0
  171. package/dist/lib/palette.js +24 -0
  172. package/dist/lib/palette.js.map +1 -0
  173. package/dist/lib/prevention.js +82 -0
  174. package/dist/lib/prevention.js.map +1 -0
  175. package/dist/lib/structs.js +276 -0
  176. package/dist/lib/structs.js.map +1 -0
  177. package/dist/lib/table.js +1248 -0
  178. package/dist/lib/table.js.map +1 -0
  179. package/dist/lib/time.js +79 -0
  180. package/dist/lib/time.js.map +1 -0
  181. package/dist/lib/virtualization.js +129 -0
  182. package/dist/lib/virtualization.js.map +1 -0
  183. package/dist/parsers/core.js +139 -0
  184. package/dist/parsers/core.js.map +1 -0
  185. package/dist/renderers/checkbox.js +20 -0
  186. package/dist/renderers/checkbox.js.map +1 -0
  187. package/dist/renderers/core.js +147 -0
  188. package/dist/renderers/core.js.map +1 -0
  189. package/dist/renderers/thousand_separator.js +17 -0
  190. package/dist/renderers/thousand_separator.js.map +1 -0
  191. package/dist/store/actions.js +762 -0
  192. package/dist/store/actions.js.map +1 -0
  193. package/dist/store/helpers.js +88 -0
  194. package/dist/store/helpers.js.map +1 -0
  195. package/dist/store/index.js +8 -0
  196. package/dist/store/index.js.map +1 -0
  197. package/dist/styles/embedder.js +19 -0
  198. package/dist/styles/embedder.js.map +1 -0
  199. package/dist/styles/minified.js +7 -0
  200. package/dist/styles/minified.js.map +1 -0
  201. package/package.json +1 -7
@@ -0,0 +1,147 @@
1
+ import dayjs from "dayjs";
2
+ import { Table } from "../lib/table.js";
3
+ import { solveFormula } from "../formula/solver.js";
4
+ import { FormulaError } from "../formula/evaluator.js";
5
+ import { p2a } from "../lib/converters.js";
6
+ import { TimeDelta } from "../lib/time.js";
7
+ class Renderer {
8
+ constructor(props) {
9
+ this.datetimeFormat = "YYYY-MM-DD HH:mm:ss";
10
+ this.dateFormat = "YYYY-MM-DD";
11
+ this.timeDeltaFormat = "HH:mm:ss";
12
+ this.applyMixins(props == null ? void 0 : props.mixins);
13
+ if (props == null) {
14
+ return;
15
+ }
16
+ const { condition, complement } = props;
17
+ this.condition = condition;
18
+ this.complement = complement;
19
+ }
20
+ applyMixins(mixins) {
21
+ if (mixins == null) {
22
+ return;
23
+ }
24
+ for (const mixin of mixins) {
25
+ for (const key in mixin) {
26
+ this[key] = mixin[key];
27
+ }
28
+ }
29
+ }
30
+ call(table, point, writer) {
31
+ var _a;
32
+ const address = p2a(point);
33
+ const cache = table.getSolvedCache(address);
34
+ const value = cache || ((_a = table.getByPoint(point)) == null ? void 0 : _a.value);
35
+ return this.render(value, table, writer);
36
+ }
37
+ render(value, table, writer) {
38
+ var _a;
39
+ if (this.condition && !this.condition(value)) {
40
+ return this.complement ? this.complement(value) : this.stringify({ value });
41
+ }
42
+ switch (typeof value) {
43
+ case "object":
44
+ if (value instanceof Date) {
45
+ return this.date(value, writer);
46
+ }
47
+ if (value instanceof TimeDelta) {
48
+ return this.timedelta(value, writer);
49
+ }
50
+ if (value == null) {
51
+ return this.null(value, writer);
52
+ }
53
+ if (value instanceof Table) {
54
+ return this.render((_a = value.getByPoint({ y: value.top, x: value.left })) == null ? void 0 : _a.value, table, writer);
55
+ }
56
+ if (Array.isArray(value)) {
57
+ return this.array(value, writer);
58
+ }
59
+ if (value instanceof FormulaError) {
60
+ throw value;
61
+ }
62
+ return this.object(value, writer);
63
+ case "string":
64
+ return this.string(value, table, writer);
65
+ case "number":
66
+ return this.number(value, writer);
67
+ case "boolean":
68
+ return this.bool(value, writer);
69
+ case "undefined":
70
+ return this.undefined(value, writer);
71
+ case "function":
72
+ return value();
73
+ }
74
+ return "";
75
+ }
76
+ stringify(cell) {
77
+ const { value } = cell;
78
+ if (value instanceof Date) {
79
+ return this.date(value);
80
+ }
81
+ if (value instanceof TimeDelta) {
82
+ return this.timedelta(value);
83
+ }
84
+ if (value == null) {
85
+ return "";
86
+ }
87
+ return value.toString();
88
+ }
89
+ string(value, table, writer) {
90
+ if (value[0] === "'") {
91
+ return value.substring(1);
92
+ }
93
+ if (value[0] === "=") {
94
+ const result = solveFormula({ value, table, raise: true });
95
+ if (result === null) {
96
+ return this.null(null);
97
+ }
98
+ if (result === void 0) {
99
+ return this.undefined(void 0);
100
+ }
101
+ if (result.constructor.name === "Boolean") {
102
+ return String(result).toUpperCase();
103
+ }
104
+ if (result.constructor.name === "Date") {
105
+ return this.date(result);
106
+ }
107
+ return this.render(result, table, writer);
108
+ }
109
+ return value;
110
+ }
111
+ bool(value, writer) {
112
+ return value ? "TRUE" : "FALSE";
113
+ }
114
+ number(value, writer) {
115
+ if (isNaN(value)) {
116
+ return "NaN";
117
+ }
118
+ return value;
119
+ }
120
+ date(value, writer) {
121
+ if (value.getHours() + value.getMinutes() + value.getSeconds() === 0) {
122
+ return dayjs(value).format(this.dateFormat);
123
+ }
124
+ return dayjs(value).format(this.datetimeFormat);
125
+ }
126
+ timedelta(value, writer) {
127
+ return value.stringify(this.timeDeltaFormat);
128
+ }
129
+ array(value, writer) {
130
+ return value.map((v) => this.stringify({ value: v })).join(",");
131
+ }
132
+ object(value, writer) {
133
+ return JSON.stringify(value);
134
+ }
135
+ null(value, writer) {
136
+ return "";
137
+ }
138
+ undefined(value, writer) {
139
+ return "";
140
+ }
141
+ }
142
+ const defaultRenderer = new Renderer();
143
+ export {
144
+ Renderer,
145
+ defaultRenderer
146
+ };
147
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sources":["../../renderers/core.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { CellType, PointType, WriterType } from '../types';\nimport { Table, UserTable } from '../lib/table';\nimport { solveFormula } from '../formula/solver';\nimport { FormulaError } from '../formula/evaluator';\nimport { p2a } from '../lib/converters';\nimport { TimeDelta } from '../lib/time';\n\ntype Condition = (value: any) => boolean;\n\ntype Stringify = (value: any) => string;\n\ntype Props = {\n condition?: Condition;\n complement?: Stringify;\n mixins?: RendererMixinType[];\n};\n\nexport interface RendererMixinType {\n render?(value: any, table: UserTable, writer?: WriterType): any;\n stringify?(cell: CellType): string;\n string?(value: string, table: UserTable, writer?: WriterType): any;\n bool?(value: boolean, writer?: WriterType): any;\n number?(value: number, writer?: WriterType): any;\n date?(value: Date, writer?: WriterType): any;\n timedelta?(value: TimeDelta, writer?: WriterType): any;\n array?(value: any[], writer?: WriterType): any;\n object?(value: any, writer?: WriterType): any;\n null?(value: null, writer?: WriterType): any;\n undefined?(value: undefined, writer?: WriterType): any;\n}\n\nexport class Renderer implements RendererMixinType {\n public datetimeFormat: string = 'YYYY-MM-DD HH:mm:ss';\n public dateFormat: string = 'YYYY-MM-DD';\n public timeDeltaFormat: string = 'HH:mm:ss';\n private condition?: Condition;\n private complement?: Stringify;\n\n constructor(props?: Props) {\n this.applyMixins(props?.mixins);\n if (props == null) {\n return;\n }\n const { condition, complement } = props;\n this.condition = condition;\n this.complement = complement;\n }\n\n private applyMixins(mixins?: RendererMixinType[]) {\n if (mixins == null) {\n return;\n }\n for (const mixin of mixins) {\n for (const key in mixin) {\n // @ts-expect-error mixin has the same fields as this\n this[key] = mixin[key];\n }\n }\n }\n\n public call(table: Table, point: PointType, writer?: WriterType): any {\n const address = p2a(point);\n const cache = table.getSolvedCache(address);\n const value = cache || table.getByPoint(point)?.value;\n return this.render(value, table, writer);\n }\n\n public render(value: any, table: Table, writer?: WriterType): any {\n if (this.condition && !this.condition(value)) {\n return this.complement ? this.complement(value) : this.stringify({ value });\n }\n\n switch (typeof value) {\n case 'object':\n if (value instanceof Date) {\n return this.date(value, writer);\n }\n if (value instanceof TimeDelta) {\n return this.timedelta(value, writer);\n }\n if (value == null) {\n return this.null(value, writer);\n }\n if (value instanceof Table) {\n return this.render(value.getByPoint({ y: value.top, x: value.left })?.value, table, writer);\n }\n if (Array.isArray(value)) {\n return this.array(value, writer);\n }\n if (value instanceof FormulaError) {\n throw value;\n }\n return this.object(value, writer);\n case 'string':\n return this.string(value, table, writer);\n case 'number':\n return this.number(value, writer);\n case 'boolean':\n return this.bool(value, writer);\n case 'undefined':\n return this.undefined(value, writer);\n case 'function':\n return value() as string;\n }\n return '';\n }\n\n stringify(cell: CellType): string {\n const { value } = cell;\n if (value instanceof Date) {\n return this.date(value);\n }\n if (value instanceof TimeDelta) {\n return this.timedelta(value);\n }\n if (value == null) {\n return '';\n }\n\n return value.toString();\n }\n\n string(value: string, table: Table, writer?: WriterType): any {\n if (value[0] === \"'\") {\n return value.substring(1);\n }\n if (value[0] === '=') {\n const result = solveFormula({ value, table, raise: true });\n if (result === null) {\n return this.null(null);\n }\n if (result === undefined) {\n return this.undefined(undefined);\n }\n if (result.constructor.name === 'Boolean') {\n return String(result).toUpperCase();\n }\n if (result.constructor.name === 'Date') {\n return this.date(result as Date);\n }\n return this.render(result, table, writer);\n }\n return value;\n }\n\n bool(value: boolean, writer?: WriterType): any {\n return value ? 'TRUE' : 'FALSE';\n }\n\n number(value: number, writer?: WriterType): any {\n if (isNaN(value)) {\n return 'NaN';\n }\n return value;\n }\n\n date(value: Date, writer?: WriterType): any {\n if (value.getHours() + value.getMinutes() + value.getSeconds() === 0) {\n return dayjs(value).format(this.dateFormat);\n }\n return dayjs(value).format(this.datetimeFormat);\n }\n\n timedelta(value: TimeDelta, writer?: WriterType): any {\n return value.stringify(this.timeDeltaFormat);\n }\n\n array(value: any[], writer?: WriterType): any {\n return value.map((v) => this.stringify({ value: v })).join(',');\n }\n\n object(value: any, writer?: WriterType): any {\n return JSON.stringify(value);\n }\n\n null(value: any, writer?: WriterType): any {\n return '';\n }\n\n undefined(value: undefined, writer?: WriterType): any {\n return '';\n }\n}\n\nexport type RendererType = Renderer;\nexport const defaultRenderer = new Renderer();\n"],"names":[],"mappings":";;;;;;AAiCO,MAAM,SAAsC;AA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;AAC/B,eAAA,KAAK,KAAK,MAAc;AAAA,MAAA;AAEjC,aAAO,KAAK,OAAO,QAAQ,OAAO,MAAM;AAAA,IAAA;AAEnC,WAAA;AAAA,EAAA;AAAA,EAGT,KAAK,OAAgB,QAA0B;AAC7C,WAAO,QAAQ,SAAS;AAAA,EAAA;AAAA,EAG1B,OAAO,OAAe,QAA0B;AAC1C,QAAA,MAAM,KAAK,GAAG;AACT,aAAA;AAAA,IAAA;AAEF,WAAA;AAAA,EAAA;AAAA,EAGT,KAAK,OAAa,QAA0B;AACtC,QAAA,MAAM,aAAa,MAAM,eAAe,MAAM,WAAW,MAAM,GAAG;AACpE,aAAO,MAAM,KAAK,EAAE,OAAO,KAAK,UAAU;AAAA,IAAA;AAE5C,WAAO,MAAM,KAAK,EAAE,OAAO,KAAK,cAAc;AAAA,EAAA;AAAA,EAGhD,UAAU,OAAkB,QAA0B;AAC7C,WAAA,MAAM,UAAU,KAAK,eAAe;AAAA,EAAA;AAAA,EAG7C,MAAM,OAAc,QAA0B;AAC5C,WAAO,MAAM,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,OAAO,EAAG,CAAA,CAAC,EAAE,KAAK,GAAG;AAAA,EAAA;AAAA,EAGhE,OAAO,OAAY,QAA0B;AACpC,WAAA,KAAK,UAAU,KAAK;AAAA,EAAA;AAAA,EAG7B,KAAK,OAAY,QAA0B;AAClC,WAAA;AAAA,EAAA;AAAA,EAGT,UAAU,OAAkB,QAA0B;AAC7C,WAAA;AAAA,EAAA;AAEX;AAGa,MAAA,kBAAkB,IAAI,SAAS;"}
@@ -0,0 +1,17 @@
1
+ const ThousandSeparatorRendererMixin = {
2
+ number(value) {
3
+ if (isNaN(value)) {
4
+ return "NaN";
5
+ }
6
+ const [int, fraction] = String(value).split(".");
7
+ const result = int.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
8
+ if (fraction == null) {
9
+ return result;
10
+ }
11
+ return `${result}.${fraction}`;
12
+ }
13
+ };
14
+ export {
15
+ ThousandSeparatorRendererMixin
16
+ };
17
+ //# sourceMappingURL=thousand_separator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thousand_separator.js","sources":["../../renderers/thousand_separator.ts"],"sourcesContent":["export const ThousandSeparatorRendererMixin = {\n number(value: number): any {\n if (isNaN(value)) {\n return 'NaN';\n }\n const [int, fraction] = String(value).split('.');\n const result = int.replace(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/g, '$1,');\n if (fraction == null) {\n return result;\n }\n return `${result}.${fraction}`;\n },\n};\n"],"names":[],"mappings":"AAAO,MAAM,iCAAiC;AAAA,EAC5C,OAAO,OAAoB;AACrB,QAAA,MAAM,KAAK,GAAG;AACT,aAAA;AAAA,IAAA;AAEH,UAAA,CAAC,KAAK,QAAQ,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAC/C,UAAM,SAAS,IAAI,QAAQ,4BAA4B,KAAK;AAC5D,QAAI,YAAY,MAAM;AACb,aAAA;AAAA,IAAA;AAEF,WAAA,GAAG,MAAM,IAAI,QAAQ;AAAA,EAAA;AAEhC;"}