Skip to content

Fix/issues 1666 #1667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

bassmanitram
Copy link

@bassmanitram bassmanitram commented May 15, 2025

  • utilities.js
    • Added checkBooleanOption in order to not repeat the pain of checking if options are set and, if so what are they set to!
    • Added getValueByPath to get a value from a model by its string path (there may be a better way to do this)
  • array.js:
    • Evaluate all options using the new utility in order to fix the original issue of preBuild options are not properly evaluated for array editors #1666
    • Added option array_copy_in_place to allow for both the original array.js behaviour and the table.js behavior
    • Added on_copy_item_label_path option which, if set, allows the editor to modify the label of the copied item by appending Copy to it.
    • Cleaned up some code related to finding referenced values in the current array (OK, I'm not sure why the code looped through the value rather than just directly indexing it - maybe there is a subtle reason)
    • Made some code more flexible so that it could be better inherited
  • table.js
  • multiple.js
    • Added two options - type_path and type_values so that the schema can tell the editor where to look for a value that indicates the "type" of an instance, and what editor it applies to - thus skipping the trial-and-error associated with schema determination. type_path is the path within the value where the type indicator can be found, type_values is an array of possible values of that indicator, in the order of declaration in the schema (which translates into the order of sub-editor instances for the multiple editor).
Q A
Is bugfix? ✔️
New feature? ✔️
Is backward-compatible? ✔️
Tests pass? ✔️ (OK, same failures as master)
Fixed issues #1666
Updated README/docs? ✔️❌
Added CHANGELOG entry? ✔️❌

Martin Bartlett added 6 commits May 13, 2025 11:50
Main enhancements:
* Cleanup and alignment of Table and Array editor code
* New option `array_copy_in_place` determines whether a copied element is
  placed after the element it is copied from, or placed at the end of the array.
  For `array` the default value is `false` corresponding to the existing behaviour.
  For `table` the default value is `true` corresponding to the existing behaviour.
Rather than the potentially expensive validation of a value
against multiple schemata, how about we provide the path to
a value field that tells you the type and an array of values in
the order of declaration!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant