@samline/forms 2.7.0 → 2.7.1
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 +3 -3
- package/dist/browser/global.global.js +7 -2
- package/dist/browser/global.global.js.map +1 -1
- package/dist/browser/index.cjs +7 -2
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{chunk-WGPAVJTK.js → chunk-MMHX34WB.js} +8 -3
- package/dist/chunk-MMHX34WB.js.map +1 -0
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/docs/api/format.md +3 -3
- package/docs/browser.md +4 -4
- package/docs/getting-started.md +1 -1
- package/docs/recipes.md +1 -0
- package/package.json +1 -1
- package/dist/chunk-WGPAVJTK.js.map +0 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -295,6 +295,10 @@ var buildAutoInterpretedOptions = (formatOptions) => ({
|
|
|
295
295
|
...formatOptions ?? {},
|
|
296
296
|
interpretInputAs: "auto"
|
|
297
297
|
});
|
|
298
|
+
var buildDisplayInterpretedOptions = (formatOptions) => ({
|
|
299
|
+
...formatOptions ?? {},
|
|
300
|
+
interpretInputAs: "display"
|
|
301
|
+
});
|
|
298
302
|
var shouldForceAutoInterpretation = (formatOptions) => formatOptions?.interpretInputAs === void 0;
|
|
299
303
|
var buildHandler = (visible, mirror, formatFn, formatType, formatOptions) => {
|
|
300
304
|
const handler = (event) => {
|
|
@@ -304,7 +308,7 @@ var buildHandler = (visible, mirror, formatFn, formatType, formatOptions) => {
|
|
|
304
308
|
if (!isVisible && !isMirror) return;
|
|
305
309
|
const rawInput = isMirror ? mirror.value : visible.value;
|
|
306
310
|
const inputType = readInputType(event);
|
|
307
|
-
const sourceOptions =
|
|
311
|
+
const sourceOptions = shouldForceAutoInterpretation(formatOptions) ? isMirror ? buildAutoInterpretedOptions(formatOptions) : buildDisplayInterpretedOptions(formatOptions) : formatOptions;
|
|
308
312
|
const { formatted, raw } = formatFn(rawInput, formatType, sourceOptions);
|
|
309
313
|
if (!formatted && !raw) {
|
|
310
314
|
visible.value = "";
|
|
@@ -386,7 +390,8 @@ var applyFormat = async (state2, helpers, config) => {
|
|
|
386
390
|
if (entry.handler !== UNBOUND) {
|
|
387
391
|
const current = entry.visible.value;
|
|
388
392
|
if (current !== "") {
|
|
389
|
-
const
|
|
393
|
+
const rebindOptions = shouldForceAutoInterpretation(formatOptions) ? buildDisplayInterpretedOptions(formatOptions) : formatOptions;
|
|
394
|
+
const { formatted, raw } = formatter.format(current, formatType, rebindOptions);
|
|
390
395
|
applyFormattedValue(entry.visible, entry.mirror, formatted, raw);
|
|
391
396
|
}
|
|
392
397
|
continue;
|