Ver código fonte

Release notes for #11633

Matt Westcott 3 meses atrás
pai
commit
9889bddcb8
2 arquivos alterados com 26 adições e 0 exclusões
  1. 1 0
      CHANGELOG.txt
  2. 25 0
      docs/releases/6.4.md

+ 1 - 0
CHANGELOG.txt

@@ -94,6 +94,7 @@ Changelog
  * Maintenance: Adopt the update value `mp` instead of `mm` for 'mystery person' as the default Gravatar if no avatar found (Harsh Dange)
  * Maintenance: Refactor search promotions views to use generic views and templates (Sage Abdullah, Rohit Sharma)
  * Maintenance: Use built-in `venv` instead of `pipenv` in CircleCI (Sage Abdullah)
+ * Maintenance: Add a new Stimulus `FormsetController` (`w-formset`) to support dynamic formset insertion/deletion behavior (LB (Ben) Johnston)
 
 
 6.3.2 (xx.xx.xxxx) - IN DEVELOPMENT

+ 25 - 0
docs/releases/6.4.md

@@ -112,6 +112,7 @@ depth: 1
  * Adopt the update value `mp` instead of `mm` for 'mystery person' as the default Gravatar if no avatar found (Harsh Dange)
  * Refactor search promotions views to use generic views and templates (Sage Abdullah, Rohit Sharma)
  * Use built-in `venv` instead of `pipenv` in CircleCI (Sage Abdullah)
+ * Add a new Stimulus `FormsetController` (`w-formset`) to support dynamic formset insertion/deletion behavior (LB (Ben) Johnston)
 
 ## Upgrade considerations - changes affecting all projects
 
@@ -139,3 +140,27 @@ On previous releases, form page models (defined through `AbstractEmailForm`, `Ab
 ### Removal of unused Rangy JS library
 
 The unused JavaScript include `wagtailadmin/js/vendor/rangy-core.js` has been removed from the editor interface, and functions such as `window.rangy.getSelection()` are no longer available. Any code relying on this should now either supply its own copy of the [Rangy library](https://github.com/timdown/rangy), or be migrated to the official [`Document.createRange()`](https://developer.mozilla.org/en-US/docs/Web/API/Range) browser API.
+
+### Deprecation of `window.buildExpandingFormset` global function
+
+The undocumented global function `window.buildExpandingFormset` to attach JavaScript insertion / deletion behavior for Django formsets has been deprecated and will be removed in a future release.
+
+Within the Wagtail admin this only impacts a small set of basic expanding formsets in use across Workflow and Group view editing. `InlinePanel` is not affected.
+
+Previously these expanding formsets required a mix of specific id attribute structures and inline scripts to instantiate with callbacks for handling deletion. User code implementing this functionality through `buildExpandingFormset` should be updated - the following data attributes can be used to emulate the same behavior. These are likely to change and should not be considered official documentation.
+
+| Element                                      | Attribute(s)                              |
+| -------------------------------------------- | ----------------------------------------- |
+| Containing element                           | `data-controller="w-formset"`             |
+| Element to append new child forms            | `data-w-formset-target="forms"`           |
+| Child form element                           | `data-w-formset-target="child"`           |
+| Deleted form element                         | `data-w-formset-target="deleted" hidden`  |
+| `template` element for blank form            | `data-w-formset-target="template"`        |
+| Management field (total forms)               | `data-w-formset-target="totalFormsInput"` |
+| Management field (min forms)                 | `data-w-formset-target="minFormsInput"`   |
+| Management field (max forms)                 | `data-w-formset-target="maxFormsInput"`   |
+| Management field (Delete, within child form) | `data-w-formset-target="deleteInput"`     |
+| Add child `button`                           | `data-action="w-formset#add"`             |
+| Delete child `button` (within child form)    | `data-action="w-formset#delete"`          |
+
+Usage of nested id structures are no longer required but can be left in place for easier debugging.