diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte
index 308a57c394..f8b5abc4cd 100644
--- a/packages/builder/src/components/backend/DataTable/DataTable.svelte
+++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte
@@ -13,7 +13,7 @@
import { fetchTableData } from "helpers/fetchTableData"
import { Pagination } from "@budibase/bbui"
- const data = fetchTableData()
+ const search = fetchTableData()
let hideAutocolumns = true
$: isUsersTable = $tables.selected?._id === TableNames.USERS
@@ -25,7 +25,7 @@
$: fetchTable(id)
const fetchTable = tableId => {
- data.update({
+ search.update({
tableId,
schema,
limit: 10,
@@ -35,7 +35,7 @@
// Fetch data whenever sorting option changes
const onSort = e => {
- data.update({
+ search.update({
sortColumn: e.detail.column,
sortOrder: e.detail.order,
})
@@ -48,9 +48,9 @@
{schema}
{type}
tableId={$tables.selected?._id}
- data={$data.rows}
+ data={$search.rows}
bind:hideAutocolumns
- loading={$data.loading}
+ loading={$search.loading}
on:sort={onSort}
allowEditing
disableSorting
@@ -79,11 +79,11 @@
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
index 638fd44de6..9f0d5086f6 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
@@ -12,7 +12,7 @@
import { dndzone } from "svelte-dnd-action"
import { generate } from "shortid"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
- import { OperatorOptions, getValidOperatorsForType } from "helpers/lucene"
+ import { OperatorOptions, getValidOperatorsForType } from "constants/lucene"
import { selectedComponent, store } from "builderStore"
import { getComponentForSettingType } from "./componentSettings"
import PropertyControl from "./PropertyControl.svelte"
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
index d6bfadb150..eddfd9b997 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
@@ -13,7 +13,7 @@
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import BindingPanel from "components/common/bindings/BindingPanel.svelte"
import { generate } from "shortid"
- import { getValidOperatorsForType, OperatorOptions } from "helpers/lucene"
+ import { getValidOperatorsForType, OperatorOptions } from "constants/lucene"
export let schemaFields
export let filters = []
diff --git a/packages/builder/src/constants/lucene.js b/packages/builder/src/constants/lucene.js
new file mode 100644
index 0000000000..00da0c29bc
--- /dev/null
+++ b/packages/builder/src/constants/lucene.js
@@ -0,0 +1,97 @@
+/**
+ * Operator options for lucene queries
+ */
+export const OperatorOptions = {
+ Equals: {
+ value: "equal",
+ label: "Equals",
+ },
+ NotEquals: {
+ value: "notEqual",
+ label: "Not equals",
+ },
+ Empty: {
+ value: "empty",
+ label: "Is empty",
+ },
+ NotEmpty: {
+ value: "notEmpty",
+ label: "Is not empty",
+ },
+ StartsWith: {
+ value: "string",
+ label: "Starts with",
+ },
+ Like: {
+ value: "fuzzy",
+ label: "Like",
+ },
+ MoreThan: {
+ value: "rangeLow",
+ label: "More than",
+ },
+ LessThan: {
+ value: "rangeHigh",
+ label: "Less than",
+ },
+ Contains: {
+ value: "equal",
+ label: "Contains",
+ },
+ NotContains: {
+ value: "notEqual",
+ label: "Does Not Contain",
+ },
+}
+
+/**
+ * Returns the valid operator options for a certain data type
+ * @param type the data type
+ */
+export const getValidOperatorsForType = type => {
+ const Op = OperatorOptions
+ if (type === "string") {
+ return [
+ Op.Equals,
+ Op.NotEquals,
+ Op.StartsWith,
+ Op.Like,
+ Op.Empty,
+ Op.NotEmpty,
+ ]
+ } else if (type === "number") {
+ return [
+ Op.Equals,
+ Op.NotEquals,
+ Op.MoreThan,
+ Op.LessThan,
+ Op.Empty,
+ Op.NotEmpty,
+ ]
+ } else if (type === "options") {
+ return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
+ } else if (type === "array") {
+ return [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty]
+ } else if (type === "boolean") {
+ return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
+ } else if (type === "longform") {
+ return [
+ Op.Equals,
+ Op.NotEquals,
+ Op.StartsWith,
+ Op.Like,
+ Op.Empty,
+ Op.NotEmpty,
+ ]
+ } else if (type === "datetime") {
+ return [
+ Op.Equals,
+ Op.NotEquals,
+ Op.MoreThan,
+ Op.LessThan,
+ Op.Empty,
+ Op.NotEmpty,
+ ]
+ }
+ return []
+}
diff --git a/packages/builder/src/helpers/fetchTableData.js b/packages/builder/src/helpers/fetchTableData.js
index 43ecd464c9..5ef3bc1076 100644
--- a/packages/builder/src/helpers/fetchTableData.js
+++ b/packages/builder/src/helpers/fetchTableData.js
@@ -1,6 +1,8 @@
+// Do not use any aliased imports in common files, as these will be bundled
+// by multiple bundlers which may not be able to resolve them
import { writable, derived, get } from "svelte/store"
-import * as API from "builderStore/api"
-import { buildLuceneQuery } from "helpers/lucene"
+import * as API from "../builderStore/api"
+import { buildLuceneQuery } from "./lucene"
const defaultOptions = {
tableId: null,
diff --git a/packages/builder/src/helpers/lucene.js b/packages/builder/src/helpers/lucene.js
index 5225467d7b..03baa751cc 100644
--- a/packages/builder/src/helpers/lucene.js
+++ b/packages/builder/src/helpers/lucene.js
@@ -177,101 +177,3 @@ export const luceneLimit = (docs, limit) => {
}
return docs.slice(0, numLimit)
}
-
-/**
- * Operator options for lucene queries
- */
-export const OperatorOptions = {
- Equals: {
- value: "equal",
- label: "Equals",
- },
- NotEquals: {
- value: "notEqual",
- label: "Not equals",
- },
- Empty: {
- value: "empty",
- label: "Is empty",
- },
- NotEmpty: {
- value: "notEmpty",
- label: "Is not empty",
- },
- StartsWith: {
- value: "string",
- label: "Starts with",
- },
- Like: {
- value: "fuzzy",
- label: "Like",
- },
- MoreThan: {
- value: "rangeLow",
- label: "More than",
- },
- LessThan: {
- value: "rangeHigh",
- label: "Less than",
- },
- Contains: {
- value: "equal",
- label: "Contains",
- },
- NotContains: {
- value: "notEqual",
- label: "Does Not Contain",
- },
-}
-
-/**
- * Returns the valid operator options for a certain data type
- * @param type the data type
- */
-export const getValidOperatorsForType = type => {
- const Op = OperatorOptions
- if (type === "string") {
- return [
- Op.Equals,
- Op.NotEquals,
- Op.StartsWith,
- Op.Like,
- Op.Empty,
- Op.NotEmpty,
- ]
- } else if (type === "number") {
- return [
- Op.Equals,
- Op.NotEquals,
- Op.MoreThan,
- Op.LessThan,
- Op.Empty,
- Op.NotEmpty,
- ]
- } else if (type === "options") {
- return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
- } else if (type === "array") {
- return [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty]
- } else if (type === "boolean") {
- return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty]
- } else if (type === "longform") {
- return [
- Op.Equals,
- Op.NotEquals,
- Op.StartsWith,
- Op.Like,
- Op.Empty,
- Op.NotEmpty,
- ]
- } else if (type === "datetime") {
- return [
- Op.Equals,
- Op.NotEquals,
- Op.MoreThan,
- Op.LessThan,
- Op.Empty,
- Op.NotEmpty,
- ]
- }
- return []
-}