@entryscape/rdforms 10.10.1 → 10.11.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/dist/rdforms.bmd.js +44 -27
- package/dist/rdforms.bootstrap.js +62 -44
- package/dist/rdforms.jquery.js +41 -24
- package/dist/rdforms.node.js +2 -280
- package/dist/rdforms.node.js.LICENSE.txt +34 -0
- package/dist/rdforms.react.js +88 -195
- package/package.json +36 -43
- package/src/spec/nls/de/spec.nls +35 -0
- package/src/template/Item.js +18 -0
- package/src/template/ItemStore.js +23 -8
- package/src/view/jquery/choice.js +11 -11
- package/src/view/react/choice.js +12 -4
- package/src/view/viewUtils.js +1 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"application profile",
|
|
9
9
|
"linked data"
|
|
10
10
|
],
|
|
11
|
-
"version": "10.
|
|
11
|
+
"version": "10.11.1",
|
|
12
12
|
"main": "dist/rdforms.node.js",
|
|
13
13
|
"browser": "dist/rdforms.react.js",
|
|
14
14
|
"module": "main.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@emotion/react": "^11.4.1",
|
|
20
20
|
"@emotion/styled": "^11.3.0",
|
|
21
|
-
"@entryscape/rdfjson": "2.
|
|
21
|
+
"@entryscape/rdfjson": "2.7.6",
|
|
22
22
|
"@fortawesome/fontawesome-free": "^5.8.1",
|
|
23
23
|
"@mui/icons-material": "^5.0.3",
|
|
24
24
|
"@mui/material": "^5.0.3",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"@mui/x-date-pickers": "^5.0.0-beta.7",
|
|
27
27
|
"@selectize/selectize": "^0.13.5",
|
|
28
28
|
"arrive": "^2.4.1",
|
|
29
|
-
"bootstrap": "^4.
|
|
29
|
+
"bootstrap": "^4.6.2",
|
|
30
30
|
"bootstrap-datepicker": "^1.9.0",
|
|
31
31
|
"bootstrap-material-datetimepicker": "https://bitbucket.org/metasolutions/bootstrap-material-datetimepicker.git#webpack",
|
|
32
32
|
"bootstrap-material-design": "^4.1.1",
|
|
33
33
|
"circular-dependency-plugin": "^5.2.2",
|
|
34
34
|
"core-js": "^3.4.0",
|
|
35
35
|
"ifdef-loader": "^2.1.1",
|
|
36
|
-
"jquery": "^3.
|
|
36
|
+
"jquery": "^3.7.0",
|
|
37
37
|
"jquery-mousewheel": "^3.1.13",
|
|
38
38
|
"lodash-es": "^4.17.10",
|
|
39
39
|
"moment": "^2.22.2",
|
|
40
40
|
"nls-loader": "https://bitbucket.org/metasolutions/nls-loader#master",
|
|
41
41
|
"node-fetch": "^2.6.0",
|
|
42
|
-
"popper.js": "^1.
|
|
42
|
+
"popper.js": "^1.16.1",
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-dom": "^18.2.0",
|
|
45
45
|
"react-hooks-lib": "^0.1.5",
|
|
@@ -51,46 +51,40 @@
|
|
|
51
51
|
"whatwg-fetch": "^3.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@babel/cli": "^7.
|
|
55
|
-
"@babel/core": "^7.
|
|
56
|
-
"@babel/plugin-proposal-
|
|
57
|
-
"@babel/plugin-
|
|
58
|
-
"@babel/plugin-
|
|
59
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
60
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"babel-
|
|
63
|
-
"babel-loader": "^8.0.2",
|
|
64
|
-
"babel-minify-webpack-plugin": "^0.3.1",
|
|
54
|
+
"@babel/cli": "^7.16.0",
|
|
55
|
+
"@babel/core": "^7.16.0",
|
|
56
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
57
|
+
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
|
58
|
+
"@babel/plugin-transform-class-properties": "^7.23.3",
|
|
59
|
+
"@babel/plugin-transform-modules-commonjs": "^7.16.0",
|
|
60
|
+
"@babel/plugin-transform-react-jsx": "^7.16.0",
|
|
61
|
+
"@babel/preset-env": "^7.18.6",
|
|
62
|
+
"babel-loader": "^8.2.3",
|
|
65
63
|
"babel-plugin-lodash": "^3.3.4",
|
|
66
64
|
"babel-plugin-transform-react-jsx": "^6.24.1",
|
|
67
|
-
"clean-webpack-plugin": "^0.
|
|
68
|
-
"copy-webpack-plugin": "^
|
|
69
|
-
"css-loader": "^
|
|
65
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
66
|
+
"copy-webpack-plugin": "^9.0.1",
|
|
67
|
+
"css-loader": "^6.5.1",
|
|
70
68
|
"eslint": "^8.23.0",
|
|
71
69
|
"eslint-config-airbnb-base": "^11.1.1",
|
|
72
70
|
"eslint-plugin-import": "^2.2.0",
|
|
73
71
|
"eslint-plugin-requirejs": "^3.1.1",
|
|
74
|
-
"
|
|
75
|
-
"html-
|
|
76
|
-
"html-webpack-plugin": "^3.2
|
|
77
|
-
"html-webpack-tags-plugin": "^2.0.17",
|
|
72
|
+
"html-loader": "^3.0.1",
|
|
73
|
+
"html-webpack-plugin": "^5.5.0",
|
|
74
|
+
"html-webpack-tags-plugin": "^3.0.2",
|
|
78
75
|
"imports-loader": "^0.8.0",
|
|
79
76
|
"mini-css-extract-plugin": "^0.4.1",
|
|
80
|
-
"optimize-css-assets-webpack-plugin": "^
|
|
81
|
-
"parallel-webpack": "^2.
|
|
82
|
-
"print-licenses": "https://bitbucket.org/metasolutions/print-licenses#master",
|
|
77
|
+
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
|
78
|
+
"parallel-webpack": "^2.6.0",
|
|
83
79
|
"q": "^1.5.0",
|
|
84
|
-
"raw-loader": "^0.
|
|
85
|
-
"style-loader": "^
|
|
80
|
+
"raw-loader": "^4.0.2",
|
|
81
|
+
"style-loader": "^3.3.1",
|
|
86
82
|
"svg-inline-loader": "^0.8.0",
|
|
87
83
|
"ttf-loader": "^1.0.2",
|
|
88
|
-
"webpack": "^
|
|
89
|
-
"webpack-cli": "^
|
|
90
|
-
"webpack-dev-server": "^
|
|
91
|
-
"webpack-
|
|
92
|
-
"webpack-merge": "^4.1.4",
|
|
93
|
-
"webpack-node-externals": "^1.6.0"
|
|
84
|
+
"webpack": "^5.88.2",
|
|
85
|
+
"webpack-cli": "^5.1.4",
|
|
86
|
+
"webpack-dev-server": "^4.15.1",
|
|
87
|
+
"webpack-merge": "^5.8.0"
|
|
94
88
|
},
|
|
95
89
|
"files": [
|
|
96
90
|
"dist",
|
|
@@ -99,16 +93,15 @@
|
|
|
99
93
|
"renderers"
|
|
100
94
|
],
|
|
101
95
|
"scripts": {
|
|
102
|
-
"build:all": "webpack --
|
|
103
|
-
"build:node": "webpack --
|
|
104
|
-
"build:node:dev": "webpack --mode=development --
|
|
96
|
+
"build:all": "webpack --mode=production --config webpack.all.js",
|
|
97
|
+
"build:node": "webpack --config webpack.node.js",
|
|
98
|
+
"build:node:dev": "webpack --mode=development --config webpack.node.js",
|
|
105
99
|
"build:samples": "webpack --config webpack.samples.js",
|
|
106
|
-
"dev:bmd": "webpack
|
|
107
|
-
"dev:bootstrap": "webpack
|
|
108
|
-
"dev:jquery": "webpack
|
|
109
|
-
"dev:react": "webpack
|
|
110
|
-
"serve:samples": "webpack
|
|
111
|
-
"print-licenses": "print-licenses"
|
|
100
|
+
"dev:bmd": "webpack serve --config webpack.dev.js",
|
|
101
|
+
"dev:bootstrap": "webpack serve --config webpack.dev.js --env type=bootstrap",
|
|
102
|
+
"dev:jquery": "webpack serve --config webpack.dev.js --env type=jquery",
|
|
103
|
+
"dev:react": "webpack serve --config webpack.dev.js --env type=react",
|
|
104
|
+
"serve:samples": "webpack serve --config webpack.samples.serve.js"
|
|
112
105
|
},
|
|
113
106
|
"author": {
|
|
114
107
|
"name": "Matthias Palmér",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tocHeading": "Innehållsförteckning",
|
|
3
|
+
"introHeading": "Introduktion",
|
|
4
|
+
"nsHeading": "Namnrymder",
|
|
5
|
+
"mainAPHeading": "Primära klasser",
|
|
6
|
+
"suppAPHeading": "Stödjande klasser",
|
|
7
|
+
"vocsHeading": "Vokabulärer",
|
|
8
|
+
"apxHeadings": "Appendix",
|
|
9
|
+
"apxHeading": "Appendix ${id} - ${name}",
|
|
10
|
+
"vocabTableHeadingLabel": "Beteckning",
|
|
11
|
+
"vocabTableHeadingValue": "Värde",
|
|
12
|
+
"vocabLabel": "Beteckning",
|
|
13
|
+
"vocabLiteralValue": "Värde",
|
|
14
|
+
"vocabURIValue": "Värde",
|
|
15
|
+
"vocabDescription": "Beskrivning",
|
|
16
|
+
"vocabSeeAlso": "Se också",
|
|
17
|
+
"fieldLiteral": "Sträng",
|
|
18
|
+
"fieldLangLit": "Sträng med språk",
|
|
19
|
+
"fieldDatatype": "Datatyp (${datatype})",
|
|
20
|
+
"fieldURI": "Webbadress (URI)",
|
|
21
|
+
"fieldRef": "Entiteten beskrivs av ",
|
|
22
|
+
"fieldLabel": "Beteckning",
|
|
23
|
+
"fieldDescription": "Beskrivning",
|
|
24
|
+
"fieldProperty": "Egenskap",
|
|
25
|
+
"fieldRange": "Värdemängd",
|
|
26
|
+
"fieldLevel": "Kravnivå",
|
|
27
|
+
"unlimited": "n",
|
|
28
|
+
"fieldCardinality": "Kardinalitet",
|
|
29
|
+
"fieldTableHeaderProperty": "Property",
|
|
30
|
+
"fieldTableHeaderLevel": "Kravnivå",
|
|
31
|
+
"levelMandatory": "Obligatorisk",
|
|
32
|
+
"levelRecommended": "Rekommenderad",
|
|
33
|
+
"levelOptional": "Valfri",
|
|
34
|
+
"class": "Klass"
|
|
35
|
+
}
|
package/src/template/Item.js
CHANGED
|
@@ -185,6 +185,24 @@ export default class Item {
|
|
|
185
185
|
getSpecificationMap(original) { return this.getSource(original).specification; }
|
|
186
186
|
setSpecificationMap(map) { this._setTextMap('specification', map); }
|
|
187
187
|
|
|
188
|
+
getText(attr, returnDetails, original) {
|
|
189
|
+
const s = this.getSource(original);
|
|
190
|
+
const t = s.text || {};
|
|
191
|
+
return returnDetails ? utils.getLocalizedValue(t[attr]) : utils.getLocalizedValue(t[attr]).value;
|
|
192
|
+
}
|
|
193
|
+
setText(attr, value, lang) {
|
|
194
|
+
const s = this.getSource(true);
|
|
195
|
+
const t = s.text = s.text || {};
|
|
196
|
+
t[attr] = this._setLangHash(t[attr], value, lang);
|
|
197
|
+
this.refreshExtends();
|
|
198
|
+
}
|
|
199
|
+
setTextMap(attr, map) {
|
|
200
|
+
const s = this.getSource(true);
|
|
201
|
+
const t = s.text = s.text || {};
|
|
202
|
+
setObjAttr(t, attr, map);
|
|
203
|
+
this.refreshExtends();
|
|
204
|
+
}
|
|
205
|
+
|
|
188
206
|
/**
|
|
189
207
|
* @return {String|null} as a URI, may be null for Groups, never null for Text or choice
|
|
190
208
|
* item types.
|
|
@@ -16,7 +16,11 @@ export default class ItemStore {
|
|
|
16
16
|
*/
|
|
17
17
|
constructor(ontologyStore) {
|
|
18
18
|
this.automaticSortAllowed = true;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Value may be console methods or 'throw'.
|
|
21
|
+
* @type {string}
|
|
22
|
+
*/
|
|
23
|
+
this.handleErrorAs = 'throw';
|
|
20
24
|
|
|
21
25
|
//= =================================================;
|
|
22
26
|
// Private Attribute;
|
|
@@ -63,10 +67,12 @@ export default class ItemStore {
|
|
|
63
67
|
|
|
64
68
|
renameItem(from, to) {
|
|
65
69
|
if (this._registry[to]) {
|
|
66
|
-
|
|
70
|
+
this._handleError(`Cannot rename to ${to} since an item with that id already exists.`);
|
|
71
|
+
return;
|
|
67
72
|
}
|
|
68
73
|
if (to === '' || to === null) {
|
|
69
|
-
|
|
74
|
+
this._handleError('Cannot give an item an empty string or null as id.');
|
|
75
|
+
return;
|
|
70
76
|
}
|
|
71
77
|
const item = this._registry[from];
|
|
72
78
|
if (item) {
|
|
@@ -180,8 +186,8 @@ export default class ItemStore {
|
|
|
180
186
|
if (source.extends) {
|
|
181
187
|
// Explicit extends given
|
|
182
188
|
const extItem = this._registry[source.extends];
|
|
183
|
-
if (extItem == null
|
|
184
|
-
|
|
189
|
+
if (extItem == null) {
|
|
190
|
+
this._handleError(`Cannot find item to extend with id: ${source.extends}`);
|
|
185
191
|
}
|
|
186
192
|
if (extItem) {
|
|
187
193
|
const newSource = this.createExtendedSource(extItem.getSource(), source);
|
|
@@ -234,10 +240,12 @@ export default class ItemStore {
|
|
|
234
240
|
}
|
|
235
241
|
// No type means it is a reference, check that the referred item (via id) exists
|
|
236
242
|
if (id == null) {
|
|
237
|
-
|
|
243
|
+
this._handleError('Cannot create subitem, `type` for creating new or `id` for referencing external are required.');
|
|
244
|
+
return;
|
|
238
245
|
}
|
|
239
246
|
if (this._registry[id] == null) {
|
|
240
|
-
|
|
247
|
+
this._handleError(`Cannot find referenced subitem using identifier: ${id}`);
|
|
248
|
+
return;
|
|
241
249
|
}
|
|
242
250
|
|
|
243
251
|
// Clone if forceClone set to true or if the source contains non-id properties.
|
|
@@ -274,6 +282,13 @@ export default class ItemStore {
|
|
|
274
282
|
// If child is not a object but a direct string reference,
|
|
275
283
|
const childToUse = typeof child === 'string' ? sourceArray[index] = { id: child } : child;
|
|
276
284
|
return this.createItem(childToUse, forceClone, false, bundle);
|
|
277
|
-
});
|
|
285
|
+
}).filter(item => item);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
_handleError(message) {
|
|
289
|
+
if (this.handleErrorAs === 'throw') {
|
|
290
|
+
throw new Error(message);
|
|
291
|
+
}
|
|
292
|
+
console[this.handleErrorAs](message);
|
|
278
293
|
}
|
|
279
294
|
}
|
|
@@ -57,17 +57,17 @@ presenters.itemtype('choice').register(choicify(
|
|
|
57
57
|
} else {
|
|
58
58
|
system.attachLinkBehaviour($el[0], binding);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
60
|
+
}
|
|
61
|
+
if (choice.load != null) {
|
|
62
|
+
choice.load(() => {
|
|
63
|
+
const locValue2 = utils.getLocalizedValue(choice.label);
|
|
64
|
+
$el.text(locValue2.value);
|
|
65
|
+
if (locValue2.lang) {
|
|
66
|
+
$el.attr('lang', locValue2.lang);
|
|
67
|
+
} else {
|
|
68
|
+
$el.attr('lang', undefined);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
71
|
}
|
|
72
72
|
if (locValue.lang) {
|
|
73
73
|
$el.attr('lang', locValue.lang);
|
package/src/view/react/choice.js
CHANGED
|
@@ -49,10 +49,18 @@ presenters.itemtype('choice').register(choicify(
|
|
|
49
49
|
const item = binding.getItem();
|
|
50
50
|
const title = desc || choice.seeAlso || choice.value;
|
|
51
51
|
if ((item.hasStaticChoices() && !item.hasStyle('externalLink')) || item.hasStyle('noLink')) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
fieldDiv.appendChild(React.createElement(() => {
|
|
53
|
+
const [locValue, setLocValue] = useState(getLocalizedLabel(choice, isEditor));
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (choice.load != null) {
|
|
56
|
+
choice.load(() => {
|
|
57
|
+
setLocValue(getLocalizedLabel(choice, isEditor));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
const langAttr = locValue.lang ? {lang: locValue.lang} : {};
|
|
62
|
+
return <div key={binding.getHash()} {...langAttr} title={title}>{locValue.value}</div>
|
|
63
|
+
}));
|
|
56
64
|
} else {
|
|
57
65
|
let attrs;
|
|
58
66
|
if (item.hasStyle('externalLink')) {
|
package/src/view/viewUtils.js
CHANGED
|
@@ -6,7 +6,7 @@ export const fromDuration = (value) => {
|
|
|
6
6
|
const days = f(value.match(/([0-9])*D/));
|
|
7
7
|
const hours = f(value.match(/([0-9])*H/));
|
|
8
8
|
let months;
|
|
9
|
-
let minutes;
|
|
9
|
+
let minutes = 0;
|
|
10
10
|
if (value.indexOf('T') === -1) {
|
|
11
11
|
months = f(value.match(/([0-9])*M/));
|
|
12
12
|
} else {
|