This commit is contained in:
Conor_Mack 2020-04-02 13:02:29 +01:00
commit c3680e4926
163 changed files with 1046 additions and 358 deletions

2
.gitignore vendored
View File

@ -38,7 +38,7 @@ bower_components
build/Release build/Release
# Dependency directories # Dependency directories
node_modules/ /node_modules/
jspm_packages/ jspm_packages/
# TypeScript v1 declaration files # TypeScript v1 declaration files

View File

@ -1,5 +1,5 @@
.DS_Store .DS_Store
node_modules /node_modules/
node_modules_win node_modules_win
package-lock.json package-lock.json
yarn.lock yarn.lock

View File

@ -5,10 +5,11 @@
"private": true, "private": true,
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",
"start": "rollup -c -w", "start": "routify -c rollup",
"test": "jest", "test": "jest",
"test:watch": "jest --watchAll", "test:watch": "jest --watchAll",
"dev:builder": "rollup -c -w" "dev:builder": "routify -c rollup",
"rollup": "rollup -c -w"
}, },
"jest": { "jest": {
"globals": { "globals": {
@ -19,7 +20,9 @@
"testURL": "http://jest-breaks-if-this-does-not-exist", "testURL": "http://jest-breaks-if-this-does-not-exist",
"moduleNameMapper": { "moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js", "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
"\\.(css|less|sass|scss)$": "identity-obj-proxy" "\\.(css|less|sass|scss)$": "identity-obj-proxy",
"components(.*)$": "<rootDir>/src/components$1",
"builderStore(.*)$": "<rootDir>/src/builderStore$1"
}, },
"moduleFileExtensions": [ "moduleFileExtensions": [
"js" "js"
@ -54,6 +57,8 @@
"@babel/plugin-transform-runtime": "^7.5.5", "@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5", "@babel/preset-env": "^7.5.5",
"@babel/runtime": "^7.5.5", "@babel/runtime": "^7.5.5",
"@rollup/plugin-alias": "^3.0.1",
"@sveltech/routify": "1.5.0-beta.16",
"babel-jest": "^24.8.0", "babel-jest": "^24.8.0",
"browser-sync": "^2.26.7", "browser-sync": "^2.26.7",
"http-proxy-middleware": "^0.19.1", "http-proxy-middleware": "^0.19.1",

View File

@ -1,3 +1,4 @@
import alias from "@rollup/plugin-alias"
import svelte from "rollup-plugin-svelte" import svelte from "rollup-plugin-svelte"
import resolve from "rollup-plugin-node-resolve" import resolve from "rollup-plugin-node-resolve"
import commonjs from "rollup-plugin-commonjs" import commonjs from "rollup-plugin-commonjs"
@ -11,6 +12,8 @@ import browsersync from "rollup-plugin-browsersync"
import proxy from "http-proxy-middleware" import proxy from "http-proxy-middleware"
import replace from "rollup-plugin-replace" import replace from "rollup-plugin-replace"
import path from "path"
const target = "http://localhost:4001" const target = "http://localhost:4001"
const _builderProxy = proxy("/_builder", { const _builderProxy = proxy("/_builder", {
target: "http://localhost:3000", target: "http://localhost:3000",
@ -142,6 +145,11 @@ const coreExternal = [
"@nx-js/compiler-util", "@nx-js/compiler-util",
] ]
const customResolver = resolve({
extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte"]
})
const projectRootDir = path.resolve(__dirname)
export default { export default {
input: "src/main.js", input: "src/main.js",
output: { output: {
@ -151,6 +159,13 @@ export default {
file: `${outputpath}/bundle.js`, file: `${outputpath}/bundle.js`,
}, },
plugins: [ plugins: [
alias({
entries: [
{ find: "components", replacement: path.resolve(projectRootDir, 'src/components') },
{ find: "builderStore", replacement: path.resolve(projectRootDir, 'src/builderStore') }
],
customResolver
}),
copy({ copy({
targets: [ targets: [
{ src: "src/index.html", dest: outputpath }, { src: "src/index.html", dest: outputpath },
@ -229,3 +244,20 @@ export default {
clearScreen: false, clearScreen: false,
}, },
} }
function serve() {
let started = false
return {
writeBundle() {
if (!started) {
started = true
require("child_process").spawn("npm", ["run", "start"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true,
})
}
},
}
}

View File

@ -2,13 +2,13 @@
import NoPackage from "./NoPackage.svelte" import NoPackage from "./NoPackage.svelte"
import PackageRoot from "./PackageRoot.svelte" import PackageRoot from "./PackageRoot.svelte"
import Settings from "./Settings.svelte" import Settings from "./Settings.svelte"
import { store, initialise } from "./builderStore" import { store, initialise } from "builderStore"
import { onMount } from "svelte" import { onMount } from "svelte"
import IconButton from "./common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import Spinner from "./common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import AppNotification, { import AppNotification, {
showAppNotification, showAppNotification,
} from "./common/AppNotification.svelte" } from "components/common/AppNotification.svelte"
let init = initialise() let init = initialise()

View File

@ -1,13 +1,13 @@
<script> <script>
import BackendNav from "./nav/BackendNav.svelte" import BackendNav from "components/nav/BackendNav.svelte"
import SchemaManagementDrawer from "./nav/SchemaManagementDrawer.svelte" import SchemaManagementDrawer from "components/nav/SchemaManagementDrawer.svelte"
import Database from "./database/DatabaseRoot.svelte" import Database from "components/database/DatabaseRoot.svelte"
import UserInterface from "./userInterface/UserInterfaceRoot.svelte" import UserInterface from "components/userInterface/UserInterfaceRoot.svelte"
import ActionsAndTriggers from "./actionsAndTriggers/ActionsAndTriggersRoot.svelte" import ActionsAndTriggers from "components/actionsAndTriggers/ActionsAndTriggersRoot.svelte"
import AccessLevels from "./accessLevels/AccessLevelsRoot.svelte" import AccessLevels from "components/accessLevels/AccessLevelsRoot.svelte"
import ComingSoon from "./common/ComingSoon.svelte" import ComingSoon from "components/common/ComingSoon.svelte"
import { store, backendUiStore } from "./builderStore" import { store, backendUiStore } from "builderStore"
</script> </script>
<div class="root"> <div class="root">
@ -37,13 +37,13 @@
.content { .content {
flex: 1 1 auto; flex: 1 1 auto;
margin: 80px 60px; margin: 40px 40px;
} }
.nav { .nav {
overflow: auto; overflow: auto;
flex: 0 1 auto; flex: 0 1 auto;
width: 300px; width: 275px;
height: 100%; height: 100%;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<script> <script>
import Button from "./common/Button.svelte" import Button from "components/common/Button.svelte"
import { store } from "./builderStore" import { store } from "builderStore"
let errors = [] let errors = []
</script> </script>

View File

@ -1,10 +1,10 @@
<script> <script>
import IconButton from "./common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import { store } from "./builderStore" import { store } from "builderStore"
import UserInterfaceRoot from "./userInterface/UserInterfaceRoot.svelte" import UserInterfaceRoot from "components/userInterface/UserInterfaceRoot.svelte"
import BackendRoot from "./BackendRoot.svelte" import BackendRoot from "./BackendRoot.svelte"
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { SettingsIcon, PreviewIcon } from "./common/Icons/" import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
const TABS = { const TABS = {
BACKEND: "backend", BACKEND: "backend",

View File

@ -1,7 +1,7 @@
<script> <script>
import IconButton from "./common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import { store } from "./builderStore" import { store } from "builderStore"
import UserInterfaceRoot from "./userInterface/UserInterfaceRoot.svelte" import UserInterfaceRoot from "components/userInterface/UserInterfaceRoot.svelte"
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
</script> </script>

View File

@ -62,9 +62,9 @@
margin: 5px 20px 5px 0px; margin: 5px 20px 5px 0px;
border-radius: 0 5px 5px 0; border-radius: 0 5px 5px 0;
display: flex; display: flex;
align-items: center; align-items: baseline;
font-weight: 500; font-weight: 500;
font-size: 0.8em; font-size: 12px;
} }
.budibase__nav-item.selected { .budibase__nav-item.selected {

View File

@ -1,4 +1,4 @@
import { createNewHierarchy } from "../common/core" import { createNewHierarchy } from "components/common/core"
export const createPackage = (packageInfo, store) => { export const createPackage = (packageInfo, store) => {
packageInfo.createNewPackage("") packageInfo.createNewPackage("")

View File

@ -1,5 +1,5 @@
import { filter, map, reduce, toPairs } from "lodash/fp" import { filter, map, reduce, toPairs } from "lodash/fp"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
const self = n => n const self = n => n
const join_with = delimiter => a => a.join(delimiter) const join_with = delimiter => a => a.join(delimiter)

View File

@ -1,5 +1,5 @@
import { flatten, values, uniq, map } from "lodash/fp" import { flatten, values, uniq, map } from "lodash/fp"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
export const loadLibs = async (appName, appPackage) => { export const loadLibs = async (appName, appPackage) => {
const allLibraries = {} const allLibraries = {}

View File

@ -10,7 +10,7 @@ import {
isIndex, isIndex,
canDeleteIndex, canDeleteIndex,
canDeleteRecord, canDeleteRecord,
} from "../../common/core" } from "components/common/core"
export const getBackendUiStore = () => { export const getBackendUiStore = () => {
const INITIAL_BACKEND_UI_STATE = { const INITIAL_BACKEND_UI_STATE = {
@ -198,7 +198,10 @@ export const saveCurrentNode = store => () => {
const defaultIndex = templateApi(state.hierarchy).getNewIndexTemplate( const defaultIndex = templateApi(state.hierarchy).getNewIndexTemplate(
cloned.parent() cloned.parent()
) )
defaultIndex.name = `all_${cloned.name}s` defaultIndex.name = hierarchyFunctions.isTopLevelIndex(cloned)
? `all_${cloned.name}s`
: `${cloned.parent().name}_${cloned.name}s`
defaultIndex.allowedRecordNodeIds = [cloned.nodeId] defaultIndex.allowedRecordNodeIds = [cloned.nodeId]
} }

View File

@ -1,18 +1,18 @@
import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp" import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp"
import { pipe, getNode, constructHierarchy } from "../../common/core" import { pipe, getNode, constructHierarchy } from "components/common/core"
import * as backendStoreActions from "./backend" import * as backendStoreActions from "./backend"
import { writable } from "svelte/store" import { writable } from "svelte/store"
import { defaultPagesObject } from "../../userInterface/pagesParsing/defaultPagesObject" import { defaultPagesObject } from "components/userInterface/pagesParsing/defaultPagesObject"
import api from "../api" import api from "../api"
import { getExactComponent } from "../../userInterface/pagesParsing/searchComponents" import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents"
import { rename } from "../../userInterface/pagesParsing/renameScreen" import { rename } from "components/userInterface/pagesParsing/renameScreen"
import { import {
getNewScreen, getNewScreen,
createProps, createProps,
makePropsSafe, makePropsSafe,
getBuiltin, getBuiltin,
} from "../../userInterface/pagesParsing/createProps" } from "components/userInterface/pagesParsing/createProps"
import { expandComponentDefinition } from "../../userInterface/pagesParsing/types" import { expandComponentDefinition } from "components/userInterface/pagesParsing/types"
import { loadLibs, libUrlsForPreview } from "../loadComponentLibraries" import { loadLibs, libUrlsForPreview } from "../loadComponentLibraries"
import { buildCodeForScreens } from "../buildCodeForScreens" import { buildCodeForScreens } from "../buildCodeForScreens"
import { generate_screen_css } from "../generate_css" import { generate_screen_css } from "../generate_css"

View File

@ -5,7 +5,7 @@
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "../common/ActionButton.svelte"
import { validateAccessLevels } from "../common/core" import { validateAccessLevels, nodeNameFromNodeKey } from "../common/core"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "../common/ErrorsBox.svelte"
export let level export let level
@ -38,7 +38,9 @@
) )
const getPermissionName = perm => const getPermissionName = perm =>
perm.nodeKey ? `${perm.type} - ${perm.nodeKey}` : perm.type perm.nodeKey
? `${perm.type} - ${nodeNameFromNodeKey(hierarchy, perm.nodeKey)}`
: perm.type
const save = () => { const save = () => {
const newLevels = isNew const newLevels = isNew

View File

@ -1,12 +1,15 @@
<script> <script>
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { generateFullPermissions, getNewAccessLevel } from "../common/core" import {
import getIcon from "../common/icon" generateFullPermissions,
getNewAccessLevel,
} from "components/common/core"
import getIcon from "components/common/icon"
import AccessLevelView from "./AccessLevelView.svelte" import AccessLevelView from "./AccessLevelView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
let editingLevel = null let editingLevel = null
let editingLevelIsNew = false let editingLevelIsNew = false

View File

@ -1,12 +1,12 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp" import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
import { validateActions, pipe } from "../common/core" import { validateActions, pipe } from "components/common/core"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
export let action export let action
export let onFinished = action => {} export let onFinished = action => {}

View File

@ -1,11 +1,11 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import { store } from "../builderStore" import { store } from "builderStore"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import ActionView from "./ActionView.svelte" import ActionView from "./ActionView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { keys, map, join } from "lodash/fp" import { keys, map, join } from "lodash/fp"
export let editingActionIsNew = false export let editingActionIsNew = false

View File

@ -1,12 +1,12 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import { store } from "../builderStore" import { store } from "builderStore"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import Actions from "./Actions.svelte" import Actions from "./Actions.svelte"
import Triggers from "./Triggers.svelte" import Triggers from "./Triggers.svelte"
import { getNewAction, getNewTrigger } from "../common/core" import { getNewAction, getNewTrigger } from "components/common/core"
let editingAction = null let editingAction = null
let editingActionIsNew = true let editingActionIsNew = true
@ -14,7 +14,9 @@
let editingTriggerIsNew = true let editingTriggerIsNew = true
let getDefaultOptionsHtml = defaultOptions => let getDefaultOptionsHtml = defaultOptions =>
pipe(defaultOptions, [ pipe(
defaultOptions,
[
keys, keys,
map( map(
k => k =>
@ -23,7 +25,8 @@
)}` )}`
), ),
join("<br>"), join("<br>"),
]) ]
)
let onActionEdit = action => { let onActionEdit = action => {
editingAction = action editingAction = action

View File

@ -1,14 +1,14 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import CodeArea from "../common/CodeArea.svelte" import CodeArea from "components/common/CodeArea.svelte"
import { cloneDeep, filter, keys, some, map, isUndefined } from "lodash/fp" import { cloneDeep, filter, keys, some, map, isUndefined } from "lodash/fp"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
import { validateTriggers, pipe, events } from "../common/core" import { validateTriggers, pipe, events } from "components/common/core"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
export let trigger export let trigger
export let onFinished = action => {} export let onFinished = action => {}
@ -22,7 +22,10 @@
let cancel = () => onFinished() let cancel = () => onFinished()
let save = () => { let save = () => {
const newTriggersList = [ const newTriggersList = [
...pipe(allTriggers, [filter(t => t !== trigger)]), ...pipe(
allTriggers,
[filter(t => t !== trigger)]
),
clonedTrigger, clonedTrigger,
] ]

View File

@ -1,8 +1,8 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import TriggerView from "./TriggerView.svelte" import TriggerView from "./TriggerView.svelte"
export let editingTrigger = null export let editingTrigger = null

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 157 B

View File

Before

Width:  |  Height:  |  Size: 379 B

After

Width:  |  Height:  |  Size: 379 B

View File

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

View File

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

View File

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 430 B

View File

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 365 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View File

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 362 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View File

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

View File

@ -3,17 +3,17 @@ import {
common, common,
getTemplateApi, getTemplateApi,
getAuthApi, getAuthApi,
} from "../../../core/src" } from "../../../../core/src"
import { _getNew } from "../../../core/src/recordApi/getNew" import { _getNew } from "../../../../core/src/recordApi/getNew"
import { find, filter, keyBy, flatten, map } from "lodash/fp" import { find, filter, keyBy, flatten, map } from "lodash/fp"
import { generateSchema } from "../../../core/src/indexing/indexSchemaCreator" import { generateSchema } from "../../../../core/src/indexing/indexSchemaCreator"
import { generate } from "shortid" import { generate } from "shortid"
export { canDeleteIndex } from "../../../core/src/templateApi/canDeleteIndex" export { canDeleteIndex } from "../../../../core/src/templateApi/canDeleteIndex"
export { canDeleteRecord } from "../../../core/src/templateApi/canDeleteRecord" export { canDeleteRecord } from "../../../../core/src/templateApi/canDeleteRecord"
export { userWithFullAccess } from "../../../core/src/index" export { userWithFullAccess } from "../../../../core/src/index"
export { joinKey } from "../../../core/src/common" export { joinKey } from "../../../../core/src/common"
export { getExactNodeForKey } from "../../../core/src/templateApi/hierarchy" export { getExactNodeForKey } from "../../../../core/src/templateApi/hierarchy"
export const pipe = common.$ export const pipe = common.$
export const events = common.eventsList export const events = common.eventsList
@ -79,6 +79,7 @@ export const getPotentialReferenceIndexes = (hierarchy, record) =>
export const isIndex = hierarchyFunctions.isIndex export const isIndex = hierarchyFunctions.isIndex
export const isRecord = hierarchyFunctions.isRecord export const isRecord = hierarchyFunctions.isRecord
export const nodeNameFromNodeKey = hierarchyFunctions.nodeNameFromNodeKey
export const getDefaultTypeOptions = type => export const getDefaultTypeOptions = type =>
!type ? {} : allTypes[type].getDefaultOptions() !type ? {} : allTypes[type].getDefaultOptions()

View File

@ -1,7 +1,7 @@
import { eventHandlers } from "../../../client/src/state/eventHandlers" import { eventHandlers } from "../../../../client/src/state/eventHandlers"
import { writable } from "svelte/store" import { writable } from "svelte/store"
export { EVENT_TYPE_MEMBER_NAME } from "../../../client/src/state/eventHandlers" export { EVENT_TYPE_MEMBER_NAME } from "../../../../client/src/state/eventHandlers"
import { createCoreApi } from "../../../client/src/core" import { createCoreApi } from "../../../../client/src/core"
export const allHandlers = (appDefinition, user) => { export const allHandlers = (appDefinition, user) => {
const coreApi = createCoreApi(appDefinition, user) const coreApi = createCoreApi(appDefinition, user)

View File

@ -2,11 +2,11 @@
import ModelView from "./ModelView.svelte" import ModelView from "./ModelView.svelte"
import IndexView from "./IndexView.svelte" import IndexView from "./IndexView.svelte"
import ModelDataTable from "./ModelDataTable" import ModelDataTable from "./ModelDataTable"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import DropdownButton from "../common/DropdownButton.svelte" import DropdownButton from "components/common/DropdownButton.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import * as api from "./ModelDataTable/api" import * as api from "./ModelDataTable/api"
import { import {
CreateEditRecordModal, CreateEditRecordModal,

View File

@ -1,13 +1,16 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import CodeArea from "../common/CodeArea.svelte" import CodeArea from "components/common/CodeArea.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import { filter, some, map, compose } from "lodash/fp" import { filter, some, map, compose } from "lodash/fp"
import { hierarchy as hierarchyFunctions, common } from "../../../core/src" import {
import ErrorsBox from "../common/ErrorsBox.svelte" hierarchy as hierarchyFunctions,
import ActionButton from "../common/ActionButton.svelte" common,
} from "../../../../core/src/"
import ErrorsBox from "components/common/ErrorsBox.svelte"
import ActionButton from "components/common/ActionButton.svelte"
const SNIPPET_EDITORS = { const SNIPPET_EDITORS = {
MAP: "Map", MAP: "Map",

View File

@ -1,6 +1,6 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../../builderStore" import { store, backendUiStore } from "builderStore"
import { import {
tap, tap,
get, get,
@ -11,11 +11,11 @@
map, map,
remove, remove,
keys, keys,
takeRight takeRight,
} from "lodash/fp" } from "lodash/fp"
import Select from "../../common/Select.svelte" import Select from "components/common/Select.svelte"
import { getIndexSchema } from "../../common/core" import { getIndexSchema } from "components/common/core"
import ActionButton from "../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import TablePagination from "./TablePagination.svelte" import TablePagination from "./TablePagination.svelte"
import { DeleteRecordModal } from "./modals" import { DeleteRecordModal } from "./modals"
import * as api from "./api" import * as api from "./api"
@ -56,7 +56,11 @@
const getSchema = getIndexSchema($store.hierarchy) const getSchema = getIndexSchema($store.hierarchy)
const childViewsForRecord = compose(flatten, map("indexes"), get("children")) const childViewsForRecord = compose(
flatten,
map("indexes"),
get("children")
)
const hideInternalHeaders = compose( const hideInternalHeaders = compose(
remove(headerName => INTERNAL_HEADERS.includes(headerName)), remove(headerName => INTERNAL_HEADERS.includes(headerName)),
@ -95,7 +99,9 @@
<section> <section>
<div class="table-controls"> <div class="table-controls">
<h4 class="budibase__title--3">{takeRight(2, $backendUiStore.breadcrumbs).join(" / ")}</h4> <h4 class="budibase__title--3">
{takeRight(2, $backendUiStore.breadcrumbs).join(' / ')}
</h4>
<Select icon="ri-eye-line" bind:value={$backendUiStore.selectedView}> <Select icon="ri-eye-line" bind:value={$backendUiStore.selectedView}>
{#each views as view} {#each views as view}
<option value={view}>{view.name}</option> <option value={view}>{view.name}</option>

View File

@ -1,5 +1,5 @@
<script> <script>
import { backendUiStore } from "../../builderStore" import { backendUiStore } from "builderStore"
export let data export let data
export let currentPage export let currentPage

View File

@ -1,5 +1,5 @@
import api from "../../builderStore/api" import api from "builderStore/api"
import { getNewRecord, getNewInstance } from "../../common/core" import { getNewRecord, getNewInstance } from "components/common/core"
export async function createUser(password, user, { appname, instanceId }) { export async function createUser(password, user, { appname, instanceId }) {
const CREATE_USER_URL = `/_builder/instance/${appname}/${instanceId}/api/createUser` const CREATE_USER_URL = `/_builder/instance/${appname}/${instanceId}/api/createUser`

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { store } from "../../../builderStore" import { store } from "builderStore"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import * as api from "../api" import * as api from "../api"
export let onClosed export let onClosed

View File

@ -0,0 +1,11 @@
<script>
import Modal from "components/common/Modal.svelte"
import ActionButton from "components/common/ActionButton.svelte"
import { backendUiStore } from "builderStore"
import ModelView from "../../ModelView.svelte"
import * as api from "../api"
</script>
<section>
<ModelView />
</section>

View File

@ -1,18 +1,18 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import { compose, map, get, flatten } from "lodash/fp" import { compose, map, get, flatten } from "lodash/fp"
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Select from "../../../common/Select.svelte" import Select from "components/common/Select.svelte"
import { import {
getNewRecord, getNewRecord,
joinKey, joinKey,
getExactNodeForKey, getExactNodeForKey,
} from "../../../common/core" } from "components/common/core"
import RecordFieldControl from "./RecordFieldControl.svelte" import RecordFieldControl from "./RecordFieldControl.svelte"
import * as api from "../api" import * as api from "../api"
import ErrorsBox from "../../../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
export let record export let record
export let onClosed export let onClosed

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import * as api from "../api" import * as api from "../api"
export let onClosed export let onClosed

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import * as api from "../api" import * as api from "../api"
export let record export let record

View File

@ -1,12 +1,12 @@
<script> <script>
import { tick } from "svelte" import { tick } from "svelte"
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Select from "../common/Select.svelte" import Select from "components/common/Select.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import FieldView from "./FieldView.svelte" import FieldView from "./FieldView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { import {
get, get,
compose, compose,
@ -18,11 +18,11 @@
keys, keys,
isDate, isDate,
} from "lodash/fp" } from "lodash/fp"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { common, hierarchy } from "../../../core/src" import { common, hierarchy } from "../../../../core/src/"
import { getNode } from "../common/core" import { getNode } from "components/common/core"
import { templateApi, pipe, validate } from "../common/core" import { templateApi, pipe, validate } from "components/common/core"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
let record let record
let getIndexAllowedRecords let getIndexAllowedRecords
@ -154,7 +154,7 @@
<div>{field.name}</div> <div>{field.name}</div>
</td> </td>
<td>{field.type}</td> <td>{field.type}</td>
<td>{field.typeOptions.values || ""}</td> <td>{field.typeOptions.values || ''}</td>
<td> <td>
<i <i
class="ri-delete-bin-6-line hoverable" class="ri-delete-bin-6-line hoverable"
@ -181,7 +181,9 @@
}}> }}>
Create Child View on {record.name} Create Child View on {record.name}
</ActionButton> </ActionButton>
<ActionButton alert on:click={store.deleteCurrentNode}>Delete</ActionButton> <ActionButton alert on:click={store.deleteCurrentNode}>
Delete
</ActionButton>
{/if} {/if}
</div> </div>
{:else} {:else}

View File

@ -1,12 +1,11 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import HierarchyRow from "./HierarchyRow.svelte" import HierarchyRow from "./HierarchyRow.svelte"
import DatabasesList from "./DatabasesList.svelte" import DatabasesList from "./DatabasesList.svelte"
import UsersList from "./UsersList.svelte" import UsersList from "./UsersList.svelte"
import { hierarchy as hierarchyFunctions } from "../../../core/src"
import NavItem from "./NavItem.svelte" import NavItem from "./NavItem.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
</script> </script>
<div class="items-root"> <div class="items-root">
@ -42,7 +41,7 @@
</div> </div>
{/if} {/if}
<NavItem name="ACCESS_LEVELS" label="User Levels" /> <NavItem name="ACCESS_LEVELS" label="User Access Levels" />
</div> </div>
<style> <style>
@ -58,12 +57,17 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 2rem 1rem 1rem 1rem; padding: 20px 20px 10px 20px;
} }
.hierarchy-title { .hierarchy-title {
align-items: center;
text-transform: uppercase; text-transform: uppercase;
font-size: 0.85em; font-size: 12px;
font-weight: bold;
opacity: 0.6;
letter-spacing: 1px;
text-rendering: optimizeLegibility;
} }
.hierarchy { .hierarchy {

View File

@ -1,7 +1,7 @@
<script> <script>
import { tick, onMount } from "svelte" import { tick, onMount } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import api from "../builderStore/api" import api from "builderStore/api"
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { CheckIcon } from "../common/Icons" import { CheckIcon } from "../common/Icons"
@ -28,7 +28,7 @@
onMount(() => { onMount(() => {
if ($store.appInstances.length > 0) { if ($store.appInstances.length > 0) {
selectDatabase($store.appInstances[0]); selectDatabase($store.appInstances[0])
} }
}) })
</script> </script>
@ -42,15 +42,14 @@
<CheckIcon /> <CheckIcon />
{/if} {/if}
</span> </span>
<i
class="ri-delete-bin-7-line hoverable uk-margin-small-left"
on:click={() => deleteDatabase(database)} />
<button <button
class:active={database.id === $backendUiStore.selectedDatabase.id} class:active={database.id === $backendUiStore.selectedDatabase.id}
on:click={() => selectDatabase(database)}> on:click={() => selectDatabase(database)}>
{database.name} {database.name}
</button> </button>
<i
class="ri-delete-bin-7-line hoverable alignment"
on:click={() => deleteDatabase(database)} />
</li> </li>
{/each} {/each}
</ul> </ul>
@ -58,12 +57,10 @@
<style> <style>
.root { .root {
padding-bottom: 10px; font-size: 12px;
font-size: 0.9rem; color: var(--secondary100);
color: var(--secondary50);
font-weight: bold;
position: relative; position: relative;
padding-left: 1.8rem; padding-left: 20px;
} }
ul { ul {
@ -72,8 +69,13 @@
list-style: none; list-style: none;
} }
.alignment {
margin-left: auto;
padding-right: 20px;
}
li { li {
margin: 0.5rem 0; margin: 0px 0px 10px 0px;
display: flex; display: flex;
align-items: center; align-items: center;
} }
@ -83,10 +85,11 @@
padding: 0; padding: 0;
border: none; border: none;
font-family: Roboto; font-family: Roboto;
font-size: 0.8rem; font-size: 12px;
outline: none; outline: none;
cursor: pointer; cursor: pointer;
background: rgba(0, 0, 0, 0); background: rgba(0, 0, 0, 0);
text-rendering: optimizeLegibility;
} }
.active { .active {

View File

@ -1,6 +1,6 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import getIcon from "../common/icon" import getIcon from "../common/icon"
@ -52,8 +52,9 @@
<style> <style>
.hierarchy-item { .hierarchy-item {
font-size: 14px; font-size: 12px;
font-weight: 400; font-weight: 400;
margin-bottom: 10px;
} }
.capitalized { .capitalized {

View File

@ -1,6 +1,6 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { backendUiStore } from "../builderStore" import { backendUiStore } from "builderStore"
export let name = "" export let name = ""
export let label = "" export let label = ""

View File

@ -1,10 +1,9 @@
<script> <script>
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import HierarchyRow from "./HierarchyRow.svelte" import HierarchyRow from "./HierarchyRow.svelte"
import DropdownButton from "../common/DropdownButton.svelte" import DropdownButton from "components/common/DropdownButton.svelte"
import { hierarchy as hierarchyFunctions } from "../../../core/src"
import NavItem from "./NavItem.svelte" import NavItem from "./NavItem.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
function newModel() { function newModel() {
if ($store.currentNode) { if ($store.currentNode) {
@ -56,20 +55,24 @@
flex-direction: column; flex-direction: column;
max-height: 100%; max-height: 100%;
height: 100%; height: 100%;
background-color: var(--secondary5); background-color: var(--white);
} }
.nav-group-header { .nav-group-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 2rem 1rem 1rem 1rem; padding: 20px 20px 10px 20px;
} }
.hierarchy-title { .hierarchy-title {
align-items: center; align-items: center;
text-transform: uppercase; text-transform: uppercase;
font-size: 0.85em; font-size: 12px;
font-weight: bold;
opacity: 0.6;
letter-spacing: 1px;
text-rendering: optimizeLegibility;
} }
.hierarchy { .hierarchy {

View File

@ -1,7 +1,7 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import api from "../builderStore/api" import api from "builderStore/api"
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { CheckIcon } from "../common/Icons" import { CheckIcon } from "../common/Icons"

View File

@ -1,8 +1,8 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import UIkit from "uikit" import UIkit from "uikit"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import CodeMirror from "codemirror" import CodeMirror from "codemirror"
import "codemirror/mode/javascript/javascript.js" import "codemirror/mode/javascript/javascript.js"

View File

@ -1,15 +1,15 @@
<script> <script>
import PropsView from "./PropsView.svelte" import PropsView from "./PropsView.svelte"
import StateBindingControl from "./StateBindingControl.svelte" import StateBindingControl from "./StateBindingControl.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import IconButton from "../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import { import {
LayoutIcon, LayoutIcon,
PaintIcon, PaintIcon,
TerminalIcon, TerminalIcon,
CircleIndicator, CircleIndicator,
EventsIcon, EventsIcon,
} from "../common/Icons/" } from "components/common/Icons/"
import CodeEditor from "./CodeEditor.svelte" import CodeEditor from "./CodeEditor.svelte"
import LayoutEditor from "./LayoutEditor.svelte" import LayoutEditor from "./LayoutEditor.svelte"
import EventsEditor from "./EventsEditor" import EventsEditor from "./EventsEditor"

View File

@ -1,6 +1,6 @@
<script> <script>
import { splitName } from "./pagesParsing/splitRootComponentName.js" import { splitName } from "./pagesParsing/splitRootComponentName.js"
import { store } from "../builderStore" import { store } from "builderStore"
import { import {
find, find,
sortBy, sortBy,
@ -11,16 +11,16 @@
uniqBy, uniqBy,
flatten, flatten,
} from "lodash/fp" } from "lodash/fp"
import { ImageIcon, InputIcon, LayoutIcon } from "../common/Icons/" import { ImageIcon, InputIcon, LayoutIcon } from "components/common/Icons/"
import Select from "../common/Select.svelte" import Select from "components/common/Select.svelte"
import Button from "../common/PlusButton.svelte" import Button from "components/common/PlusButton.svelte"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { import {
getRecordNodes, getRecordNodes,
getIndexNodes, getIndexNodes,
getIndexSchema, getIndexSchema,
pipe, pipe,
} from "../common/core" } from "components/common/core"
export let toggleTab export let toggleTab
@ -35,13 +35,16 @@
$: templatesByComponent = groupBy(t => t.component)($store.templates) $: templatesByComponent = groupBy(t => t.component)($store.templates)
$: hierarchy = $store.hierarchy $: hierarchy = $store.hierarchy
$: libraryModules = $store.libraries $: libraryModules = $store.libraries
$: standaloneTemplates = pipe(templatesByComponent, [ $: standaloneTemplates = pipe(
templatesByComponent,
[
values, values,
flatten, flatten,
filter(t => !$store.components.some(c => c.name === t.component)), filter(t => !$store.components.some(c => c.name === t.component)),
map(t => ({ name: splitName(t.component).componentName, template: t })), map(t => ({ name: splitName(t.component).componentName, template: t })),
uniqBy(t => t.name), uniqBy(t => t.name),
]) ]
)
const addRootComponent = (component, allComponents) => { const addRootComponent = (component, allComponents) => {
const { libName } = splitName(component.name) const { libName } = splitName(component.name)

View File

@ -2,10 +2,10 @@
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte" import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp" import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { store } from "../builderStore" import { store } from "builderStore"
import { ArrowDownIcon, ShapeIcon } from "../common/Icons/" import { ArrowDownIcon, ShapeIcon } from "components/common/Icons/"
export let screens = [] export let screens = []
@ -15,12 +15,15 @@
const joinPath = join("/") const joinPath = join("/")
const normalizedName = name => const normalizedName = name =>
pipe(name, [ pipe(
name,
[
trimCharsStart("./"), trimCharsStart("./"),
trimCharsStart("~/"), trimCharsStart("~/"),
trimCharsStart("../"), trimCharsStart("../"),
trimChars(" "), trimChars(" "),
]) ]
)
const lastPartOfName = c => { const lastPartOfName = c => {
if (!c) return "" if (!c) return ""
@ -32,10 +35,10 @@
const isFolderSelected = (current, folder) => isInSubfolder(current, folder) const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
$: _screens = pipe(screens, [ $: _screens = pipe(
map(c => ({ component: c, title: lastPartOfName(c) })), screens,
sortBy("title"), [map(c => ({ component: c, title: lastPartOfName(c) })), sortBy("title")]
]) )
const isScreenSelected = component => const isScreenSelected = component =>
component.component && component.component &&

Some files were not shown because too many files have changed in this diff Show More