Add icons for all data types
This commit is contained in:
parent
f2cf174557
commit
aefdfabe39
|
@ -1,8 +1,6 @@
|
|||
<script>
|
||||
import { getContext } from "svelte"
|
||||
import SheetCell from "./cells/SheetCell.svelte"
|
||||
import DataCell from "./cells/DataCell.svelte"
|
||||
import { getCellRenderer } from "./renderers"
|
||||
|
||||
export let row
|
||||
export let idx
|
||||
|
@ -11,12 +9,10 @@
|
|||
selectedCellId,
|
||||
reorder,
|
||||
selectedRows,
|
||||
rows,
|
||||
renderedColumns,
|
||||
hoveredRowId,
|
||||
selectedCellMap,
|
||||
selectedCellRow,
|
||||
menu,
|
||||
} = getContext("sheet")
|
||||
|
||||
$: rowSelected = !!$selectedRows[row._id]
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
config,
|
||||
selectedCellMap,
|
||||
selectedCellRow,
|
||||
menu,
|
||||
} = getContext("sheet")
|
||||
|
||||
$: scrollLeft = $scroll.left
|
||||
|
|
|
@ -5,12 +5,22 @@ export const getColor = (idx, opacity = 0.3) => {
|
|||
return `hsla(${((idx + 1) * 222) % 360}, 90%, 75%, ${opacity})`
|
||||
}
|
||||
|
||||
const DataTypeIconMap = {
|
||||
options: "Dropdown",
|
||||
datetime: "Date",
|
||||
text: "Text",
|
||||
barcodeqr: "Camera",
|
||||
longform: "TextAlignLeft",
|
||||
array: "Dropdown",
|
||||
number: "Text",
|
||||
boolean: "Boolean",
|
||||
attachment: "AppleFiles",
|
||||
link: "Link",
|
||||
formula: "Calculator",
|
||||
json: "Brackets",
|
||||
}
|
||||
|
||||
export const getIconForField = field => {
|
||||
const type = field.schema.type
|
||||
if (type === "options") {
|
||||
return "Dropdown"
|
||||
} else if (type === "datetime") {
|
||||
return "Date"
|
||||
}
|
||||
return "Text"
|
||||
return DataTypeIconMap[type] || "Text"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue