Skip to content

Commit 966fb1a

Browse files
committed
refactor(custom-chart-web): rename to custom-chart-web
1 parent 60a3f3c commit 966fb1a

19 files changed

+49
-58
lines changed

packages/pluggableWidgets/any-chart-web/src/AnyChart.tsx

-10
This file was deleted.

packages/pluggableWidgets/any-chart-web/src/package.xml

-11
This file was deleted.

packages/pluggableWidgets/any-chart-web/src/ui/AnyChart.scss

-13
This file was deleted.

packages/pluggableWidgets/any-chart-web/package.json renamed to packages/pluggableWidgets/custom-chart-web/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@mendix/any-chart-web2",
3-
"widgetName": "AnyChart",
2+
"name": "@mendix/custom-chart-web",
3+
"widgetName": "CustomChart",
44
"version": "1.0.0",
55
"description": "",
66
"copyright": "© Mendix Technology BV 2024. All rights reserved.",
@@ -14,18 +14,18 @@
1414
"developmentPort": 3000
1515
},
1616
"mxpackage": {
17-
"name": "AnyChart",
17+
"name": "CustomChart",
1818
"type": "widget",
19-
"mpkName": "com.mendix.widget.web.AnyChart.mpk"
19+
"mpkName": "com.mendix.widget.web.CustomChart.mpk"
2020
},
2121
"marketplace": {
2222
"minimumMXVersion": "10.16.0",
2323
"appNumber": 1234,
24-
"appName": "AnyChart"
24+
"appName": "CustomChart"
2525
},
2626
"testProject": {
2727
"githubUrl": "https://github.com/mendix/testProjects",
28-
"branchName": "any-chart-web"
28+
"branchName": "custom-chart-web"
2929
},
3030
"packagePath": "com.mendix.widget.web",
3131
"scripts": {
@@ -34,9 +34,9 @@
3434
"build": "pluggable-widgets-tools build:web",
3535
"format": "pluggable-widgets-tools format",
3636
"lint": "eslint --ext .jsx,.js,.ts,.tsx src/",
37-
"test": "echo 'FIXME: Finish any-chart-web unit test migration'",
38-
"e2e": "echo 'FIXME: Finish any-chart-web e2e test migration'",
39-
"e2edev": "echo 'FIXME: Finish any-chart-web e2e test migration'",
37+
"test": "echo 'FIXME: Finish custom-chart-web unit test migration'",
38+
"e2e": "echo 'FIXME: Finish custom-chart-web e2e test migration'",
39+
"e2edev": "echo 'FIXME: Finish custom-chart-web e2e test migration'",
4040
"release": "pluggable-widgets-tools release:web",
4141
"create-gh-release": "rui-create-gh-release",
4242
"publish-marketplace": "rui-publish-marketplace",

packages/pluggableWidgets/any-chart-web/src/AnyChart.editorConfig.ts renamed to packages/pluggableWidgets/custom-chart-web/src/CustomChart.editorConfig.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {
22
StructurePreviewProps,
33
structurePreviewPalette
44
} from "@mendix/widget-plugin-platform/preview/structure-preview-api";
5-
import { AnyChartPreviewProps } from "../typings/AnyChartProps";
5+
import { CustomChartPreviewProps } from "../typings/CustomChartProps";
66

7-
export function getPreview(_values: AnyChartPreviewProps, isDarkMode: boolean): StructurePreviewProps {
7+
export function getPreview(_values: CustomChartPreviewProps, isDarkMode: boolean): StructurePreviewProps {
88
const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"];
99
const sampleChartSvg = `
1010
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">

packages/pluggableWidgets/any-chart-web/src/AnyChart.editorPreview.tsx renamed to packages/pluggableWidgets/custom-chart-web/src/CustomChart.editorPreview.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReactElement, createElement } from "react";
2-
import { AnyChartPreviewProps } from "../typings/AnyChartProps";
3-
import AnyChart from "./AnyChart";
2+
import { CustomChartPreviewProps } from "../typings/CustomChartProps";
3+
import CustomChart from "./CustomChart";
44

55
const defaultSampleData = `[{
66
"type": "scatter",
@@ -38,7 +38,7 @@ const defaultConfig = `{
3838
"staticPlot": true
3939
}`;
4040

41-
export function preview(props: AnyChartPreviewProps): ReactElement {
41+
export function preview(props: CustomChartPreviewProps): ReactElement {
4242
const containerProps = {
4343
name: "preview-chart",
4444
class: props.class,
@@ -56,5 +56,5 @@ export function preview(props: AnyChartPreviewProps): ReactElement {
5656
height: props.height || 75
5757
};
5858

59-
return <AnyChart {...containerProps} />;
59+
return <CustomChart {...containerProps} />;
6060
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ReactElement, createElement } from "react";
2+
import { CustomChartContainerProps } from "../typings/CustomChartProps";
3+
import { useCustomChart } from "./hooks/useCustomChart";
4+
import "./ui/CustomChart.scss";
5+
6+
export default function CustomChart(props: CustomChartContainerProps): ReactElement {
7+
const { chartRef, containerStyle } = useCustomChart(props);
8+
9+
return <div ref={chartRef} className="widget-custom-chart" style={containerStyle} tabIndex={props.tabIndex} />;
10+
}

packages/pluggableWidgets/any-chart-web/src/AnyChart.xml renamed to packages/pluggableWidgets/custom-chart-web/src/CustomChart.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<widget id="com.mendix.widget.web.anychart.AnyChart" pluginWidget="true" offlineCapable="true" xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
3-
<name>Any chart</name>
4-
<description>Create any chart</description>
2+
<widget id="com.mendix.widget.web.custom-chart.CustomChart" pluginWidget="true" offlineCapable="true" xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
3+
<name>Custom chart</name>
4+
<description>Create a custom chart</description>
55
<studioProCategory>Charts</studioProCategory>
66
<studioCategory>Charts</studioCategory>
77
<properties>

packages/pluggableWidgets/any-chart-web/src/hooks/useAnyChart.ts renamed to packages/pluggableWidgets/custom-chart-web/src/hooks/useCustomChart.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { debounce } from "@mendix/widget-plugin-platform/utils/debounce";
22
import { useEffect, useMemo, useRef, useState, type RefObject } from "react";
3-
import { AnyChartContainerProps } from "../../typings/AnyChartProps";
3+
import { CustomChartContainerProps } from "../../typings/CustomChartProps";
44
import { PlotlyChart } from "../components/PlotlyChart";
55
import { ChartDataProcessor } from "../utils/ChartDataProcessor";
66

7-
interface UseAnyChartReturn {
7+
interface UseCustomChartReturn {
88
chartRef: RefObject<HTMLDivElement>;
99
containerStyle: {
1010
width?: string;
1111
height?: string;
1212
};
1313
}
1414

15-
export function useAnyChart(props: AnyChartContainerProps): UseAnyChartReturn {
15+
export function useCustomChart(props: CustomChartContainerProps): UseCustomChartReturn {
1616
const chartRef = useRef<HTMLDivElement>(null);
1717
const [chart, setChart] = useState<PlotlyChart | null>(null);
1818
const [containerDimensions, setContainerDimensions] = useState<{ width?: number; height?: number }>({});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<package xmlns="http://www.mendix.com/package/1.0/">
3+
<clientModule name="CustomChart" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
4+
<widgetFiles>
5+
<widgetFile path="CustomChart.xml" />
6+
</widgetFiles>
7+
<files>
8+
<file path="com/mendix/widget/web/custom-chart" />
9+
</files>
10+
</clientModule>
11+
</package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.widget-custom-chart {
2+
width: 100%;
3+
height: 100%;
4+
}

packages/pluggableWidgets/any-chart-web/typings/AnyChartProps.d.ts renamed to packages/pluggableWidgets/custom-chart-web/typings/CustomChartProps.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* This file was generated from AnyChart.xml
2+
* This file was generated from CustomChart.xml
33
* WARNING: All changes made to this file will be overwritten
44
* @author Mendix Widgets Framework Team
55
*/
@@ -12,7 +12,7 @@ export type WidthUnitEnum = "percentage" | "pixels";
1212

1313
export type HeightUnitEnum = "percentageOfWidth" | "pixels" | "percentageOfParent";
1414

15-
export interface AnyChartContainerProps {
15+
export interface CustomChartContainerProps {
1616
name: string;
1717
class: string;
1818
style?: CSSProperties;
@@ -31,7 +31,7 @@ export interface AnyChartContainerProps {
3131
height: number;
3232
}
3333

34-
export interface AnyChartPreviewProps {
34+
export interface CustomChartPreviewProps {
3535
/**
3636
* @deprecated Deprecated since version 9.18.0. Please use class property instead.
3737
*/

0 commit comments

Comments
 (0)