cotomy 2.0.2 → 2.0.3
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 +1 -1
- package/dist/browser/cotomy.js +8 -5
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/api.js +8 -5
- package/dist/esm/api.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -271,7 +271,7 @@ The Form layer builds on `CotomyElement` for common form flows.
|
|
|
271
271
|
- `utc` — Treats the value as UTC (or appends `Z` when missing) and formats with `data-cotomy-format` (default `YYYY/MM/DD HH:mm`). By default it renders in local time; set `data-cotomy-timezone` (element or ancestor) to render in a specific IANA timezone.
|
|
272
272
|
- `date` — Renders local dates with `data-cotomy-format` (default `YYYY/MM/DD`) when the input is a valid `Date` value. By default it renders in local time; set `data-cotomy-timezone` (element or ancestor) to render in a specific IANA timezone.
|
|
273
273
|
|
|
274
|
-
`data-cotomy-bindtype` values are matched case-insensitively and surrounding whitespace is ignored. Custom renderers registered through `renderer(type, callback)` are stored with lowercase keys. If you override the protected `renderers` map directly,
|
|
274
|
+
`data-cotomy-bindtype` values are matched case-insensitively and surrounding whitespace is ignored. Custom renderers registered through `renderer(type, callback)` are stored with lowercase keys. If you override the protected `renderers` map directly, keys are also matched case-insensitively.
|
|
275
275
|
|
|
276
276
|
### UTC Renderer
|
|
277
277
|
|
package/dist/browser/cotomy.js
CHANGED
|
@@ -3235,17 +3235,20 @@ class CotomyViewRenderer {
|
|
|
3235
3235
|
return this;
|
|
3236
3236
|
}
|
|
3237
3237
|
bindPrimitiveValue(propertyName, value) {
|
|
3238
|
+
let renderers;
|
|
3238
3239
|
this.element.find(`[data-cotomy-bind="${propertyName}" i]`).forEach(element => {
|
|
3239
3240
|
if (CotomyDebugSettings.isEnabled(CotomyDebugFeature.Bind)) {
|
|
3240
3241
|
console.debug(`Binding data to element [data-cotomy-bind="${propertyName}"]:`, value);
|
|
3241
3242
|
}
|
|
3242
3243
|
const type = element.attribute("data-cotomy-bindtype")?.trim().toLowerCase();
|
|
3243
|
-
if (type
|
|
3244
|
-
this.renderers[
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3244
|
+
if (type) {
|
|
3245
|
+
renderers ?? (renderers = Object.fromEntries(Object.entries(this.renderers).map(([key, renderer]) => [key.toLowerCase(), renderer])));
|
|
3246
|
+
if (renderers[type]) {
|
|
3247
|
+
renderers[type](element, value);
|
|
3248
|
+
return;
|
|
3249
|
+
}
|
|
3248
3250
|
}
|
|
3251
|
+
element.text = String(value ?? "");
|
|
3249
3252
|
});
|
|
3250
3253
|
}
|
|
3251
3254
|
async applyArrayAsync(values, propertyName) {
|