Skip to content

feat(react): pick a column's decimal mark in the import preview - #949

Merged
eizedev merged 18 commits into
mainfrom
feat/import-decimal-mark
Nov 25, 2026
Merged

eizedev merged 18 commits into
mainfrom
feat/import-decimal-mark

Conversation

@eizedev

@eizedev eizedev commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

In the import preview, a person can now pick how a number column with one separator is read. Before, a file that reads 1.500 as 1.5 instead of 1500 could only be fixed by editing the file.

Fixes #787

pivotkit-core

  • retype(table, types, { decimal }) forces a column's decimal mark, by name or by position. Entries that are not valid are ignored. The DECIMAL_MARK note carries the example's two readings, point and comma.
  • retype has its own section in docs/reference/import.md, with types.

pivotkit-react

  • When a column carries a DECIMAL_MARK note, the preview shows a question under the column's type: "“1,234” means". Below it is a list with two readings:
    • "1 point 234" (German: "1 Komma 234");
    • "1234 (thousands)" (German: "1234 (Tausender)").
  • Both readings are spelled out from the example as written. No option repeats the question's own form in any language or locale, and no option mixes digit systems or minus signs.
  • The visible question is the list's label. The column name is added for screen readers. The choice widens its column so the whole option shows on a 390 px phone.
  • New label keys markOf, markQuestion and markOption are documented in docs/reference/localisation.md. If one of them is missing, the choice is not shown.

pivotkit-element

  • The import group grows to 23.7 KiB gzip, and its budget to 23.9 KiB (Node 24, as in CI). The first load stays under its budget.

Neutral review

I ran five rounds of independent review on the local branch before pushing. Fixed because of them:

  • the list has an accessible name;
  • the options name the value they read as;
  • the German and the English options were circular and are now spelled out;
  • guards for missing texts;
  • the list's width on phones;
  • the label keys are documented;
  • one digit system and one minus sign per list.

The last round found nothing blocking.

Left as is: the terse "(thousands)" wording and the list's title.

Checklist (PRODUCT.md)

  • Linked issue
  • New or changed tests fail without this change; no test weakened. The option-text tests were shown red against the old code under sv_SE, fa_IR and ar_EG runtime locales.
  • Docs (load-data.md, import.md, localisation.md, upgrading notes) and CHANGELOG.md (core, react, element) describe the new state
  • Reviewed before opening by a separate AI session

Test plan

  • npm run lint, npm run types, npm run growth, npm run pack:check: exit 0
  • npm test: exit 0 on the last run. Two earlier runs failed in pivotkit-cli and pivotkit-mcp timing tests, which this branch does not touch; each passed alone.
  • Full npm run test:browser: 2800 passed on the state before the last round. After it, import.spec.js in chromium, firefox and webkit: 114 passed.
  • PowerShell Universal preview with these packages: 138 passed, 18 skipped

🤖 Generated with Claude Code

eizedev and others added 18 commits November 25, 2026 18:24
retype(table, types, { decimal }) takes the decimal mark of number
columns by name or position. Their text reads in that mark alone; a
value that does not fit it is blank, with a note. The note DECIMAL_MARK
stays with the mark picked and gives the example's number with each
mark (params point and comma), so a preview can offer both.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a number column with the note DECIMAL_MARK, the preview offers
both marks as what the note's example is with each, such as
"1,234" = 1234 (decimal point) and "1,234" = 1.234 (decimal comma), in
English and German. The note points there instead of to the file. The
column head is a component of its own, so ImportDialog shrinks.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A narrow column cut "“1,234” = 1234 (decimal point)" before the part
that differs. The options now read "1234 (“1,234” in the file)" from
one text, markReads. The note and the hint about columns past the first
60 say what holds for those too: they keep the mark found, and the file
can be changed. A note without the example's two numbers (a plugin's
own) offers no choice.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The closed select had no visible label and clipped its option text in
German and on a phone. A small label above it now asks the question with
the example from the file ("“1,234” means"), the options are just the
value as it reads with each mark, and the select has a title with the
full text. The choice shows only for a note with finite values for both
marks. Column heads start at the top so the type selects align.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge the decimal paragraph into the retype paragraph under a section of
its own, say when the note DECIMAL_MARK stays and that a mark forced on
another column blanks values that do not fit, and point the 0.10 upgrade
row to the new choice. The type consumer exercises retype's decimal by
name and by position.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/pivotkit-core/CHANGELOG.md
#	packages/pivotkit-element/CHANGELOG.md
#	packages/pivotkit-element/build.js
The question above the select is now its label, so the accessible name
holds the visible text (the column follows for a screen reader) and a
click on the question focuses the select. The options say whether the
example's separator is the decimal mark or groups thousands, and the
select widens to show them whole on a phone. The note says how to change
the choice in the words the control uses. markTexts builds the texts and
offers no choice for a note without both numbers or a mark, now tested.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The type consumer now also checks that a wrong mark or a single mark
instead of a list or record is rejected.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Next to the question „1,234“ bedeutet, the option "1,234 (Dezimal)" read
as "1,234 means 1,234". In German the decimal option now spells the
reading out from the example's digits as written, „1 Komma 234“, with
its sign and trailing zeros; the thousands option and English stay.

Refs #787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
English labels showed the decimal reading in the locale's notation, so
under de-DE, fr-FR or sv-SE the question "“1,234” means" offered
"1,234 (decimal)", the circular text the German fix removed. The English
option now reads "1 point 234" from the example's digits as written, as
German reads "1 Komma 234".

markTexts offers no choice when the texts lack markQuestion or the two
markOption texts. The localisation reference names the keys, their
placeholders and why the decimal text must not show the separator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The thousands option came from toLocaleString, so one select mixed the
file's ASCII digits with the locale's: "١٢٣٤ (thousands)" next to
"1 point 234" under ar-EG, a U+2212 minus under sv-SE, direction marks
under fa-IR and ar-EG. Both options now take the example's characters,
the thousands reading its digits joined without the separator, and
markTexts no longer takes a locale.

markTexts offers no choice without a markOf text either. The
localisation reference says how markOf joins the question, that a
missing text hides the choice, and why the decimal text spells the
mark out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/pivotkit-core/CHANGELOG.md
#	packages/pivotkit-element/build.js
#	scripts/growth-baseline.json
@eizedev
eizedev merged commit fa2e21a into main Nov 25, 2026
26 checks passed
@eizedev
eizedev deleted the feat/import-decimal-mark branch November 25, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import: let a person pick a column's decimal mark in the preview

1 participant