Prune files not in the deploy set (stale build context)
Browse files
web/src/customer-grid/mapSetup.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
// ---------------------------------------------------------------------------
|
| 2 |
-
// customer-grid / mapSetup.ts
|
| 3 |
-
// The Map capability contract: built-in `lat`/`lon` is a default when the payload
|
| 4 |
-
// supplies it; every other table must explicitly choose one `latitude, longitude`
|
| 5 |
-
// text-like field before Map can open.
|
| 6 |
-
// ---------------------------------------------------------------------------
|
| 7 |
-
|
| 8 |
-
import type { Field, Row } from "./types";
|
| 9 |
-
|
| 10 |
-
type CoordinateField = Pick<Field, "key" | "type">;
|
| 11 |
-
|
| 12 |
-
/** A single custom coordinate cell is parsed by MapView as `latitude, longitude`. */
|
| 13 |
-
export function isMapCoordinateField(field: Pick<Field, "type">): boolean {
|
| 14 |
-
return field.type === "text" || field.type === "url" || field.type === "email";
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Odoo's coordinates are transport values and are deliberately absent from the ordinary visible
|
| 19 |
-
* field list. A table may instead publish the pair as normal fields, so both schema surfaces count.
|
| 20 |
-
*/
|
| 21 |
-
export function hasBuiltInMapCoordinates(
|
| 22 |
-
fields: readonly CoordinateField[],
|
| 23 |
-
rows: readonly Row[],
|
| 24 |
-
): boolean {
|
| 25 |
-
return (
|
| 26 |
-
(fields.some((field) => field.key === "lat") && fields.some((field) => field.key === "lon"))
|
| 27 |
-
|| rows.some((row) => (
|
| 28 |
-
Object.prototype.hasOwnProperty.call(row, "lat")
|
| 29 |
-
&& Object.prototype.hasOwnProperty.call(row, "lon")
|
| 30 |
-
))
|
| 31 |
-
);
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
/** The exact capability gate used before Map changes mode. */
|
| 35 |
-
export function mapCoordinatesReady(
|
| 36 |
-
fields: readonly CoordinateField[],
|
| 37 |
-
rows: readonly Row[],
|
| 38 |
-
coordField?: string,
|
| 39 |
-
): boolean {
|
| 40 |
-
return hasBuiltInMapCoordinates(fields, rows)
|
| 41 |
-
|| !!coordField && fields.some((field) => (
|
| 42 |
-
field.key === coordField && isMapCoordinateField(field)
|
| 43 |
-
));
|
| 44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|