@entryscape/rdforms 10.6.2 → 10.7.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.
- 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 +79 -77
- package/package.json +4 -3
- package/src/template/Item.js +2 -1
- package/src/view/Presenter.js +32 -3
- package/src/view/Registry.js +1 -1
- package/src/view/ValidationPresenter.js +2 -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 +18 -1
- 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 +24 -15
- 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 +46 -15
- 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 +9 -5
- 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/nls.json +1 -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/src/view/react/style.css
CHANGED
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.rdformsEditor .rdformsLangControl {
|
|
136
|
-
width: calc(33.33% -
|
|
136
|
+
width: calc(33.33% - 4px);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/* Duration */
|
|
@@ -205,10 +205,6 @@ div.MuiTooltip-tooltip {
|
|
|
205
205
|
margin-right: 11px;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
.rdformsEditor .rdformsLangControl {
|
|
209
|
-
width: calc(33.33% - 8px);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
208
|
.rdformsDependency {
|
|
213
209
|
display: none;
|
|
214
210
|
}
|
|
@@ -227,4 +223,12 @@ div.MuiTooltip-tooltip {
|
|
|
227
223
|
font-size: 10px;
|
|
228
224
|
font-weight: bolder;
|
|
229
225
|
font-family: sans-serif;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.rdformsHeading>.rdformsDescription {
|
|
229
|
+
margin: -20px 0 20px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.Mui-disabled.rdformsDatatypeOption {
|
|
233
|
+
color: red;
|
|
230
234
|
}
|
package/src/view/react/text.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect, useMemo } from 'react';
|
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import system from '../../model/system';
|
|
5
5
|
import renderingContext from '../renderingContext';
|
|
6
|
-
import { fromDuration } from '
|
|
6
|
+
import { fromDuration } from '../viewUtils';
|
|
7
7
|
import utils from '../../utils';
|
|
8
8
|
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ presenters.itemtype('text').datatype('xsd:duration').register((fieldDiv, binding
|
|
|
13
13
|
const data = fromDuration(binding.getValue());
|
|
14
14
|
const keys = ['years', 'months', 'days', 'hours', 'minutes'];
|
|
15
15
|
fieldDiv.appendChild(<div key={binding.getHash()}>{keys.map(key => (
|
|
16
|
-
data[key] && <React.Fragment key={key}><span className="
|
|
16
|
+
data[key] && <React.Fragment key={key}><span className="durationLabel">{
|
|
17
17
|
context.view.messages[`duration_${key}`]}:</span><span className="durationValue">{data[key]}</span></React.Fragment>
|
|
18
18
|
))}</div>);
|
|
19
19
|
});
|
|
@@ -10,6 +10,7 @@ import Select from '@mui/material/Select';
|
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import renderingContext from '../renderingContext';
|
|
12
12
|
import utils from '../../utils';
|
|
13
|
+
import { useNamedGraphId } from './hooks';
|
|
13
14
|
|
|
14
15
|
const LanguageControl = (props) => {
|
|
15
16
|
const [lang, setLang] = useState(props.binding.getLanguage() || '');
|
|
@@ -38,10 +39,12 @@ const LanguageControl = (props) => {
|
|
|
38
39
|
};
|
|
39
40
|
}, []);
|
|
40
41
|
|
|
42
|
+
const ngId = useNamedGraphId(props.binding, props.context);
|
|
41
43
|
return <FormControl className="rdformsLangControl" variant={renderingContext.materialVariant}>
|
|
42
44
|
<Select
|
|
43
45
|
inputProps={{ 'aria-labelledby': props.labelledby }}
|
|
44
46
|
value={lang}
|
|
47
|
+
disabled={!!ngId}
|
|
45
48
|
onChange={onLangChange}>
|
|
46
49
|
{langs.map(langOption => (langOption === null ?
|
|
47
50
|
(<MenuItem key="_none" value="_none" disabled>─────</MenuItem>) :
|
|
@@ -90,11 +93,13 @@ editors.itemtype('text').register((fieldDiv, binding, context) => {
|
|
|
90
93
|
},
|
|
91
94
|
};
|
|
92
95
|
const bundle = context.view.messages;
|
|
96
|
+
const ngId = useNamedGraphId(binding, context);
|
|
93
97
|
return <><TextField
|
|
94
98
|
className={extLink || langlit ? 'rdformsTwoThirds' : ''}
|
|
95
99
|
multiline={multiline}
|
|
96
100
|
placeholder={item.getPlaceholder()}
|
|
97
101
|
error={!valid}
|
|
102
|
+
disabled={!!ngId}
|
|
98
103
|
helperText={!valid ? item.getHelp() || '' : ''}
|
|
99
104
|
variant={renderingContext.materialVariant} inputProps={iprops}
|
|
100
105
|
/>{extLink && (value != null || value === '') &&
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
1
2
|
import Registry from './Registry';
|
|
2
3
|
import system from '../model/system';
|
|
3
4
|
import nls from './resources/nls';
|
|
@@ -328,7 +329,9 @@ const groupPresenter = (fieldDiv, binding, context) => {
|
|
|
328
329
|
messages: context.view.messages,
|
|
329
330
|
binding,
|
|
330
331
|
topLevel: false,
|
|
332
|
+
compact: context.view.compact,
|
|
331
333
|
showLanguage: context.view.showLanguage,
|
|
334
|
+
showDescription: context.view.showDescription,
|
|
332
335
|
defaultLanguage: context.view.defaultLanguage,
|
|
333
336
|
filterTranslations: context.view.filterTranslations,
|
|
334
337
|
includeLevel: context.view.includeLevel, // Copied from groupEditor, was this.includeLevel but that 'this' does not make sense here
|
|
@@ -346,6 +349,8 @@ const groupEditor = (fieldDiv, binding, context) => {
|
|
|
346
349
|
languages: context.view.languages,
|
|
347
350
|
binding,
|
|
348
351
|
topLevel: false,
|
|
352
|
+
compact: context.view.compact,
|
|
353
|
+
showDescription: context.view.showDescription,
|
|
349
354
|
includeLevel: context.view.includeLevel,
|
|
350
355
|
}, fieldDiv);
|
|
351
356
|
context.view._subEditors.push(subView);
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
"missingValueField": "This field is required, please provide a value.",
|
|
55
55
|
"dependencyField": "This field depends on another field, please review the field it depends on or remove this value.",
|
|
56
56
|
"wrongValueField": "This is an invalid value, please change or remove it.",
|
|
57
|
+
"wrongDatatypeField": "The value has an invalid datatype, please change or remove it.",
|
|
57
58
|
"openLinkExternally": "Open link externally"
|
|
58
59
|
}
|
|
@@ -136,11 +136,11 @@ a.rdformsUrl:hover {
|
|
|
136
136
|
|
|
137
137
|
/* compact anyway for first level*/
|
|
138
138
|
.compact .rdformsTopLevel.rdformsRow.notCompact {
|
|
139
|
-
display:
|
|
139
|
+
display: inherit;
|
|
140
140
|
width: 98%;
|
|
141
141
|
}
|
|
142
142
|
.compact .rdformsTopLevel.rdformsRow.notCompact>div {
|
|
143
|
-
display:
|
|
143
|
+
display: block;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
.compact .rdformsTopLevel.rdformsRow.rdformsHeading.notCompact>div {
|
|
@@ -151,6 +151,27 @@ a.rdformsUrl:hover {
|
|
|
151
151
|
margin-left: 0px;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
.compact .rdformsRow.notCompact {
|
|
155
|
+
display: block;
|
|
156
|
+
width: auto;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.compact .rdformsRow.notCompact>div {
|
|
160
|
+
display: inherit;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.rdformsPresenter .rdformsRow.rdformsCompactItem {
|
|
164
|
+
display: table;
|
|
165
|
+
width: 98%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rdformsPresenter .rdformsRow.rdformsCompactItem>.rdformsLabel {
|
|
169
|
+
width: 10em;
|
|
170
|
+
}
|
|
171
|
+
.rdformsPresenter .rdformsRow.rdformsCompactItem>div {
|
|
172
|
+
display: table-cell;
|
|
173
|
+
}
|
|
174
|
+
|
|
154
175
|
/* compact anyway for first level*/
|
|
155
176
|
.compact .rdformsTopLevel.rdformsRow.rdformsHeading>.rdformsFields>.rdformsGroup>.rdformsRow {
|
|
156
177
|
display: table;
|
|
@@ -161,6 +182,16 @@ a.rdformsUrl:hover {
|
|
|
161
182
|
display: table-cell;
|
|
162
183
|
}
|
|
163
184
|
|
|
185
|
+
.compact .rdformsTopLevel.rdformsRow.rdformsHeading>.rdformsFields>.rdformsGroup>.rdformsRow.notCompact {
|
|
186
|
+
display: inherit;
|
|
187
|
+
width: auto;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.compact .rdformsTopLevel.rdformsRow.rdformsHeading>.rdformsFields>.rdformsGroup>.rdformsRow.notCompact>div {
|
|
191
|
+
display: inherit;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
164
195
|
|
|
165
196
|
|
|
166
197
|
.rdformsImage {
|
|
@@ -420,10 +451,6 @@ a.rdformsUrl:hover {
|
|
|
420
451
|
padding-left: 0px;
|
|
421
452
|
}
|
|
422
453
|
|
|
423
|
-
.rdformsValidator .rdformsValidationMessageWrapper {
|
|
424
|
-
margin-left: -30px;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
454
|
.rdformsValidator .rdformsField.error {
|
|
428
455
|
color: red;
|
|
429
456
|
}
|
|
@@ -484,18 +511,8 @@ a.rdformsUrl:hover {
|
|
|
484
511
|
padding-left: 0px;
|
|
485
512
|
}
|
|
486
513
|
|
|
487
|
-
.compact .rdformsRow.notCompact {
|
|
488
|
-
display: block;
|
|
489
|
-
width: auto;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.compact .rdformsRow.notCompact>div {
|
|
493
|
-
display: inherit;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
514
|
.compact .rdformsRow>.rdformsLabelRow {
|
|
497
|
-
|
|
498
|
-
white-space: nowrap;
|
|
515
|
+
white-space: nowrap;
|
|
499
516
|
}
|
|
500
517
|
|
|
501
518
|
.compact .rdformsTopLevel.rdformsRow>.rdformsLabelRow .action {
|
|
@@ -717,4 +734,9 @@ a.rdformsUrl:hover {
|
|
|
717
734
|
.rdformsDeprecated {
|
|
718
735
|
border: 2px solid red;
|
|
719
736
|
padding: 12px;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.rdformsDescription {
|
|
740
|
+
font-style: italic;
|
|
741
|
+
margin-bottom: 10px;
|
|
720
742
|
}
|
|
@@ -32,6 +32,7 @@ export const toDuration = (data) => {
|
|
|
32
32
|
return null;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
export const getDate = (value) => {
|
|
36
37
|
try {
|
|
37
38
|
// xsd:time
|
|
@@ -199,3 +200,13 @@ export const getDatePresentation = (binding) => {
|
|
|
199
200
|
}
|
|
200
201
|
return undefined;
|
|
201
202
|
};
|
|
203
|
+
|
|
204
|
+
export const getNamedGraphId = (binding, context) => {
|
|
205
|
+
const ng = (binding.getStatement() || binding.getParent().getStatement())?.getNamedGraph();
|
|
206
|
+
if (ng) {
|
|
207
|
+
let view = context.view;
|
|
208
|
+
while (view.getParentView()) view = view.getParentView();
|
|
209
|
+
return view.getNamedGraphId(ng);
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
package/src/view/react/util.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export const fromDuration = (value) => {
|
|
2
|
-
const f = val => (val && val.length > 1 ? parseInt(val[0], 10) : 0);
|
|
3
|
-
const years = f(value.match(/([0-9])*Y/));
|
|
4
|
-
const days = f(value.match(/([0-9])*D/));
|
|
5
|
-
const hours = f(value.match(/([0-9])*H/));
|
|
6
|
-
let months;
|
|
7
|
-
let minutes;
|
|
8
|
-
if (value.indexOf('T') === -1) {
|
|
9
|
-
months = f(value.match(/([0-9])*M/));
|
|
10
|
-
} else {
|
|
11
|
-
const arr = value.split('T');
|
|
12
|
-
months = f(arr[0].match(/([0-9])*M/));
|
|
13
|
-
minutes = f(arr[1].match(/([0-9])*M/));
|
|
14
|
-
}
|
|
15
|
-
return { years, months, days, hours, minutes };
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const toDuration = (data) => {
|
|
19
|
-
if (data.years || data.months || data.days || data.hours || data.minutes) {
|
|
20
|
-
let str = `P${data.years ? `${data.years}Y` : ''
|
|
21
|
-
}${data.months ? `${data.months}M` : ''
|
|
22
|
-
}${data.days ? `${data.days}D` : ''}`;
|
|
23
|
-
if (data.hours || data.minutes) {
|
|
24
|
-
str = `${str}T${
|
|
25
|
-
data.hours ? `${data.hours}H` : ''
|
|
26
|
-
}${data.minutes ? `${data.minutes}M` : ''}`;
|
|
27
|
-
}
|
|
28
|
-
return str;
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
31
|
-
};
|