component preview sort of working
This commit is contained in:
parent
53c3a54230
commit
573f274f89
|
@ -1,14 +1,17 @@
|
|||
import { isUndefined } from "lodash/fp";
|
||||
|
||||
const apiCall = (method, returnResponse) => (url, body) =>
|
||||
const apiCall = (method, returnJson) => (url, body, returnJsonOverride) =>
|
||||
fetch(url, {
|
||||
method: method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: body && JSON.stringify(body),
|
||||
}).then(r =>
|
||||
returnResponse ? r.json() : r
|
||||
);
|
||||
}).then(r => {
|
||||
if(!isUndefined(returnJsonOverride))
|
||||
returnJson = returnJsonOverride;
|
||||
return returnJson ? r.json() : r
|
||||
});
|
||||
|
||||
const post = apiCall("POST", true);
|
||||
const get = apiCall("GET", true);
|
||||
|
|
|
@ -11,653 +11,3 @@ export const createPackage = (packageInfo, store) => {
|
|||
accessLevelsVersion: 0
|
||||
});
|
||||
};
|
||||
|
||||
const testroot = {
|
||||
"name": "root",
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"name": "settings",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "appName",
|
||||
"type": "string",
|
||||
"typeOptions": {
|
||||
"maxLength": null,
|
||||
"values": null,
|
||||
"allowDeclaredValuesOnly": false
|
||||
},
|
||||
"label": "appName",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [],
|
||||
"validationRules": [],
|
||||
"nodeId": 1,
|
||||
"indexes": [],
|
||||
"allidsShardFactor": 64,
|
||||
"collectionName": "",
|
||||
"isSingle": true
|
||||
},
|
||||
{
|
||||
"name": "customer",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "surname",
|
||||
"type": "string",
|
||||
"typeOptions": {
|
||||
"maxLength": null,
|
||||
"values": null,
|
||||
"allowDeclaredValuesOnly": false
|
||||
},
|
||||
"label": "surname",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "isalive",
|
||||
"type": "bool",
|
||||
"typeOptions": {
|
||||
"allowNulls": true
|
||||
},
|
||||
"label": "isalive",
|
||||
"getInitialValue": "true",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "createddate",
|
||||
"type": "datetime",
|
||||
"typeOptions": {
|
||||
"maxValue": "+275760-09-13T00:00:00.000Z",
|
||||
"minValue": "-271821-04-20T00:00:00.000Z"
|
||||
},
|
||||
"label": "createddate",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "age",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 0
|
||||
},
|
||||
"label": "age",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "profilepic",
|
||||
"type": "file",
|
||||
"typeOptions": {},
|
||||
"label": "profilepic",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "partner",
|
||||
"type": "reference",
|
||||
"typeOptions": {
|
||||
"indexNodeKey": "/partnersReference",
|
||||
"displayValue": "name",
|
||||
"reverseIndexNodeKeys": [
|
||||
"/partners/4-{id}/partnerCustomers"
|
||||
]
|
||||
},
|
||||
"label": "partner",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "referredBy",
|
||||
"type": "reference",
|
||||
"typeOptions": {
|
||||
"indexNodeKey": "/customer_index",
|
||||
"displayValue": "surname",
|
||||
"reverseIndexNodeKeys": [
|
||||
"/customers/2-{id}/referredToCustomers"
|
||||
]
|
||||
},
|
||||
"label": "referredBy",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"name": "invoice",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "totalIncVat",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 2
|
||||
},
|
||||
"label": "totalIncVat",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "createdDate",
|
||||
"type": "datetime",
|
||||
"typeOptions": {
|
||||
"maxValue": "+275760-09-13T00:00:00.000Z",
|
||||
"minValue": "-271821-04-20T00:00:00.000Z"
|
||||
},
|
||||
"label": "createdDate",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "paidAmount",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 0
|
||||
},
|
||||
"label": "paidAmount",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "invoiceType",
|
||||
"type": "string",
|
||||
"typeOptions": {
|
||||
"maxLength": null,
|
||||
"values": null,
|
||||
"allowDeclaredValuesOnly": false
|
||||
},
|
||||
"label": "invoiceType",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "isWrittenOff",
|
||||
"type": "bool",
|
||||
"typeOptions": {
|
||||
"allowNulls": true
|
||||
},
|
||||
"label": "isWrittenOff",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "customer",
|
||||
"type": "reference",
|
||||
"typeOptions": {
|
||||
"indexNodeKey": "/customersReference",
|
||||
"reverseIndexNodeKeys": [
|
||||
"/customers/2-{id}/invoice_index"
|
||||
],
|
||||
"displayValue": "name"
|
||||
},
|
||||
"label": "customer",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"name": "charge",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 0
|
||||
},
|
||||
"label": "amount",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "partnerInvoice",
|
||||
"type": "reference",
|
||||
"typeOptions": {
|
||||
"reverseIndexNodeKeys": [
|
||||
"/partners/4-{id}/invoices/6-{id}/partnerCharges"
|
||||
],
|
||||
"displayValue": "createdDate",
|
||||
"indexNodeKey": "/partners/4-{id}/partnerInvoices_index"
|
||||
},
|
||||
"label": "partnerInvoice",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [],
|
||||
"validationRules": [],
|
||||
"nodeId": 10,
|
||||
"indexes": [],
|
||||
"allidsShardFactor": 1,
|
||||
"collectionName": "charges",
|
||||
"isSingle": false
|
||||
}
|
||||
],
|
||||
"validationRules": [],
|
||||
"nodeId": 8,
|
||||
"indexes": [
|
||||
{
|
||||
"name": "charge_index",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
10
|
||||
],
|
||||
"nodeId": 11
|
||||
}
|
||||
],
|
||||
"allidsShardFactor": 1,
|
||||
"collectionName": "invoices",
|
||||
"isSingle": false
|
||||
}
|
||||
],
|
||||
"validationRules": [],
|
||||
"nodeId": 2,
|
||||
"indexes": [
|
||||
{
|
||||
"name": "invoice_index",
|
||||
"type": "index",
|
||||
"map": "return {createdDate: record.createdDate, totalIncVat: record.totalIncVat};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
8
|
||||
],
|
||||
"nodeId": 9
|
||||
},
|
||||
{
|
||||
"name": "referredToCustomers",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "reference",
|
||||
"getShardName": "return !record.surname ? 'null' : record.surname.substring(0,1);",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 14
|
||||
},
|
||||
{
|
||||
"name": "invoicesByOutstanding",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "return (record.totalIncVat > record.paidAmount ? 'outstanding' : 'paid');",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [
|
||||
{
|
||||
"name": "all_invoices_by_type",
|
||||
"type": "aggregateGroup",
|
||||
"groupBy": "return record.invoiceType",
|
||||
"aggregates": [
|
||||
{
|
||||
"name": "totalIncVat",
|
||||
"aggregatedValue": "return record.totalIncVat"
|
||||
}
|
||||
],
|
||||
"condition": "",
|
||||
"nodeId": 26
|
||||
}
|
||||
],
|
||||
"allowedRecordNodeIds": [
|
||||
6,
|
||||
8
|
||||
],
|
||||
"nodeId": 25
|
||||
}
|
||||
],
|
||||
"allidsShardFactor": 64,
|
||||
"collectionName": "customers",
|
||||
"isSingle": false
|
||||
},
|
||||
{
|
||||
"name": "partner",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "businessName",
|
||||
"type": "string",
|
||||
"typeOptions": {
|
||||
"maxLength": null,
|
||||
"values": null,
|
||||
"allowDeclaredValuesOnly": false
|
||||
},
|
||||
"label": "businessName",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"name": "invoice",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "totalIncVat",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 2
|
||||
},
|
||||
"label": "totalIncVat",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "createdDate",
|
||||
"type": "datetime",
|
||||
"typeOptions": {
|
||||
"maxValue": "+275760-09-13T00:00:00.000Z",
|
||||
"minValue": "-271821-04-20T00:00:00.000Z"
|
||||
},
|
||||
"label": "createdDate",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "paidAmount",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 0
|
||||
},
|
||||
"label": "paidAmount",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [],
|
||||
"validationRules": [],
|
||||
"nodeId": 6,
|
||||
"indexes": [
|
||||
{
|
||||
"name": "partnerCharges",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "reference",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
{
|
||||
"name": "charge",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "number",
|
||||
"typeOptions": {
|
||||
"maxValue": 9007199254740991,
|
||||
"minValue": -9007199254740991,
|
||||
"decimalPlaces": 0
|
||||
},
|
||||
"label": "amount",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "partnerInvoice",
|
||||
"type": "reference",
|
||||
"typeOptions": {
|
||||
"reverseIndexNodeKeys": [
|
||||
"/partners/4-{id}/invoices/6-{id}/partnerCharges"
|
||||
],
|
||||
"displayValue": "createdDate",
|
||||
"indexNodeKey": "/partners/4-{id}/partnerInvoices_index"
|
||||
},
|
||||
"label": "partnerInvoice",
|
||||
"getInitialValue": "default",
|
||||
"getUndefinedValue": "default"
|
||||
}
|
||||
],
|
||||
"children": [],
|
||||
"validationRules": [],
|
||||
"nodeId": 10,
|
||||
"indexes": [],
|
||||
"allidsShardFactor": 1,
|
||||
"collectionName": "charges",
|
||||
"isSingle": false
|
||||
}
|
||||
],
|
||||
"nodeId": 15
|
||||
}
|
||||
],
|
||||
"allidsShardFactor": 1,
|
||||
"collectionName": "invoices",
|
||||
"isSingle": false
|
||||
}
|
||||
],
|
||||
"validationRules": [],
|
||||
"nodeId": 4,
|
||||
"indexes": [
|
||||
{
|
||||
"name": "partnerInvoices_index",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
6
|
||||
],
|
||||
"nodeId": 7
|
||||
},
|
||||
{
|
||||
"name": "partnerCustomers",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "record.isalive === true",
|
||||
"indexType": "reference",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 13
|
||||
}
|
||||
],
|
||||
"allidsShardFactor": 64,
|
||||
"collectionName": "partners",
|
||||
"isSingle": false
|
||||
}
|
||||
],
|
||||
"pathMaps": [],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "customer_index",
|
||||
"type": "index",
|
||||
"map": "return record;",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [
|
||||
{
|
||||
"name": "Customers Summary",
|
||||
"type": "aggregateGroup",
|
||||
"groupBy": "",
|
||||
"aggregates": [
|
||||
{
|
||||
"name": "all customers - age breakdown",
|
||||
"aggregatedValue": "return record.age"
|
||||
}
|
||||
],
|
||||
"condition": "",
|
||||
"nodeId": 24
|
||||
}
|
||||
],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 3
|
||||
},
|
||||
{
|
||||
"name": "partner_index",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
4
|
||||
],
|
||||
"nodeId": 5
|
||||
},
|
||||
{
|
||||
"name": "partnersReference",
|
||||
"type": "index",
|
||||
"map": "return {name:record.businessName};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
4
|
||||
],
|
||||
"nodeId": 12
|
||||
},
|
||||
{
|
||||
"name": "customersReference",
|
||||
"type": "index",
|
||||
"map": "return {name:record.surname}",
|
||||
"filter": "record.isalive === true",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 16
|
||||
},
|
||||
{
|
||||
"name": "deceased",
|
||||
"type": "index",
|
||||
"map": "return {surname: record.surname, age:record.age};",
|
||||
"filter": "record.isalive === false",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 17
|
||||
},
|
||||
{
|
||||
"name": "customer_invoices",
|
||||
"type": "index",
|
||||
"map": "return record;",
|
||||
"filter": "record.type === 'invoice'",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
8
|
||||
],
|
||||
"nodeId": 18
|
||||
},
|
||||
{
|
||||
"name": "Outstanding Invoices",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "record.type === 'invoice' && record.paidAmount < record.totalIncVat",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [
|
||||
{
|
||||
"name": "all_invoices",
|
||||
"type": "aggregateGroup",
|
||||
"groupBy": "",
|
||||
"aggregates": [],
|
||||
"condition": "",
|
||||
"nodeId": 20
|
||||
},
|
||||
{
|
||||
"name": "all_invoices_by_type",
|
||||
"type": "aggregateGroup",
|
||||
"groupBy": "return record.invoiceType",
|
||||
"aggregates": [
|
||||
{
|
||||
"name": "totalIncVat",
|
||||
"aggregatedValue": "return record.totalIncVat"
|
||||
},
|
||||
{
|
||||
"name": "paidAmount",
|
||||
"aggregatedValue": "return record.paidAmount"
|
||||
}
|
||||
],
|
||||
"condition": "",
|
||||
"nodeId": 21
|
||||
},
|
||||
{
|
||||
"name": "written_off",
|
||||
"type": "aggregateGroup",
|
||||
"groupBy": "return record.invoiceType",
|
||||
"aggregates": [
|
||||
{
|
||||
"name": "totalIncVat",
|
||||
"aggregatedValue": "return record.totalIncVat"
|
||||
}
|
||||
],
|
||||
"condition": "record.isWrittenOff === true",
|
||||
"nodeId": 22
|
||||
}
|
||||
],
|
||||
"allowedRecordNodeIds": [
|
||||
8,
|
||||
6
|
||||
],
|
||||
"nodeId": 19
|
||||
},
|
||||
{
|
||||
"name": "customersBySurname",
|
||||
"type": "index",
|
||||
"map": "return {...record};",
|
||||
"filter": "",
|
||||
"indexType": "ancestor",
|
||||
"getShardName": "return !record.surname ? 'null' : record.surname.substring(0,1);",
|
||||
"getSortKey": "record.id",
|
||||
"aggregateGroups": [],
|
||||
"allowedRecordNodeIds": [
|
||||
2
|
||||
],
|
||||
"nodeId": 23
|
||||
}
|
||||
],
|
||||
"nodeId": 0
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
import {createPackage} from "./createPackage";
|
||||
import getStore from "./store";
|
||||
import { last } from "lodash/fp";
|
||||
|
||||
export const store = getStore();
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { map } from "lodash/fp";
|
||||
|
||||
export const loadLibs = async (appName, appPackage) => {
|
||||
|
||||
const makeUrl = l =>
|
||||
`/_builder/api/${appName}/componentlibrary?lib=${encodeURI(l)}`
|
||||
|
||||
const allLibraries = {};
|
||||
for(let lib of appPackage.pages.componentLibraries) {
|
||||
const libModule = await import(makeUrl(lib));
|
||||
allLibraries[lib] = libModule;
|
||||
}
|
||||
|
||||
return allLibraries;
|
||||
}
|
|
@ -30,6 +30,7 @@ import {
|
|||
getComponentInfo,
|
||||
getNewComponentInfo
|
||||
} from "../userInterface/pagesParsing/createProps";
|
||||
import { loadLibs } from "./loadComponentLibraries";
|
||||
|
||||
export const getStore = () => {
|
||||
|
||||
|
@ -52,6 +53,7 @@ export const getStore = () => {
|
|||
hasAppPackage: false,
|
||||
accessLevels: [],
|
||||
currentNode: null,
|
||||
libraries:null,
|
||||
};
|
||||
|
||||
const store = writable(initial);
|
||||
|
@ -82,6 +84,9 @@ export const getStore = () => {
|
|||
store.setCurrentComponent = setCurrentComponent(store);
|
||||
store.setCurrentPage = setCurrentPage(store);
|
||||
store.createDerivedComponent = createDerivedComponent(store);
|
||||
store.removeComponentLibrary =removeComponentLibrary(store);
|
||||
store.addStylesheet = addStylesheet(store);
|
||||
store.removeStylesheet = removeStylesheet(store);
|
||||
return store;
|
||||
}
|
||||
|
||||
|
@ -102,7 +107,9 @@ const initialise = (store, initial) => async () => {
|
|||
|
||||
const pkg = await api.get(`/_builder/api/${appname}/appPackage`);
|
||||
|
||||
initial.libraries = await loadLibs(appname, pkg);
|
||||
initial.appname = appname;
|
||||
initial.pages = pkg.pages;
|
||||
initial.hasAppPackage = true;
|
||||
initial.hierarchy = pkg.appDefinition.hierarchy;
|
||||
initial.accessLevels = pkg.accessLevels;
|
||||
|
@ -386,7 +393,7 @@ const saveDerivedComponent = store => (derivedComponent) => {
|
|||
s.allComponents = components;
|
||||
s.currentFrontEndItem = derivedComponent;
|
||||
s.currentComponentInfo = getNewComponentInfo(
|
||||
s.allComponents, componentName);
|
||||
s.allComponents, derivedComponent.name);
|
||||
s.currentComponentIsNew = false;
|
||||
|
||||
api.post(`/_builder/api/${s.appname}/derivedcomponent`, derivedComponent);
|
||||
|
@ -452,7 +459,7 @@ const renameDerivedComponent = store => (oldname, newname) => {
|
|||
const addComponentLibrary = store => async lib => {
|
||||
|
||||
const response =
|
||||
await api.get(`/_builder/api/${db.appname}/components?${encodeURI(lib)}`,undefined, true);
|
||||
await api.get(`/_builder/api/${db.appname}/components?${encodeURI(lib)}`,undefined, false);
|
||||
|
||||
const success = response.status === 200;
|
||||
|
||||
|
@ -476,6 +483,7 @@ const addComponentLibrary = store => async lib => {
|
|||
]);
|
||||
|
||||
s.pages.componentLibraries.push(lib);
|
||||
savePackage(store, s);
|
||||
}
|
||||
|
||||
return s;
|
||||
|
@ -484,7 +492,42 @@ const addComponentLibrary = store => async lib => {
|
|||
|
||||
}
|
||||
|
||||
const removeComponentLibrary = store => lib => {
|
||||
store.update(s => {
|
||||
|
||||
|
||||
s.pages.componentLibraries = filter(l => l !== lib)(
|
||||
s.pages.componentLibraries);
|
||||
savePackage(store, s);
|
||||
|
||||
|
||||
return s;
|
||||
})
|
||||
}
|
||||
|
||||
const addStylesheet = store => stylesheet => {
|
||||
store.update(s => {
|
||||
s.pages.stylesheets.push(stylesheet);
|
||||
|
||||
const styles = document.createElement('link');
|
||||
styles.rel = 'stylesheet';
|
||||
styles.type = 'text/css';
|
||||
styles.media = 'screen';
|
||||
styles.href = stylesheet;
|
||||
document.getElementsByTagName('head')[0].appendChild(styles);
|
||||
|
||||
savePackage(store, s);
|
||||
return s;
|
||||
})
|
||||
}
|
||||
|
||||
const removeStylesheet = store => stylesheet => {
|
||||
store.update(s => {
|
||||
s.pages.stylesheets = filter(s => s !== stylesheet)(s.pages.stylesheets);
|
||||
savePackage(store, s);
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
const refreshComponents = store => async () => {
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<script>
|
||||
import { store } from "../builderStore";
|
||||
import {
|
||||
last,
|
||||
split
|
||||
} from "lodash/fp";
|
||||
import { pipe } from "../common/core";
|
||||
import { splitName } from "./pagesParsing/splitRootComponentName"
|
||||
|
||||
let component;
|
||||
|
||||
store.subscribe(s => {
|
||||
const {componentName, libName} = splitName(
|
||||
s.currentComponentInfo.rootComponent.name);
|
||||
|
||||
component = s.libraries[libName][componentName];
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="component-preview" >
|
||||
<div class="component-container">
|
||||
<iframe title="componentPreview">
|
||||
|
||||
<head>
|
||||
{#each $store.pages.stylesheets as stylesheet}
|
||||
<link rel="stylesheet" href="{stylesheet}"/>
|
||||
{/each}
|
||||
</head>
|
||||
<body>
|
||||
<svelte:component this={component} {...$store.currentComponentInfo.fullProps}/>
|
||||
</body>
|
||||
|
||||
</iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.component-preview {
|
||||
display: grid;
|
||||
grid-template-rows: [top] 1fr [middle] auto [bottom] 1fr;
|
||||
grid-template-columns: [left] 1fr [middle] auto [right] 1fr;
|
||||
grid-column-start: preview;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.component-container {
|
||||
grid-row-start: middle;
|
||||
grid-column-start: middle;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,145 @@
|
|||
<script>
|
||||
|
||||
import { store } from "../builderStore";
|
||||
import Textbox from "../common/Textbox.svelte";
|
||||
import Button from "../common/Button.svelte";
|
||||
import IconButton from "../common/IconButton.svelte";
|
||||
import { libraryDependencies } from "./pagesParsing/findDependencies";
|
||||
import UIkit from "uikit";
|
||||
|
||||
let addNewLib = "";
|
||||
let addNewStylesheet = "";
|
||||
let addComponentError = "";
|
||||
let modalElement;
|
||||
let allComponents;
|
||||
|
||||
store.subscribe(s => {
|
||||
allComponents = s.allComponents;
|
||||
})
|
||||
|
||||
const removeLibrary = lib => {
|
||||
const dependencies = libraryDependencies(allComponents, lib);
|
||||
if(dependencies.length > 0) return;
|
||||
store.removeComponentLibrary(lib);
|
||||
}
|
||||
|
||||
const addLib = () => {
|
||||
store.addComponentLibrary(addNewLib)
|
||||
.then(() => {
|
||||
addNewLib = "";
|
||||
});
|
||||
}
|
||||
|
||||
const removeStylesheet = stylesheet => {
|
||||
store.removeStylesheet(stylesheet);
|
||||
}
|
||||
|
||||
const addStylesheet = () => {
|
||||
if(addNewStylesheet)
|
||||
store.addStylesheet(addNewStylesheet);
|
||||
}
|
||||
|
||||
export const close = () => {
|
||||
UIkit.modal(modalElement).hide();
|
||||
}
|
||||
|
||||
export const show = () => {
|
||||
UIkit.modal(modalElement).show();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div bind:this={modalElement} id="new-component-modal" uk-modal>
|
||||
<div class="uk-modal-dialog">
|
||||
|
||||
<div class="uk-modal-header header">
|
||||
<div>Settings</div>
|
||||
<div>
|
||||
<IconButton icon="x"
|
||||
on:click={close}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-modal-body uk-form-horizontal">
|
||||
|
||||
<div class="section-container">
|
||||
<p>Component Libraries
|
||||
<span>
|
||||
<input bind:value={addNewLib} />
|
||||
<Button color="primary-outline"
|
||||
on:click={addLib}>Add</Button>
|
||||
</span>
|
||||
</p>
|
||||
{#each $store.pages.componentLibraries as lib}
|
||||
<div>
|
||||
<span class="row-text">{lib}</span>
|
||||
<IconButton icon="x"
|
||||
on:click={() => removeLibrary(lib)}/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section-container">
|
||||
<p>Stylesheets
|
||||
<span>
|
||||
<input bind:value={addNewStylesheet} />
|
||||
<Button color="primary-outline"
|
||||
on:click={addStylesheet} >Add</Button>
|
||||
</span>
|
||||
</p>
|
||||
{#each $store.pages.stylesheets as stylesheet}
|
||||
<div>
|
||||
<span class="row-text">{stylesheet}</span>
|
||||
<IconButton icon="x"
|
||||
on:click={() => removeStylesheet(stylesheet)}/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
.section-container {
|
||||
padding: 15px;
|
||||
border-style: dotted;
|
||||
border-width: 1px;
|
||||
border-color: var(--lightslate);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.section-container:nth-child(1) {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.row-text {
|
||||
margin-right: 15px;
|
||||
color: var(--primary100);
|
||||
}
|
||||
|
||||
input {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
p > span {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: grid;
|
||||
grid-template-columns: [title] 1fr [icon] auto;
|
||||
}
|
||||
|
||||
.header > div:nth-child(1) {
|
||||
grid-column-start: title;
|
||||
}
|
||||
|
||||
.header > div:nth-child(2) {
|
||||
grid-column-start: icon;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -9,12 +9,19 @@ import { isRootComponent } from "./pagesParsing/searchComponents";
|
|||
import IconButton from "../common/IconButton.svelte";
|
||||
import Modal from "../common/Modal.svelte";
|
||||
import NewComponent from "./NewComponent.svelte";
|
||||
import CurrentItemPreview from "./CurrentItemPreview.svelte";
|
||||
import SettingsView from "./SettingsView.svelte";
|
||||
|
||||
let newComponentPicker;
|
||||
const newComponent = () => {
|
||||
newComponentPicker.show();
|
||||
}
|
||||
|
||||
let settingsView;
|
||||
const settings = () => {
|
||||
settingsView.show();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="root">
|
||||
|
@ -26,6 +33,9 @@ const newComponent = () => {
|
|||
<div>{@html getIcon("sidebar","18")}</div>
|
||||
<span>COMPONENTS</span>
|
||||
<div>
|
||||
<IconButton icon="settings"
|
||||
size="14"
|
||||
on:click={settings}/>
|
||||
<IconButton icon="plus"
|
||||
on:click={newComponent}/>
|
||||
</div>
|
||||
|
@ -47,11 +57,9 @@ const newComponent = () => {
|
|||
|
||||
</div>
|
||||
|
||||
<div class="component-preview">
|
||||
<div>
|
||||
{#if $store.currentFrontEndItem}
|
||||
<div class="component-container">
|
||||
<h1>{$store.currentFrontEndItem.name}</h1>
|
||||
</div>
|
||||
<CurrentItemPreview />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
@ -65,6 +73,7 @@ const newComponent = () => {
|
|||
|
||||
|
||||
<NewComponent bind:this={newComponentPicker}/>
|
||||
<SettingsView bind:this={settingsView} />
|
||||
|
||||
|
||||
<style>
|
||||
|
@ -82,18 +91,6 @@ const newComponent = () => {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
.component-preview {
|
||||
display: grid;
|
||||
grid-template-rows: [top] 1fr [middle] auto [bottom] 1fr;
|
||||
grid-template-columns: [left] 1fr [middle] auto [right] 1fr;
|
||||
grid-column-start: preview;
|
||||
}
|
||||
|
||||
.component-container {
|
||||
grid-row-start: middle;
|
||||
grid-column-start: middle;
|
||||
}
|
||||
|
||||
.properties-pane {
|
||||
grid-column-start: properties;
|
||||
background-color: var(--primary10);
|
||||
|
|
|
@ -98,7 +98,8 @@ export const getComponentInfo = (allComponents, comp, stack=[], subComponentProp
|
|||
unsetProps,
|
||||
fullProps: p.props,
|
||||
errors: p.errors,
|
||||
component: stack.length > 0 ? stack[0] : component
|
||||
component: stack.length > 0 ? stack[0] : component,
|
||||
rootComponent: component
|
||||
});
|
||||
}
|
||||
return getComponentInfo(
|
||||
|
|
|
@ -11,5 +11,7 @@ export const defaultPagesObject = () => ({
|
|||
},
|
||||
appBody: "bbapp.unauthenticated.json"
|
||||
},
|
||||
componentLibraries: ["./components"]
|
||||
componentLibraries: [],
|
||||
stylesheets: []
|
||||
|
||||
});
|
|
@ -0,0 +1,24 @@
|
|||
import { splitName } from "./splitRootComponentName";
|
||||
import {
|
||||
find,
|
||||
filter
|
||||
} from "lodash/fp";
|
||||
import { isRootComponent } from "./searchComponents";
|
||||
|
||||
export const libraryDependencies = (allComponents, lib) => {
|
||||
|
||||
const componentDependsOnLibrary = comp => {
|
||||
if(isRootComponent(comp)) {
|
||||
const {libName} = splitName(component.name);
|
||||
return (libName === lib);
|
||||
}
|
||||
return componentDependsOnLibrary(
|
||||
find(c => c.name === comp.inherits)(allComponents)
|
||||
);
|
||||
}
|
||||
|
||||
return filter(c => !isRootComponent(c)
|
||||
&& componentDependsOnLibrary(c))(
|
||||
allComponents
|
||||
);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
import {
|
||||
split,
|
||||
last
|
||||
} from "lodash/fp";
|
||||
|
||||
import { pipe } from "../../common/core";
|
||||
|
||||
export const splitName = fullname => {
|
||||
const componentName = pipe(fullname, [
|
||||
split("/"),
|
||||
last
|
||||
]);
|
||||
|
||||
const libName =fullname.substring(
|
||||
0, fullname.length - componentName.length - 1);
|
||||
|
||||
return {libName, componentName};
|
||||
}
|
|
@ -1 +1,75 @@
|
|||
{"levels":[{"name":"owner","permissions":[{"type":"create record","nodeKey":"/customers/1-{id}"},{"type":"delete record","nodeKey":"/customers/1-{id}"},{"type":"update record","nodeKey":"/customers/1-{id}"},{"type":"read record","nodeKey":"/customers/1-{id}"},{"type":"create record","nodeKey":"/customers/1-{id}/invoices/2-{id}"},{"type":"update record","nodeKey":"/customers/1-{id}/invoices/2-{id}"},{"type":"delete record","nodeKey":"/customers/1-{id}/invoices/2-{id}"},{"type":"read record","nodeKey":"/customers/1-{id}/invoices/2-{id}"},{"type":"write templates"},{"type":"create user"},{"type":"set password"},{"type":"create temporary access"},{"type":"enable or disable user"},{"type":"write access levels"},{"type":"list users"},{"type":"list access levels"},{"type":"manage index"},{"type":"set user access levels"},{"type":"manage collection"}]}],"version":0}
|
||||
{
|
||||
"levels": [
|
||||
{
|
||||
"name": "owner",
|
||||
"permissions": [
|
||||
{
|
||||
"type": "create record",
|
||||
"nodeKey": "/customers/1-{id}"
|
||||
},
|
||||
{
|
||||
"type": "delete record",
|
||||
"nodeKey": "/customers/1-{id}"
|
||||
},
|
||||
{
|
||||
"type": "update record",
|
||||
"nodeKey": "/customers/1-{id}"
|
||||
},
|
||||
{
|
||||
"type": "read record",
|
||||
"nodeKey": "/customers/1-{id}"
|
||||
},
|
||||
{
|
||||
"type": "create record",
|
||||
"nodeKey": "/customers/1-{id}/invoices/2-{id}"
|
||||
},
|
||||
{
|
||||
"type": "update record",
|
||||
"nodeKey": "/customers/1-{id}/invoices/2-{id}"
|
||||
},
|
||||
{
|
||||
"type": "delete record",
|
||||
"nodeKey": "/customers/1-{id}/invoices/2-{id}"
|
||||
},
|
||||
{
|
||||
"type": "read record",
|
||||
"nodeKey": "/customers/1-{id}/invoices/2-{id}"
|
||||
},
|
||||
{
|
||||
"type": "write templates"
|
||||
},
|
||||
{
|
||||
"type": "create user"
|
||||
},
|
||||
{
|
||||
"type": "set password"
|
||||
},
|
||||
{
|
||||
"type": "create temporary access"
|
||||
},
|
||||
{
|
||||
"type": "enable or disable user"
|
||||
},
|
||||
{
|
||||
"type": "write access levels"
|
||||
},
|
||||
{
|
||||
"type": "list users"
|
||||
},
|
||||
{
|
||||
"type": "list access levels"
|
||||
},
|
||||
{
|
||||
"type": "manage index"
|
||||
},
|
||||
{
|
||||
"type": "set user access levels"
|
||||
},
|
||||
{
|
||||
"type": "manage collection"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 0
|
||||
}
|
||||
|
|
|
@ -74,13 +74,37 @@
|
|||
}
|
||||
],
|
||||
"actions": {
|
||||
"output_to_file":
|
||||
{
|
||||
"output_to_file": [
|
||||
{
|
||||
"name": "output_to_file",
|
||||
"behaviourSource": "main",
|
||||
"behaviourName": "outputToFile",
|
||||
"initialOptions": {}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"pages": {
|
||||
"main": {
|
||||
"index": {},
|
||||
"appBody": "./main.app.json"
|
||||
},
|
||||
"unauthenticated": {
|
||||
"index": {
|
||||
"_component": "budibase-components/indexHtml",
|
||||
"title": "Test App 1 - Login",
|
||||
"customScripts": [
|
||||
"MyCustomComponents.js"
|
||||
]
|
||||
},
|
||||
"appBody": "./unauthenticated.app.json"
|
||||
},
|
||||
"componentLibraries": [
|
||||
"./standard-components"
|
||||
],
|
||||
"stylesheets": [
|
||||
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
|
||||
]
|
||||
},
|
||||
"mainUi": {},
|
||||
"unauthenticatedUi": {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "Primary Button",
|
||||
"description": "",
|
||||
"inherits": "./standard-components/button",
|
||||
"props": {
|
||||
"className": "btn btn-secondary",
|
||||
"_component": "Primary Button",
|
||||
"disabled": false
|
||||
},
|
||||
"tags": [
|
||||
"button"
|
||||
]
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"inherits": "./customComponents/textbox",
|
||||
"name": "myTextBox",
|
||||
"tags": [],
|
||||
"description": "A text input, with a label",
|
||||
"props" : {
|
||||
"label": "hello"
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"inherits": "./moreCustomComponents/textbox",
|
||||
"name":"subfolder/otherTextBox.json",
|
||||
"tags": [],
|
||||
"description": "A text input, with a label",
|
||||
"props" : {
|
||||
"label": "hello"
|
||||
}
|
||||
}
|
|
@ -15,5 +15,6 @@
|
|||
},
|
||||
"appBody" : "./unauthenticated.app.json"
|
||||
},
|
||||
"componentLibraries": ["./customComponents", "./moreCustomComponents"]
|
||||
"componentLibraries": ["./standard-components"],
|
||||
"stylesheets": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
index.js
|
||||
index.mjs
|
|
@ -0,0 +1,33 @@
|
|||
*Psst — looking for an app template? Go here --> [sveltejs/template](https://github.com/sveltejs/template)*
|
||||
|
||||
---
|
||||
|
||||
# component-template
|
||||
|
||||
A base for building shareable Svelte components. Clone it with [degit](https://github.com/Rich-Harris/degit):
|
||||
|
||||
```bash
|
||||
npx degit sveltejs/component-template my-new-component
|
||||
cd my-new-component
|
||||
npm install # or yarn
|
||||
```
|
||||
|
||||
Your component's source code lives in `src/index.html`.
|
||||
|
||||
TODO
|
||||
|
||||
* [ ] some firm opinions about the best way to test components
|
||||
* [ ] update `degit` so that it automates some of the setup work
|
||||
|
||||
|
||||
## Setting up
|
||||
|
||||
* Run `npm init` (or `yarn init`)
|
||||
* Replace this README with your own
|
||||
|
||||
|
||||
## Consuming components
|
||||
|
||||
Your package.json has a `"svelte"` field pointing to `src/index.html`, which allows Svelte apps to import the source code directly, if they are using a bundler plugin like [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) or [svelte-loader](https://github.com/sveltejs/svelte-loader) (where [`resolve.mainFields`](https://webpack.js.org/configuration/resolve/#resolve-mainfields) in your webpack config includes `"svelte"`). **This is recommended.**
|
||||
|
||||
For everyone else, `npm run build` will bundle your component's source code into a plain JavaScript module (`index.mjs`) and a UMD script (`index.js`). This will happen automatically when you publish your component to npm, courtesy of the `prepublishOnly` hook in package.json.
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"_lib": {
|
||||
"path":"./dist/index.js"
|
||||
},
|
||||
"button" : {
|
||||
"importPath": "button",
|
||||
"name": "Button",
|
||||
"description": "an html <button />",
|
||||
"props": {
|
||||
"contentText": { "type": "string", "default": "Button" },
|
||||
"contentComponent": "component",
|
||||
"className": "string",
|
||||
"disabled": "bool"
|
||||
},
|
||||
"tags": ["button"]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "budibase-standard-components",
|
||||
"svelte": "src/index.svelte",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rollup": "^1.11.0",
|
||||
"rollup-plugin-node-resolve": "^4.0.0",
|
||||
"rollup-plugin-svelte": "^5.0.0",
|
||||
"svelte": "^3.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"svelte"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"license": "MIT"
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import svelte from 'rollup-plugin-svelte';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
|
||||
export default {
|
||||
input: 'src/index.js',
|
||||
output: [
|
||||
{ file: "dist/index.js", 'format': 'esm', name:"budibaseStandardComponents" }
|
||||
],
|
||||
plugins: [
|
||||
svelte(),
|
||||
resolve()
|
||||
]
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
<script>
|
||||
export let className = "";
|
||||
export let disabled = false;
|
||||
export let contentText = "";
|
||||
export let contentComponent = {};
|
||||
</script>
|
||||
|
||||
|
||||
<button class={className} {disabled} on:click>
|
||||
{#if contentComponent}
|
||||
{contentText}
|
||||
{:else}
|
||||
<div>Props..</div>
|
||||
{/if}
|
||||
</button>
|
|
@ -1,31 +1,39 @@
|
|||
main.svelte-j8mzr7{height:100%;width:100%;font-family:"Lato", Helvetica, Arial, sans-serif}
|
||||
.root.svelte-e4n7zy{position:fixed;margin:0 auto;text-align:center;top:20%;width:100%}.inner.svelte-e4n7zy{display:inline-block;margin:auto}.logo.svelte-e4n7zy{width:300px;margin-bottom:40px}.root.svelte-e4n7zy .option{width:250px}.app-link.svelte-e4n7zy{margin-top:10px;display:block}
|
||||
.root.svelte-i0dstr{height:100%}.content.svelte-i0dstr{position:fixed;height:100%;background-color:var(--white);margin:0}
|
||||
h4.svelte-o0id5a{margin-top:20px}
|
||||
.border-normal.svelte-7rfkdx{border-radius:var(--borderradiusall)}.border-left.svelte-7rfkdx{border-radius:var(--borderradius) 0 0 var(--borderradius)}.border-right.svelte-7rfkdx{border-radius:0 var(--borderradius) var(--borderradius) 0}.border-middle.svelte-7rfkdx{border-radius:0}button.svelte-7rfkdx{border-style:solid;padding:7px 15px;cursor:pointer}.primary.svelte-7rfkdx{background-color:var(--primary100);border-color:var(--primary100);color:var(--white)}.primary.svelte-7rfkdx:hover{background-color:var(--primary75);border-color:var(--primary75)}.primary.svelte-7rfkdx:active{background-color:var(--primarydark);border-color:var(--primarydark)}.primary-outline.svelte-7rfkdx{background-color:var(--white);border-color:var(--primary100);color:var(--primary100)}.primary-outline.svelte-7rfkdx:hover{background-color:var(--primary10)}.primary-outline.svelte-7rfkdx:pressed{background-color:var(--primary25)}.secondary.svelte-7rfkdx{background-color:var(--secondary100);border-color:var(--secondary100);color:var(--white)}.secondary.svelte-7rfkdx:hover{background-color:var(--secondary75);border-color:var(--secondary75)}.secondary.svelte-7rfkdx:pressed{background-color:var(--secondarydark);border-color:var(--secondarydark)}.secondary-outline.svelte-7rfkdx{background-color:var(--white);border-color:var(--secondary100);color:var(--secondary100)}.secondary-outline.svelte-7rfkdx:hover{background-color:var(--secondary10)}.secondary-outline.svelte-7rfkdx:pressed{background-color:var(--secondary25)}.success.svelte-7rfkdx{background-color:var(--success100);border-color:var(--success100);color:var(--white)}.success.svelte-7rfkdx:hover{background-color:var(--success75);border-color:var(--success75)}.success.svelte-7rfkdx:pressed{background-color:var(--successdark);border-color:var(--successdark)}.success-outline.svelte-7rfkdx{background-color:var(--white);border-color:var(--success100);color:var(--success100)}.success-outline.svelte-7rfkdx:hover{background-color:var(--success10)}.success-outline.svelte-7rfkdx:pressed{background-color:var(--success25)}.deletion.svelte-7rfkdx{background-color:var(--deletion100);border-color:var(--deletion100);color:var(--white)}.deletion.svelte-7rfkdx:hover{background-color:var(--deletion75);border-color:var(--deletion75)}.deletion.svelte-7rfkdx:pressed{background-color:var(--deletiondark);border-color:var(--deletiondark)}.deletion-outline.svelte-7rfkdx{background-color:var(--white);border-color:var(--deletion100);color:var(--deletion100)}.deletion-outline.svelte-7rfkdx:hover{background-color:var(--deletion10)}.deletion-outline.svelte-7rfkdx:pressed{background-color:var(--deletion25)}
|
||||
.nav.svelte-lgepe1{height:100%;position:fixed;left:0px;background-color:var(--secondary100);color:var(--darkslate)}.nav.svelte-lgepe1>img.svelte-lgepe1{width:100%;margin-bottom:30px;margin-top:5px;margin-left:0px}
|
||||
.root.svelte-ui57a{display:flex;height:100%;position:relative}.hierarchy.svelte-ui57a{flex:0 1 auto;background-color:var(--primary10);overflow-y:auto;height:100%}.node-container.svelte-ui57a{flex:1 1 auto;display:flex;flex-direction:column}.actions-header.svelte-ui57a{flex:0 1 auto}.node-view.svelte-ui57a{overflow-y:auto;flex:1 1 auto}.hierarchy-title-row.svelte-ui57a{padding:15px 7px;font-size:11pt;display:flex;font-weight:bold}.hierarchy-title.svelte-ui57a{flex:auto 1 1}
|
||||
h4.svelte-o0id5a{margin-top:20px}
|
||||
.root.svelte-1dih19s{display:grid;grid-template-columns:[uiNav] 250px [preview] auto [properties] 300px;height:100%;width:100%}.ui-nav.svelte-1dih19s{grid-column-start:uiNav;background-color:var(--primary10);height:100%}.properties-pane.svelte-1dih19s{grid-column-start:properties;background-color:var(--primary10);height:100%}.pages-list-container.svelte-1dih19s{padding-top:20px}.nav-group-header.svelte-1dih19s{font-size:10pt;padding-left:10px}.nav-items-container.svelte-1dih19s{padding-top:10px}.nav-group-header.svelte-1dih19s{display:grid;grid-template-columns:[icon] auto [title] 1fr [button] auto;padding:10px 2px 0px 7px}.nav-group-header.svelte-1dih19s>div.svelte-1dih19s:nth-child(1){padding:0px 7px 0px 0px;vertical-align:bottom;grid-column-start:icon;margin-right:5px}.nav-group-header.svelte-1dih19s>span.svelte-1dih19s:nth-child(2){margin-left:5px;vertical-align:bottom;grid-column-start:title;margin-top:auto}.nav-group-header.svelte-1dih19s>div.svelte-1dih19s:nth-child(3){vertical-align:bottom;grid-column-start:button;cursor:pointer;color:var(--slate)}.nav-group-header.svelte-1dih19s>div.svelte-1dih19s:nth-child(3):hover{color:var(--primary75)}
|
||||
.nav.svelte-lgepe1{height:100%;position:fixed;left:0px;background-color:var(--secondary100);color:var(--darkslate)}.nav.svelte-lgepe1>img.svelte-lgepe1{width:100%;margin-bottom:30px;margin-top:5px;margin-left:0px}
|
||||
.root.svelte-zzs4qg{padding:10px}
|
||||
.root.svelte-179wat4{display:grid;grid-template-columns:[uiNav] 250px [preview] auto [properties] 250px;height:100%;width:100%}.ui-nav.svelte-179wat4{grid-column-start:uiNav;background-color:var(--primary10);height:100%}.component-preview.svelte-179wat4{display:grid;grid-template-rows:[top] 1fr [middle] auto [bottom] 1fr;grid-template-columns:[left] 1fr [middle] auto [right] 1fr;grid-column-start:preview}.component-container.svelte-179wat4{grid-row-start:middle;grid-column-start:middle}.properties-pane.svelte-179wat4{grid-column-start:properties;background-color:var(--primary10);height:100%}.pages-list-container.svelte-179wat4{padding-top:20px}.nav-group-header.svelte-179wat4{font-size:10pt;padding-left:10px}.nav-items-container.svelte-179wat4{padding-top:10px}.nav-group-header.svelte-179wat4{display:grid;grid-template-columns:[icon] auto [title] 1fr [button] auto;padding:10px 2px 0px 7px}.nav-group-header.svelte-179wat4>div.svelte-179wat4:nth-child(1){padding:0px 7px 0px 0px;vertical-align:bottom;grid-column-start:icon;margin-right:5px}.nav-group-header.svelte-179wat4>span.svelte-179wat4:nth-child(2){margin-left:5px;vertical-align:bottom;grid-column-start:title;margin-top:auto}.nav-group-header.svelte-179wat4>div.svelte-179wat4:nth-child(3){vertical-align:bottom;grid-column-start:button;cursor:pointer;color:var(--slate)}.nav-group-header.svelte-179wat4>div.svelte-179wat4:nth-child(3):hover{color:var(--primary75)}
|
||||
.root.svelte-1qmjs65{padding:10px}.edit-button.svelte-1qmjs65{cursor:pointer;color:var(--white)}tr.svelte-1qmjs65:hover .edit-button.svelte-1qmjs65{color:var(--secondary75)}
|
||||
.root.svelte-1q40nqm{display:block;font-size:13pt;width:100%;cursor:pointer}.title.svelte-1q40nqm{font:var(--bodytext);padding-top:10px;padding-right:5px;padding-bottom:10px;color:var(--secondary100)}.title.svelte-1q40nqm:hover{background-color:var(--secondary10)}
|
||||
.root.svelte-kswv5p{height:100%;padding:15px}.fields-table.svelte-kswv5p{margin:10px;border-collapse:collapse}.add-field-button.svelte-kswv5p{margin-left:15px;cursor:pointer}.edit-button.svelte-kswv5p{cursor:pointer;color:var(--white)}.edit-button.svelte-kswv5p:hover{color:var(--secondary75)}th.svelte-kswv5p{text-align:left}td.svelte-kswv5p{padding:5px 30px 5px 0px;margin:0}thead.svelte-kswv5p>tr.svelte-kswv5p{border-width:0px 0px 1px 0px;border-style:solid;border-color:var(--secondary75);margin-bottom:20px}tbody.svelte-kswv5p>tr.svelte-kswv5p{border-width:0px 0px 1px 0px;border-style:solid;border-color:var(--primary10)}tbody.svelte-kswv5p>tr.svelte-kswv5p:hover{background-color:var(--primary10)}tbody.svelte-kswv5p>tr:hover .edit-button.svelte-kswv5p{color:var(--secondary75)}.index-container.svelte-kswv5p{border-style:solid;border-width:0 0 1px 0;border-color:var(--secondary25);padding:10px;margin-bottom:5px}.index-label.svelte-kswv5p{color:var(--slate)}.index-name.svelte-kswv5p{font-weight:bold;color:var(--primary100)}.index-container.svelte-kswv5p code.svelte-kswv5p{margin:0;display:inline;background-color:var(--primary10);color:var(--secondary100);padding:3px}.index-field-row.svelte-kswv5p{margin-top:7px}
|
||||
.nav-item.svelte-5cf6ht{padding:0px 5px;display:block;padding:10px;color:var(--slate);cursor:pointer}.inner.svelte-5cf6ht{padding:0px 20px 10px 0px;display:inline-block;width:100%}.nav-item.svelte-5cf6ht:hover{background-color:var(--primary25)}.icon.svelte-5cf6ht{font-size:0.9em;display:inline-block;position:relative;top:5px;margin-right:5px;width:100%}.active.svelte-5cf6ht>div.svelte-5cf6ht{background-color:var(--primary10);color:var(--secondary100)}.active.svelte-5cf6ht>div.svelte-5cf6ht:hover{background-color:var(--slate);color:var(--secondary100)}.active.svelte-5cf6ht{background-color:white}
|
||||
.root.svelte-1tilbnf{padding:5px;top:0;width:100%}
|
||||
.dropdown-background.svelte-179p8ge{position:fixed;top:0;left:0;width:100vw;height:100vh}.root.svelte-179p8ge{cursor:pointer;z-index:1}.dropdown-content.svelte-179p8ge{position:absolute;background-color:var(--white);min-width:160px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;font-weight:normal;border-style:solid;border-width:1px;border-color:var(--secondary10)}.dropdown-content.svelte-179p8ge:not(:focus){display:none}.action-row.svelte-179p8ge{padding:7px 10px;cursor:pointer}.action-row.svelte-179p8ge:hover{background-color:var(--primary100);color:var(--white)}
|
||||
.root.svelte-d6wwkb{display:flex}.root.svelte-d6wwkb:last-child{border-radius:0 var(--borderradius) var(--borderradius) 0}.root.svelte-d6wwkb:first-child{border-radius:var(--borderradius) 0 0 var(--borderradius)}.root.svelte-d6wwkb:not(:first-child):not(:last-child){border-radius:0}
|
||||
.root.svelte-pq2tmv{height:100%;padding:15px}.allowed-records.svelte-pq2tmv{margin:20px 0px}.allowed-records.svelte-pq2tmv>span.svelte-pq2tmv{margin-right:30px}
|
||||
.edit-button.svelte-neetem{cursor:pointer;color:var(--white)}tr.svelte-neetem:hover .edit-button.svelte-neetem{color:var(--secondary75)}
|
||||
.edit-button.svelte-9z4fqi{cursor:pointer;color:var(--white)}tr.svelte-9z4fqi:hover .edit-button.svelte-9z4fqi{color:var(--secondary75)}
|
||||
button.svelte-6dbfug{border-style:none;background-color:rgba(0,0,0,0);cursor:pointer}
|
||||
.root.svelte-1hxxti1{padding:10px;font-size:10pt}.title.svelte-1hxxti1{font:var(--smallheavybodytext)}.prop-row.svelte-1hxxti1{padding:7px 3px}.component-description.svelte-1hxxti1{font:var(--lightbodytext)}
|
||||
.root.svelte-kswv5p{height:100%;padding:15px}.fields-table.svelte-kswv5p{margin:10px;border-collapse:collapse}.add-field-button.svelte-kswv5p{margin-left:15px;cursor:pointer}.edit-button.svelte-kswv5p{cursor:pointer;color:var(--white)}.edit-button.svelte-kswv5p:hover{color:var(--secondary75)}th.svelte-kswv5p{text-align:left}td.svelte-kswv5p{padding:5px 30px 5px 0px;margin:0}thead.svelte-kswv5p>tr.svelte-kswv5p{border-width:0px 0px 1px 0px;border-style:solid;border-color:var(--secondary75);margin-bottom:20px}tbody.svelte-kswv5p>tr.svelte-kswv5p{border-width:0px 0px 1px 0px;border-style:solid;border-color:var(--primary10)}tbody.svelte-kswv5p>tr.svelte-kswv5p:hover{background-color:var(--primary10)}tbody.svelte-kswv5p>tr:hover .edit-button.svelte-kswv5p{color:var(--secondary75)}.index-container.svelte-kswv5p{border-style:solid;border-width:0 0 1px 0;border-color:var(--secondary25);padding:10px;margin-bottom:5px}.index-label.svelte-kswv5p{color:var(--slate)}.index-name.svelte-kswv5p{font-weight:bold;color:var(--primary100)}.index-container.svelte-kswv5p code.svelte-kswv5p{margin:0;display:inline;background-color:var(--primary10);color:var(--secondary100);padding:3px}.index-field-row.svelte-kswv5p{margin-top:7px}
|
||||
.root.svelte-1tilbnf{padding:5px;top:0;width:100%}
|
||||
.root.svelte-1q40nqm{display:block;font-size:13pt;width:100%;cursor:pointer}.title.svelte-1q40nqm{font:var(--bodytext);padding-top:10px;padding-right:5px;padding-bottom:10px;color:var(--secondary100)}.title.svelte-1q40nqm:hover{background-color:var(--secondary10)}
|
||||
.dropdown-background.svelte-179p8ge{position:fixed;top:0;left:0;width:100vw;height:100vh}.root.svelte-179p8ge{cursor:pointer;z-index:1}.dropdown-content.svelte-179p8ge{position:absolute;background-color:var(--white);min-width:160px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;font-weight:normal;border-style:solid;border-width:1px;border-color:var(--secondary10)}.dropdown-content.svelte-179p8ge:not(:focus){display:none}.action-row.svelte-179p8ge{padding:7px 10px;cursor:pointer}.action-row.svelte-179p8ge:hover{background-color:var(--primary100);color:var(--white)}
|
||||
.root.svelte-ffb307{padding-bottom:10px;padding-left:10px;font-size:16px;color:var(--secondary50)}.hierarchy-item.svelte-ffb307{cursor:pointer;padding:5px 0px}.hierarchy-item.svelte-ffb307:hover{color:var(--secondary75)}.component.svelte-ffb307{margin-left:5px}.selected.svelte-ffb307{color:var(--primary100)}.title.svelte-ffb307{margin-left:10px}
|
||||
.root.svelte-1cnqtw{color:var(--secondary50)}.hierarchy-item.svelte-1cnqtw{cursor:pointer;padding:5px 0px}.hierarchy-item.svelte-1cnqtw:hover{color:var(--secondary75)}.component.svelte-1cnqtw{margin-left:5px}.currentfolder.svelte-1cnqtw{color:var(--secondary100)}.selected.svelte-1cnqtw{color:var(--primary100)}.title.svelte-1cnqtw{margin-left:10px}
|
||||
.error-container.svelte-jwy920{padding:10px;border-style:solid;border-color:var(--deletion100);border-radius:var(--borderradiusall);background:var(--deletion75)}.error-row.svelte-jwy920{padding:5px 0px}
|
||||
.root.svelte-xai2hc{height:100%;border-style:solid;border-color:var(--lightslate);border-width:0px 0px 0px 1px}.padding.svelte-xai2hc{padding:0px 5px 0px 10px}.title.svelte-xai2hc{background-color:white;padding:3px;display:grid;grid-template-columns:[name] 1fr [actions] auto}.title.svelte-xai2hc>div.svelte-xai2hc:nth-child(1){grid-column-start:name;color:var(--secondary100)}.title.svelte-xai2hc>div.svelte-xai2hc:nth-child(2){grid-column-start:actions}.section-header.svelte-xai2hc{font-style:italic;color:var(--slate);border-style:solid;border-color:var(--lightslate);border-width:0px 0px 1px 0px}.section-header.svelte-xai2hc{vertical-align:middle;margin-top:20px}
|
||||
button.svelte-4po3k2{border-style:none;background-color:rgba(0,0,0,0);cursor:pointer;outline:none}button.svelte-4po3k2:hover{color:var(--hovercolor)}button.svelte-4po3k2:active{outline:none}
|
||||
.nav-item.svelte-5cf6ht{padding:0px 5px;display:block;padding:10px;color:var(--slate);cursor:pointer}.inner.svelte-5cf6ht{padding:0px 20px 10px 0px;display:inline-block;width:100%}.nav-item.svelte-5cf6ht:hover{background-color:var(--primary25)}.icon.svelte-5cf6ht{font-size:0.9em;display:inline-block;position:relative;top:5px;margin-right:5px;width:100%}.active.svelte-5cf6ht>div.svelte-5cf6ht{background-color:var(--primary10);color:var(--secondary100)}.active.svelte-5cf6ht>div.svelte-5cf6ht:hover{background-color:var(--slate);color:var(--secondary100)}.active.svelte-5cf6ht{background-color:white}
|
||||
h1.svelte-2ukyrk{font-size:1.2em}
|
||||
.root.svelte-d6wwkb{display:flex}.root.svelte-d6wwkb:last-child{border-radius:0 var(--borderradius) var(--borderradius) 0}.root.svelte-d6wwkb:first-child{border-radius:var(--borderradius) 0 0 var(--borderradius)}.root.svelte-d6wwkb:not(:first-child):not(:last-child){border-radius:0}
|
||||
.edit-button.svelte-9z4fqi{cursor:pointer;color:var(--white)}tr.svelte-9z4fqi:hover .edit-button.svelte-9z4fqi{color:var(--secondary75)}
|
||||
.edit-button.svelte-neetem{cursor:pointer;color:var(--white)}tr.svelte-neetem:hover .edit-button.svelte-neetem{color:var(--secondary75)}
|
||||
textarea.svelte-1ooq0hh{padding:3px;background:var(--darkslate);color:var(--white);font-family:'Courier New', Courier, monospace;width:95%;height:100px}
|
||||
.root.svelte-bv289q{padding:10px}.option-container.svelte-bv289q{border-style:dotted;border-width:1px;border-color:var(--primary75);padding:3px;margin-right:5px}
|
||||
input.svelte-66516k{margin-right:7px}
|
||||
.info-text.svelte-um9cf7{font-size:0.8em;color:var(--slate)}
|
||||
.error-container.svelte-jwy920{padding:10px;border-style:solid;border-color:var(--deletion100);border-radius:var(--borderradiusall);background:var(--deletion75)}.error-row.svelte-jwy920{padding:5px 0px}
|
||||
.root.svelte-1sxai5n{font-size:10pt}.padding.svelte-1sxai5n{padding:0 10px}.inherited-title.svelte-1sxai5n{margin-top:40px;display:grid;grid-template-columns:[name] 1fr [actions] auto;border-style:solid;border-width:0px 0px 1px 0px;border-color:var(--lightslate);font-style:italic}.inherited-title.svelte-1sxai5n>div.svelte-1sxai5n:nth-child(1){grid-column-start:name;color:var(--slate)}.inherited-title.svelte-1sxai5n>div.svelte-1sxai5n:nth-child(2){grid-column-start:actions;color:var(--secondary100)}
|
||||
.title.svelte-1pp53c5{padding:3px;background-color:white;color:var(--secondary100);border-style:solid;border-width:1px 0 0 0;border-color:var(--lightslate)}.title.svelte-1pp53c5>span.svelte-1pp53c5{margin-left:10px}
|
||||
.component.svelte-13tuzj8{padding:5px;border-style:solid;border-width:0 0 1px 0;border-color:var(--lightslate);cursor:pointer}.component.svelte-13tuzj8:hover{background-color:var(--primary10)}.component.svelte-13tuzj8>.title.svelte-13tuzj8{font-size:13pt;color:var(--secondary100)}.component.svelte-13tuzj8>.description.svelte-13tuzj8{font-size:10pt;color:var(--primary75);font-style:italic}
|
||||
input.svelte-66516k{margin-right:7px}
|
||||
.root.svelte-bv289q{padding:10px}.option-container.svelte-bv289q{border-style:dotted;border-width:1px;border-color:var(--primary75);padding:3px;margin-right:5px}
|
||||
textarea.svelte-1wfv4cc{width:300px;height:200px}
|
||||
.root.svelte-woqcuf{display:grid;grid-template-columns:[name] 1fr [actions] auto}.root.svelte-woqcuf>div.svelte-woqcuf:nth-child(1){grid-column-start:name;color:var(--secondary50)}.root.svelte-woqcuf>div.svelte-woqcuf:nth-child(2){grid-column-start:actions}.selectedname.svelte-woqcuf{font-weight:bold;color:var(--secondary)}
|
||||
.root.svelte-w5on8s{padding:3px 5px 7px 10px;border-style:dotted;border-width:0 0 1px 0;border-color:var(--primary25)}
|
||||
.component-preview.svelte-1rf8xuh{display:grid;grid-template-rows:[top] 1fr [middle] auto [bottom] 1fr;grid-template-columns:[left] 1fr [middle] auto [right] 1fr;grid-column-start:preview;height:100%}.component-container.svelte-1rf8xuh{grid-row-start:middle;grid-column-start:middle}
|
||||
.section-container.svelte-1t0x31f{padding:15px;border-style:dotted;border-width:1px;border-color:var(--lightslate);border-radius:2px}.section-container.svelte-1t0x31f:nth-child(1){margin-bottom:15px}.row-text.svelte-1t0x31f{margin-right:15px;color:var(--primary100)}input.svelte-1t0x31f{margin-right:15px}p.svelte-1t0x31f>span.svelte-1t0x31f{margin-left:30px}.header.svelte-1t0x31f{display:grid;grid-template-columns:[title] 1fr [icon] auto}.header.svelte-1t0x31f>div.svelte-1t0x31f:nth-child(1){grid-column-start:title}.header.svelte-1t0x31f>div.svelte-1t0x31f:nth-child(2){grid-column-start:icon}
|
||||
|
||||
/*# sourceMappingURL=bundle.css.map */
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,8 @@ const {
|
|||
getApps,
|
||||
saveDerivedComponent,
|
||||
renameDerivedComponent,
|
||||
deleteDerivedComponent
|
||||
deleteDerivedComponent,
|
||||
getComponentLibraryPath
|
||||
} = require("../utilities/builder");
|
||||
|
||||
const builderPath = resolve(__dirname, "../builder");
|
||||
|
@ -160,6 +161,13 @@ module.exports = (config, app) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
.get("/_builder/api/:appname/componentlibrary", async (ctx) => {
|
||||
const {appPath, libPath} = await getComponentLibraryPath(
|
||||
config,
|
||||
ctx.params.appname,
|
||||
ctx.query.lib);
|
||||
await send(ctx, libPath, { root: appPath });
|
||||
})
|
||||
.post("/_builder/api/:appname/derivedcomponent", async (ctx) => {
|
||||
await saveDerivedComponent(
|
||||
config,
|
||||
|
|
|
@ -23,7 +23,8 @@ const {
|
|||
keys,
|
||||
reduce,
|
||||
some,
|
||||
keyBy
|
||||
keyBy,
|
||||
filter
|
||||
} = require("lodash/fp");
|
||||
const {merge} = require("lodash");
|
||||
|
||||
|
@ -51,15 +52,18 @@ module.exports.savePackage = async (config, appname, pkg) => {
|
|||
const appPath = appPackageFolder(config, appname);
|
||||
await writeJSON(
|
||||
`${appPath}/appDefinition.json`,
|
||||
pkg.appDefinition);
|
||||
pkg.appDefinition,
|
||||
{spaces:2});
|
||||
|
||||
await writeJSON(
|
||||
`${appPath}/access_levels.json`,
|
||||
pkg.accessLevels);
|
||||
pkg.accessLevels,
|
||||
{spaces:2});
|
||||
|
||||
await writeJSON(
|
||||
`${appPath}/pages.json`,
|
||||
pkg.pages);
|
||||
pkg.pages,
|
||||
{spaces:2});
|
||||
}
|
||||
|
||||
module.exports.getApps = async (config) =>
|
||||
|
@ -75,7 +79,7 @@ module.exports.saveDerivedComponent = async (config, appname, component) => {
|
|||
await writeJSON(
|
||||
componentPath(appPath, component.name),
|
||||
component,
|
||||
{encoding:"utf8", flag:"w"});
|
||||
{encoding:"utf8", flag:"w", spaces:2});
|
||||
}
|
||||
|
||||
module.exports.renameDerivedComponent = async (config, appname, oldName, newName) => {
|
||||
|
@ -104,32 +108,46 @@ module.exports.deleteDerivedComponent = async (config, appname, name) => {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports.getComponentLibraryPath = async (config, appname, libname) => {
|
||||
const appPath = appPackageFolder(config, appname);
|
||||
const components = await getComponentsFile(appPath, libname);
|
||||
return ({
|
||||
appPath,
|
||||
libPath:join(libname, components._lib.path)
|
||||
});
|
||||
}
|
||||
|
||||
const getComponentsFile = async (appPath, libname) => {
|
||||
const isRelative = some(c => c === libname.substring(0,1))
|
||||
("./~\\".split(""));
|
||||
|
||||
const componentsPath = isRelative
|
||||
? resolve(appPath, libname, "components.json")
|
||||
: resolve(libname, "components.json");
|
||||
|
||||
if(!await exists(componentsPath)) {
|
||||
const e = new Error(`could not find components definition file at ${componentsPath}`);
|
||||
e.statusCode = 404;
|
||||
throw e;
|
||||
}
|
||||
|
||||
try {
|
||||
return await readJSON(componentsPath);
|
||||
} catch(e) {
|
||||
const err = `could not parse JSON - ${componentsPath} : ${e.message}`;
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
const getRootComponents = async (appPath, pages ,lib) => {
|
||||
|
||||
const componentsInLibrary = async (libname) => {
|
||||
const isRelative = some(c => c === libname.substring(0,1))
|
||||
("./~\\".split(""));
|
||||
|
||||
const componentsPath = isRelative
|
||||
? resolve(appPath, libname, "components.json")
|
||||
: resolve(libname, "components.json");
|
||||
|
||||
if(!await exists(componentsPath)) {
|
||||
const e = new Error(`could not find components definition file at ${componentsPath}`);
|
||||
e.statusCode = 404;
|
||||
throw e;
|
||||
}
|
||||
|
||||
let components;
|
||||
try {
|
||||
components = await readJSON(componentsPath);
|
||||
} catch(e) {
|
||||
const err = `could not parse JSON - ${componentsPath} : ${e.message}`;
|
||||
throw new Error(err);
|
||||
}
|
||||
const components = await getComponentsFile(appPath, libname);
|
||||
|
||||
return $(components, [
|
||||
keys,
|
||||
filter(k => k !== "_lib"),
|
||||
reduce((obj, k) => {
|
||||
const component = components[k];
|
||||
component.name = `${libname}/${k}`;
|
||||
|
|
Loading…
Reference in New Issue