@samline/forms 2.7.0 → 2.7.2

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.
@@ -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 = isMirror && shouldForceAutoInterpretation(formatOptions) ? buildAutoInterpretedOptions(formatOptions) : formatOptions;
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 { formatted, raw } = formatter.format(current, formatType, formatOptions);
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;