pragma-schema
Advanced tools
Comparing version 1.0.59 to 1.0.60
{ | ||
"name": "pragma-schema", | ||
"version": "1.0.59", | ||
"version": "1.0.60", | ||
"description": "utility for building pragma schema structures", | ||
@@ -5,0 +5,0 @@ "main": "commonjs/src/schema.js", |
@@ -315,15 +315,9 @@ class IdObject { | ||
export class Title { | ||
constructor() { | ||
} | ||
add(key, value) { | ||
this[key] = value; | ||
} | ||
} | ||
export class Translations { | ||
constructor() { | ||
this.titles = new Title(); | ||
add(objectName, key, value) { | ||
if (this[objectName] == null) { | ||
this[objectName] = {}; | ||
} | ||
this[objectName][key] = value; | ||
} | ||
@@ -456,18 +450,25 @@ } | ||
static gridColumn(attributes) { | ||
const result = { | ||
element: "pragma-grid-column" | ||
static gridColumn(field, title, width, formatters) { | ||
const element = { | ||
field: field, | ||
title: title, | ||
width: width, | ||
formatters: formatters || [] | ||
}; | ||
SchemaElementFactory.addAttributes(result, attributes); | ||
return result; | ||
return element; | ||
} | ||
static gridVisualisation(attributes) { | ||
static gridVisualisation(id, selection, selectedId, dataSource, perspective, columns, attributes) { | ||
const element = { | ||
element: "pragma-grid", | ||
elements: [] | ||
element: "grid", | ||
columns: columns || [], | ||
elements: [], | ||
id: id, | ||
selection: selection, | ||
selectedId: selectedId, | ||
datasource: dataSource, | ||
perspective: perspective | ||
}; | ||
SchemaElementFactory.addAttributes(element, attributes); | ||
@@ -506,6 +507,11 @@ | ||
static listVisualisation(attributes) { | ||
static listVisualisation(id, templates, dataSource, perspective, selection, selectedId, attributes) { | ||
const element = { | ||
element: "pragma-list", | ||
elements: [] | ||
element: "list", | ||
templates: templates || [], | ||
id: id, | ||
datasource: dataSource, | ||
perspective: perspective, | ||
selection: selection, | ||
selectedId: selectedId | ||
}; | ||
@@ -589,3 +595,3 @@ | ||
static translation(value) { | ||
static translation(path, value) { | ||
if(value !== undefined) { | ||
@@ -596,3 +602,3 @@ const capitalized = `${value.charAt(0).toUpperCase()}${value.slice(1)}`; | ||
label: label, | ||
translation: `@translations.titles.${label}` | ||
translation: `@translations.${path}.${label}` | ||
} | ||
@@ -599,0 +605,0 @@ } |
16397
509