* Add BigInt type * Allow BigInt columns to be added * Sort fixes * Add BigInt field
This commit is contained in:
parent
8986fb3659
commit
89c0d3b389
|
@ -62,6 +62,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getInputMode = type => {
|
||||||
|
if (type === "bigint") {
|
||||||
|
return "numeric"
|
||||||
|
}
|
||||||
|
return type === "number" ? "decimal" : "text"
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
focus = autofocus
|
focus = autofocus
|
||||||
if (focus) field.focus()
|
if (focus) field.focus()
|
||||||
|
@ -103,7 +110,7 @@
|
||||||
{type}
|
{type}
|
||||||
class="spectrum-Textfield-input"
|
class="spectrum-Textfield-input"
|
||||||
style={align ? `text-align: ${align};` : ""}
|
style={align ? `text-align: ${align};` : ""}
|
||||||
inputmode={type === "number" ? "decimal" : "text"}
|
inputmode={getInputMode(type)}
|
||||||
{autocomplete}
|
{autocomplete}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { getSchemaForDatasource } from "../../../dataBinding"
|
||||||
const fieldTypeToComponentMap = {
|
const fieldTypeToComponentMap = {
|
||||||
string: "stringfield",
|
string: "stringfield",
|
||||||
number: "numberfield",
|
number: "numberfield",
|
||||||
|
bigint: "bigintfield",
|
||||||
options: "optionsfield",
|
options: "optionsfield",
|
||||||
array: "multifieldselect",
|
array: "multifieldselect",
|
||||||
boolean: "booleanfield",
|
boolean: "booleanfield",
|
||||||
|
|
|
@ -330,6 +330,7 @@
|
||||||
FIELDS.NUMBER,
|
FIELDS.NUMBER,
|
||||||
FIELDS.BOOLEAN,
|
FIELDS.BOOLEAN,
|
||||||
FIELDS.FORMULA,
|
FIELDS.FORMULA,
|
||||||
|
FIELDS.BIGINT,
|
||||||
]
|
]
|
||||||
// no-sql or a spreadsheet
|
// no-sql or a spreadsheet
|
||||||
if (!external || table.sql) {
|
if (!external || table.sql) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ const componentMap = {
|
||||||
"field/sortable": SortableFieldSelect,
|
"field/sortable": SortableFieldSelect,
|
||||||
"field/string": FormFieldSelect,
|
"field/string": FormFieldSelect,
|
||||||
"field/number": FormFieldSelect,
|
"field/number": FormFieldSelect,
|
||||||
|
"field/bigint": FormFieldSelect,
|
||||||
"field/options": FormFieldSelect,
|
"field/options": FormFieldSelect,
|
||||||
"field/boolean": FormFieldSelect,
|
"field/boolean": FormFieldSelect,
|
||||||
"field/longform": FormFieldSelect,
|
"field/longform": FormFieldSelect,
|
||||||
|
|
|
@ -228,7 +228,7 @@
|
||||||
on:change={event => (filter.value = event.detail)}
|
on:change={event => (filter.value = event.detail)}
|
||||||
{fillWidth}
|
{fillWidth}
|
||||||
/>
|
/>
|
||||||
{:else if ["string", "longform", "number", "formula"].includes(filter.type)}
|
{:else if ["string", "longform", "number", "bigint", "formula"].includes(filter.type)}
|
||||||
<Input disabled={filter.noValue} bind:value={filter.value} />
|
<Input disabled={filter.noValue} bind:value={filter.value} />
|
||||||
{:else if filter.type === "array" || (filter.type === "options" && filter.operator === "oneOf")}
|
{:else if filter.type === "array" || (filter.type === "options" && filter.operator === "oneOf")}
|
||||||
<Multiselect
|
<Multiselect
|
||||||
|
|
|
@ -53,6 +53,10 @@ export const FIELDS = {
|
||||||
numericality: { greaterThanOrEqualTo: "", lessThanOrEqualTo: "" },
|
numericality: { greaterThanOrEqualTo: "", lessThanOrEqualTo: "" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
BIGINT: {
|
||||||
|
name: "BigInt",
|
||||||
|
type: "bigint",
|
||||||
|
},
|
||||||
BOOLEAN: {
|
BOOLEAN: {
|
||||||
name: "Boolean",
|
name: "Boolean",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
|
|
@ -15,12 +15,7 @@
|
||||||
{
|
{
|
||||||
"name": "Layout",
|
"name": "Layout",
|
||||||
"icon": "ClassicGridView",
|
"icon": "ClassicGridView",
|
||||||
"children": [
|
"children": ["container", "section", "grid", "sidepanel"]
|
||||||
"container",
|
|
||||||
"section",
|
|
||||||
"grid",
|
|
||||||
"sidepanel"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Data",
|
"name": "Data",
|
||||||
|
@ -63,6 +58,7 @@
|
||||||
"fieldgroup",
|
"fieldgroup",
|
||||||
"stringfield",
|
"stringfield",
|
||||||
"numberfield",
|
"numberfield",
|
||||||
|
"bigintfield",
|
||||||
"passwordfield",
|
"passwordfield",
|
||||||
"optionsfield",
|
"optionsfield",
|
||||||
"booleanfield",
|
"booleanfield",
|
||||||
|
@ -79,13 +75,6 @@
|
||||||
{
|
{
|
||||||
"name": "Chart",
|
"name": "Chart",
|
||||||
"icon": "GraphBarVertical",
|
"icon": "GraphBarVertical",
|
||||||
"children": [
|
"children": ["bar", "line", "area", "candlestick", "pie", "donut"]
|
||||||
"bar",
|
|
||||||
"line",
|
|
||||||
"area",
|
|
||||||
"candlestick",
|
|
||||||
"pie",
|
|
||||||
"donut"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -2509,6 +2509,57 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"bigintfield": {
|
||||||
|
"name": "BigInt Field",
|
||||||
|
"icon": "TagBold",
|
||||||
|
"styles": ["size"],
|
||||||
|
"requiredAncestors": ["form"],
|
||||||
|
"editable": true,
|
||||||
|
"size": {
|
||||||
|
"width": 400,
|
||||||
|
"height": 50
|
||||||
|
},
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "field/bigint",
|
||||||
|
"label": "Field",
|
||||||
|
"key": "field",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Label",
|
||||||
|
"key": "label"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Placeholder",
|
||||||
|
"key": "placeholder"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Default value",
|
||||||
|
"key": "defaultValue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"label": "On change",
|
||||||
|
"key": "onChange",
|
||||||
|
"context": [
|
||||||
|
{
|
||||||
|
"label": "Field Value",
|
||||||
|
"key": "value"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Disabled",
|
||||||
|
"key": "disabled",
|
||||||
|
"defaultValue": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"passwordfield": {
|
"passwordfield": {
|
||||||
"name": "Password Field",
|
"name": "Password Field",
|
||||||
"icon": "LockClosed",
|
"icon": "LockClosed",
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
const FieldTypeToComponentMap = {
|
const FieldTypeToComponentMap = {
|
||||||
string: "stringfield",
|
string: "stringfield",
|
||||||
number: "numberfield",
|
number: "numberfield",
|
||||||
|
bigint: "bigintfield",
|
||||||
options: "optionsfield",
|
options: "optionsfield",
|
||||||
array: "multifieldselect",
|
array: "multifieldselect",
|
||||||
boolean: "booleanfield",
|
boolean: "booleanfield",
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
on:change={e => onOperatorChange(filter, e.detail)}
|
on:change={e => onOperatorChange(filter, e.detail)}
|
||||||
placeholder={null}
|
placeholder={null}
|
||||||
/>
|
/>
|
||||||
{#if ["string", "longform", "number", "formula"].includes(filter.type)}
|
{#if ["string", "longform", "number", "bigint", "formula"].includes(filter.type)}
|
||||||
<Input disabled={filter.noValue} bind:value={filter.value} />
|
<Input disabled={filter.noValue} bind:value={filter.value} />
|
||||||
{:else if ["options", "array"].includes(filter.type)}
|
{:else if ["options", "array"].includes(filter.type)}
|
||||||
<Combobox
|
<Combobox
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<script>
|
||||||
|
import StringField from "./StringField.svelte"
|
||||||
|
|
||||||
|
export let defaultValue
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<StringField {...$$props} type="bigint" {defaultValue} />
|
|
@ -33,7 +33,10 @@
|
||||||
formStep
|
formStep
|
||||||
)
|
)
|
||||||
|
|
||||||
$: schemaType = fieldSchema?.type !== "formula" ? fieldSchema?.type : "string"
|
$: schemaType =
|
||||||
|
fieldSchema?.type !== "formula" && fieldSchema?.type !== "bigint"
|
||||||
|
? fieldSchema?.type
|
||||||
|
: "string"
|
||||||
|
|
||||||
// Focus label when editing
|
// Focus label when editing
|
||||||
let labelNode
|
let labelNode
|
||||||
|
|
|
@ -2,6 +2,7 @@ export { default as form } from "./Form.svelte"
|
||||||
export { default as fieldgroup } from "./FieldGroup.svelte"
|
export { default as fieldgroup } from "./FieldGroup.svelte"
|
||||||
export { default as stringfield } from "./StringField.svelte"
|
export { default as stringfield } from "./StringField.svelte"
|
||||||
export { default as numberfield } from "./NumberField.svelte"
|
export { default as numberfield } from "./NumberField.svelte"
|
||||||
|
export { default as bigintfield } from "./BigIntField.svelte"
|
||||||
export { default as optionsfield } from "./OptionsField.svelte"
|
export { default as optionsfield } from "./OptionsField.svelte"
|
||||||
export { default as multifieldselect } from "./MultiFieldSelect.svelte"
|
export { default as multifieldselect } from "./MultiFieldSelect.svelte"
|
||||||
export { default as booleanfield } from "./BooleanField.svelte"
|
export { default as booleanfield } from "./BooleanField.svelte"
|
||||||
|
|
|
@ -6,6 +6,7 @@ const schemaComponentMap = {
|
||||||
string: "stringfield",
|
string: "stringfield",
|
||||||
options: "optionsfield",
|
options: "optionsfield",
|
||||||
number: "numberfield",
|
number: "numberfield",
|
||||||
|
bigint: "bigintfield",
|
||||||
datetime: "datetimefield",
|
datetime: "datetimefield",
|
||||||
boolean: "booleanfield",
|
boolean: "booleanfield",
|
||||||
formula: "stringfield",
|
formula: "stringfield",
|
||||||
|
|
|
@ -37,8 +37,12 @@
|
||||||
$: sortedBy = column.name === $sort.column
|
$: sortedBy = column.name === $sort.column
|
||||||
$: canMoveLeft = orderable && idx > 0
|
$: canMoveLeft = orderable && idx > 0
|
||||||
$: canMoveRight = orderable && idx < $renderedColumns.length - 1
|
$: canMoveRight = orderable && idx < $renderedColumns.length - 1
|
||||||
$: ascendingLabel = column.schema?.type === "number" ? "low-high" : "A-Z"
|
$: ascendingLabel = ["number", "bigint"].includes(column.schema?.type)
|
||||||
$: descendingLabel = column.schema?.type === "number" ? "high-low" : "Z-A"
|
? "low-high"
|
||||||
|
: "A-Z"
|
||||||
|
$: descendingLabel = ["number", "bigint"].includes(column.schema?.type)
|
||||||
|
? "high-low"
|
||||||
|
: "Z-A"
|
||||||
|
|
||||||
const editColumn = () => {
|
const editColumn = () => {
|
||||||
dispatch("edit-column", column.schema)
|
dispatch("edit-column", column.schema)
|
||||||
|
|
|
@ -18,6 +18,7 @@ const TypeIconMap = {
|
||||||
link: "DataCorrelated",
|
link: "DataCorrelated",
|
||||||
formula: "Calculator",
|
formula: "Calculator",
|
||||||
json: "Brackets",
|
json: "Brackets",
|
||||||
|
bigint: "TagBold",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getColumnIcon = column => {
|
export const getColumnIcon = column => {
|
||||||
|
|
|
@ -155,7 +155,7 @@ export default class DataFetch {
|
||||||
let sortType = "string"
|
let sortType = "string"
|
||||||
if (sortColumn) {
|
if (sortColumn) {
|
||||||
const type = schema?.[sortColumn]?.type
|
const type = schema?.[sortColumn]?.type
|
||||||
sortType = type === "number" ? "number" : "string"
|
sortType = type === "number" || type === "bigint" ? "number" : "string"
|
||||||
}
|
}
|
||||||
this.options.sortType = sortType
|
this.options.sortType = sortType
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ function generateSchema(
|
||||||
schema.float(key)
|
schema.float(key)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case FieldTypes.BIGINT:
|
||||||
|
schema.bigint(key)
|
||||||
|
break
|
||||||
case FieldTypes.BOOLEAN:
|
case FieldTypes.BOOLEAN:
|
||||||
schema.boolean(key)
|
schema.boolean(key)
|
||||||
break
|
break
|
||||||
|
|
|
@ -48,7 +48,6 @@ const SQL_STRING_TYPE_MAP = {
|
||||||
blob: FieldTypes.STRING,
|
blob: FieldTypes.STRING,
|
||||||
long: FieldTypes.STRING,
|
long: FieldTypes.STRING,
|
||||||
text: FieldTypes.STRING,
|
text: FieldTypes.STRING,
|
||||||
bigint: FieldTypes.STRING,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const SQL_BOOLEAN_TYPE_MAP = {
|
const SQL_BOOLEAN_TYPE_MAP = {
|
||||||
|
@ -59,6 +58,7 @@ const SQL_BOOLEAN_TYPE_MAP = {
|
||||||
|
|
||||||
const SQL_MISC_TYPE_MAP = {
|
const SQL_MISC_TYPE_MAP = {
|
||||||
json: FieldTypes.JSON,
|
json: FieldTypes.JSON,
|
||||||
|
bigint: FieldTypes.BIGINT,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SQL_TYPE_MAP = {
|
const SQL_TYPE_MAP = {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export const getValidOperatorsForType = (
|
||||||
}[] = []
|
}[] = []
|
||||||
if (type === "string") {
|
if (type === "string") {
|
||||||
ops = stringOps
|
ops = stringOps
|
||||||
} else if (type === "number") {
|
} else if (type === "number" || type === "bigint") {
|
||||||
ops = numOps
|
ops = numOps
|
||||||
} else if (type === "options") {
|
} else if (type === "options") {
|
||||||
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
|
||||||
|
|
|
@ -15,6 +15,7 @@ export enum FieldType {
|
||||||
JSON = "json",
|
JSON = "json",
|
||||||
INTERNAL = "internal",
|
INTERNAL = "internal",
|
||||||
BARCODEQR = "barcodeqr",
|
BARCODEQR = "barcodeqr",
|
||||||
|
BIGINT = "bigint",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RowAttachment {
|
export interface RowAttachment {
|
||||||
|
|
Loading…
Reference in New Issue