Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- web/dist-embed/index.html +0 -0
- web/src/customer-grid/cells.ts +12 -6
- web/src/customer-grid/display.ts +19 -2
web/dist-embed/index.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/src/customer-grid/cells.ts
CHANGED
|
@@ -38,8 +38,8 @@ import { STATUS_BUBBLE } from "./theme";
|
|
| 38 |
// another. C-AVATAR names choiceColors' as the avatar fallback's source, so the two stay
|
| 39 |
// distinguishable at the call site rather than one silently shadowing the other.
|
| 40 |
import { optionTint, pickTint as choicePickTint } from "./choiceColors";
|
| 41 |
-
import { avatarInitials, avatarSize, checkboxOn, dateTimeText,
|
| 42 |
-
userCellPayload } from "./display";
|
| 43 |
import type { CellValue, UserCellData } from "./display";
|
| 44 |
|
| 45 |
// Wave-7 (item W2): the pure display-string half moved to display.ts so the
|
|
@@ -299,8 +299,13 @@ export function makeCell(
|
|
| 299 |
// formula printed as `0` here and in `formatDisplay`, which held its own copy of the same
|
| 300 |
// broken test. `formulaIsText` is now the ONE test, asked of the RAW value, shared by both
|
| 301 |
// renderers precisely because two copies is how they drifted. See its note in display.ts.
|
| 302 |
-
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
return {
|
| 305 |
kind: GridCellKind.Text,
|
| 306 |
data: v,
|
|
@@ -309,10 +314,11 @@ export function makeCell(
|
|
| 309 |
readonly: true,
|
| 310 |
};
|
| 311 |
}
|
|
|
|
| 312 |
return {
|
| 313 |
kind: GridCellKind.Number,
|
| 314 |
-
data:
|
| 315 |
-
displayData:
|
| 316 |
contentAlign: "right",
|
| 317 |
allowOverlay: false,
|
| 318 |
readonly: true,
|
|
|
|
| 38 |
// another. C-AVATAR names choiceColors' as the avatar fallback's source, so the two stay
|
| 39 |
// distinguishable at the call site rather than one silently shadowing the other.
|
| 40 |
import { optionTint, pickTint as choicePickTint } from "./choiceColors";
|
| 41 |
+
import { avatarInitials, avatarSize, checkboxOn, dateTimeText, formulaIsBlank, formulaIsText,
|
| 42 |
+
num, numberText, userCellPayload } from "./display";
|
| 43 |
import type { CellValue, UserCellData } from "./display";
|
| 44 |
|
| 45 |
// Wave-7 (item W2): the pure display-string half moved to display.ts so the
|
|
|
|
| 299 |
// formula printed as `0` here and in `formatDisplay`, which held its own copy of the same
|
| 300 |
// broken test. `formulaIsText` is now the ONE test, asked of the RAW value, shared by both
|
| 301 |
// renderers precisely because two copies is how they drifted. See its note in display.ts.
|
| 302 |
+
// ⚠ `formulaIsBlank`, NOT this function's shared `blank` (which is `v === ""`). A formula
|
| 303 |
+
// returning a SPACE is neither empty by that test nor text by the one below it, so it fell
|
| 304 |
+
// through to the numeric path and painted `0` — `Number(" ")` is 0. The two predicates are
|
| 305 |
+
// written to be total over a formula's three states; using only one of them re-opens the
|
| 306 |
+
// gap in miniature.
|
| 307 |
+
const formulaBlank = formulaIsBlank(v);
|
| 308 |
+
if (!formulaBlank && formulaIsText(v)) {
|
| 309 |
return {
|
| 310 |
kind: GridCellKind.Text,
|
| 311 |
data: v,
|
|
|
|
| 314 |
readonly: true,
|
| 315 |
};
|
| 316 |
}
|
| 317 |
+
const asNum = num(v);
|
| 318 |
return {
|
| 319 |
kind: GridCellKind.Number,
|
| 320 |
+
data: formulaBlank ? undefined : asNum,
|
| 321 |
+
displayData: formulaBlank ? "" : numberText(asNum, field.format),
|
| 322 |
contentAlign: "right",
|
| 323 |
allowOverlay: false,
|
| 324 |
readonly: true,
|
web/src/customer-grid/display.ts
CHANGED
|
@@ -105,6 +105,22 @@ export function formulaIsText(v: CellValue): v is string {
|
|
| 105 |
return typeof v === "string" && v.trim() !== "" && !Number.isFinite(Number(v));
|
| 106 |
}
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
/** A checkbox cell's boolean, out of the overlay's '1'-or-empty contract. */
|
| 109 |
export function checkboxOn(v: CellValue | boolean): boolean {
|
| 110 |
return v === "1" || v === 1 || v === true;
|
|
@@ -192,8 +208,9 @@ export function formatDisplay(field: Field, v: CellValue): string {
|
|
| 192 |
// Found by rendering the owner's own Buy signal formula through the shipped bundle
|
| 193 |
// (_qa_owner_20260803). The branch below is `makeCell`'s test, verbatim: a non-blank,
|
| 194 |
// non-numeric STRING is its own display.
|
| 195 |
-
|
| 196 |
-
if (
|
|
|
|
| 197 |
return numberText(num(v), field.format);
|
| 198 |
}
|
| 199 |
case "int":
|
|
|
|
| 105 |
return typeof v === "string" && v.trim() !== "" && !Number.isFinite(Number(v));
|
| 106 |
}
|
| 107 |
|
| 108 |
+
/**
|
| 109 |
+
* ⛔ AND THE BLANK TEST HAS TO AGREE WITH IT, or a value falls between the two.
|
| 110 |
+
*
|
| 111 |
+
* `formulaIsText` excludes whitespace-only strings (a `" "` result is not TEXT worth painting).
|
| 112 |
+
* The callers' own blank guard was `v === ""`, which does not catch `" "` — so a formula
|
| 113 |
+
* returning a space matched NEITHER, fell through to the numeric path, and printed `0`, because
|
| 114 |
+
* `Number(" ")` is 0. The exact bug this pair was written to fix, surviving in a narrower case.
|
| 115 |
+
*
|
| 116 |
+
* A formula's result is therefore one of exactly three things, and these two predicates make the
|
| 117 |
+
* three TOTAL: blank (null, empty, or whitespace), text, or a number. Reachable in practice —
|
| 118 |
+
* `CONCATENATE(" ", "")` is a space, and so is `TRIM()` of one.
|
| 119 |
+
*/
|
| 120 |
+
export function formulaIsBlank(v: CellValue): boolean {
|
| 121 |
+
return v == null || (typeof v === "string" && v.trim() === "");
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
/** A checkbox cell's boolean, out of the overlay's '1'-or-empty contract. */
|
| 125 |
export function checkboxOn(v: CellValue | boolean): boolean {
|
| 126 |
return v === "1" || v === 1 || v === true;
|
|
|
|
| 208 |
// Found by rendering the owner's own Buy signal formula through the shipped bundle
|
| 209 |
// (_qa_owner_20260803). The branch below is `makeCell`'s test, verbatim: a non-blank,
|
| 210 |
// non-numeric STRING is its own display.
|
| 211 |
+
// The three states, in the one order that makes them total — see `formulaIsBlank`.
|
| 212 |
+
if (formulaIsBlank(v)) return "";
|
| 213 |
+
if (formulaIsText(v)) return v;
|
| 214 |
return numberText(num(v), field.format);
|
| 215 |
}
|
| 216 |
case "int":
|