@entryscape/rdforms 10.15.1 → 10.17.0
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/README.md +35 -31
- package/dist/rdforms.bootstrap.js +1 -1
- package/dist/rdforms.bootstrap.js.LICENSE.txt +0 -35
- package/dist/rdforms.jquery.js +1 -1
- package/dist/rdforms.jquery.js.LICENSE.txt +0 -35
- package/dist/rdforms.node.js +44 -43
- package/dist/rdforms.react.js +17 -17
- package/dist/rdforms.react.js.LICENSE.txt +0 -35
- package/package.json +18 -27
- package/src/template/Item.js +3 -1
- package/src/template/ItemStore.js +2 -2
- package/src/template/OntologyStore.js +1 -1
- package/src/utils.js +1 -1
- package/src/view/Editor.js +1 -1
- package/src/view/Presenter.js +2 -1
- package/src/view/ValidationPresenter.js +1 -1
- package/src/view/View.js +5 -1
- package/src/view/bootstrap/choice.js +2 -2
- package/src/view/bootstrap/labels.js +6 -0
- package/src/view/jquery/labels.js +2 -1
- package/src/view/jquery/text.js +1 -1
- package/src/view/react/labels.js +66 -82
- package/src/view/react/style.css +11 -1
- package/src/view/renderingContext.js +3 -1
- package/src/view/resources/rdforms.css +1 -2
- package/dist/rdforms.bmd.js +0 -2
- package/dist/rdforms.bmd.js.LICENSE.txt +0 -81
- package/renderers/bmd.js +0 -9
- package/src/view/bmd/DateTimeMD.js +0 -120
- package/src/view/bmd/Selectize.css +0 -163
- package/src/view/bmd/Selectize.js +0 -69
- package/src/view/bmd/all.js +0 -27
- package/src/view/bmd/style.css +0 -150
|
@@ -5,19 +5,8 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
/*!
|
|
9
|
-
* The buffer module from node.js, for the browser.
|
|
10
|
-
*
|
|
11
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
-
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
16
|
-
|
|
17
8
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
18
9
|
|
|
19
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
20
|
-
|
|
21
10
|
/**
|
|
22
11
|
* @license React
|
|
23
12
|
* react-dom.production.min.js
|
|
@@ -68,30 +57,6 @@
|
|
|
68
57
|
* LICENSE file in the root directory of this source tree.
|
|
69
58
|
*/
|
|
70
59
|
|
|
71
|
-
/**
|
|
72
|
-
* Character class utilities for XML NS 1.0 edition 3.
|
|
73
|
-
*
|
|
74
|
-
* @author Louis-Dominique Dubeau
|
|
75
|
-
* @license MIT
|
|
76
|
-
* @copyright Louis-Dominique Dubeau
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Character classes and associated utilities for the 2nd edition of XML 1.1.
|
|
81
|
-
*
|
|
82
|
-
* @author Louis-Dominique Dubeau
|
|
83
|
-
* @license MIT
|
|
84
|
-
* @copyright Louis-Dominique Dubeau
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
89
|
-
*
|
|
90
|
-
* @author Louis-Dominique Dubeau
|
|
91
|
-
* @license MIT
|
|
92
|
-
* @copyright Louis-Dominique Dubeau
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
60
|
/** @license React v16.13.1
|
|
96
61
|
* react-is.production.min.js
|
|
97
62
|
*
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"application profile",
|
|
9
9
|
"linked data"
|
|
10
10
|
],
|
|
11
|
-
"version": "10.
|
|
11
|
+
"version": "10.17.0",
|
|
12
12
|
"main": "dist/rdforms.node.js",
|
|
13
13
|
"browser": "dist/rdforms.react.js",
|
|
14
14
|
"module": "main.js",
|
|
@@ -23,21 +23,20 @@
|
|
|
23
23
|
"@emotion/styled": "^11.14.1",
|
|
24
24
|
"@entryscape/rdfjson": "2.7.7",
|
|
25
25
|
"@fortawesome/fontawesome-free": "^5.15.4",
|
|
26
|
-
"@mui/icons-material": "^7.3.
|
|
27
|
-
"@mui/material": "^7.3.
|
|
26
|
+
"@mui/icons-material": "^7.3.11",
|
|
27
|
+
"@mui/material": "^7.3.11",
|
|
28
28
|
"@mui/x-date-pickers": "^5.0.20",
|
|
29
|
-
"
|
|
30
|
-
"arrive": "^2.5.2",
|
|
29
|
+
"arrive": "^2.5.3",
|
|
31
30
|
"bootstrap": "^4.6.2",
|
|
32
31
|
"bootstrap-datepicker": "^1.10.1",
|
|
33
32
|
"bootstrap-material-datetimepicker": "bitbucket:metasolutions/bootstrap-material-datetimepicker#webpack",
|
|
34
33
|
"bootstrap-material-design": "^4.1.3",
|
|
35
34
|
"circular-dependency-plugin": "^5.2.2",
|
|
36
|
-
"core-js": "^3.
|
|
35
|
+
"core-js": "^3.49.0",
|
|
37
36
|
"ifdef-loader": "^2.3.2",
|
|
38
37
|
"jquery": "^3.7.1",
|
|
39
38
|
"jquery-mousewheel": "^3.2.2",
|
|
40
|
-
"lodash": "^4.
|
|
39
|
+
"lodash-es": "^4.18.1",
|
|
41
40
|
"moment": "^2.30.1",
|
|
42
41
|
"nls-loader": "bitbucket:metasolutions/nls-loader#master",
|
|
43
42
|
"node-fetch": "^2.7.0",
|
|
@@ -47,23 +46,21 @@
|
|
|
47
46
|
"react-hooks-lib": "^0.1.5",
|
|
48
47
|
"regenerator-runtime": "^0.13.11",
|
|
49
48
|
"select2": "4.0.8",
|
|
50
|
-
"selectize-bootstrap4-theme": "^2.0.2",
|
|
51
49
|
"sizzle": "^2.3.10",
|
|
52
|
-
"terser-webpack-plugin": "^5.
|
|
50
|
+
"terser-webpack-plugin": "^5.6.0",
|
|
53
51
|
"whatwg-fetch": "^3.6.20"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
|
-
"@babel/cli": "^7.28.
|
|
57
|
-
"@babel/core": "^7.
|
|
54
|
+
"@babel/cli": "^7.28.6",
|
|
55
|
+
"@babel/core": "^7.29.0",
|
|
58
56
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
59
57
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
60
|
-
"@babel/plugin-transform-class-properties": "^7.
|
|
61
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
62
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
64
|
-
"@babel/preset-react": "^7.
|
|
58
|
+
"@babel/plugin-transform-class-properties": "^7.28.6",
|
|
59
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
60
|
+
"@babel/plugin-transform-react-jsx": "^7.28.6",
|
|
61
|
+
"@babel/preset-env": "^7.29.5",
|
|
62
|
+
"@babel/preset-react": "^7.28.5",
|
|
65
63
|
"babel-loader": "^8.4.1",
|
|
66
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
67
64
|
"babel-plugin-transform-react-jsx": "^6.24.1",
|
|
68
65
|
"copy-webpack-plugin": "^9.1.0",
|
|
69
66
|
"css-loader": "^6.11.0",
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
"eslint-plugin-import": "^2.32.0",
|
|
73
70
|
"eslint-plugin-requirejs": "^3.2.0",
|
|
74
71
|
"html-loader": "^3.1.2",
|
|
75
|
-
"html-webpack-plugin": "^5.6.
|
|
72
|
+
"html-webpack-plugin": "^5.6.7",
|
|
76
73
|
"html-webpack-tags-plugin": "^3.0.2",
|
|
77
74
|
"imports-loader": "^0.8.0",
|
|
78
75
|
"mini-css-extract-plugin": "^0.4.5",
|
|
@@ -82,9 +79,9 @@
|
|
|
82
79
|
"style-loader": "^3.3.4",
|
|
83
80
|
"svg-inline-loader": "^0.8.2",
|
|
84
81
|
"ttf-loader": "^1.0.2",
|
|
85
|
-
"webpack": "^5.
|
|
82
|
+
"webpack": "^5.107.1",
|
|
86
83
|
"webpack-cli": "^5.1.4",
|
|
87
|
-
"webpack-dev-server": "^5.2.
|
|
84
|
+
"webpack-dev-server": "^5.2.4",
|
|
88
85
|
"webpack-merge": "^5.10.0",
|
|
89
86
|
"webpack-node-externals": "^3.0.0"
|
|
90
87
|
},
|
|
@@ -94,17 +91,11 @@
|
|
|
94
91
|
"main*",
|
|
95
92
|
"renderers"
|
|
96
93
|
],
|
|
97
|
-
"pnpm": {
|
|
98
|
-
"overrides": {
|
|
99
|
-
"minimist": "0.2.4"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
94
|
"scripts": {
|
|
103
95
|
"build:all": "webpack --mode=production --config webpack.all.js",
|
|
104
96
|
"build:node": "webpack --config webpack.node.js",
|
|
105
97
|
"build:node:dev": "webpack --mode=development --config webpack.node.js",
|
|
106
98
|
"build:samples": "webpack --config webpack.samples.js",
|
|
107
|
-
"dev:bmd": "webpack serve --config webpack.dev.js",
|
|
108
99
|
"dev:bootstrap": "webpack serve --config webpack.dev.js --env type=bootstrap",
|
|
109
100
|
"dev:jquery": "webpack serve --config webpack.dev.js --env type=jquery",
|
|
110
101
|
"dev:react": "webpack serve --config webpack.dev.js --env type=react",
|
|
@@ -122,5 +113,5 @@
|
|
|
122
113
|
"url": "http://valentinohudhra.com/"
|
|
123
114
|
}
|
|
124
115
|
],
|
|
125
|
-
"packageManager": "pnpm@10.
|
|
116
|
+
"packageManager": "pnpm@10.21.0+sha512.da3337267e400fdd3d479a6c68079ac6db01d8ca4f67572083e722775a796788a7a9956613749e000fac20d424b594f7a791a5f4e2e13581c5ef947f26968a40"
|
|
126
117
|
}
|
package/src/template/Item.js
CHANGED
|
@@ -24,6 +24,8 @@ export default class Item {
|
|
|
24
24
|
this._styles = [
|
|
25
25
|
'heading',
|
|
26
26
|
'invisible',
|
|
27
|
+
'invisibleInPresent',
|
|
28
|
+
'invisibleInEdit',
|
|
27
29
|
'invisibleGroup',
|
|
28
30
|
'stars',
|
|
29
31
|
'commentOn',
|
|
@@ -284,7 +286,7 @@ export default class Item {
|
|
|
284
286
|
|
|
285
287
|
/**
|
|
286
288
|
* @return {Object} never available for Text item type.
|
|
287
|
-
* The property value pairs corresponds to predicate and objects in required
|
|
289
|
+
* The property value pairs corresponds to predicate and objects in required triples.
|
|
288
290
|
*/
|
|
289
291
|
getConstraints(original) {
|
|
290
292
|
const constr = this.getSource(original).constraints;
|
|
@@ -13,7 +13,7 @@ const deepMerge = (source1, source2) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (Array.isArray(source1) && Array.isArray(source2)) {
|
|
16
|
-
return [].concat(
|
|
16
|
+
return [].concat(source1, source2);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (typeof source1 === 'object' && typeof source2 === 'object') {
|
|
@@ -111,7 +111,7 @@ export default class ItemStore {
|
|
|
111
111
|
const child = children[j];
|
|
112
112
|
if (child.id === from || child['@id'] === from) {
|
|
113
113
|
child.id = to;
|
|
114
|
-
delete child['@id']; // Clean up backward
|
|
114
|
+
delete child['@id']; // Clean up backward compatibility.
|
|
115
115
|
}
|
|
116
116
|
if (child.content) {
|
|
117
117
|
renameInGroup(child);
|
package/src/utils.js
CHANGED
package/src/view/Editor.js
CHANGED
|
@@ -7,7 +7,7 @@ import { bindingReport } from '../model/validate';
|
|
|
7
7
|
const showNow = (editor, item, bindings, includeLevel) => {
|
|
8
8
|
// Invisible should be created as components and hidden using display: none
|
|
9
9
|
// Otherwise certain extentions such as autoUUID does not work.
|
|
10
|
-
/* if (item.hasStyle('invisible')) {
|
|
10
|
+
/* if (item.hasStyle('invisible') || item.hasStyle('invisibleInEdit')) {
|
|
11
11
|
return false;
|
|
12
12
|
} */
|
|
13
13
|
if (item.hasStyle('presenterOnly')) {
|
package/src/view/Presenter.js
CHANGED
|
@@ -6,7 +6,8 @@ import View from './View';
|
|
|
6
6
|
const showNow = (editor, item, bindings) => {
|
|
7
7
|
if (bindings.length === 0 ||
|
|
8
8
|
// item.hasStyle('deprecated') ||
|
|
9
|
-
item.hasStyle('invisible')
|
|
9
|
+
item.hasStyle('invisible') ||
|
|
10
|
+
item.hasStyle('invisibleInPresent')) {
|
|
10
11
|
return false;
|
|
11
12
|
}
|
|
12
13
|
const prop = item.getProperty();
|
|
@@ -25,7 +25,7 @@ export default class ValidationPresenter extends Presenter {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
showNow(item, bindings) {
|
|
28
|
-
if (item.hasStyle('invisible')) {
|
|
28
|
+
if (item.hasStyle('invisible') || item.hasStyle('invisibleInPresent')) {
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
31
|
if (bindings.length > 0) {
|
package/src/view/View.js
CHANGED
|
@@ -28,6 +28,7 @@ export default class View {
|
|
|
28
28
|
this.styleCls = params.styleCls || '';
|
|
29
29
|
this.truncateLimit = params.truncateLimit !== undefined ? params.truncateLimit : 10;
|
|
30
30
|
this.truncate = params.truncate !== undefined ? params.truncate : false;
|
|
31
|
+
this.headingLevel = params.headingLevel || 2;
|
|
31
32
|
if (Array.isArray(params.filterPredicates)) {
|
|
32
33
|
this.filterPredicates =
|
|
33
34
|
params.filterPredicates.reduce((prev, current) => { prev[current] = true; return prev; }, {});
|
|
@@ -329,7 +330,10 @@ export default class View {
|
|
|
329
330
|
|
|
330
331
|
this._binding2node[binding.getHash()] = fieldDiv;
|
|
331
332
|
this.addComponent(fieldDiv, binding);
|
|
332
|
-
|
|
333
|
+
const isEditor = this._subEditors !== undefined;
|
|
334
|
+
if (item.hasStyle('invisible') ||
|
|
335
|
+
(item.hasStyle('invisibleInEdit') && isEditor)
|
|
336
|
+
) {
|
|
333
337
|
renderingContext.domClassToggle(newRow || lastRow, 'rdformsInvisible', true);
|
|
334
338
|
}
|
|
335
339
|
return newRow || lastRow;
|
|
@@ -60,7 +60,7 @@ editors.itemtype('choice').choices('none').register((fieldDiv, binding, context)
|
|
|
60
60
|
// reference to the wrong setValue function later on.
|
|
61
61
|
const setValue = context.setValue;
|
|
62
62
|
|
|
63
|
-
const $search = jquery(`<button ${disabledAttr} class="btn btn-primary
|
|
63
|
+
const $search = jquery(`<button ${disabledAttr} class="btn btn-primary browseChoices" type="button">`)
|
|
64
64
|
.attr('title', context.view.messages.edit_browse)
|
|
65
65
|
.appendTo(fieldDiv);
|
|
66
66
|
if (context.chooser && context.chooser.supportsInlineCreate &&
|
|
@@ -111,7 +111,7 @@ editors.itemtype('choice').choices('none').register((fieldDiv, binding, context)
|
|
|
111
111
|
c.load(() => {
|
|
112
112
|
// If the value can be upgraded into its own entity.
|
|
113
113
|
if (c.upgrade) {
|
|
114
|
-
const $button = jquery(`<button ${disabledAttr} class="btn btn-default
|
|
114
|
+
const $button = jquery(`<button ${disabledAttr} class="btn btn-default` +
|
|
115
115
|
' browseChoices" type="button">')
|
|
116
116
|
.attr('title', context.view.messages.edit_upgrade)
|
|
117
117
|
.click(() => {
|
|
@@ -116,4 +116,10 @@ renderingContext.attachItemInfo = function (item, aroundNode, context) {
|
|
|
116
116
|
}</div>${propinfo}`,
|
|
117
117
|
};
|
|
118
118
|
jquery(aroundNode).popover(popoverOptions).attr('data-toggle', 'popover');
|
|
119
|
+
jquery(aroundNode).on('keydown', (e) => {
|
|
120
|
+
if (e.key === 'Escape' && aroundNode.getAttribute('aria-describedby')) {
|
|
121
|
+
jquery(aroundNode).popover('hide');
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
119
125
|
};
|
|
@@ -12,8 +12,9 @@ renderingContext.renderPresenterLabel = (rowNode, binding, item, context, labelR
|
|
|
12
12
|
label = '';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const headingElement = `h${context.view.headingLevel}`;
|
|
15
16
|
const $labelDiv = item.hasStyle('heading') ?
|
|
16
|
-
jquery(
|
|
17
|
+
jquery(`<${headingElement} class="rdformsLabel" tabindex="0">`).text(label).appendTo(rowNode) :
|
|
17
18
|
jquery('<div class="rdformsLabel" tabindex="0">').text(label).appendTo(rowNode);
|
|
18
19
|
if (binding) {
|
|
19
20
|
$labelDiv.attr('id', context.view.createLabelIndex(binding));
|
package/src/view/jquery/text.js
CHANGED
package/src/view/react/labels.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import React, { Fragment, useState, useEffect, forwardRef } from 'react';
|
|
3
3
|
import Tooltip, { tooltipClasses } from '@mui/material/Tooltip';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
4
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
5
|
+
import IconButton from '@mui/material/IconButton';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
|
|
6
8
|
import renderingContext from '../renderingContext';
|
|
7
9
|
import utils from '../../utils';
|
|
8
10
|
import { Editor } from './Wrappers';
|
|
@@ -26,77 +28,67 @@ const StyledTooltip = styled(
|
|
|
26
28
|
},
|
|
27
29
|
}));
|
|
28
30
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
while (el) {
|
|
35
|
-
if (el.id === tooltipId) {
|
|
36
|
-
external = false;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
el = el.parentElement;
|
|
40
|
-
}
|
|
41
|
-
if (external) {
|
|
42
|
-
setOpen(false);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
window.addEventListener('focusin', focusListener);
|
|
46
|
-
return () => {
|
|
47
|
-
window.removeEventListener('focusin', focusListener);
|
|
48
|
-
};
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
return (<>
|
|
52
|
-
<p className="rdformsLinebreaks rdformsDescription">
|
|
53
|
-
{description}
|
|
54
|
-
</p>
|
|
55
|
-
{propinfo}
|
|
56
|
-
</>);
|
|
31
|
+
const getDescription = (item, view) => {
|
|
32
|
+
const descMap = view instanceof Editor
|
|
33
|
+
? item.getEditDescriptionMap() || item.getDescriptionMap()
|
|
34
|
+
: item.getDescriptionMap();
|
|
35
|
+
return utils.getLocalizedValue(descMap, view.getLocale()).value;
|
|
57
36
|
};
|
|
58
37
|
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
38
|
+
const DescriptionIcon = ({ item, context }) => {
|
|
39
|
+
const { view } = context;
|
|
40
|
+
const description = getDescription(item, view);
|
|
41
|
+
const [pinned, setPinned] = useState(false);
|
|
42
|
+
const [hovered, setHovered] = useState(false);
|
|
43
|
+
|
|
44
|
+
const property = item.getProperty();
|
|
45
|
+
const fallbackDescription = !description && !property
|
|
46
|
+
? view.messages.info_missing || ''
|
|
47
|
+
: '';
|
|
48
|
+
const shownDescription = description || fallbackDescription;
|
|
49
|
+
if (!shownDescription && !property) return null;
|
|
50
|
+
|
|
51
|
+
const propinfo = property
|
|
52
|
+
? <div className="rdformsProperty"><a target="_blank" href={property}>{property}</a></div>
|
|
53
|
+
: null;
|
|
54
|
+
|
|
55
|
+
const tooltipContent = (
|
|
56
|
+
<>
|
|
57
|
+
{shownDescription ? <p className="rdformsLinebreaks rdformsDescription">{shownDescription}</p> : null}
|
|
58
|
+
{propinfo}
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const handleClick = () => setPinned(!pinned);
|
|
64
|
+
const handleKeyDown = (e) => {
|
|
65
|
+
if (e.key !== 'Escape' || !pinned) return;
|
|
66
|
+
setPinned(false);
|
|
67
|
+
e.stopPropagation();
|
|
66
68
|
};
|
|
67
|
-
let propinfo = '';
|
|
68
|
-
const property = props.item.getProperty();
|
|
69
|
-
if (property) {
|
|
70
|
-
propinfo = <div className="rdformsProperty"><a target="_blank" href={property}>{property}</a></div>;
|
|
71
|
-
}
|
|
72
|
-
const descriptionMap = props.context.view instanceof Editor ?
|
|
73
|
-
props.item.getEditDescriptionMap() || props.item.getDescriptionMap() : props.item.getDescriptionMap()
|
|
74
|
-
|| (property ? '' : props.context.view.messages.info_missing || '');
|
|
75
|
-
const description = utils.getLocalizedValue(descriptionMap, props.context.view.getLocale()).value;
|
|
76
|
-
const tooltipId = `tt_${props.binding ? props.binding.getHash() : props.item.getHash()}`;
|
|
77
69
|
|
|
78
70
|
return (
|
|
79
|
-
<ClickAwayListener onClickAway={
|
|
80
|
-
<
|
|
71
|
+
<ClickAwayListener onClickAway={() => setPinned(false)}>
|
|
72
|
+
<span>
|
|
81
73
|
<StyledTooltip
|
|
82
|
-
title={
|
|
83
|
-
placement="
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onFocus={handleTooltipOpen}
|
|
88
|
-
onOpen={handleTooltipOpen}
|
|
89
|
-
onClose={handleTooltipClose}
|
|
90
|
-
open={open}
|
|
91
|
-
slotProps={{
|
|
92
|
-
popper: {
|
|
93
|
-
disablePortal: true
|
|
94
|
-
},
|
|
95
|
-
}}
|
|
74
|
+
title={tooltipContent}
|
|
75
|
+
placement="top-start"
|
|
76
|
+
open={pinned || hovered}
|
|
77
|
+
onOpen={() => setHovered(true)}
|
|
78
|
+
onClose={() => setHovered(false)}
|
|
96
79
|
>
|
|
97
|
-
<
|
|
80
|
+
<IconButton
|
|
81
|
+
className="rdformsDescriptionIcon"
|
|
82
|
+
size="small"
|
|
83
|
+
aria-label={view.messages.info_description}
|
|
84
|
+
onClick={handleClick}
|
|
85
|
+
onKeyDown={handleKeyDown}
|
|
86
|
+
sx={{ marginLeft: '0px !important' }}
|
|
87
|
+
>
|
|
88
|
+
<HelpOutlineIcon fontSize="inherit" />
|
|
89
|
+
</IconButton>
|
|
98
90
|
</StyledTooltip>
|
|
99
|
-
</
|
|
91
|
+
</span>
|
|
100
92
|
</ClickAwayListener>
|
|
101
93
|
);
|
|
102
94
|
};
|
|
@@ -130,17 +122,12 @@ renderingContext.renderPresenterLabel = (rowNode, binding, item, context) => {
|
|
|
130
122
|
}
|
|
131
123
|
|
|
132
124
|
const labelId = binding ? context.view.createLabelIndex(binding) : undefined;
|
|
133
|
-
const
|
|
134
|
-
const
|
|
125
|
+
const HeadingElement = `h${context.view.headingLevel}`;
|
|
126
|
+
const descriptionIcon = context.view.popupOnLabel ? <DescriptionIcon item={item} context={context} /> : null;
|
|
135
127
|
label = item.hasStyle('heading') ?
|
|
136
|
-
<
|
|
137
|
-
<span tabIndex="0" id={labelId} className="rdformsLabelRow"><span className=
|
|
138
|
-
|
|
139
|
-
rowNode.appendChild(<Fragment key={`${binding ? binding.getHash() : item.getHash()}_label` }><ItemTooltip
|
|
140
|
-
context={context} item={item} binding={binding}>{label}</ItemTooltip>{description}</Fragment>);
|
|
141
|
-
} else {
|
|
142
|
-
rowNode.appendChild(<Fragment key={`${binding ? binding.getHash() : item.getHash()}_label` }>{label}{description}</Fragment>);
|
|
143
|
-
}
|
|
128
|
+
<HeadingElement tabIndex="0" id={labelId} className="rdformsLabelRow"><span className="rdformsLabel">{label}</span>{descriptionIcon}</HeadingElement> :
|
|
129
|
+
<span tabIndex="0" id={labelId} className="rdformsLabelRow"><span className="rdformsLabel">{label}</span>{descriptionIcon}</span>;
|
|
130
|
+
rowNode.appendChild(<Fragment key={`${binding ? binding.getHash() : item.getHash()}_label` }>{label}{description}</Fragment>);
|
|
144
131
|
};
|
|
145
132
|
|
|
146
133
|
renderingContext.renderEditorLabel = (rowNode, binding, item, context) => {
|
|
@@ -154,13 +141,9 @@ renderingContext.renderEditorLabel = (rowNode, binding, item, context) => {
|
|
|
154
141
|
} else {
|
|
155
142
|
label = '';
|
|
156
143
|
}
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<span tabIndex="0" className={rdformsLabel} role={role}>{label}</span>;
|
|
161
|
-
if (context.view.popupOnLabel) {
|
|
162
|
-
label = <ItemTooltip item={item} context={context} binding={binding}>{label}</ItemTooltip>;
|
|
163
|
-
}
|
|
144
|
+
const HeadingElement = `h${context.view.headingLevel}`;
|
|
145
|
+
label = item.hasStyle('heading') ? <HeadingElement tabIndex="0" className="rdformsLabel">{label}</HeadingElement> :
|
|
146
|
+
<span tabIndex="0" className="rdformsLabel">{label}</span>;
|
|
164
147
|
|
|
165
148
|
const card = item.getCardinality();
|
|
166
149
|
const b = context.view.messages;
|
|
@@ -205,8 +188,9 @@ renderingContext.renderEditorLabel = (rowNode, binding, item, context) => {
|
|
|
205
188
|
}
|
|
206
189
|
|
|
207
190
|
const labelId = context.view.createLabelIndex(binding);
|
|
191
|
+
const descriptionIcon = context.view.popupOnLabel ? <DescriptionIcon item={item} context={context} /> : null;
|
|
208
192
|
rowNode.appendChild(<Fragment key={`${binding.getHash()}_label`}><div id={labelId} className="rdformsLabelRow">{
|
|
209
|
-
label}{mark}{Button && <Button></Button>}</div>{description}</Fragment>);
|
|
193
|
+
label}{mark}{descriptionIcon}{Button && <Button></Button>}</div>{description}</Fragment>);
|
|
210
194
|
}
|
|
211
195
|
};
|
|
212
196
|
|
package/src/view/react/style.css
CHANGED
|
@@ -14,6 +14,16 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
.rdformsLabel:hover {
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
cursor: default;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rdformsDescriptionIcon {
|
|
23
|
+
color: grey !important;
|
|
24
|
+
font-size: 16px !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
.rdformsLabelRow .MuiButtonBase-root {
|
|
18
28
|
margin-top: -4px;
|
|
19
29
|
margin-left: 7px;
|
|
@@ -244,4 +254,4 @@ div.MuiTooltip-tooltip {
|
|
|
244
254
|
|
|
245
255
|
.rdformsPresenter .rdformsInline {
|
|
246
256
|
padding-left: 0em;
|
|
247
|
-
}
|
|
257
|
+
}
|
|
@@ -234,7 +234,7 @@ const renderingContext = {
|
|
|
234
234
|
const alts = {};
|
|
235
235
|
|
|
236
236
|
// Detect the various available languages
|
|
237
|
-
// noLanguage - a binding exists with no
|
|
237
|
+
// noLanguage - a binding exists with no language set
|
|
238
238
|
// best - a binding exists with the current locale
|
|
239
239
|
// close - a binding exists with a language close to the current locale,
|
|
240
240
|
// e.g. en_US when the locale is en or the opposite
|
|
@@ -340,6 +340,7 @@ const groupPresenter = (fieldDiv, binding, context) => {
|
|
|
340
340
|
popupOnLabel: context.view.popupOnLabel,
|
|
341
341
|
truncate: context.view.truncate,
|
|
342
342
|
truncateLimit: context.view.truncateLimit,
|
|
343
|
+
headingLevel: context.view.headingLevel,
|
|
343
344
|
includeLevel: context.view.includeLevel, // Copied from groupEditor, was this.includeLevel but that 'this' does not make sense here
|
|
344
345
|
}, fieldDiv);
|
|
345
346
|
};
|
|
@@ -361,6 +362,7 @@ const groupEditor = (fieldDiv, binding, context) => {
|
|
|
361
362
|
showDescription: context.view.showDescription,
|
|
362
363
|
truncate: context.view.truncate,
|
|
363
364
|
truncateLimit: context.view.truncateLimit,
|
|
365
|
+
headingLevel: context.view.headingLevel,
|
|
364
366
|
includeLevel: context.view.includeLevel,
|
|
365
367
|
}, fieldDiv);
|
|
366
368
|
context.view._subEditors.push(subView);
|