From f42a4dd6cc18d22d959814f6b5363e91b2b008be Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 24 Jun 2025 12:32:27 -0700 Subject: [PATCH 01/71] [feat] Add core Vue widget infrastructure - SimplifiedWidget interface for Vue-based node widgets - widgetPropFilter utility with component-specific exclusion lists - Removes DOM manipulation and positioning concerns - Provides clean API for value binding and prop filtering --- src/types/simplifiedWidget.ts | 27 +++++++++++++ src/utils/widgetPropFilter.ts | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/types/simplifiedWidget.ts create mode 100644 src/utils/widgetPropFilter.ts diff --git a/src/types/simplifiedWidget.ts b/src/types/simplifiedWidget.ts new file mode 100644 index 0000000000..7c755917d0 --- /dev/null +++ b/src/types/simplifiedWidget.ts @@ -0,0 +1,27 @@ +/** + * Simplified widget interface for Vue-based node rendering + * Removes all DOM manipulation and positioning concerns + */ + +export interface SimplifiedWidget> { + /** Display name of the widget */ + name: string + + /** Widget type identifier (e.g., 'STRING', 'INT', 'COMBO') */ + type: string + + /** Current value of the widget */ + value: T + + /** Widget options including filtered PrimeVue props */ + options?: O + + /** Callback fired when value changes */ + callback?: (value: T) => void + + /** Optional serialization method for custom value handling */ + serializeValue?: () => any + + /** Optional method to compute widget size requirements */ + computeSize?: () => { minHeight: number; maxHeight?: number } +} diff --git a/src/utils/widgetPropFilter.ts b/src/utils/widgetPropFilter.ts new file mode 100644 index 0000000000..9456da6b96 --- /dev/null +++ b/src/utils/widgetPropFilter.ts @@ -0,0 +1,76 @@ +/** + * Widget prop filtering utilities + * Filters out style-related and customization props from PrimeVue components + * to maintain consistent widget appearance across the application + */ + +// Props to exclude based on the widget interface specifications +export const STANDARD_EXCLUDED_PROPS = [ + 'style', + 'class', + 'dt', + 'pt', + 'ptOptions', + 'unstyled' +] as const + +export const INPUT_EXCLUDED_PROPS = [ + ...STANDARD_EXCLUDED_PROPS, + 'inputClass', + 'inputStyle' +] as const + +export const PANEL_EXCLUDED_PROPS = [ + ...STANDARD_EXCLUDED_PROPS, + 'panelClass', + 'panelStyle', + 'overlayClass' +] as const + +export const IMAGE_EXCLUDED_PROPS = [ + ...STANDARD_EXCLUDED_PROPS, + 'imageClass', + 'imageStyle' +] as const + +export const GALLERIA_EXCLUDED_PROPS = [ + ...STANDARD_EXCLUDED_PROPS, + 'thumbnailsPosition', + 'verticalThumbnailViewPortHeight', + 'indicatorsPosition', + 'maskClass', + 'containerStyle', + 'containerClass', + 'galleriaClass' +] as const + +export const BADGE_EXCLUDED_PROPS = [ + ...STANDARD_EXCLUDED_PROPS, + 'badgeClass' +] as const + +export const LABEL_EXCLUDED_PROPS = [ + ...PANEL_EXCLUDED_PROPS, + 'labelStyle' +] as const + +/** + * Filters widget props by excluding specified properties + * @param props - The props object to filter + * @param excludeList - List of property names to exclude + * @returns Filtered props object + */ +export function filterWidgetProps>( + props: T | undefined, + excludeList: readonly string[] +): Partial { + if (!props) return {} + + const filtered: Record = {} + for (const [key, value] of Object.entries(props)) { + if (!excludeList.includes(key)) { + filtered[key] = value + } + } + return filtered as Partial +} From 2dcfe84e9910bb80c36c81aeb20307f607f1460e Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 24 Jun 2025 12:32:41 -0700 Subject: [PATCH 02/71] [feat] Add Vue widget registry system - Complete widget type enum with all 15 widget types - Component mapping registry for dynamic widget rendering - Helper function for type-safe widget component resolution --- .../graph/vueWidgets/widgetRegistry.ts | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/components/graph/vueWidgets/widgetRegistry.ts diff --git a/src/components/graph/vueWidgets/widgetRegistry.ts b/src/components/graph/vueWidgets/widgetRegistry.ts new file mode 100644 index 0000000000..0eede8b8dc --- /dev/null +++ b/src/components/graph/vueWidgets/widgetRegistry.ts @@ -0,0 +1,80 @@ +/** + * Widget type registry and component mapping for Vue-based widgets + */ +import type { Component } from 'vue' + +// Component imports +import WidgetButton from './WidgetButton.vue' +import WidgetChart from './WidgetChart.vue' +import WidgetColorPicker from './WidgetColorPicker.vue' +import WidgetFileUpload from './WidgetFileUpload.vue' +import WidgetGalleria from './WidgetGalleria.vue' +import WidgetImage from './WidgetImage.vue' +import WidgetImageCompare from './WidgetImageCompare.vue' +import WidgetInputText from './WidgetInputText.vue' +import WidgetMultiSelect from './WidgetMultiSelect.vue' +import WidgetSelect from './WidgetSelect.vue' +import WidgetSelectButton from './WidgetSelectButton.vue' +import WidgetSlider from './WidgetSlider.vue' +import WidgetTextarea from './WidgetTextarea.vue' +import WidgetToggleSwitch from './WidgetToggleSwitch.vue' +import WidgetTreeSelect from './WidgetTreeSelect.vue' + +/** + * Enum of all available widget types + */ +export enum WidgetType { + BUTTON = 'BUTTON', + STRING = 'STRING', + INT = 'INT', + FLOAT = 'FLOAT', + NUMBER = 'NUMBER', + BOOLEAN = 'BOOLEAN', + COMBO = 'COMBO', + COLOR = 'COLOR', + MULTISELECT = 'MULTISELECT', + SELECTBUTTON = 'SELECTBUTTON', + SLIDER = 'SLIDER', + TEXTAREA = 'TEXTAREA', + TOGGLESWITCH = 'TOGGLESWITCH', + CHART = 'CHART', + IMAGE = 'IMAGE', + IMAGECOMPARE = 'IMAGECOMPARE', + GALLERIA = 'GALLERIA', + FILEUPLOAD = 'FILEUPLOAD', + TREESELECT = 'TREESELECT' +} + +/** + * Maps widget types to their corresponding Vue components + * Components will be added as they are implemented + */ +export const widgetTypeToComponent: Record = { + // Components will be uncommented as they are implemented + [WidgetType.BUTTON]: WidgetButton, + [WidgetType.STRING]: WidgetInputText, + [WidgetType.INT]: WidgetSlider, + [WidgetType.FLOAT]: WidgetSlider, + [WidgetType.NUMBER]: WidgetSlider, // For compatibility + [WidgetType.BOOLEAN]: WidgetToggleSwitch, + [WidgetType.COMBO]: WidgetSelect, + [WidgetType.COLOR]: WidgetColorPicker, + [WidgetType.MULTISELECT]: WidgetMultiSelect, + [WidgetType.SELECTBUTTON]: WidgetSelectButton, + [WidgetType.SLIDER]: WidgetSlider, + [WidgetType.TEXTAREA]: WidgetTextarea, + [WidgetType.TOGGLESWITCH]: WidgetToggleSwitch, + [WidgetType.CHART]: WidgetChart, + [WidgetType.IMAGE]: WidgetImage, + [WidgetType.IMAGECOMPARE]: WidgetImageCompare, + [WidgetType.GALLERIA]: WidgetGalleria, + [WidgetType.FILEUPLOAD]: WidgetFileUpload, + [WidgetType.TREESELECT]: WidgetTreeSelect +} + +/** + * Helper function to get widget component by type + */ +export function getWidgetComponent(type: string): Component | undefined { + return widgetTypeToComponent[type] +} From 06d0a63a2f61bd9c3193d045a411d73b5d1510f2 Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 24 Jun 2025 12:32:54 -0700 Subject: [PATCH 03/71] [feat] Add Vue input widgets - WidgetInputText: Single-line text input with InputText component - WidgetTextarea: Multi-line text input with Textarea component - WidgetSlider: Numeric range input with Slider component - WidgetToggleSwitch: Boolean toggle with ToggleSwitch component --- .../graph/vueWidgets/WidgetInputText.vue | 30 +++++++++++++++++++ .../graph/vueWidgets/WidgetSlider.vue | 30 +++++++++++++++++++ .../graph/vueWidgets/WidgetTextarea.vue | 30 +++++++++++++++++++ .../graph/vueWidgets/WidgetToggleSwitch.vue | 30 +++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 src/components/graph/vueWidgets/WidgetInputText.vue create mode 100644 src/components/graph/vueWidgets/WidgetSlider.vue create mode 100644 src/components/graph/vueWidgets/WidgetTextarea.vue create mode 100644 src/components/graph/vueWidgets/WidgetToggleSwitch.vue diff --git a/src/components/graph/vueWidgets/WidgetInputText.vue b/src/components/graph/vueWidgets/WidgetInputText.vue new file mode 100644 index 0000000000..462957335d --- /dev/null +++ b/src/components/graph/vueWidgets/WidgetInputText.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/components/graph/vueWidgets/WidgetSlider.vue b/src/components/graph/vueWidgets/WidgetSlider.vue new file mode 100644 index 0000000000..e7f2ece3ef --- /dev/null +++ b/src/components/graph/vueWidgets/WidgetSlider.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/components/graph/vueWidgets/WidgetTextarea.vue b/src/components/graph/vueWidgets/WidgetTextarea.vue new file mode 100644 index 0000000000..e6ba1730f4 --- /dev/null +++ b/src/components/graph/vueWidgets/WidgetTextarea.vue @@ -0,0 +1,30 @@ +