cotomy 0.1.67 → 0.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,6 +26,7 @@ For the latest updates, please check the official documentation or repository re
26
26
  Attach `data-cotomy-entity-key="<id>"` to the form when editing an existing entity; omit the attribute (or leave it empty) to issue a `POST` to the base `action` URL.
27
27
  On `201 Created`, the form reads the `Location` header and stores the generated key back into `data-cotomy-entity-key`, enabling subsequent `PUT` submissions.
28
28
  Composite or natural keys are no longer supported—migrate any legacy markup that relied on `data-cotomy-keyindex` or multiple key inputs to the new surrogate-key flow.
29
+ When you must integrate with endpoints that still expect natural identifiers, subclass `CotomyEntityApiForm`/`CotomyEntityFillApiForm`, override `canLoad()` to supply your own load condition, and adjust `loadActionUrl()` (plus any submission hooks) to build the appropriate URL fragments.
29
30
 
30
31
  The core of Cotomy is `CotomyElement`, which is constructed as a wrapper for `Element`.
31
32
  By passing HTML and CSS strings to the constructor, it is possible to generate Element designs with a limited scope.
@@ -2656,8 +2656,11 @@ class CotomyEntityFillApiForm extends CotomyEntityApiForm {
2656
2656
  renderer() {
2657
2657
  return new CotomyViewRenderer(this, this.bindNameGenerator());
2658
2658
  }
2659
+ canLoad() {
2660
+ return this.hasEntityKey;
2661
+ }
2659
2662
  async loadAsync() {
2660
- if (!this.hasEntityKey) {
2663
+ if (!this.canLoad()) {
2661
2664
  return new CotomyApiResponse();
2662
2665
  }
2663
2666
  const api = this.apiClient();