@luomus/laji-form 15.1.0 → 15.1.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/CHANGELOG.md +0 -4
- package/dist/laji-form.js +1 -1
- package/jsonconfig.json +26 -0
- package/migrate.sh +0 -1
- package/package.json +8 -8
- package/test-export/test-utils.d.ts +100 -54
- package/test-export/test-utils.js +102 -84
- package/xsel -b +9 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and closes suggestion list (failed).png +0 -0
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and is marked as suggested (failed).png +0 -0
- package/lib/ApiClient.d.ts +0 -46
- package/lib/ApiClient.js +0 -93
- package/lib/Context.d.ts +0 -8
- package/lib/Context.js +0 -18
- package/lib/ReactContext.d.ts +0 -7
- package/lib/ReactContext.js +0 -5
- package/lib/components/BaseComponent.d.ts +0 -9
- package/lib/components/BaseComponent.js +0 -29
- package/lib/components/LajiForm.d.ts +0 -221
- package/lib/components/LajiForm.js +0 -615
- package/lib/components/VirtualSchemaField.d.ts +0 -42
- package/lib/components/VirtualSchemaField.js +0 -74
- package/lib/components/components.d.ts +0 -119
- package/lib/components/components.js +0 -606
- package/lib/components/fields/AnnotationField.d.ts +0 -34
- package/lib/components/fields/AnnotationField.js +0 -242
- package/lib/components/fields/AnyToBooleanField.d.ts +0 -18
- package/lib/components/fields/AnyToBooleanField.js +0 -20
- package/lib/components/fields/ArrayBulkField.d.ts +0 -23
- package/lib/components/fields/ArrayBulkField.js +0 -82
- package/lib/components/fields/ArrayCombinerField.d.ts +0 -36
- package/lib/components/fields/ArrayCombinerField.js +0 -138
- package/lib/components/fields/ArrayField.d.ts +0 -39
- package/lib/components/fields/ArrayField.js +0 -148
- package/lib/components/fields/AudioArrayField.d.ts +0 -22
- package/lib/components/fields/AudioArrayField.js +0 -100
- package/lib/components/fields/AutoArrayField.d.ts +0 -24
- package/lib/components/fields/AutoArrayField.js +0 -56
- package/lib/components/fields/AutosuggestField.d.ts +0 -69
- package/lib/components/fields/AutosuggestField.js +0 -299
- package/lib/components/fields/CombinedValueDisplayField.d.ts +0 -41
- package/lib/components/fields/CombinedValueDisplayField.js +0 -100
- package/lib/components/fields/ConditionalOnChangeField.d.ts +0 -42
- package/lib/components/fields/ConditionalOnChangeField.js +0 -107
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +0 -123
- package/lib/components/fields/ConditionalUiSchemaField.js +0 -143
- package/lib/components/fields/ContextInjectionField.d.ts +0 -24
- package/lib/components/fields/ContextInjectionField.js +0 -68
- package/lib/components/fields/DataLeakerField.d.ts +0 -40
- package/lib/components/fields/DataLeakerField.js +0 -68
- package/lib/components/fields/DefaultValueArrayField.d.ts +0 -34
- package/lib/components/fields/DefaultValueArrayField.js +0 -59
- package/lib/components/fields/DependentBooleanField.d.ts +0 -38
- package/lib/components/fields/DependentBooleanField.js +0 -87
- package/lib/components/fields/DependentDisableField.d.ts +0 -35
- package/lib/components/fields/DependentDisableField.js +0 -71
- package/lib/components/fields/EnumRangeArrayField.d.ts +0 -27
- package/lib/components/fields/EnumRangeArrayField.js +0 -115
- package/lib/components/fields/ExtraLabelRowField.d.ts +0 -38
- package/lib/components/fields/ExtraLabelRowField.js +0 -100
- package/lib/components/fields/FakePropertyField.d.ts +0 -18
- package/lib/components/fields/FakePropertyField.js +0 -48
- package/lib/components/fields/FilterArrayField.d.ts +0 -73
- package/lib/components/fields/FilterArrayField.js +0 -121
- package/lib/components/fields/FlatField.d.ts +0 -29
- package/lib/components/fields/FlatField.js +0 -171
- package/lib/components/fields/GeocoderField.d.ts +0 -47
- package/lib/components/fields/GeocoderField.js +0 -372
- package/lib/components/fields/GridLayoutField.d.ts +0 -18
- package/lib/components/fields/GridLayoutField.js +0 -32
- package/lib/components/fields/HiddenField.d.ts +0 -10
- package/lib/components/fields/HiddenField.js +0 -11
- package/lib/components/fields/ImageArrayField.d.ts +0 -172
- package/lib/components/fields/ImageArrayField.js +0 -697
- package/lib/components/fields/ImageDisplayField.d.ts +0 -18
- package/lib/components/fields/ImageDisplayField.js +0 -44
- package/lib/components/fields/InitiallyHiddenField.d.ts +0 -21
- package/lib/components/fields/InitiallyHiddenField.js +0 -58
- package/lib/components/fields/InjectDefaultValueField.d.ts +0 -37
- package/lib/components/fields/InjectDefaultValueField.js +0 -68
- package/lib/components/fields/InjectField.d.ts +0 -46
- package/lib/components/fields/InjectField.js +0 -88
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +0 -25
- package/lib/components/fields/InputWithDefaultValueButtonField.js +0 -61
- package/lib/components/fields/LocalityField.d.ts +0 -22
- package/lib/components/fields/LocalityField.js +0 -94
- package/lib/components/fields/LocationChooserField.d.ts +0 -27
- package/lib/components/fields/LocationChooserField.js +0 -440
- package/lib/components/fields/MapArrayField.d.ts +0 -78
- package/lib/components/fields/MapArrayField.js +0 -1783
- package/lib/components/fields/MapField.d.ts +0 -48
- package/lib/components/fields/MapField.js +0 -434
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +0 -25
- package/lib/components/fields/MultiAnyToBooleanField.js +0 -100
- package/lib/components/fields/MultiArrayField.d.ts +0 -53
- package/lib/components/fields/MultiArrayField.js +0 -224
- package/lib/components/fields/MultiLanguageField.d.ts +0 -13
- package/lib/components/fields/MultiLanguageField.js +0 -52
- package/lib/components/fields/MultiTagArrayField.d.ts +0 -36
- package/lib/components/fields/MultiTagArrayField.js +0 -142
- package/lib/components/fields/NamedPlaceChooserField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceChooserField.js +0 -380
- package/lib/components/fields/NamedPlaceSaverField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceSaverField.js +0 -237
- package/lib/components/fields/NestField.d.ts +0 -148
- package/lib/components/fields/NestField.js +0 -289
- package/lib/components/fields/ObjectField.d.ts +0 -2
- package/lib/components/fields/ObjectField.js +0 -119
- package/lib/components/fields/PdfArrayField.d.ts +0 -21
- package/lib/components/fields/PdfArrayField.js +0 -40
- package/lib/components/fields/PrefillingArrayField.d.ts +0 -22
- package/lib/components/fields/PrefillingArrayField.js +0 -65
- package/lib/components/fields/SchemaField.d.ts +0 -7
- package/lib/components/fields/SchemaField.js +0 -109
- package/lib/components/fields/ScopeField.d.ts +0 -85
- package/lib/components/fields/ScopeField.js +0 -521
- package/lib/components/fields/SectionArrayField.d.ts +0 -38
- package/lib/components/fields/SectionArrayField.js +0 -618
- package/lib/components/fields/SelectTreeField.d.ts +0 -39
- package/lib/components/fields/SelectTreeField.js +0 -143
- package/lib/components/fields/SingleActiveArrayField.d.ts +0 -49
- package/lib/components/fields/SingleActiveArrayField.js +0 -974
- package/lib/components/fields/SingleItemArrayField.d.ts +0 -15
- package/lib/components/fields/SingleItemArrayField.js +0 -60
- package/lib/components/fields/SortArrayField.d.ts +0 -73
- package/lib/components/fields/SortArrayField.js +0 -351
- package/lib/components/fields/SplitField.d.ts +0 -28
- package/lib/components/fields/SplitField.js +0 -65
- package/lib/components/fields/StringToArrayField.d.ts +0 -24
- package/lib/components/fields/StringToArrayField.js +0 -48
- package/lib/components/fields/SumField.d.ts +0 -35
- package/lib/components/fields/SumField.js +0 -83
- package/lib/components/fields/TableField.d.ts +0 -18
- package/lib/components/fields/TableField.js +0 -136
- package/lib/components/fields/TagArrayField.d.ts +0 -38
- package/lib/components/fields/TagArrayField.js +0 -128
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -26
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +0 -81
- package/lib/components/fields/UiFieldApplierField.d.ts +0 -30
- package/lib/components/fields/UiFieldApplierField.js +0 -106
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +0 -42
- package/lib/components/fields/UiFieldMapperArrayField.js +0 -121
- package/lib/components/fields/UnitCountShorthandField.d.ts +0 -22
- package/lib/components/fields/UnitCountShorthandField.js +0 -149
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +0 -26
- package/lib/components/fields/UnitListShorthandArrayField.js +0 -108
- package/lib/components/fields/UnitShorthandField.d.ts +0 -32
- package/lib/components/fields/UnitShorthandField.js +0 -220
- package/lib/components/templates/ArrayFieldTemplate.d.ts +0 -85
- package/lib/components/templates/ArrayFieldTemplate.js +0 -417
- package/lib/components/templates/BaseInputTemplate.d.ts +0 -11
- package/lib/components/templates/BaseInputTemplate.js +0 -80
- package/lib/components/templates/DescriptionField.d.ts +0 -1
- package/lib/components/templates/DescriptionField.js +0 -37
- package/lib/components/templates/ErrorListTemplate.d.ts +0 -9
- package/lib/components/templates/ErrorListTemplate.js +0 -95
- package/lib/components/templates/FieldTemplate.d.ts +0 -6
- package/lib/components/templates/FieldTemplate.js +0 -112
- package/lib/components/templates/ObjectFieldTemplate.d.ts +0 -7
- package/lib/components/templates/ObjectFieldTemplate.js +0 -66
- package/lib/components/templates/TitleField.d.ts +0 -9
- package/lib/components/templates/TitleField.js +0 -51
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +0 -20
- package/lib/components/widgets/AnyToBooleanWidget.js +0 -49
- package/lib/components/widgets/AutosuggestWidget.d.ts +0 -66
- package/lib/components/widgets/AutosuggestWidget.js +0 -1127
- package/lib/components/widgets/CheckboxWidget.d.ts +0 -37
- package/lib/components/widgets/CheckboxWidget.js +0 -139
- package/lib/components/widgets/DateTimeWidget.d.ts +0 -62
- package/lib/components/widgets/DateTimeWidget.js +0 -251
- package/lib/components/widgets/DateWidget.d.ts +0 -23
- package/lib/components/widgets/DateWidget.js +0 -41
- package/lib/components/widgets/HiddenWidget.d.ts +0 -15
- package/lib/components/widgets/HiddenWidget.js +0 -19
- package/lib/components/widgets/ImageSelectWidget.d.ts +0 -14
- package/lib/components/widgets/ImageSelectWidget.js +0 -57
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +0 -43
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +0 -237
- package/lib/components/widgets/InputGroupWidget.d.ts +0 -21
- package/lib/components/widgets/InputGroupWidget.js +0 -36
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +0 -21
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +0 -47
- package/lib/components/widgets/NumberWidget.d.ts +0 -13
- package/lib/components/widgets/NumberWidget.js +0 -21
- package/lib/components/widgets/PlainTextWidget.d.ts +0 -12
- package/lib/components/widgets/PlainTextWidget.js +0 -24
- package/lib/components/widgets/SelectWidget.d.ts +0 -52
- package/lib/components/widgets/SelectWidget.js +0 -158
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +0 -19
- package/lib/components/widgets/SeparatedDateTimeWidget.js +0 -59
- package/lib/components/widgets/TaxonImageWidget.d.ts +0 -13
- package/lib/components/widgets/TaxonImageWidget.js +0 -30
- package/lib/components/widgets/TextSelectWidget.d.ts +0 -25
- package/lib/components/widgets/TextSelectWidget.js +0 -94
- package/lib/components/widgets/TextareaWidget.d.ts +0 -32
- package/lib/components/widgets/TextareaWidget.js +0 -87
- package/lib/components/widgets/TimeWidget.d.ts +0 -11
- package/lib/components/widgets/TimeWidget.js +0 -19
- package/lib/components/widgets/URLWidget.d.ts +0 -14
- package/lib/components/widgets/URLWidget.js +0 -12
- package/lib/components/widgets/UpperCaseWidget.d.ts +0 -13
- package/lib/components/widgets/UpperCaseWidget.js +0 -21
- package/lib/index.d.ts +0 -20
- package/lib/index.js +0 -50
- package/lib/services/blocker-service.d.ts +0 -11
- package/lib/services/blocker-service.js +0 -55
- package/lib/services/custom-event-service.d.ts +0 -17
- package/lib/services/custom-event-service.js +0 -35
- package/lib/services/dom-id-service.d.ts +0 -8
- package/lib/services/dom-id-service.js +0 -30
- package/lib/services/focus-service.d.ts +0 -13
- package/lib/services/focus-service.js +0 -60
- package/lib/services/id-service.d.ts +0 -22
- package/lib/services/id-service.js +0 -130
- package/lib/services/key-handler-service.d.ts +0 -56
- package/lib/services/key-handler-service.js +0 -184
- package/lib/services/root-instance-service.d.ts +0 -25
- package/lib/services/root-instance-service.js +0 -49
- package/lib/services/settings-service.d.ts +0 -34
- package/lib/services/settings-service.js +0 -154
- package/lib/services/singleton-map-service.d.ts +0 -23
- package/lib/services/singleton-map-service.js +0 -44
- package/lib/services/submit-hook-service.d.ts +0 -24
- package/lib/services/submit-hook-service.js +0 -73
- package/lib/styles.d.ts +0 -1
- package/lib/styles.js +0 -4
- package/lib/themes/bs3.d.ts +0 -3
- package/lib/themes/bs3.js +0 -133
- package/lib/themes/bs5.d.ts +0 -3
- package/lib/themes/bs5.js +0 -111
- package/lib/themes/glyphicon-fa-mapping.d.ts +0 -3
- package/lib/themes/glyphicon-fa-mapping.js +0 -271
- package/lib/themes/stub.d.ts +0 -3
- package/lib/themes/stub.js +0 -82
- package/lib/themes/theme.d.ts +0 -233
- package/lib/themes/theme.js +0 -2
- package/lib/translations.json +0 -847
- package/lib/utils.d.ts +0 -171
- package/lib/utils.js +0 -1191
- package/lib/validation.d.ts +0 -7
- package/lib/validation.js +0 -141
- package/llol +0 -10
- package/llol.pdf +0 -10
- package/playwright-report/index.html +0 -62
- package/q +0 -196
- package/rename.sh +0 -24
- package/trip-report.spec.ts +0 -594
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const React = require("react");
|
|
10
|
-
const PropTypes = require("prop-types");
|
|
11
|
-
const immutability_helper_1 = require("immutability-helper");
|
|
12
|
-
const equals = require("deep-equal");
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const BaseComponent_1 = require("../BaseComponent");
|
|
15
|
-
const fetch = require("isomorphic-fetch");
|
|
16
|
-
const Context_1 = require("../../Context");
|
|
17
|
-
const ReactContext_1 = require("../../ReactContext");
|
|
18
|
-
const components_1 = require("../components");
|
|
19
|
-
const Spinner = require("react-spinner");
|
|
20
|
-
const globals_1 = require("@luomus/laji-map/lib/globals");
|
|
21
|
-
const cache = {};
|
|
22
|
-
let GeocoderField = class GeocoderField extends React.Component {
|
|
23
|
-
constructor(props) {
|
|
24
|
-
super(props);
|
|
25
|
-
this.onLocate = (geometry) => {
|
|
26
|
-
this.updateForGeometry(this.props, undefined, this.normalizeGeometry(geometry));
|
|
27
|
-
};
|
|
28
|
-
this.getOptions = (props) => {
|
|
29
|
-
return Object.assign({ updateOnlyEmpty: false, button: false, fields: ["country", "municipality", "biologicalProvince", "biogeographicalProvince", "administrativeProvince"] }, utils_1.getUiOptions((props || this.props).uiSchema));
|
|
30
|
-
};
|
|
31
|
-
this.onButtonClick = () => () => {
|
|
32
|
-
this.mounted ? this.setState(this.getStateFromProps(this.props, true), () => {
|
|
33
|
-
this.update(this.props, (failed = false) => {
|
|
34
|
-
this.fetchedButton = this.fetchedButton ? this.fetchedButton + 1 : 1;
|
|
35
|
-
this.mounted && this.setState(Object.assign(Object.assign({}, this.getStateFromProps(this.props, false)), { timeout: failed }));
|
|
36
|
-
});
|
|
37
|
-
}) :
|
|
38
|
-
this.update(this.props, (failed = false) => {
|
|
39
|
-
this.mounted && this.setState(Object.assign(Object.assign({}, this.getStateFromProps(this.props, false)), { timeout: failed }));
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
this.getGeometry = (props) => {
|
|
43
|
-
const { uiSchema, formData = {} } = props;
|
|
44
|
-
const { geometryField = "geometry" } = utils_1.getUiOptions(uiSchema);
|
|
45
|
-
let geometry = this.normalizeGeometry(formData[geometryField]);
|
|
46
|
-
// TODO misses geometry collections
|
|
47
|
-
if (formData.units)
|
|
48
|
-
formData.units.forEach(({ unitGathering }) => {
|
|
49
|
-
if (unitGathering && unitGathering.geometry && unitGathering.geometry.coordinates) {
|
|
50
|
-
geometry = immutability_helper_1.default(geometry, { geometries: { $push: [unitGathering.geometry] } });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return geometry;
|
|
54
|
-
};
|
|
55
|
-
this.normalizeGeometry = (geometry) => {
|
|
56
|
-
if (!geometry || !geometry.type) {
|
|
57
|
-
geometry = { type: "GeometryCollection", geometries: [] };
|
|
58
|
-
}
|
|
59
|
-
else if ("type" in geometry && geometry.type !== "GeometryCollection") {
|
|
60
|
-
geometry = { type: "GeometryCollection", geometries: [geometry] };
|
|
61
|
-
}
|
|
62
|
-
return geometry;
|
|
63
|
-
};
|
|
64
|
-
this.fetch = (url) => {
|
|
65
|
-
cache[url] = cache[url] || fetch(url).then(response => {
|
|
66
|
-
if (response.status >= 400) {
|
|
67
|
-
throw new Error(this.props.formContext.translations.RequestFailed);
|
|
68
|
-
}
|
|
69
|
-
return response.json();
|
|
70
|
-
}).catch(() => {
|
|
71
|
-
delete cache[url];
|
|
72
|
-
throw new Error(this.props.formContext.translations.RequestFailed);
|
|
73
|
-
});
|
|
74
|
-
return cache[url];
|
|
75
|
-
};
|
|
76
|
-
this.update = (props, callback) => {
|
|
77
|
-
const geometry = this.getGeometry(props);
|
|
78
|
-
this.updateForGeometry(props, callback, geometry);
|
|
79
|
-
};
|
|
80
|
-
this.getComponentContext = () => {
|
|
81
|
-
return Context_1.default(`${this.props.formContext.contextId}_${utils_1.getFieldUUID(this.props)}_GEOCODERFIELD`);
|
|
82
|
-
};
|
|
83
|
-
this.updateForGeometry = (props, callback, geometry) => {
|
|
84
|
-
const { fields } = this.getOptions();
|
|
85
|
-
const fieldByKeys = fields.reduce((_fields, option) => {
|
|
86
|
-
_fields[option] = true;
|
|
87
|
-
return _fields;
|
|
88
|
-
}, {});
|
|
89
|
-
if (!geometry || !geometry.geometries || !geometry.geometries.length) {
|
|
90
|
-
this.mounted && this.setState(this.getStateFromProps(props, false));
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const bounds = L.geoJson({
|
|
94
|
-
type: "FeatureCollection",
|
|
95
|
-
features: geometry.geometries.map(geometry => {
|
|
96
|
-
return { type: "Feature", properties: {}, geometry };
|
|
97
|
-
})
|
|
98
|
-
}).getBounds();
|
|
99
|
-
const center = bounds.getCenter();
|
|
100
|
-
const { lat, lng } = center;
|
|
101
|
-
const join = (oldValue, value) => utils_1.isEmptyString(oldValue) ? value : `${oldValue}, ${value}`;
|
|
102
|
-
const lajiFormInstance = props.formContext.services.rootInstance;
|
|
103
|
-
const timestamp = Date.now();
|
|
104
|
-
this.promiseTimestamp = timestamp;
|
|
105
|
-
const doAsync = () => {
|
|
106
|
-
this.getComponentContext().hook = props.formContext.services.submitHooks.add(props, () => new Promise((resolve, reject) => {
|
|
107
|
-
const afterFetch = (callback, timeout = false) => {
|
|
108
|
-
if (this.getComponentContext().fetching) {
|
|
109
|
-
if (callback)
|
|
110
|
-
callback(timeout);
|
|
111
|
-
}
|
|
112
|
-
this.getComponentContext().fetching = false;
|
|
113
|
-
if (this.getComponentContext().resetRemountedState)
|
|
114
|
-
this.getComponentContext().resetRemountedState(false);
|
|
115
|
-
};
|
|
116
|
-
const success = (callback, timeout) => {
|
|
117
|
-
afterFetch(callback, timeout);
|
|
118
|
-
resolve();
|
|
119
|
-
};
|
|
120
|
-
const fail = (e, callback, timeout) => {
|
|
121
|
-
afterFetch(callback, timeout);
|
|
122
|
-
reject(e);
|
|
123
|
-
};
|
|
124
|
-
const handleResponse = (country, ...fields) => (response) => {
|
|
125
|
-
fields = fields.reduce((_fields, field) => {
|
|
126
|
-
_fields[field] = true;
|
|
127
|
-
return _fields;
|
|
128
|
-
}, {});
|
|
129
|
-
const changes = {};
|
|
130
|
-
if (fieldByKeys.biologicalProvince) {
|
|
131
|
-
changes.biologicalProvince = undefined;
|
|
132
|
-
}
|
|
133
|
-
if (fieldByKeys.biogeographicalProvince) {
|
|
134
|
-
changes.biogeographicalProvince = undefined;
|
|
135
|
-
}
|
|
136
|
-
if (fieldByKeys.administrativeProvince) {
|
|
137
|
-
changes.administrativeProvince = undefined;
|
|
138
|
-
}
|
|
139
|
-
const parsers = {
|
|
140
|
-
country: {
|
|
141
|
-
type: ["country"],
|
|
142
|
-
responseField: "long_name"
|
|
143
|
-
},
|
|
144
|
-
administrativeProvince: {
|
|
145
|
-
type: ["administrative_area_level_1"],
|
|
146
|
-
responseField: "long_name"
|
|
147
|
-
},
|
|
148
|
-
municipality: {
|
|
149
|
-
type: ["municipality", "administrative_area_level_3", "administrative_area_level_2"],
|
|
150
|
-
responseField: "long_name"
|
|
151
|
-
},
|
|
152
|
-
biologicalProvince: {
|
|
153
|
-
type: ["biogeographicalProvince"],
|
|
154
|
-
responseField: "long_name"
|
|
155
|
-
},
|
|
156
|
-
biogeographicalProvince: {
|
|
157
|
-
type: ["biogeographicalProvince"],
|
|
158
|
-
responseField: "long_name"
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
if (response.status === "OK") {
|
|
162
|
-
const found = {};
|
|
163
|
-
Object.keys(parsers).forEach(field => {
|
|
164
|
-
const parser = parsers[field];
|
|
165
|
-
parser.type.some((type, typeIdx) => {
|
|
166
|
-
response.results.forEach(result => result.address_components.forEach(addressComponent => {
|
|
167
|
-
if (addressComponent.types.includes(type)) {
|
|
168
|
-
if (!found[field])
|
|
169
|
-
found[field] = {};
|
|
170
|
-
if (!found[field][typeIdx])
|
|
171
|
-
found[field][typeIdx] = {};
|
|
172
|
-
const responseField = addressComponent[parser.responseField] ? parser.responseField : "short_name";
|
|
173
|
-
found[field][typeIdx][addressComponent[responseField]] = true;
|
|
174
|
-
}
|
|
175
|
-
}));
|
|
176
|
-
return found[field] && found[field][typeIdx];
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
Object.keys(parsers).forEach(field => {
|
|
180
|
-
if (!fieldByKeys[field] || !this.props.schema.properties[field]) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
if (found[field]) {
|
|
184
|
-
const keys = Object.keys(found[field]);
|
|
185
|
-
const responseForField = found[field][keys[0]];
|
|
186
|
-
Object.keys(responseForField).forEach(value => {
|
|
187
|
-
// If target field is array.
|
|
188
|
-
if (this.props.schema.properties[field].type === "array") {
|
|
189
|
-
const temp = Array.from((this.props.formData || {})[field] || []);
|
|
190
|
-
// Find correct enum from fieldOptions.
|
|
191
|
-
const fieldOptions = this.props.uiSchema["ui:options"].fieldOptions;
|
|
192
|
-
const enumField = fieldOptions[fieldOptions.findIndex(element => {
|
|
193
|
-
return element.field === field;
|
|
194
|
-
})].enum;
|
|
195
|
-
// Find enum value from key (eg. municipalityName --> municipalityId).
|
|
196
|
-
const _enum = this.props.formContext.uiSchemaContext[enumField].oneOf;
|
|
197
|
-
const enumValue = _enum.find(item => item.title === value).const;
|
|
198
|
-
// Push enum value to changes.
|
|
199
|
-
if (enumValue !== undefined) {
|
|
200
|
-
!temp.includes(enumValue) && temp.push(enumValue);
|
|
201
|
-
changes[field] = temp;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
changes[field] = join(changes[field], value);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
changes[field] = utils_1.getDefaultFormState(this.props.schema.properties[field]);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
if (country && this.props.schema.properties.country && fieldByKeys.country)
|
|
214
|
-
changes.country = country;
|
|
215
|
-
success(() => {
|
|
216
|
-
if (timestamp !== this.promiseTimestamp)
|
|
217
|
-
return;
|
|
218
|
-
if (this.mounted) {
|
|
219
|
-
this.props.onChange(Object.assign(Object.assign({}, (this.props.formData || {})), changes));
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
const pointer = this.props.formContext.services.ids.getJSONPointerFromLajiFormIdAndFormDataAndIdSchemaId(this.props.idSchema.$id, utils_1.getFieldUUID(this.props));
|
|
223
|
-
const newFormData = Object.assign(Object.assign({}, utils_1.parseJSONPointer(lajiFormInstance.getFormData(), pointer)), changes);
|
|
224
|
-
lajiFormInstance.onChange(utils_1.updateSafelyWithJSONPointer(lajiFormInstance.getFormData(), newFormData, pointer));
|
|
225
|
-
}
|
|
226
|
-
if (callback)
|
|
227
|
-
callback();
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
else if (country) {
|
|
231
|
-
fetchForeign();
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
const fetchForeign = () => {
|
|
235
|
-
if (!props.formContext.googleApiKey)
|
|
236
|
-
return fail("No Google API key", callback);
|
|
237
|
-
this.fetch(`https://maps.googleapis.com/maps/api/geocode/json\
|
|
238
|
-
?latlng=${lat},${lng}\
|
|
239
|
-
&key=${props.formContext.googleApiKey}\
|
|
240
|
-
&language=en\
|
|
241
|
-
&filter=country|administrative_area_level_1|administrative_area_level_2|administrative_area_level_3`).then(handleResponse(undefined, "country", "municipality", "administrativeProvince")).catch((e) => {
|
|
242
|
-
fail(e.message, callback, !!"failed");
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
this.getComponentContext().fetching = true;
|
|
246
|
-
this.props.formContext.setTimeout(() => {
|
|
247
|
-
if (timestamp !== this.promiseTimestamp)
|
|
248
|
-
return;
|
|
249
|
-
if (this.getComponentContext().fetching) {
|
|
250
|
-
fail(this.props.formContext.translations.GeocodingTimeout);
|
|
251
|
-
this.mounted && this.setState({ timeout: true }, () => {
|
|
252
|
-
this.mounted && this.setState(this.getStateFromProps(this.props, false));
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}, 30 * 1000);
|
|
256
|
-
!bounds.overlaps(globals_1.FINLAND_BOUNDS)
|
|
257
|
-
? fetchForeign()
|
|
258
|
-
: this.props.formContext.apiClient.fetchRaw("/coordinates/location", undefined, {
|
|
259
|
-
method: "POST",
|
|
260
|
-
headers: {
|
|
261
|
-
"accept": "application/json",
|
|
262
|
-
"content-type": "application/json"
|
|
263
|
-
},
|
|
264
|
-
body: JSON.stringify(geometry)
|
|
265
|
-
}).then(response => response.json()).then(handleResponse(props.formContext.translations.Finland, "municipality", "biologicalProvince", "biogeographicalProvince")).catch((e) => {
|
|
266
|
-
fail(e.message);
|
|
267
|
-
});
|
|
268
|
-
}));
|
|
269
|
-
};
|
|
270
|
-
if (this.getComponentContext().hook) {
|
|
271
|
-
this.props.formContext.services.submitHooks.remove(utils_1.getFieldUUID(this.props), this.getComponentContext().hook).then(doAsync);
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
doAsync();
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
const loading = this.getComponentContext().fetching;
|
|
278
|
-
this.state = this.getStateFromProps(props, loading);
|
|
279
|
-
}
|
|
280
|
-
static getName() { return "GeocoderField"; }
|
|
281
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
282
|
-
const geometryUpdated = equals(this.getGeometry(props), this.getGeometry(this.props)) ? false : undefined;
|
|
283
|
-
this.setState(this.getStateFromProps(props, geometryUpdated));
|
|
284
|
-
}
|
|
285
|
-
componentDidMount() {
|
|
286
|
-
this.mounted = true;
|
|
287
|
-
this.componentDidUpdate();
|
|
288
|
-
this.props.formContext.services.customEvents.add(this.props.idSchema.$id, "locate", this.onLocate);
|
|
289
|
-
this.getComponentContext().resetRemountedState = (loading) => this.setState(this.getStateFromProps(this.props, loading));
|
|
290
|
-
}
|
|
291
|
-
componentWillUnmount() {
|
|
292
|
-
this.mounted = false;
|
|
293
|
-
this.props.formContext.services.customEvents.remove(this.props.idSchema.$id, "locate", this.onLocate);
|
|
294
|
-
delete this.getComponentContext().resetRemountedState;
|
|
295
|
-
}
|
|
296
|
-
componentDidUpdate(prevProps) {
|
|
297
|
-
const { updateOnlyEmpty, button, fields } = this.getOptions(this.props);
|
|
298
|
-
const hasData = fields.some(field => !utils_1.isEmptyString((this.props.formData || {})[field]));
|
|
299
|
-
const geometry = this.getGeometry(this.props);
|
|
300
|
-
const geometriesEqual = prevProps && equals(this.getGeometry(prevProps), geometry);
|
|
301
|
-
const geometryEmpty = geometry && geometry.geometries && geometry.geometries.length === 0;
|
|
302
|
-
if (updateOnlyEmpty && !geometryEmpty && hasData) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
if (!prevProps && hasData) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
if ((geometryEmpty && prevProps && !geometriesEqual) // was emptied
|
|
309
|
-
||
|
|
310
|
-
(((this.state.loading === undefined && !this.state && geometry) || !geometriesEqual))) {
|
|
311
|
-
button ? this.onButtonClick()() : this.update(this.props);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
getStateFromProps(props, loading) {
|
|
315
|
-
const state = { loading };
|
|
316
|
-
const { button } = this.getOptions(props);
|
|
317
|
-
const innerUiSchema = utils_1.getInnerUiSchema(props.uiSchema);
|
|
318
|
-
if (button) {
|
|
319
|
-
state.uiSchema = Object.assign(Object.assign({}, innerUiSchema), { "ui:options": Object.assign(Object.assign({}, utils_1.getUiOptions(innerUiSchema)), { buttons: [
|
|
320
|
-
...(utils_1.getUiOptions(innerUiSchema).buttons || []),
|
|
321
|
-
this.getButton(props, loading)
|
|
322
|
-
] }) });
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
state.uiSchema = innerUiSchema;
|
|
326
|
-
}
|
|
327
|
-
return state;
|
|
328
|
-
}
|
|
329
|
-
getButton(props, loading) {
|
|
330
|
-
// Button is disabled when loading is false
|
|
331
|
-
// (it is false only after fetch and no formData updates, otherwise it will be true/undefined.
|
|
332
|
-
const geometry = this.getGeometry(props);
|
|
333
|
-
return {
|
|
334
|
-
fn: this.onButtonClick,
|
|
335
|
-
position: "top",
|
|
336
|
-
key: loading,
|
|
337
|
-
render: onClick => (React.createElement(components_1.Button, { key: "geolocate", onClick: onClick, disabled: loading || props.disabled || props.readonly || !this.state.timeout && (loading === false || !geometry || !geometry.geometries || geometry.geometries.length === 0), className: "geocoder-btn" },
|
|
338
|
-
loading ? React.createElement(Spinner, null) : React.createElement(ReactContext_1.default.Consumer, null, ({ theme: { Glyphicon } }) => React.createElement(Glyphicon, { glyph: "globe" })),
|
|
339
|
-
" ",
|
|
340
|
-
props.formContext.translations.Geolocate))
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
render() {
|
|
344
|
-
const { SchemaField } = this.props.registry.fields;
|
|
345
|
-
return React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: this.state.uiSchema }));
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
GeocoderField.propTypes = {
|
|
349
|
-
uiSchema: PropTypes.shape({
|
|
350
|
-
"ui:options": PropTypes.shape({
|
|
351
|
-
updateOnlyEmpty: PropTypes.bool,
|
|
352
|
-
button: PropTypes.bool,
|
|
353
|
-
fields: PropTypes.arrayOf(PropTypes.oneOf((["country", "municipality",
|
|
354
|
-
"biologicalProvince", "biogeographicalProvince", "administrativeProvince"]))),
|
|
355
|
-
geometryField: PropTypes.string,
|
|
356
|
-
"fieldOptions": PropTypes.arrayOf(PropTypes.shape({
|
|
357
|
-
field: PropTypes.string,
|
|
358
|
-
enum: PropTypes.string
|
|
359
|
-
}))
|
|
360
|
-
}),
|
|
361
|
-
uiSchema: PropTypes.object
|
|
362
|
-
}).isRequired,
|
|
363
|
-
schema: PropTypes.shape({
|
|
364
|
-
type: PropTypes.oneOf(["object"])
|
|
365
|
-
}).isRequired,
|
|
366
|
-
formData: PropTypes.object
|
|
367
|
-
};
|
|
368
|
-
GeocoderField.contextType = ReactContext_1.default;
|
|
369
|
-
GeocoderField = __decorate([
|
|
370
|
-
BaseComponent_1.default
|
|
371
|
-
], GeocoderField);
|
|
372
|
-
exports.default = GeocoderField;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default GridLayoutField;
|
|
2
|
-
declare function GridLayoutField(props: any): JSX.Element;
|
|
3
|
-
declare namespace GridLayoutField {
|
|
4
|
-
namespace propTypes {
|
|
5
|
-
const uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
-
"ui:grid": PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
-
lg: PropTypes.Requireable<number | object>;
|
|
8
|
-
md: PropTypes.Requireable<number | object>;
|
|
9
|
-
sm: PropTypes.Requireable<number | object>;
|
|
10
|
-
xs: PropTypes.Requireable<number | object>;
|
|
11
|
-
}>>;
|
|
12
|
-
}>>;
|
|
13
|
-
const schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
14
|
-
type: PropTypes.Requireable<string>;
|
|
15
|
-
}>>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const GridLayoutField = (props) => {
|
|
7
|
-
let { schema, uiSchema } = props;
|
|
8
|
-
const { SchemaField } = props.registry.fields;
|
|
9
|
-
uiSchema = Object.assign(Object.assign({}, uiSchema), { "ui:grid": uiSchema["ui:options"] });
|
|
10
|
-
delete uiSchema["ui:field"];
|
|
11
|
-
if (utils_1.getUiOptions(uiSchema).label === false) {
|
|
12
|
-
Object.keys(schema.properties).forEach(propertyName => {
|
|
13
|
-
const propertyUiSchema = (uiSchema[propertyName] || {});
|
|
14
|
-
uiSchema[propertyName] = Object.assign(Object.assign({}, propertyUiSchema), { "ui:options": Object.assign(Object.assign({}, (propertyUiSchema["ui:options"] || {})), { label: false }) });
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return React.createElement(SchemaField, Object.assign({}, props, { schema: schema, uiSchema: uiSchema }));
|
|
18
|
-
};
|
|
19
|
-
GridLayoutField.propTypes = {
|
|
20
|
-
uiSchema: PropTypes.shape({
|
|
21
|
-
"ui:grid": PropTypes.shape({
|
|
22
|
-
lg: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
23
|
-
md: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
24
|
-
sm: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
|
|
25
|
-
xs: PropTypes.oneOfType([PropTypes.number, PropTypes.object])
|
|
26
|
-
})
|
|
27
|
-
}),
|
|
28
|
-
schema: PropTypes.shape({
|
|
29
|
-
type: PropTypes.oneOf(["object"])
|
|
30
|
-
}).isRequired
|
|
31
|
-
};
|
|
32
|
-
exports.default = GridLayoutField;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default HiddenField;
|
|
2
|
-
declare function HiddenField(): JSX.Element;
|
|
3
|
-
declare namespace HiddenField {
|
|
4
|
-
namespace propTypes {
|
|
5
|
-
const schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
6
|
-
type: PropTypes.Requireable<string>;
|
|
7
|
-
}>>;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
import * as PropTypes from "prop-types";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const PropTypes = require("prop-types");
|
|
5
|
-
const HiddenField = () => { return React.createElement("div", null); };
|
|
6
|
-
HiddenField.propTypes = {
|
|
7
|
-
schema: PropTypes.shape({
|
|
8
|
-
type: PropTypes.oneOf(["object", "array", "string", "number", "boolean", "integer"])
|
|
9
|
-
}).isRequired
|
|
10
|
-
};
|
|
11
|
-
exports.default = HiddenField;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as PropTypes from "prop-types";
|
|
3
|
-
import { FieldProps } from "../LajiForm";
|
|
4
|
-
import ApiClient from "../../ApiClient";
|
|
5
|
-
interface ProcessedFile {
|
|
6
|
-
dataURL: string;
|
|
7
|
-
name: string;
|
|
8
|
-
size: number;
|
|
9
|
-
type: File["type"];
|
|
10
|
-
}
|
|
11
|
-
interface ImageArrayFieldState extends MediaArrayState {
|
|
12
|
-
modalMediaSrc: string;
|
|
13
|
-
}
|
|
14
|
-
interface MediaMetadataSchema {
|
|
15
|
-
capturerVerbatim?: string[];
|
|
16
|
-
intellectualOwner?: string;
|
|
17
|
-
intellectualRights?: string;
|
|
18
|
-
}
|
|
19
|
-
export default class ImageArrayField extends React.Component<FieldProps, ImageArrayFieldState> {
|
|
20
|
-
ALLOWED_FILE_TYPES: string[];
|
|
21
|
-
ACCEPT_FILE_TYPES: string[];
|
|
22
|
-
MAX_FILE_SIZE: number;
|
|
23
|
-
KEY: string;
|
|
24
|
-
ENDPOINT: string;
|
|
25
|
-
GLYPH: string;
|
|
26
|
-
TRANSLATION_TAKE_NEW: string;
|
|
27
|
-
TRANSLATION_SELECT_FILE: string;
|
|
28
|
-
TRANSLATION_NO_MEDIA: string;
|
|
29
|
-
CONTAINER_CLASS: string;
|
|
30
|
-
METADATA_FORM_ID: string;
|
|
31
|
-
renderMedia: (id: string) => JSX.Element;
|
|
32
|
-
renderLoadingMedia: (id: string) => JSX.Element;
|
|
33
|
-
onMediaClick: (i: number) => any;
|
|
34
|
-
renderModalMedia: () => JSX.Element;
|
|
35
|
-
formatValue(value: string[], options: any, props: FieldProps): string | null;
|
|
36
|
-
}
|
|
37
|
-
export interface MediaArrayState {
|
|
38
|
-
tmpMedias: number[];
|
|
39
|
-
addModal?: any;
|
|
40
|
-
dragging?: boolean;
|
|
41
|
-
metadataModalOpen?: number | false;
|
|
42
|
-
modalIdx?: number;
|
|
43
|
-
modalMediaSrc?: string;
|
|
44
|
-
modalMetadata?: any;
|
|
45
|
-
metadataSaveSuccess?: string | false;
|
|
46
|
-
metadataForm?: any;
|
|
47
|
-
alert?: boolean;
|
|
48
|
-
alertMsg?: string;
|
|
49
|
-
}
|
|
50
|
-
declare type Constructor<LFC> = new (...args: any[]) => LFC;
|
|
51
|
-
export declare function MediaArrayField<LFC extends Constructor<React.Component<FieldProps, MediaArrayState>>>(ComposedComponent: LFC): {
|
|
52
|
-
new (...args: any[]): {
|
|
53
|
-
ALLOWED_FILE_TYPES: string[];
|
|
54
|
-
ACCEPT_FILE_TYPES: string[];
|
|
55
|
-
MAX_FILE_SIZE: number;
|
|
56
|
-
KEY: string;
|
|
57
|
-
ENDPOINT: string;
|
|
58
|
-
GLYPH: string;
|
|
59
|
-
TRANSLATION_TAKE_NEW: string;
|
|
60
|
-
TRANSLATION_SELECT_FILE: string;
|
|
61
|
-
TRANSLATION_NO_MEDIA: string;
|
|
62
|
-
CONTAINER_CLASS: string;
|
|
63
|
-
METADATA_FORM_ID: string;
|
|
64
|
-
deprecatedOptions: {
|
|
65
|
-
imageAddModal: string;
|
|
66
|
-
autoOpenImageAddModal: string;
|
|
67
|
-
};
|
|
68
|
-
apiClient: ApiClient;
|
|
69
|
-
_context: any;
|
|
70
|
-
mounted: boolean;
|
|
71
|
-
fetching: any;
|
|
72
|
-
addMediaContainerRef: React.RefObject<HTMLInputElement>;
|
|
73
|
-
getOptions: (uiSchema: any) => any;
|
|
74
|
-
componentDidMount(): void;
|
|
75
|
-
componentWillUnmount(): void;
|
|
76
|
-
onDragEnter: () => void;
|
|
77
|
-
onDragLeave: () => void;
|
|
78
|
-
onDrop: (files: File[]) => void;
|
|
79
|
-
defaultOnClick: () => void;
|
|
80
|
-
render(): JSX.Element;
|
|
81
|
-
onKeyDown: (e: KeyboardEvent | React.KeyboardEvent<Element>) => void;
|
|
82
|
-
renderMedias: () => any;
|
|
83
|
-
renderLoadingMedias: () => (JSX.Element | null)[];
|
|
84
|
-
openModalFor: (i: number) => () => void;
|
|
85
|
-
onMediaRmClick: (i: number) => () => void;
|
|
86
|
-
hideMetadataModal: () => void;
|
|
87
|
-
onMetadataFormChange: (formData: any) => void;
|
|
88
|
-
renderMetadataModal: () => JSX.Element | null;
|
|
89
|
-
onHideMediaAddModal: () => void;
|
|
90
|
-
renderMediaAddModal: () => JSX.Element | null;
|
|
91
|
-
onAlertOk: () => void;
|
|
92
|
-
parseExif: (files: File[]) => undefined | Promise<any>;
|
|
93
|
-
sideEffects: (formData: any) => void;
|
|
94
|
-
onFileFormChange: (files: File[]) => void;
|
|
95
|
-
getContainerId: () => number | "root";
|
|
96
|
-
saveMedias(files: File[]): Promise<any[] | undefined>;
|
|
97
|
-
addNameToDataURL: (dataURL: string, name: string) => string;
|
|
98
|
-
processFiles: (files: File[]) => Promise<ProcessedFile[]>;
|
|
99
|
-
processFile: (file: File) => Promise<ProcessedFile>;
|
|
100
|
-
onMediaMetadataUpdate: ({ formData }: {
|
|
101
|
-
formData: any;
|
|
102
|
-
}) => void;
|
|
103
|
-
getMetadataPromise: () => Promise<MediaMetadataSchema>;
|
|
104
|
-
getMaxFileSizeAsString: () => string;
|
|
105
|
-
getAllowedMediaFormatsAsString: () => string;
|
|
106
|
-
context: any;
|
|
107
|
-
setState<K extends keyof MediaArrayState>(state: MediaArrayState | ((prevState: Readonly<MediaArrayState>, props: Readonly<FieldProps>) => MediaArrayState | Pick<MediaArrayState, K> | null) | Pick<MediaArrayState, K> | null, callback?: (() => void) | undefined): void;
|
|
108
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
109
|
-
readonly props: Readonly<FieldProps> & Readonly<{
|
|
110
|
-
children?: React.ReactNode;
|
|
111
|
-
}>;
|
|
112
|
-
state: Readonly<MediaArrayState>;
|
|
113
|
-
refs: {
|
|
114
|
-
[key: string]: React.ReactInstance;
|
|
115
|
-
};
|
|
116
|
-
shouldComponentUpdate?(nextProps: Readonly<FieldProps>, nextState: Readonly<MediaArrayState>, nextContext: any): boolean;
|
|
117
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
118
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<FieldProps>, prevState: Readonly<MediaArrayState>): any;
|
|
119
|
-
componentDidUpdate?(prevProps: Readonly<FieldProps>, prevState: Readonly<MediaArrayState>, snapshot?: any): void;
|
|
120
|
-
componentWillMount?(): void;
|
|
121
|
-
UNSAFE_componentWillMount?(): void;
|
|
122
|
-
componentWillReceiveProps?(nextProps: Readonly<FieldProps>, nextContext: any): void;
|
|
123
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<FieldProps>, nextContext: any): void;
|
|
124
|
-
componentWillUpdate?(nextProps: Readonly<FieldProps>, nextState: Readonly<MediaArrayState>, nextContext: any): void;
|
|
125
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<FieldProps>, nextState: Readonly<MediaArrayState>, nextContext: any): void;
|
|
126
|
-
};
|
|
127
|
-
contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
128
|
-
propTypes: {
|
|
129
|
-
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
130
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
131
|
-
titleClassName: PropTypes.Requireable<string>;
|
|
132
|
-
addModal: PropTypes.Requireable<boolean | PropTypes.InferProps<{
|
|
133
|
-
labels: PropTypes.Requireable<PropTypes.InferProps<{
|
|
134
|
-
cancel: PropTypes.Requireable<string>;
|
|
135
|
-
}>>;
|
|
136
|
-
}>>;
|
|
137
|
-
autoOpenAddModal: PropTypes.Requireable<boolean>;
|
|
138
|
-
autoOpenMetadataModal: PropTypes.Requireable<boolean>;
|
|
139
|
-
sideEffects: PropTypes.Requireable<object>;
|
|
140
|
-
exifParsers: PropTypes.Requireable<(object | null | undefined)[]>;
|
|
141
|
-
}>>;
|
|
142
|
-
}>>;
|
|
143
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
144
|
-
type: PropTypes.Requireable<string>;
|
|
145
|
-
items: PropTypes.Validator<PropTypes.InferProps<{
|
|
146
|
-
type: PropTypes.Validator<string>;
|
|
147
|
-
}>>;
|
|
148
|
-
}>>;
|
|
149
|
-
formData: PropTypes.Requireable<any[]>;
|
|
150
|
-
};
|
|
151
|
-
displayName: string;
|
|
152
|
-
} & LFC;
|
|
153
|
-
interface ThumbnailProps {
|
|
154
|
-
id?: string;
|
|
155
|
-
apiClient: ApiClient;
|
|
156
|
-
apiEndpoint?: string;
|
|
157
|
-
dataURL?: string;
|
|
158
|
-
loading?: boolean;
|
|
159
|
-
}
|
|
160
|
-
interface ThumbnailState {
|
|
161
|
-
url?: string;
|
|
162
|
-
}
|
|
163
|
-
export declare class Thumbnail extends React.PureComponent<ThumbnailProps, ThumbnailState> {
|
|
164
|
-
mounted: boolean;
|
|
165
|
-
constructor(props: ThumbnailProps);
|
|
166
|
-
componentDidMount(): void;
|
|
167
|
-
componentWillUnmount(): void;
|
|
168
|
-
UNSAFE_componentWillReceiveProps(props: ThumbnailProps): void;
|
|
169
|
-
updateURL: ({ id, apiClient, apiEndpoint }: ThumbnailProps) => void;
|
|
170
|
-
render(): JSX.Element | null;
|
|
171
|
-
}
|
|
172
|
-
export {};
|