@pie-lib/charting 5.13.1-next.0 → 5.14.0

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/CHANGELOG.md CHANGED
@@ -3,537 +3,316 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [5.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.12.0...@pie-lib/charting@5.13.0) (2023-06-12)
6
+ # [5.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.13.0...@pie-lib/charting@5.14.0) (2023-06-13)
7
7
 
8
8
 
9
9
  ### Features
10
10
 
11
- * started adding new mathMLOptions property PD-2150 ([175b45e](https://github.com/pie-framework/pie-lib/commit/175b45ecd98e9cc703bd7056b930f299a4345c75))
12
-
11
+ * **charting, translator:** add translator to charting. add missing text in translator ([2c722a2](https://github.com/pie-framework/pie-lib/commit/2c722a241deb1ad4b51aa22c6eba74a0ec8a5ec0))
13
12
 
14
13
 
15
14
 
16
15
 
17
- # [5.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.11.0...@pie-lib/charting@5.12.0) (2023-05-22)
18
16
 
17
+ # [5.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.12.0...@pie-lib/charting@5.13.0) (2023-06-12)
19
18
 
20
19
  ### Features
21
20
 
22
- * **charting:** add new authoring view settings to restrict the permitted chart types and allow their names to be changed PD-2777 ([ae606aa](https://github.com/pie-framework/pie-lib/commit/ae606aa81a314c9b95fec36c5f47e88b1e6cd497))
23
- * **charting:** show chart type only if it's available in config PD-2777 ([754876f](https://github.com/pie-framework/pie-lib/commit/754876f223e1fa57c259fd8e752340ea29e36bdc))
24
-
21
+ - started adding new mathMLOptions property PD-2150 ([175b45e](https://github.com/pie-framework/pie-lib/commit/175b45ecd98e9cc703bd7056b930f299a4345c75))
25
22
 
23
+ # [5.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.11.0...@pie-lib/charting@5.12.0) (2023-05-22)
26
24
 
25
+ ### Features
27
26
 
27
+ - **charting:** add new authoring view settings to restrict the permitted chart types and allow their names to be changed PD-2777 ([ae606aa](https://github.com/pie-framework/pie-lib/commit/ae606aa81a314c9b95fec36c5f47e88b1e6cd497))
28
+ - **charting:** show chart type only if it's available in config PD-2777 ([754876f](https://github.com/pie-framework/pie-lib/commit/754876f223e1fa57c259fd8e752340ea29e36bdc))
28
29
 
29
30
  # [5.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.10.0...@pie-lib/charting@5.11.0) (2023-05-18)
30
31
 
31
-
32
32
  ### Features
33
33
 
34
- * **charting:** use 0 as default value for new added category ([3b17996](https://github.com/pie-framework/pie-lib/commit/3b1799687b9db2e3dc2cd60748b121e317d56f0d))
35
-
36
-
37
-
38
-
34
+ - **charting:** use 0 as default value for new added category ([3b17996](https://github.com/pie-framework/pie-lib/commit/3b1799687b9db2e3dc2cd60748b121e317d56f0d))
39
35
 
40
36
  # [5.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.9.0...@pie-lib/charting@5.10.0) (2023-05-18)
41
37
 
42
-
43
38
  ### Bug Fixes
44
39
 
45
- * **charting:** provide mask id PD-2821 ([9e29841](https://github.com/pie-framework/pie-lib/commit/9e298415e6cafd03e4264ab189af8a3b03f46b97))
46
-
40
+ - **charting:** provide mask id PD-2821 ([9e29841](https://github.com/pie-framework/pie-lib/commit/9e298415e6cafd03e4264ab189af8a3b03f46b97))
47
41
 
48
42
  ### Features
49
43
 
50
- * **charting:** add new item properties, settings, and authoring view settings for changeInteractive, changeEditable and addCategory ([0fe39c9](https://github.com/pie-framework/pie-lib/commit/0fe39c96f2e7ddeb0e24a9ef58a5d75d42550c73))
51
- * **charting:** add props validation PD-2776 ([6566927](https://github.com/pie-framework/pie-lib/commit/6566927be268b358c7de10d4b63d15e502a8368e))
52
- * **charting:** fix value for category editable when changeEditableEnabled is false ([4214aab](https://github.com/pie-framework/pie-lib/commit/4214aab4437b5d2395515b9b1d0680b93530ac83))
53
-
54
-
55
-
56
-
44
+ - **charting:** add new item properties, settings, and authoring view settings for changeInteractive, changeEditable and addCategory ([0fe39c9](https://github.com/pie-framework/pie-lib/commit/0fe39c96f2e7ddeb0e24a9ef58a5d75d42550c73))
45
+ - **charting:** add props validation PD-2776 ([6566927](https://github.com/pie-framework/pie-lib/commit/6566927be268b358c7de10d4b63d15e502a8368e))
46
+ - **charting:** fix value for category editable when changeEditableEnabled is false ([4214aab](https://github.com/pie-framework/pie-lib/commit/4214aab4437b5d2395515b9b1d0680b93530ac83))
57
47
 
58
48
  # [5.9.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.8.1...@pie-lib/charting@5.9.0) (2023-05-12)
59
49
 
60
-
61
50
  ### Features
62
51
 
63
- * **charting:** add authoring view settings for authorNewCategoryDefaults and studentNewCategoryDefaultLabel PD-2774 ([84009f7](https://github.com/pie-framework/pie-lib/commit/84009f791d1f6c1dc15ec2789e5e9c6570190536))
64
-
65
-
66
-
67
-
52
+ - **charting:** add authoring view settings for authorNewCategoryDefaults and studentNewCategoryDefaultLabel PD-2774 ([84009f7](https://github.com/pie-framework/pie-lib/commit/84009f791d1f6c1dc15ec2789e5e9c6570190536))
68
53
 
69
54
  ## [5.8.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.8.0...@pie-lib/charting@5.8.1) (2023-05-02)
70
55
 
71
-
72
56
  ### Bug Fixes
73
57
 
74
- * **charting:** fix bad default state for chart data in author and player PD-2755, PD-2625 ([2428bb1](https://github.com/pie-framework/pie-lib/commit/2428bb14c0d304111f79e8553e48b95e6882d628))
75
-
76
-
77
-
78
-
58
+ - **charting:** fix bad default state for chart data in author and player PD-2755, PD-2625 ([2428bb1](https://github.com/pie-framework/pie-lib/commit/2428bb14c0d304111f79e8553e48b95e6882d628))
79
59
 
80
60
  # [5.8.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.7.2...@pie-lib/charting@5.8.0) (2023-05-01)
81
61
 
82
-
83
62
  ### Bug Fixes
84
63
 
85
- * **charting:** reset invalid values from chart model ([892b90d](https://github.com/pie-framework/pie-lib/commit/892b90d049e0fd8e0ab623ebc17a2e4e1ca63a2e))
86
- * **charting:** update chart data in player ([657399d](https://github.com/pie-framework/pie-lib/commit/657399d1b2fe285695196df4b9641aa632394a84))
87
-
64
+ - **charting:** reset invalid values from chart model ([892b90d](https://github.com/pie-framework/pie-lib/commit/892b90d049e0fd8e0ab623ebc17a2e4e1ca63a2e))
65
+ - **charting:** update chart data in player ([657399d](https://github.com/pie-framework/pie-lib/commit/657399d1b2fe285695196df4b9641aa632394a84))
88
66
 
89
67
  ### Features
90
68
 
91
- * **charting:** add classes and rerender math at correct answer: PD-491 ([79f4398](https://github.com/pie-framework/pie-lib/commit/79f4398adae30f4a5a7ad4a9da577665ece145ba))
92
- * **charting:** refactor regenx for mixed fractions and solve reviews and eslint-PD-491 ([49d18f4](https://github.com/pie-framework/pie-lib/commit/49d18f4a65f25fbfa010898d8486608819eece06))
93
- * **charting:** render fractions using mathjax-PD-491 ([336319f](https://github.com/pie-framework/pie-lib/commit/336319fa238fed333c2bddc0888a031805452a13))
94
-
95
-
96
-
97
-
69
+ - **charting:** add classes and rerender math at correct answer: PD-491 ([79f4398](https://github.com/pie-framework/pie-lib/commit/79f4398adae30f4a5a7ad4a9da577665ece145ba))
70
+ - **charting:** refactor regenx for mixed fractions and solve reviews and eslint-PD-491 ([49d18f4](https://github.com/pie-framework/pie-lib/commit/49d18f4a65f25fbfa010898d8486608819eece06))
71
+ - **charting:** render fractions using mathjax-PD-491 ([336319f](https://github.com/pie-framework/pie-lib/commit/336319fa238fed333c2bddc0888a031805452a13))
98
72
 
99
73
  ## [5.7.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.7.1...@pie-lib/charting@5.7.2) (2023-04-19)
100
74
 
101
-
102
75
  ### Bug Fixes
103
76
 
104
- * **eslint:** fix eslint problems-PD-2732 ([9eb9976](https://github.com/pie-framework/pie-lib/commit/9eb9976749753da86e1057a07bd2cfc65bf64ae4))
105
-
106
-
107
-
108
-
77
+ - **eslint:** fix eslint problems-PD-2732 ([9eb9976](https://github.com/pie-framework/pie-lib/commit/9eb9976749753da86e1057a07bd2cfc65bf64ae4))
109
78
 
110
79
  ## [5.7.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.7.0...@pie-lib/charting@5.7.1) (2023-04-03)
111
80
 
112
-
113
81
  ### Bug Fixes
114
82
 
115
- * **charting:** generate random maskId to avoid duplication of ids-PD-2712 ([c32c7ea](https://github.com/pie-framework/pie-lib/commit/c32c7ea84972c396e123e00ca16ac6ec41b844d3))
116
-
117
-
118
-
119
-
83
+ - **charting:** generate random maskId to avoid duplication of ids-PD-2712 ([c32c7ea](https://github.com/pie-framework/pie-lib/commit/c32c7ea84972c396e123e00ca16ac6ec41b844d3))
120
84
 
121
85
  # [5.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.16...@pie-lib/charting@5.7.0) (2023-03-27)
122
86
 
123
-
124
87
  ### Features
125
88
 
126
- * **charting:** mark up the category name in the student’s response as correct or incorrect with a rectangle ([5746b54](https://github.com/pie-framework/pie-lib/commit/5746b54bdeee204e906af91dca1cb65788d91128))
127
-
128
-
129
-
130
-
89
+ - **charting:** mark up the category name in the student’s response as correct or incorrect with a rectangle ([5746b54](https://github.com/pie-framework/pie-lib/commit/5746b54bdeee204e906af91dca1cb65788d91128))
131
90
 
132
91
  ## [5.6.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.15...@pie-lib/charting@5.6.16) (2023-03-06)
133
92
 
134
-
135
93
  ### Bug Fixes
136
94
 
137
- * **charting:** fix style for chart boxes ([6e45b13](https://github.com/pie-framework/pie-lib/commit/6e45b130ad2a72f236d3c89269fdc180687864fe))
138
-
139
-
140
-
141
-
95
+ - **charting:** fix style for chart boxes ([6e45b13](https://github.com/pie-framework/pie-lib/commit/6e45b130ad2a72f236d3c89269fdc180687864fe))
142
96
 
143
97
  ## [5.6.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.13...@pie-lib/charting@5.6.15) (2023-02-28)
144
98
 
145
-
146
99
  ### Bug Fixes
147
100
 
148
- * version bump ([d9280a9](https://github.com/pie-framework/pie-lib/commit/d9280a9aeddab459b6d84ecdbeb62814e1eee965))
149
-
150
-
151
-
152
-
101
+ - version bump ([d9280a9](https://github.com/pie-framework/pie-lib/commit/d9280a9aeddab459b6d84ecdbeb62814e1eee965))
153
102
 
154
103
  ## [5.6.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.12...@pie-lib/charting@5.6.13) (2023-02-28)
155
104
 
156
-
157
105
  ### Bug Fixes
158
106
 
159
- * **charting:** add sanity checks to data ([25c7bb2](https://github.com/pie-framework/pie-lib/commit/25c7bb226cac10556950ace3feeba73d1966f0ba))
160
-
161
-
162
-
163
-
107
+ - **charting:** add sanity checks to data ([25c7bb2](https://github.com/pie-framework/pie-lib/commit/25c7bb226cac10556950ace3feeba73d1966f0ba))
164
108
 
165
109
  ## [5.6.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.10...@pie-lib/charting@5.6.12) (2023-01-31)
166
110
 
167
111
  **Note:** Version bump only for package @pie-lib/charting
168
112
 
169
-
170
-
171
-
172
-
173
113
  ## [5.6.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.9...@pie-lib/charting@5.6.10) (2023-01-31)
174
114
 
175
115
  **Note:** Version bump only for package @pie-lib/charting
176
116
 
177
-
178
-
179
-
180
-
181
117
  ## [5.6.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.8...@pie-lib/charting@5.6.9) (2023-01-31)
182
118
 
183
119
  **Note:** Version bump only for package @pie-lib/charting
184
120
 
185
-
186
-
187
-
188
-
189
121
  ## [5.6.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.7...@pie-lib/charting@5.6.8) (2023-01-31)
190
122
 
191
123
  **Note:** Version bump only for package @pie-lib/charting
192
124
 
193
-
194
-
195
-
196
-
197
125
  ## [5.6.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.5...@pie-lib/charting@5.6.7) (2023-01-31)
198
126
 
199
127
  **Note:** Version bump only for package @pie-lib/charting
200
128
 
201
-
202
-
203
-
204
-
205
129
  ## [5.6.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.3...@pie-lib/charting@5.6.5) (2023-01-31)
206
130
 
207
131
  **Note:** Version bump only for package @pie-lib/charting
208
132
 
209
-
210
-
211
-
212
-
213
133
  ## [5.6.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.1...@pie-lib/charting@5.6.3) (2023-01-31)
214
134
 
215
135
  **Note:** Version bump only for package @pie-lib/charting
216
136
 
217
-
218
-
219
-
220
-
221
137
  ## [5.6.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.6.0...@pie-lib/charting@5.6.1) (2023-01-16)
222
138
 
223
-
224
139
  ### Bug Fixes
225
140
 
226
- * sanity check DNA-16247 ([9213ff4](https://github.com/pie-framework/pie-lib/commit/9213ff48d24f6492a5f7ea2ad61d059c09cbf090))
227
-
228
-
229
-
230
-
141
+ - sanity check DNA-16247 ([9213ff4](https://github.com/pie-framework/pie-lib/commit/9213ff48d24f6492a5f7ea2ad61d059c09cbf090))
231
142
 
232
143
  # [5.6.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.5.1...@pie-lib/charting@5.6.0) (2023-01-16)
233
144
 
234
-
235
145
  ### Features
236
146
 
237
- * added theme naming support + cleanup ([72d562d](https://github.com/pie-framework/pie-lib/commit/72d562d509e5d31d883690eb455a9afea6bf54fc))
238
-
239
-
240
-
241
-
147
+ - added theme naming support + cleanup ([72d562d](https://github.com/pie-framework/pie-lib/commit/72d562d509e5d31d883690eb455a9afea6bf54fc))
242
148
 
243
149
  ## [5.5.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.5.0...@pie-lib/charting@5.5.1) (2023-01-03)
244
150
 
245
151
  **Note:** Version bump only for package @pie-lib/charting
246
152
 
247
-
248
-
249
-
250
-
251
153
  # [5.5.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.4.2...@pie-lib/charting@5.5.0) (2022-12-19)
252
154
 
253
-
254
155
  ### Features
255
156
 
256
- * **charting:** add color scheme for charting bars ([0e3cb02](https://github.com/pie-framework/pie-lib/commit/0e3cb021e646efebf84111ec9a1016495e6a4a39))
257
- * **charting:** update snapshots ([1e61ad2](https://github.com/pie-framework/pie-lib/commit/1e61ad27b8b78842cd56b4bdb8ce1215760f2d35))
258
- * **charting:** use colors for bars only in histogram chart type ([d7bef94](https://github.com/pie-framework/pie-lib/commit/d7bef947996282270f6343afd2d332f73ef64e31))
259
-
260
-
261
-
262
-
157
+ - **charting:** add color scheme for charting bars ([0e3cb02](https://github.com/pie-framework/pie-lib/commit/0e3cb021e646efebf84111ec9a1016495e6a4a39))
158
+ - **charting:** update snapshots ([1e61ad2](https://github.com/pie-framework/pie-lib/commit/1e61ad27b8b78842cd56b4bdb8ce1215760f2d35))
159
+ - **charting:** use colors for bars only in histogram chart type ([d7bef94](https://github.com/pie-framework/pie-lib/commit/d7bef947996282270f6343afd2d332f73ef64e31))
263
160
 
264
161
  ## [5.4.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.4.1...@pie-lib/charting@5.4.2) (2022-12-06)
265
162
 
266
-
267
163
  ### Bug Fixes
268
164
 
269
- * **charting:** add sanity check for correctResponse data ([9f6ccd3](https://github.com/pie-framework/pie-lib/commit/9f6ccd39e8bae29c0a3efe6f5149942a0577c5d7))
270
-
271
-
272
-
273
-
165
+ - **charting:** add sanity check for correctResponse data ([9f6ccd3](https://github.com/pie-framework/pie-lib/commit/9f6ccd39e8bae29c0a3efe6f5149942a0577c5d7))
274
166
 
275
167
  ## [5.4.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.4.0...@pie-lib/charting@5.4.1) (2022-11-23)
276
168
 
277
169
  **Note:** Version bump only for package @pie-lib/charting
278
170
 
279
-
280
-
281
-
282
-
283
171
  # [5.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.3.1...@pie-lib/charting@5.4.0) (2022-11-14)
284
172
 
285
-
286
173
  ### Features
287
174
 
288
- * **charting:** add error message for empty category labels and non unique category labels ([8daa572](https://github.com/pie-framework/pie-lib/commit/8daa572b3f04b8b097f937cfb28ba527b6ea51f1))
289
- * **charting:** rename chart types ([01bbcaa](https://github.com/pie-framework/pie-lib/commit/01bbcaad7702c2a2ddcc3c225a76ca94cfeea702))
290
- * **charting:** rename chart types ([316389b](https://github.com/pie-framework/pie-lib/commit/316389b5315de50518aa39d0de3dbee23cc9f53c))
291
- * **charting:** validation for category labels ([9f190fa](https://github.com/pie-framework/pie-lib/commit/9f190fa3626135f14e28bd7ac3517939af1aaf7a))
292
-
293
-
294
-
295
-
175
+ - **charting:** add error message for empty category labels and non unique category labels ([8daa572](https://github.com/pie-framework/pie-lib/commit/8daa572b3f04b8b097f937cfb28ba527b6ea51f1))
176
+ - **charting:** rename chart types ([01bbcaa](https://github.com/pie-framework/pie-lib/commit/01bbcaad7702c2a2ddcc3c225a76ca94cfeea702))
177
+ - **charting:** rename chart types ([316389b](https://github.com/pie-framework/pie-lib/commit/316389b5315de50518aa39d0de3dbee23cc9f53c))
178
+ - **charting:** validation for category labels ([9f190fa](https://github.com/pie-framework/pie-lib/commit/9f190fa3626135f14e28bd7ac3517939af1aaf7a))
296
179
 
297
180
  ## [5.3.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.3.0...@pie-lib/charting@5.3.1) (2022-10-31)
298
181
 
299
-
300
182
  ### Bug Fixes
301
183
 
302
- * **charting:** add sanity checks for range and domain ([b30ea68](https://github.com/pie-framework/pie-lib/commit/b30ea68c586115c0a081d8d974f508bd9c11be2f))
303
-
304
-
305
-
306
-
184
+ - **charting:** add sanity checks for range and domain ([b30ea68](https://github.com/pie-framework/pie-lib/commit/b30ea68c586115c0a081d8d974f508bd9c11be2f))
307
185
 
308
186
  # [5.3.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.2.1...@pie-lib/charting@5.3.0) (2022-10-17)
309
187
 
310
-
311
188
  ### Features
312
189
 
313
- * **charting:** check configuration when changing chartType ([e3a0222](https://github.com/pie-framework/pie-lib/commit/e3a0222d4d2a2b2854d85f90114b1efffa2bc453))
314
-
315
-
316
-
317
-
190
+ - **charting:** check configuration when changing chartType ([e3a0222](https://github.com/pie-framework/pie-lib/commit/e3a0222d4d2a2b2854d85f90114b1efffa2bc453))
318
191
 
319
192
  ## [5.2.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.2.0...@pie-lib/charting@5.2.1) (2022-09-29)
320
193
 
321
-
322
194
  ### Bug Fixes
323
195
 
324
- * **charting:** fix left label position for define correct response and player chart ([4a50663](https://github.com/pie-framework/pie-lib/commit/4a5066351901cbe400180b1d19d9a54781eb726e))
325
- * **charting:** make space for delete category buttons in define correct response and in player ([7c0f653](https://github.com/pie-framework/pie-lib/commit/7c0f6536f106099da9a9ab5a7328fed827841c5c))
326
-
327
-
328
-
329
-
196
+ - **charting:** fix left label position for define correct response and player chart ([4a50663](https://github.com/pie-framework/pie-lib/commit/4a5066351901cbe400180b1d19d9a54781eb726e))
197
+ - **charting:** make space for delete category buttons in define correct response and in player ([7c0f653](https://github.com/pie-framework/pie-lib/commit/7c0f6536f106099da9a9ab5a7328fed827841c5c))
330
198
 
331
199
  # [5.2.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.8...@pie-lib/charting@5.2.0) (2022-09-28)
332
200
 
333
-
334
201
  ### Bug Fixes
335
202
 
336
- * **charting:** arrange the position of the checkboxes labels, fix style amd arrangement ([c5f2f7a](https://github.com/pie-framework/pie-lib/commit/c5f2f7acf60898e77ecc0b47b190256537605c8e))
337
- * **charting:** change position for checbox labels in order to fit without overlapping the checboxes ([98a56cb](https://github.com/pie-framework/pie-lib/commit/98a56cbae47c4bcadd0d4087d6b7df3c4d5d3e2e))
338
- * **charting:** fix conflicts ([2b3da1b](https://github.com/pie-framework/pie-lib/commit/2b3da1b4b87a518b5c18daf6f6c57db1ccc1c536))
339
- * **charting:** increase height for category draggable zone ([922e107](https://github.com/pie-framework/pie-lib/commit/922e107101981358647937c12133fef6b78a6ea9))
340
-
203
+ - **charting:** arrange the position of the checkboxes labels, fix style amd arrangement ([c5f2f7a](https://github.com/pie-framework/pie-lib/commit/c5f2f7acf60898e77ecc0b47b190256537605c8e))
204
+ - **charting:** change position for checbox labels in order to fit without overlapping the checboxes ([98a56cb](https://github.com/pie-framework/pie-lib/commit/98a56cbae47c4bcadd0d4087d6b7df3c4d5d3e2e))
205
+ - **charting:** fix conflicts ([2b3da1b](https://github.com/pie-framework/pie-lib/commit/2b3da1b4b87a518b5c18daf6f6c57db1ccc1c536))
206
+ - **charting:** increase height for category draggable zone ([922e107](https://github.com/pie-framework/pie-lib/commit/922e107101981358647937c12133fef6b78a6ea9))
341
207
 
342
208
  ### Features
343
209
 
344
- * **charting:** refactor ability to edit chart title and labels, fix style ([6edcdfb](https://github.com/pie-framework/pie-lib/commit/6edcdfbfbd83806a8487c29c42ae447b11850ac7))
345
- * **charting:** try to set up labels for charting, work in progress ([c6cd049](https://github.com/pie-framework/pie-lib/commit/c6cd049723dadab329748511da2f6c4f1fa943db))
346
- * **graphing, plot:** moved graphing labels to plot package + fixed math input + added support for labels rotation PD-1962 ([a85ec39](https://github.com/pie-framework/pie-lib/commit/a85ec3911dd1f6bc89e4eb20a19ef8f957deebf1))
347
-
348
-
349
-
350
-
210
+ - **charting:** refactor ability to edit chart title and labels, fix style ([6edcdfb](https://github.com/pie-framework/pie-lib/commit/6edcdfbfbd83806a8487c29c42ae447b11850ac7))
211
+ - **charting:** try to set up labels for charting, work in progress ([c6cd049](https://github.com/pie-framework/pie-lib/commit/c6cd049723dadab329748511da2f6c4f1fa943db))
212
+ - **graphing, plot:** moved graphing labels to plot package + fixed math input + added support for labels rotation PD-1962 ([a85ec39](https://github.com/pie-framework/pie-lib/commit/a85ec3911dd1f6bc89e4eb20a19ef8f957deebf1))
351
213
 
352
214
  ## [5.1.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.7...@pie-lib/charting@5.1.8) (2022-09-12)
353
215
 
354
216
  **Note:** Version bump only for package @pie-lib/charting
355
217
 
356
-
357
-
358
-
359
-
360
218
  ## [5.1.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.6...@pie-lib/charting@5.1.7) (2022-08-30)
361
219
 
362
-
363
220
  ### Bug Fixes
364
221
 
365
- * **plot, charting, graphing:** adjusted side pixel guides, fixed graphing rendering issue, adjusted charting dimensions PD-1963 ([5043231](https://github.com/pie-framework/pie-lib/commit/5043231ba73a0aa475115fb5fe9af29e0e67a4b6))
366
-
367
-
368
-
369
-
222
+ - **plot, charting, graphing:** adjusted side pixel guides, fixed graphing rendering issue, adjusted charting dimensions PD-1963 ([5043231](https://github.com/pie-framework/pie-lib/commit/5043231ba73a0aa475115fb5fe9af29e0e67a4b6))
370
223
 
371
224
  ## [5.1.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.5...@pie-lib/charting@5.1.6) (2022-08-29)
372
225
 
373
-
374
226
  ### Bug Fixes
375
227
 
376
- * **charting:** override grey background in IBX for chart disabled labels ([be882d4](https://github.com/pie-framework/pie-lib/commit/be882d40b7ebf88531bfb546252221673fa74dab))
377
- * do not change range on cancel ([1a7c990](https://github.com/pie-framework/pie-lib/commit/1a7c990a0ddf5d0b8c05aa68d6af324dd386b7d3))
378
-
379
-
380
-
381
-
228
+ - **charting:** override grey background in IBX for chart disabled labels ([be882d4](https://github.com/pie-framework/pie-lib/commit/be882d40b7ebf88531bfb546252221673fa74dab))
229
+ - do not change range on cancel ([1a7c990](https://github.com/pie-framework/pie-lib/commit/1a7c990a0ddf5d0b8c05aa68d6af324dd386b7d3))
382
230
 
383
231
  ## [5.1.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.4...@pie-lib/charting@5.1.5) (2022-08-15)
384
232
 
385
233
  **Note:** Version bump only for package @pie-lib/charting
386
234
 
387
-
388
-
389
-
390
-
391
235
  ## [5.1.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.3...@pie-lib/charting@5.1.4) (2022-08-01)
392
236
 
393
237
  **Note:** Version bump only for package @pie-lib/charting
394
238
 
395
-
396
-
397
-
398
-
399
239
  ## [5.1.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.2...@pie-lib/charting@5.1.3) (2022-08-01)
400
240
 
401
241
  **Note:** Version bump only for package @pie-lib/charting
402
242
 
403
-
404
-
405
-
406
-
407
243
  ## [5.1.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.1...@pie-lib/charting@5.1.2) (2022-07-12)
408
244
 
409
245
  **Note:** Version bump only for package @pie-lib/charting
410
246
 
411
-
412
-
413
-
414
-
415
247
  ## [5.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.0...@pie-lib/charting@5.1.1) (2022-07-12)
416
248
 
417
249
  **Note:** Version bump only for package @pie-lib/charting
418
250
 
419
-
420
-
421
-
422
-
423
251
  # [5.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.0.0...@pie-lib/charting@5.1.0) (2022-06-27)
424
252
 
425
-
426
253
  ### Features
427
254
 
428
- * **charting:** add constraints on max value for charting setup panel ([595c301](https://github.com/pie-framework/pie-lib/commit/595c301c6b10caf1921aa25f38897729c56ed47c))
429
-
430
-
431
-
432
-
255
+ - **charting:** add constraints on max value for charting setup panel ([595c301](https://github.com/pie-framework/pie-lib/commit/595c301c6b10caf1921aa25f38897729c56ed47c))
433
256
 
434
257
  # [5.0.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.18...@pie-lib/charting@5.0.0) (2022-06-13)
435
258
 
436
-
437
259
  ### Bug Fixes
438
260
 
439
- * updated shapshot ([4f4975d](https://github.com/pie-framework/pie-lib/commit/4f4975d9abd2c52365f7081e280d860149e7edd0))
440
-
261
+ - updated shapshot ([4f4975d](https://github.com/pie-framework/pie-lib/commit/4f4975d9abd2c52365f7081e280d860149e7edd0))
441
262
 
442
263
  ### Features
443
264
 
444
- * **charting:** remove editCategoryEnabled property checkbox and usage ([3181fc0](https://github.com/pie-framework/pie-lib/commit/3181fc02ea83e408af5d930d5e10a85a2ded3dd4))
445
- * **charting:** remove editCategoryEnabled property checkbox and usage ([b72de39](https://github.com/pie-framework/pie-lib/commit/b72de39525c0f9c0439204e65b2a7d330bb9061d))
446
-
265
+ - **charting:** remove editCategoryEnabled property checkbox and usage ([3181fc0](https://github.com/pie-framework/pie-lib/commit/3181fc02ea83e408af5d930d5e10a85a2ded3dd4))
266
+ - **charting:** remove editCategoryEnabled property checkbox and usage ([b72de39](https://github.com/pie-framework/pie-lib/commit/b72de39525c0f9c0439204e65b2a7d330bb9061d))
447
267
 
448
268
  ### BREAKING CHANGES
449
269
 
450
- * **charting:** The editCategoryEnabled checkbox and property was removed.
451
- Enabeled property will be used for each category.
452
- * **charting:** The editCategoryEnabled propery has been removed
453
-
454
-
455
-
456
-
270
+ - **charting:** The editCategoryEnabled checkbox and property was removed.
271
+ Enabeled property will be used for each category.
272
+ - **charting:** The editCategoryEnabled propery has been removed
457
273
 
458
274
  ## [4.5.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.17...@pie-lib/charting@4.5.18) (2022-06-13)
459
275
 
460
-
461
276
  ### Bug Fixes
462
277
 
463
- * revert possible breaking changes ([75acdf4](https://github.com/pie-framework/pie-lib/commit/75acdf4eb571694fc2069e7f7088ac25a7b3aceb))
464
-
465
-
466
-
467
-
278
+ - revert possible breaking changes ([75acdf4](https://github.com/pie-framework/pie-lib/commit/75acdf4eb571694fc2069e7f7088ac25a7b3aceb))
468
279
 
469
280
  ## [4.5.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.16...@pie-lib/charting@4.5.17) (2022-06-13)
470
281
 
471
282
  **Note:** Version bump only for package @pie-lib/charting
472
283
 
473
-
474
-
475
-
476
-
477
284
  ## [4.5.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.15...@pie-lib/charting@4.5.16) (2022-05-30)
478
285
 
479
-
480
286
  ### Bug Fixes
481
287
 
482
- * unable to load items locally ([17ab686](https://github.com/pie-framework/pie-lib/commit/17ab6864557288aef6ec1d9a130cb508e2591562))
483
-
484
-
485
-
486
-
288
+ - unable to load items locally ([17ab686](https://github.com/pie-framework/pie-lib/commit/17ab6864557288aef6ec1d9a130cb508e2591562))
487
289
 
488
290
  ## [4.5.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.14...@pie-lib/charting@4.5.15) (2022-05-10)
489
291
 
490
292
  **Note:** Version bump only for package @pie-lib/charting
491
293
 
492
-
493
-
494
-
495
-
496
294
  ## [4.5.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.13...@pie-lib/charting@4.5.14) (2022-03-21)
497
295
 
498
-
499
296
  ### Bug Fixes
500
297
 
501
- * **charting:** Added custom modulo function to work with decimals PD-1645 ([70951ef](https://github.com/pie-framework/pie-lib/commit/70951ef055630f217094a42ec2d15282cf680c6b))
502
-
503
-
504
-
505
-
298
+ - **charting:** Added custom modulo function to work with decimals PD-1645 ([70951ef](https://github.com/pie-framework/pie-lib/commit/70951ef055630f217094a42ec2d15282cf680c6b))
506
299
 
507
300
  ## [4.5.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.12...@pie-lib/charting@4.5.13) (2021-09-10)
508
301
 
509
-
510
302
  ### Bug Fixes
511
303
 
512
- * **charting:** Displayed the entire rightmost category label when space available PD-531 ([4c96415](https://github.com/pie-framework/pie-lib/commit/4c96415))
513
-
514
-
515
-
516
-
304
+ - **charting:** Displayed the entire rightmost category label when space available PD-531 ([4c96415](https://github.com/pie-framework/pie-lib/commit/4c96415))
517
305
 
518
306
  ## [4.5.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.11...@pie-lib/charting@4.5.12) (2021-09-08)
519
307
 
520
308
  **Note:** Version bump only for package @pie-lib/charting
521
309
 
522
-
523
-
524
-
525
-
526
310
  ## [4.5.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.10...@pie-lib/charting@4.5.11) (2021-09-08)
527
311
 
528
-
529
312
  ### Bug Fixes
530
313
 
531
- * **charting:** calculate step and labelStep if they are not defined or if tickLabels are crowded PD-1016 ([d215ea0](https://github.com/pie-framework/pie-lib/commit/d215ea0))
532
- * **charting:** Updated label font size ([d7905e0](https://github.com/pie-framework/pie-lib/commit/d7905e0))
533
-
534
-
535
-
536
-
314
+ - **charting:** calculate step and labelStep if they are not defined or if tickLabels are crowded PD-1016 ([d215ea0](https://github.com/pie-framework/pie-lib/commit/d215ea0))
315
+ - **charting:** Updated label font size ([d7905e0](https://github.com/pie-framework/pie-lib/commit/d7905e0))
537
316
 
538
317
  ## [4.5.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.8...@pie-lib/charting@4.5.10) (2021-06-25)
539
318
 
package/lib/chart.js CHANGED
@@ -53,6 +53,8 @@ var _chartTypes = _interopRequireDefault(require("./chart-types"));
53
53
 
54
54
  var _configUi = require("@pie-lib/config-ui");
55
55
 
56
+ var _translator = _interopRequireDefault(require("@pie-lib/translator"));
57
+
56
58
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
59
 
58
60
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -61,6 +63,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
61
63
 
62
64
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
63
65
 
66
+ var translator = _translator["default"].translator;
64
67
  var log = (0, _debug["default"])('pie-lib:charts:chart');
65
68
 
66
69
  var Chart = /*#__PURE__*/function (_React$Component) {
@@ -126,14 +129,20 @@ var Chart = /*#__PURE__*/function (_React$Component) {
126
129
  data = _this$props2.data,
127
130
  categoryDefaultLabel = _this$props2.categoryDefaultLabel,
128
131
  defineChart = _this$props2.defineChart,
129
- categoryDefaults = _this$props2.categoryDefaults;
132
+ categoryDefaults = _this$props2.categoryDefaults,
133
+ language = _this$props2.language;
130
134
 
131
135
  if (!defineChart && data.length > 19) {
132
136
  _this.setState({
133
137
  dialog: {
134
138
  open: true,
135
- title: 'Warning',
136
- text: "There can't be more than 20 categories.",
139
+ title: translator.t('common:warning', {
140
+ lng: language
141
+ }),
142
+ text: translator.t('charting.reachedLimit_other', {
143
+ count: 20,
144
+ lng: language
145
+ }),
137
146
  onConfirm: function onConfirm() {
138
147
  return _this.handleAlertDialog(false);
139
148
  }
@@ -143,7 +152,9 @@ var Chart = /*#__PURE__*/function (_React$Component) {
143
152
  onDataChange([].concat((0, _toConsumableArray2["default"])(data), [{
144
153
  inDefineChart: defineChart,
145
154
  autoFocus: true,
146
- label: categoryDefaultLabel || 'New Bar',
155
+ label: categoryDefaultLabel || translator.t('charting.newLabel', {
156
+ lng: language
157
+ }),
147
158
  value: 0,
148
159
  deletable: true,
149
160
  editable: categoryDefaults ? categoryDefaults === null || categoryDefaults === void 0 ? void 0 : categoryDefaults.editable : true,
@@ -200,7 +211,8 @@ var Chart = /*#__PURE__*/function (_React$Component) {
200
211
  showPixelGuides = _this$props4.showPixelGuides,
201
212
  error = _this$props4.error,
202
213
  _this$props4$mathMlOp = _this$props4.mathMlOptions,
203
- mathMlOptions = _this$props4$mathMlOp === void 0 ? {} : _this$props4$mathMlOp;
214
+ mathMlOptions = _this$props4$mathMlOp === void 0 ? {} : _this$props4$mathMlOp,
215
+ language = _this$props4.language;
204
216
  var chartType = this.props.chartType;
205
217
  var dialog = this.state.dialog;
206
218
  var defineChart = this.props.defineChart || false;
@@ -262,7 +274,8 @@ var Chart = /*#__PURE__*/function (_React$Component) {
262
274
  disabled: !addCategoryEnabled,
263
275
  addCategory: function addCategory() {
264
276
  return _this2.addCategory();
265
- }
277
+ },
278
+ language: language
266
279
  })), /*#__PURE__*/_react["default"].createElement(_plot.Root, (0, _extends2["default"])({
267
280
  title: title,
268
281
  onChangeTitle: onChangeTitle,
@@ -364,7 +377,8 @@ exports.Chart = Chart;
364
377
  theme: _propTypes["default"].object,
365
378
  chartingOptions: _propTypes["default"].object,
366
379
  changeInteractiveEnabled: _propTypes["default"].bool,
367
- changeEditableEnabled: _propTypes["default"].bool
380
+ changeEditableEnabled: _propTypes["default"].bool,
381
+ language: _propTypes["default"].string
368
382
  });
369
383
  (0, _defineProperty2["default"])(Chart, "defaultProps", {
370
384
  size: {
package/lib/chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chart.jsx"],"names":["log","Chart","props","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","open","callback","setState","dialog","state","chartType","ChartComponent","chart","find","type","Component","data","onDataChange","index","newCategory","integerIndex","parseInt","categoryDefaultLabel","defineChart","categoryDefaults","length","title","text","onConfirm","handleAlertDialog","inDefineChart","autoFocus","label","value","deletable","editable","interactive","map","d","maskUid","generateMaskId","Math","random","toFixed","classes","className","domain","range","chartingOptions","size","onChangeTitle","onChangeLabels","labelsPlaceholders","titlePlaceholder","addCategoryEnabled","changeInteractiveEnabled","changeEditableEnabled","showPixelGuides","error","mathMlOptions","width","height","labels","left","bottom","getChart","categories","getFilteredCategories","correctValues","verticalLines","horizontalLines","leftAxis","common","graphProps","rootNode","maskSize","x","y","scale","xBand","bandWidth","bandwidth","barWidth","max","increaseHeight","top","rootCommon","chartBox","controls","toolMenu","addCategory","r","changeData","changeCategory","onClose","React","PropTypes","object","isRequired","string","shape","number","min","axisLabel","arrayOf","step","labelStep","array","func","any","bool","theme","styles","graphBox","transform","display","justifyContent","padding","spacing","unit","backgroundColor","color","primaryLight","borderTop","primaryDark","borderBottom","borderLeft","borderRight","svg","overflow","minHeight","withTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,sBAAN,CAAZ;;IAEaC,K;;;;;AACX,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,8FA2DX;AACNC,MAAAA,MAAM,EAAE,CACNC,uBAAWC,GAAX,EADM,EAEND,uBAAWE,SAAX,EAFM,EAGNF,uBAAWG,OAAX,EAHM,EAINH,uBAAWI,SAAX,EAJM,EAKNJ,uBAAWK,OAAX,EALM,EAMNL,uBAAWM,QAAX,EANM;AADF,KA3DW;AAAA,0GA0EC,UAACC,IAAD,EAAOC,QAAP;AAAA,aAClB,MAAKC,QAAL,CACE;AACEC,QAAAA,MAAM,EAAE;AAAEH,UAAAA,IAAI,EAAJA;AAAF;AADV,OADF,EAIEC,QAJF,CADkB;AAAA,KA1ED;AAAA,iGAkFR,YAAM;AACf,UAAMT,MAAM,G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B,IAAMmD,MAAM,GAAG,SAATA,MAAS,CAACD,KAAD;AAAA,SAAY;AACzBE,IAAAA,QAAQ,EAAE;AACRC,MAAAA,SAAS,EAAE;AADH,KADe;AAIzB1B,IAAAA,QAAQ,EAAE;AACR2B,MAAAA,OAAO,EAAE,MADD;AAERC,MAAAA,cAAc,EAAE,eAFR;AAGRC,MAAAA,OAAO,EAAEN,KAAK,CAACO,OAAN,CAAcC,IAHf;AAIRC,MAAAA,eAAe,EAAEC,gBAAMC,YAAN,EAJT;AAKRC,MAAAA,SAAS,sBAAeF,gBAAMG,WAAN,EAAf,CALD;AAMRC,MAAAA,YAAY,sBAAeJ,gBAAMG,WAAN,EAAf,CANJ;AAORE,MAAAA,UAAU,sBAAeL,gBAAMG,WAAN,EAAf,CAPF;AAQRG,MAAAA,WAAW,sBAAeN,gBAAMG,WAAN,EAAf;AARH,KAJe;AAczBI,IAAAA,GAAG,EAAE;AACHC,MAAAA,QAAQ,EAAE;AADP,KAdoB;AAiBzBxC,IAAAA,QAAQ,EAAE;AACRyC,MAAAA,SAAS,EAAE;AADH,KAjBe;AAoBzB3C,IAAAA,QAAQ,EAAE;AACR3B,MAAAA,KAAK,EAAE;AADC;AApBe,GAAZ;AAAA,CAAf;;eAyBe,wBAAWoD,MAAX,EAAmB;AAAEmB,EAAAA,SAAS,EAAE;AAAb,CAAnB,EAAwCxI,KAAxC,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { Root, createGraphProps } from '@pie-lib/plot';\nimport cloneDeep from 'lodash/cloneDeep';\nimport ChartGrid from './grid';\nimport ChartAxes from './axes';\nimport debug from 'debug';\nimport { color } from '@pie-lib/render-ui';\nimport { dataToXBand, getDomainAndRangeByChartType, getGridLinesAndAxisByChartType, getTopPadding } from './utils';\nimport ToolMenu from './tool-menu';\nimport chartTypes from './chart-types';\nimport { AlertDialog } from '@pie-lib/config-ui';\n\nconst log = debug('pie-lib:charts:chart');\n\nexport class Chart extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n dialog: {\n open: false,\n },\n };\n this.maskUid = this.generateMaskId();\n }\n\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n chartType: PropTypes.string.isRequired,\n size: PropTypes.shape({\n width: PropTypes.number,\n height: PropTypes.number,\n }),\n domain: PropTypes.shape({\n label: PropTypes.string,\n min: PropTypes.number,\n max: PropTypes.number,\n axisLabel: PropTypes.string,\n }),\n data: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string, value: PropTypes.number })),\n range: PropTypes.shape({\n label: PropTypes.string,\n min: PropTypes.number,\n max: PropTypes.number,\n step: PropTypes.number,\n labelStep: PropTypes.number,\n axisLabel: PropTypes.string,\n }),\n charts: PropTypes.array,\n labelsPlaceholders: PropTypes.object,\n title: PropTypes.string,\n titlePlaceholder: PropTypes.string,\n onDataChange: PropTypes.func,\n onChangeLabels: PropTypes.func,\n onChangeTitle: PropTypes.func,\n error: PropTypes.any,\n addCategoryEnabled: PropTypes.bool,\n showPixelGuides: PropTypes.bool,\n categoryDefaultLabel: PropTypes.string,\n categoryDefaults: PropTypes.object,\n defineChart: PropTypes.bool,\n theme: PropTypes.object,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n };\n\n static defaultProps = {\n size: {\n width: 480,\n height: 480,\n },\n };\n\n state = {\n charts: [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ],\n };\n\n generateMaskId() {\n return 'chart-' + (Math.random() * 10000).toFixed();\n }\n\n handleAlertDialog = (open, callback) =>\n this.setState(\n {\n dialog: { open },\n },\n callback,\n );\n\n getChart = () => {\n const charts = this.props.charts || this.state.charts;\n let { chartType } = this.props;\n let ChartComponent = null;\n let chart = null;\n\n if (chartType) {\n chart = charts && charts.find((chart) => chart.type === chartType);\n ChartComponent = chart && chart.Component;\n } else {\n chart = charts && charts[0];\n ChartComponent = chart && chart.Component;\n chartType = chart && chart.type;\n }\n\n return {\n type: chartType,\n ChartComponent,\n };\n };\n\n changeData = (data) => {\n const { onDataChange } = this.props;\n\n onDataChange(data);\n };\n\n changeCategory = (index, newCategory) => {\n const integerIndex = parseInt(index, 10);\n\n if (integerIndex >= 0) {\n const { data, onDataChange } = this.props;\n data[integerIndex] = {\n ...data[integerIndex],\n ...newCategory,\n };\n\n onDataChange(data);\n }\n };\n\n addCategory = () => {\n const { onDataChange, data, categoryDefaultLabel, defineChart, categoryDefaults } = this.props;\n\n if (!defineChart && data.length > 19) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: \"There can't be more than 20 categories.\",\n onConfirm: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onDataChange([\n ...data,\n {\n inDefineChart: defineChart,\n autoFocus: true,\n label: categoryDefaultLabel || 'New Bar',\n value: 0,\n deletable: true,\n editable: categoryDefaults ? categoryDefaults?.editable : true,\n interactive: categoryDefaults ? categoryDefaults?.interactive : true,\n },\n ]);\n }\n };\n\n getFilteredCategories = () => {\n const { data, defineChart } = this.props;\n\n return data\n ? data.map((d) => ({\n ...d,\n deletable: defineChart || d.deletable,\n }))\n : [];\n };\n\n render() {\n const {\n classes,\n className,\n domain = {},\n range = {},\n chartingOptions,\n size,\n title,\n onChangeTitle,\n onChangeLabels,\n labelsPlaceholders,\n titlePlaceholder,\n addCategoryEnabled,\n changeInteractiveEnabled,\n changeEditableEnabled,\n showPixelGuides,\n error,\n mathMlOptions = {}\n } = this.props;\n let { chartType } = this.props;\n\n const { dialog } = this.state;\n const defineChart = this.props.defineChart || false;\n\n const { width, height } = size || {};\n const labels = { left: range?.label || '', bottom: domain?.label || '' };\n\n const { ChartComponent } = this.getChart();\n const categories = this.getFilteredCategories();\n\n const correctValues = getDomainAndRangeByChartType(domain, range, chartType);\n\n const { verticalLines, horizontalLines, leftAxis } = getGridLinesAndAxisByChartType(correctValues.range, chartType);\n const common = {\n graphProps: createGraphProps(correctValues.domain, correctValues.range, size, () => this.rootNode),\n };\n\n log('[render] common:', common);\n\n const maskSize = { x: -10, y: -10, width: width + 20, height: height + 80 };\n const { scale } = common.graphProps;\n const xBand = dataToXBand(scale.x, categories, width, chartType);\n\n if (!ChartComponent) {\n return null;\n }\n\n const bandWidth = xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || scale.x(correctValues.domain.max) / categories.length;\n const increaseHeight = defineChart ? 160 : 60;\n\n // if there are many categories, we have to rotate their names in order to fit\n // and we have to add extra value on top of some items\n const top = getTopPadding(barWidth);\n const rootCommon = cloneDeep(common);\n rootCommon.graphProps.size.height += top + increaseHeight;\n\n return (\n <div className={classNames(classes.chart, classes.chartBox, className)}>\n <div className={classes.controls}>\n <ToolMenu\n className={classes.toolMenu}\n disabled={!addCategoryEnabled}\n addCategory={() => this.addCategory()}\n />\n </div>\n\n <Root\n title={title}\n onChangeTitle={onChangeTitle}\n disabledTitle={!defineChart}\n showTitle={true}\n showLabels={true}\n labels={labels}\n onChangeLabels={onChangeLabels}\n labelsPlaceholders={labelsPlaceholders}\n titlePlaceholder={titlePlaceholder}\n defineChart={defineChart}\n disabledLabels={!defineChart}\n isChart={true}\n showPixelGuides={showPixelGuides}\n rootRef={(r) => (this.rootNode = r)}\n mathMlOptions={mathMlOptions}\n {...rootCommon}\n >\n <ChartGrid {...common} xBand={xBand} rowTickValues={horizontalLines} columnTickValues={verticalLines} />\n <ChartAxes\n {...common}\n defineChart={defineChart}\n categories={categories}\n xBand={xBand}\n leftAxis={leftAxis}\n onChange={this.changeData}\n onChangeCategory={this.changeCategory}\n chartingOptions={chartingOptions}\n changeInteractiveEnabled={changeInteractiveEnabled}\n changeEditableEnabled={changeEditableEnabled}\n top={top}\n error={error}\n />\n <mask id={`${this.maskUid}`}>\n <rect {...maskSize} fill=\"white\" />\n </mask>\n <g id=\"marks\" mask={`url('#${this.maskUid}')`}>\n <ChartComponent\n {...common}\n data={categories}\n defineChart={defineChart}\n onChange={this.changeData}\n onChangeCategory={this.changeCategory}\n />\n </g>\n </Root>\n <AlertDialog\n open={dialog.open}\n title={dialog.title}\n text={dialog.text}\n onClose={dialog.onClose}\n onConfirm={dialog.onConfirm}\n />\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n graphBox: {\n transform: 'translate(60px, 35px)',\n },\n controls: {\n display: 'flex',\n justifyContent: 'space-between',\n padding: theme.spacing.unit,\n backgroundColor: color.primaryLight(),\n borderTop: `solid 1px ${color.primaryDark()}`,\n borderBottom: `solid 0px ${color.primaryDark()}`,\n borderLeft: `solid 1px ${color.primaryDark()}`,\n borderRight: `solid 1px ${color.primaryDark()}`,\n },\n svg: {\n overflow: 'visible',\n },\n toolMenu: {\n minHeight: '36px',\n },\n chartBox: {\n width: 'min-content',\n },\n});\n\nexport default withStyles(styles, { withTheme: true })(Chart);\n"],"file":"chart.js"}
1
+ {"version":3,"sources":["../src/chart.jsx"],"names":["translator","Translator","log","Chart","props","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","open","callback","setState","dialog","state","chartType","ChartComponent","chart","find","type","Component","data","onDataChange","index","newCategory","integerIndex","parseInt","categoryDefaultLabel","defineChart","categoryDefaults","language","length","title","t","lng","text","count","onConfirm","handleAlertDialog","inDefineChart","autoFocus","label","value","deletable","editable","interactive","map","d","maskUid","generateMaskId","Math","random","toFixed","classes","className","domain","range","chartingOptions","size","onChangeTitle","onChangeLabels","labelsPlaceholders","titlePlaceholder","addCategoryEnabled","changeInteractiveEnabled","changeEditableEnabled","showPixelGuides","error","mathMlOptions","width","height","labels","left","bottom","getChart","categories","getFilteredCategories","correctValues","verticalLines","horizontalLines","leftAxis","common","graphProps","rootNode","maskSize","x","y","scale","xBand","bandWidth","bandwidth","barWidth","max","increaseHeight","top","rootCommon","chartBox","controls","toolMenu","addCategory","r","changeData","changeCategory","onClose","React","PropTypes","object","isRequired","string","shape","number","min","axisLabel","arrayOf","step","labelStep","array","func","any","bool","theme","styles","graphBox","transform","display","justifyContent","padding","spacing","unit","backgroundColor","color","primaryLight","borderTop","primaryDark","borderBottom","borderLeft","borderRight","svg","overflow","minHeight","withTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;AAEA,IAAME,GAAG,GAAG,uBAAM,sBAAN,CAAZ;;IAEaC,K;;;;;AACX,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,8FA4DX;AACNC,MAAAA,MAAM,EAAE,CACNC,uBAAWC,GAAX,EADM,EAEND,uBAAWE,SAAX,EAFM,EAGNF,uBAAWG,OAAX,EAHM,EAINH,uBAAWI,SAAX,EAJM,EAKNJ,uBAAWK,OAAX,EALM,EAMNL,uBAAWM,QAAX,EANM;AADF,KA5DW;AAAA,0GA2EC,UAACC,IAAD,EAAOC,QAAP;AAAA,aAClB,MAAKC,QAAL,CACE;AACEC,QAAAA,MAAM,EAAE;AAAEH,UAAAA,IAAI,EAAJA;AAAF;AADV,OADF,EAIEC,QAJF,CADkB;AAAA,KA3ED;AAAA,iGAmFR,YAAM;AACf,UAAMT,MAAM,GAAG,MAAKD,KAAL,CAAWC,MAAX,IAAqB,MAAKY,KAAL,CAAWZ,MAA/C;AACA,UAAMa,SAAN,GAAoB,MAAKd,KAAzB,CAAMc,SAAN;AACA,UAAIC,cAAc,GAAG,IAArB;AACA,UAAIC,KAAK,GAAG,IAAZ;;AAEA,UAAIF,SAAJ,EAAe;AACbE,QAAAA,KAAK,GAAGf,MAAM,IAAIA,MAAM,CAACgB,IAAP,CAAY,UAACD,KAAD;AAAA,iBAAWA,KAAK,CAACE,IAAN,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xCH,C;iCAXR5G,K,kBAsDW;AACpB0D,EAAAA,IAAI,EAAE;AACJW,IAAAA,KAAK,EAAE,GADH;AAEJC,IAAAA,MAAM,EAAE;AAFJ;AADc,C;;AA+OxB,IAAMmD,MAAM,GAAG,SAATA,MAAS,CAACD,KAAD;AAAA,SAAY;AACzBE,IAAAA,QAAQ,EAAE;AACRC,MAAAA,SAAS,EAAE;AADH,KADe;AAIzB1B,IAAAA,QAAQ,EAAE;AACR2B,MAAAA,OAAO,EAAE,MADD;AAERC,MAAAA,cAAc,EAAE,eAFR;AAGRC,MAAAA,OAAO,EAAEN,KAAK,CAACO,OAAN,CAAcC,IAHf;AAIRC,MAAAA,eAAe,EAAEC,gBAAMC,YAAN,EAJT;AAKRC,MAAAA,SAAS,sBAAeF,gBAAMG,WAAN,EAAf,CALD;AAMRC,MAAAA,YAAY,sBAAeJ,gBAAMG,WAAN,EAAf,CANJ;AAORE,MAAAA,UAAU,sBAAeL,gBAAMG,WAAN,EAAf,CAPF;AAQRG,MAAAA,WAAW,sBAAeN,gBAAMG,WAAN,EAAf;AARH,KAJe;AAczBI,IAAAA,GAAG,EAAE;AACHC,MAAAA,QAAQ,EAAE;AADP,KAdoB;AAiBzBxC,IAAAA,QAAQ,EAAE;AACRyC,MAAAA,SAAS,EAAE;AADH,KAjBe;AAoBzB3C,IAAAA,QAAQ,EAAE;AACR3B,MAAAA,KAAK,EAAE;AADC;AApBe,GAAZ;AAAA,CAAf;;eAyBe,wBAAWoD,MAAX,EAAmB;AAAEmB,EAAAA,SAAS,EAAE;AAAb,CAAnB,EAAwC5I,KAAxC,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { Root, createGraphProps } from '@pie-lib/plot';\nimport cloneDeep from 'lodash/cloneDeep';\nimport ChartGrid from './grid';\nimport ChartAxes from './axes';\nimport debug from 'debug';\nimport { color } from '@pie-lib/render-ui';\nimport { dataToXBand, getDomainAndRangeByChartType, getGridLinesAndAxisByChartType, getTopPadding } from './utils';\nimport ToolMenu from './tool-menu';\nimport chartTypes from './chart-types';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-lib:charts:chart');\n\nexport class Chart extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n dialog: {\n open: false,\n },\n };\n this.maskUid = this.generateMaskId();\n }\n\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n chartType: PropTypes.string.isRequired,\n size: PropTypes.shape({\n width: PropTypes.number,\n height: PropTypes.number,\n }),\n domain: PropTypes.shape({\n label: PropTypes.string,\n min: PropTypes.number,\n max: PropTypes.number,\n axisLabel: PropTypes.string,\n }),\n data: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string, value: PropTypes.number })),\n range: PropTypes.shape({\n label: PropTypes.string,\n min: PropTypes.number,\n max: PropTypes.number,\n step: PropTypes.number,\n labelStep: PropTypes.number,\n axisLabel: PropTypes.string,\n }),\n charts: PropTypes.array,\n labelsPlaceholders: PropTypes.object,\n title: PropTypes.string,\n titlePlaceholder: PropTypes.string,\n onDataChange: PropTypes.func,\n onChangeLabels: PropTypes.func,\n onChangeTitle: PropTypes.func,\n error: PropTypes.any,\n addCategoryEnabled: PropTypes.bool,\n showPixelGuides: PropTypes.bool,\n categoryDefaultLabel: PropTypes.string,\n categoryDefaults: PropTypes.object,\n defineChart: PropTypes.bool,\n theme: PropTypes.object,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n language: PropTypes.string,\n };\n\n static defaultProps = {\n size: {\n width: 480,\n height: 480,\n },\n };\n\n state = {\n charts: [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ],\n };\n\n generateMaskId() {\n return 'chart-' + (Math.random() * 10000).toFixed();\n }\n\n handleAlertDialog = (open, callback) =>\n this.setState(\n {\n dialog: { open },\n },\n callback,\n );\n\n getChart = () => {\n const charts = this.props.charts || this.state.charts;\n let { chartType } = this.props;\n let ChartComponent = null;\n let chart = null;\n\n if (chartType) {\n chart = charts && charts.find((chart) => chart.type === chartType);\n ChartComponent = chart && chart.Component;\n } else {\n chart = charts && charts[0];\n ChartComponent = chart && chart.Component;\n chartType = chart && chart.type;\n }\n\n return {\n type: chartType,\n ChartComponent,\n };\n };\n\n changeData = (data) => {\n const { onDataChange } = this.props;\n\n onDataChange(data);\n };\n\n changeCategory = (index, newCategory) => {\n const integerIndex = parseInt(index, 10);\n\n if (integerIndex >= 0) {\n const { data, onDataChange } = this.props;\n data[integerIndex] = {\n ...data[integerIndex],\n ...newCategory,\n };\n\n onDataChange(data);\n }\n };\n\n addCategory = () => {\n const { onDataChange, data, categoryDefaultLabel, defineChart, categoryDefaults, language } = this.props;\n\n if (!defineChart && data.length > 19) {\n this.setState({\n dialog: {\n open: true,\n title: translator.t('common:warning', { lng: language }),\n text: translator.t('charting.reachedLimit_other', { count: 20, lng: language }),\n onConfirm: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onDataChange([\n ...data,\n {\n inDefineChart: defineChart,\n autoFocus: true,\n label: categoryDefaultLabel || translator.t('charting.newLabel', { lng: language }),\n value: 0,\n deletable: true,\n editable: categoryDefaults ? categoryDefaults?.editable : true,\n interactive: categoryDefaults ? categoryDefaults?.interactive : true,\n },\n ]);\n }\n };\n\n getFilteredCategories = () => {\n const { data, defineChart } = this.props;\n\n return data\n ? data.map((d) => ({\n ...d,\n deletable: defineChart || d.deletable,\n }))\n : [];\n };\n\n render() {\n const {\n classes,\n className,\n domain = {},\n range = {},\n chartingOptions,\n size,\n title,\n onChangeTitle,\n onChangeLabels,\n labelsPlaceholders,\n titlePlaceholder,\n addCategoryEnabled,\n changeInteractiveEnabled,\n changeEditableEnabled,\n showPixelGuides,\n error,\n mathMlOptions = {},\n language,\n } = this.props;\n let { chartType } = this.props;\n\n const { dialog } = this.state;\n const defineChart = this.props.defineChart || false;\n\n const { width, height } = size || {};\n const labels = { left: range?.label || '', bottom: domain?.label || '' };\n\n const { ChartComponent } = this.getChart();\n const categories = this.getFilteredCategories();\n\n const correctValues = getDomainAndRangeByChartType(domain, range, chartType);\n\n const { verticalLines, horizontalLines, leftAxis } = getGridLinesAndAxisByChartType(correctValues.range, chartType);\n const common = {\n graphProps: createGraphProps(correctValues.domain, correctValues.range, size, () => this.rootNode),\n };\n\n log('[render] common:', common);\n\n const maskSize = { x: -10, y: -10, width: width + 20, height: height + 80 };\n const { scale } = common.graphProps;\n const xBand = dataToXBand(scale.x, categories, width, chartType);\n\n if (!ChartComponent) {\n return null;\n }\n\n const bandWidth = xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || scale.x(correctValues.domain.max) / categories.length;\n const increaseHeight = defineChart ? 160 : 60;\n\n // if there are many categories, we have to rotate their names in order to fit\n // and we have to add extra value on top of some items\n const top = getTopPadding(barWidth);\n const rootCommon = cloneDeep(common);\n rootCommon.graphProps.size.height += top + increaseHeight;\n\n return (\n <div className={classNames(classes.chart, classes.chartBox, className)}>\n <div className={classes.controls}>\n <ToolMenu\n className={classes.toolMenu}\n disabled={!addCategoryEnabled}\n addCategory={() => this.addCategory()}\n language={language}\n />\n </div>\n\n <Root\n title={title}\n onChangeTitle={onChangeTitle}\n disabledTitle={!defineChart}\n showTitle={true}\n showLabels={true}\n labels={labels}\n onChangeLabels={onChangeLabels}\n labelsPlaceholders={labelsPlaceholders}\n titlePlaceholder={titlePlaceholder}\n defineChart={defineChart}\n disabledLabels={!defineChart}\n isChart={true}\n showPixelGuides={showPixelGuides}\n rootRef={(r) => (this.rootNode = r)}\n mathMlOptions={mathMlOptions}\n {...rootCommon}\n >\n <ChartGrid {...common} xBand={xBand} rowTickValues={horizontalLines} columnTickValues={verticalLines} />\n <ChartAxes\n {...common}\n defineChart={defineChart}\n categories={categories}\n xBand={xBand}\n leftAxis={leftAxis}\n onChange={this.changeData}\n onChangeCategory={this.changeCategory}\n chartingOptions={chartingOptions}\n changeInteractiveEnabled={changeInteractiveEnabled}\n changeEditableEnabled={changeEditableEnabled}\n top={top}\n error={error}\n />\n <mask id={`${this.maskUid}`}>\n <rect {...maskSize} fill=\"white\" />\n </mask>\n <g id=\"marks\" mask={`url('#${this.maskUid}')`}>\n <ChartComponent\n {...common}\n data={categories}\n defineChart={defineChart}\n onChange={this.changeData}\n onChangeCategory={this.changeCategory}\n />\n </g>\n </Root>\n <AlertDialog\n open={dialog.open}\n title={dialog.title}\n text={dialog.text}\n onClose={dialog.onClose}\n onConfirm={dialog.onConfirm}\n />\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n graphBox: {\n transform: 'translate(60px, 35px)',\n },\n controls: {\n display: 'flex',\n justifyContent: 'space-between',\n padding: theme.spacing.unit,\n backgroundColor: color.primaryLight(),\n borderTop: `solid 1px ${color.primaryDark()}`,\n borderBottom: `solid 0px ${color.primaryDark()}`,\n borderLeft: `solid 1px ${color.primaryDark()}`,\n borderRight: `solid 1px ${color.primaryDark()}`,\n },\n svg: {\n overflow: 'visible',\n },\n toolMenu: {\n minHeight: '36px',\n },\n chartBox: {\n width: 'min-content',\n },\n});\n\nexport default withStyles(styles, { withTheme: true })(Chart);\n"],"file":"chart.js"}
package/lib/tool-menu.js CHANGED
@@ -31,10 +31,14 @@ var _styles = require("@material-ui/core/styles");
31
31
 
32
32
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
33
33
 
34
+ var _translator = _interopRequireDefault(require("@pie-lib/translator"));
35
+
34
36
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
35
37
 
36
38
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
39
 
40
+ var translator = _translator["default"].translator;
41
+
38
42
  var buttonStyles = function buttonStyles(theme) {
39
43
  return {
40
44
  root: {
@@ -114,11 +118,14 @@ var ToolMenu = /*#__PURE__*/function (_React$Component) {
114
118
  var _this$props = this.props,
115
119
  className = _this$props.className,
116
120
  disabled = _this$props.disabled,
117
- addCategory = _this$props.addCategory;
121
+ addCategory = _this$props.addCategory,
122
+ language = _this$props.language;
118
123
  return /*#__PURE__*/_react["default"].createElement("div", {
119
124
  className: (0, _classnames["default"])(className)
120
125
  }, !disabled && /*#__PURE__*/_react["default"].createElement(MiniButton, {
121
- value: 'Add Category',
126
+ value: translator.t('charting.addCategory', {
127
+ lng: language
128
+ }),
122
129
  onClick: addCategory
123
130
  }));
124
131
  }
@@ -130,7 +137,8 @@ exports.ToolMenu = ToolMenu;
130
137
  (0, _defineProperty2["default"])(ToolMenu, "propTypes", {
131
138
  className: _propTypes["default"].string,
132
139
  addCategory: _propTypes["default"].func,
133
- disabled: _propTypes["default"].bool
140
+ disabled: _propTypes["default"].bool,
141
+ language: _propTypes["default"].string
134
142
  });
135
143
  (0, _defineProperty2["default"])(ToolMenu, "defaultProps", {});
136
144
  var _default = ToolMenu;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tool-menu.jsx"],"names":["buttonStyles","theme","root","backgroundColor","color","background","text","border","secondary","secondaryLight","fontSize","typography","selected","primaryDark","notSelected","primary","disabled","MiniButton","props","classes","className","value","onClick","propTypes","PropTypes","bool","string","disabledClassName","func","ToolMenu","addCategory","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;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jBT,EAAAA,SAAS,EAAEI,sBAAUE,MADJ;AAEjBI,EAAAA,WAAW,EAAEN,sBAAUI,IAFN;AAGjBZ,EAAAA,QAAQ,EAAEQ,sBAAUC;AAHH,C;iCADRI,Q,kBAOW,E;eAaTA,Q","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport cn from 'classnames';\nimport Button from '@material-ui/core/Button';\n\nconst buttonStyles = (theme) => ({\n root: {\n backgroundColor: color.background(),\n color: color.text(),\n border: `1px solid ${color.secondary()}`,\n '&:hover': {\n backgroundColor: color.secondaryLight(),\n },\n fontSize: theme.typography.fontSize,\n },\n selected: {\n backgroundColor: color.background(),\n '& span': {\n color: color.primaryDark(),\n },\n },\n notSelected: {\n '& span': {\n color: color.primary(),\n },\n backgroundColor: color.background(),\n },\n disabled: {\n '& span': {\n color: color.primary(),\n },\n backgroundColor: color.disabled(),\n },\n});\n\nexport const MiniButton = withStyles(buttonStyles)((props) => {\n const { disabled, classes, className, selected, value, onClick } = props;\n return (\n <Button\n size=\"small\"\n disabled={disabled}\n color={selected ? 'secondary' : 'default'}\n className={cn(classes.root, selected && classes.selected, className)}\n classes={{ disabled: cn(disabled && classes.disabled) }}\n value={value}\n key={value}\n variant=\"outlined\"\n onClick={onClick}\n >\n {value}\n </Button>\n );\n});\nMiniButton.propTypes = {\n disabled: PropTypes.bool,\n className: PropTypes.string,\n disabledClassName: PropTypes.string,\n selected: PropTypes.bool,\n value: PropTypes.string,\n onClick: PropTypes.func,\n};\n\nexport class ToolMenu extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n addCategory: PropTypes.func,\n disabled: PropTypes.bool,\n };\n\n static defaultProps = {};\n\n render() {\n const { className, disabled, addCategory } = this.props;\n\n return (\n <div className={classNames(className)}>\n {!disabled && <MiniButton value={'Add Category'} onClick={addCategory} />}\n </div>\n );\n }\n}\n\nexport default ToolMenu;\n"],"file":"tool-menu.js"}
1
+ {"version":3,"sources":["../src/tool-menu.jsx"],"names":["translator","Translator","buttonStyles","theme","root","backgroundColor","color","background","text","border","secondary","secondaryLight","fontSize","typography","selected","primaryDark","notSelected","primary","disabled","MiniButton","props","classes","className","value","onClick","propTypes","PropTypes","bool","string","disabledClassName","func","ToolMenu","addCategory","language","t","lng","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;AAEA,IAAME,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD;AAAA,SAAY;AAC/BC,IAAAA,IAAI,EAAE;AACJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADb;AAEJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFH;AAGJC,MAAAA,MAAM,sBAAeH,gBAAMI,SAAN,EAAf,CAHF;AAIJ,iBAAW;AACTL,QAAAA,eAAe,EAAEC,gBAAMK,cAAN;AADR,OAJP;AAOJC,MAAAA,QAAQ,EAAET,KAAK,CAACU,UAAN,CAAiBD;AAPvB,KADyB;AAU/BE,IAAAA,QAAQ,EAAE;AACRT,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADT;AAER,gBAAU;AACRD,QAAAA,KAAK,EAAEA,gBAAMS,WAAN;AADC;AAFF,KAVqB;AAgB/BC,IAAAA,WAAW,EAAE;AACX,gBAAU;AACRV,QAAAA,KAAK,EAAEA,gBAAMW,OAAN;AADC,OADC;AAIXZ,MAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAJN,KAhBkB;AAsB/BW,IAAAA,QAAQ,EAAE;AACR,gBAAU;AACRZ,QAAAA,KAAK,EAAEA,gBAAMW,OAAN;AADC,OADF;AAIRZ,MAAAA,eAAe,EAAEC,gBAAMY,QAAN;AAJT;AAtBqB,GAAZ;AAAA,CAArB;;AA8BO,IAAMC,UAAU,GAAG,w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AuD,KAAKX,KAA5D;AAAA,UAAQE,SAAR,eAAQA,SAAR;AAAA,UAAmBJ,QAAnB,eAAmBA,QAAnB;AAAA,UAA6Bc,WAA7B,eAA6BA,WAA7B;AAAA,UAA0CC,QAA1C,eAA0CA,QAA1C;AAEA,0BACE;AAAK,QAAA,SAAS,EAAE,4BAAWX,SAAX;AAAhB,SACG,CAACJ,QAAD,iBACC,gCAAC,UAAD;AAAY,QAAA,KAAK,EAAElB,UAAU,CAACkC,CAAX,CAAa,sBAAb,EAAqC;AAAEC,UAAAA,GAAG,EAAEF;AAAP,SAArC,CAAnB;AAA4E,QAAA,OAAO,EAAED;AAArF,QAFJ,CADF;AAOD;;;EApB2BI,kBAAMC,S;;;iCAAvBN,Q,eACQ;AACjBT,EAAAA,SAAS,EAAEI,sBAAUE,MADJ;AAEjBI,EAAAA,WAAW,EAAEN,sBAAUI,IAFN;AAGjBZ,EAAAA,QAAQ,EAAEQ,sBAAUC,IAHH;AAIjBM,EAAAA,QAAQ,EAAEP,sBAAUE;AAJH,C;iCADRG,Q,kBAQW,E;eAeTA,Q","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport cn from 'classnames';\nimport Button from '@material-ui/core/Button';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst buttonStyles = (theme) => ({\n root: {\n backgroundColor: color.background(),\n color: color.text(),\n border: `1px solid ${color.secondary()}`,\n '&:hover': {\n backgroundColor: color.secondaryLight(),\n },\n fontSize: theme.typography.fontSize,\n },\n selected: {\n backgroundColor: color.background(),\n '& span': {\n color: color.primaryDark(),\n },\n },\n notSelected: {\n '& span': {\n color: color.primary(),\n },\n backgroundColor: color.background(),\n },\n disabled: {\n '& span': {\n color: color.primary(),\n },\n backgroundColor: color.disabled(),\n },\n});\n\nexport const MiniButton = withStyles(buttonStyles)((props) => {\n const { disabled, classes, className, selected, value, onClick } = props;\n return (\n <Button\n size=\"small\"\n disabled={disabled}\n color={selected ? 'secondary' : 'default'}\n className={cn(classes.root, selected && classes.selected, className)}\n classes={{ disabled: cn(disabled && classes.disabled) }}\n value={value}\n key={value}\n variant=\"outlined\"\n onClick={onClick}\n >\n {value}\n </Button>\n );\n});\nMiniButton.propTypes = {\n disabled: PropTypes.bool,\n className: PropTypes.string,\n disabledClassName: PropTypes.string,\n selected: PropTypes.bool,\n value: PropTypes.string,\n onClick: PropTypes.func,\n};\n\nexport class ToolMenu extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n addCategory: PropTypes.func,\n disabled: PropTypes.bool,\n language: PropTypes.string,\n };\n\n static defaultProps = {};\n\n render() {\n const { className, disabled, addCategory, language } = this.props;\n\n return (\n <div className={classNames(className)}>\n {!disabled && (\n <MiniButton value={translator.t('charting.addCategory', { lng: language })} onClick={addCategory} />\n )}\n </div>\n );\n }\n}\n\nexport default ToolMenu;\n"],"file":"tool-menu.js"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.13.1-next.0+01336e0d",
6
+ "version": "5.14.0",
7
7
  "description": "charting",
8
8
  "keywords": [
9
9
  "react",
@@ -19,7 +19,8 @@
19
19
  "dependencies": {
20
20
  "@mapbox/point-geometry": "^0.1.0",
21
21
  "@material-ui/core": "^3.8.3",
22
- "@pie-lib/plot": "^2.7.1-next.0+01336e0d",
22
+ "@pie-lib/plot": "^2.7.1",
23
+ "@pie-lib/translator": "^2.1.0",
23
24
  "@vx/axis": "^0.0.183",
24
25
  "@vx/event": "^0.0.182",
25
26
  "@vx/grid": "^0.0.183",
@@ -43,5 +44,5 @@
43
44
  "peerDependencies": {
44
45
  "react": "^16.8.1"
45
46
  },
46
- "gitHead": "01336e0ddd02830406b3e5e8a80dd4a3a33bddfe"
47
+ "gitHead": "b76cbf501c964c9905cff2f16a811c47c16f9e1d"
47
48
  }
package/src/chart.jsx CHANGED
@@ -12,6 +12,9 @@ import { dataToXBand, getDomainAndRangeByChartType, getGridLinesAndAxisByChartTy
12
12
  import ToolMenu from './tool-menu';
13
13
  import chartTypes from './chart-types';
14
14
  import { AlertDialog } from '@pie-lib/config-ui';
15
+ import Translator from '@pie-lib/translator';
16
+
17
+ const { translator } = Translator;
15
18
 
16
19
  const log = debug('pie-lib:charts:chart');
17
20
 
@@ -66,6 +69,7 @@ export class Chart extends React.Component {
66
69
  chartingOptions: PropTypes.object,
67
70
  changeInteractiveEnabled: PropTypes.bool,
68
71
  changeEditableEnabled: PropTypes.bool,
72
+ language: PropTypes.string,
69
73
  };
70
74
 
71
75
  static defaultProps = {
@@ -140,14 +144,14 @@ export class Chart extends React.Component {
140
144
  };
141
145
 
142
146
  addCategory = () => {
143
- const { onDataChange, data, categoryDefaultLabel, defineChart, categoryDefaults } = this.props;
147
+ const { onDataChange, data, categoryDefaultLabel, defineChart, categoryDefaults, language } = this.props;
144
148
 
145
149
  if (!defineChart && data.length > 19) {
146
150
  this.setState({
147
151
  dialog: {
148
152
  open: true,
149
- title: 'Warning',
150
- text: "There can't be more than 20 categories.",
153
+ title: translator.t('common:warning', { lng: language }),
154
+ text: translator.t('charting.reachedLimit_other', { count: 20, lng: language }),
151
155
  onConfirm: () => this.handleAlertDialog(false),
152
156
  },
153
157
  });
@@ -157,7 +161,7 @@ export class Chart extends React.Component {
157
161
  {
158
162
  inDefineChart: defineChart,
159
163
  autoFocus: true,
160
- label: categoryDefaultLabel || 'New Bar',
164
+ label: categoryDefaultLabel || translator.t('charting.newLabel', { lng: language }),
161
165
  value: 0,
162
166
  deletable: true,
163
167
  editable: categoryDefaults ? categoryDefaults?.editable : true,
@@ -196,7 +200,8 @@ export class Chart extends React.Component {
196
200
  changeEditableEnabled,
197
201
  showPixelGuides,
198
202
  error,
199
- mathMlOptions = {}
203
+ mathMlOptions = {},
204
+ language,
200
205
  } = this.props;
201
206
  let { chartType } = this.props;
202
207
 
@@ -244,6 +249,7 @@ export class Chart extends React.Component {
244
249
  className={classes.toolMenu}
245
250
  disabled={!addCategoryEnabled}
246
251
  addCategory={() => this.addCategory()}
252
+ language={language}
247
253
  />
248
254
  </div>
249
255
 
package/src/tool-menu.jsx CHANGED
@@ -6,6 +6,9 @@ import { color } from '@pie-lib/render-ui';
6
6
  import { withStyles } from '@material-ui/core/styles';
7
7
  import cn from 'classnames';
8
8
  import Button from '@material-ui/core/Button';
9
+ import Translator from '@pie-lib/translator';
10
+
11
+ const { translator } = Translator;
9
12
 
10
13
  const buttonStyles = (theme) => ({
11
14
  root: {
@@ -69,16 +72,19 @@ export class ToolMenu extends React.Component {
69
72
  className: PropTypes.string,
70
73
  addCategory: PropTypes.func,
71
74
  disabled: PropTypes.bool,
75
+ language: PropTypes.string,
72
76
  };
73
77
 
74
78
  static defaultProps = {};
75
79
 
76
80
  render() {
77
- const { className, disabled, addCategory } = this.props;
81
+ const { className, disabled, addCategory, language } = this.props;
78
82
 
79
83
  return (
80
84
  <div className={classNames(className)}>
81
- {!disabled && <MiniButton value={'Add Category'} onClick={addCategory} />}
85
+ {!disabled && (
86
+ <MiniButton value={translator.t('charting.addCategory', { lng: language })} onClick={addCategory} />
87
+ )}
82
88
  </div>
83
89
  );
84
90
  }