@carto/meridian-ds 2.9.3 → 2.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/types/widgets/ChartLegend.d.ts +5 -3
- package/dist/types/widgets/ChartLegend.d.ts.map +1 -1
- package/dist/types/widgets/PieWidgetUI/PieCentralText.d.ts +2 -2
- package/dist/types/widgets/PieWidgetUI/PieCentralText.d.ts.map +1 -1
- package/dist/types/widgets/PieWidgetUI/PieWidgetUI.d.ts +4 -3
- package/dist/types/widgets/PieWidgetUI/PieWidgetUI.d.ts.map +1 -1
- package/dist/types/widgets/PieWidgetUI/usePieCategories.d.ts +1 -1
- package/dist/widgets/index.cjs +8 -5
- package/dist/widgets/index.js +8 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
type Category = string | null;
|
|
1
2
|
export default function ChartLegend({ series, selectedCategories, labels, onCategoryClick, }: {
|
|
2
3
|
series: {
|
|
3
|
-
name:
|
|
4
|
+
name: Category;
|
|
4
5
|
color: string;
|
|
5
6
|
value?: number;
|
|
6
7
|
}[];
|
|
7
|
-
selectedCategories:
|
|
8
|
+
selectedCategories: Category[];
|
|
8
9
|
labels?: Record<string, string>;
|
|
9
|
-
onCategoryClick?: (categoryName:
|
|
10
|
+
onCategoryClick?: (categoryName: Category) => void;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
11
13
|
//# sourceMappingURL=ChartLegend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/widgets/ChartLegend.tsx"],"names":[],"mappings":"AAkEA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,kBAAkB,EAClB,MAAkB,EAClB,eAAe,GAChB,EAAE;IACD,MAAM,EAAE;QAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/widgets/ChartLegend.tsx"],"names":[],"mappings":"AAkEA,KAAK,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAA;AAE7B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,kBAAkB,EAClB,MAAkB,EAClB,eAAe,GAChB,EAAE;IACD,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3D,kBAAkB,EAAE,QAAQ,EAAE,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,KAAK,IAAI,CAAA;CACnD,2CA2JA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PieChartData, ProcessedPieChartData } from './PieWidgetUI';
|
|
1
|
+
import { PieCategory, PieChartData, ProcessedPieChartData } from './PieWidgetUI';
|
|
2
2
|
export default function PieCentralText({ data, selectedCategories, formatter, }: {
|
|
3
3
|
data: ProcessedPieChartData[];
|
|
4
|
-
selectedCategories:
|
|
4
|
+
selectedCategories: PieCategory[];
|
|
5
5
|
formatter: (value: number) => string;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
/** Find the largest item in an array based on its value */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PieCentralText.d.ts","sourceRoot":"","sources":["../../../../src/widgets/PieWidgetUI/PieCentralText.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"PieCentralText.d.ts","sourceRoot":"","sources":["../../../../src/widgets/PieWidgetUI/PieCentralText.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AA4BhF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,kBAAkB,EAClB,SAAS,GACV,EAAE;IACD,IAAI,EAAE,qBAAqB,EAAE,CAAA;IAC7B,kBAAkB,EAAE,WAAW,EAAE,CAAA;IACjC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACrC,kDAiEA;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,4BAiBxD;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,UASrC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { OrderTypes } from '../../utils/chart-constants';
|
|
2
2
|
import { TooltipParams } from '../../utils/formatter-utils';
|
|
3
3
|
export default function PieWidgetUI({ name, data, formatter, tooltipFormatter, percentFormatter, height, width, labels, colors, animation, filterable, selectedCategories, onSelectedCategoriesChange, isLoading, maxItems, othersValue, order, }: PieWidgetUIProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export type PieCategory = string | null;
|
|
4
5
|
export type PieChartData = {
|
|
5
|
-
name:
|
|
6
|
+
name: PieCategory;
|
|
6
7
|
value?: number;
|
|
7
8
|
};
|
|
8
9
|
export type ProcessedPieChartData = PieChartData & {
|
|
@@ -20,8 +21,8 @@ export type PieWidgetUIProps = {
|
|
|
20
21
|
width?: string;
|
|
21
22
|
animation?: boolean;
|
|
22
23
|
filterable?: boolean;
|
|
23
|
-
selectedCategories?:
|
|
24
|
-
onSelectedCategoriesChange?: (categories:
|
|
24
|
+
selectedCategories?: PieCategory[];
|
|
25
|
+
onSelectedCategoriesChange?: (categories: PieCategory[]) => void;
|
|
25
26
|
isLoading?: boolean;
|
|
26
27
|
maxItems?: number;
|
|
27
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PieWidgetUI.d.ts","sourceRoot":"","sources":["../../../../src/widgets/PieWidgetUI/PieWidgetUI.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAwB,MAAM,yBAAyB,CAAA;AAI1E,OAAO,EAA0B,aAAa,EAAE,MAAM,yBAAyB,CAAA;AA2C/E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,IAAI,EACJ,IAAI,EACJ,SAAiD,EACjD,gBAA0C,EAC1C,gBAAgB,EAChB,MAAmB,EACnB,KAAkB,EAClB,MAAkB,EAClB,MAA8B,EAC9B,SAAgB,EAChB,UAAiB,EACjB,kBAA0C,EAC1C,0BAA0B,EAC1B,SAAS,EACT,QAAa,EACb,WAAW,EACX,KAA0B,GAC3B,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PieWidgetUI.d.ts","sourceRoot":"","sources":["../../../../src/widgets/PieWidgetUI/PieWidgetUI.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAwB,MAAM,yBAAyB,CAAA;AAI1E,OAAO,EAA0B,aAAa,EAAE,MAAM,yBAAyB,CAAA;AA2C/E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,IAAI,EACJ,IAAI,EACJ,SAAiD,EACjD,gBAA0C,EAC1C,gBAAgB,EAChB,MAAmB,EACnB,KAAkB,EAClB,MAAkB,EAClB,MAA8B,EAC9B,SAAgB,EAChB,UAAiB,EACjB,kBAA0C,EAC1C,0BAA0B,EAC1B,SAAS,EACT,QAAa,EACb,WAAW,EACX,KAA0B,GAC3B,EAAE,gBAAgB,2CAgOlB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;AAEvC,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,YAAY,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACrC,gBAAgB,CAAC,EAAE,OAAO,uBAAuB,CAAA;IACjD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAA;IAClC,0BAA0B,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,IAAI,CAAA;IAChE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,iBAAS,uBAAuB,CAC9B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EACpC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,iBAiB5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OrderTypes } from '../../utils/chart-constants';
|
|
2
2
|
import { PieChartData } from './PieWidgetUI';
|
|
3
3
|
export default function usePieCategories(data: PieChartData[], order: OrderTypes, maxItems: number, colors: string[], othersValue?: number): (({
|
|
4
|
-
name:
|
|
4
|
+
name: import('./PieWidgetUI').PieCategory;
|
|
5
5
|
value?: number;
|
|
6
6
|
emphasis?: undefined;
|
|
7
7
|
} | {
|
package/dist/widgets/index.cjs
CHANGED
|
@@ -969,7 +969,7 @@ function CategoryWidgetUI({
|
|
|
969
969
|
if (name === REST_CATEGORY) {
|
|
970
970
|
return `Others ${searchable ? "" : `(${getCategoriesCount()})`}`;
|
|
971
971
|
} else {
|
|
972
|
-
return labels[String(name)] ?? String(name);
|
|
972
|
+
return labels[String(name)] ?? (name === null ? "NULL" : String(name));
|
|
973
973
|
}
|
|
974
974
|
},
|
|
975
975
|
[getCategoriesCount, labels, searchable]
|
|
@@ -2166,7 +2166,8 @@ function ChartLegend({
|
|
|
2166
2166
|
children: series.map((category, i) => {
|
|
2167
2167
|
if (i < offset) return null;
|
|
2168
2168
|
const selected = selectedCategories.length === 0 || selectedCategories.includes(category.name);
|
|
2169
|
-
const
|
|
2169
|
+
const labelKey = String(category.name);
|
|
2170
|
+
const label = labelKey in labels ? labels[labelKey] : category.name === null ? "NULL" : category.name;
|
|
2170
2171
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2171
2172
|
Item,
|
|
2172
2173
|
{
|
|
@@ -2328,8 +2329,9 @@ function PieWidgetUI({
|
|
|
2328
2329
|
data: processedData.map((item) => {
|
|
2329
2330
|
const clonedItem = { ...item };
|
|
2330
2331
|
const disabled = (selectedCategories == null ? void 0 : selectedCategories.length) && !selectedCategories.includes(clonedItem.name);
|
|
2331
|
-
|
|
2332
|
-
|
|
2332
|
+
const labelKey = String(clonedItem.name) ?? "";
|
|
2333
|
+
if (labels == null ? void 0 : labels[labelKey]) {
|
|
2334
|
+
clonedItem.name = labels[labelKey];
|
|
2333
2335
|
}
|
|
2334
2336
|
if (disabled) {
|
|
2335
2337
|
return {
|
|
@@ -4837,7 +4839,8 @@ function TimeSeriesWidgetUIContent({
|
|
|
4837
4839
|
{
|
|
4838
4840
|
series,
|
|
4839
4841
|
selectedCategories,
|
|
4840
|
-
onCategoryClick: onSelectedCategoriesChange &&
|
|
4842
|
+
onCategoryClick: onSelectedCategoriesChange && // in TimeSeries we don't support null categories, so we're safe assume category is always a string
|
|
4843
|
+
handleCategoryClick
|
|
4841
4844
|
}
|
|
4842
4845
|
);
|
|
4843
4846
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/widgets/index.js
CHANGED
|
@@ -967,7 +967,7 @@ function CategoryWidgetUI({
|
|
|
967
967
|
if (name === REST_CATEGORY) {
|
|
968
968
|
return `Others ${searchable ? "" : `(${getCategoriesCount()})`}`;
|
|
969
969
|
} else {
|
|
970
|
-
return labels[String(name)] ?? String(name);
|
|
970
|
+
return labels[String(name)] ?? (name === null ? "NULL" : String(name));
|
|
971
971
|
}
|
|
972
972
|
},
|
|
973
973
|
[getCategoriesCount, labels, searchable]
|
|
@@ -2164,7 +2164,8 @@ function ChartLegend({
|
|
|
2164
2164
|
children: series.map((category, i) => {
|
|
2165
2165
|
if (i < offset) return null;
|
|
2166
2166
|
const selected = selectedCategories.length === 0 || selectedCategories.includes(category.name);
|
|
2167
|
-
const
|
|
2167
|
+
const labelKey = String(category.name);
|
|
2168
|
+
const label = labelKey in labels ? labels[labelKey] : category.name === null ? "NULL" : category.name;
|
|
2168
2169
|
return /* @__PURE__ */ jsxs(
|
|
2169
2170
|
Item,
|
|
2170
2171
|
{
|
|
@@ -2326,8 +2327,9 @@ function PieWidgetUI({
|
|
|
2326
2327
|
data: processedData.map((item) => {
|
|
2327
2328
|
const clonedItem = { ...item };
|
|
2328
2329
|
const disabled = (selectedCategories == null ? void 0 : selectedCategories.length) && !selectedCategories.includes(clonedItem.name);
|
|
2329
|
-
|
|
2330
|
-
|
|
2330
|
+
const labelKey = String(clonedItem.name) ?? "";
|
|
2331
|
+
if (labels == null ? void 0 : labels[labelKey]) {
|
|
2332
|
+
clonedItem.name = labels[labelKey];
|
|
2331
2333
|
}
|
|
2332
2334
|
if (disabled) {
|
|
2333
2335
|
return {
|
|
@@ -4835,7 +4837,8 @@ function TimeSeriesWidgetUIContent({
|
|
|
4835
4837
|
{
|
|
4836
4838
|
series,
|
|
4837
4839
|
selectedCategories,
|
|
4838
|
-
onCategoryClick: onSelectedCategoriesChange &&
|
|
4840
|
+
onCategoryClick: onSelectedCategoriesChange && // in TimeSeries we don't support null categories, so we're safe assume category is always a string
|
|
4841
|
+
handleCategoryClick
|
|
4839
4842
|
}
|
|
4840
4843
|
);
|
|
4841
4844
|
return /* @__PURE__ */ jsx(
|