@visactor/vseed 0.0.4 → 0.0.6
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/dist/builder/builder/build.d.ts +2 -2
- package/dist/builder/builder/buildSpec.d.ts +2 -2
- package/dist/builder/builder/builder.d.ts +8 -5
- package/dist/dataReshape/constant.d.ts +1 -1
- package/dist/dataReshape/dataReshapeFor1D1M.d.ts +6 -1
- package/dist/dataReshape/dataReshapeFor2D1M.d.ts +6 -1
- package/dist/index.cjs +1762 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +1545 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline/advanced/pipes/encoding/{encodingCartesian.d.ts → encodingXY.d.ts} +0 -1
- package/dist/pipeline/advanced/pipes/encoding/encodingYX.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/index.d.ts +2 -1
- package/dist/pipeline/advanced/pipes/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/pivot/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/pivot/pivotAdapter.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/reshape/index.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/reshape/pivotReshapeTo1D1M.d.ts +8 -0
- package/dist/pipeline/advanced/pipes/reshape/pivotReshapeTo2D1M.d.ts +8 -0
- package/dist/pipeline/spec/pipeline/area.d.ts +1 -2
- package/dist/pipeline/spec/pipeline/areaPercent.d.ts +1 -2
- package/dist/pipeline/spec/pipeline/column.d.ts +1 -2
- package/dist/pipeline/spec/pipes/dataset/datasetPivot.d.ts +3 -0
- package/dist/pipeline/spec/pipes/dataset/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/init/pivot.d.ts +4 -0
- package/dist/pipeline/spec/pipes/legend/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/legend/pivotLegend.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/index.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotAdapter.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotIndicators.d.ts +4 -0
- package/dist/types/advancedVSeed.d.ts +3 -2
- package/dist/types/builder/builder.d.ts +3 -3
- package/dist/types/builder/index.d.ts +1 -0
- package/dist/types/builder/spec.d.ts +3 -0
- package/dist/types/pipeline/spec/spec.d.ts +2 -2
- package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +3 -2
- package/dist/types/properties/datasetReshapeInfo/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/.rsdoctor/chunkGraph/0 +0 -1
- package/dist/.rsdoctor/configs/0 +0 -1
- package/dist/.rsdoctor/envinfo/0 +0 -1
- package/dist/.rsdoctor/errors/0 +0 -1
- package/dist/.rsdoctor/loader/0 +0 -1
- package/dist/.rsdoctor/manifest.json +0 -52
- package/dist/.rsdoctor/moduleCodeMap/0 +0 -1
- package/dist/.rsdoctor/moduleGraph/0 +0 -1
- package/dist/.rsdoctor/otherReports/0 +0 -1
- package/dist/.rsdoctor/packageGraph/0 +0 -1
- package/dist/.rsdoctor/plugin/0 +0 -1
- package/dist/.rsdoctor/resolver/0 +0 -1
- package/dist/.rsdoctor/summary/0 +0 -1
- package/dist/index.html +0 -1
- package/dist/static/js/271.b02e15b2.js +0 -16
- package/dist/static/js/index.7ac2af0b.js +0 -1
package/dist/index.cjs
ADDED
@@ -0,0 +1,1762 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __webpack_require__ = {};
|
3
|
+
(()=>{
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
6
|
+
enumerable: true,
|
7
|
+
get: definition[key]
|
8
|
+
});
|
9
|
+
};
|
10
|
+
})();
|
11
|
+
(()=>{
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
13
|
+
})();
|
14
|
+
(()=>{
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
17
|
+
value: 'Module'
|
18
|
+
});
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
20
|
+
value: true
|
21
|
+
});
|
22
|
+
};
|
23
|
+
})();
|
24
|
+
var __webpack_exports__ = {};
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
27
|
+
columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
|
28
|
+
isVChart: ()=>isVChart,
|
29
|
+
registerAll: ()=>all_registerAll,
|
30
|
+
execPipeline: ()=>execPipeline,
|
31
|
+
areaSpecPipeline: ()=>areaSpecPipeline,
|
32
|
+
registerCustomTheme: ()=>registerCustomTheme,
|
33
|
+
registerLine: ()=>registerLine,
|
34
|
+
zColor: ()=>zColor,
|
35
|
+
zMeasureGroup: ()=>zMeasureGroup,
|
36
|
+
zUnfoldInfo: ()=>zUnfoldInfo,
|
37
|
+
zMeasures: ()=>zMeasures,
|
38
|
+
darkTheme: ()=>darkTheme,
|
39
|
+
columnPercentAdvancedPipeline: ()=>columnPercentAdvancedPipeline,
|
40
|
+
isVTable: ()=>isVTable,
|
41
|
+
columnSpecPipeline: ()=>columnSpecPipeline,
|
42
|
+
zFoldInfo: ()=>zFoldInfo,
|
43
|
+
zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
|
44
|
+
columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
|
45
|
+
columnAdvancedPipeline: ()=>columnAdvancedPipeline,
|
46
|
+
zLabel: ()=>zLabel,
|
47
|
+
registerColumn: ()=>registerColumn,
|
48
|
+
zDimension: ()=>zDimension,
|
49
|
+
lightTheme: ()=>lightTheme,
|
50
|
+
registerColumnParallel: ()=>registerColumnParallel,
|
51
|
+
zCustomTheme: ()=>zCustomTheme,
|
52
|
+
dataReshapeFor1D1M: ()=>dataReshapeFor1D1M_dataReshapeFor1D1M,
|
53
|
+
registerArea: ()=>registerArea,
|
54
|
+
zDataset: ()=>zDataset,
|
55
|
+
barPercentAdvancedPipeline: ()=>barPercentAdvancedPipeline,
|
56
|
+
areaPercentAdvancedPipeline: ()=>areaPercentAdvancedPipeline,
|
57
|
+
zBackgroundColor: ()=>zBackgroundColor,
|
58
|
+
registerBarParallel: ()=>registerBarParallel,
|
59
|
+
zMeasure: ()=>zMeasure,
|
60
|
+
zDimensions: ()=>zDimensions,
|
61
|
+
zLegend: ()=>zLegend,
|
62
|
+
zTheme: ()=>zTheme,
|
63
|
+
zEncoding: ()=>zEncoding,
|
64
|
+
registerAreaPercent: ()=>registerAreaPercent,
|
65
|
+
zDatum: ()=>zDatum,
|
66
|
+
barAdvancedPipeline: ()=>barAdvancedPipeline,
|
67
|
+
zCustomThemeConfig: ()=>zCustomThemeConfig,
|
68
|
+
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
69
|
+
registerColumnPercent: ()=>registerColumnPercent,
|
70
|
+
registerBarPercent: ()=>registerBarPercent,
|
71
|
+
foldMeasures: ()=>foldMeasures,
|
72
|
+
dataReshapeFor2D1M: ()=>dataReshapeFor2D1M,
|
73
|
+
registerLightTheme: ()=>registerLightTheme,
|
74
|
+
registerDarkTheme: ()=>registerDarkTheme,
|
75
|
+
zChartType: ()=>zChartType,
|
76
|
+
barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
|
77
|
+
barPercentSpecPipeline: ()=>barPercentSpecPipeline,
|
78
|
+
lineAdvancedPipeline: ()=>lineAdvancedPipeline,
|
79
|
+
zTooltip: ()=>zTooltip,
|
80
|
+
barSpecPipeline: ()=>barSpecPipeline,
|
81
|
+
lineSpecPipeline: ()=>lineSpecPipeline,
|
82
|
+
zBaseConfig: ()=>zBaseConfig,
|
83
|
+
unfoldDimensions: ()=>unfoldDimensions,
|
84
|
+
areaAdvancedPipeline: ()=>areaAdvancedPipeline,
|
85
|
+
areaPercentSpecPipeline: ()=>areaPercentSpecPipeline,
|
86
|
+
Builder: ()=>Builder,
|
87
|
+
barParallelSpecPipeline: ()=>barParallelSpecPipeline,
|
88
|
+
registerBar: ()=>registerBar
|
89
|
+
});
|
90
|
+
const constant_FoldMeasureName = '__MeaName__';
|
91
|
+
const constant_FoldMeasureValue = '__MeaValue__';
|
92
|
+
const constant_FoldMeasureId = '__MeaId__';
|
93
|
+
const constant_UnfoldDimensionGroup = '__DimGroup__';
|
94
|
+
const Separator = '-';
|
95
|
+
const external_remeda_namespaceObject = require("remeda");
|
96
|
+
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = constant_UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
|
97
|
+
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
98
|
+
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
99
|
+
const unfoldInfo = {
|
100
|
+
groupName: foldGroupName,
|
101
|
+
colorItems: []
|
102
|
+
};
|
103
|
+
if (0 === dimensions.length || 0 === measures.length) return {
|
104
|
+
dataset,
|
105
|
+
unfoldInfo: {
|
106
|
+
groupName: foldGroupName,
|
107
|
+
colorItems: []
|
108
|
+
}
|
109
|
+
};
|
110
|
+
const colorItems = [];
|
111
|
+
for(let i = 0; i < dataset.length; i++){
|
112
|
+
const datum = dataset[i];
|
113
|
+
const colorItem = generateDimGroupName(dimensionsToBeUnfolded, datum, dimensionsSeparator);
|
114
|
+
datum[foldGroupName] = colorItem;
|
115
|
+
colorItems.push(colorItem);
|
116
|
+
}
|
117
|
+
unfoldInfo.colorItems = (0, external_remeda_namespaceObject.unique)(colorItems);
|
118
|
+
return {
|
119
|
+
dataset,
|
120
|
+
unfoldInfo
|
121
|
+
};
|
122
|
+
};
|
123
|
+
const generateDimGroupName = (dimensionsToBeGrouped, datum, dimensionsSeparator)=>dimensionsToBeGrouped.map((dim)=>String(datum[dim.id])).join(dimensionsSeparator);
|
124
|
+
const foldMeasures = (dataset, measures, measureId = constant_FoldMeasureId, measureName = constant_FoldMeasureName, measureValue = constant_FoldMeasureValue)=>{
|
125
|
+
const foldInfo = {
|
126
|
+
measureId,
|
127
|
+
measureName,
|
128
|
+
measureValue,
|
129
|
+
foldMap: {}
|
130
|
+
};
|
131
|
+
const result = new Array(dataset.length * measures.length);
|
132
|
+
let index = 0;
|
133
|
+
for(let i = 0; i < dataset.length; i++)for(let j = 0; j < measures.length; j++){
|
134
|
+
const datum = {
|
135
|
+
...dataset[i]
|
136
|
+
};
|
137
|
+
const measure = measures[j];
|
138
|
+
const { id, alias } = measure;
|
139
|
+
datum[measureId] = id;
|
140
|
+
datum[measureName] = alias;
|
141
|
+
datum[measureValue] = dataset[i][id];
|
142
|
+
foldInfo.foldMap[id] = alias;
|
143
|
+
result[index++] = datum;
|
144
|
+
}
|
145
|
+
return {
|
146
|
+
dataset: result,
|
147
|
+
foldInfo
|
148
|
+
};
|
149
|
+
};
|
150
|
+
const emptyReshapeResult = {
|
151
|
+
dataset: [],
|
152
|
+
foldInfo: {
|
153
|
+
foldMap: {},
|
154
|
+
measureId: '',
|
155
|
+
measureName: '',
|
156
|
+
measureValue: ''
|
157
|
+
},
|
158
|
+
unfoldInfo: {
|
159
|
+
colorItems: [],
|
160
|
+
groupName: ''
|
161
|
+
}
|
162
|
+
};
|
163
|
+
const dataReshapeFor2D1M = (dataset, dimensions, measures, options)=>{
|
164
|
+
const { foldMeasureId = constant_FoldMeasureId, foldMeasureName = constant_FoldMeasureName, foldMeasureValue = constant_FoldMeasureValue, unfoldDimensionGroup = constant_UnfoldDimensionGroup } = options || {};
|
165
|
+
if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
|
166
|
+
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
167
|
+
if (0 === dimensions.length) {
|
168
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
169
|
+
{
|
170
|
+
id: foldMeasureId,
|
171
|
+
alias: "\u6307\u6807Id",
|
172
|
+
location: 'dimension'
|
173
|
+
},
|
174
|
+
{
|
175
|
+
id: foldMeasureName,
|
176
|
+
alias: "\u6307\u6807\u540D\u79F0",
|
177
|
+
location: 'dimension'
|
178
|
+
}
|
179
|
+
], [
|
180
|
+
{
|
181
|
+
id: foldMeasureValue,
|
182
|
+
alias: "\u6307\u6807\u503C"
|
183
|
+
}
|
184
|
+
], 1, unfoldDimensionGroup);
|
185
|
+
return {
|
186
|
+
dataset: finalDataset,
|
187
|
+
foldInfo,
|
188
|
+
unfoldInfo
|
189
|
+
};
|
190
|
+
}
|
191
|
+
{
|
192
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
193
|
+
...dimensions,
|
194
|
+
{
|
195
|
+
id: foldMeasureName,
|
196
|
+
alias: "\u6307\u6807\u540D\u79F0",
|
197
|
+
location: 'dimension'
|
198
|
+
}
|
199
|
+
], [
|
200
|
+
{
|
201
|
+
id: foldMeasureValue,
|
202
|
+
alias: "\u6307\u6807\u503C"
|
203
|
+
}
|
204
|
+
], 1, unfoldDimensionGroup);
|
205
|
+
return {
|
206
|
+
dataset: finalDataset,
|
207
|
+
foldInfo,
|
208
|
+
unfoldInfo
|
209
|
+
};
|
210
|
+
}
|
211
|
+
};
|
212
|
+
const dataReshapeFor1D1M_emptyReshapeResult = {
|
213
|
+
dataset: [],
|
214
|
+
foldInfo: {
|
215
|
+
foldMap: {},
|
216
|
+
measureId: '',
|
217
|
+
measureName: '',
|
218
|
+
measureValue: ''
|
219
|
+
},
|
220
|
+
unfoldInfo: {
|
221
|
+
groupName: '',
|
222
|
+
colorItems: []
|
223
|
+
}
|
224
|
+
};
|
225
|
+
const dataReshapeFor1D1M_dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
226
|
+
const { foldMeasureId = constant_FoldMeasureId, foldMeasureName = constant_FoldMeasureName, foldMeasureValue = constant_FoldMeasureValue, unfoldDimensionGroup = constant_UnfoldDimensionGroup } = options || {};
|
227
|
+
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
228
|
+
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
229
|
+
if (0 === dimensions.length) {
|
230
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
231
|
+
{
|
232
|
+
id: foldMeasureName,
|
233
|
+
alias: "\u6307\u6807\u540D\u79F0",
|
234
|
+
location: 'dimension'
|
235
|
+
}
|
236
|
+
], [
|
237
|
+
{
|
238
|
+
id: foldMeasureValue,
|
239
|
+
alias: "\u6307\u6807\u503C"
|
240
|
+
}
|
241
|
+
], 0, unfoldDimensionGroup);
|
242
|
+
return {
|
243
|
+
dataset: finalDataset,
|
244
|
+
foldInfo,
|
245
|
+
unfoldInfo
|
246
|
+
};
|
247
|
+
}
|
248
|
+
{
|
249
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
250
|
+
...dimensions,
|
251
|
+
{
|
252
|
+
id: foldMeasureName,
|
253
|
+
alias: "\u6307\u6807\u540D\u79F0",
|
254
|
+
location: 'dimension'
|
255
|
+
}
|
256
|
+
], [
|
257
|
+
{
|
258
|
+
id: foldMeasureValue,
|
259
|
+
alias: "\u6307\u6807\u503C"
|
260
|
+
}
|
261
|
+
], 0, unfoldDimensionGroup);
|
262
|
+
return {
|
263
|
+
dataset: finalDataset,
|
264
|
+
foldInfo,
|
265
|
+
unfoldInfo
|
266
|
+
};
|
267
|
+
}
|
268
|
+
};
|
269
|
+
const reshapeTo2D1M = (advancedVSeed, context)=>{
|
270
|
+
const result = {
|
271
|
+
...advancedVSeed
|
272
|
+
};
|
273
|
+
const { vseed } = context;
|
274
|
+
const { dataset } = vseed;
|
275
|
+
const { dimensions, measures } = advancedVSeed;
|
276
|
+
if (!measures || !dimensions || !dataset) return result;
|
277
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
278
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, dimensions, measures);
|
279
|
+
return {
|
280
|
+
...result,
|
281
|
+
dataset: newDatasets,
|
282
|
+
datasetReshapeInfo: [
|
283
|
+
{
|
284
|
+
id: '2D1M',
|
285
|
+
foldInfo,
|
286
|
+
unfoldInfo
|
287
|
+
}
|
288
|
+
],
|
289
|
+
dimensions,
|
290
|
+
measures
|
291
|
+
};
|
292
|
+
};
|
293
|
+
const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
294
|
+
const result = {
|
295
|
+
...advancedVSeed
|
296
|
+
};
|
297
|
+
const { vseed } = context;
|
298
|
+
const { dataset } = vseed;
|
299
|
+
const { dimensions, measures } = advancedVSeed;
|
300
|
+
if (!measures || !dimensions) return result;
|
301
|
+
const measureGroups = [];
|
302
|
+
if (measures) measures.forEach((measure)=>{
|
303
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
304
|
+
});
|
305
|
+
const newDatasets = [];
|
306
|
+
const datasetReshapeInfo = [];
|
307
|
+
measureGroups.forEach((measureGroup)=>{
|
308
|
+
const measures = measureGroup.children;
|
309
|
+
if (!measures) return;
|
310
|
+
const groupId = measureGroup.id;
|
311
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, dimensions, measures, {
|
312
|
+
foldMeasureId: constant_FoldMeasureId + groupId,
|
313
|
+
foldMeasureName: constant_FoldMeasureName + groupId,
|
314
|
+
foldMeasureValue: constant_FoldMeasureValue + groupId,
|
315
|
+
unfoldDimensionGroup: constant_UnfoldDimensionGroup + groupId
|
316
|
+
});
|
317
|
+
const reshapeInfo = {
|
318
|
+
id: groupId,
|
319
|
+
foldInfo,
|
320
|
+
unfoldInfo
|
321
|
+
};
|
322
|
+
newDatasets.push(newSubDataset);
|
323
|
+
datasetReshapeInfo.push(reshapeInfo);
|
324
|
+
});
|
325
|
+
return {
|
326
|
+
...result,
|
327
|
+
dataset: newDatasets,
|
328
|
+
datasetReshapeInfo: datasetReshapeInfo
|
329
|
+
};
|
330
|
+
};
|
331
|
+
const encodingXY = (advancedVSeed)=>{
|
332
|
+
const result = {
|
333
|
+
...advancedVSeed
|
334
|
+
};
|
335
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
336
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
337
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
338
|
+
const { foldInfo, unfoldInfo } = cur;
|
339
|
+
const isSingleDimension = 0 === dimensions.length;
|
340
|
+
const x = [
|
341
|
+
isSingleDimension ? foldInfo.measureName : dimensions[0].id
|
342
|
+
];
|
343
|
+
const y = [
|
344
|
+
foldInfo.measureValue
|
345
|
+
];
|
346
|
+
const group = [
|
347
|
+
isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
|
348
|
+
];
|
349
|
+
const color = [
|
350
|
+
foldInfo.measureName
|
351
|
+
];
|
352
|
+
return [
|
353
|
+
...prev,
|
354
|
+
{
|
355
|
+
x,
|
356
|
+
y,
|
357
|
+
group,
|
358
|
+
color
|
359
|
+
}
|
360
|
+
];
|
361
|
+
}, []);
|
362
|
+
return {
|
363
|
+
...result,
|
364
|
+
encoding
|
365
|
+
};
|
366
|
+
};
|
367
|
+
const encodingYX = (advancedVSeed)=>{
|
368
|
+
const result = {
|
369
|
+
...advancedVSeed
|
370
|
+
};
|
371
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
372
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
373
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
374
|
+
const { foldInfo, unfoldInfo } = cur;
|
375
|
+
const isSingleDimension = 0 === dimensions.length;
|
376
|
+
const y = [
|
377
|
+
isSingleDimension ? foldInfo.measureName : dimensions[0].id
|
378
|
+
];
|
379
|
+
const x = [
|
380
|
+
foldInfo.measureValue
|
381
|
+
];
|
382
|
+
const group = [
|
383
|
+
isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
|
384
|
+
];
|
385
|
+
const color = [
|
386
|
+
foldInfo.measureName
|
387
|
+
];
|
388
|
+
return [
|
389
|
+
...prev,
|
390
|
+
{
|
391
|
+
x,
|
392
|
+
y,
|
393
|
+
group,
|
394
|
+
color
|
395
|
+
}
|
396
|
+
];
|
397
|
+
}, []);
|
398
|
+
return {
|
399
|
+
...result,
|
400
|
+
encoding
|
401
|
+
};
|
402
|
+
};
|
403
|
+
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
404
|
+
const { vseed } = context;
|
405
|
+
const { chartType = 'table' } = vseed;
|
406
|
+
return {
|
407
|
+
...advancedVSeed,
|
408
|
+
chartType
|
409
|
+
};
|
410
|
+
};
|
411
|
+
const autoMeasures = (advancedVSeed, context)=>{
|
412
|
+
const result = {
|
413
|
+
...advancedVSeed
|
414
|
+
};
|
415
|
+
const { vseed } = context;
|
416
|
+
const { measures, dataset } = vseed;
|
417
|
+
if (!dataset) throw new Error('dataset is required');
|
418
|
+
if (0 === dataset.length) return result;
|
419
|
+
if (measures) {
|
420
|
+
result.measures = measures;
|
421
|
+
return result;
|
422
|
+
}
|
423
|
+
const top100dataset = dataset.slice(0, 100);
|
424
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
425
|
+
...prev,
|
426
|
+
...cur
|
427
|
+
}), {});
|
428
|
+
result.measures = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
429
|
+
'',
|
430
|
+
null,
|
431
|
+
void 0
|
432
|
+
].includes(key)).map((measure)=>({
|
433
|
+
id: measure,
|
434
|
+
alias: measure
|
435
|
+
}));
|
436
|
+
return result;
|
437
|
+
};
|
438
|
+
const autoDimensions = (advancedVSeed, context)=>{
|
439
|
+
const result = {
|
440
|
+
...advancedVSeed
|
441
|
+
};
|
442
|
+
const { vseed } = context;
|
443
|
+
const { dimensions, dataset } = vseed;
|
444
|
+
const { measures = [] } = advancedVSeed;
|
445
|
+
if (!dataset) throw new Error('dataset is required');
|
446
|
+
if (0 === dataset.length) return result;
|
447
|
+
if (dimensions) {
|
448
|
+
result.dimensions = dimensions;
|
449
|
+
return result;
|
450
|
+
}
|
451
|
+
const top100dataset = dataset.slice(0, 100);
|
452
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
453
|
+
...prev,
|
454
|
+
...cur
|
455
|
+
}), {});
|
456
|
+
result.dimensions = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'string' == typeof item[key]) && ![
|
457
|
+
'',
|
458
|
+
null,
|
459
|
+
void 0
|
460
|
+
].includes(key) && !measures.some((measure)=>measure.id === key)).map((dim)=>({
|
461
|
+
id: dim,
|
462
|
+
alias: dim,
|
463
|
+
location: 'dimension'
|
464
|
+
}));
|
465
|
+
return result;
|
466
|
+
};
|
467
|
+
const vchartBaseConfig = (advancedVSeed, context)=>{
|
468
|
+
const { vseed } = context;
|
469
|
+
const result = {
|
470
|
+
...advancedVSeed
|
471
|
+
};
|
472
|
+
const config = (0, external_remeda_namespaceObject.pick)(vseed, [
|
473
|
+
'backgroundColor',
|
474
|
+
'color',
|
475
|
+
'label',
|
476
|
+
'legend',
|
477
|
+
'tooltip'
|
478
|
+
]);
|
479
|
+
result.baseConfig = {
|
480
|
+
vchart: {
|
481
|
+
...config
|
482
|
+
}
|
483
|
+
};
|
484
|
+
return result;
|
485
|
+
};
|
486
|
+
const vchartTheme = (advancedVSeed, context)=>{
|
487
|
+
const { customTheme, vseed } = context;
|
488
|
+
const { theme = 'light' } = vseed;
|
489
|
+
const result = {
|
490
|
+
...advancedVSeed
|
491
|
+
};
|
492
|
+
if (!customTheme || !customTheme[theme]) return result;
|
493
|
+
const config = result.baseConfig?.vchart;
|
494
|
+
const themeConfig = customTheme?.[theme].baseConfig?.vchart;
|
495
|
+
if (!themeConfig || !config) return result;
|
496
|
+
const mergedConfig = (0, external_remeda_namespaceObject.mergeDeep)(themeConfig, (0, external_remeda_namespaceObject.clone)(config));
|
497
|
+
result.baseConfig = {
|
498
|
+
vchart: mergedConfig
|
499
|
+
};
|
500
|
+
return result;
|
501
|
+
};
|
502
|
+
const execPipeline = (pipeline, context, initialValue = {})=>{
|
503
|
+
const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
|
504
|
+
return result;
|
505
|
+
};
|
506
|
+
const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
507
|
+
const { vseed } = context;
|
508
|
+
const { measures } = vseed;
|
509
|
+
if (measures && measures.find((measure)=>measure && measure.children)) return execPipeline(pivotPipeline, context, advancedVSeed);
|
510
|
+
return execPipeline(pipeline, context, advancedVSeed);
|
511
|
+
};
|
512
|
+
const lineAdvancedPipeline = [
|
513
|
+
initAdvancedVSeed,
|
514
|
+
autoMeasures,
|
515
|
+
autoDimensions,
|
516
|
+
pivotAdapter([
|
517
|
+
reshapeTo2D1M
|
518
|
+
], [
|
519
|
+
pivotReshapeTo2D1M
|
520
|
+
]),
|
521
|
+
encodingXY,
|
522
|
+
vchartBaseConfig,
|
523
|
+
vchartTheme
|
524
|
+
];
|
525
|
+
const barAdvancedPipeline = [
|
526
|
+
initAdvancedVSeed,
|
527
|
+
autoMeasures,
|
528
|
+
autoDimensions,
|
529
|
+
pivotAdapter([
|
530
|
+
reshapeTo2D1M
|
531
|
+
], [
|
532
|
+
pivotReshapeTo2D1M
|
533
|
+
]),
|
534
|
+
encodingYX,
|
535
|
+
vchartBaseConfig,
|
536
|
+
vchartTheme
|
537
|
+
];
|
538
|
+
const barParallelAdvancedPipeline = [
|
539
|
+
initAdvancedVSeed,
|
540
|
+
autoMeasures,
|
541
|
+
autoDimensions,
|
542
|
+
pivotAdapter([
|
543
|
+
reshapeTo2D1M
|
544
|
+
], [
|
545
|
+
pivotReshapeTo2D1M
|
546
|
+
]),
|
547
|
+
encodingYX,
|
548
|
+
vchartBaseConfig,
|
549
|
+
vchartTheme
|
550
|
+
];
|
551
|
+
const barPercentAdvancedPipeline = [
|
552
|
+
initAdvancedVSeed,
|
553
|
+
autoMeasures,
|
554
|
+
autoDimensions,
|
555
|
+
pivotAdapter([
|
556
|
+
reshapeTo2D1M
|
557
|
+
], [
|
558
|
+
pivotReshapeTo2D1M
|
559
|
+
]),
|
560
|
+
encodingYX,
|
561
|
+
vchartBaseConfig,
|
562
|
+
vchartTheme
|
563
|
+
];
|
564
|
+
const columnAdvancedPipeline = [
|
565
|
+
initAdvancedVSeed,
|
566
|
+
autoMeasures,
|
567
|
+
autoDimensions,
|
568
|
+
pivotAdapter([
|
569
|
+
reshapeTo2D1M
|
570
|
+
], [
|
571
|
+
pivotReshapeTo2D1M
|
572
|
+
]),
|
573
|
+
encodingXY,
|
574
|
+
vchartBaseConfig,
|
575
|
+
vchartTheme
|
576
|
+
];
|
577
|
+
const columnParallelAdvancedPipeline = [
|
578
|
+
initAdvancedVSeed,
|
579
|
+
autoMeasures,
|
580
|
+
autoDimensions,
|
581
|
+
pivotAdapter([
|
582
|
+
reshapeTo2D1M
|
583
|
+
], [
|
584
|
+
pivotReshapeTo2D1M
|
585
|
+
]),
|
586
|
+
encodingXY,
|
587
|
+
vchartBaseConfig,
|
588
|
+
vchartTheme
|
589
|
+
];
|
590
|
+
const columnPercentAdvancedPipeline = [
|
591
|
+
initAdvancedVSeed,
|
592
|
+
autoMeasures,
|
593
|
+
autoDimensions,
|
594
|
+
pivotAdapter([
|
595
|
+
reshapeTo2D1M
|
596
|
+
], [
|
597
|
+
pivotReshapeTo2D1M
|
598
|
+
]),
|
599
|
+
encodingXY,
|
600
|
+
vchartBaseConfig,
|
601
|
+
vchartTheme
|
602
|
+
];
|
603
|
+
const areaAdvancedPipeline = [
|
604
|
+
initAdvancedVSeed,
|
605
|
+
autoMeasures,
|
606
|
+
autoDimensions,
|
607
|
+
pivotAdapter([
|
608
|
+
reshapeTo2D1M
|
609
|
+
], [
|
610
|
+
pivotReshapeTo2D1M
|
611
|
+
]),
|
612
|
+
encodingXY,
|
613
|
+
vchartBaseConfig,
|
614
|
+
vchartTheme
|
615
|
+
];
|
616
|
+
const areaPercentAdvancedPipeline = [
|
617
|
+
initAdvancedVSeed,
|
618
|
+
autoMeasures,
|
619
|
+
autoDimensions,
|
620
|
+
pivotAdapter([
|
621
|
+
reshapeTo2D1M
|
622
|
+
], [
|
623
|
+
pivotReshapeTo2D1M
|
624
|
+
]),
|
625
|
+
encodingXY,
|
626
|
+
vchartBaseConfig,
|
627
|
+
vchartTheme
|
628
|
+
];
|
629
|
+
const dataset_dataset = (spec, context)=>{
|
630
|
+
const { advancedVSeed } = context;
|
631
|
+
return {
|
632
|
+
...spec,
|
633
|
+
data: {
|
634
|
+
values: advancedVSeed.dataset
|
635
|
+
}
|
636
|
+
};
|
637
|
+
};
|
638
|
+
const datasetPivot = (spec, context)=>{
|
639
|
+
const result = {
|
640
|
+
...spec
|
641
|
+
};
|
642
|
+
const { advancedVSeed } = context;
|
643
|
+
const { dataset, datasetReshapeInfo } = advancedVSeed;
|
644
|
+
const records = dataset.reduce((pre, cur, index)=>{
|
645
|
+
const id = datasetReshapeInfo[index].id;
|
646
|
+
pre[id] = cur;
|
647
|
+
return pre;
|
648
|
+
}, {});
|
649
|
+
return {
|
650
|
+
...result,
|
651
|
+
records: records
|
652
|
+
};
|
653
|
+
};
|
654
|
+
const datasetPivotPlaceholder = (spec)=>({
|
655
|
+
...spec,
|
656
|
+
data: {
|
657
|
+
id: 'placeholderDataId'
|
658
|
+
}
|
659
|
+
});
|
660
|
+
const initColumn = (spec, context)=>{
|
661
|
+
const result = {
|
662
|
+
...spec
|
663
|
+
};
|
664
|
+
const { advancedVSeed } = context;
|
665
|
+
const { encoding } = advancedVSeed;
|
666
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
667
|
+
result.type = 'bar';
|
668
|
+
result.direction = 'vertical';
|
669
|
+
result.xField = encoding[0].x[0];
|
670
|
+
result.yField = encoding[0].y[0];
|
671
|
+
result.seriesField = encoding[0].group[0];
|
672
|
+
result.padding = 0;
|
673
|
+
return result;
|
674
|
+
};
|
675
|
+
const initBar = (spec, context)=>{
|
676
|
+
const result = {
|
677
|
+
...spec
|
678
|
+
};
|
679
|
+
const { advancedVSeed } = context;
|
680
|
+
const { encoding } = advancedVSeed;
|
681
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
682
|
+
result.type = 'bar';
|
683
|
+
result.direction = 'horizontal';
|
684
|
+
result.yField = encoding[0].y?.[0];
|
685
|
+
result.xField = encoding[0].x?.[0];
|
686
|
+
result.seriesField = encoding[0].group?.[0];
|
687
|
+
result.padding = 0;
|
688
|
+
return result;
|
689
|
+
};
|
690
|
+
const initBarParallel = (spec, context)=>{
|
691
|
+
const result = {
|
692
|
+
...spec
|
693
|
+
};
|
694
|
+
const { advancedVSeed } = context;
|
695
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
696
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
697
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
698
|
+
result.type = 'bar';
|
699
|
+
result.direction = 'horizontal';
|
700
|
+
result.yField = [
|
701
|
+
encoding[0].y[0],
|
702
|
+
unfoldInfo.groupName
|
703
|
+
];
|
704
|
+
result.xField = encoding[0].x[0];
|
705
|
+
result.seriesField = encoding[0].group[0];
|
706
|
+
result.padding = 0;
|
707
|
+
return result;
|
708
|
+
};
|
709
|
+
const initArea = (spec, context)=>{
|
710
|
+
const result = {
|
711
|
+
...spec
|
712
|
+
};
|
713
|
+
const { advancedVSeed } = context;
|
714
|
+
const { encoding } = advancedVSeed;
|
715
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
716
|
+
result.type = 'area';
|
717
|
+
result.direction = 'vertical';
|
718
|
+
result.xField = encoding[0].x[0];
|
719
|
+
result.yField = encoding[0].y[0];
|
720
|
+
result.seriesField = encoding[0].group[0];
|
721
|
+
result.padding = 0;
|
722
|
+
return result;
|
723
|
+
};
|
724
|
+
const initLine = (spec, context)=>{
|
725
|
+
const result = {
|
726
|
+
...spec
|
727
|
+
};
|
728
|
+
const { advancedVSeed } = context;
|
729
|
+
const { encoding } = advancedVSeed;
|
730
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
731
|
+
result.type = 'line';
|
732
|
+
result.direction = 'vertical';
|
733
|
+
result.xField = encoding[0].x[0];
|
734
|
+
result.yField = encoding[0].y[0];
|
735
|
+
result.seriesField = encoding[0].group[0];
|
736
|
+
result.padding = 0;
|
737
|
+
return result;
|
738
|
+
};
|
739
|
+
const initColumnParallel = (spec, context)=>{
|
740
|
+
const result = {
|
741
|
+
...spec
|
742
|
+
};
|
743
|
+
const { advancedVSeed } = context;
|
744
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
745
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
746
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
747
|
+
result.type = 'bar';
|
748
|
+
result.direction = 'vertical';
|
749
|
+
result.xField = [
|
750
|
+
encoding[0].x[0],
|
751
|
+
unfoldInfo.groupName
|
752
|
+
];
|
753
|
+
result.yField = encoding[0].y[0];
|
754
|
+
result.seriesField = encoding[0].group[0];
|
755
|
+
result.padding = 0;
|
756
|
+
return result;
|
757
|
+
};
|
758
|
+
const initPivot = (spec)=>{
|
759
|
+
const result = {
|
760
|
+
...spec
|
761
|
+
};
|
762
|
+
return {
|
763
|
+
...result,
|
764
|
+
rows: [],
|
765
|
+
columns: [],
|
766
|
+
indicators: [],
|
767
|
+
records: [],
|
768
|
+
widthMode: 'adaptive',
|
769
|
+
heightMode: 'adaptive',
|
770
|
+
indicatorsAsCol: false
|
771
|
+
};
|
772
|
+
};
|
773
|
+
const xBand = (spec)=>{
|
774
|
+
const result = {
|
775
|
+
...spec
|
776
|
+
};
|
777
|
+
if (!result.axes) result.axes = [];
|
778
|
+
result.axes = [
|
779
|
+
...result.axes,
|
780
|
+
{
|
781
|
+
visible: true,
|
782
|
+
type: 'band',
|
783
|
+
orient: 'bottom'
|
784
|
+
}
|
785
|
+
];
|
786
|
+
return result;
|
787
|
+
};
|
788
|
+
const xLinear = (spec)=>{
|
789
|
+
const result = {
|
790
|
+
...spec
|
791
|
+
};
|
792
|
+
if (!result.axes) result.axes = [];
|
793
|
+
result.axes = [
|
794
|
+
...result.axes,
|
795
|
+
{
|
796
|
+
visible: true,
|
797
|
+
type: 'linear',
|
798
|
+
orient: 'bottom',
|
799
|
+
nice: true,
|
800
|
+
zero: true
|
801
|
+
}
|
802
|
+
];
|
803
|
+
return result;
|
804
|
+
};
|
805
|
+
const yBand = (spec)=>{
|
806
|
+
const result = {
|
807
|
+
...spec
|
808
|
+
};
|
809
|
+
if (!result.axes) result.axes = [];
|
810
|
+
result.axes = [
|
811
|
+
...result.axes,
|
812
|
+
{
|
813
|
+
visible: true,
|
814
|
+
type: 'band',
|
815
|
+
orient: 'left'
|
816
|
+
}
|
817
|
+
];
|
818
|
+
return result;
|
819
|
+
};
|
820
|
+
const yLinear = (spec)=>{
|
821
|
+
const result = {
|
822
|
+
...spec
|
823
|
+
};
|
824
|
+
if (!result.axes) result.axes = [];
|
825
|
+
result.axes = [
|
826
|
+
...result.axes,
|
827
|
+
{
|
828
|
+
visible: true,
|
829
|
+
type: 'linear',
|
830
|
+
orient: 'left',
|
831
|
+
nice: true,
|
832
|
+
zero: true
|
833
|
+
}
|
834
|
+
];
|
835
|
+
return result;
|
836
|
+
};
|
837
|
+
const percent = (spec, context)=>{
|
838
|
+
const result = {
|
839
|
+
...spec
|
840
|
+
};
|
841
|
+
result.percent = true;
|
842
|
+
return result;
|
843
|
+
};
|
844
|
+
const stack = (spec, context)=>{
|
845
|
+
const result = {
|
846
|
+
...spec
|
847
|
+
};
|
848
|
+
result.stack = true;
|
849
|
+
return result;
|
850
|
+
};
|
851
|
+
const background_backgroundColor = (spec, context)=>{
|
852
|
+
const result = {
|
853
|
+
...spec
|
854
|
+
};
|
855
|
+
const { advancedVSeed } = context;
|
856
|
+
const { baseConfig } = advancedVSeed;
|
857
|
+
if (!baseConfig?.vchart) return result;
|
858
|
+
const { backgroundColor } = baseConfig.vchart;
|
859
|
+
return {
|
860
|
+
...result,
|
861
|
+
background: backgroundColor
|
862
|
+
};
|
863
|
+
};
|
864
|
+
const defaultTooltip = {
|
865
|
+
enable: true
|
866
|
+
};
|
867
|
+
const tooltip_tooltip = (spec, context)=>{
|
868
|
+
const result = {
|
869
|
+
...spec
|
870
|
+
};
|
871
|
+
const { advancedVSeed } = context;
|
872
|
+
const baseConfig = advancedVSeed.baseConfig.vchart;
|
873
|
+
const { tooltip = defaultTooltip } = baseConfig;
|
874
|
+
const { enable } = tooltip;
|
875
|
+
result.tooltip = {
|
876
|
+
visible: enable
|
877
|
+
};
|
878
|
+
return result;
|
879
|
+
};
|
880
|
+
const label_label = (spec, context)=>{
|
881
|
+
const result = {
|
882
|
+
...spec
|
883
|
+
};
|
884
|
+
const { advancedVSeed } = context;
|
885
|
+
const baseConfig = advancedVSeed.baseConfig.vchart;
|
886
|
+
if (!baseConfig || !baseConfig.label) return result;
|
887
|
+
const { label } = baseConfig;
|
888
|
+
const { enable } = label;
|
889
|
+
result.label = {
|
890
|
+
visible: enable
|
891
|
+
};
|
892
|
+
return result;
|
893
|
+
};
|
894
|
+
const defaultLegend = {
|
895
|
+
enable: true
|
896
|
+
};
|
897
|
+
const legend_legend = (spec, context)=>{
|
898
|
+
const result = {
|
899
|
+
...spec
|
900
|
+
};
|
901
|
+
const { advancedVSeed } = context;
|
902
|
+
const baseConfig = advancedVSeed.baseConfig.vchart;
|
903
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
904
|
+
const { legend = defaultLegend } = baseConfig;
|
905
|
+
const { enable } = legend;
|
906
|
+
result.legends = {
|
907
|
+
visible: enable
|
908
|
+
};
|
909
|
+
return result;
|
910
|
+
};
|
911
|
+
const pivotLegend = (spec, context)=>{
|
912
|
+
const result = {
|
913
|
+
...spec
|
914
|
+
};
|
915
|
+
const { advancedVSeed } = context;
|
916
|
+
const baseConfig = advancedVSeed.baseConfig.vchart;
|
917
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
918
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
919
|
+
const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
920
|
+
const { legend, color } = baseConfig;
|
921
|
+
const { enable } = legend;
|
922
|
+
const { colorScheme } = color;
|
923
|
+
result.legends = {
|
924
|
+
visible: enable,
|
925
|
+
alignSelf: 'end',
|
926
|
+
type: 'discrete',
|
927
|
+
position: 'start',
|
928
|
+
data: colorItems.map((d, index)=>({
|
929
|
+
label: d,
|
930
|
+
shape: {
|
931
|
+
symbolType: 'square',
|
932
|
+
fill: colorScheme[index]
|
933
|
+
}
|
934
|
+
})),
|
935
|
+
orient: 'bottom'
|
936
|
+
};
|
937
|
+
return result;
|
938
|
+
};
|
939
|
+
const color_color = (spec, context)=>{
|
940
|
+
const result = {
|
941
|
+
...spec
|
942
|
+
};
|
943
|
+
const { advancedVSeed } = context;
|
944
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
945
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
946
|
+
const baseConfig = advancedVSeed.baseConfig.vchart;
|
947
|
+
if (!baseConfig || !baseConfig.color) return result;
|
948
|
+
const { color } = baseConfig;
|
949
|
+
const { colorScheme, colorMapping } = color;
|
950
|
+
result.color = {
|
951
|
+
type: 'ordinal',
|
952
|
+
domain: unfoldInfo.colorItems,
|
953
|
+
range: colorScheme,
|
954
|
+
specified: colorMapping
|
955
|
+
};
|
956
|
+
return result;
|
957
|
+
};
|
958
|
+
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
959
|
+
const { advancedVSeed } = context;
|
960
|
+
const { measures } = advancedVSeed;
|
961
|
+
if (measures && measures.find((measure)=>measure && measure.children)) return execPipeline(pivotPipeline, context, spec);
|
962
|
+
return execPipeline(pipeline, context, spec);
|
963
|
+
};
|
964
|
+
const pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
965
|
+
const result = {
|
966
|
+
...spec
|
967
|
+
};
|
968
|
+
const { advancedVSeed } = context;
|
969
|
+
const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
|
970
|
+
const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
971
|
+
const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
|
972
|
+
const measure = measures?.find((d)=>d.id === reshapeInfo.id);
|
973
|
+
const newEncoding = [
|
974
|
+
encoding[index]
|
975
|
+
];
|
976
|
+
const newDatasetReshapeInfo = [
|
977
|
+
{
|
978
|
+
...reshapeInfo,
|
979
|
+
unfoldInfo: {
|
980
|
+
...reshapeInfo.unfoldInfo,
|
981
|
+
colorItems
|
982
|
+
}
|
983
|
+
}
|
984
|
+
];
|
985
|
+
const newContext = {
|
986
|
+
...context,
|
987
|
+
advancedVSeed: {
|
988
|
+
...advancedVSeed,
|
989
|
+
datasetReshapeInfo: newDatasetReshapeInfo,
|
990
|
+
encoding: newEncoding
|
991
|
+
}
|
992
|
+
};
|
993
|
+
const chartSpec = execPipeline(chartPipeline, newContext, {});
|
994
|
+
return {
|
995
|
+
indicatorKey: reshapeInfo.id,
|
996
|
+
title: measure?.alias,
|
997
|
+
cellType: 'chart',
|
998
|
+
chartModule: 'vchart',
|
999
|
+
chartSpec: chartSpec,
|
1000
|
+
style: {
|
1001
|
+
padding: [
|
1002
|
+
1,
|
1003
|
+
1,
|
1004
|
+
0,
|
1005
|
+
1
|
1006
|
+
]
|
1007
|
+
}
|
1008
|
+
};
|
1009
|
+
});
|
1010
|
+
return {
|
1011
|
+
...result,
|
1012
|
+
indicators: indicators
|
1013
|
+
};
|
1014
|
+
};
|
1015
|
+
const pivotIndicators_pivotIndicatorsAsRow = (spec)=>{
|
1016
|
+
const result = {
|
1017
|
+
...spec
|
1018
|
+
};
|
1019
|
+
return {
|
1020
|
+
...result,
|
1021
|
+
indicatorsAsCol: false
|
1022
|
+
};
|
1023
|
+
};
|
1024
|
+
const pivotIndicators_pivotIndicatorsAsCol = (spec)=>{
|
1025
|
+
const result = {
|
1026
|
+
...spec
|
1027
|
+
};
|
1028
|
+
return {
|
1029
|
+
...result,
|
1030
|
+
indicatorsAsCol: true
|
1031
|
+
};
|
1032
|
+
};
|
1033
|
+
const line = [
|
1034
|
+
initLine,
|
1035
|
+
color_color,
|
1036
|
+
background_backgroundColor,
|
1037
|
+
dataset_dataset,
|
1038
|
+
xBand,
|
1039
|
+
yLinear,
|
1040
|
+
label_label,
|
1041
|
+
tooltip_tooltip,
|
1042
|
+
legend_legend
|
1043
|
+
];
|
1044
|
+
const pivotLine = [
|
1045
|
+
initPivot,
|
1046
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1047
|
+
datasetPivot,
|
1048
|
+
pivotIndicators([
|
1049
|
+
initLine,
|
1050
|
+
color_color,
|
1051
|
+
background_backgroundColor,
|
1052
|
+
datasetPivotPlaceholder,
|
1053
|
+
xBand,
|
1054
|
+
yLinear,
|
1055
|
+
label_label,
|
1056
|
+
tooltip_tooltip
|
1057
|
+
]),
|
1058
|
+
pivotLegend
|
1059
|
+
];
|
1060
|
+
const lineSpecPipeline = [
|
1061
|
+
pivotAdapter_pivotAdapter(line, pivotLine)
|
1062
|
+
];
|
1063
|
+
const column = [
|
1064
|
+
initColumn,
|
1065
|
+
color_color,
|
1066
|
+
background_backgroundColor,
|
1067
|
+
dataset_dataset,
|
1068
|
+
xBand,
|
1069
|
+
yLinear,
|
1070
|
+
label_label,
|
1071
|
+
tooltip_tooltip,
|
1072
|
+
legend_legend
|
1073
|
+
];
|
1074
|
+
const pivotColumn = [
|
1075
|
+
initPivot,
|
1076
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1077
|
+
datasetPivot,
|
1078
|
+
pivotIndicators([
|
1079
|
+
initColumn,
|
1080
|
+
color_color,
|
1081
|
+
background_backgroundColor,
|
1082
|
+
datasetPivotPlaceholder,
|
1083
|
+
xBand,
|
1084
|
+
yLinear,
|
1085
|
+
label_label,
|
1086
|
+
tooltip_tooltip
|
1087
|
+
]),
|
1088
|
+
pivotLegend
|
1089
|
+
];
|
1090
|
+
const columnSpecPipeline = [
|
1091
|
+
pivotAdapter_pivotAdapter(column, pivotColumn)
|
1092
|
+
];
|
1093
|
+
const columnParallel = [
|
1094
|
+
initColumnParallel,
|
1095
|
+
color_color,
|
1096
|
+
background_backgroundColor,
|
1097
|
+
dataset_dataset,
|
1098
|
+
xBand,
|
1099
|
+
yLinear,
|
1100
|
+
label_label,
|
1101
|
+
tooltip_tooltip,
|
1102
|
+
legend_legend
|
1103
|
+
];
|
1104
|
+
const pivotColumnParallel = [
|
1105
|
+
initPivot,
|
1106
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1107
|
+
datasetPivot,
|
1108
|
+
pivotIndicators([
|
1109
|
+
initColumnParallel,
|
1110
|
+
color_color,
|
1111
|
+
background_backgroundColor,
|
1112
|
+
datasetPivotPlaceholder,
|
1113
|
+
xBand,
|
1114
|
+
yLinear,
|
1115
|
+
label_label,
|
1116
|
+
tooltip_tooltip
|
1117
|
+
]),
|
1118
|
+
pivotLegend
|
1119
|
+
];
|
1120
|
+
const columnParallelSpecPipeline = [
|
1121
|
+
pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
|
1122
|
+
];
|
1123
|
+
const columnPercent = [
|
1124
|
+
initColumn,
|
1125
|
+
color_color,
|
1126
|
+
background_backgroundColor,
|
1127
|
+
percent,
|
1128
|
+
dataset_dataset,
|
1129
|
+
xBand,
|
1130
|
+
yLinear,
|
1131
|
+
label_label,
|
1132
|
+
tooltip_tooltip,
|
1133
|
+
legend_legend
|
1134
|
+
];
|
1135
|
+
const pivotColumnPercent = [
|
1136
|
+
initPivot,
|
1137
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1138
|
+
datasetPivot,
|
1139
|
+
pivotIndicators([
|
1140
|
+
initColumn,
|
1141
|
+
color_color,
|
1142
|
+
percent,
|
1143
|
+
background_backgroundColor,
|
1144
|
+
datasetPivotPlaceholder,
|
1145
|
+
xBand,
|
1146
|
+
yLinear,
|
1147
|
+
label_label,
|
1148
|
+
tooltip_tooltip
|
1149
|
+
]),
|
1150
|
+
pivotLegend
|
1151
|
+
];
|
1152
|
+
const columnPercentSpecPipeline = [
|
1153
|
+
pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
|
1154
|
+
];
|
1155
|
+
const bar = [
|
1156
|
+
initBar,
|
1157
|
+
color_color,
|
1158
|
+
background_backgroundColor,
|
1159
|
+
dataset_dataset,
|
1160
|
+
xLinear,
|
1161
|
+
yBand,
|
1162
|
+
label_label,
|
1163
|
+
tooltip_tooltip,
|
1164
|
+
legend_legend
|
1165
|
+
];
|
1166
|
+
const pivotBar = [
|
1167
|
+
initPivot,
|
1168
|
+
pivotIndicators_pivotIndicatorsAsCol,
|
1169
|
+
datasetPivot,
|
1170
|
+
pivotIndicators([
|
1171
|
+
initBar,
|
1172
|
+
color_color,
|
1173
|
+
background_backgroundColor,
|
1174
|
+
datasetPivotPlaceholder,
|
1175
|
+
yBand,
|
1176
|
+
label_label,
|
1177
|
+
label_label,
|
1178
|
+
tooltip_tooltip
|
1179
|
+
]),
|
1180
|
+
pivotLegend
|
1181
|
+
];
|
1182
|
+
const barSpecPipeline = [
|
1183
|
+
pivotAdapter_pivotAdapter(bar, pivotBar)
|
1184
|
+
];
|
1185
|
+
const barParallel = [
|
1186
|
+
initBarParallel,
|
1187
|
+
color_color,
|
1188
|
+
background_backgroundColor,
|
1189
|
+
dataset_dataset,
|
1190
|
+
xLinear,
|
1191
|
+
yBand,
|
1192
|
+
label_label,
|
1193
|
+
tooltip_tooltip,
|
1194
|
+
legend_legend
|
1195
|
+
];
|
1196
|
+
const pivotBarParallel = [
|
1197
|
+
initPivot,
|
1198
|
+
pivotIndicators_pivotIndicatorsAsCol,
|
1199
|
+
datasetPivot,
|
1200
|
+
pivotIndicators([
|
1201
|
+
initBarParallel,
|
1202
|
+
color_color,
|
1203
|
+
background_backgroundColor,
|
1204
|
+
datasetPivotPlaceholder,
|
1205
|
+
yBand,
|
1206
|
+
xLinear,
|
1207
|
+
label_label,
|
1208
|
+
tooltip_tooltip
|
1209
|
+
]),
|
1210
|
+
pivotLegend
|
1211
|
+
];
|
1212
|
+
const barParallelSpecPipeline = [
|
1213
|
+
pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
|
1214
|
+
];
|
1215
|
+
const barPercent = [
|
1216
|
+
initBar,
|
1217
|
+
color_color,
|
1218
|
+
background_backgroundColor,
|
1219
|
+
percent,
|
1220
|
+
dataset_dataset,
|
1221
|
+
xLinear,
|
1222
|
+
yBand,
|
1223
|
+
label_label,
|
1224
|
+
tooltip_tooltip,
|
1225
|
+
legend_legend
|
1226
|
+
];
|
1227
|
+
const pivotBarPercent = [
|
1228
|
+
initPivot,
|
1229
|
+
pivotIndicators_pivotIndicatorsAsCol,
|
1230
|
+
datasetPivot,
|
1231
|
+
pivotIndicators([
|
1232
|
+
initBar,
|
1233
|
+
color_color,
|
1234
|
+
background_backgroundColor,
|
1235
|
+
percent,
|
1236
|
+
datasetPivotPlaceholder,
|
1237
|
+
yBand,
|
1238
|
+
xLinear,
|
1239
|
+
label_label,
|
1240
|
+
tooltip_tooltip
|
1241
|
+
]),
|
1242
|
+
pivotLegend
|
1243
|
+
];
|
1244
|
+
const barPercentSpecPipeline = [
|
1245
|
+
pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
|
1246
|
+
];
|
1247
|
+
const area_area = [
|
1248
|
+
initArea,
|
1249
|
+
color_color,
|
1250
|
+
background_backgroundColor,
|
1251
|
+
stack,
|
1252
|
+
dataset_dataset,
|
1253
|
+
xBand,
|
1254
|
+
yLinear,
|
1255
|
+
label_label,
|
1256
|
+
tooltip_tooltip,
|
1257
|
+
legend_legend
|
1258
|
+
];
|
1259
|
+
const pivotArea = [
|
1260
|
+
initPivot,
|
1261
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1262
|
+
datasetPivot,
|
1263
|
+
pivotIndicators([
|
1264
|
+
initArea,
|
1265
|
+
color_color,
|
1266
|
+
background_backgroundColor,
|
1267
|
+
stack,
|
1268
|
+
datasetPivotPlaceholder,
|
1269
|
+
xBand,
|
1270
|
+
yLinear,
|
1271
|
+
label_label,
|
1272
|
+
tooltip_tooltip
|
1273
|
+
]),
|
1274
|
+
pivotLegend
|
1275
|
+
];
|
1276
|
+
const areaSpecPipeline = [
|
1277
|
+
pivotAdapter_pivotAdapter(area_area, pivotArea)
|
1278
|
+
];
|
1279
|
+
const areaPercent = [
|
1280
|
+
initArea,
|
1281
|
+
color_color,
|
1282
|
+
background_backgroundColor,
|
1283
|
+
percent,
|
1284
|
+
dataset_dataset,
|
1285
|
+
xBand,
|
1286
|
+
yLinear,
|
1287
|
+
label_label,
|
1288
|
+
tooltip_tooltip,
|
1289
|
+
legend_legend
|
1290
|
+
];
|
1291
|
+
const pivotAreaPercent = [
|
1292
|
+
initPivot,
|
1293
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1294
|
+
datasetPivot,
|
1295
|
+
pivotIndicators([
|
1296
|
+
initArea,
|
1297
|
+
color_color,
|
1298
|
+
background_backgroundColor,
|
1299
|
+
percent,
|
1300
|
+
datasetPivotPlaceholder,
|
1301
|
+
xBand,
|
1302
|
+
yLinear,
|
1303
|
+
label_label,
|
1304
|
+
tooltip_tooltip
|
1305
|
+
]),
|
1306
|
+
pivotLegend
|
1307
|
+
];
|
1308
|
+
const areaPercentSpecPipeline = [
|
1309
|
+
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
1310
|
+
];
|
1311
|
+
const isVTable = (chartType)=>[
|
1312
|
+
'table',
|
1313
|
+
'pivotTable'
|
1314
|
+
].includes(chartType);
|
1315
|
+
const isVChart = (chartType)=>!isVTable(chartType);
|
1316
|
+
const buildAdvanced = (builder)=>{
|
1317
|
+
const { chartType } = builder.vseed;
|
1318
|
+
if (!chartType) throw new Error('chartType is nil in buildAdvanced');
|
1319
|
+
const pipeline = builder.getAdvancedPipeline(chartType);
|
1320
|
+
if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
|
1321
|
+
const context = {
|
1322
|
+
vseed: builder.vseed,
|
1323
|
+
customTheme: builder.getThemeMap()
|
1324
|
+
};
|
1325
|
+
try {
|
1326
|
+
return execPipeline(pipeline, context);
|
1327
|
+
} catch (e) {
|
1328
|
+
console.error(e);
|
1329
|
+
throw new Error("buildAdvanced error, see error info in console");
|
1330
|
+
}
|
1331
|
+
};
|
1332
|
+
const buildSpec = (builder, advancedVSeed)=>{
|
1333
|
+
const { chartType } = builder.vseed;
|
1334
|
+
if (!chartType) throw new Error('chartType is nil in buildSpec');
|
1335
|
+
const pipeline = builder.getSpecPipeline(chartType);
|
1336
|
+
if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
|
1337
|
+
const context = {
|
1338
|
+
vseed: builder.vseed,
|
1339
|
+
advancedVSeed
|
1340
|
+
};
|
1341
|
+
try {
|
1342
|
+
return execPipeline(pipeline, context);
|
1343
|
+
} catch (e) {
|
1344
|
+
console.error(e);
|
1345
|
+
throw new Error("buildSpec error, see error info in console");
|
1346
|
+
}
|
1347
|
+
};
|
1348
|
+
const build = (builder)=>{
|
1349
|
+
console.log('debug vseed', builder.vseed);
|
1350
|
+
const advancedVSeed = builder.buildAdvanced();
|
1351
|
+
console.log('debug advancedVSeed', advancedVSeed);
|
1352
|
+
if (!advancedVSeed) throw new Error('advancedVSeed is null');
|
1353
|
+
const spec = builder.buildSpec(advancedVSeed);
|
1354
|
+
console.log('debug spec', spec);
|
1355
|
+
return spec;
|
1356
|
+
};
|
1357
|
+
class Builder {
|
1358
|
+
_vseed;
|
1359
|
+
_advancedVSeed = null;
|
1360
|
+
constructor(vseed){
|
1361
|
+
this._vseed = vseed;
|
1362
|
+
}
|
1363
|
+
build = ()=>build(this);
|
1364
|
+
buildSpec = (advanced)=>buildSpec(this, advanced);
|
1365
|
+
buildAdvanced = ()=>buildAdvanced(this);
|
1366
|
+
getAdvancedPipeline = (chartType)=>Builder._advancedPipelineMap[chartType];
|
1367
|
+
getSpecPipeline = (chartType)=>Builder._specPipelineMap[chartType];
|
1368
|
+
getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
1369
|
+
getThemeMap = ()=>Builder._themeMap;
|
1370
|
+
get vseed() {
|
1371
|
+
return this._vseed;
|
1372
|
+
}
|
1373
|
+
set vseed(value) {
|
1374
|
+
this._vseed = value;
|
1375
|
+
}
|
1376
|
+
get advancedVSeed() {
|
1377
|
+
return this._advancedVSeed;
|
1378
|
+
}
|
1379
|
+
set advancedVSeed(value) {
|
1380
|
+
this._advancedVSeed = value;
|
1381
|
+
}
|
1382
|
+
static _advancedPipelineMap = {};
|
1383
|
+
static _specPipelineMap = {};
|
1384
|
+
static _themeMap = {};
|
1385
|
+
static from = (vseed)=>new Builder(vseed);
|
1386
|
+
}
|
1387
|
+
const registerColumn = ()=>{
|
1388
|
+
Builder._advancedPipelineMap.column = columnAdvancedPipeline;
|
1389
|
+
Builder._specPipelineMap.column = columnSpecPipeline;
|
1390
|
+
};
|
1391
|
+
const registerBar = ()=>{
|
1392
|
+
Builder._advancedPipelineMap.bar = barAdvancedPipeline;
|
1393
|
+
Builder._specPipelineMap.bar = barSpecPipeline;
|
1394
|
+
};
|
1395
|
+
const registerLine = ()=>{
|
1396
|
+
Builder._advancedPipelineMap.line = lineAdvancedPipeline;
|
1397
|
+
Builder._specPipelineMap.line = lineSpecPipeline;
|
1398
|
+
};
|
1399
|
+
const registerArea = ()=>{
|
1400
|
+
Builder._advancedPipelineMap.area = areaAdvancedPipeline;
|
1401
|
+
Builder._specPipelineMap.area = areaSpecPipeline;
|
1402
|
+
};
|
1403
|
+
const registerAreaPercent = ()=>{
|
1404
|
+
Builder._advancedPipelineMap.areaPercent = areaPercentAdvancedPipeline;
|
1405
|
+
Builder._specPipelineMap.areaPercent = areaPercentSpecPipeline;
|
1406
|
+
};
|
1407
|
+
const registerBarPercent = ()=>{
|
1408
|
+
Builder._advancedPipelineMap.barPercent = barPercentAdvancedPipeline;
|
1409
|
+
Builder._specPipelineMap.barPercent = barPercentSpecPipeline;
|
1410
|
+
};
|
1411
|
+
const registerColumnPercent = ()=>{
|
1412
|
+
Builder._advancedPipelineMap.columnPercent = columnPercentAdvancedPipeline;
|
1413
|
+
Builder._specPipelineMap.columnPercent = columnPercentSpecPipeline;
|
1414
|
+
};
|
1415
|
+
const registerColumnParallel = ()=>{
|
1416
|
+
Builder._advancedPipelineMap.columnParallel = columnParallelAdvancedPipeline;
|
1417
|
+
Builder._specPipelineMap.columnParallel = columnParallelSpecPipeline;
|
1418
|
+
};
|
1419
|
+
const registerBarParallel = ()=>{
|
1420
|
+
Builder._advancedPipelineMap.barParallel = barParallelAdvancedPipeline;
|
1421
|
+
Builder._specPipelineMap.barParallel = barParallelSpecPipeline;
|
1422
|
+
};
|
1423
|
+
const lightTheme = ()=>({
|
1424
|
+
baseConfig: {
|
1425
|
+
vtable: {
|
1426
|
+
backgroundColor: '#ffffff'
|
1427
|
+
},
|
1428
|
+
vchart: {
|
1429
|
+
backgroundColor: '#ffffff',
|
1430
|
+
color: {
|
1431
|
+
colorScheme: [
|
1432
|
+
'#8D72F6',
|
1433
|
+
'#5766EC',
|
1434
|
+
'#66A3FE',
|
1435
|
+
'#51D5E6',
|
1436
|
+
'#4EC0B3',
|
1437
|
+
'#F9DF90',
|
1438
|
+
'#F9AD71',
|
1439
|
+
'#ED8888',
|
1440
|
+
'#E9A0C3',
|
1441
|
+
'#D77DD3'
|
1442
|
+
]
|
1443
|
+
},
|
1444
|
+
label: {
|
1445
|
+
enable: true
|
1446
|
+
},
|
1447
|
+
tooltip: {
|
1448
|
+
enable: true
|
1449
|
+
},
|
1450
|
+
legend: {
|
1451
|
+
enable: true
|
1452
|
+
}
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
});
|
1456
|
+
const darkTheme = ()=>({
|
1457
|
+
baseConfig: {
|
1458
|
+
vtable: {
|
1459
|
+
backgroundColor: '#141414'
|
1460
|
+
},
|
1461
|
+
vchart: {
|
1462
|
+
backgroundColor: '#141414',
|
1463
|
+
color: {
|
1464
|
+
colorScheme: [
|
1465
|
+
'#2E62F1',
|
1466
|
+
'#4DC36A',
|
1467
|
+
'#FF8406',
|
1468
|
+
'#FFCC00',
|
1469
|
+
'#4F44CF',
|
1470
|
+
'#5AC8FA',
|
1471
|
+
'#003A8C',
|
1472
|
+
'#B08AE2',
|
1473
|
+
'#FF6341',
|
1474
|
+
'#98DD62'
|
1475
|
+
]
|
1476
|
+
},
|
1477
|
+
label: {
|
1478
|
+
enable: true
|
1479
|
+
},
|
1480
|
+
tooltip: {
|
1481
|
+
enable: true
|
1482
|
+
},
|
1483
|
+
legend: {
|
1484
|
+
enable: true
|
1485
|
+
}
|
1486
|
+
}
|
1487
|
+
}
|
1488
|
+
});
|
1489
|
+
const registerCustomTheme = (key, themeConfig)=>{
|
1490
|
+
Builder._themeMap[key] = themeConfig;
|
1491
|
+
};
|
1492
|
+
const registerLightTheme = ()=>{
|
1493
|
+
registerCustomTheme('light', lightTheme());
|
1494
|
+
};
|
1495
|
+
const registerDarkTheme = ()=>{
|
1496
|
+
registerCustomTheme('dark', darkTheme());
|
1497
|
+
};
|
1498
|
+
const all_registerAll = ()=>{
|
1499
|
+
registerLine();
|
1500
|
+
registerColumn();
|
1501
|
+
registerColumnParallel();
|
1502
|
+
registerColumnPercent();
|
1503
|
+
registerBar();
|
1504
|
+
registerBarParallel();
|
1505
|
+
registerBarPercent();
|
1506
|
+
registerArea();
|
1507
|
+
registerAreaPercent();
|
1508
|
+
registerLightTheme();
|
1509
|
+
registerDarkTheme();
|
1510
|
+
};
|
1511
|
+
const external_zod_namespaceObject = require("zod");
|
1512
|
+
const zChartType = external_zod_namespaceObject.z["enum"]([
|
1513
|
+
'table',
|
1514
|
+
'pivotTable',
|
1515
|
+
'line',
|
1516
|
+
'column',
|
1517
|
+
'columnPercent',
|
1518
|
+
'columnParallel',
|
1519
|
+
'bar',
|
1520
|
+
'barPercent',
|
1521
|
+
'barParallel',
|
1522
|
+
'area',
|
1523
|
+
'areaPercent',
|
1524
|
+
'rose',
|
1525
|
+
'pie',
|
1526
|
+
'donut',
|
1527
|
+
'dualAxis'
|
1528
|
+
]);
|
1529
|
+
const zDatum = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.number()), external_zod_namespaceObject.z.any());
|
1530
|
+
const zDataset = external_zod_namespaceObject.z.array(zDatum);
|
1531
|
+
const zDimension = external_zod_namespaceObject.z.object({
|
1532
|
+
id: external_zod_namespaceObject.z.string(),
|
1533
|
+
alias: external_zod_namespaceObject.z.string().optional(),
|
1534
|
+
visible: external_zod_namespaceObject.z.boolean().default(true).optional(),
|
1535
|
+
location: external_zod_namespaceObject.z["enum"]([
|
1536
|
+
'dimension',
|
1537
|
+
'rowDimension',
|
1538
|
+
'columnDimension'
|
1539
|
+
])
|
1540
|
+
});
|
1541
|
+
const zDimensions = external_zod_namespaceObject.z.array(zDimension).optional();
|
1542
|
+
const zMeasure = external_zod_namespaceObject.z.object({
|
1543
|
+
id: external_zod_namespaceObject.z.string(),
|
1544
|
+
alias: external_zod_namespaceObject.z.string().optional(),
|
1545
|
+
visible: external_zod_namespaceObject.z.boolean().default(true).optional(),
|
1546
|
+
autoFormat: external_zod_namespaceObject.z.boolean().default(true).optional(),
|
1547
|
+
format: external_zod_namespaceObject.z.object({
|
1548
|
+
type: external_zod_namespaceObject.z["enum"]([
|
1549
|
+
'number',
|
1550
|
+
'percent',
|
1551
|
+
'permille'
|
1552
|
+
]).optional().default('number'),
|
1553
|
+
ratio: external_zod_namespaceObject.z.number().optional().default(1),
|
1554
|
+
symbol: external_zod_namespaceObject.z.string().optional().default(''),
|
1555
|
+
thousandSeparator: external_zod_namespaceObject.z.boolean().optional().default(false),
|
1556
|
+
decimalPlaces: external_zod_namespaceObject.z.number().optional().default(2),
|
1557
|
+
round: external_zod_namespaceObject.z["enum"]([
|
1558
|
+
'round',
|
1559
|
+
'floor',
|
1560
|
+
'ceil'
|
1561
|
+
]).optional().default('round'),
|
1562
|
+
prefix: external_zod_namespaceObject.z.string().optional().default(''),
|
1563
|
+
suffix: external_zod_namespaceObject.z.string().optional().default('')
|
1564
|
+
}).optional()
|
1565
|
+
});
|
1566
|
+
const zMeasureGroup = external_zod_namespaceObject.z.object({
|
1567
|
+
id: external_zod_namespaceObject.z.string(),
|
1568
|
+
alias: external_zod_namespaceObject.z.string().optional(),
|
1569
|
+
visible: external_zod_namespaceObject.z.boolean().default(true).optional(),
|
1570
|
+
get children () {
|
1571
|
+
return external_zod_namespaceObject.z.array(zMeasureGroup.or(zMeasure)).optional();
|
1572
|
+
}
|
1573
|
+
});
|
1574
|
+
const zMeasures = external_zod_namespaceObject.z.array(zMeasureGroup.or(zMeasure)).optional();
|
1575
|
+
const zFoldInfo = external_zod_namespaceObject.z.object({
|
1576
|
+
foldMap: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.undefined())),
|
1577
|
+
measureId: external_zod_namespaceObject.z.string(),
|
1578
|
+
measureName: external_zod_namespaceObject.z.string(),
|
1579
|
+
measureValue: external_zod_namespaceObject.z.string()
|
1580
|
+
});
|
1581
|
+
const zUnfoldInfo = external_zod_namespaceObject.z.object({
|
1582
|
+
colorItems: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()),
|
1583
|
+
groupName: external_zod_namespaceObject.z.string()
|
1584
|
+
});
|
1585
|
+
const zDatasetReshapeInfo = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
1586
|
+
id: external_zod_namespaceObject.z.string(),
|
1587
|
+
foldInfo: zFoldInfo,
|
1588
|
+
unfoldInfo: zUnfoldInfo
|
1589
|
+
}));
|
1590
|
+
const zEncoding = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
1591
|
+
x: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1592
|
+
y: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1593
|
+
color: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1594
|
+
group: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1595
|
+
angle: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1596
|
+
radius: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1597
|
+
tooltip: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional()
|
1598
|
+
}));
|
1599
|
+
const zBackgroundColor = external_zod_namespaceObject.z.string().default('transparent').optional();
|
1600
|
+
const zLabel = external_zod_namespaceObject.z.object({
|
1601
|
+
enable: external_zod_namespaceObject.z.boolean().default(true).optional()
|
1602
|
+
});
|
1603
|
+
const zColor = external_zod_namespaceObject.z.object({
|
1604
|
+
colorScheme: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
|
1605
|
+
colorMapping: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.string()).optional()
|
1606
|
+
});
|
1607
|
+
const zTooltip = external_zod_namespaceObject.z.object({
|
1608
|
+
enable: external_zod_namespaceObject.z.boolean().default(true).optional()
|
1609
|
+
});
|
1610
|
+
const zLegend = external_zod_namespaceObject.z.object({
|
1611
|
+
enable: external_zod_namespaceObject.z.boolean().default(true).optional()
|
1612
|
+
});
|
1613
|
+
const zVChartBaseConfig = external_zod_namespaceObject.z.object({
|
1614
|
+
backgroundColor: zBackgroundColor,
|
1615
|
+
label: zLabel.optional(),
|
1616
|
+
color: zColor.optional(),
|
1617
|
+
tooltip: zTooltip.optional(),
|
1618
|
+
legend: zLegend.optional()
|
1619
|
+
});
|
1620
|
+
const zVTableBaseConfig = external_zod_namespaceObject.z.object({
|
1621
|
+
backgroundColor: zBackgroundColor
|
1622
|
+
});
|
1623
|
+
const zBaseConfig = external_zod_namespaceObject.z.object({
|
1624
|
+
vchart: zVChartBaseConfig.optional(),
|
1625
|
+
vtable: zVTableBaseConfig.optional()
|
1626
|
+
});
|
1627
|
+
const zCustomThemeConfig = external_zod_namespaceObject.z.object({
|
1628
|
+
baseConfig: zBaseConfig.optional()
|
1629
|
+
});
|
1630
|
+
const zCustomTheme = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), zCustomThemeConfig).optional();
|
1631
|
+
const zTheme = external_zod_namespaceObject.z.string();
|
1632
|
+
exports.Builder = __webpack_exports__.Builder;
|
1633
|
+
exports.areaAdvancedPipeline = __webpack_exports__.areaAdvancedPipeline;
|
1634
|
+
exports.areaPercentAdvancedPipeline = __webpack_exports__.areaPercentAdvancedPipeline;
|
1635
|
+
exports.areaPercentSpecPipeline = __webpack_exports__.areaPercentSpecPipeline;
|
1636
|
+
exports.areaSpecPipeline = __webpack_exports__.areaSpecPipeline;
|
1637
|
+
exports.barAdvancedPipeline = __webpack_exports__.barAdvancedPipeline;
|
1638
|
+
exports.barParallelAdvancedPipeline = __webpack_exports__.barParallelAdvancedPipeline;
|
1639
|
+
exports.barParallelSpecPipeline = __webpack_exports__.barParallelSpecPipeline;
|
1640
|
+
exports.barPercentAdvancedPipeline = __webpack_exports__.barPercentAdvancedPipeline;
|
1641
|
+
exports.barPercentSpecPipeline = __webpack_exports__.barPercentSpecPipeline;
|
1642
|
+
exports.barSpecPipeline = __webpack_exports__.barSpecPipeline;
|
1643
|
+
exports.columnAdvancedPipeline = __webpack_exports__.columnAdvancedPipeline;
|
1644
|
+
exports.columnParallelAdvancedPipeline = __webpack_exports__.columnParallelAdvancedPipeline;
|
1645
|
+
exports.columnParallelSpecPipeline = __webpack_exports__.columnParallelSpecPipeline;
|
1646
|
+
exports.columnPercentAdvancedPipeline = __webpack_exports__.columnPercentAdvancedPipeline;
|
1647
|
+
exports.columnPercentSpecPipeline = __webpack_exports__.columnPercentSpecPipeline;
|
1648
|
+
exports.columnSpecPipeline = __webpack_exports__.columnSpecPipeline;
|
1649
|
+
exports.darkTheme = __webpack_exports__.darkTheme;
|
1650
|
+
exports.dataReshapeFor1D1M = __webpack_exports__.dataReshapeFor1D1M;
|
1651
|
+
exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
|
1652
|
+
exports.execPipeline = __webpack_exports__.execPipeline;
|
1653
|
+
exports.foldMeasures = __webpack_exports__.foldMeasures;
|
1654
|
+
exports.isVChart = __webpack_exports__.isVChart;
|
1655
|
+
exports.isVTable = __webpack_exports__.isVTable;
|
1656
|
+
exports.lightTheme = __webpack_exports__.lightTheme;
|
1657
|
+
exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
|
1658
|
+
exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
|
1659
|
+
exports.registerAll = __webpack_exports__.registerAll;
|
1660
|
+
exports.registerArea = __webpack_exports__.registerArea;
|
1661
|
+
exports.registerAreaPercent = __webpack_exports__.registerAreaPercent;
|
1662
|
+
exports.registerBar = __webpack_exports__.registerBar;
|
1663
|
+
exports.registerBarParallel = __webpack_exports__.registerBarParallel;
|
1664
|
+
exports.registerBarPercent = __webpack_exports__.registerBarPercent;
|
1665
|
+
exports.registerColumn = __webpack_exports__.registerColumn;
|
1666
|
+
exports.registerColumnParallel = __webpack_exports__.registerColumnParallel;
|
1667
|
+
exports.registerColumnPercent = __webpack_exports__.registerColumnPercent;
|
1668
|
+
exports.registerCustomTheme = __webpack_exports__.registerCustomTheme;
|
1669
|
+
exports.registerDarkTheme = __webpack_exports__.registerDarkTheme;
|
1670
|
+
exports.registerLightTheme = __webpack_exports__.registerLightTheme;
|
1671
|
+
exports.registerLine = __webpack_exports__.registerLine;
|
1672
|
+
exports.unfoldDimensions = __webpack_exports__.unfoldDimensions;
|
1673
|
+
exports.zBackgroundColor = __webpack_exports__.zBackgroundColor;
|
1674
|
+
exports.zBaseConfig = __webpack_exports__.zBaseConfig;
|
1675
|
+
exports.zChartType = __webpack_exports__.zChartType;
|
1676
|
+
exports.zColor = __webpack_exports__.zColor;
|
1677
|
+
exports.zCustomTheme = __webpack_exports__.zCustomTheme;
|
1678
|
+
exports.zCustomThemeConfig = __webpack_exports__.zCustomThemeConfig;
|
1679
|
+
exports.zDataset = __webpack_exports__.zDataset;
|
1680
|
+
exports.zDatasetReshapeInfo = __webpack_exports__.zDatasetReshapeInfo;
|
1681
|
+
exports.zDatum = __webpack_exports__.zDatum;
|
1682
|
+
exports.zDimension = __webpack_exports__.zDimension;
|
1683
|
+
exports.zDimensions = __webpack_exports__.zDimensions;
|
1684
|
+
exports.zEncoding = __webpack_exports__.zEncoding;
|
1685
|
+
exports.zFoldInfo = __webpack_exports__.zFoldInfo;
|
1686
|
+
exports.zLabel = __webpack_exports__.zLabel;
|
1687
|
+
exports.zLegend = __webpack_exports__.zLegend;
|
1688
|
+
exports.zMeasure = __webpack_exports__.zMeasure;
|
1689
|
+
exports.zMeasureGroup = __webpack_exports__.zMeasureGroup;
|
1690
|
+
exports.zMeasures = __webpack_exports__.zMeasures;
|
1691
|
+
exports.zTheme = __webpack_exports__.zTheme;
|
1692
|
+
exports.zTooltip = __webpack_exports__.zTooltip;
|
1693
|
+
exports.zUnfoldInfo = __webpack_exports__.zUnfoldInfo;
|
1694
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
1695
|
+
"Builder",
|
1696
|
+
"areaAdvancedPipeline",
|
1697
|
+
"areaPercentAdvancedPipeline",
|
1698
|
+
"areaPercentSpecPipeline",
|
1699
|
+
"areaSpecPipeline",
|
1700
|
+
"barAdvancedPipeline",
|
1701
|
+
"barParallelAdvancedPipeline",
|
1702
|
+
"barParallelSpecPipeline",
|
1703
|
+
"barPercentAdvancedPipeline",
|
1704
|
+
"barPercentSpecPipeline",
|
1705
|
+
"barSpecPipeline",
|
1706
|
+
"columnAdvancedPipeline",
|
1707
|
+
"columnParallelAdvancedPipeline",
|
1708
|
+
"columnParallelSpecPipeline",
|
1709
|
+
"columnPercentAdvancedPipeline",
|
1710
|
+
"columnPercentSpecPipeline",
|
1711
|
+
"columnSpecPipeline",
|
1712
|
+
"darkTheme",
|
1713
|
+
"dataReshapeFor1D1M",
|
1714
|
+
"dataReshapeFor2D1M",
|
1715
|
+
"execPipeline",
|
1716
|
+
"foldMeasures",
|
1717
|
+
"isVChart",
|
1718
|
+
"isVTable",
|
1719
|
+
"lightTheme",
|
1720
|
+
"lineAdvancedPipeline",
|
1721
|
+
"lineSpecPipeline",
|
1722
|
+
"registerAll",
|
1723
|
+
"registerArea",
|
1724
|
+
"registerAreaPercent",
|
1725
|
+
"registerBar",
|
1726
|
+
"registerBarParallel",
|
1727
|
+
"registerBarPercent",
|
1728
|
+
"registerColumn",
|
1729
|
+
"registerColumnParallel",
|
1730
|
+
"registerColumnPercent",
|
1731
|
+
"registerCustomTheme",
|
1732
|
+
"registerDarkTheme",
|
1733
|
+
"registerLightTheme",
|
1734
|
+
"registerLine",
|
1735
|
+
"unfoldDimensions",
|
1736
|
+
"zBackgroundColor",
|
1737
|
+
"zBaseConfig",
|
1738
|
+
"zChartType",
|
1739
|
+
"zColor",
|
1740
|
+
"zCustomTheme",
|
1741
|
+
"zCustomThemeConfig",
|
1742
|
+
"zDataset",
|
1743
|
+
"zDatasetReshapeInfo",
|
1744
|
+
"zDatum",
|
1745
|
+
"zDimension",
|
1746
|
+
"zDimensions",
|
1747
|
+
"zEncoding",
|
1748
|
+
"zFoldInfo",
|
1749
|
+
"zLabel",
|
1750
|
+
"zLegend",
|
1751
|
+
"zMeasure",
|
1752
|
+
"zMeasureGroup",
|
1753
|
+
"zMeasures",
|
1754
|
+
"zTheme",
|
1755
|
+
"zTooltip",
|
1756
|
+
"zUnfoldInfo"
|
1757
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
1758
|
+
Object.defineProperty(exports, '__esModule', {
|
1759
|
+
value: true
|
1760
|
+
});
|
1761
|
+
|
1762
|
+
//# sourceMappingURL=index.cjs.map
|