Skip to content

Commit 2fd8a12

Browse files
Merge pull request #3 from hunter-koppen/main
Added on change event and fixed lint errors
2 parents 25203a2 + 9b4fdc2 commit 2fd8a12

File tree

7 files changed

+202
-187
lines changed

7 files changed

+202
-187
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codeeditor",
33
"widgetName": "CodeEditor",
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"description": "Ace code editor, as a Mendix pluggable widget.",
66
"copyright": "© Mendix Technology BV 2022. All rights reserved.",
77
"author": "Carter Moorse",

src/CodeEditor.editorConfig.ts

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,66 +34,75 @@ export type Problem = {
3434
};
3535

3636
type BaseProps = {
37-
type: "Image" | "Container" | "RowLayout" | "Text" | "DropZone" | "Selectable" | "Datasource";
38-
grow?: number; // optionally sets a growth factor if used in a layout (default = 1)
39-
}
37+
type: "Image" | "Container" | "RowLayout" | "Text" | "DropZone" | "Selectable" | "Datasource";
38+
grow?: number; // optionally sets a growth factor if used in a layout (default = 1)
39+
};
4040

4141
type ImageProps = BaseProps & {
42-
type: "Image";
43-
document?: string; // svg image
44-
data?: string; // base64 image
45-
property?: object; // widget image property object from Values API
46-
width?: number; // sets a fixed maximum width
47-
height?: number; // sets a fixed maximum height
48-
}
42+
type: "Image";
43+
document?: string; // svg image
44+
data?: string; // base64 image
45+
property?: object; // widget image property object from Values API
46+
width?: number; // sets a fixed maximum width
47+
height?: number; // sets a fixed maximum height
48+
};
4949

5050
type ContainerProps = BaseProps & {
51-
type: "Container" | "RowLayout";
52-
children: PreviewProps[]; // any other preview element
53-
borders?: boolean; // sets borders around the layout to visually group its children
54-
borderRadius?: number; // integer. Can be used to create rounded borders
55-
backgroundColor?: string; // HTML color, formatted #RRGGBB
56-
borderWidth?: number; // sets the border width
57-
padding?: number; // integer. adds padding around the container
58-
}
51+
type: "Container" | "RowLayout";
52+
children: PreviewProps[]; // any other preview element
53+
borders?: boolean; // sets borders around the layout to visually group its children
54+
borderRadius?: number; // integer. Can be used to create rounded borders
55+
backgroundColor?: string; // HTML color, formatted #RRGGBB
56+
borderWidth?: number; // sets the border width
57+
padding?: number; // integer. adds padding around the container
58+
};
5959

6060
type RowLayoutProps = ContainerProps & {
61-
type: "RowLayout";
62-
columnSize?: "fixed" | "grow" // default is fixed
63-
}
61+
type: "RowLayout";
62+
columnSize?: "fixed" | "grow"; // default is fixed
63+
};
6464

6565
type TextProps = BaseProps & {
66-
type: "Text";
67-
content: string; // text that should be shown
68-
fontSize?: number; // sets the font size
69-
fontColor?: string; // HTML color, formatted #RRGGBB
70-
bold?: boolean;
71-
italic?: boolean;
72-
}
66+
type: "Text";
67+
content: string; // text that should be shown
68+
fontSize?: number; // sets the font size
69+
fontColor?: string; // HTML color, formatted #RRGGBB
70+
bold?: boolean;
71+
italic?: boolean;
72+
};
7373

7474
type DropZoneProps = BaseProps & {
75-
type: "DropZone";
76-
property: object; // widgets property object from Values API
77-
placeholder: string; // text to be shown inside the dropzone when empty
78-
showDataSourceHeader?: boolean; // true by default. Toggles whether to show a header containing information about the datasource
79-
}
80-
75+
type: "DropZone";
76+
property: object; // widgets property object from Values API
77+
placeholder: string; // text to be shown inside the dropzone when empty
78+
showDataSourceHeader?: boolean; // true by default. Toggles whether to show a header containing information about the datasource
79+
};
8180

8281
type SelectableProps = BaseProps & {
83-
type: "Selectable";
84-
object: object; // object property instance from the Value API
85-
child: PreviewProps; // any type of preview property to visualize the object instance
86-
}
82+
type: "Selectable";
83+
object: object; // object property instance from the Value API
84+
child: PreviewProps; // any type of preview property to visualize the object instance
85+
};
8786

8887
type DatasourceProps = BaseProps & {
89-
type: "Datasource";
90-
property: object | null; // datasource property object from Values API
91-
child?: PreviewProps; // any type of preview property component (optional)
92-
}
93-
94-
export type PreviewProps = ImageProps | ContainerProps | RowLayoutProps | TextProps | DropZoneProps | SelectableProps | DatasourceProps;
88+
type: "Datasource";
89+
property: object | null; // datasource property object from Values API
90+
child?: PreviewProps; // any type of preview property component (optional)
91+
};
9592

96-
export function getProperties(_values: CodeEditorPreviewProps, defaultProperties: Properties/*, target: Platform*/): Properties {
93+
export type PreviewProps =
94+
| ImageProps
95+
| ContainerProps
96+
| RowLayoutProps
97+
| TextProps
98+
| DropZoneProps
99+
| SelectableProps
100+
| DatasourceProps;
101+
102+
export function getProperties(
103+
_values: CodeEditorPreviewProps,
104+
defaultProperties: Properties /* target: Platform */
105+
): Properties {
97106
// Do the values manipulation here to control the visibility of properties in Studio and Studio Pro conditionally.
98107
/* Example
99108
if (values.myProperty === "custom") {

0 commit comments

Comments
 (0)