@luomus/laji-form 15.0.0 → 15.1.1
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/dist/styles.css +81 -90
- package/jsonconfig.json +26 -0
- package/migrate.sh +0 -1
- package/package.json +8 -8
- package/test-export/array-spec.js +204 -0
- package/test-export/bird-point-count-spec.d.ts +1 -0
- package/test-export/bird-point-count-spec.js +62 -0
- package/test-export/collection-contest-form-spec.d.ts +1 -0
- package/test-export/collection-contest-form-spec.js +38 -0
- package/test-export/dataset-form-spec.d.ts +1 -0
- package/test-export/dataset-form-spec.js +50 -0
- package/test-export/date-time-widget-spec.d.ts +1 -0
- package/test-export/date-time-widget-spec.js +188 -0
- package/test-export/geocoder-spec.d.ts +1 -0
- package/test-export/geocoder-spec.js +135 -0
- package/test-export/image-array-spec.d.ts +1 -0
- package/test-export/image-array-spec.js +94 -0
- package/test-export/inject-field-spec.d.ts +1 -0
- package/test-export/inject-field-spec.js +148 -0
- package/test-export/internal-uuids-spec.d.ts +1 -0
- package/test-export/internal-uuids-spec.js +157 -0
- package/test-export/invasive-species-eradication-np-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-np-spec.js +18 -0
- package/test-export/invasive-species-eradication-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-spec.js +25 -0
- package/test-export/line-transect-spec.d.ts +1 -0
- package/test-export/line-transect-spec.js +121 -0
- package/test-export/mobile-form-spec.d.ts +1 -0
- package/test-export/mobile-form-spec.js +84 -0
- package/test-export/nafi-spec.d.ts +1 -0
- package/test-export/nafi-spec.js +85 -0
- package/test-export/select-widget-spec.d.ts +1 -0
- package/test-export/select-widget-spec.js +68 -0
- package/test-export/single-item-array-field-spec.d.ts +1 -0
- package/test-export/single-item-array-field-spec.js +92 -0
- package/test-export/syke-butterfly-spec.d.ts +1 -0
- package/test-export/syke-butterfly-spec.js +163 -0
- package/test-export/test-utils.d.ts +150 -176
- package/test-export/test-utils.js +218 -210
- package/test-export/transaction-form-spec.d.ts +1 -0
- package/test-export/transaction-form-spec.js +63 -0
- package/test-export/trip-report-autosuggest-spec.d.ts +1 -0
- package/test-export/trip-report-autosuggest-spec.js +272 -0
- package/test-export/trip-report-spec.d.ts +1 -0
- package/test-export/trip-report-spec.js +456 -0
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +1 -0
- package/test-export/unit-list-shorthand-array-field-spec.js +71 -0
- package/test-export/validation-spec.d.ts +1 -0
- package/test-export/validation-spec.js +336 -0
- package/test-export/water-bird-spec.d.ts +1 -0
- package/test-export/water-bird-spec.js +30 -0
- package/test-export/wbc-spec.d.ts +1 -0
- package/test-export/wbc-spec.js +82 -0
- package/tsconfig.test.json +1 -1
- 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.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
- /package/{lib/styles.d.ts → test-export/array-spec.d.ts} +0 -0
|
@@ -1,606 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.FailedBackgroundJobsPanel = exports.Fullscreen = exports.OverlayTrigger = exports.FetcherInput = exports.TooltipComponent = exports.ErrorPanel = exports.Label = exports.Help = exports.Stretch = exports.Affix = exports.GlyphButton = exports.AddButton = exports.DeleteButton = exports.Button = void 0;
|
|
15
|
-
const React = require("react");
|
|
16
|
-
const PropTypes = require("prop-types");
|
|
17
|
-
const react_dom_1 = require("react-dom");
|
|
18
|
-
const Spinner = require("react-spinner");
|
|
19
|
-
const utils_1 = require("../utils");
|
|
20
|
-
const ReactContext_1 = require("../ReactContext");
|
|
21
|
-
class Button extends React.Component {
|
|
22
|
-
render() {
|
|
23
|
-
const _a = this.props, { tooltip, tooltipPlacement, tooltipTrigger, tooltipClass } = _a, _props = __rest(_a, ["tooltip", "tooltipPlacement", "tooltipTrigger", "tooltipClass"]);
|
|
24
|
-
const { Button: _Button } = this.context.theme;
|
|
25
|
-
return (React.createElement(TooltipComponent, { tooltip: tooltip, placement: tooltipPlacement, trigger: tooltipTrigger, className: tooltipClass },
|
|
26
|
-
React.createElement(_Button, Object.assign({}, _props), _props.children)));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.Button = Button;
|
|
30
|
-
Button.contextType = ReactContext_1.default;
|
|
31
|
-
class DeleteButton extends React.Component {
|
|
32
|
-
constructor(props) {
|
|
33
|
-
super(props);
|
|
34
|
-
this.onButtonKeyDown = ({ key }) => {
|
|
35
|
-
if (key === "Enter")
|
|
36
|
-
this.onConfirmedClick();
|
|
37
|
-
else if (key === "Escape")
|
|
38
|
-
this.setState({ show: false });
|
|
39
|
-
};
|
|
40
|
-
this.onHideConfirm = () => {
|
|
41
|
-
this.setState({ show: false }, () => {
|
|
42
|
-
if (this.callback) {
|
|
43
|
-
this.callback(this.deleted);
|
|
44
|
-
this.callbackCalled = true;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
this.onShowConfirm = (e) => {
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
this.setState({ show: true }, () => {
|
|
52
|
-
if (this.props.confirmStyle === "browser") {
|
|
53
|
-
this.browserConfirm();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
this.onConfirmedClick = (e) => {
|
|
58
|
-
e && e.preventDefault();
|
|
59
|
-
e && e.stopPropagation();
|
|
60
|
-
this.props.onClick();
|
|
61
|
-
this.onHideConfirm();
|
|
62
|
-
this.deleted = true;
|
|
63
|
-
};
|
|
64
|
-
this.onClick = (e, callback) => {
|
|
65
|
-
this.callback = callback;
|
|
66
|
-
this.props.confirm ? this.onShowConfirm(e) : this.onConfirmedClick(e);
|
|
67
|
-
};
|
|
68
|
-
this.componentWillUnmount = () => {
|
|
69
|
-
if (this.callback && !this.callbackCalled) {
|
|
70
|
-
this.callback(this.deleted);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
this.setConfirmAutofocus = (elem) => {
|
|
74
|
-
setTimeout(() => {
|
|
75
|
-
const domElem = react_dom_1.findDOMNode(elem);
|
|
76
|
-
domElem && domElem.focus();
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
this.renderConfirm = () => {
|
|
80
|
-
const { show } = this.state;
|
|
81
|
-
if (!show) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
const { confirmStyle = "popup" } = this.props;
|
|
85
|
-
if (confirmStyle === "popup") {
|
|
86
|
-
return this.renderConfirmPopup();
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
};
|
|
90
|
-
this.getOverlayTarget = () => react_dom_1.findDOMNode(this.refs.del);
|
|
91
|
-
this.state = { show: false };
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
const { props } = this;
|
|
95
|
-
const { corner, tooltip, disabled, readonly, glyphButton = true, confirm, confirmPlacement, confirmStyle } = props, maybeProps = __rest(props, ["corner", "tooltip", "disabled", "readonly", "glyphButton", "confirm", "confirmPlacement", "confirmStyle"]); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
96
|
-
let buttonClassName = glyphButton ? "glyph-button" : "";
|
|
97
|
-
buttonClassName += corner ? " button-corner" : "";
|
|
98
|
-
if (props.className) {
|
|
99
|
-
buttonClassName = `${buttonClassName} ${props.className}`;
|
|
100
|
-
}
|
|
101
|
-
if (props.id !== undefined) {
|
|
102
|
-
maybeProps.id = `${props.id}-delete`;
|
|
103
|
-
}
|
|
104
|
-
const button = (React.createElement(React.Fragment, null,
|
|
105
|
-
React.createElement(Button, Object.assign({}, maybeProps, { disabled: disabled || readonly, variant: "danger", className: buttonClassName, style: this.props.style, ref: "del", onKeyDown: this.onButtonKeyDown, onClick: this.onClick }),
|
|
106
|
-
this.props.children,
|
|
107
|
-
" ",
|
|
108
|
-
"✖"),
|
|
109
|
-
this.renderConfirm()));
|
|
110
|
-
return tooltip ? React.createElement(TooltipComponent, { tooltip: tooltip }, button) : button;
|
|
111
|
-
}
|
|
112
|
-
renderConfirmPopup() {
|
|
113
|
-
const { translations, confirmPlacement = "left" } = this.props;
|
|
114
|
-
const { Overlay, Popover, ButtonGroup } = this.context.theme;
|
|
115
|
-
return (React.createElement(Overlay, { show: true, placement: confirmPlacement, rootClose: true, onHide: this.onHideConfirm, target: this.getOverlayTarget },
|
|
116
|
-
React.createElement(Popover, { id: `${this.props.id}-button-confirm` },
|
|
117
|
-
React.createElement("span", null, translations.ConfirmRemove),
|
|
118
|
-
React.createElement(ButtonGroup, null,
|
|
119
|
-
React.createElement(Button, { variant: "danger", onClick: this.onConfirmedClick, ref: this.setConfirmAutofocus, id: `${this.props.id}-delete-confirm-yes` }, translations.Remove),
|
|
120
|
-
React.createElement(Button, { variant: "default", onClick: this.onHideConfirm, id: `${this.props.id}-delete-confirm-no` }, translations.Cancel)))));
|
|
121
|
-
}
|
|
122
|
-
browserConfirm() {
|
|
123
|
-
const choice = confirm(this.props.translations.ConfirmRemove);
|
|
124
|
-
if (choice) {
|
|
125
|
-
this.onConfirmedClick();
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
this.onHideConfirm();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.DeleteButton = DeleteButton;
|
|
133
|
-
DeleteButton.contextType = ReactContext_1.default;
|
|
134
|
-
DeleteButton.propTypes = {
|
|
135
|
-
confirm: PropTypes.bool,
|
|
136
|
-
onClick: PropTypes.func.isRequired,
|
|
137
|
-
translations: PropTypes.object.isRequired,
|
|
138
|
-
confirmStyle: PropTypes.oneOf(["popup", "browser"])
|
|
139
|
-
};
|
|
140
|
-
function AddButton({ onClick }) {
|
|
141
|
-
const { Row, Col } = React.useContext(ReactContext_1.default).theme;
|
|
142
|
-
return React.createElement(Row, null,
|
|
143
|
-
React.createElement(Col, { xs: 2 },
|
|
144
|
-
React.createElement(Button, { onClick: onClick }, "\u2795")));
|
|
145
|
-
}
|
|
146
|
-
exports.AddButton = AddButton;
|
|
147
|
-
exports.GlyphButton = React.forwardRef((props, ref) => {
|
|
148
|
-
const { glyph } = props, buttonProps = __rest(props, ["glyph"]);
|
|
149
|
-
const { Glyphicon } = React.useContext(ReactContext_1.default).theme;
|
|
150
|
-
return (React.createElement(Button, Object.assign({}, buttonProps, { ref: ref, className: `glyph-button${props.className ? ` ${props.className}` : ""}`, tooltipPlacement: props.tooltipPlacement || "left" }),
|
|
151
|
-
React.createElement(Glyphicon, { glyph: glyph }),
|
|
152
|
-
props.children));
|
|
153
|
-
});
|
|
154
|
-
const TOP = "TOP", AFFIXED = "AFFIXED", BOTTOM = "BOTTOM";
|
|
155
|
-
class Affix extends React.Component {
|
|
156
|
-
constructor(props) {
|
|
157
|
-
super(props);
|
|
158
|
-
this.getState = (props) => {
|
|
159
|
-
const { topOffset = 0, bottomOffset = 0, getContainer } = props;
|
|
160
|
-
const container = getContainer ? getContainer() : this.refs.container;
|
|
161
|
-
const wrapperElem = react_dom_1.findDOMNode(this.refs.wrapper);
|
|
162
|
-
if (!container || !document.body.contains(container) || !wrapperElem)
|
|
163
|
-
return;
|
|
164
|
-
const containerTop = container.getBoundingClientRect().top;
|
|
165
|
-
const containerHeight = container.offsetHeight;
|
|
166
|
-
const containerVisibleHeight = containerHeight + containerTop;
|
|
167
|
-
const wrapperHeight = wrapperElem.offsetHeight;
|
|
168
|
-
const wrapperScrollHeight = wrapperElem.scrollHeight;
|
|
169
|
-
const scrolled = this.refs.container.getBoundingClientRect().top < topOffset;
|
|
170
|
-
const viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
171
|
-
const bottomDist = viewportHeight - container.getBoundingClientRect().top - containerHeight;
|
|
172
|
-
const bottomInvisibleHeight = Math.min(bottomDist, 0);
|
|
173
|
-
let affixState = TOP;
|
|
174
|
-
if (scrolled && containerVisibleHeight < wrapperScrollHeight + topOffset)
|
|
175
|
-
affixState = BOTTOM;
|
|
176
|
-
else if (scrolled)
|
|
177
|
-
affixState = AFFIXED;
|
|
178
|
-
const width = wrapperElem ? wrapperElem.offsetWidth : undefined;
|
|
179
|
-
const top = topOffset;
|
|
180
|
-
const affixHeight = affixState === BOTTOM
|
|
181
|
-
? Math.max(containerVisibleHeight
|
|
182
|
-
- topOffset
|
|
183
|
-
+ Math.min(bottomInvisibleHeight, 0)
|
|
184
|
-
- (bottomDist < bottomOffset ? Math.min(bottomOffset - bottomDist, bottomOffset) : 0), 0)
|
|
185
|
-
: undefined;
|
|
186
|
-
const wrapperCutHeight = wrapperHeight - (affixHeight || 0);
|
|
187
|
-
let change;
|
|
188
|
-
if (affixState === BOTTOM) {
|
|
189
|
-
if (!this.state) {
|
|
190
|
-
change = wrapperCutHeight;
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
if (this.state.affixState === BOTTOM) {
|
|
194
|
-
const lastChange = this.state.change;
|
|
195
|
-
const changeNow = wrapperCutHeight;
|
|
196
|
-
change = lastChange + changeNow;
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
change = wrapperCutHeight;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
const fixerHeight = affixState === AFFIXED
|
|
204
|
-
? wrapperHeight - (affixHeight || 0)
|
|
205
|
-
: affixState === BOTTOM
|
|
206
|
-
? affixHeight + change
|
|
207
|
-
: 0;
|
|
208
|
-
return { affixState, width, top, affixHeight, fixerHeight, change };
|
|
209
|
-
};
|
|
210
|
-
this._onScroll = () => {
|
|
211
|
-
this.setState(this.getState(this.props));
|
|
212
|
-
};
|
|
213
|
-
this.onScroll = () => {
|
|
214
|
-
requestAnimationFrame(this._onScroll);
|
|
215
|
-
};
|
|
216
|
-
this._onResize = () => {
|
|
217
|
-
const positioner = react_dom_1.findDOMNode(this.refs.positioner);
|
|
218
|
-
const width = positioner.getBoundingClientRect().width;
|
|
219
|
-
const state = { width };
|
|
220
|
-
const _state = this.getState(this.props);
|
|
221
|
-
if (_state.affixState !== TOP)
|
|
222
|
-
state.top = _state.top;
|
|
223
|
-
this.setState(state);
|
|
224
|
-
};
|
|
225
|
-
this.onResize = () => {
|
|
226
|
-
requestAnimationFrame(this._onResize);
|
|
227
|
-
};
|
|
228
|
-
this.state = this.getState(props);
|
|
229
|
-
}
|
|
230
|
-
componentDidMount() {
|
|
231
|
-
window.addEventListener("scroll", this.onScroll);
|
|
232
|
-
window.addEventListener("resize", this.onResize);
|
|
233
|
-
}
|
|
234
|
-
componentWillUnmount() {
|
|
235
|
-
window.removeEventListener("scroll", this.onScroll);
|
|
236
|
-
window.removeEventListener("resize", this.onResize);
|
|
237
|
-
}
|
|
238
|
-
componentDidUpdate(prevProps, prevState) {
|
|
239
|
-
if (!this.props.onAffixChange || !prevState || !this.state)
|
|
240
|
-
return;
|
|
241
|
-
if (prevState.affixState !== AFFIXED && this.state.affixState === AFFIXED) {
|
|
242
|
-
this.props.onAffixChange(true);
|
|
243
|
-
}
|
|
244
|
-
else if (prevState.affixState === AFFIXED && this.state.affixState !== AFFIXED) {
|
|
245
|
-
this.props.onAffixChange(false);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
render() {
|
|
249
|
-
const { children, style: containerStyle } = this.props;
|
|
250
|
-
const { top, width, affixState, affixHeight, fixerHeight } = this.state || {};
|
|
251
|
-
const style = {};
|
|
252
|
-
const fixerStyle = { position: "relative", zIndex: -1, height: fixerHeight };
|
|
253
|
-
style.position = "relative";
|
|
254
|
-
if (affixState === BOTTOM || affixState === AFFIXED) {
|
|
255
|
-
style.position = "fixed";
|
|
256
|
-
style.width = width;
|
|
257
|
-
style.top = top;
|
|
258
|
-
style.zIndex = 1000;
|
|
259
|
-
style.height = affixHeight;
|
|
260
|
-
if (affixState === BOTTOM) {
|
|
261
|
-
style.overflow = "hidden";
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return (React.createElement("div", { style: containerStyle, ref: "container" },
|
|
265
|
-
React.createElement("div", { ref: "positioner" }),
|
|
266
|
-
React.createElement("div", { ref: "wrapper", style: style, className: this.props.className }, children),
|
|
267
|
-
React.createElement("div", { style: fixerStyle })));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
exports.Affix = Affix;
|
|
271
|
-
class Stretch extends React.Component {
|
|
272
|
-
constructor(props) {
|
|
273
|
-
super(props);
|
|
274
|
-
this._onScroll = () => {
|
|
275
|
-
let callback = undefined;
|
|
276
|
-
const state = this.getState();
|
|
277
|
-
if (!this.cameToViewFirstTime && state.height > this.props.enterViewPortTreshold || 0) {
|
|
278
|
-
this.cameToViewFirstTime = true;
|
|
279
|
-
if (this.props.onEnterViewPort)
|
|
280
|
-
callback = () => this.props.onEnterViewPort();
|
|
281
|
-
}
|
|
282
|
-
this.update(state, callback);
|
|
283
|
-
};
|
|
284
|
-
this.onScroll = () => {
|
|
285
|
-
requestAnimationFrame(this._onScroll);
|
|
286
|
-
};
|
|
287
|
-
this.update = (state, callback) => {
|
|
288
|
-
const afterStateChange = () => {
|
|
289
|
-
if (this.props.onResize)
|
|
290
|
-
this.props.onResize();
|
|
291
|
-
callback && callback();
|
|
292
|
-
};
|
|
293
|
-
state ? this.setState(state, () => {
|
|
294
|
-
afterStateChange();
|
|
295
|
-
}) : afterStateChange;
|
|
296
|
-
};
|
|
297
|
-
this.getState = () => {
|
|
298
|
-
const { getContainer, topOffset = 0, bottomOffset = 0, minHeight } = this.props;
|
|
299
|
-
let container = getContainer();
|
|
300
|
-
if (this.refs.wrapper &&
|
|
301
|
-
this.props.getContainer().getBoundingClientRect().top !== react_dom_1.findDOMNode(this.refs.wrapper).getBoundingClientRect().top) {
|
|
302
|
-
return {
|
|
303
|
-
horizontallyAligned: false
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
let containerHeight = container.offsetHeight;
|
|
307
|
-
if (minHeight && containerHeight < minHeight) {
|
|
308
|
-
containerHeight = minHeight;
|
|
309
|
-
container = this.refs.wrapper;
|
|
310
|
-
}
|
|
311
|
-
const viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
312
|
-
const bottomDist = viewportHeight - container.getBoundingClientRect().top - containerHeight;
|
|
313
|
-
const bottomInvisibleHeight = Math.min(bottomDist, 0);
|
|
314
|
-
return {
|
|
315
|
-
horizontallyAligned: true,
|
|
316
|
-
containerHeight,
|
|
317
|
-
height: Math.max(containerHeight
|
|
318
|
-
+ Math.min(container.getBoundingClientRect().top, 0)
|
|
319
|
-
+ Math.min(bottomInvisibleHeight, 0)
|
|
320
|
-
- (container.getBoundingClientRect().top < topOffset ? Math.min(topOffset - container.getBoundingClientRect().top, topOffset) : 0)
|
|
321
|
-
- (bottomDist < bottomOffset ? Math.min(bottomOffset - bottomDist, bottomOffset) : 0), 0),
|
|
322
|
-
top: Math.max(-container.getBoundingClientRect().top + topOffset, 0)
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
this.state = {};
|
|
326
|
-
}
|
|
327
|
-
UNSAFE_componentWillReceiveProps(props) {
|
|
328
|
-
if (props.mounted && !this.initialized) {
|
|
329
|
-
const state = this.getState();
|
|
330
|
-
this.update(state);
|
|
331
|
-
this.cameToViewFirstTime = state.height > this.props.enterViewPortTreshold || 0;
|
|
332
|
-
this.initialized = true;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
componentDidMount() {
|
|
336
|
-
window.addEventListener("scroll", this.onScroll);
|
|
337
|
-
window.addEventListener("resize", this.onScroll);
|
|
338
|
-
}
|
|
339
|
-
componentWillUnmount() {
|
|
340
|
-
window.removeEventListener("scroll", this.onScroll);
|
|
341
|
-
window.removeEventListener("resize", this.onScroll);
|
|
342
|
-
}
|
|
343
|
-
render() {
|
|
344
|
-
const { children } = this.props;
|
|
345
|
-
const wrapperStyle = {
|
|
346
|
-
height: this.state.horizontallyAligned ? this.state.containerHeight : this.props.minHeight,
|
|
347
|
-
};
|
|
348
|
-
const style = {
|
|
349
|
-
position: "relative",
|
|
350
|
-
top: this.state.horizontallyAligned ? this.state.top : undefined,
|
|
351
|
-
height: this.state.horizontallyAligned ? this.state.height : "100%",
|
|
352
|
-
};
|
|
353
|
-
return (React.createElement("div", { ref: "wrapper", style: wrapperStyle, className: this.props.className },
|
|
354
|
-
React.createElement("div", { style: style }, children)));
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.Stretch = Stretch;
|
|
358
|
-
function Help({ help, id }) {
|
|
359
|
-
const helpGlyph = React.createElement("span", { className: "laji-form-help-glyph text-muted" });
|
|
360
|
-
const { Tooltip } = React.useContext(ReactContext_1.default).theme;
|
|
361
|
-
return help ? (React.createElement(OverlayTrigger, { placement: "right", overlay: React.createElement(Tooltip, { id: id },
|
|
362
|
-
React.createElement("span", { dangerouslySetInnerHTML: { __html: help } })) }, helpGlyph)) : helpGlyph;
|
|
363
|
-
}
|
|
364
|
-
exports.Help = Help;
|
|
365
|
-
function Label({ label, children, id, required, registry = {}, uiSchema = {} }) {
|
|
366
|
-
const { "ui:help": help, "ui:helpHoverable": helpHoverable, "ui:helpPlacement": helpPlacement } = uiSchema;
|
|
367
|
-
const showHelp = label && help;
|
|
368
|
-
const { Tooltip } = React.useContext(ReactContext_1.default).theme;
|
|
369
|
-
const tooltipElem = (React.createElement(Tooltip, { id: id + "-tooltip" }, help ? (React.createElement("span", null,
|
|
370
|
-
React.createElement("strong", { dangerouslySetInnerHTML: { __html: label } }),
|
|
371
|
-
React.createElement("br", null),
|
|
372
|
-
React.createElement("span", { dangerouslySetInnerHTML: { __html: help } }))) : label));
|
|
373
|
-
const requiredHtml = required ? "<span class='text-danger'>*</span>" : "";
|
|
374
|
-
const labelElem = (React.createElement("label", { htmlFor: id },
|
|
375
|
-
React.createElement("div", null,
|
|
376
|
-
React.createElement("strong", { dangerouslySetInnerHTML: { __html: label + requiredHtml } }),
|
|
377
|
-
showHelp ? React.createElement(Help, null) : null),
|
|
378
|
-
children));
|
|
379
|
-
return (label || help) ? (React.createElement(OverlayTrigger, { placement: helpPlacement || "right", overlay: tooltipElem, hoverable: helpHoverable, formContext: registry.formContext }, labelElem)) : labelElem;
|
|
380
|
-
}
|
|
381
|
-
exports.Label = Label;
|
|
382
|
-
class ErrorPanel extends React.Component {
|
|
383
|
-
constructor(props) {
|
|
384
|
-
super(props);
|
|
385
|
-
this.expand = () => {
|
|
386
|
-
if (!this.state.expanded)
|
|
387
|
-
this.setState({ expanded: true });
|
|
388
|
-
};
|
|
389
|
-
this.collapseToggle = () => this.setState({ expanded: !this.state.expanded });
|
|
390
|
-
this.state = { expanded: true };
|
|
391
|
-
}
|
|
392
|
-
render() {
|
|
393
|
-
const { errors, title, clickHandler, poppedToggle, showToggle, classNames, footer } = this.props;
|
|
394
|
-
if (errors.length === 0)
|
|
395
|
-
return null;
|
|
396
|
-
const { Panel, ListGroup } = this.context.theme;
|
|
397
|
-
return (React.createElement(Panel, { collapsible: "true", onToggle: this.collapseToggle, className: classNames },
|
|
398
|
-
React.createElement(Panel.Heading, null,
|
|
399
|
-
React.createElement("div", { className: "laji-form-clickable-panel-header", onClick: this.collapseToggle },
|
|
400
|
-
React.createElement("div", { className: "panel-title" },
|
|
401
|
-
title,
|
|
402
|
-
React.createElement("span", { className: "pull-right" },
|
|
403
|
-
React.createElement(exports.GlyphButton, { glyph: this.state.expanded ? "chevron-up" : "chevron-down", variant: "link" }),
|
|
404
|
-
showToggle ? React.createElement(exports.GlyphButton, { glyph: "new-window", variant: "link", onClick: poppedToggle }) : null)))),
|
|
405
|
-
React.createElement(Panel.Collapse, { in: this.state.expanded },
|
|
406
|
-
React.createElement(ListGroup, null, errors.map((props, i) => React.createElement(ErrorPanelError, Object.assign({ key: i, clickHandler: clickHandler }, props))))),
|
|
407
|
-
footer
|
|
408
|
-
? (React.createElement(Panel.Footer, null, footer))
|
|
409
|
-
: null));
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
exports.ErrorPanel = ErrorPanel;
|
|
413
|
-
ErrorPanel.contextType = ReactContext_1.default;
|
|
414
|
-
function ErrorPanelError({ label, error, id, getId, extra = null, disabled, clickHandler }) {
|
|
415
|
-
const message = error && error.message ? error.message : error;
|
|
416
|
-
const _clickHandler = React.useCallback(() => {
|
|
417
|
-
clickHandler(id || (getId ? getId() : undefined));
|
|
418
|
-
}, [clickHandler, id, getId]);
|
|
419
|
-
const { ListGroupItem } = React.useContext(ReactContext_1.default).theme;
|
|
420
|
-
return (React.createElement(ListGroupItem, { onClick: _clickHandler, disabled: disabled },
|
|
421
|
-
label ? React.createElement("b", null,
|
|
422
|
-
label,
|
|
423
|
-
":") : null,
|
|
424
|
-
" ",
|
|
425
|
-
message,
|
|
426
|
-
" ",
|
|
427
|
-
extra));
|
|
428
|
-
}
|
|
429
|
-
// Tooltip component that doesn't show tooltip for empty/undefined tooltip.
|
|
430
|
-
class TooltipComponent extends React.Component {
|
|
431
|
-
constructor(props) {
|
|
432
|
-
super(props);
|
|
433
|
-
this.onMouseOver = () => {
|
|
434
|
-
this.setState({ show: true });
|
|
435
|
-
};
|
|
436
|
-
this.onMouseOut = () => {
|
|
437
|
-
this.setState({ show: false });
|
|
438
|
-
};
|
|
439
|
-
this.state = { show: false };
|
|
440
|
-
}
|
|
441
|
-
render() {
|
|
442
|
-
const { tooltip, children, id, placement, trigger, className } = this.props;
|
|
443
|
-
const { OverlayTrigger, Tooltip } = this.context.theme;
|
|
444
|
-
const overlay = (tooltip ? (React.createElement(OverlayTrigger, { show: this.state.show, placement: placement, trigger: trigger === "hover" ? [] : trigger, key: `${id}-overlay`, overlay: React.createElement(Tooltip, { id: `${id}-tooltip`, className: `${className}` }, React.isValidElement(tooltip) ? tooltip : React.createElement("span", { dangerouslySetInnerHTML: { __html: tooltip } })) }, children)) : React.createElement(React.Fragment, null, children));
|
|
445
|
-
return (trigger === "hover") ? (React.createElement("div", { onMouseOver: this.onMouseOver, onMouseOut: this.onMouseOut }, overlay)) : overlay;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
exports.TooltipComponent = TooltipComponent;
|
|
449
|
-
TooltipComponent.contextType = ReactContext_1.default;
|
|
450
|
-
exports.FetcherInput = React.forwardRef((props, ref) => {
|
|
451
|
-
const { loading, validationState, glyph, extra, onMouseOver, onMouseOut, className = "", InputComponent } = props, inputProps = __rest(props, ["loading", "validationState", "glyph", "extra", "onMouseOver", "onMouseOut", "className", "InputComponent"]); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
452
|
-
const { InputGroup, FormGroup } = React.useContext(ReactContext_1.default).theme;
|
|
453
|
-
const Input = InputComponent ? InputComponent : FetcherInputDefaultInput;
|
|
454
|
-
const _extra = (!Array.isArray(extra)) ? [extra] : extra;
|
|
455
|
-
const hasExtras = _extra.some(item => item !== null && item !== undefined);
|
|
456
|
-
const inputContent = React.createElement(React.Fragment, null,
|
|
457
|
-
hasExtras && React.createElement(InputGroup.Button, null, _extra),
|
|
458
|
-
React.createElement(Input, Object.assign({}, inputProps, { ref: ref })),
|
|
459
|
-
glyph,
|
|
460
|
-
loading && React.createElement(Spinner, null));
|
|
461
|
-
const content = hasExtras
|
|
462
|
-
? (React.createElement(InputGroup, null, inputContent))
|
|
463
|
-
: inputContent;
|
|
464
|
-
return (React.createElement(FormGroup, { onMouseOver: onMouseOver, onMouseOut: onMouseOut, validationState: validationState, className: utils_1.classNames(className, "fetcher-input") }, content));
|
|
465
|
-
});
|
|
466
|
-
const FetcherInputDefaultInput = React.forwardRef((props, ref) => {
|
|
467
|
-
const { readonly } = props, inputProps = __rest(props, ["readonly"]);
|
|
468
|
-
const { FormControl } = React.useContext(ReactContext_1.default).theme;
|
|
469
|
-
return React.createElement(FormControl, Object.assign({ type: "text" }, inputProps, { readOnly: readonly, ref: ref }));
|
|
470
|
-
});
|
|
471
|
-
// OverlayTrigger that is hoverable if hoverable === true
|
|
472
|
-
class OverlayTrigger extends React.Component {
|
|
473
|
-
constructor(props) {
|
|
474
|
-
super(props);
|
|
475
|
-
this.overlayTriggerMouseOver = () => {
|
|
476
|
-
this.overlayTriggerMouseIn = true;
|
|
477
|
-
this.setState({ show: true });
|
|
478
|
-
};
|
|
479
|
-
this.overlayTriggerMouseOut = () => {
|
|
480
|
-
this.overlayTriggerMouseIn = false;
|
|
481
|
-
if (this.overlayTimeout) {
|
|
482
|
-
clearTimeout(this.overlayTimeout);
|
|
483
|
-
}
|
|
484
|
-
this.overlayTimeout = this.props.formContext.setTimeout(() => {
|
|
485
|
-
if (!this.popoverMouseIn && !this.overlayTriggerMouseIn) {
|
|
486
|
-
this.setState({ show: false });
|
|
487
|
-
}
|
|
488
|
-
}, 200);
|
|
489
|
-
};
|
|
490
|
-
this.overlayMouseOver = () => {
|
|
491
|
-
this.overlayMouseIn = true;
|
|
492
|
-
};
|
|
493
|
-
this.overlayMouseOut = () => {
|
|
494
|
-
this.overlayMouseIn = false;
|
|
495
|
-
if (this.overlayTimeout) {
|
|
496
|
-
clearTimeout(this.overlayTimeout);
|
|
497
|
-
}
|
|
498
|
-
this.overlayTimeout = this.props.formContext.setTimeout(() => {
|
|
499
|
-
if (!this.overlayMouseIn && !this.overlayTriggerMouseIn) {
|
|
500
|
-
this.setState({ show: false });
|
|
501
|
-
}
|
|
502
|
-
}, 200);
|
|
503
|
-
};
|
|
504
|
-
this.state = { show: false };
|
|
505
|
-
}
|
|
506
|
-
componentWillUnmount() {
|
|
507
|
-
if (this.overlayTimeout) {
|
|
508
|
-
clearTimeout(this.overlayTimeout);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
render() {
|
|
512
|
-
const _a = this.props, { children, overlay, contextId } = _a, //eslint-disable-line @typescript-eslint/no-unused-vars
|
|
513
|
-
props = __rest(_a, ["children", "overlay", "contextId"]);
|
|
514
|
-
const { OverlayTrigger } = this.context.theme;
|
|
515
|
-
if (!this.props.hoverable)
|
|
516
|
-
return (React.createElement(OverlayTrigger, Object.assign({}, props, { overlay: overlay }), children));
|
|
517
|
-
let _overlay = React.cloneElement(overlay, { onMouseOver: this.overlayMouseOver, onMouseOut: this.overlayMouseOut });
|
|
518
|
-
return (React.createElement("div", { onMouseOver: this.overlayTriggerMouseOver, onMouseOut: this.overlayTriggerMouseOut },
|
|
519
|
-
React.createElement(OverlayTrigger, Object.assign({}, props, { delay: 1, trigger: [], placement: this.props.placement || "top", overlay: _overlay, show: this.state.show }), children)));
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
exports.OverlayTrigger = OverlayTrigger;
|
|
523
|
-
OverlayTrigger.contextType = ReactContext_1.default;
|
|
524
|
-
class Fullscreen extends React.Component {
|
|
525
|
-
componentDidMount() {
|
|
526
|
-
this.bodyOverFlow = document.body.style.overflow;
|
|
527
|
-
if (this.props.onKeyDown) {
|
|
528
|
-
this._onKeyDown = true;
|
|
529
|
-
this.props.formContext.services.keyHandler.addGlobalEventHandler("keydown", this.props.onKeyDown);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
componentWillUnmount() {
|
|
533
|
-
document.body.style.overflow = this.bodyOverFlow;
|
|
534
|
-
if (this._onKeyDown) {
|
|
535
|
-
this.props.formContext.services.keyHandler.removeGlobalEventHandler("keydown", this.props.onKeyDown);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
render() {
|
|
539
|
-
return react_dom_1.createPortal((React.createElement("div", { className: "laji-form fullscreen" }, this.props.children)), document.body);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
exports.Fullscreen = Fullscreen;
|
|
543
|
-
class FailedBackgroundJobsPanel extends React.Component {
|
|
544
|
-
constructor(props) {
|
|
545
|
-
super(props);
|
|
546
|
-
this.dismissFailedJob = ({ id, hook, running }) => (e) => {
|
|
547
|
-
e.stopPropagation();
|
|
548
|
-
if (running)
|
|
549
|
-
return;
|
|
550
|
-
this.props.formContext.services.submitHooks.remove(id, hook);
|
|
551
|
-
};
|
|
552
|
-
this.retryFailedJob = ({ hook, running }) => (e) => {
|
|
553
|
-
e.stopPropagation();
|
|
554
|
-
if (running)
|
|
555
|
-
return;
|
|
556
|
-
hook();
|
|
557
|
-
};
|
|
558
|
-
this.poppedToggle = (e) => {
|
|
559
|
-
e.stopPropagation();
|
|
560
|
-
this.setState({ popped: !this.state.popped, poppedTouched: true });
|
|
561
|
-
};
|
|
562
|
-
this.state = { popped: true };
|
|
563
|
-
}
|
|
564
|
-
render() {
|
|
565
|
-
const { jobs = [], schema, uiSchema = {}, formContext: { translations } } = this.props;
|
|
566
|
-
if (!jobs.length)
|
|
567
|
-
return null;
|
|
568
|
-
const { Glyphicon } = this.context.theme;
|
|
569
|
-
const errors = jobs.reduce((_errors, error) => {
|
|
570
|
-
const { lajiFormId, relativePointer, e, running } = error;
|
|
571
|
-
if (!e) {
|
|
572
|
-
return _errors;
|
|
573
|
-
}
|
|
574
|
-
const getJsonPointer = () => this.props.formContext.services.ids.getJSONPointerFromLajiFormIdAndRelativePointer(lajiFormId, relativePointer);
|
|
575
|
-
const jsonPointer = getJsonPointer();
|
|
576
|
-
const label = utils_1.parseJSONPointer(uiSchema, `${utils_1.uiSchemaJSONPointer(uiSchema, jsonPointer)}/ui:title`, "safely")
|
|
577
|
-
|| utils_1.parseJSONPointer(schema, `${utils_1.schemaJSONPointer(schema, jsonPointer)}/title`, "safely");
|
|
578
|
-
const retryButton = React.createElement("a", { key: "rety", className: "pull-right", disabled: running, onClick: this.retryFailedJob(error) },
|
|
579
|
-
React.createElement(Glyphicon, { className: running ? "rotating" : "", glyph: "refresh" }),
|
|
580
|
-
" ",
|
|
581
|
-
translations.Retry);
|
|
582
|
-
const dismissButton = React.createElement("a", { key: "dismiss", className: "pull-right", onClick: this.dismissFailedJob(error) },
|
|
583
|
-
React.createElement(Glyphicon, { glyph: "ok" }),
|
|
584
|
-
" ",
|
|
585
|
-
translations.Dismiss);
|
|
586
|
-
const getId = () => {
|
|
587
|
-
const jsonPointer = getJsonPointer();
|
|
588
|
-
return `root_${utils_1.JSONPointerToId(jsonPointer)}`;
|
|
589
|
-
};
|
|
590
|
-
const _error = { getId, error: e, extra: [dismissButton, retryButton], disabled: running };
|
|
591
|
-
if (label)
|
|
592
|
-
_error.label = label;
|
|
593
|
-
return [..._errors, _error];
|
|
594
|
-
}, []);
|
|
595
|
-
if (!errors.length)
|
|
596
|
-
return null;
|
|
597
|
-
const footer = (React.createElement(Button, { onClick: this.props.formContext.services.submitHooks.removeAll },
|
|
598
|
-
React.createElement(Glyphicon, { glyph: "ok" }),
|
|
599
|
-
" ",
|
|
600
|
-
`${translations.Dismiss} ${translations.all}`));
|
|
601
|
-
return (React.createElement("div", { className: `laji-form-error-list laji-form-failed-jobs-list${this.state.popped ? " laji-form-popped" : ""}`, style: this.state.popped ? { top: (this.props.formContext.topOffset || 0) + 5 } : null },
|
|
602
|
-
React.createElement(ErrorPanel, { title: translations.FailedBackgroundJobs, errors: errors, showToggle: true, poppedToggle: this.poppedToggle, clickHandler: this.props.errorClickHandler, classNames: "error-panel", footer: footer })));
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
exports.FailedBackgroundJobsPanel = FailedBackgroundJobsPanel;
|
|
606
|
-
FailedBackgroundJobsPanel.contextType = ReactContext_1.default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default class AnnotationField extends React.Component<any, any, any> {
|
|
2
|
-
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
3
|
-
static propTypes: {
|
|
4
|
-
uiSchema: PropTypes.Validator<PropTypes.InferProps<{
|
|
5
|
-
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
-
adminOnly: PropTypes.Requireable<boolean>;
|
|
7
|
-
container: PropTypes.Requireable<string>;
|
|
8
|
-
add: PropTypes.Requireable<object>;
|
|
9
|
-
filter: PropTypes.Requireable<object>;
|
|
10
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
11
|
-
buttonsPath: PropTypes.Requireable<string>;
|
|
12
|
-
formId: PropTypes.Requireable<string>;
|
|
13
|
-
}>>;
|
|
14
|
-
uiSchema: PropTypes.Requireable<object>;
|
|
15
|
-
}>>;
|
|
16
|
-
schema: PropTypes.Validator<PropTypes.InferProps<{
|
|
17
|
-
type: PropTypes.Requireable<string>;
|
|
18
|
-
}>>;
|
|
19
|
-
formData: PropTypes.Validator<object>;
|
|
20
|
-
};
|
|
21
|
-
constructor(props: any);
|
|
22
|
-
getButton: () => {
|
|
23
|
-
glyph: string;
|
|
24
|
-
tooltip: any;
|
|
25
|
-
tooltipPlacement: string;
|
|
26
|
-
fn: () => () => void;
|
|
27
|
-
variant: string;
|
|
28
|
-
};
|
|
29
|
-
onClick: () => () => void;
|
|
30
|
-
onHide: () => void;
|
|
31
|
-
getAnnotations: () => any;
|
|
32
|
-
}
|
|
33
|
-
import * as React from "react";
|
|
34
|
-
import * as PropTypes from "prop-types";
|