Skip to content
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

Add Tabulator Input + Add Translatable Value + Improve Structure Properties #81

Merged
merged 53 commits into from
Mar 13, 2024

Conversation

mcaskill
Copy link
Collaborator

Admin

  • Add support for ES6 in the asset build.
  • Add AbstractPropertyInput::getInputValOptions() to allow input sub-classes to define their own set of options to parse input values.
  • Add input that integrates Tabulator for tabular data editing.
  • Improve handling of JSON values with TabulatorInput, JsonEditorInput, and TextareaInput.
  • Prioritize form_group over default_form_group in StructureFormGroup to allow for custom one-off form groups.

Property

  • Validate models in ModelStructureProperty.

Translator

  • Rework the translation system to standardize translatable values with new TranslatableInterface and add a new TranslatableValue to dissociate from Translation which is tied with the Translator and LocalesManager.
  • Add awareness of TranslatableValue to Property package.

@mcaskill mcaskill marked this pull request as draft December 14, 2023 23:53
@mcaskill mcaskill force-pushed the joel/feature/tabulator-input branch 2 times, most recently from 41d3a1c to ae05a1e Compare December 18, 2023 23:50
@mcaskill mcaskill marked this pull request as ready for review March 5, 2024 15:55
…andardize translatables with TranslatableInterface.php and add a new TranslatableValue.php enabling dissociating translation from the core translator
…trans` method signature and update `TranslatableValue` with said method and deprecate `each` and `sanitize` for future version of charcoal
…rty.php

- remove inputVal from StructureProperty.php
…tache since it's no longer needed following changes to TranslatableValue and AbstractProperty/Input
Changed:
- Update Node from v14 to v16.
- Update NPM from v8 to v9.
- Update Node Sass from v7 to v9.
- Update lockfile.
Added support to prioritize "form_group" over "default_form_group" to allow for custom one-off form groups.
Added support for validating model structures
@mcaskill mcaskill force-pushed the joel/feature/tabulator-input branch from ae05a1e to b4af3bf Compare March 5, 2024 16:49
JoelAlphonso and others added 4 commits March 5, 2024 11:51
Changed:
- Ensure instantiated menu item is an instance of `AuthAwareInterface` before testing authorization.
- Add missing class properties for menu and menu item builders.
Improve 'metadata/config' and 'view/config'.

Changed:
- Ensure extra paths are defined before merging.
- Add support for extra module paths to 'translator/config'.
…nput

Resolves #88

Add input option `form_widget` to `SelectizeInput` and `Selectize\TagsInput` and default to "charcoal/admin/widget/quick-form".
@mcaskill mcaskill force-pushed the joel/feature/tabulator-input branch from 2d8c73f to b407dfb Compare March 6, 2024 02:44
mcaskill added 11 commits March 11, 2024 13:07
When there's only a heading, collapse the bottom margin.
If no layout is defined, create a layout of single columns matching the number of properties to render.
Changed:
- Add ordered list (`numlist`) to toolbar.
- Disable menubar.
- Disable plugins `code` and `pagebreak`.
- Remove "_blank" as default link target.
- Sort options.
Add options `dialog_title_create` and `dialog_title_update` to customize the dialog to create or update an option. Defaults to the property's label.
Changed:
- Display all form groups when quick form is tabbed by language.
- Replaced default `.nav-pills` with `.nav-tabs` for a better appearance.
- Fixed spacing between groups with and without headers.
- Fixed disappeared language prefixes (amends 524ec25).
- Fixed and improved appearance of tabs in quick form.
Also fixed indentation of CSS.
Changed:
- Add method for default tabulator options.
- Translate the tabulator placeholder option.
- Translate tabulator column tooltip.
- Sort methods by visibility.
…inerTrait

See https://locomotivemtl.slack.com/archives/C02G3F7JV/p1699466030801199

A `Metadata` instance is shared by instances of the same class, when retrieved from the `MetadataLoader`.

For example, all instances of a `Page` model will share the same `ModelMetadata` instance. Same applies to properties, all instances of `StringProperty` will share the same `PropertyMetadata` instance, regardless of its related model and model property ident.

This was causing issue for me this morning with `TableWidget` where two different properties (e.g., `full_name` and `computed_thing`) used the same property type `string` but two different display types (`TextDisplay` and `CustomDisplay`). The `TextDisplay` was not defined on full_name but `CustomDisplay` was for `computed_thing`. From the second row onwards, the `full_name` wasn’t rendering like the first row. The source of the issue is that `CollectionContainerTrait::setupDisplayPropertyValue()` merges a model’s property definition (where the custom `display_type` is defined) into its property’s (`StringProperty`) metadata instance.

The `CollectionContainerTrait::setupDisplayPropertyValue()` method will now clone the property type metadata to avoid conflicts.
Changed `StructureFormGroup::formProperties()` to filter property metadata by structure model (new feature) and parent model (existing feature).

BREAKING: The parent model property now receives both its structure/storage property and the structure's sub-property as a dot-delimited key path: `<storageProperty>.<childProperty>`. This fixes the risk of conflicting property identifiers where a structure's child property inherits the parent model's property mutations and fixes the missing context for the structure's property.
@mcaskill mcaskill force-pushed the joel/feature/tabulator-input branch from 70d2bb5 to e582431 Compare March 11, 2024 18:39
mcaskill and others added 12 commits March 11, 2024 16:11
Available from `Charcoal.Admin.debounce()`.
Add support for TinyMCE's Notifications Manager to provide validity feedback: we add an error notification when the form dispatches an `invalid` event.

Since TinyMCE does not properly support editors inside dialogs, notifications are positionned absolutely, outside of the modal, from the bottom of the DOM. This risks positioning them outside of the viewport. To work around this issue, a debounced `scroll` event is used to reposition any notifications.
Ensure the method returns any value and not just a string.
Changed:
- When column is required, a red asterisk is appended to the column title.
- Column title will be prepended to the row index in the validation feedback message.
- Duplicate validation messages will be suppressed to minimize noise.
Removed `defaultColumnTemplate` in favour of `columnDefaults` introduced in Tabulator 5.0.
@JoelAlphonso JoelAlphonso merged commit 458cf06 into main Mar 13, 2024
36 checks passed
@charcoal-butler
Copy link
Contributor

🎉 This PR is included in version 5.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@mcaskill mcaskill deleted the joel/feature/tabulator-input branch October 16, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants