diff --git a/CHANGELOG.md b/CHANGELOG.md index 8223c5f6da5c..1d2c936456cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,15 @@ - [Copy-pasting multiple nodes][10194]. - The documentation editor has [formatting toolbars][10064]. - The documentation editor supports [rendering images][10205]. +- [Fixed a bug where drop-down were not displayed for some arguments][10297]. + For example, `locale` parameter of `Equal_Ignore_Case` kind in join component. [10064]: https://github.com/enso-org/enso/pull/10064 [10179]: https://github.com/enso-org/enso/pull/10179 [10194]: https://github.com/enso-org/enso/pull/10194 [10198]: https://github.com/enso-org/enso/pull/10198 [10205]: https://github.com/enso-org/enso/pull/10205 +[10297]: https://github.com/enso-org/enso/pull/10297 #### Enso Standard Library diff --git a/app/gui2/mock/engine.ts b/app/gui2/mock/engine.ts index 83324aa0f7a8..2adc5dc7b0e7 100644 --- a/app/gui2/mock/engine.ts +++ b/app/gui2/mock/engine.ts @@ -170,13 +170,96 @@ const mockVizPreprocessors: Record U 'warning 1', "warning 2!!&<>;'\x22", ]), - 'Standard.Visualization.Widgets.get_widget_json': (params) => { - switch (params[0]) { - case '.read': - return encodeJSON([ - [ - 'path', - { + 'Standard.Visualization.Widgets.get_widget_json': (params) => mockWidgetConfiguration(params[0]), + + // The following visualizations do not have unique transformation methods, and as such are only kept + // for posterity. + Image: encodeJSON({ + mediaType: 'image/svg+xml', + base64: `PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0\ +MCI+PGcgY2xpcC1wYXRoPSJ1cmwoI2EpIj48cGF0aCBkPSJNMjAuMDUgMEEyMCAyMCAwIDAgMCAwIDIwLjA1IDIwLjA2IDIwLjA\ +2IDAgMSAwIDIwLjA1IDBabTAgMzYuMDVjLTguOTMgMC0xNi4xLTcuMTctMTYuMS0xNi4xIDAtOC45NCA3LjE3LTE2LjEgMTYuMS\ +0xNi4xIDguOTQgMCAxNi4xIDcuMTYgMTYuMSAxNi4xYTE2LjE4IDE2LjE4IDAgMCAxLTE2LjEgMTYuMVoiLz48cGF0aCBkPSJNM\ +jcuMTIgMTcuNzdhNC42OCA0LjY4IDAgMCAxIDIuMzkgNS45MiAxMC4yMiAxMC4yMiAwIDAgMS05LjU2IDYuODZBMTAuMiAxMC4y\ +IDAgMCAxIDkuNzcgMjAuMzZzMS41NSAyLjA4IDQuNTcgMi4wOGMzLjAxIDAgNC4zNi0xLjE0IDUuNi0yLjA4IDEuMjUtLjkzIDI\ +uMDktMyA1LjItMyAuNzMgMCAxLjQ2LjIgMS45OC40WiIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImEiPjxwYXRoIGZpbGw9Ii\ +NmZmYiIGQ9Ik0wIDBoNDB2NDBIMHoiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=`, + }), + Heatmap: encodeJSON([ + ['A', 'B', 'C', 'D', 'A'], + ['D', 'E', 'D', 'X', 'Z'], + [50, 25, 40, 20, 10], + ]), +} + +function mockWidgetConfiguration(method: string | undefined) { + switch (method) { + case '.read': + return encodeJSON([ + [ + 'path', + { + type: 'Widget', + constructor: 'Single_Choice', + label: null, + values: [ + { + type: 'Choice', + constructor: 'Option', + value: '"File 1"', + label: 'File 1', + parameters: [], + }, + { + type: 'Choice', + constructor: 'Option', + value: '"File 2"', + label: 'File 2', + parameters: [], + }, + ], + display: { type: 'Display', constructor: 'Always' }, + }, + ], + ]) + case '.select_columns': + return encodeJSON([ + [ + 'columns', + { + type: 'Widget', + constructor: 'Multiple_Choice', + label: null, + values: [ + { + type: 'Choice', + constructor: 'Option', + value: "'Column A'", + label: 'Column A', + parameters: [], + }, + { + type: 'Choice', + constructor: 'Option', + value: "'Column B'", + label: 'Column B', + parameters: [], + }, + ], + display: { type: 'Display', constructor: 'Always' }, + }, + ], + ]) + case '.aggregate': + return encodeJSON([ + [ + 'columns', + { + type: 'Widget', + constructor: 'Vector_Editor', + /* eslint-disable camelcase */ + item_default: 'Aggregate_Column.Group_By', + item_editor: { type: 'Widget', constructor: 'Single_Choice', label: null, @@ -184,168 +267,87 @@ const mockVizPreprocessors: Record U { type: 'Choice', constructor: 'Option', - value: '"File 1"', - label: 'File 1', - parameters: [], + value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Group_By', + label: null, + parameters: [ + [ + 'column', + { + type: 'Widget', + constructor: 'Single_Choice', + label: null, + values: [ + { + type: 'Choice', + constructor: 'Option', + value: '"column 1"', + label: 'column 1', + parameters: [], + }, + { + type: 'Choice', + constructor: 'Option', + value: '"column 2"', + label: 'column 2', + parameters: [], + }, + ], + display: { type: 'Display', constructor: 'Always' }, + }, + ], + ], }, { type: 'Choice', constructor: 'Option', - value: '"File 2"', - label: 'File 2', - parameters: [], - }, - ], - display: { type: 'Display', constructor: 'Always' }, - }, - ], - ]) - case '.select_columns': - return encodeJSON([ - [ - 'columns', - { - type: 'Widget', - constructor: 'Multiple_Choice', - label: null, - values: [ - { - type: 'Choice', - constructor: 'Option', - value: "'Column A'", - label: 'Column A', + value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Count', + label: null, parameters: [], }, { type: 'Choice', constructor: 'Option', - value: "'Column B'", - label: 'Column B', - parameters: [], + value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Count_Distinct', + label: null, + parameters: [ + [ + 'columns', + { + type: 'Widget', + constructor: 'Single_Choice', + label: null, + values: [ + { + type: 'Choice', + constructor: 'Option', + value: '"column 1"', + label: 'column 1', + parameters: [], + }, + { + type: 'Choice', + constructor: 'Option', + value: '"column 2"', + label: 'column 2', + parameters: [], + }, + ], + display: { type: 'Display', constructor: 'Always' }, + }, + ], + ], }, ], display: { type: 'Display', constructor: 'Always' }, }, - ], - ]) - case '.aggregate': - return encodeJSON([ - [ - 'columns', - { - type: 'Widget', - constructor: 'Vector_Editor', - /* eslint-disable camelcase */ - item_default: 'Aggregate_Column.Group_By', - item_editor: { - type: 'Widget', - constructor: 'Single_Choice', - label: null, - values: [ - { - type: 'Choice', - constructor: 'Option', - value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Group_By', - label: null, - parameters: [ - [ - 'column', - { - type: 'Widget', - constructor: 'Single_Choice', - label: null, - values: [ - { - type: 'Choice', - constructor: 'Option', - value: '"column 1"', - label: 'column 1', - parameters: [], - }, - { - type: 'Choice', - constructor: 'Option', - value: '"column 2"', - label: 'column 2', - parameters: [], - }, - ], - display: { type: 'Display', constructor: 'Always' }, - }, - ], - ], - }, - { - type: 'Choice', - constructor: 'Option', - value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Count', - label: null, - parameters: [], - }, - { - type: 'Choice', - constructor: 'Option', - value: 'Standard.Table.Aggregate_Column.Aggregate_Column.Count_Distinct', - label: null, - parameters: [ - [ - 'columns', - { - type: 'Widget', - constructor: 'Single_Choice', - label: null, - values: [ - { - type: 'Choice', - constructor: 'Option', - value: '"column 1"', - label: 'column 1', - parameters: [], - }, - { - type: 'Choice', - constructor: 'Option', - value: '"column 2"', - label: 'column 2', - parameters: [], - }, - ], - display: { type: 'Display', constructor: 'Always' }, - }, - ], - ], - }, - ], - display: { type: 'Display', constructor: 'Always' }, - }, - /* eslint-enable camelcase */ - display: { type: 'Display', constructor: 'Always' }, - }, - ], - ]) - default: - return encodeJSON([]) - } - }, - - // The following visualizations do not have unique transformation methods, and as such are only kept - // for posterity. - Image: encodeJSON({ - mediaType: 'image/svg+xml', - base64: `PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0\ -MCI+PGcgY2xpcC1wYXRoPSJ1cmwoI2EpIj48cGF0aCBkPSJNMjAuMDUgMEEyMCAyMCAwIDAgMCAwIDIwLjA1IDIwLjA2IDIwLjA\ -2IDAgMSAwIDIwLjA1IDBabTAgMzYuMDVjLTguOTMgMC0xNi4xLTcuMTctMTYuMS0xNi4xIDAtOC45NCA3LjE3LTE2LjEgMTYuMS\ -0xNi4xIDguOTQgMCAxNi4xIDcuMTYgMTYuMSAxNi4xYTE2LjE4IDE2LjE4IDAgMCAxLTE2LjEgMTYuMVoiLz48cGF0aCBkPSJNM\ -jcuMTIgMTcuNzdhNC42OCA0LjY4IDAgMCAxIDIuMzkgNS45MiAxMC4yMiAxMC4yMiAwIDAgMS05LjU2IDYuODZBMTAuMiAxMC4y\ -IDAgMCAxIDkuNzcgMjAuMzZzMS41NSAyLjA4IDQuNTcgMi4wOGMzLjAxIDAgNC4zNi0xLjE0IDUuNi0yLjA4IDEuMjUtLjkzIDI\ -uMDktMyA1LjItMyAuNzMgMCAxLjQ2LjIgMS45OC40WiIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImEiPjxwYXRoIGZpbGw9Ii\ -NmZmYiIGQ9Ik0wIDBoNDB2NDBIMHoiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=`, - }), - Heatmap: encodeJSON([ - ['A', 'B', 'C', 'D', 'A'], - ['D', 'E', 'D', 'X', 'Z'], - [50, 25, 40, 20, 10], - ]), + /* eslint-enable camelcase */ + display: { type: 'Display', constructor: 'Always' }, + }, + ], + ]) + default: + return encodeJSON([]) + } } function createMessageId(builder: Builder) { @@ -361,11 +363,13 @@ function createId(id: Uuid) { function sendVizData(id: Uuid, config: VisualizationConfiguration, expressionId?: Uuid) { const vizDataHandler = - mockVizPreprocessors[ - typeof config.expression === 'string' ? - `${config.visualizationModule}.${config.expression}` - : `${config.expression.definedOnType}.${config.expression.name}` - ] + typeof config.expression === 'string' ? + // Getting widget configuration is a special case, where we sometimes pass lambda as + // expression to discard the input value + /^[a-z_]+ *->.*get_widget_json/.test(config.expression) ? + mockWidgetConfiguration(config.positionalArgumentsExpressions?.at(0)) + : mockVizPreprocessors[`${config.visualizationModule}.${config.expression}`] + : mockVizPreprocessors[`${config.expression.definedOnType}.${config.expression.name}`] if (!vizDataHandler || !sendData) return const vizData = vizDataHandler instanceof Uint8Array ? vizDataHandler : ( diff --git a/app/gui2/src/components/GraphEditor/widgets/WidgetFunction.vue b/app/gui2/src/components/GraphEditor/widgets/WidgetFunction.vue index 084f795f34d9..2229af583b50 100644 --- a/app/gui2/src/components/GraphEditor/widgets/WidgetFunction.vue +++ b/app/gui2/src/components/GraphEditor/widgets/WidgetFunction.vue @@ -1,5 +1,7 @@