@luomus/laji-form 15.1.22 → 15.1.24
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/laji-form.js +1 -1
- package/lib/components/fields/AutoArrayField.d.ts +1 -1
- package/lib/components/fields/AutoArrayField.js +1 -1
- package/lib/components/fields/AutosuggestField.d.ts +1 -1
- package/lib/components/fields/AutosuggestField.js +1 -1
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +1 -1
- package/lib/components/fields/ConditionalUiSchemaField.js +1 -1
- package/lib/components/fields/ExtraLabelRowField.d.ts +1 -1
- package/lib/components/fields/ExtraLabelRowField.js +1 -1
- package/lib/components/fields/FilterArrayField.d.ts +1 -1
- package/lib/components/fields/FilterArrayField.js +1 -1
- package/lib/components/fields/LocationChooserField.js +1 -1
- package/lib/components/fields/MapField.d.ts +1 -1
- package/lib/components/fields/MapField.js +1 -1
- package/lib/components/fields/MultiArrayField.d.ts +1 -1
- package/lib/components/fields/MultiArrayField.js +1 -1
- package/lib/components/fields/NamedPlaceChooserField.js +1 -1
- package/lib/components/fields/NamedPlaceSaverField.js +10 -10
- package/lib/components/fields/ScopeField.d.ts +1 -1
- package/lib/components/fields/ScopeField.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ export default class AutoArrayField extends React.Component<any, any, any> {
|
|
|
2
2
|
static propTypes: {
|
|
3
3
|
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
4
4
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
5
|
-
autofocus:
|
|
5
|
+
autofocus: PropTypes.Requireable<boolean>;
|
|
6
6
|
}>>;
|
|
7
7
|
}>>;
|
|
8
8
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -42,7 +42,7 @@ let AutoArrayField = class AutoArrayField extends React.Component {
|
|
|
42
42
|
AutoArrayField.propTypes = {
|
|
43
43
|
uiSchema: PropTypes.shape({
|
|
44
44
|
"ui:options": PropTypes.shape({
|
|
45
|
-
autofocus: PropTypes.
|
|
45
|
+
autofocus: PropTypes.bool
|
|
46
46
|
})
|
|
47
47
|
}),
|
|
48
48
|
schema: PropTypes.shape({
|
|
@@ -20,7 +20,7 @@ export default class AutosuggestField extends React.Component<any, any, any> {
|
|
|
20
20
|
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
21
21
|
autosuggestField: PropTypes.Validator<string>;
|
|
22
22
|
suggestionInputField: PropTypes.Validator<string>;
|
|
23
|
-
allowNonsuggestedValue:
|
|
23
|
+
allowNonsuggestedValue: PropTypes.Requireable<boolean>;
|
|
24
24
|
suggestionReceivers: PropTypes.Validator<object>;
|
|
25
25
|
inputTransformer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
26
|
regexp: PropTypes.Validator<string>;
|
|
@@ -281,7 +281,7 @@ AutosuggestField.propTypes = {
|
|
|
281
281
|
"ui:options": PropTypes.shape({
|
|
282
282
|
autosuggestField: PropTypes.string.isRequired,
|
|
283
283
|
suggestionInputField: PropTypes.string.isRequired,
|
|
284
|
-
allowNonsuggestedValue: PropTypes.
|
|
284
|
+
allowNonsuggestedValue: PropTypes.bool,
|
|
285
285
|
suggestionReceivers: PropTypes.object.isRequired,
|
|
286
286
|
inputTransformer: PropTypes.shape({
|
|
287
287
|
regexp: PropTypes.string.isRequired,
|
|
@@ -103,7 +103,7 @@ export default class ConditionalUiSchemaField extends React.Component<any, any,
|
|
|
103
103
|
uiSchema: PropTypes.Validator<object>;
|
|
104
104
|
}> | null | undefined)[]>;
|
|
105
105
|
}> | null | undefined)[]>;
|
|
106
|
-
cache:
|
|
106
|
+
cache: PropTypes.Requireable<boolean>;
|
|
107
107
|
}>>;
|
|
108
108
|
}>>;
|
|
109
109
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -8,7 +8,7 @@ export default class ExtraLabelRowField extends React.Component<any, any, any> {
|
|
|
8
8
|
md: PropTypes.Requireable<number | object>;
|
|
9
9
|
sm: PropTypes.Requireable<number | object>;
|
|
10
10
|
xs: PropTypes.Requireable<number | object>;
|
|
11
|
-
hiddenXs:
|
|
11
|
+
hiddenXs: PropTypes.Requireable<boolean>;
|
|
12
12
|
}>>;
|
|
13
13
|
}>>;
|
|
14
14
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -86,7 +86,7 @@ ExtraLabelRowField.propTypes = {
|
|
|
86
86
|
md: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
87
87
|
sm: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
88
88
|
xs: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
89
|
-
hiddenXs: PropTypes.
|
|
89
|
+
hiddenXs: PropTypes.bool
|
|
90
90
|
})
|
|
91
91
|
}).isRequired,
|
|
92
92
|
schema: PropTypes.shape({
|
|
@@ -48,7 +48,7 @@ export default class FilterArrayField extends React.Component<any, any, any> {
|
|
|
48
48
|
isLast: PropTypes.Requireable<number>;
|
|
49
49
|
complement: PropTypes.Requireable<boolean>;
|
|
50
50
|
}> | null | undefined)[]>;
|
|
51
|
-
cache:
|
|
51
|
+
cache: PropTypes.Requireable<boolean>;
|
|
52
52
|
}>>;
|
|
53
53
|
}>>;
|
|
54
54
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -246,7 +246,7 @@ class LocationButton extends React.Component {
|
|
|
246
246
|
if (!geometryRef || !geometryRef.type) {
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
|
-
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props,
|
|
249
|
+
that.props.onChange(utils_1.updateFormDataWithJSONPointer(that.props, undefined, geometryField));
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
252
|
case "edit": {
|
|
@@ -13,7 +13,7 @@ export default class MapField extends React.Component<any, any, any> {
|
|
|
13
13
|
mapOptions: PropTypes.Requireable<object>;
|
|
14
14
|
height: PropTypes.Requireable<number>;
|
|
15
15
|
emptyHelp: PropTypes.Requireable<string>;
|
|
16
|
-
geometryCollection:
|
|
16
|
+
geometryCollection: PropTypes.Requireable<boolean>;
|
|
17
17
|
}>>;
|
|
18
18
|
}>>;
|
|
19
19
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -32,7 +32,7 @@ export default class MultiArrayField extends React.Component<any, any, any> {
|
|
|
32
32
|
type: PropTypes.Requireable<string>;
|
|
33
33
|
uiSchema: PropTypes.Validator<object>;
|
|
34
34
|
}> | null | undefined)[]>;
|
|
35
|
-
cache:
|
|
35
|
+
cache: PropTypes.Requireable<boolean>;
|
|
36
36
|
}>>;
|
|
37
37
|
}>>;
|
|
38
38
|
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
@@ -187,7 +187,7 @@ MultiArrayField.propTypes = {
|
|
|
187
187
|
ConditionalUiSchemaField_1.operationPropType,
|
|
188
188
|
PropTypes.arrayOf(ConditionalUiSchemaField_1.operationPropType)
|
|
189
189
|
]),
|
|
190
|
-
cache: PropTypes.
|
|
190
|
+
cache: PropTypes.bool
|
|
191
191
|
})
|
|
192
192
|
}),
|
|
193
193
|
schema: PropTypes.shape({
|
|
@@ -89,7 +89,7 @@ let NamedPlaceChooserField = class NamedPlaceChooserField extends React.Componen
|
|
|
89
89
|
};
|
|
90
90
|
this.onPlaceDeleted = (place, success) => {
|
|
91
91
|
this.apiClient.fetchRaw(`/named-places/${place.id}`, undefined, { method: "DELETE" }).then(response => {
|
|
92
|
-
if (response.status
|
|
92
|
+
if (response.status < 400) {
|
|
93
93
|
// It takes a while for API to remove the place, so we remove it locally and then invalidate again after some time.
|
|
94
94
|
this.removeIds[place.id] = true;
|
|
95
95
|
this.apiClient.invalidateCachePath("/named-places");
|
|
@@ -27,6 +27,7 @@ const ReactContext_1 = require("../../ReactContext");
|
|
|
27
27
|
const BaseComponent_1 = require("../BaseComponent");
|
|
28
28
|
const Spinner = require("react-spinner");
|
|
29
29
|
const MapArrayField_1 = require("./MapArrayField");
|
|
30
|
+
const memoize = require("memoizee");
|
|
30
31
|
const SAVE = "SAVE", FETCH = "FETCH";
|
|
31
32
|
/**
|
|
32
33
|
* Compatible only with gathering field.
|
|
@@ -110,18 +111,17 @@ class PlaceSaverDialog extends React.Component {
|
|
|
110
111
|
prepopulatedDocument: { gatherings: [gathering] }
|
|
111
112
|
});
|
|
112
113
|
};
|
|
113
|
-
this.
|
|
114
|
-
const { namedPlaceID } = this.props.gathering;
|
|
114
|
+
this.onOverwriteCurrentFor = memoize((namedPlaceID) => () => {
|
|
115
115
|
const gathering = this.getGathering(); //eslint-disable-line no-unused-vars
|
|
116
116
|
this.onSave(Object.assign(Object.assign({}, this.state.placeIdsToPlaces[namedPlaceID]), { name: this.state.value, prepopulatedDocument: { gatherings: [gathering] } }));
|
|
117
|
-
};
|
|
118
|
-
this.onOverwriteSelected = (place) => () => {
|
|
117
|
+
});
|
|
118
|
+
this.onOverwriteSelected = memoize((place) => () => {
|
|
119
119
|
const gathering = this.getGathering(); //eslint-disable-line no-unused-vars
|
|
120
120
|
this.onSave(Object.assign(Object.assign({}, place), { name: this.state.value, prepopulatedDocument: { gatherings: [gathering] } }));
|
|
121
|
-
};
|
|
122
|
-
this.
|
|
123
|
-
this.onOverwriteSelected(
|
|
124
|
-
};
|
|
121
|
+
});
|
|
122
|
+
this.onOverwriteExistingFor = memoize((place) => () => {
|
|
123
|
+
this.onOverwriteSelected(place)();
|
|
124
|
+
});
|
|
125
125
|
// Hack that fixed autofocus cursor position
|
|
126
126
|
this.onFocus = (e) => {
|
|
127
127
|
var val = e.target.value;
|
|
@@ -219,9 +219,9 @@ class PlaceSaverDialog extends React.Component {
|
|
|
219
219
|
getButton(this.onSaveNew, `${translations.Save} ${translations.new}`) : null,
|
|
220
220
|
" ",
|
|
221
221
|
this.props.gathering.namedPlaceID ?
|
|
222
|
-
getButton(this.
|
|
222
|
+
getButton(this.onOverwriteCurrentFor(this.props.gathering.namedPlaceID), translations.SaveCurrentOverwrite) : null,
|
|
223
223
|
existingPlaces.length === 1 && !this.props.gathering.namedPlaceID ?
|
|
224
|
-
getButton(this.
|
|
224
|
+
getButton(this.onOverwriteExistingFor(existingPlaces[0]), translations.SaveExistingOverwrite) : null),
|
|
225
225
|
loading ? React.createElement("div", { className: "pull-right" },
|
|
226
226
|
React.createElement(Spinner, null)) : null),
|
|
227
227
|
!this.props.gathering.namedPlaceID && existingPlaces.length ?
|
|
@@ -35,7 +35,7 @@ export default class ScopeField extends React.Component<any, any, any> {
|
|
|
35
35
|
static propTypes: {
|
|
36
36
|
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
37
37
|
"ui:options": PropTypes.Validator<PropTypes.InferProps<{
|
|
38
|
-
includeAdditionalFieldsChooserButton:
|
|
38
|
+
includeAdditionalFieldsChooserButton: PropTypes.Requireable<boolean>;
|
|
39
39
|
additionalsGroupingPath: PropTypes.Requireable<string>;
|
|
40
40
|
additionalsGroupsTranslator: PropTypes.Requireable<string>;
|
|
41
41
|
additionalsPersistenceKey: PropTypes.Requireable<string>;
|
|
@@ -453,7 +453,7 @@ ScopeField.contextType = ReactContext_1.default;
|
|
|
453
453
|
ScopeField.propTypes = {
|
|
454
454
|
uiSchema: PropTypes.shape({
|
|
455
455
|
"ui:options": PropTypes.shape({
|
|
456
|
-
includeAdditionalFieldsChooserButton: PropTypes.
|
|
456
|
+
includeAdditionalFieldsChooserButton: PropTypes.bool,
|
|
457
457
|
additionalsGroupingPath: PropTypes.string,
|
|
458
458
|
additionalsGroupsTranslator: PropTypes.oneOf(Object.keys(scopeFieldSettings)),
|
|
459
459
|
additionalsPersistenceKey: PropTypes.string,
|