pivotkit-react 0.0.0-stage → 0.2.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 +442 -0
- package/LICENSE +21 -0
- package/README.md +77 -2
- package/dist/chunks/chunk-53ZMK4BH.js +177 -0
- package/dist/chunks/chunk-F6MVUAQD.js +741 -0
- package/dist/chunks/chunk-LQCWFJBS.js +310 -0
- package/dist/chunks/chunk-OYY4BKIL.js +93 -0
- package/dist/chunks/chunk-QBD4FOBB.js +254 -0
- package/dist/chunks/chunk-X7H7BAVT.js +1752 -0
- package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
- package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
- package/dist/echarts.js +347 -0
- package/dist/index.js +3482 -0
- package/dist/labels.js +21 -0
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +1681 -0
- package/dist/styles.css +2529 -0
- package/package.json +70 -4
- package/types/PivotReport.d.ts +20 -0
- package/types/all-labels.d.ts +5 -0
- package/types/chart-decorate.d.ts +16 -0
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-options.d.ts +23 -0
- package/types/chart-summary.d.ts +12 -0
- package/types/chart-tooltip.d.ts +38 -0
- package/types/chart-types.d.ts +61 -0
- package/types/chart.d.ts +39 -0
- package/types/chip-menus.d.ts +32 -0
- package/types/clear-input.d.ts +20 -0
- package/types/dnd-moves.d.ts +45 -0
- package/types/dnd.d.ts +101 -0
- package/types/dom.d.ts +52 -0
- package/types/drill-export.d.ts +42 -0
- package/types/drill-panel.d.ts +22 -0
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +26 -0
- package/types/echarts.d.ts +4 -0
- package/types/export-run.d.ts +59 -0
- package/types/field-info.d.ts +34 -0
- package/types/fields.d.ts +32 -0
- package/types/files.d.ts +27 -0
- package/types/filter.d.ts +21 -0
- package/types/help.d.ts +21 -0
- package/types/icons.d.ts +80 -0
- package/types/index.d.ts +536 -0
- package/types/info.d.ts +34 -0
- package/types/iso.d.ts +2 -0
- package/types/labels.d.ts +663 -0
- package/types/lazy-menus.d.ts +28 -0
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +317 -0
- package/types/menu-ops.d.ts +145 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menus.d.ts +7 -0
- package/types/names.d.ts +80 -0
- package/types/numbers.d.ts +13 -0
- package/types/overflow.d.ts +62 -0
- package/types/place.d.ts +43 -0
- package/types/popover.d.ts +93 -0
- package/types/rove.d.ts +20 -0
- package/types/section.d.ts +25 -0
- package/types/sections.d.ts +2 -0
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +114 -0
- package/types/skeleton.d.ts +9 -0
- package/types/storage.d.ts +24 -0
- package/types/table.d.ts +29 -0
- package/types/templates.d.ts +46 -0
- package/types/theme.d.ts +24 -0
- package/types/tip-list.d.ts +20 -0
- package/types/tips.d.ts +300 -0
- package/types/toasts.d.ts +26 -0
- package/types/toolbar-panels.d.ts +93 -0
- package/types/toolbar.d.ts +5 -0
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +130 -0
- package/types/unused.d.ts +22 -0
- package/types/use-big-result.d.ts +29 -0
- package/types/use-export.d.ts +7 -0
- package/types/use-theme.d.ts +11 -0
- package/types/use-view-history.d.ts +37 -0
- package/types/version.d.ts +2 -0
- package/types/view-history.d.ts +106 -0
- package/types/view-ops.d.ts +293 -0
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +59 -0
- package/types/virtual.d.ts +44 -0
- package/types/zones.d.ts +42 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// src/unused-texts.js
|
|
2
|
+
var en = {
|
|
3
|
+
// "Quakes: the colour scale needs two or three colours - the default colours are used"
|
|
4
|
+
item: "{subject}: {text}",
|
|
5
|
+
// a key of the view this version does not know, as the subject
|
|
6
|
+
quote: "\u201C{key}\u201D",
|
|
7
|
+
// two lines about different entries with the same name: which one ({part}: the zone or section)
|
|
8
|
+
position: "{subject} (no. {n} in {part})",
|
|
9
|
+
// what an issue is about when no field or value is named
|
|
10
|
+
view: "The view",
|
|
11
|
+
sections: {
|
|
12
|
+
sort: "Sorting",
|
|
13
|
+
derived: "Groupings",
|
|
14
|
+
totals: "Totals",
|
|
15
|
+
collapsed: "Collapsed groups",
|
|
16
|
+
display: "Table or chart",
|
|
17
|
+
chart: "Chart",
|
|
18
|
+
formatting: "Formatting"
|
|
19
|
+
},
|
|
20
|
+
// the setting of an unknown choice ({setting}), by the last part of its path
|
|
21
|
+
settings: {
|
|
22
|
+
display: "display",
|
|
23
|
+
type: "chart type",
|
|
24
|
+
valueLabels: "value labels",
|
|
25
|
+
legend: "legend position",
|
|
26
|
+
axisLabels: "axis labels",
|
|
27
|
+
groupLabels: "group labels",
|
|
28
|
+
labelPosition: "label position",
|
|
29
|
+
other: "setting"
|
|
30
|
+
},
|
|
31
|
+
// what the report does instead, by the part of the view ({dropped} in a text)
|
|
32
|
+
dropped: {
|
|
33
|
+
rows: "it is left out of Rows",
|
|
34
|
+
cols: "it is left out of Columns",
|
|
35
|
+
values: "this value is left out",
|
|
36
|
+
filters: "this filter is left out",
|
|
37
|
+
sort: "the usual order is used",
|
|
38
|
+
derived: "this grouping is left out",
|
|
39
|
+
other: "it is left out"
|
|
40
|
+
},
|
|
41
|
+
codes: {
|
|
42
|
+
notView: "this is not a pivotkit view - the report starts empty",
|
|
43
|
+
notJson: "this is not valid JSON - the report starts empty",
|
|
44
|
+
tooLarge: "the view is too large - the report starts empty",
|
|
45
|
+
badVersion: "the view has an unknown version - the report starts empty",
|
|
46
|
+
newerVersion: "the view comes from a newer pivotkit - the report starts empty; update pivotkit to open it",
|
|
47
|
+
noMigration: "the view cannot be brought to this version - the report starts empty",
|
|
48
|
+
unknownKey: "this setting is unknown here - it is ignored",
|
|
49
|
+
notList: "this is not a list - nothing of it is used",
|
|
50
|
+
tooMany: "more than {max} entries - only the first {max} are used",
|
|
51
|
+
tooManyItems: "more than {max} items - only the first {max} are used",
|
|
52
|
+
itemType: "the item \u201C{value}\u201D does not fit a {type} field - it is left out",
|
|
53
|
+
unknownField: "the data has no field \u201C{field}\u201D - {dropped}",
|
|
54
|
+
// the same, when the line is about that field itself (Rows, Columns, a filter or a sort)
|
|
55
|
+
unknownFieldHere: "the data has no field of this name - {dropped}",
|
|
56
|
+
placedTwice: "the field is in Rows or Columns twice - only its first place is used",
|
|
57
|
+
groupingNoName: "the grouping has no name - it is left out",
|
|
58
|
+
groupingNameTaken: "the data already has a field of this name - the grouping is left out",
|
|
59
|
+
groupingNoSource: "the data has no field \u201C{field}\u201D to group - the grouping is left out",
|
|
60
|
+
groupingUnknown: "the grouping \u201C{value}\u201D is unknown - it is left out",
|
|
61
|
+
binsNeedNumber: "ranges need a number field, \u201C{field}\u201D is not one - the grouping is left out",
|
|
62
|
+
groupingNeedsDate: "a date grouping needs a date field, \u201C{field}\u201D is not one - the grouping is left out",
|
|
63
|
+
binSize: "ranges need a size above zero - the grouping is left out",
|
|
64
|
+
notValueRef: "this is not a value - {dropped}",
|
|
65
|
+
unknownAggregator: "the calculation \u201C{value}\u201D is unknown - {dropped}",
|
|
66
|
+
aggregatorNeedsField: "{agg} needs a field - {dropped}",
|
|
67
|
+
aggregatorType: "{agg} does not work on \u201C{field}\u201D ({type}) - {dropped}",
|
|
68
|
+
unknownFormat: "the number format \u201C{value}\u201D is unknown - the usual format is used",
|
|
69
|
+
badLabel: "the name is empty or longer than {max} characters - the usual name is used",
|
|
70
|
+
unknownShowAs: "\u201CShow as\u201D \u201C{value}\u201D is unknown - the plain value is shown",
|
|
71
|
+
showAsNotAdditive: "this \u201CShow as\u201D needs a sum or a count, not {agg} - the plain value is shown",
|
|
72
|
+
showAsNotNumber: "{agg} gives no number to show as a share - the plain value is shown",
|
|
73
|
+
unknownConditional: "the colour format \u201C{value}\u201D is unknown - the value is shown without colours",
|
|
74
|
+
conditionalNotNumber: "colours need a number value - the value is shown without colours",
|
|
75
|
+
colorScaleColors: "the colour scale needs two or three colours - the default colours are used",
|
|
76
|
+
dataBarColor: "the bar colour is not a colour - the default colour is used",
|
|
77
|
+
unknownFilterType: "the filter type \u201C{value}\u201D is unknown - this filter is left out",
|
|
78
|
+
filterNoItems: "the filter lists no items - it is left out",
|
|
79
|
+
filterLabelOp: "the text condition \u201C{value}\u201D is unknown - this filter is left out",
|
|
80
|
+
filterText: "the text condition has no text - this filter is left out",
|
|
81
|
+
filterNotNumber: "{agg} gives no number to filter by - this filter is left out",
|
|
82
|
+
filterCount: "Top needs a whole number from 1 to {max} - this filter is left out",
|
|
83
|
+
filterValue: "the condition needs a comparison and a number - this filter is left out",
|
|
84
|
+
filterValue2: "\u201C{value}\u201D needs a second number - this filter is left out",
|
|
85
|
+
sortNoItems: "the custom order lists no items - the usual order is used",
|
|
86
|
+
sortedTwice: "the field is sorted twice - only its first sort is used",
|
|
87
|
+
badTotals: "the totals cannot be read - the usual totals are shown",
|
|
88
|
+
collapsedPath: "a collapsed group does not fit the fields - it is shown expanded",
|
|
89
|
+
unknownSetting: "the {setting} \u201C{value}\u201D is unknown - the default is used",
|
|
90
|
+
badTitle: "the title is empty or longer than {max} characters - the chart has no title",
|
|
91
|
+
unknownLocale: "the language \u201C{value}\u201D is unknown - the report's language is used",
|
|
92
|
+
unknownTimeZone: "the time zone \u201C{value}\u201D is unknown - the data's time zone is used",
|
|
93
|
+
timeZoneMismatch: "the view was made for the time zone {value}, the data is in {zone} - times are read in {zone}"
|
|
94
|
+
},
|
|
95
|
+
// a problem this version has no text for (a newer pivotkit-core)
|
|
96
|
+
other: "this part could not be used - it is left out"
|
|
97
|
+
};
|
|
98
|
+
var isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
99
|
+
var own = (obj, key) => isObject(obj) && Object.hasOwn(obj, key) ? obj[key] : void 0;
|
|
100
|
+
var text = (v) => typeof v === "string" && v.trim() !== "" ? v.trim() : null;
|
|
101
|
+
var ENTRY = /^(rows|cols|values|filters|sort|derived)\[(\d+)\]/;
|
|
102
|
+
function valueName(entry, ctx) {
|
|
103
|
+
const label = text(own(entry, "label"));
|
|
104
|
+
if (label) {
|
|
105
|
+
return label;
|
|
106
|
+
}
|
|
107
|
+
const agg = own(entry, "agg");
|
|
108
|
+
if (typeof agg !== "string") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const field = own(entry, "field");
|
|
112
|
+
return ctx.value({ field: typeof field === "string" ? field : null, agg, label: null, showAs: null });
|
|
113
|
+
}
|
|
114
|
+
function subjectOf(issue, raw, texts, ctx) {
|
|
115
|
+
if (issue.code === "unknownKey") {
|
|
116
|
+
return ctx.fill(texts.quote, { key: issue.path });
|
|
117
|
+
}
|
|
118
|
+
const m = ENTRY.exec(issue.path);
|
|
119
|
+
if (m) {
|
|
120
|
+
const list = own(raw, m[1]);
|
|
121
|
+
const entry = Array.isArray(list) ? list[Number(m[2])] : void 0;
|
|
122
|
+
const name = m[1] === "values" ? valueName(entry, ctx) : text(m[1] === "rows" || m[1] === "cols" ? entry : m[1] === "derived" ? own(entry, "name") : own(entry, "field"));
|
|
123
|
+
if (name) {
|
|
124
|
+
return m[1] === "values" || m[1] === "derived" ? name : ctx.field(name);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const head = /^[a-z]*/i.exec(issue.path)?.[0] ?? "";
|
|
128
|
+
return own(ctx.labels.zones, head) ?? own(texts.sections, head) ?? texts.view;
|
|
129
|
+
}
|
|
130
|
+
function unusedItem(issue, raw, texts, ctx) {
|
|
131
|
+
const { labels, fill } = ctx;
|
|
132
|
+
const head = /^[a-z]*/i.exec(issue.path)?.[0] ?? "";
|
|
133
|
+
const code = typeof issue.code === "string" ? issue.code : "";
|
|
134
|
+
const key = code === "unknownField" && /^(rows|cols|filters|sort)\[\d+\]$/.test(issue.path) ? "unknownFieldHere" : code;
|
|
135
|
+
const template = code ? own(texts.codes, key) ?? texts.other : "{message}";
|
|
136
|
+
const params = (
|
|
137
|
+
/** @type {import("pivotkit-core").IssueParams} */
|
|
138
|
+
isObject(issue.params) ? issue.params : {}
|
|
139
|
+
);
|
|
140
|
+
const core = labels.core;
|
|
141
|
+
const values = {
|
|
142
|
+
dropped: own(texts.dropped, head) ?? texts.dropped.other,
|
|
143
|
+
setting: own(texts.settings, issue.path.split(".").pop() ?? "") ?? texts.settings.other,
|
|
144
|
+
field: typeof params.field === "string" ? ctx.field(params.field) : "",
|
|
145
|
+
value: params.value ?? "",
|
|
146
|
+
agg: typeof params.agg === "string" ? own(core.aggregators, params.agg) ?? params.agg : "",
|
|
147
|
+
type: typeof params.type === "string" ? own(labels.types, params.type) ?? params.type : "",
|
|
148
|
+
max: typeof params.max === "number" ? params.max.toLocaleString(labels.lang) : "",
|
|
149
|
+
zone: params.zone ?? "",
|
|
150
|
+
message: issue.message
|
|
151
|
+
};
|
|
152
|
+
const [before, after = ""] = texts.item.split("{subject}");
|
|
153
|
+
const line = { text: fill(template, values) };
|
|
154
|
+
return { pre: fill(before, line), subject: subjectOf(issue, raw, texts, ctx), post: fill(after, line) };
|
|
155
|
+
}
|
|
156
|
+
function unusedItems(notes, texts, ctx) {
|
|
157
|
+
const items = notes.map((n) => ({ ...unusedItem(n.issue, n.raw, texts, ctx), at: ENTRY.exec(n.issue.path) }));
|
|
158
|
+
const entries = /* @__PURE__ */ new Map();
|
|
159
|
+
for (const it of items) {
|
|
160
|
+
const set = entries.get(it.subject) ?? /* @__PURE__ */ new Set();
|
|
161
|
+
set.add(it.at ? it.at[0] : "");
|
|
162
|
+
entries.set(it.subject, set);
|
|
163
|
+
}
|
|
164
|
+
return items.map(({ at, ...it }) => {
|
|
165
|
+
if (!at || entries.get(it.subject).size < 2) {
|
|
166
|
+
return it;
|
|
167
|
+
}
|
|
168
|
+
const part = own(ctx.labels.zones, at[1]) ?? own(texts.sections, at[1]) ?? at[1];
|
|
169
|
+
return { ...it, subject: ctx.fill(texts.position, { subject: it.subject, n: Number(at[2]) + 1, part }) };
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
en,
|
|
175
|
+
unusedItem,
|
|
176
|
+
unusedItems
|
|
177
|
+
};
|