@entryscape/rdforms 10.5.2 → 10.6.2

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.
Files changed (39) hide show
  1. package/dist/rdforms.bmd.js +5 -5
  2. package/dist/rdforms.bootstrap.js +9 -9
  3. package/dist/rdforms.jquery.js +3 -3
  4. package/dist/rdforms.node.js +3 -3
  5. package/dist/rdforms.react.js +27 -27
  6. package/index.bmd.js +5 -4
  7. package/package.json +2 -1
  8. package/src/model/CODES.js +17 -0
  9. package/src/model/CardinalityTracker.js +2 -1
  10. package/src/model/ChoiceBinding.js +7 -1
  11. package/src/model/engine.js +1 -19
  12. package/src/model/validate.js +21 -20
  13. package/src/template/Item.js +46 -51
  14. package/src/view/Editor.js +8 -3
  15. package/src/view/Presenter.js +2 -1
  16. package/src/view/ValidationPresenter.js +2 -1
  17. package/src/view/View.js +6 -3
  18. package/src/view/bootstrap/RadioButtonsEditor.js +4 -4
  19. package/src/view/bootstrap/choice.js +1 -1
  20. package/src/view/bootstrap/labels.js +12 -17
  21. package/src/view/bootstrap/style.css +11 -0
  22. package/src/view/bootstrap/table.js +5 -1
  23. package/src/view/bootstrap/text.js +29 -11
  24. package/src/view/jquery/components.js +12 -4
  25. package/src/view/jquery/labels.js +5 -1
  26. package/src/view/react/buttons.js +1 -1
  27. package/src/view/react/choice.js +16 -7
  28. package/src/view/react/choiceEditors/CheckBoxesEditor.js +1 -1
  29. package/src/view/react/choiceEditors/ChoiceLookup.js +2 -1
  30. package/src/view/react/choiceEditors/ChoiceLookupAndInlineSearch.js +6 -5
  31. package/src/view/react/choiceEditors/ChoiceSelector.js +2 -1
  32. package/src/view/react/choiceEditors/RadioButtonsEditor.js +2 -2
  33. package/src/view/react/components.js +6 -6
  34. package/src/view/react/date.js +0 -16
  35. package/src/view/react/hooks.js +17 -9
  36. package/src/view/react/labels.js +13 -8
  37. package/src/view/react/textEditors.js +5 -0
  38. package/src/view/renderingContext.js +2 -2
  39. package/src/view/resources/rdforms.css +1 -2
package/index.bmd.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import 'whatwg-fetch';
2
2
  import 'core-js/stable';
3
3
  import 'regenerator-runtime/runtime';
4
+ import bundleLoader from './src/template/bundleLoader';
5
+ import ItemStore from './src/template/ItemStore';
6
+
4
7
  import './src/view/bmd/all';
5
8
  import './src/view/bmd/style.css';
6
9
 
7
- import ItemStore from './src/template/ItemStore';
8
10
  import Editor from './src/view/Editor';
9
11
  import Presenter from './src/view/Presenter';
10
- import ValidationPresenter from './src/view/ValidationPresenter';
11
- import bundleLoader from './src/template/bundleLoader';
12
12
  import renderingContext from './src/view/renderingContext';
13
+ import ValidationPresenter from './src/view/ValidationPresenter';
13
14
  import LevelEditor from './src/view/bootstrap/LevelEditor';
14
15
 
15
- export {bundleLoader, ItemStore, Editor, Presenter, ValidationPresenter, LevelEditor, renderingContext};
16
+ export { bundleLoader, ItemStore, Editor, Presenter, ValidationPresenter, LevelEditor, renderingContext };
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "application profile",
9
9
  "linked data"
10
10
  ],
11
- "version": "10.5.2",
11
+ "version": "10.6.2",
12
12
  "main": "dist/rdforms.node.js",
13
13
  "browser": "dist/rdforms.react.js",
14
14
  "module": "main.js",
@@ -29,6 +29,7 @@
29
29
  "bootstrap-material-datetimepicker": "https://bitbucket.org/metasolutions/bootstrap-material-datetimepicker.git#webpack",
30
30
  "bootstrap-material-design": "^4.1.1",
31
31
  "core-js": "^3.1.4",
32
+ "circular-dependency-plugin": "^5.2.2",
32
33
  "ifdef-loader": "^2.1.1",
33
34
  "jquery": "^3.3.1",
34
35
  "jquery-mousewheel": "^3.1.13",
@@ -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
+ };
@@ -1,4 +1,5 @@
1
- import { CODES } from './engine';
1
+ import CODES from './CODES';
2
+
2
3
  export default class CardinalityTracker {
3
4
  /**
4
5
  * A counter paired with a item with cardinality restrictions.
@@ -1,4 +1,5 @@
1
1
  import ValueBinding from './ValueBinding';
2
+ import CODES from './CODES';
2
3
 
3
4
  const label = 'http://www.w3.org/2000/01/rdf-schema#label';
4
5
  const seeAlso = 'http://www.w3.org/2000/01/rdf-schema#seeAlso';
@@ -24,6 +25,11 @@ export default class ChoiceBinding extends ValueBinding {
24
25
  } else if (this.getValue() !== choice.value) {
25
26
  this.setValue(choice.value, choice, silent);
26
27
  }
28
+ if (choice && choice.mismatch) {
29
+ this.setMatchingCode(CODES.WRONG_VALUE);
30
+ } else if ((!choice || !choice.mismatch) && this.getMatchingCode() === CODES.WRONG_VALUE) {
31
+ this.setMatchingCode(CODES.OK);
32
+ }
27
33
  }
28
34
 
29
35
  getChoice() {
@@ -31,8 +37,8 @@ export default class ChoiceBinding extends ValueBinding {
31
37
  }
32
38
 
33
39
  setValue(value, choice, silent) {
34
- super.setValue(value, choice, silent);
35
40
  const oldval = this.getValue();
41
+ super.setValue(value, choice, silent);
36
42
  const graph = this._statement.getGraph();
37
43
  graph.findAndRemove(oldval, label, undefined, silent);
38
44
  graph.findAndRemove(oldval, seeAlso, undefined, silent);
@@ -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,
@@ -1,8 +1,9 @@
1
1
  import { namespaces as ns } from '@entryscape/rdfjson';
2
- import * as engine from './engine';
2
+ import { fuzzyMatch, findBindingRelativeToParentBinding, matchPathBelowBinding } from './engine';
3
+ import CODES from './CODES';
3
4
 
4
5
  const _clearMatchingCodes = (binding) => {
5
- binding.setMatchingCode(engine.CODES.OK);
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 = engine.findBindingRelativeToParentBinding(groupBinding, childPath);
70
- if (!engine.matchPathBelowBinding(fromBinding, childPath)) {
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() !== engine.CODES.OK) {
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 = engine.findBindingRelativeToParentBinding(groupbinding.getParent(), path);
88
- if (!engine.matchPathBelowBinding(fromBinding, path)) {
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 = engine.CODES.AT_MOST_ONE_CHILD;
105
+ code = CODES.AT_MOST_ONE_CHILD;
105
106
  } else if (nrOfValid !== 1 && groupitem.hasStyle('exactlyOneChild')) {
106
- code = engine.CODES.EXACTLY_ONE_CHILD;
107
+ code = CODES.EXACTLY_ONE_CHILD;
107
108
  } else if (nrOfValid === 0 && groupitem.hasStyle('atLeastOneChild')) {
108
- code = engine.CODES.AT_LEAST_ONE_CHILD;
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: engine.CODES.TOO_FEW_VALUES_MIN,
133
+ code: CODES.TOO_FEW_VALUES_MIN,
133
134
  });
134
- updateViaCardinalityTracker(bindings, engine.CODES.TOO_FEW_VALUES_MIN);
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(engine.CODES.TOO_FEW_VALUES_MIN);
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: engine.CODES.TOO_FEW_VALUES_PREF,
149
+ code: CODES.TOO_FEW_VALUES_PREF,
149
150
  });
150
- // updateViaCardinalityTracker(bindings, engine.CODES.TOO_FEW_VALUES_PREF);
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: engine.CODES.TOO_MANY_VALUES,
157
+ code: CODES.TOO_MANY_VALUES,
157
158
  });
158
- updateViaCardinalityTracker(bindings, engine.CODES.TOO_MANY_VALUES);
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(engine.CODES.TOO_MANY_VALUES);
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() !== engine.CODES.OK) {
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 = engine.fuzzyMatch(graph, resource, template);
334
+ const binding = fuzzyMatch(graph, resource, template);
334
335
  const report = bindingReport(binding);
335
336
  _filterReport(report, resource, ignoreResources || {});
336
337
  _simplifyReport(report);
@@ -49,6 +49,7 @@ export default class Item {
49
49
  'strictmatch',
50
50
  'relaxedDatatypeMatch',
51
51
  'viewAllTranslations',
52
+ 'filterTranslations',
52
53
  'email',
53
54
  'atLeastOneChild',
54
55
  'atMostOneChild',
@@ -123,65 +124,59 @@ export default class Item {
123
124
  return this.getExtends() != null;
124
125
  }
125
126
 
126
- getLabel(returnDetails, original) {
127
+ _getText(attr, returnDetails, original) {
127
128
  const s = this.getSource(original);
128
- return returnDetails ? utils.getLocalizedValue(s.label) : utils.getLocalizedValue(s.label).value;
129
+ return returnDetails ? utils.getLocalizedValue(s[attr]) : utils.getLocalizedValue(s[attr]).value;
129
130
  }
130
-
131
- setLabel(value, lang) {
131
+ _setText(attr, value, lang) {
132
132
  const s = this.getSource(true);
133
- s.label = this._setLangHash(s.label, value, lang);
133
+ s[attr] = this._setLangHash(s[attr], value, lang);
134
134
  this.refreshExtends();
135
135
  }
136
-
137
- getLabelMap(original) {
138
- return this.getSource(original).label;
139
- }
140
-
141
- setLabelMap(map) {
142
- setObjAttr(this.getSource(true), 'label', map);
143
- this.refreshExtends();
144
- }
145
-
146
- getDescription(returnDetails, original) {
147
- const s = this.getSource(original);
148
- return returnDetails ? utils.getLocalizedValue(s.description) : utils.getLocalizedValue(s.description).value;
149
- }
150
-
151
- setDescription(value, lang) {
152
- const s = this.getSource(true);
153
- s.description = this._setLangHash(s.description, value, lang);
136
+ _setTextMap(attr, map) {
137
+ setObjAttr(this.getSource(true), attr, map);
154
138
  this.refreshExtends();
155
139
  }
156
140
 
157
- getDescriptionMap(original) {
158
- return this.getSource(original).description;
159
- }
160
-
161
- setDescriptionMap(map) {
162
- setObjAttr(this.getSource(true), 'description', map);
163
- this.refreshExtends();
164
- }
165
-
166
- getPlaceholder(returnDetails, original) {
167
- const s = this.getSource(original);
168
- return returnDetails ? utils.getLocalizedValue(s.placeholder) : utils.getLocalizedValue(s.placeholder).value;
169
- }
170
-
171
- setPlaceholder(value, lang) {
172
- const s = this.getSource(true);
173
- s.placeholder = this._setLangHash(s.placeholder, value, lang);
174
- this.refreshExtends();
175
- }
176
-
177
- getPlaceholderMap(original) {
178
- return this.getSource(original).placeholder;
179
- }
180
-
181
- setPlaceholderMap(map) {
182
- setObjAttr(this.getSource(true), 'placeholder', map);
183
- this.refreshExtends();
184
- }
141
+ getLabel(returnDetails, original) { return this._getText('label', returnDetails, original); }
142
+ setLabel(value, lang) { this._setText('label', value, lang); }
143
+ getLabelMap(original) { return this.getSource(original).label; }
144
+ setLabelMap(map) { this._setTextMap('label', map); }
145
+
146
+ getEditLabel(returnDetails, original) { return this._getText('editlabel', returnDetails, original); }
147
+ setEditLabel(value, lang) { this._setText('editlabel', value, lang); }
148
+ getEditLabelMap(original) { return this.getSource(original).editlabel; }
149
+ setEditLabelMap(map) { this._setTextMap('editlabel', map); }
150
+
151
+ getDescription(returnDetails, original) { return this._getText('description', returnDetails, original); }
152
+ setDescription(value, lang) { this._setText('description', value, lang); }
153
+ getDescriptionMap(original) { return this.getSource(original).description; }
154
+ setDescriptionMap(map) { this._setTextMap('description', map); }
155
+
156
+ getEditDescription(returnDetails, original) { return this._getText('editdescription', returnDetails, original); }
157
+ setEditDescription(value, lang) { this._setText('editdescription', value, lang); }
158
+ getEditDescriptionMap(original) { return this.getSource(original).editdescription; }
159
+ setEditDescriptionMap(map) { this._setTextMap('editdescription', map); }
160
+
161
+ getHelp(returnDetails, original) { return this._getText('help', returnDetails, original); }
162
+ setHelp(value, lang) { this._setText('help', value, lang); }
163
+ getHelpMap(original) { return this.getSource(original).help; }
164
+ setHelpMap(map) { this._setTextMap('help', map); }
165
+
166
+ getPlaceholder(returnDetails, original) { return this._getText('placeholder', returnDetails, original); }
167
+ setPlaceholder(value, lang) { this._setText('placeholder', value, lang); }
168
+ getPlaceholderMap(original) { return this.getSource(original).placeholder; }
169
+ setPlaceholderMap(map) { this._setTextMap('placeholder', map); }
170
+
171
+ getPurpose(returnDetails, original) { return this._getText('purpose', returnDetails, original); }
172
+ setPurpose(value, lang) { this._setText('purpose', value, lang); }
173
+ getPurposeMap(original) { return this.getSource(original).purpose; }
174
+ setPurposeMap(map) { this._setTextMap('purpose', map); }
175
+
176
+ getSpecification(returnDetails, original) { return this._getText('specification', returnDetails, original); }
177
+ setSpecification(value, lang) { this._setText('specification', value, lang); }
178
+ getSpecificationMap(original) { return this.getSource(original).specification; }
179
+ setSpecificationMap(map) { this._setTextMap('specification', map); }
185
180
 
186
181
  /**
187
182
  * @return {String|null} as a URI, may be null for Groups, never null for Text or choice
@@ -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
 
@@ -61,6 +62,10 @@ export default class Editor extends Presenter {
61
62
  super._handleParams(params);
62
63
  }
63
64
 
65
+ getSubEditorForBinding(binding) {
66
+ return this._subEditors.find(editor => editor.getBinding() === binding);
67
+ }
68
+
64
69
  report(report) {
65
70
  const _report = report || bindingReport(this.binding);
66
71
 
@@ -70,7 +75,7 @@ export default class Editor extends Presenter {
70
75
  for (let j = 0; j < _report.errors.length; j++) {
71
76
  const err = _report.errors[j];
72
77
  if (err.parentBinding === this.binding) {
73
- if (err.code === engine.CODES.TOO_FEW_VALUES_MIN) {
78
+ if (err.code === CODES.TOO_FEW_VALUES_MIN) {
74
79
  const item = err.item;
75
80
  let counter = item.getCardinality().min;
76
81
 
@@ -82,9 +87,9 @@ export default class Editor extends Presenter {
82
87
  }
83
88
  return counter === 0;
84
89
  });
85
- } else if (err.code === engine.CODES.AT_MOST_ONE_CHILD) {
90
+ } else if (err.code === CODES.AT_MOST_ONE_CHILD) {
86
91
  this.binding.getChildBindings().forEach((binding) => {
87
- if (binding.getMatchingCode() !== engine.CODES.OK) {
92
+ if (binding.getMatchingCode() !== CODES.OK) {
88
93
  renderingContext.domClassToggle(this._binding2node[binding.getHash()],
89
94
  'errorReport', true);
90
95
  }
@@ -43,7 +43,8 @@ export default class Presenter extends View {
43
43
  * otherwise same as input bindings.
44
44
  */
45
45
  prepareBindings(item, bindings) {
46
- if (!this.filterTranslations || item.getNodetype() !== 'LANGUAGE_LITERAL' || item.hasStyle('viewAllTranslations')) {
46
+ if (!item.hasStyle('filterTranslations') &&
47
+ (!this.filterTranslations || item.getNodetype() !== 'LANGUAGE_LITERAL' || item.hasStyle('viewAllTranslations'))) {
47
48
  return bindings;
48
49
  }
49
50
 
@@ -1,6 +1,7 @@
1
1
  import renderingContext from './renderingContext';
2
2
  import Presenter from './Presenter';
3
- import engine, { CODES } from '../model/engine';
3
+ import CODES from '../model/CODES';
4
+ import engine from '../model/engine';
4
5
  import { bindingReport } from '../model/validate';
5
6
 
6
7
  const localize = (bundle, key, val) => {
package/src/view/View.js CHANGED
@@ -263,9 +263,9 @@ export default class View {
263
263
 
264
264
  // New rowDiv since we have a label
265
265
  if (lastRowNode == null) {
266
- rowNode = renderingContext.domCreate('div', this.domNode);
266
+ rowNode = renderingContext.domCreate('div', this.domNode, binding ? this.getRowIndex(binding) : undefined);
267
267
  } else {
268
- rowNode = renderingContext.domCreateAfter('div', lastRowNode);
268
+ rowNode = renderingContext.domCreateAfter('div', lastRowNode, binding ? this.getRowIndex(binding) : undefined);
269
269
  }
270
270
 
271
271
  item.getClasses().forEach((cls) => {
@@ -331,7 +331,6 @@ export default class View {
331
331
  }
332
332
 
333
333
  getLabelIndex(binding) {
334
- const labelItem = binding.getItem();
335
334
  let idx;
336
335
  binding.getParent().getChildBindingsFor(binding.getItem()).reverse().find((b) => {
337
336
  idx = this._labelIndex[b.getHash()];
@@ -352,6 +351,10 @@ export default class View {
352
351
  return idx;
353
352
  }
354
353
 
354
+ getRowIndex(binding) {
355
+ return `${binding.getHash()}_${this._viewId}_row`;
356
+ }
357
+
355
358
  isMultiValued(item) {
356
359
  return false;
357
360
  }
@@ -5,10 +5,10 @@ export default class RadioButtonsEditor {
5
5
  this.binding = args.binding;
6
6
  this.item = this.binding.getItem();
7
7
  this.choices = this.item.getChoices().map(c => ({
8
- label: c.label,
8
+ label: c.editlabel || c.label,
9
9
  description: c.description,
10
10
  value: c.value,
11
- text: this.item._getLocalizedValue(c.label).value,
11
+ text: this.item._getLocalizedValue(c.editlabel || c.label).value,
12
12
  choice: c,
13
13
  }));
14
14
 
@@ -45,7 +45,7 @@ export default class RadioButtonsEditor {
45
45
  .appendTo($divWrap);
46
46
  }
47
47
  if (c.description) {
48
- $label.attr('title', this.item._getLocalizedValue(c.description).value
48
+ $label.attr('title', this.item._getLocalizedValue(c.editdescription || c.description).value
49
49
  || c.seeAlso || c.value);
50
50
  }
51
51
 
@@ -54,7 +54,7 @@ export default class RadioButtonsEditor {
54
54
  .attr('checked', c.value === currentValue)
55
55
  .attr('name', `rdformsRadio_${uniqueRadioButtonGroupNr}`)
56
56
  .appendTo($label);
57
- $label.append(this.item._getLocalizedValue(c.label).value);
57
+ $label.append(this.item._getLocalizedValue(c.editlabel || c.label).value);
58
58
 
59
59
  if (c.mismatch) {
60
60
  $label.addClass('mismatch disabled');
@@ -21,7 +21,7 @@ editors.itemtype('choice').choices().register((fieldDiv, binding, context) => {
21
21
  const item = binding.getItem();
22
22
  const choices = item.getChoices().map(c => ({
23
23
  id: c.value,
24
- text: item._getLocalizedValue(c.label).value,
24
+ text: item._getLocalizedValue(c.editlabel || c.label).value,
25
25
  choice: c,
26
26
  }));
27
27
  if (!item.hasStyle('preserveOrderOfChoices')) {
@@ -1,18 +1,22 @@
1
1
  import jquery from 'jquery';
2
2
  import renderingContext from '../renderingContext';
3
+ import Editor from '../Editor';
3
4
 
4
5
  renderingContext.renderEditorLabel = (rowNode, binding, item, context) => {
5
6
  if (item.hasStyle('nonEditable') || item.hasStyle('heading')) {
6
7
  return renderingContext.renderPresenterLabel(rowNode, binding, item, context, true);
7
8
  }
8
9
 
9
- let label = item.getLabel();
10
+ let label = item.getEditLabel() || item.getLabel();
10
11
  if (label != null && label !== '') {
11
12
  label = label.charAt(0).toUpperCase() + label.slice(1);
12
13
  } else {
13
14
  label = '';
14
15
  }
15
16
  const $labelDiv = jquery('<div class="rdformsLabelRow">').appendTo(rowNode);
17
+ if (binding) {
18
+ $labelDiv.attr('id', context.view.createLabelIndex(binding));
19
+ }
16
20
  context.labelNode = $labelDiv[0];
17
21
  const $label = jquery('<span class="rdformsLabel">').text(label).appendTo($labelDiv);
18
22
  const card = item.getCardinality();
@@ -49,32 +53,23 @@ renderingContext.renderEditorLabel = (rowNode, binding, item, context) => {
49
53
  }
50
54
  return undefined;
51
55
  };
52
- // TODO this is listening for any click and popover showings... too much! especially considering
53
- // that is being used in another application. Rewrite!
54
- jquery(document).ready(() => {
55
- jquery(document.body).on('show.bs.popover click', (e) => {
56
- jquery('[data-toggle="popover"]').each((node, a) => {
57
- if (e.target.innerHTML !== a.innerHTML) {
58
- jquery(a).popover('hide');
59
- }
60
- });
61
- });
62
- });
63
56
 
64
- renderingContext.attachItemInfo = function (item, aroundNode/* , context */) {
65
- if (item == null || (item.getProperty() == null && item.getDescription() == null)) {
57
+ renderingContext.attachItemInfo = function (item, aroundNode, context) {
58
+ if (item == null || (item.getProperty() == null && item.getDescription() == null
59
+ && item.getEditDescription() == null)) {
66
60
  jquery(aroundNode).addClass('noPointer');
67
61
  return;
68
62
  }
69
63
 
70
- const description = item.getDescription() || '';
64
+ const description = (context.view instanceof Editor ?
65
+ item.getEditDescription() || item.getDescription() : item.getDescription()) || '';
71
66
  let propinfo = '';
72
67
  if (item.getProperty()) {
73
68
  propinfo = `<div class="property"><a target="_blank" href="${item.getProperty()}">${
74
69
  item.getProperty()}</a></div>`;
75
70
  }
76
71
 
77
- let label = item.getLabel();
72
+ let label = context.view instanceof Editor ? item.getEditLabel() || item.getLabel() : item.getLabel();
78
73
  if (label != null && label !== '') {
79
74
  label = label.charAt(0).toUpperCase() + label.slice(1);
80
75
  } else {
@@ -84,7 +79,7 @@ renderingContext.attachItemInfo = function (item, aroundNode/* , context */) {
84
79
  html: true,
85
80
  container: renderingContext.getPopoverContainer(),
86
81
  placement: 'auto',
87
- trigger: 'click focus',
82
+ trigger: 'focus',
88
83
  title: label,
89
84
  content: `<div class="description">${
90
85
  description.replace(/(\r\n|\r|\n)/g, '<br/>')
@@ -32,6 +32,17 @@
32
32
  background-color: lightcoral;
33
33
  }
34
34
 
35
+ .rdformsHelp {
36
+ color: red;
37
+ font-size: small;
38
+ display: none;
39
+ padding: 2px 0 6px;
40
+ }
41
+
42
+ .rdformsHelp.rdformsHelpActive {
43
+ display: block;
44
+ }
45
+
35
46
  .rdformsDateValue .rdformsDatepicker {
36
47
  width: 12em;
37
48
  display: inline-block;
@@ -2,6 +2,7 @@ import renderingContext from '../renderingContext';
2
2
  import * as engine from '../../model/engine';
3
3
  import utils from '../../utils';
4
4
  import jquery from 'jquery';
5
+ import Editor from '../Editor';
5
6
 
6
7
 
7
8
  const createChildBindingsForFirstFixedColumn = (bindings/* , context*/) => {
@@ -108,8 +109,11 @@ renderingContext.addEditorTable = (newRow, firstBinding, context) => {
108
109
  for (colInd = 0; colInd < childItems.length; colInd++) {
109
110
  const $th = jquery('<th>').appendTo($tHeadRow);
110
111
  jquery($th).addClass(`rdformsColumnHeader${colInd}`);
112
+ const childItem = childItems[colInd];
113
+ const label = context.view instanceof Editor ?
114
+ childItem.getEditLabel() || childItem.getLabel() : childItem.getLabel();
111
115
  renderingContext.attachItemInfo(item,
112
- jquery('<span>').text(childItems[colInd].getLabel()).appendTo($th)[0], context);
116
+ jquery('<span>').text(label).appendTo($th)[0], context);
113
117
  }
114
118
  if (!firstBinding.getItem().hasStyle('firstcolumnfixedtable')) {
115
119
  const $addTh = jquery('<th>').addClass('rdformsTableControl').appendTo($tHeadRow);