Page MenuHomePhabricator

[VE WikifunctionsCall]: Add CdxTextInput field support for types with Parsers
Closed, ResolvedPublic

Description

Description

In FunctionInputSetup.vue (VE dialog, second screen: function call configuration), add support in the TextInput field to handle inputs that expect types with Parser functions.

Store modules (ztype.js, library.js, testResults.js...) already provide the necessary functions to deal with these types.
See ZObjectStringRenderer component for an example of fields with parsers/renderers.

Desired behavior/Acceptance criteria

  • When an input expected type has a parser, the text input field should be able to handle and validate the input
  • On initialization, validate:
    • non empty string, parser function must run without errors
    • if the parser function fails, show an error
  • On text field update, validate:
    • non empty string, parser function must run without errors
    • if the parser function fails, show an error and emit empty value to VE
    • if the parser function succeeds, emit the string value to VE

Also, following ZObjectStringRenderer component:

  • The collapsed field placeholder shows an example from the renderer function tests
    • The example should be shown in the user language
    • If no valid test is found for the renderer function, fallback to a hardcoded placeholder

Devices and Design (URLs or screenshots)

  • Desktop: ...
  • Small screens/mobile: ...

Completion checklist

Event Timeline

DSmit-WMF changed the task status from Open to In Progress.Mar 10 2025, 9:57 AM
DSmit-WMF claimed this task.

Change #1126962 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] [VE WikifunctionsCall]: Add CdxTextInput field support for types with Parsers

https://gerrit.wikimedia.org/r/1126962

Change #1126962 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] [VE WikifunctionsCall]: Add CdxTextInput field support for types with Parsers

https://gerrit.wikimedia.org/r/1126962

Jdforrester-WMF subscribed.

No need to wait for deploy on this one, as it's not live in prod.