@entryscape/rdforms 10.6.0 → 10.7.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/dist/rdforms.bmd.js +7 -5
- package/dist/rdforms.bootstrap.js +17 -15
- package/dist/rdforms.jquery.js +6 -4
- package/dist/rdforms.node.js +273 -3
- package/dist/rdforms.react.js +78 -76
- package/package.json +4 -2
- package/src/model/CODES.js +17 -0
- package/src/model/CardinalityTracker.js +2 -1
- package/src/model/ChoiceBinding.js +1 -1
- package/src/model/engine.js +1 -19
- package/src/model/validate.js +21 -20
- package/src/template/Item.js +2 -1
- package/src/view/Editor.js +4 -3
- package/src/view/Presenter.js +32 -3
- package/src/view/Registry.js +1 -1
- package/src/view/ValidationPresenter.js +3 -2
- package/src/view/View.js +52 -10
- package/src/view/bmd/DateTimeMD.js +12 -14
- package/src/view/bmd/Selectize.js +5 -4
- package/src/view/bmd/style.css +9 -1
- package/src/view/bootstrap/DateTimeBootstrapDatepicker.js +6 -4
- package/src/view/bootstrap/RadioButtonsEditor.js +5 -2
- package/src/view/bootstrap/Select2.js +8 -5
- package/src/view/bootstrap/buttons.js +9 -5
- package/src/view/bootstrap/choice.js +6 -4
- package/src/view/bootstrap/durationEditor.js +3 -2
- package/src/view/bootstrap/labels.js +26 -15
- package/src/view/bootstrap/style.css +9 -3
- package/src/view/bootstrap/text.js +7 -4
- package/src/view/jquery/labels.js +15 -0
- package/src/view/jquery/text.js +3 -3
- package/src/view/react/buttons.js +3 -0
- package/src/view/react/choiceEditors/CheckBoxesEditor.js +8 -3
- package/src/view/react/choiceEditors/ChoiceLookup.js +4 -2
- package/src/view/react/choiceEditors/ChoiceLookupAndInlineSearch.js +25 -16
- package/src/view/react/choiceEditors/ChoiceSelector.js +7 -4
- package/src/view/react/choiceEditors/RadioButtonsEditor.js +8 -4
- package/src/view/react/choiceEditors/ShowButton.js +1 -0
- package/src/view/react/date.js +7 -5
- package/src/view/react/duration.js +4 -2
- package/src/view/react/hooks.js +3 -0
- package/src/view/react/labels.js +41 -5
- package/src/view/react/style.css +6 -6
- package/src/view/react/text.js +2 -2
- package/src/view/react/textEditors.js +5 -0
- package/src/view/renderingContext.js +5 -0
- package/src/view/resources/rdforms.css +39 -17
- package/src/view/{jquery/util.js → viewUtils.js} +11 -0
- package/src/view/react/util.js +0 -31
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"application profile",
|
|
9
9
|
"linked data"
|
|
10
10
|
],
|
|
11
|
-
"version": "10.
|
|
11
|
+
"version": "10.7.0",
|
|
12
12
|
"main": "dist/rdforms.node.js",
|
|
13
13
|
"browser": "dist/rdforms.react.js",
|
|
14
14
|
"module": "main.js",
|
|
@@ -19,15 +19,18 @@
|
|
|
19
19
|
"@emotion/react": "^11.4.1",
|
|
20
20
|
"@emotion/styled": "^11.3.0",
|
|
21
21
|
"@entryscape/rdfjson": "^2.5.4",
|
|
22
|
+
"@fortawesome/fontawesome-free": "^5.8.1",
|
|
22
23
|
"@mui/icons-material": "^5.0.3",
|
|
23
24
|
"@mui/lab": "^5.0.0-alpha.51",
|
|
24
25
|
"@mui/material": "^5.0.3",
|
|
25
26
|
"@mui/styles": "^5.0.1",
|
|
27
|
+
"@selectize/selectize": "^0.13.5",
|
|
26
28
|
"arrive": "^2.4.1",
|
|
27
29
|
"bootstrap": "^4.3.1",
|
|
28
30
|
"bootstrap-datepicker": "^1.9.0",
|
|
29
31
|
"bootstrap-material-datetimepicker": "https://bitbucket.org/metasolutions/bootstrap-material-datetimepicker.git#webpack",
|
|
30
32
|
"bootstrap-material-design": "^4.1.1",
|
|
33
|
+
"circular-dependency-plugin": "^5.2.2",
|
|
31
34
|
"core-js": "^3.1.4",
|
|
32
35
|
"ifdef-loader": "^2.1.1",
|
|
33
36
|
"jquery": "^3.3.1",
|
|
@@ -42,7 +45,6 @@
|
|
|
42
45
|
"react-hooks-lib": "^0.1.5",
|
|
43
46
|
"regenerator-runtime": "^0.13.2",
|
|
44
47
|
"select2": "4.0.7",
|
|
45
|
-
"selectize": "^0.12.6",
|
|
46
48
|
"selectize-bootstrap4-theme": "^2.0.2",
|
|
47
49
|
"sizzle": "^2.3.3",
|
|
48
50
|
"terser-webpack-plugin": "^1.3.0",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
UNKNOWN: 'unknown', // Used as a marker initially, to not mark everything red initially
|
|
3
|
+
OK: 'correct',
|
|
4
|
+
TOO_FEW_VALUES: 'few', // deprecated
|
|
5
|
+
TOO_FEW_VALUES_MIN: 'min',
|
|
6
|
+
TOO_FEW_VALUES_PREF: 'pref',
|
|
7
|
+
TOO_MANY_VALUES: 'many',
|
|
8
|
+
AT_MOST_ONE_CHILD: 'atmostonechild',
|
|
9
|
+
AT_LEAST_ONE_CHILD: 'atleastonechild',
|
|
10
|
+
EXACTLY_ONE_CHILD: 'exactlyonechild',
|
|
11
|
+
WRONG_VALUE: 'value',
|
|
12
|
+
WRONG_PATTERN: 'pattern',
|
|
13
|
+
WRONG_NODETYPE: 'nodetype',
|
|
14
|
+
WRONG_DATATYPE: 'datatype',
|
|
15
|
+
MISSING_LANGUAGE: 'language',
|
|
16
|
+
MISSING_CONSTRAINTS: 'constraints',
|
|
17
|
+
};
|
package/src/model/engine.js
CHANGED
|
@@ -11,6 +11,7 @@ import ValueBinding from './ValueBinding';
|
|
|
11
11
|
import ChoiceBinding from './ChoiceBinding';
|
|
12
12
|
import GroupURIBinding from './GroupURIBinding';
|
|
13
13
|
import utils from '../utils';
|
|
14
|
+
import CODES from './CODES';
|
|
14
15
|
|
|
15
16
|
// See public API at the bottom of this file.
|
|
16
17
|
|
|
@@ -871,27 +872,8 @@ export { levelProfile };
|
|
|
871
872
|
*/
|
|
872
873
|
export { detectLevel };
|
|
873
874
|
|
|
874
|
-
const CODES = {
|
|
875
|
-
UNKNOWN: 'unknown', // Used as a marker initially, to not mark everything red initially
|
|
876
|
-
OK: 'correct',
|
|
877
|
-
TOO_FEW_VALUES: 'few', // deprecated
|
|
878
|
-
TOO_FEW_VALUES_MIN: 'min',
|
|
879
|
-
TOO_FEW_VALUES_PREF: 'pref',
|
|
880
|
-
TOO_MANY_VALUES: 'many',
|
|
881
|
-
AT_MOST_ONE_CHILD: 'atmostonechild',
|
|
882
|
-
AT_LEAST_ONE_CHILD: 'atleastonechild',
|
|
883
|
-
EXACTLY_ONE_CHILD: 'exactlyonechild',
|
|
884
|
-
WRONG_VALUE: 'value',
|
|
885
|
-
WRONG_PATTERN: 'pattern',
|
|
886
|
-
WRONG_NODETYPE: 'nodetype',
|
|
887
|
-
WRONG_DATATYPE: 'datatype',
|
|
888
|
-
MISSING_LANGUAGE: 'language',
|
|
889
|
-
MISSING_CONSTRAINTS: 'constraints',
|
|
890
|
-
};
|
|
891
|
-
|
|
892
875
|
export { CODES };
|
|
893
876
|
|
|
894
|
-
|
|
895
877
|
export default { // TODO @valentino anti-pattern. This is done because engine is used in EntryScape. It shouldn't really...
|
|
896
878
|
detectLevel,
|
|
897
879
|
levelProfile,
|
package/src/model/validate.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { namespaces as ns } from '@entryscape/rdfjson';
|
|
2
|
-
import
|
|
2
|
+
import { fuzzyMatch, findBindingRelativeToParentBinding, matchPathBelowBinding } from './engine';
|
|
3
|
+
import CODES from './CODES';
|
|
3
4
|
|
|
4
5
|
const _clearMatchingCodes = (binding) => {
|
|
5
|
-
binding.setMatchingCode(
|
|
6
|
+
binding.setMatchingCode(CODES.OK);
|
|
6
7
|
if (binding.getItem().getType() === 'group') {
|
|
7
8
|
binding.getChildBindings().forEach(childBinding => _clearMatchingCodes(childBinding));
|
|
8
9
|
}
|
|
@@ -66,8 +67,8 @@ const doNotProceedFurther = (groupBinding, childItem) => {
|
|
|
66
67
|
// Don't check further if the binding is hidden due to missing dependencies
|
|
67
68
|
const childPath = childItem.getDeps();
|
|
68
69
|
if (childPath) {
|
|
69
|
-
const fromBinding =
|
|
70
|
-
if (!
|
|
70
|
+
const fromBinding = findBindingRelativeToParentBinding(groupBinding, childPath);
|
|
71
|
+
if (!matchPathBelowBinding(fromBinding, childPath)) {
|
|
71
72
|
return true;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -75,7 +76,7 @@ const doNotProceedFurther = (groupBinding, childItem) => {
|
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
const _createReport = (groupbinding, report, firstLevel) => {
|
|
78
|
-
if (groupbinding.getMatchingCode() !==
|
|
79
|
+
if (groupbinding.getMatchingCode() !== CODES.OK) {
|
|
79
80
|
return undefined;
|
|
80
81
|
}
|
|
81
82
|
const groupitem = groupbinding.getItem();
|
|
@@ -84,8 +85,8 @@ const _createReport = (groupbinding, report, firstLevel) => {
|
|
|
84
85
|
// Check disabled since it is done for each child before recursive call
|
|
85
86
|
/* const path = groupitem.getDeps();
|
|
86
87
|
if (path && groupbinding.getParent() != null) {
|
|
87
|
-
const fromBinding =
|
|
88
|
-
if (!
|
|
88
|
+
const fromBinding = findBindingRelativeToParentBinding(groupbinding.getParent(), path);
|
|
89
|
+
if (!matchPathBelowBinding(fromBinding, path)) {
|
|
89
90
|
return undefined;
|
|
90
91
|
}
|
|
91
92
|
} */
|
|
@@ -101,11 +102,11 @@ const _createReport = (groupbinding, report, firstLevel) => {
|
|
|
101
102
|
const nrOfValid = _countValidBindings(bindings);
|
|
102
103
|
let code;
|
|
103
104
|
if (nrOfValid > 1 && (groupitem.hasStyle('disjoint') || groupitem.hasStyle('atMostOneChild'))) {
|
|
104
|
-
code =
|
|
105
|
+
code = CODES.AT_MOST_ONE_CHILD;
|
|
105
106
|
} else if (nrOfValid !== 1 && groupitem.hasStyle('exactlyOneChild')) {
|
|
106
|
-
code =
|
|
107
|
+
code = CODES.EXACTLY_ONE_CHILD;
|
|
107
108
|
} else if (nrOfValid === 0 && groupitem.hasStyle('atLeastOneChild')) {
|
|
108
|
-
code =
|
|
109
|
+
code = CODES.AT_LEAST_ONE_CHILD;
|
|
109
110
|
}
|
|
110
111
|
if (code) {
|
|
111
112
|
updateViaCardinalityTracker([groupbinding], code);
|
|
@@ -129,15 +130,15 @@ const _createReport = (groupbinding, report, firstLevel) => {
|
|
|
129
130
|
report.errors.push({
|
|
130
131
|
parentBinding: groupbinding,
|
|
131
132
|
item: childItem,
|
|
132
|
-
code:
|
|
133
|
+
code: CODES.TOO_FEW_VALUES_MIN,
|
|
133
134
|
});
|
|
134
|
-
updateViaCardinalityTracker(bindings,
|
|
135
|
+
updateViaCardinalityTracker(bindings, CODES.TOO_FEW_VALUES_MIN);
|
|
135
136
|
/* let counter = 0;
|
|
136
137
|
bindings.forEach((binding) => {
|
|
137
138
|
if (!binding.isValid()) {
|
|
138
139
|
if (counter < card.min) {
|
|
139
140
|
counter += 1;
|
|
140
|
-
binding.setMatchingCode(
|
|
141
|
+
binding.setMatchingCode(CODES.TOO_FEW_VALUES_MIN);
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}); */
|
|
@@ -145,23 +146,23 @@ const _createReport = (groupbinding, report, firstLevel) => {
|
|
|
145
146
|
report.warnings.push({
|
|
146
147
|
parentBinding: groupbinding,
|
|
147
148
|
item: childItem,
|
|
148
|
-
code:
|
|
149
|
+
code: CODES.TOO_FEW_VALUES_PREF,
|
|
149
150
|
});
|
|
150
|
-
// updateViaCardinalityTracker(bindings,
|
|
151
|
+
// updateViaCardinalityTracker(bindings, CODES.TOO_FEW_VALUES_PREF);
|
|
151
152
|
}
|
|
152
153
|
if (card.max != null && card.max < nrOfValid) {
|
|
153
154
|
report.errors.push({
|
|
154
155
|
parentBinding: groupbinding,
|
|
155
156
|
item: childItem,
|
|
156
|
-
code:
|
|
157
|
+
code: CODES.TOO_MANY_VALUES,
|
|
157
158
|
});
|
|
158
|
-
updateViaCardinalityTracker(bindings,
|
|
159
|
+
updateViaCardinalityTracker(bindings, CODES.TOO_MANY_VALUES);
|
|
159
160
|
/* let counter = 0;
|
|
160
161
|
bindings.forEach((binding) => {
|
|
161
162
|
if (binding.isValid()) {
|
|
162
163
|
counter += 1;
|
|
163
164
|
if (counter > card.max) {
|
|
164
|
-
binding.setMatchingCode(
|
|
165
|
+
binding.setMatchingCode(CODES.TOO_MANY_VALUES);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}); */
|
|
@@ -172,7 +173,7 @@ const _createReport = (groupbinding, report, firstLevel) => {
|
|
|
172
173
|
|
|
173
174
|
groupbinding.getChildBindings().forEach((binding) => {
|
|
174
175
|
const item = binding.getItem();
|
|
175
|
-
if (binding.getMatchingCode() !==
|
|
176
|
+
if (binding.getMatchingCode() !== CODES.OK) {
|
|
176
177
|
report.errors.push({
|
|
177
178
|
parentBinding: binding,
|
|
178
179
|
item,
|
|
@@ -330,7 +331,7 @@ const _simplifyReport = (report) => {
|
|
|
330
331
|
};
|
|
331
332
|
|
|
332
333
|
const _resourceReport = (resource, graph, template, ignoreResources) => {
|
|
333
|
-
const binding =
|
|
334
|
+
const binding = fuzzyMatch(graph, resource, template);
|
|
334
335
|
const report = bindingReport(binding);
|
|
335
336
|
_filterReport(report, resource, ignoreResources || {});
|
|
336
337
|
_simplifyReport(report);
|
package/src/template/Item.js
CHANGED
|
@@ -54,7 +54,6 @@ export default class Item {
|
|
|
54
54
|
'atLeastOneChild',
|
|
55
55
|
'atMostOneChild',
|
|
56
56
|
'exactlyOneChild',
|
|
57
|
-
'deprecated',
|
|
58
57
|
'noLabelInPresent',
|
|
59
58
|
'autoInitDate',
|
|
60
59
|
'autoUpdateDate',
|
|
@@ -63,6 +62,8 @@ export default class Item {
|
|
|
63
62
|
'showURI',
|
|
64
63
|
'showLink',
|
|
65
64
|
'showValue',
|
|
65
|
+
'showDescriptionInPresent',
|
|
66
|
+
'showDescriptionInEdit',
|
|
66
67
|
'textAsChoice',
|
|
67
68
|
'preserveOrderOfChoices',
|
|
68
69
|
'linkWithLabel',
|
package/src/view/Editor.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import renderingContext from './renderingContext';
|
|
2
2
|
import Presenter from './Presenter';
|
|
3
|
+
import CODES from '../model/CODES';
|
|
3
4
|
import * as engine from '../model/engine';
|
|
4
5
|
import { bindingReport } from '../model/validate';
|
|
5
6
|
|
|
@@ -74,7 +75,7 @@ export default class Editor extends Presenter {
|
|
|
74
75
|
for (let j = 0; j < _report.errors.length; j++) {
|
|
75
76
|
const err = _report.errors[j];
|
|
76
77
|
if (err.parentBinding === this.binding) {
|
|
77
|
-
if (err.code ===
|
|
78
|
+
if (err.code === CODES.TOO_FEW_VALUES_MIN) {
|
|
78
79
|
const item = err.item;
|
|
79
80
|
let counter = item.getCardinality().min;
|
|
80
81
|
|
|
@@ -86,9 +87,9 @@ export default class Editor extends Presenter {
|
|
|
86
87
|
}
|
|
87
88
|
return counter === 0;
|
|
88
89
|
});
|
|
89
|
-
} else if (err.code ===
|
|
90
|
+
} else if (err.code === CODES.AT_MOST_ONE_CHILD) {
|
|
90
91
|
this.binding.getChildBindings().forEach((binding) => {
|
|
91
|
-
if (binding.getMatchingCode() !==
|
|
92
|
+
if (binding.getMatchingCode() !== CODES.OK) {
|
|
92
93
|
renderingContext.domClassToggle(this._binding2node[binding.getHash()],
|
|
93
94
|
'errorReport', true);
|
|
94
95
|
}
|
package/src/view/Presenter.js
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import moment from 'moment';
|
|
2
3
|
import renderingContext from './renderingContext';
|
|
3
4
|
import View from './View';
|
|
4
5
|
|
|
6
|
+
|
|
7
|
+
const showNow = (editor, item, bindings) => {
|
|
8
|
+
if (bindings.length === 0 ||
|
|
9
|
+
// item.hasStyle('deprecated') ||
|
|
10
|
+
item.hasStyle('invisible')) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const prop = item.getProperty();
|
|
14
|
+
if (prop) {
|
|
15
|
+
return !editor.filterItem(item);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Take care of layout grouping by checking recursively.
|
|
19
|
+
if (item.getType() === 'group') {
|
|
20
|
+
const groupedItemsArr = item.getChildren();
|
|
21
|
+
if (groupedItemsArr.length === 0) {
|
|
22
|
+
return true; // Corresponds to an extention or pure heading, since no children.
|
|
23
|
+
}
|
|
24
|
+
if (bindings[0].getItemGroupedChildBindings().find((childBindings, idx) =>
|
|
25
|
+
showNow(editor, groupedItemsArr[idx], childBindings))) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
|
|
5
33
|
export default class Presenter extends View {
|
|
6
34
|
_handleParams(params) {
|
|
7
35
|
this.showLanguage = params.showLanguage !== false;
|
|
@@ -17,10 +45,11 @@ export default class Presenter extends View {
|
|
|
17
45
|
* @param {Object} bindings
|
|
18
46
|
*/
|
|
19
47
|
showNow(item, bindings) {
|
|
20
|
-
|
|
48
|
+
return showNow(this, item, bindings);
|
|
49
|
+
/* if (item.hasStyle('deprecated') && bindings.length === 0) {
|
|
21
50
|
return false;
|
|
22
51
|
}
|
|
23
|
-
return bindings.length > 0 && !item.hasStyle('invisible')
|
|
52
|
+
return bindings.length > 0 && !item.hasStyle('invisible');*/
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
skipBinding(binding) {
|
package/src/view/Registry.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import renderingContext from './renderingContext';
|
|
2
2
|
import Presenter from './Presenter';
|
|
3
|
-
import
|
|
3
|
+
import CODES from '../model/CODES';
|
|
4
|
+
import { create } from '../model/engine';
|
|
4
5
|
import { bindingReport } from '../model/validate';
|
|
5
6
|
|
|
6
7
|
const localize = (bundle, key, val) => {
|
|
@@ -101,7 +102,7 @@ export default class ValidationPresenter extends Presenter {
|
|
|
101
102
|
if (target > _bindings.length && groupChildRequirementHinder && !groupError) {
|
|
102
103
|
_bindings = _bindings.concat([]);
|
|
103
104
|
while (target > _bindings.length) {
|
|
104
|
-
const binding =
|
|
105
|
+
const binding = create(this.binding, item);
|
|
105
106
|
if (_bindings.length < min) {
|
|
106
107
|
binding.setMatchingCode(CODES.TOO_FEW_VALUES_MIN);
|
|
107
108
|
// binding.error = CODES.TOO_FEW_VALUES;
|
package/src/view/View.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this,no-unused-vars */
|
|
2
|
+
import { namespaces } from '@entryscape/rdfjson';
|
|
2
3
|
import renderingContext from './renderingContext';
|
|
3
4
|
import GroupBinding from '../model/GroupBinding';
|
|
4
5
|
import * as engine from '../model/engine';
|
|
5
6
|
import { bindingReport } from '../model/validate';
|
|
6
|
-
import {namespaces} from "@entryscape/rdfjson";
|
|
7
7
|
|
|
8
8
|
let viewCounter = 0;
|
|
9
9
|
export default class View {
|
|
@@ -18,10 +18,14 @@ export default class View {
|
|
|
18
18
|
this.resource = params.resource || '';
|
|
19
19
|
this.topLevel = params.topLevel !== false;
|
|
20
20
|
this.compact = params.compact !== false;
|
|
21
|
+
this.showDescription = params.showDescription === true;
|
|
21
22
|
this.styleCls = params.styleCls || '';
|
|
22
|
-
this.filterPredicates = params.filterPredicates
|
|
23
|
+
this.filterPredicates = Array.isArray(params.filterPredicates) ?
|
|
24
|
+
params.filterPredicates.reduce((prev, current) => { prev[current] = true; return prev; }, {}) :
|
|
25
|
+
params.filterPredicates || null;
|
|
23
26
|
this.restrictToItem = params.restrictToItem;
|
|
24
27
|
this.fuzzy = params.fuzzy === true;
|
|
28
|
+
this.markOrigin = params.markOrigin !== false;
|
|
25
29
|
this._handleParams(params);
|
|
26
30
|
this._labelIndex = {};
|
|
27
31
|
this.domNode = renderingContext.createDomNode(srcNodeRef, this);
|
|
@@ -30,6 +34,32 @@ export default class View {
|
|
|
30
34
|
this.render();
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
getParentView() {
|
|
38
|
+
return this.parentView;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getNamedGraphId(namedGraph) {
|
|
42
|
+
if (!this.markOrigin) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
if (!this.namedGraphs) {
|
|
46
|
+
this.namedGraphs = {};
|
|
47
|
+
this.namedGraphCounter = 65; // 'A'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let id = this.namedGraphs[namedGraph];
|
|
51
|
+
if (id === undefined) {
|
|
52
|
+
id = String.fromCharCode(this.namedGraphCounter);
|
|
53
|
+
this.namedGraphs[namedGraph] = id;
|
|
54
|
+
this.namedGraphCounter += 1;
|
|
55
|
+
}
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getNamedGraphFromId(id) {
|
|
60
|
+
return this.namedGraphs ? Object.keys(this.namedGraphs).find(key => this.namedGraphs[key] === id) : undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
33
63
|
destroy() {
|
|
34
64
|
renderingContext.destroyDomNode(this.domNode, this);
|
|
35
65
|
}
|
|
@@ -192,6 +222,7 @@ export default class View {
|
|
|
192
222
|
}
|
|
193
223
|
}
|
|
194
224
|
} else {
|
|
225
|
+
this.context = { view: this };
|
|
195
226
|
lastRow = this.createRowNode(lastRow, null, item);
|
|
196
227
|
}
|
|
197
228
|
|
|
@@ -244,6 +275,17 @@ export default class View {
|
|
|
244
275
|
this.createEndOfRowNode(newRow, binding, item);
|
|
245
276
|
}
|
|
246
277
|
}
|
|
278
|
+
if (this.markOrigin) {
|
|
279
|
+
const ngId = this.getNamedGraphId(binding);
|
|
280
|
+
if (ngId) {
|
|
281
|
+
renderingContext.domClassToggle(fieldDiv, 'rdformsOrigin', true);
|
|
282
|
+
renderingContext.domClassToggle(fieldDiv, `rdformsOrigin_${ngId}`, true);
|
|
283
|
+
} else {
|
|
284
|
+
renderingContext.domClassToggle(fieldDiv, 'rdformsOrigin', true);
|
|
285
|
+
renderingContext.domClassToggle(fieldDiv, 'rdformsOrigin_default', true);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
247
289
|
if (item.getType() === 'group') {
|
|
248
290
|
renderingContext.domClassToggle(fieldDiv, 'rdformsGroup', true);
|
|
249
291
|
} else {
|
|
@@ -275,7 +317,8 @@ export default class View {
|
|
|
275
317
|
renderingContext.domClassToggle(rowNode, 'rdformsTopLevel', this.topLevel);
|
|
276
318
|
renderingContext.domClassToggle(rowNode, 'rdformsInvisibleGroup', item.hasStyle('invisibleGroup'));
|
|
277
319
|
renderingContext.domClassToggle(rowNode, 'rdformsHeading', item.hasStyle('heading'));
|
|
278
|
-
renderingContext.domClassToggle(rowNode, 'notCompact', item.getType() === 'group');
|
|
320
|
+
renderingContext.domClassToggle(rowNode, 'notCompact', item.getType() === 'group' || item.hasStyle('nonCompact'));
|
|
321
|
+
renderingContext.domClassToggle(rowNode, 'rdformsCompactItem', item.hasStyle('compact'));
|
|
279
322
|
|
|
280
323
|
this.addLabel(rowNode, binding, item);
|
|
281
324
|
if (binding && this.filterBinding(binding)) {
|
|
@@ -301,16 +344,15 @@ export default class View {
|
|
|
301
344
|
const filter = (item, fp) => {
|
|
302
345
|
// Exclude based on item id.
|
|
303
346
|
const id = item.getId();
|
|
304
|
-
if (id &&
|
|
347
|
+
if (id && Object.keys(fp).includes(id)) {
|
|
305
348
|
return true;
|
|
306
349
|
}
|
|
307
|
-
// Exclude if property matches.
|
|
308
350
|
const prop = item.getProperty();
|
|
309
|
-
|
|
351
|
+
// Exclude if property matches.
|
|
352
|
+
if (prop) {
|
|
310
353
|
return fp[prop] === true || fp[namespaces.shortenKnown(prop)] === true;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// Checks one level below if there is a child that is visible
|
|
354
|
+
} else if (item.getType() === 'group') {
|
|
355
|
+
// Exclude group headers if all children hidden
|
|
314
356
|
const childBindings = item.getChildren() || [];
|
|
315
357
|
let hasNonFilteredChild = false;
|
|
316
358
|
childBindings.forEach((child) => {
|
|
@@ -322,7 +364,7 @@ export default class View {
|
|
|
322
364
|
}
|
|
323
365
|
return false;
|
|
324
366
|
};
|
|
325
|
-
return filter(itemToCheck, filterPredicates);
|
|
367
|
+
return filterPredicates ? filter(itemToCheck, filterPredicates) : false;
|
|
326
368
|
}
|
|
327
369
|
|
|
328
370
|
filterProperty(property) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import jquery from 'jquery';
|
|
3
3
|
import DateTimeBase from '../bootstrap/DateTimeBase';
|
|
4
|
+
import { getNamedGraphId } from '../viewUtils';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A Date and time picker.
|
|
7
8
|
*/
|
|
8
9
|
export default class DateTimeMD extends DateTimeBase {
|
|
9
10
|
buildUI() {
|
|
11
|
+
const disabledAttr = getNamedGraphId(this.binding, this.context) ? 'disabled' : '';
|
|
10
12
|
this.tpdate = null;
|
|
11
13
|
this.dpdate = null;
|
|
12
14
|
const bundle = this.context.view.messages;
|
|
@@ -16,23 +18,23 @@ export default class DateTimeMD extends DateTimeBase {
|
|
|
16
18
|
|
|
17
19
|
this.domNode.innerHTML = `<div class="rdformsDateValue rdformsFieldInput" xmlns="http://www.w3.org/1999/html">
|
|
18
20
|
<div class="rdformsDatepicker form-group input" style="padding-right: 15px;">
|
|
19
|
-
<input class="form-control dateInput date" type="text" placeholder="YYYY-MM-DD" />
|
|
21
|
+
<input ${disabledAttr} class="form-control dateInput date" type="text" placeholder="YYYY-MM-DD" />
|
|
20
22
|
<span >
|
|
21
|
-
<button type="button" class="btn btn-primary bmd-btn-fab bmd-btn-fab-sm dateButton"><span class="fa fa-calendar"></span>
|
|
23
|
+
<button ${disabledAttr} type="button" class="btn btn-primary bmd-btn-fab bmd-btn-fab-sm dateButton"><span class="fa fa-calendar"></span>
|
|
22
24
|
<div class="ripple-container"></div></button>
|
|
23
25
|
</span>
|
|
24
26
|
</div>
|
|
25
27
|
<div class="form-group input" style="display:none;">
|
|
26
|
-
<input type="text" class="form-control timeInput" placeholder="HH:MM"/>
|
|
28
|
+
<input ${disabledAttr} type="text" class="form-control timeInput" placeholder="HH:MM"/>
|
|
27
29
|
<span>
|
|
28
|
-
<button type="button" class="btn btn-primary bmd-btn-fab bmd-btn-fab-sm timeButton"><span class="fa fa-clock"></span></button>
|
|
30
|
+
<button ${disabledAttr} type="button" class="btn btn-primary bmd-btn-fab bmd-btn-fab-sm timeButton"><span class="fa fa-clock"></span></button>
|
|
29
31
|
</span>
|
|
30
32
|
</div>
|
|
31
33
|
<div class="form-group input" style="display:none;">
|
|
32
|
-
<input type="text" class="form-control yearInput" placeholder="YYYY"/>
|
|
34
|
+
<input ${disabledAttr} type="text" class="form-control yearInput" placeholder="YYYY"/>
|
|
33
35
|
</div>
|
|
34
36
|
|
|
35
|
-
<select class="form-control dateControl">
|
|
37
|
+
<select ${disabledAttr} class="form-control dateControl">
|
|
36
38
|
${yearOption}
|
|
37
39
|
${dateOption}
|
|
38
40
|
${dateTimeOption}
|
|
@@ -68,10 +70,8 @@ export default class DateTimeMD extends DateTimeBase {
|
|
|
68
70
|
jquery(this.dateButton).click(() => {
|
|
69
71
|
this.$datepicker.bootstrapMaterialDatePicker('_fireCalendar');
|
|
70
72
|
});
|
|
71
|
-
this.$datepicker.on('change', (evt,
|
|
72
|
-
|
|
73
|
-
m = moment(evt.target.value);
|
|
74
|
-
}
|
|
73
|
+
this.$datepicker.on('change', (evt, mInstance) => {
|
|
74
|
+
const m = mInstance || moment(evt.target.value);
|
|
75
75
|
|
|
76
76
|
if (this.tpdate) {
|
|
77
77
|
const tpd = moment(this.tpdate);
|
|
@@ -90,10 +90,8 @@ export default class DateTimeMD extends DateTimeBase {
|
|
|
90
90
|
this.$timepicker.bootstrapMaterialDatePicker('_fireCalendar');
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
this.$timepicker.on('change', (evt,
|
|
94
|
-
|
|
95
|
-
m = moment(evt.target.value);
|
|
96
|
-
}
|
|
93
|
+
this.$timepicker.on('change', (evt, mInstance) => {
|
|
94
|
+
const m = mInstance || moment(evt.target.value);
|
|
97
95
|
|
|
98
96
|
if (this.dpdate != null) {
|
|
99
97
|
const dpd = moment(this.dpdate);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import 'selectize';
|
|
1
|
+
import '@selectize/selectize/dist/js/standalone/selectize.min';
|
|
2
|
+
//import '@selectize/selectize/dist/css/selectize.bootstrap4.css';
|
|
2
3
|
import renderingContext from '../renderingContext';
|
|
3
|
-
import system from '../../model/system';
|
|
4
4
|
import utils from '../../utils';
|
|
5
|
+
import { getNamedGraphId } from '../viewUtils';
|
|
5
6
|
|
|
6
7
|
renderingContext.renderSelect = function (fieldDiv, binding, context) {
|
|
7
8
|
const formgroup = jquery('<div class="form-group selectizeException">').appendTo(fieldDiv);
|
|
@@ -48,7 +49,7 @@ renderingContext.renderSelect = function (fieldDiv, binding, context) {
|
|
|
48
49
|
}
|
|
49
50
|
sel = $select.selectize(settings)[0].selectize;
|
|
50
51
|
|
|
51
|
-
if (disable) {
|
|
52
|
+
if (disable || getNamedGraphId(binding, context)) {
|
|
52
53
|
sel.disable();
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -60,7 +61,7 @@ renderingContext.renderSelect = function (fieldDiv, binding, context) {
|
|
|
60
61
|
const label = utils.getLocalizedValue(choice.label).value || '';
|
|
61
62
|
const op = sel.options[choice.value];
|
|
62
63
|
if (!op) {
|
|
63
|
-
sel.addOption({id: choice.value, text: label, choice});
|
|
64
|
+
sel.addOption({ id: choice.value, text: label, choice });
|
|
64
65
|
}
|
|
65
66
|
sel.addItem(choice.value, true);
|
|
66
67
|
// $select.val(choice.value).trigger('change');
|
package/src/view/bmd/style.css
CHANGED
|
@@ -137,5 +137,13 @@
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
.rdforms.rdformsEditor .rdformsLangFieldControl>.action {
|
|
140
|
-
margin-top:
|
|
140
|
+
margin-top: 10px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rdformsActionButton:focus {
|
|
144
|
+
color: #009688;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rdforms .rdformsLabelRow>.rdformsActionButton.action {
|
|
148
|
+
margin-top: -5px;
|
|
141
149
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import 'bootstrap-datepicker/dist/js/bootstrap-datepicker';
|
|
2
2
|
import jquery from 'jquery';
|
|
3
3
|
import DateTimeBase from './DateTimeBase';
|
|
4
|
+
import { getNamedGraphId } from '../viewUtils';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A Date and time picker.
|
|
7
8
|
*/
|
|
8
9
|
export default class DateTimeBootstrapDatepicker extends DateTimeBase {
|
|
9
10
|
buildUI() {
|
|
11
|
+
const disabledAttr = getNamedGraphId(this.binding, this.context) ? 'disabled' : '';
|
|
10
12
|
const bundle = this.context.view.messages;
|
|
11
13
|
const yearOption = this.includeYearOption() ? `<option value="Year">${bundle.date_year}</option>` : '';
|
|
12
14
|
const dateOption = this.includeDateOption() ? `<option value="Date" selected="true">${bundle.date_date}</option>` : '';
|
|
@@ -14,7 +16,7 @@ export default class DateTimeBootstrapDatepicker extends DateTimeBase {
|
|
|
14
16
|
this.domNode.innerHTML = `<div class="rdformsDateValue rdformsFieldInput" xmlns="http://www.w3.org/1999/html">
|
|
15
17
|
<div class="rdformsDatepicker datepicker">
|
|
16
18
|
<div class="input-group date">
|
|
17
|
-
<input type="text" class="form-control">
|
|
19
|
+
<input ${disabledAttr} type="text" class="form-control">
|
|
18
20
|
<div class="input-group-append">
|
|
19
21
|
<span class="input-group-text">
|
|
20
22
|
<i class="fas fa-calendar"></i>
|
|
@@ -23,12 +25,12 @@ export default class DateTimeBootstrapDatepicker extends DateTimeBase {
|
|
|
23
25
|
</div>
|
|
24
26
|
</div>
|
|
25
27
|
<span style="display: none">
|
|
26
|
-
<input type="text" class="form-control timeInput" placeholder="HH:MM"/>
|
|
28
|
+
<input ${disabledAttr} type="text" class="form-control timeInput" placeholder="HH:MM"/>
|
|
27
29
|
</span>
|
|
28
30
|
<span style="display: none">
|
|
29
|
-
<input type="text" class="form-control yearInput" placeholder="YYYY"/>
|
|
31
|
+
<input ${disabledAttr} type="text" class="form-control yearInput" placeholder="YYYY"/>
|
|
30
32
|
</span>
|
|
31
|
-
<select class="form-control dateControl">
|
|
33
|
+
<select ${disabledAttr} class="form-control dateControl">
|
|
32
34
|
${yearOption}
|
|
33
35
|
${dateOption}
|
|
34
36
|
${dateTimeOption}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getNamedGraphId } from '../viewUtils';
|
|
2
|
+
|
|
1
3
|
let uniqueRadioButtonGroupNr = 0;
|
|
2
4
|
|
|
3
5
|
export default class RadioButtonsEditor {
|
|
@@ -49,7 +51,8 @@ export default class RadioButtonsEditor {
|
|
|
49
51
|
|| c.seeAlso || c.value);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
const
|
|
54
|
+
const disabledAttr = getNamedGraphId(this.binding, this.context) ? 'disabled' : '';
|
|
55
|
+
const $input = jquery(`<input ${disabledAttr} type="radio">`)
|
|
53
56
|
.val(c.value)
|
|
54
57
|
.attr('checked', c.value === currentValue)
|
|
55
58
|
.attr('name', `rdformsRadio_${uniqueRadioButtonGroupNr}`)
|
|
@@ -60,7 +63,7 @@ export default class RadioButtonsEditor {
|
|
|
60
63
|
$label.addClass('mismatch disabled');
|
|
61
64
|
$input.attr('disabled', true);
|
|
62
65
|
} else {
|
|
63
|
-
$label.click((
|
|
66
|
+
$label.click(() => {
|
|
64
67
|
this.binding.setValue($input.val());
|
|
65
68
|
});
|
|
66
69
|
}
|