@teipublisher/pb-components 1.26.0 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/css/gridjs/mermaid.min.css +1 -0
- package/dist/demo/demos.json +4 -1
- package/dist/demo/pb-table-grid.html +17 -0
- package/dist/demo/people.json +35 -0
- package/dist/pb-components-bundle.js +136 -117
- package/dist/pb-elements.json +231 -0
- package/dist/pb-odd-editor.js +23 -14
- package/i18n/common/de.json +8 -1
- package/i18n/common/en.json +11 -3
- package/package.json +2 -1
- package/pb-elements.json +231 -0
- package/src/authority/connectors.js +4 -0
- package/src/authority/reconciliation.js +124 -0
- package/src/pb-components.js +1 -0
- package/src/pb-odd-editor.js +6 -2
- package/src/pb-odd-elementspec-editor.js +2 -0
- package/src/pb-odd-model-editor.js +17 -0
- package/src/pb-odd-parameter-editor.js +12 -5
- package/src/pb-table-column.js +66 -0
- package/src/pb-table-grid.js +212 -0
- package/src/pb-view-annotate.js +21 -6
- package/src/pb-view.js +10 -1
package/pb-elements.json
CHANGED
|
@@ -6661,6 +6661,11 @@
|
|
|
6661
6661
|
"type": "string",
|
|
6662
6662
|
"default": "\"\""
|
|
6663
6663
|
},
|
|
6664
|
+
{
|
|
6665
|
+
"name": "mode",
|
|
6666
|
+
"type": "string",
|
|
6667
|
+
"default": "\"\""
|
|
6668
|
+
},
|
|
6664
6669
|
{
|
|
6665
6670
|
"name": "model",
|
|
6666
6671
|
"type": "object",
|
|
@@ -6771,6 +6776,12 @@
|
|
|
6771
6776
|
"type": "string",
|
|
6772
6777
|
"default": "\"\""
|
|
6773
6778
|
},
|
|
6779
|
+
{
|
|
6780
|
+
"name": "mode",
|
|
6781
|
+
"attribute": "mode",
|
|
6782
|
+
"type": "string",
|
|
6783
|
+
"default": "\"\""
|
|
6784
|
+
},
|
|
6774
6785
|
{
|
|
6775
6786
|
"name": "model",
|
|
6776
6787
|
"attribute": "model",
|
|
@@ -6882,6 +6893,11 @@
|
|
|
6882
6893
|
"type": "string",
|
|
6883
6894
|
"default": "\"\""
|
|
6884
6895
|
},
|
|
6896
|
+
{
|
|
6897
|
+
"name": "set",
|
|
6898
|
+
"type": "boolean",
|
|
6899
|
+
"default": "false"
|
|
6900
|
+
},
|
|
6885
6901
|
{
|
|
6886
6902
|
"name": "behaviour",
|
|
6887
6903
|
"type": "string",
|
|
@@ -6918,6 +6934,12 @@
|
|
|
6918
6934
|
"type": "string",
|
|
6919
6935
|
"default": "\"\""
|
|
6920
6936
|
},
|
|
6937
|
+
{
|
|
6938
|
+
"name": "setParam",
|
|
6939
|
+
"attribute": "set",
|
|
6940
|
+
"type": "boolean",
|
|
6941
|
+
"default": "false"
|
|
6942
|
+
},
|
|
6921
6943
|
{
|
|
6922
6944
|
"name": "behaviour",
|
|
6923
6945
|
"attribute": "behaviour",
|
|
@@ -8923,6 +8945,215 @@
|
|
|
8923
8945
|
}
|
|
8924
8946
|
]
|
|
8925
8947
|
},
|
|
8948
|
+
{
|
|
8949
|
+
"name": "pb-table-column",
|
|
8950
|
+
"path": "./src/pb-table-column.js",
|
|
8951
|
+
"description": "Defines a column within `pb-table-grid`.",
|
|
8952
|
+
"attributes": [
|
|
8953
|
+
{
|
|
8954
|
+
"name": "label",
|
|
8955
|
+
"description": "Column heading to display",
|
|
8956
|
+
"type": "string",
|
|
8957
|
+
"default": "\"no-label\""
|
|
8958
|
+
},
|
|
8959
|
+
{
|
|
8960
|
+
"name": "property",
|
|
8961
|
+
"description": "Name of the JSON property containing the data",
|
|
8962
|
+
"type": "string"
|
|
8963
|
+
},
|
|
8964
|
+
{
|
|
8965
|
+
"name": "sort",
|
|
8966
|
+
"description": "Should the column support sorting?",
|
|
8967
|
+
"type": "boolean",
|
|
8968
|
+
"default": "false"
|
|
8969
|
+
},
|
|
8970
|
+
{
|
|
8971
|
+
"name": "width",
|
|
8972
|
+
"description": "Optional fixed width of the column (e.g. '200px' or '30%')",
|
|
8973
|
+
"type": "string"
|
|
8974
|
+
}
|
|
8975
|
+
],
|
|
8976
|
+
"properties": [
|
|
8977
|
+
{
|
|
8978
|
+
"name": "label",
|
|
8979
|
+
"attribute": "label",
|
|
8980
|
+
"description": "Column heading to display",
|
|
8981
|
+
"type": "string",
|
|
8982
|
+
"default": "\"no-label\""
|
|
8983
|
+
},
|
|
8984
|
+
{
|
|
8985
|
+
"name": "property",
|
|
8986
|
+
"attribute": "property",
|
|
8987
|
+
"description": "Name of the JSON property containing the data",
|
|
8988
|
+
"type": "string"
|
|
8989
|
+
},
|
|
8990
|
+
{
|
|
8991
|
+
"name": "sort",
|
|
8992
|
+
"attribute": "sort",
|
|
8993
|
+
"description": "Should the column support sorting?",
|
|
8994
|
+
"type": "boolean",
|
|
8995
|
+
"default": "false"
|
|
8996
|
+
},
|
|
8997
|
+
{
|
|
8998
|
+
"name": "width",
|
|
8999
|
+
"attribute": "width",
|
|
9000
|
+
"description": "Optional fixed width of the column (e.g. '200px' or '30%')",
|
|
9001
|
+
"type": "string"
|
|
9002
|
+
}
|
|
9003
|
+
]
|
|
9004
|
+
},
|
|
9005
|
+
{
|
|
9006
|
+
"name": "pb-table-grid",
|
|
9007
|
+
"path": "./src/pb-table-grid.js",
|
|
9008
|
+
"description": "A table grid based on [gridjs](https://gridjs.io/), which loads its data from a server endpoint\nspecified in `source`. If `source` is a relative URI, it will be resolved relative to the\nTEI Publisher endpoint.\n\nThe JSON data returned by the endpoint should be an object with two properties:\n\n* `count`: the overall number of rows available on the server\n* `results`: an array containing each record as an object\n\nThe parameters send to the server are as follows:\n\n\nParameter | Description\n---------|----------\nlimit | number of records to return for each page\nstart | start offset from which to return records\norder | the id of the column to sort by\ndir | sort direction: either 'asc' or 'desc'\nsearch | an optional search string entered by the user\n\nTable columns are configured via nested `<pb-table-column>` elements:\n\n```html\n<pb-table-column label=\"Name\" property=\"name\" sort width=\"33%\"></pb-table-column>\n<pb-table-column label=\"Born\" property=\"birth\"></pb-table-column>\n<pb-table-column label=\"Died\" property=\"death\"></pb-table-column>\n```",
|
|
9009
|
+
"attributes": [
|
|
9010
|
+
{
|
|
9011
|
+
"name": "source",
|
|
9012
|
+
"description": "URI of the server-side endpoint to retrieve data from.\nRelative URIs are resolved relative to the configured TEI Publisher endpoint.",
|
|
9013
|
+
"type": "string"
|
|
9014
|
+
},
|
|
9015
|
+
{
|
|
9016
|
+
"name": "css-path",
|
|
9017
|
+
"description": "Path to the gridjs theme CSS files.",
|
|
9018
|
+
"type": "string",
|
|
9019
|
+
"default": "\"../css/gridjs\""
|
|
9020
|
+
},
|
|
9021
|
+
{
|
|
9022
|
+
"name": "resizable",
|
|
9023
|
+
"description": "If specified, columns (without a fixed width) will be resizable.",
|
|
9024
|
+
"type": "boolean",
|
|
9025
|
+
"default": "false"
|
|
9026
|
+
},
|
|
9027
|
+
{
|
|
9028
|
+
"name": "search",
|
|
9029
|
+
"description": "If specified, enable server-side search.",
|
|
9030
|
+
"type": "boolean",
|
|
9031
|
+
"default": "false"
|
|
9032
|
+
},
|
|
9033
|
+
{
|
|
9034
|
+
"name": "per-page",
|
|
9035
|
+
"type": "number",
|
|
9036
|
+
"default": "10"
|
|
9037
|
+
},
|
|
9038
|
+
{
|
|
9039
|
+
"name": "height",
|
|
9040
|
+
"type": "string"
|
|
9041
|
+
},
|
|
9042
|
+
{
|
|
9043
|
+
"name": "subscribe",
|
|
9044
|
+
"description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
|
|
9045
|
+
"type": "string"
|
|
9046
|
+
},
|
|
9047
|
+
{
|
|
9048
|
+
"name": "subscribe-config",
|
|
9049
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
|
|
9050
|
+
"type": "object"
|
|
9051
|
+
},
|
|
9052
|
+
{
|
|
9053
|
+
"name": "emit",
|
|
9054
|
+
"description": "The name of the channel to send events to.",
|
|
9055
|
+
"type": "string"
|
|
9056
|
+
},
|
|
9057
|
+
{
|
|
9058
|
+
"name": "emit-config",
|
|
9059
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
|
|
9060
|
+
"type": "object"
|
|
9061
|
+
},
|
|
9062
|
+
{
|
|
9063
|
+
"name": "wait-for",
|
|
9064
|
+
"description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
|
|
9065
|
+
"type": "string"
|
|
9066
|
+
},
|
|
9067
|
+
{
|
|
9068
|
+
"name": "disabled",
|
|
9069
|
+
"description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
|
|
9070
|
+
"type": "boolean",
|
|
9071
|
+
"default": "false"
|
|
9072
|
+
}
|
|
9073
|
+
],
|
|
9074
|
+
"properties": [
|
|
9075
|
+
{
|
|
9076
|
+
"name": "source",
|
|
9077
|
+
"attribute": "source",
|
|
9078
|
+
"description": "URI of the server-side endpoint to retrieve data from.\nRelative URIs are resolved relative to the configured TEI Publisher endpoint.",
|
|
9079
|
+
"type": "string"
|
|
9080
|
+
},
|
|
9081
|
+
{
|
|
9082
|
+
"name": "cssPath",
|
|
9083
|
+
"attribute": "css-path",
|
|
9084
|
+
"description": "Path to the gridjs theme CSS files.",
|
|
9085
|
+
"type": "string",
|
|
9086
|
+
"default": "\"../css/gridjs\""
|
|
9087
|
+
},
|
|
9088
|
+
{
|
|
9089
|
+
"name": "resizable",
|
|
9090
|
+
"attribute": "resizable",
|
|
9091
|
+
"description": "If specified, columns (without a fixed width) will be resizable.",
|
|
9092
|
+
"type": "boolean",
|
|
9093
|
+
"default": "false"
|
|
9094
|
+
},
|
|
9095
|
+
{
|
|
9096
|
+
"name": "search",
|
|
9097
|
+
"attribute": "search",
|
|
9098
|
+
"description": "If specified, enable server-side search.",
|
|
9099
|
+
"type": "boolean",
|
|
9100
|
+
"default": "false"
|
|
9101
|
+
},
|
|
9102
|
+
{
|
|
9103
|
+
"name": "perPage",
|
|
9104
|
+
"attribute": "per-page",
|
|
9105
|
+
"type": "number",
|
|
9106
|
+
"default": "10"
|
|
9107
|
+
},
|
|
9108
|
+
{
|
|
9109
|
+
"name": "height",
|
|
9110
|
+
"attribute": "height",
|
|
9111
|
+
"type": "string"
|
|
9112
|
+
},
|
|
9113
|
+
{
|
|
9114
|
+
"name": "fixedHeader",
|
|
9115
|
+
"type": "boolean",
|
|
9116
|
+
"default": "false"
|
|
9117
|
+
},
|
|
9118
|
+
{
|
|
9119
|
+
"name": "subscribe",
|
|
9120
|
+
"attribute": "subscribe",
|
|
9121
|
+
"description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
|
|
9122
|
+
"type": "string"
|
|
9123
|
+
},
|
|
9124
|
+
{
|
|
9125
|
+
"name": "subscribeConfig",
|
|
9126
|
+
"attribute": "subscribe-config",
|
|
9127
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
|
|
9128
|
+
"type": "object"
|
|
9129
|
+
},
|
|
9130
|
+
{
|
|
9131
|
+
"name": "emit",
|
|
9132
|
+
"attribute": "emit",
|
|
9133
|
+
"description": "The name of the channel to send events to.",
|
|
9134
|
+
"type": "string"
|
|
9135
|
+
},
|
|
9136
|
+
{
|
|
9137
|
+
"name": "emitConfig",
|
|
9138
|
+
"attribute": "emit-config",
|
|
9139
|
+
"description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
|
|
9140
|
+
"type": "object"
|
|
9141
|
+
},
|
|
9142
|
+
{
|
|
9143
|
+
"name": "waitFor",
|
|
9144
|
+
"attribute": "wait-for",
|
|
9145
|
+
"description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
|
|
9146
|
+
"type": "string"
|
|
9147
|
+
},
|
|
9148
|
+
{
|
|
9149
|
+
"name": "disabled",
|
|
9150
|
+
"attribute": "disabled",
|
|
9151
|
+
"description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
|
|
9152
|
+
"type": "boolean",
|
|
9153
|
+
"default": "false"
|
|
9154
|
+
}
|
|
9155
|
+
]
|
|
9156
|
+
},
|
|
8926
9157
|
{
|
|
8927
9158
|
"name": "pb-tabs",
|
|
8928
9159
|
"path": "./src/pb-tabs.js",
|
|
@@ -4,6 +4,7 @@ import { Airtable } from './airtable.js';
|
|
|
4
4
|
import { GND } from './gnd.js';
|
|
5
5
|
import { KBGA } from './kbga.js';
|
|
6
6
|
import { GF } from './gf.js';
|
|
7
|
+
import { ReconciliationService } from './reconciliation.js';
|
|
7
8
|
import { Custom } from './custom.js';
|
|
8
9
|
|
|
9
10
|
export function createConnectors(endpoint, root) {
|
|
@@ -27,6 +28,9 @@ export function createConnectors(endpoint, root) {
|
|
|
27
28
|
case 'GF':
|
|
28
29
|
instance = new GF(configElem);
|
|
29
30
|
break;
|
|
31
|
+
case 'ReconciliationService':
|
|
32
|
+
instance = new ReconciliationService(configElem);
|
|
33
|
+
break;
|
|
30
34
|
case 'Custom':
|
|
31
35
|
instance = new Custom(endpoint, configElem);
|
|
32
36
|
break;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { Registry } from './registry.js'
|
|
3
|
+
|
|
4
|
+
// Todo:
|
|
5
|
+
// - strings <- types
|
|
6
|
+
// - use scheme#types in @type output?
|
|
7
|
+
// - test with other providers, inside custom connector
|
|
8
|
+
// - documentation
|
|
9
|
+
|
|
10
|
+
async function getServiceManifest (endpoint) {
|
|
11
|
+
const response = await fetch(endpoint);
|
|
12
|
+
const data = await response.json();
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class ReconciliationService extends Registry {
|
|
17
|
+
constructor(configElem) {
|
|
18
|
+
super(configElem)
|
|
19
|
+
this.endpoint = configElem.getAttribute('endpoint');
|
|
20
|
+
this.debug = configElem.getAttribute('debug');
|
|
21
|
+
getServiceManifest(this.endpoint).then((result) => {
|
|
22
|
+
this.ORConfig = result;
|
|
23
|
+
if (this.debug) {
|
|
24
|
+
console.log(
|
|
25
|
+
'OpenReconcile connector for register \'%s\' at endpoint <%s>. Using config: %o',
|
|
26
|
+
this._register, this.endpoint, this.ORConfig
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Query the authority and return a RegistryResult.
|
|
34
|
+
*
|
|
35
|
+
* @param {String} key the search string
|
|
36
|
+
*/
|
|
37
|
+
async query(key) {
|
|
38
|
+
const results = [];
|
|
39
|
+
const paramsObj = {
|
|
40
|
+
q1: {
|
|
41
|
+
query: key
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
fetch(this.endpoint, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
'Accept': 'application/json',
|
|
50
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
51
|
+
},
|
|
52
|
+
body: "queries=".concat(JSON.stringify(paramsObj))
|
|
53
|
+
})
|
|
54
|
+
.then((response) => response.json())
|
|
55
|
+
.then((json) => {
|
|
56
|
+
json.q1.result.forEach((item) => {
|
|
57
|
+
if (this.ORConfig.view) {
|
|
58
|
+
this.view = this.ORConfig.view.url.replace('{{id}}', item.id);
|
|
59
|
+
} else {
|
|
60
|
+
this.view = item.id;
|
|
61
|
+
}
|
|
62
|
+
if (item.description) {
|
|
63
|
+
this.description = item.description;
|
|
64
|
+
} else if (item.type) {
|
|
65
|
+
this.description = item.type.map(t => t.name.toString() ).join(', ')
|
|
66
|
+
} else {
|
|
67
|
+
this.description = ""
|
|
68
|
+
}
|
|
69
|
+
const result = {
|
|
70
|
+
register: this._register,
|
|
71
|
+
id: (this._prefix ? `${this._prefix}-${item.id}` : item.id),
|
|
72
|
+
label: item.name,
|
|
73
|
+
link: this.view,
|
|
74
|
+
details: this.description,
|
|
75
|
+
provider: 'OpenReconcile'
|
|
76
|
+
};
|
|
77
|
+
results.push(result);
|
|
78
|
+
});
|
|
79
|
+
if (this.debug) {
|
|
80
|
+
console.log(
|
|
81
|
+
'OpenReconcile results: %o',
|
|
82
|
+
results
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
resolve({
|
|
86
|
+
totalItems: json.q1.result.length,
|
|
87
|
+
items: results,
|
|
88
|
+
});
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Retrieve information about a registry entry and display it
|
|
95
|
+
* using the given container.
|
|
96
|
+
*
|
|
97
|
+
* @param {String} id the id to look up
|
|
98
|
+
* @param {HTMLElement} container reference to an element which should be used as container for displaying the information
|
|
99
|
+
* @returns {Promise} a promise
|
|
100
|
+
*/
|
|
101
|
+
info(id, container) {
|
|
102
|
+
if (!id) {
|
|
103
|
+
return Promise.resolve({});
|
|
104
|
+
}
|
|
105
|
+
if (!this.ORConfig.preview) {
|
|
106
|
+
container.innerHTML = 'no \'preview\' information in endpoint\'s manifest';
|
|
107
|
+
return Promise.resolve();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
const rawid = this._prefix ? id.substring(this._prefix.length + 1) : id;
|
|
112
|
+
const url = this.ORConfig.preview.url.replace('{{id}}', encodeURIComponent(rawid));
|
|
113
|
+
fetch(url)
|
|
114
|
+
.then(response => response.text())
|
|
115
|
+
.then((output) => {
|
|
116
|
+
container.innerHTML = output;
|
|
117
|
+
resolve({
|
|
118
|
+
id: this._prefix ? `${this._prefix}-${rawid}` : rawid
|
|
119
|
+
});
|
|
120
|
+
})
|
|
121
|
+
.catch(() => reject());
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
package/src/pb-components.js
CHANGED
|
@@ -56,6 +56,7 @@ import './pb-authority-lookup.js';
|
|
|
56
56
|
import './pb-message.js';
|
|
57
57
|
import './pb-blacklab-results.js';
|
|
58
58
|
import './pb-blacklab-highlight.js';
|
|
59
|
+
import './pb-table-grid.js';
|
|
59
60
|
|
|
60
61
|
import '@polymer/iron-icons/editor-icons';
|
|
61
62
|
import '@polymer/iron-icons/social-icons';
|
package/src/pb-odd-editor.js
CHANGED
|
@@ -832,8 +832,9 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
832
832
|
this.serializeAttribute('predicate', model.predicate),
|
|
833
833
|
model.type === 'model' ? this.serializeAttribute('behaviour', model.behaviour) : '',
|
|
834
834
|
this.serializeAttribute('cssClass', model.css),
|
|
835
|
-
this.serializeAttribute('useSourceRendition', model.sourcerend)
|
|
836
|
-
|
|
835
|
+
this.serializeAttribute('useSourceRendition', model.sourcerend),
|
|
836
|
+
this.serializeAttribute('pb:mode', model.mode)
|
|
837
|
+
].join('');
|
|
837
838
|
|
|
838
839
|
const desc = model.desc ? nestedIndent + '<desc>' + model.desc + '</desc>\n' : '';
|
|
839
840
|
|
|
@@ -854,6 +855,9 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
854
855
|
}
|
|
855
856
|
const name = this.serializeAttribute('name', parameter.name);
|
|
856
857
|
const value = this.serializeAttribute('value', parameter.value);
|
|
858
|
+
if (parameter.set) {
|
|
859
|
+
return `${indent}<pb:set-param xmlns=""${name}${value}/>\n`
|
|
860
|
+
}
|
|
857
861
|
return `${indent}<param${name}${value}/>\n`
|
|
858
862
|
}
|
|
859
863
|
|
|
@@ -171,6 +171,7 @@ export class PbOddElementspecEditor extends LitElement {
|
|
|
171
171
|
type="${model.type}"
|
|
172
172
|
output="${model.output}"
|
|
173
173
|
css="${model.css}"
|
|
174
|
+
mode="${model.mode}"
|
|
174
175
|
.model="${model}"
|
|
175
176
|
.parameters="${model.parameters}"
|
|
176
177
|
desc="${model.desc}"
|
|
@@ -203,6 +204,7 @@ export class PbOddElementspecEditor extends LitElement {
|
|
|
203
204
|
const newModel = {
|
|
204
205
|
behaviour: 'inline',
|
|
205
206
|
css: '',
|
|
207
|
+
mode: '',
|
|
206
208
|
predicate: '',
|
|
207
209
|
desc: '',
|
|
208
210
|
type: addModel.selected,
|
|
@@ -271,6 +271,9 @@ export class PbOddModelEditor extends LitElement {
|
|
|
271
271
|
return value;
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
|
+
mode: {
|
|
275
|
+
type: String
|
|
276
|
+
},
|
|
274
277
|
model: {
|
|
275
278
|
type: Object
|
|
276
279
|
},
|
|
@@ -331,6 +334,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
331
334
|
this.template = '';
|
|
332
335
|
this.output = '';
|
|
333
336
|
this.css = '';
|
|
337
|
+
this.mode = '';
|
|
334
338
|
this.model = {};
|
|
335
339
|
this.model.models = [];
|
|
336
340
|
this.parameters = [];
|
|
@@ -479,6 +483,11 @@ export class PbOddModelEditor extends LitElement {
|
|
|
479
483
|
placeholder="${translate('odd.editor.model.css-class-placeholder')}"
|
|
480
484
|
label="CSS Class"
|
|
481
485
|
@change="${this._inputCss}"></paper-input>
|
|
486
|
+
|
|
487
|
+
<paper-input id="mode" .value="${this.mode}"
|
|
488
|
+
placeholder="${translate('odd.editor.model.mode-placeholder')}"
|
|
489
|
+
label="Mode"
|
|
490
|
+
@change="${this._inputMode}"></paper-input>
|
|
482
491
|
|
|
483
492
|
<pb-code-editor id="template"
|
|
484
493
|
code="${this.template}"
|
|
@@ -501,6 +510,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
501
510
|
behaviour="${this.behaviour}"
|
|
502
511
|
name="${parameter.name}"
|
|
503
512
|
value="${parameter.value}"
|
|
513
|
+
?set="${parameter.set}"
|
|
504
514
|
endpoint="${this.endpoint}"
|
|
505
515
|
apiVersion="${this.apiVersion}"
|
|
506
516
|
@parameter-remove="${(e) => this._removeParam(e, index)}"
|
|
@@ -543,6 +553,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
543
553
|
type="${model.type}"
|
|
544
554
|
output="${model.output}"
|
|
545
555
|
css="${model.css}"
|
|
556
|
+
mode="${model.mode}"
|
|
546
557
|
.model="${model}"
|
|
547
558
|
.parameters="${model.parameters}"
|
|
548
559
|
desc="${model.desc}"
|
|
@@ -836,6 +847,11 @@ export class PbOddModelEditor extends LitElement {
|
|
|
836
847
|
this._fireModelChanged('css', this.css);
|
|
837
848
|
}
|
|
838
849
|
|
|
850
|
+
_inputMode(ev) {
|
|
851
|
+
this.mode = ev.composedPath()[0].value;
|
|
852
|
+
this._fireModelChanged('mode', this.mode);
|
|
853
|
+
}
|
|
854
|
+
|
|
839
855
|
_updateTemplate(ev) {
|
|
840
856
|
this.template = this.shadowRoot.getElementById('template').getSource();
|
|
841
857
|
this._fireModelChanged('template', this.template);
|
|
@@ -854,6 +870,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
854
870
|
_updateParam(e, index) {
|
|
855
871
|
this.parameters[index].name = e.detail.name;
|
|
856
872
|
this.parameters[index].value = e.detail.value;
|
|
873
|
+
this.parameters[index].set = e.detail.set;
|
|
857
874
|
this._fireModelChanged('parameters', this.parameters);
|
|
858
875
|
}
|
|
859
876
|
|
|
@@ -29,7 +29,7 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
29
29
|
}
|
|
30
30
|
.wrapper{
|
|
31
31
|
display:grid;
|
|
32
|
-
grid-template-columns:150px auto 50px;
|
|
32
|
+
grid-template-columns:150px auto 50px 50px;
|
|
33
33
|
grid-column-gap:20px;
|
|
34
34
|
grid-row-gap:20px;
|
|
35
35
|
margin-bottom:10px;
|
|
@@ -37,8 +37,9 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
37
37
|
paper-dropdown-menu{
|
|
38
38
|
align-self:start;
|
|
39
39
|
}
|
|
40
|
-
paper-icon-button{
|
|
41
|
-
align-self:center;
|
|
40
|
+
paper-icon-button, paper-checkbox {
|
|
41
|
+
align-self: center;
|
|
42
|
+
margin-top: 16px;
|
|
42
43
|
}
|
|
43
44
|
`;
|
|
44
45
|
}
|
|
@@ -56,7 +57,7 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
56
57
|
code="${this.value}"
|
|
57
58
|
linter="${this.endpoint}/${cmpVersion(this.apiVersion, '1.0.0') ? 'modules/editor.xql' : 'api/lint'}"
|
|
58
59
|
apiVersion="${this.apiVersion}"></pb-code-editor>
|
|
59
|
-
|
|
60
|
+
<paper-checkbox id="set" ?checked="${this.setParam}" @change="${this._handleCodeChange}">set</paper-checkbox>
|
|
60
61
|
<paper-icon-button @click="${this._delete}" icon="delete" title="delete this parameter"></paper-icon-button>
|
|
61
62
|
</div>
|
|
62
63
|
|
|
@@ -87,6 +88,10 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
87
88
|
parameters: {
|
|
88
89
|
type: Object
|
|
89
90
|
},
|
|
91
|
+
setParam: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
attribute: 'set'
|
|
94
|
+
},
|
|
90
95
|
_currentParameters: {
|
|
91
96
|
type: Array
|
|
92
97
|
},
|
|
@@ -104,6 +109,7 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
104
109
|
super();
|
|
105
110
|
this.name = '';
|
|
106
111
|
this.value = '';
|
|
112
|
+
this.setParam = false;
|
|
107
113
|
this.behaviour = '';
|
|
108
114
|
this.currentParameters = [];
|
|
109
115
|
this.parameters = {
|
|
@@ -189,7 +195,8 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
189
195
|
console.log('_handleCodeChange ', e);
|
|
190
196
|
this.value = this.shadowRoot.getElementById('editor').getSource();
|
|
191
197
|
this.name = this.shadowRoot.getElementById('combo').text;
|
|
192
|
-
this.
|
|
198
|
+
this.setParam = this.shadowRoot.getElementById('set').checked;
|
|
199
|
+
this.dispatchEvent(new CustomEvent('parameter-changed', { composed: true, bubbles: true, detail: { name: this.name, value: this.value, set: this.setParam } }));
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { LitElement } from 'lit-element';
|
|
2
|
+
import { html } from "gridjs";
|
|
3
|
+
import './pb-popover.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines a column within `pb-table-grid`.
|
|
7
|
+
*/
|
|
8
|
+
export class PbTableColumn extends LitElement {
|
|
9
|
+
static get properties() {
|
|
10
|
+
return {
|
|
11
|
+
/**
|
|
12
|
+
* Column heading to display
|
|
13
|
+
*/
|
|
14
|
+
label: {
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Name of the JSON property containing the data
|
|
19
|
+
*/
|
|
20
|
+
property: {
|
|
21
|
+
type: String
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Should the column support sorting?
|
|
25
|
+
*/
|
|
26
|
+
sort: {
|
|
27
|
+
type: Boolean
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Optional fixed width of the column (e.g. '200px' or '30%')
|
|
31
|
+
*/
|
|
32
|
+
width: {
|
|
33
|
+
type: String
|
|
34
|
+
},
|
|
35
|
+
...super.properties
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
super();
|
|
41
|
+
this.label = 'no-label';
|
|
42
|
+
this.property = null;
|
|
43
|
+
this.sort = false;
|
|
44
|
+
this.width = null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
data() {
|
|
52
|
+
const config = {
|
|
53
|
+
name: this.label,
|
|
54
|
+
sort: { enabled: this.sort },
|
|
55
|
+
formatter: (cell) => html(cell)
|
|
56
|
+
};
|
|
57
|
+
if (this.property) {
|
|
58
|
+
config.id = this.property;
|
|
59
|
+
}
|
|
60
|
+
if (this.width) {
|
|
61
|
+
config.width = this.width;
|
|
62
|
+
}
|
|
63
|
+
return config;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
customElements.define('pb-table-column', PbTableColumn);
|