@devgateway/dvz-wp-commons 1.2.0 → 1.3.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/build/APIConfig.cjs +479 -0
- package/build/APIConfig.d.ts +12 -0
- package/build/APIConfig.js +367 -283
- package/build/APIutils.cjs +54 -0
- package/build/APIutils.js +7 -1
- package/build/Blocks.cjs +672 -0
- package/build/Blocks.d.ts +14 -1
- package/build/Blocks.js +523 -330
- package/build/CSVSourceConfig.cjs +99 -0
- package/build/CSVSourceConfig.js +63 -46
- package/build/ChartColors.cjs +593 -0
- package/build/ChartColors.d.ts +0 -1
- package/build/ChartColors.js +430 -366
- package/build/ChartLegends.cjs +157 -0
- package/build/ChartLegends.d.ts +0 -1
- package/build/ChartLegends.js +173 -54
- package/build/ChartMeasures.cjs +192 -0
- package/build/ChartMeasures.d.ts +0 -1
- package/build/ChartMeasures.js +197 -109
- package/build/Constants.cjs +21 -0
- package/build/Constants.js +3 -1
- package/build/DataFilters.cjs +176 -0
- package/build/DataFilters.js +100 -89
- package/build/Format.cjs +1038 -0
- package/build/Format.js +428 -378
- package/build/MapCSVSourceConfig.cjs +36 -0
- package/build/MapCSVSourceConfig.js +19 -8
- package/build/Measures.cjs +196 -0
- package/build/Measures.js +204 -108
- package/build/MobileConfigUtils.cjs +92 -0
- package/build/MobileConfigUtils.js +19 -8
- package/build/Tooltip.cjs +63 -0
- package/build/Tooltip.d.ts +1 -3
- package/build/Tooltip.js +27 -51
- package/build/Util.cjs +29 -0
- package/build/Util.js +7 -7
- package/build/hooks/index.cjs +1 -0
- package/build/hooks/index.js +0 -3
- package/build/icons/Chart.cjs +49 -0
- package/build/icons/Chart.d.ts +1 -2
- package/build/icons/Chart.js +10 -11
- package/build/icons/Generic.cjs +24 -0
- package/build/icons/Generic.d.ts +1 -2
- package/build/icons/Generic.js +25 -4
- package/build/icons/index.cjs +19 -0
- package/build/icons/index.js +2 -2
- package/build/index.cjs +225 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +47 -16
- package/package.json +16 -7
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = exports.FilterSelector = exports.CategoricalFilter = exports.APIConfig = void 0;
|
|
7
|
+
var _element = require("@wordpress/element");
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _Measures = require("./Measures.cjs");
|
|
11
|
+
const defaultFormat = {
|
|
12
|
+
style: "percent",
|
|
13
|
+
minimumFractionDigits: 1,
|
|
14
|
+
maximumFractionDigits: 1,
|
|
15
|
+
currency: "USD"
|
|
16
|
+
};
|
|
17
|
+
const FilterSelector = ({
|
|
18
|
+
param,
|
|
19
|
+
index,
|
|
20
|
+
options,
|
|
21
|
+
onUpdateFilterParam
|
|
22
|
+
}) => {
|
|
23
|
+
const sortedOptions = options.sort(function (a, b) {
|
|
24
|
+
var aLabel = a.label ? a.label.toLowerCase() : "";
|
|
25
|
+
var bLabel = b.label ? b.label.toLowerCase() : "";
|
|
26
|
+
return aLabel < bLabel ? -1 : aLabel > bLabel ? 1 : 0;
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */React.createElement(_components.SelectControl, {
|
|
29
|
+
onChange: value => {
|
|
30
|
+
onUpdateFilterParam(value, index);
|
|
31
|
+
},
|
|
32
|
+
value: param,
|
|
33
|
+
options: sortedOptions
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.FilterSelector = FilterSelector;
|
|
37
|
+
const CategoricalFilter = ({
|
|
38
|
+
value,
|
|
39
|
+
index,
|
|
40
|
+
items,
|
|
41
|
+
onUpdateFilterValue
|
|
42
|
+
}) => {
|
|
43
|
+
if (items) {
|
|
44
|
+
const sortedItems = items.sort(function (a, b) {
|
|
45
|
+
if (a.position !== void 0 && b.position !== void 0 && a.position !== b.position) {
|
|
46
|
+
return a.position - b.position;
|
|
47
|
+
}
|
|
48
|
+
let aValue = a.value ? a.value.toLowerCase() : "";
|
|
49
|
+
let bValue = b.value ? b.value.toLowerCase() : "";
|
|
50
|
+
return aValue < bValue ? -1 : aValue > bValue ? 1 : 0;
|
|
51
|
+
});
|
|
52
|
+
return sortedItems.map(v => /* @__PURE__ */React.createElement(_components.PanelRow, null, " ", /* @__PURE__ */React.createElement(_components.ToggleControl, {
|
|
53
|
+
label: v.value,
|
|
54
|
+
checked: value.indexOf(v.id) > -1,
|
|
55
|
+
onChange: e => {
|
|
56
|
+
onUpdateFilterValue(v.id, index);
|
|
57
|
+
}
|
|
58
|
+
})));
|
|
59
|
+
} else {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.CategoricalFilter = CategoricalFilter;
|
|
64
|
+
class APIConfig extends _element.Component {
|
|
65
|
+
constructor(props) {
|
|
66
|
+
super(props);
|
|
67
|
+
this.onMeasuresChange = this.onMeasuresChange.bind(this);
|
|
68
|
+
this.onSetSingleMeasure = this.onSetSingleMeasure.bind(this);
|
|
69
|
+
this.addFilter = this.addFilter.bind(this);
|
|
70
|
+
this.updateFilterParam = this.updateFilterParam.bind(this);
|
|
71
|
+
this.updateFilterValue = this.updateFilterValue.bind(this);
|
|
72
|
+
this.setFilterValue = this.setFilterValue.bind(this);
|
|
73
|
+
this.removeFilter = this.removeFilter.bind(this);
|
|
74
|
+
this.items = this.items.bind(this);
|
|
75
|
+
this.onFormatChange = this.onFormatChange.bind(this);
|
|
76
|
+
this.onCustomLabelToggleChange = this.onCustomLabelToggleChange.bind(this);
|
|
77
|
+
this.onCustomLabelChange = this.onCustomLabelChange.bind(this);
|
|
78
|
+
this.onUseCustomAxisFormatChange = this.onUseCustomAxisFormatChange.bind(this);
|
|
79
|
+
this.state = {
|
|
80
|
+
measures: [],
|
|
81
|
+
dimensions: [],
|
|
82
|
+
filters: [],
|
|
83
|
+
categories: []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
cleanSelection(prevState) {
|
|
87
|
+
const {
|
|
88
|
+
setAttributes
|
|
89
|
+
} = this.props;
|
|
90
|
+
setAttributes({
|
|
91
|
+
measures: [],
|
|
92
|
+
filters: []
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
updateFilterParam(param, idx) {
|
|
96
|
+
const {
|
|
97
|
+
attributes: {
|
|
98
|
+
filters
|
|
99
|
+
},
|
|
100
|
+
setAttributes,
|
|
101
|
+
allFilters
|
|
102
|
+
} = this.props;
|
|
103
|
+
const newFilters = filters.slice();
|
|
104
|
+
const selected = allFilters.filter(f => f.param === param)[0];
|
|
105
|
+
newFilters[idx] = {
|
|
106
|
+
...selected,
|
|
107
|
+
value: []
|
|
108
|
+
};
|
|
109
|
+
setAttributes({
|
|
110
|
+
filters: newFilters
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
updateFilterValue(value, idx) {
|
|
114
|
+
const {
|
|
115
|
+
attributes: {
|
|
116
|
+
filters
|
|
117
|
+
},
|
|
118
|
+
setAttributes,
|
|
119
|
+
allFilters
|
|
120
|
+
} = this.props;
|
|
121
|
+
const selected = filters[idx];
|
|
122
|
+
let values = selected.value;
|
|
123
|
+
if (values.indexOf(value) > -1) {
|
|
124
|
+
values = values.filter(v => v != value);
|
|
125
|
+
} else {
|
|
126
|
+
values.push(value);
|
|
127
|
+
}
|
|
128
|
+
const newFilters = filters.slice();
|
|
129
|
+
newFilters[idx].value = values;
|
|
130
|
+
setAttributes({
|
|
131
|
+
filters: newFilters
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
setFilterValue(value, idx) {
|
|
135
|
+
const {
|
|
136
|
+
attributes: {
|
|
137
|
+
filters
|
|
138
|
+
},
|
|
139
|
+
setAttributes,
|
|
140
|
+
allFilters
|
|
141
|
+
} = this.props;
|
|
142
|
+
const selected = filters[idx];
|
|
143
|
+
let values = selected.value;
|
|
144
|
+
values = value.split(",");
|
|
145
|
+
const newFilters = filters.slice();
|
|
146
|
+
newFilters[idx].value = values;
|
|
147
|
+
setAttributes({
|
|
148
|
+
filters: newFilters
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
addFilter() {
|
|
152
|
+
const {
|
|
153
|
+
attributes: {
|
|
154
|
+
filters
|
|
155
|
+
},
|
|
156
|
+
setAttributes,
|
|
157
|
+
allFilters
|
|
158
|
+
} = this.props;
|
|
159
|
+
let index = filters.length > allFilters.length ? allFilters.length : filters.length;
|
|
160
|
+
const newFilter = allFilters && allFilters.length > 0 ? {
|
|
161
|
+
...allFilters[index],
|
|
162
|
+
value: []
|
|
163
|
+
} : null;
|
|
164
|
+
let newFilters = filters.slice();
|
|
165
|
+
newFilters.push(newFilter);
|
|
166
|
+
setAttributes({
|
|
167
|
+
filters: newFilters
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
removeFilter(f) {
|
|
171
|
+
const {
|
|
172
|
+
attributes: {
|
|
173
|
+
filters
|
|
174
|
+
},
|
|
175
|
+
setAttributes,
|
|
176
|
+
allFilters
|
|
177
|
+
} = this.props;
|
|
178
|
+
let newFilters = filters.slice(0, -1);
|
|
179
|
+
setAttributes({
|
|
180
|
+
filters: newFilters
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
componentDidUpdate(prevProps) {
|
|
184
|
+
const {
|
|
185
|
+
setAttributes,
|
|
186
|
+
attributes: {
|
|
187
|
+
type,
|
|
188
|
+
colorBy,
|
|
189
|
+
dimension2,
|
|
190
|
+
types,
|
|
191
|
+
measures,
|
|
192
|
+
app
|
|
193
|
+
}
|
|
194
|
+
} = this.props;
|
|
195
|
+
const {
|
|
196
|
+
attributes: {
|
|
197
|
+
type: prevType,
|
|
198
|
+
dimension2: prevDimension2
|
|
199
|
+
}
|
|
200
|
+
} = prevProps;
|
|
201
|
+
const prevTypeObject = types.filter(t => t.value === prevType).length > 0 ? types.filter(t => t.value === prevType)[0] : null;
|
|
202
|
+
if (dimension2 != prevDimension2) {
|
|
203
|
+
const uMs = Object.assign({}, measures);
|
|
204
|
+
if (dimension2 != "none") {
|
|
205
|
+
let i = 0;
|
|
206
|
+
if (uMs[app]) {
|
|
207
|
+
const selected = Object.keys(uMs[app]).map(k => uMs[app][k].selected).length;
|
|
208
|
+
if (selected > 1) {
|
|
209
|
+
Object.keys(uMs[app]).forEach(k => {
|
|
210
|
+
if (uMs[app][k].selected) {
|
|
211
|
+
uMs[app][k].prevSelected = true;
|
|
212
|
+
uMs[app][k].selected = i > 0 ? false : true;
|
|
213
|
+
} else {
|
|
214
|
+
uMs[app][k].prevSelected = false;
|
|
215
|
+
}
|
|
216
|
+
i++;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
setAttributes({
|
|
221
|
+
measures: uMs
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (dimension2 == "none" && uMs[app]) {
|
|
225
|
+
Object.keys(uMs[app]).forEach(k => {
|
|
226
|
+
if (uMs[app][k].prevSelected) {
|
|
227
|
+
uMs[app][k].selected = true;
|
|
228
|
+
uMs[app][k].prevSelected = false;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
setAttributes({
|
|
232
|
+
measures: uMs
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
onSetSingleMeasure(value) {
|
|
238
|
+
const {
|
|
239
|
+
setAttributes,
|
|
240
|
+
attributes: {
|
|
241
|
+
app,
|
|
242
|
+
measures
|
|
243
|
+
}
|
|
244
|
+
} = this.props;
|
|
245
|
+
const uMs = Object.assign({}, measures);
|
|
246
|
+
if (!uMs[app]) {
|
|
247
|
+
uMs[app] = {};
|
|
248
|
+
}
|
|
249
|
+
Object.keys(uMs[app]).filter(k => typeof uMs[app][k] !== "boolean").forEach(k => uMs[app][k].selected = false);
|
|
250
|
+
if (uMs[app][value]) {
|
|
251
|
+
uMs[app][value].selected = uMs[app][value].selected ? false : true;
|
|
252
|
+
} else {
|
|
253
|
+
uMs[app][value] = {
|
|
254
|
+
selected: true,
|
|
255
|
+
format: defaultFormat
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
setAttributes({
|
|
259
|
+
measures: uMs
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
onFormatChange(format, field) {
|
|
263
|
+
const {
|
|
264
|
+
setAttributes,
|
|
265
|
+
attributes: {
|
|
266
|
+
app,
|
|
267
|
+
measures
|
|
268
|
+
}
|
|
269
|
+
} = this.props;
|
|
270
|
+
const uMs = Object.assign({}, {
|
|
271
|
+
...measures
|
|
272
|
+
});
|
|
273
|
+
if (!uMs[app]) {
|
|
274
|
+
uMs[app] = {
|
|
275
|
+
allowSelection: false,
|
|
276
|
+
format,
|
|
277
|
+
customFormat: format,
|
|
278
|
+
selected: false
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
uMs[app][field] = format;
|
|
282
|
+
setAttributes({
|
|
283
|
+
measures: uMs
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
onUseCustomAxisFormatChange(value) {
|
|
287
|
+
const {
|
|
288
|
+
setAttributes,
|
|
289
|
+
attributes: {
|
|
290
|
+
app,
|
|
291
|
+
measures
|
|
292
|
+
}
|
|
293
|
+
} = this.props;
|
|
294
|
+
const uMs = Object.assign({}, {
|
|
295
|
+
...measures
|
|
296
|
+
});
|
|
297
|
+
if (uMs[app]) {
|
|
298
|
+
uMs[app].useCustomAxisFormat = value;
|
|
299
|
+
setAttributes({
|
|
300
|
+
measures: uMs
|
|
301
|
+
});
|
|
302
|
+
} else {
|
|
303
|
+
uMs[app] = {
|
|
304
|
+
allowSelection: false,
|
|
305
|
+
format: defaultFormat,
|
|
306
|
+
customFormat: defaultFormat,
|
|
307
|
+
selected: false,
|
|
308
|
+
useCustomAxisFormat: value
|
|
309
|
+
};
|
|
310
|
+
setAttributes({
|
|
311
|
+
measures: uMs
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/*
|
|
316
|
+
onCustomMeasureFieldChange(measureName, field, value) {
|
|
317
|
+
|
|
318
|
+
const {setAttributes, attributes: {measures}} = this.props
|
|
319
|
+
const uMs = Object.assign({}, {...measures})
|
|
320
|
+
|
|
321
|
+
if (uMs[measureName]) {
|
|
322
|
+
uMs[measureName][field] = value
|
|
323
|
+
} else {
|
|
324
|
+
uMs[measureName] = {allowSelection: false, field: value, selected: false}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
setAttributes({measures: uMs})
|
|
328
|
+
}
|
|
329
|
+
*/
|
|
330
|
+
onMeasuresChange(value) {
|
|
331
|
+
const {
|
|
332
|
+
setAttributes,
|
|
333
|
+
attributes: {
|
|
334
|
+
app,
|
|
335
|
+
measures
|
|
336
|
+
}
|
|
337
|
+
} = this.props;
|
|
338
|
+
const uMs = Object.assign({}, measures);
|
|
339
|
+
if (!uMs[app]) {
|
|
340
|
+
uMs[app] = {};
|
|
341
|
+
}
|
|
342
|
+
if (uMs[app][value]) {
|
|
343
|
+
uMs[app][value].selected = uMs[app][value].selected ? false : true;
|
|
344
|
+
} else {
|
|
345
|
+
uMs[app][value] = {
|
|
346
|
+
selected: true,
|
|
347
|
+
format: defaultFormat
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
setAttributes({
|
|
351
|
+
measures: uMs
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
onCustomLabelToggleChange(value) {
|
|
355
|
+
const {
|
|
356
|
+
setAttributes,
|
|
357
|
+
attributes: {
|
|
358
|
+
app,
|
|
359
|
+
measures
|
|
360
|
+
}
|
|
361
|
+
} = this.props;
|
|
362
|
+
const uMs = Object.assign({}, measures);
|
|
363
|
+
if (uMs[app] && uMs[app][value]) {
|
|
364
|
+
uMs[app][value].hasCustomLabel = uMs[app][value].hasCustomLabel ? false : true;
|
|
365
|
+
setAttributes({
|
|
366
|
+
measures: uMs
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
onCustomLabelChange(value, customLabel) {
|
|
371
|
+
const {
|
|
372
|
+
setAttributes,
|
|
373
|
+
attributes: {
|
|
374
|
+
app,
|
|
375
|
+
measures
|
|
376
|
+
}
|
|
377
|
+
} = this.props;
|
|
378
|
+
const uMs = Object.assign({}, measures);
|
|
379
|
+
if (uMs[app] && uMs[app][value] && uMs[app][value].hasCustomLabel) {
|
|
380
|
+
uMs[app][value].customLabel = customLabel;
|
|
381
|
+
setAttributes({
|
|
382
|
+
measures: uMs
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
items(type) {
|
|
387
|
+
const values = this.props.allCategories ? this.props.allCategories.filter(c => c.type === type) : [];
|
|
388
|
+
const cat = values.length > 0 ? values[0] : null;
|
|
389
|
+
let items = null;
|
|
390
|
+
if (type === "Boolean") {
|
|
391
|
+
items = [{
|
|
392
|
+
value: "Yes",
|
|
393
|
+
id: true
|
|
394
|
+
}, {
|
|
395
|
+
value: "No",
|
|
396
|
+
id: false
|
|
397
|
+
}];
|
|
398
|
+
} else if (cat) {
|
|
399
|
+
items = cat.items;
|
|
400
|
+
}
|
|
401
|
+
return items;
|
|
402
|
+
}
|
|
403
|
+
render() {
|
|
404
|
+
const {
|
|
405
|
+
allDimensions,
|
|
406
|
+
allFilters,
|
|
407
|
+
allMeasures,
|
|
408
|
+
setAttributes,
|
|
409
|
+
attributes: {
|
|
410
|
+
measures,
|
|
411
|
+
filters,
|
|
412
|
+
dimension1,
|
|
413
|
+
dimension2,
|
|
414
|
+
type,
|
|
415
|
+
types
|
|
416
|
+
}
|
|
417
|
+
} = this.props;
|
|
418
|
+
const currentType = types.filter(t => t.value === type).length > 0 ? types.filter(t => t.value === type)[0] : null;
|
|
419
|
+
return [/* @__PURE__ */React.createElement(_components.PanelBody, {
|
|
420
|
+
initialOpen: false,
|
|
421
|
+
title: (0, _i18n.__)(type == "map" ? "Fields" : `Dimensions`)
|
|
422
|
+
}, /* @__PURE__ */React.createElement(_components.PanelRow, null, /* @__PURE__ */React.createElement(_components.SelectControl, {
|
|
423
|
+
label: (0, _i18n.__)(type == "map" ? "Matching Field" : "First Dimension"),
|
|
424
|
+
value: [dimension1],
|
|
425
|
+
onChange: value => {
|
|
426
|
+
setAttributes({
|
|
427
|
+
dimension1: value,
|
|
428
|
+
dimension2: value == "none" ? "none" : dimension2
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
options: allDimensions
|
|
432
|
+
})), !["radar"].includes(type) && /* @__PURE__ */React.createElement(_components.PanelRow, null, /* @__PURE__ */React.createElement(_components.SelectControl, {
|
|
433
|
+
label: (0, _i18n.__)(type == "map" ? "Breakdown Field" : "Second Dimension"),
|
|
434
|
+
value: [dimension2],
|
|
435
|
+
onChange: value => {
|
|
436
|
+
setAttributes({
|
|
437
|
+
dimension2: value
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
options: allDimensions,
|
|
441
|
+
disabled: dimension1 == "none"
|
|
442
|
+
}))), /* @__PURE__ */React.createElement(_Measures.Measures, {
|
|
443
|
+
onFormatChange: this.onFormatChange,
|
|
444
|
+
onUseCustomAxisFormatChange: this.onUseCustomAxisFormatChange,
|
|
445
|
+
onSetSingleMeasure: this.onSetSingleMeasure,
|
|
446
|
+
onMeasuresChange: this.onMeasuresChange,
|
|
447
|
+
onCustomLabelToggleChange: this.onCustomLabelToggleChange,
|
|
448
|
+
onCustomLabelChange: this.onCustomLabelChange,
|
|
449
|
+
...this.props,
|
|
450
|
+
currentType
|
|
451
|
+
}), /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(_components.PanelBody, {
|
|
452
|
+
initialOpen: false,
|
|
453
|
+
title: (0, _i18n.__)("Filters")
|
|
454
|
+
}, filters.map((f, index) => {
|
|
455
|
+
return /* @__PURE__ */React.createElement(_components.PanelBody, {
|
|
456
|
+
initialOpen: true,
|
|
457
|
+
title: (0, _i18n.__)(`Filter - ${f.label}`)
|
|
458
|
+
}, /* @__PURE__ */React.createElement(FilterSelector, {
|
|
459
|
+
param: f.param,
|
|
460
|
+
index,
|
|
461
|
+
options: allFilters,
|
|
462
|
+
onUpdateFilterParam: this.updateFilterParam
|
|
463
|
+
}), /* @__PURE__ */React.createElement(CategoricalFilter, {
|
|
464
|
+
value: f.value,
|
|
465
|
+
index,
|
|
466
|
+
items: this.items(f.type),
|
|
467
|
+
onUpdateFilterValue: this.updateFilterValue
|
|
468
|
+
}));
|
|
469
|
+
}), /* @__PURE__ */React.createElement(_components.PanelRow, null, /* @__PURE__ */React.createElement(_components.Button, {
|
|
470
|
+
variant: "link",
|
|
471
|
+
onClick: this.addFilter
|
|
472
|
+
}, (0, _i18n.__)("Add Filter")), /* @__PURE__ */React.createElement(_components.Button, {
|
|
473
|
+
variant: "link",
|
|
474
|
+
onClick: this.removeFilter
|
|
475
|
+
}, (0, _i18n.__)("Remove")))))];
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
exports.APIConfig = APIConfig;
|
|
479
|
+
module.exports = APIConfig;
|
package/build/APIConfig.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
export function FilterSelector({ param, index, options, onUpdateFilterParam }: {
|
|
2
|
+
param: any;
|
|
3
|
+
index: any;
|
|
4
|
+
options: any;
|
|
5
|
+
onUpdateFilterParam: any;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export function CategoricalFilter({ value, index, items, onUpdateFilterValue }: {
|
|
8
|
+
value: any;
|
|
9
|
+
index: any;
|
|
10
|
+
items: any;
|
|
11
|
+
onUpdateFilterValue: any;
|
|
12
|
+
}): any;
|
|
1
13
|
export class APIConfig extends Component<any, any, any> {
|
|
2
14
|
constructor(props: any);
|
|
3
15
|
onMeasuresChange(value: any): void;
|