@luomus/laji-form 15.1.4 → 15.1.6
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/lib/ApiClient.d.ts +46 -0
- package/lib/ApiClient.js +93 -0
- package/lib/Context.d.ts +8 -0
- package/lib/Context.js +18 -0
- package/lib/ReactContext.d.ts +7 -0
- package/lib/ReactContext.js +5 -0
- package/lib/components/BaseComponent.d.ts +9 -0
- package/lib/components/BaseComponent.js +29 -0
- package/lib/components/LajiForm.d.ts +221 -0
- package/lib/components/LajiForm.js +616 -0
- package/lib/components/VirtualSchemaField.d.ts +42 -0
- package/lib/components/VirtualSchemaField.js +74 -0
- package/lib/components/components.d.ts +119 -0
- package/lib/components/components.js +606 -0
- package/lib/components/fields/AnnotationField.d.ts +34 -0
- package/lib/components/fields/AnnotationField.js +242 -0
- package/lib/components/fields/AnyToBooleanField.d.ts +18 -0
- package/lib/components/fields/AnyToBooleanField.js +20 -0
- package/lib/components/fields/ArrayBulkField.d.ts +23 -0
- package/lib/components/fields/ArrayBulkField.js +82 -0
- package/lib/components/fields/ArrayCombinerField.d.ts +36 -0
- package/lib/components/fields/ArrayCombinerField.js +138 -0
- package/lib/components/fields/ArrayField.d.ts +39 -0
- package/lib/components/fields/ArrayField.js +148 -0
- package/lib/components/fields/AsArrayField.d.ts +292 -0
- package/lib/components/fields/AsArrayField.js +38 -0
- package/lib/components/fields/AudioArrayField.d.ts +22 -0
- package/lib/components/fields/AudioArrayField.js +100 -0
- package/lib/components/fields/AutoArrayField.d.ts +24 -0
- package/lib/components/fields/AutoArrayField.js +56 -0
- package/lib/components/fields/AutosuggestField.d.ts +69 -0
- package/lib/components/fields/AutosuggestField.js +299 -0
- package/lib/components/fields/CombinedValueDisplayField.d.ts +41 -0
- package/lib/components/fields/CombinedValueDisplayField.js +100 -0
- package/lib/components/fields/ConditionalOnChangeField.d.ts +42 -0
- package/lib/components/fields/ConditionalOnChangeField.js +107 -0
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +123 -0
- package/lib/components/fields/ConditionalUiSchemaField.js +143 -0
- package/lib/components/fields/ContextInjectionField.d.ts +24 -0
- package/lib/components/fields/ContextInjectionField.js +68 -0
- package/lib/components/fields/DataLeakerField.d.ts +40 -0
- package/lib/components/fields/DataLeakerField.js +68 -0
- package/lib/components/fields/DefaultValueArrayField.d.ts +34 -0
- package/lib/components/fields/DefaultValueArrayField.js +59 -0
- package/lib/components/fields/DependentBooleanField.d.ts +38 -0
- package/lib/components/fields/DependentBooleanField.js +87 -0
- package/lib/components/fields/DependentDisableField.d.ts +35 -0
- package/lib/components/fields/DependentDisableField.js +71 -0
- package/lib/components/fields/EnumRangeArrayField.d.ts +27 -0
- package/lib/components/fields/EnumRangeArrayField.js +115 -0
- package/lib/components/fields/ExtraLabelRowField.d.ts +38 -0
- package/lib/components/fields/ExtraLabelRowField.js +100 -0
- package/lib/components/fields/FakePropertyField.d.ts +18 -0
- package/lib/components/fields/FakePropertyField.js +48 -0
- package/lib/components/fields/FilterArrayField.d.ts +73 -0
- package/lib/components/fields/FilterArrayField.js +121 -0
- package/lib/components/fields/FlatField.d.ts +29 -0
- package/lib/components/fields/FlatField.js +171 -0
- package/lib/components/fields/GeocoderField.d.ts +47 -0
- package/lib/components/fields/GeocoderField.js +372 -0
- package/lib/components/fields/GridLayoutField.d.ts +18 -0
- package/lib/components/fields/GridLayoutField.js +32 -0
- package/lib/components/fields/HiddenField.d.ts +10 -0
- package/lib/components/fields/HiddenField.js +11 -0
- package/lib/components/fields/ImageArrayField.d.ts +172 -0
- package/lib/components/fields/ImageArrayField.js +699 -0
- package/lib/components/fields/ImageDisplayField.d.ts +18 -0
- package/lib/components/fields/ImageDisplayField.js +44 -0
- package/lib/components/fields/InitiallyHiddenField.d.ts +21 -0
- package/lib/components/fields/InitiallyHiddenField.js +58 -0
- package/lib/components/fields/InjectDefaultValueField.d.ts +37 -0
- package/lib/components/fields/InjectDefaultValueField.js +68 -0
- package/lib/components/fields/InjectField.d.ts +46 -0
- package/lib/components/fields/InjectField.js +88 -0
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +25 -0
- package/lib/components/fields/InputWithDefaultValueButtonField.js +61 -0
- package/lib/components/fields/LocalityField.d.ts +22 -0
- package/lib/components/fields/LocalityField.js +94 -0
- package/lib/components/fields/LocationChooserField.d.ts +27 -0
- package/lib/components/fields/LocationChooserField.js +440 -0
- package/lib/components/fields/MapArrayField.d.ts +78 -0
- package/lib/components/fields/MapArrayField.js +1783 -0
- package/lib/components/fields/MapField.d.ts +48 -0
- package/lib/components/fields/MapField.js +434 -0
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +25 -0
- package/lib/components/fields/MultiAnyToBooleanField.js +100 -0
- package/lib/components/fields/MultiArrayField.d.ts +53 -0
- package/lib/components/fields/MultiArrayField.js +224 -0
- package/lib/components/fields/MultiLanguageField.d.ts +13 -0
- package/lib/components/fields/MultiLanguageField.js +52 -0
- package/lib/components/fields/MultiTagArrayField.d.ts +36 -0
- package/lib/components/fields/MultiTagArrayField.js +142 -0
- package/lib/components/fields/NamedPlaceChooserField.d.ts +29 -0
- package/lib/components/fields/NamedPlaceChooserField.js +380 -0
- package/lib/components/fields/NamedPlaceSaverField.d.ts +29 -0
- package/lib/components/fields/NamedPlaceSaverField.js +237 -0
- package/lib/components/fields/NestField.d.ts +148 -0
- package/lib/components/fields/NestField.js +289 -0
- package/lib/components/fields/ObjectField.d.ts +2 -0
- package/lib/components/fields/ObjectField.js +119 -0
- package/lib/components/fields/PdfArrayField.d.ts +21 -0
- package/lib/components/fields/PdfArrayField.js +40 -0
- package/lib/components/fields/PrefillingArrayField.d.ts +22 -0
- package/lib/components/fields/PrefillingArrayField.js +65 -0
- package/lib/components/fields/SchemaField.d.ts +7 -0
- package/lib/components/fields/SchemaField.js +109 -0
- package/lib/components/fields/ScopeField.d.ts +85 -0
- package/lib/components/fields/ScopeField.js +521 -0
- package/lib/components/fields/SectionArrayField.d.ts +38 -0
- package/lib/components/fields/SectionArrayField.js +618 -0
- package/lib/components/fields/SelectTreeField.d.ts +39 -0
- package/lib/components/fields/SelectTreeField.js +143 -0
- package/lib/components/fields/SingleActiveArrayField.d.ts +49 -0
- package/lib/components/fields/SingleActiveArrayField.js +974 -0
- package/lib/components/fields/SingleItemArrayField.d.ts +15 -0
- package/lib/components/fields/SingleItemArrayField.js +60 -0
- package/lib/components/fields/SortArrayField.d.ts +73 -0
- package/lib/components/fields/SortArrayField.js +351 -0
- package/lib/components/fields/SplitField.d.ts +28 -0
- package/lib/components/fields/SplitField.js +65 -0
- package/lib/components/fields/StringToArrayField.d.ts +24 -0
- package/lib/components/fields/StringToArrayField.js +48 -0
- package/lib/components/fields/SumField.d.ts +35 -0
- package/lib/components/fields/SumField.js +83 -0
- package/lib/components/fields/TableField.d.ts +18 -0
- package/lib/components/fields/TableField.js +136 -0
- package/lib/components/fields/TagArrayField.d.ts +38 -0
- package/lib/components/fields/TagArrayField.js +128 -0
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +26 -0
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +81 -0
- package/lib/components/fields/UiFieldApplierField.d.ts +30 -0
- package/lib/components/fields/UiFieldApplierField.js +106 -0
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +42 -0
- package/lib/components/fields/UiFieldMapperArrayField.js +121 -0
- package/lib/components/fields/UnitCountShorthandField.d.ts +22 -0
- package/lib/components/fields/UnitCountShorthandField.js +149 -0
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +26 -0
- package/lib/components/fields/UnitListShorthandArrayField.js +108 -0
- package/lib/components/fields/UnitShorthandField.d.ts +32 -0
- package/lib/components/fields/UnitShorthandField.js +220 -0
- package/lib/components/templates/ArrayFieldTemplate.d.ts +85 -0
- package/lib/components/templates/ArrayFieldTemplate.js +416 -0
- package/lib/components/templates/BaseInputTemplate.d.ts +11 -0
- package/lib/components/templates/BaseInputTemplate.js +80 -0
- package/lib/components/templates/DescriptionField.d.ts +1 -0
- package/lib/components/templates/DescriptionField.js +37 -0
- package/lib/components/templates/ErrorListTemplate.d.ts +9 -0
- package/lib/components/templates/ErrorListTemplate.js +95 -0
- package/lib/components/templates/FieldTemplate.d.ts +6 -0
- package/lib/components/templates/FieldTemplate.js +112 -0
- package/lib/components/templates/ObjectFieldTemplate.d.ts +7 -0
- package/lib/components/templates/ObjectFieldTemplate.js +66 -0
- package/lib/components/templates/TitleField.d.ts +9 -0
- package/lib/components/templates/TitleField.js +51 -0
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +20 -0
- package/lib/components/widgets/AnyToBooleanWidget.js +49 -0
- package/lib/components/widgets/AutosuggestWidget.d.ts +66 -0
- package/lib/components/widgets/AutosuggestWidget.js +1127 -0
- package/lib/components/widgets/CheckboxWidget.d.ts +37 -0
- package/lib/components/widgets/CheckboxWidget.js +139 -0
- package/lib/components/widgets/DateTimeWidget.d.ts +62 -0
- package/lib/components/widgets/DateTimeWidget.js +251 -0
- package/lib/components/widgets/DateWidget.d.ts +23 -0
- package/lib/components/widgets/DateWidget.js +41 -0
- package/lib/components/widgets/HiddenWidget.d.ts +15 -0
- package/lib/components/widgets/HiddenWidget.js +19 -0
- package/lib/components/widgets/ImageSelectWidget.d.ts +14 -0
- package/lib/components/widgets/ImageSelectWidget.js +57 -0
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +43 -0
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +237 -0
- package/lib/components/widgets/InputGroupWidget.d.ts +21 -0
- package/lib/components/widgets/InputGroupWidget.js +36 -0
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +21 -0
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +47 -0
- package/lib/components/widgets/NumberWidget.d.ts +13 -0
- package/lib/components/widgets/NumberWidget.js +21 -0
- package/lib/components/widgets/PlainTextWidget.d.ts +12 -0
- package/lib/components/widgets/PlainTextWidget.js +24 -0
- package/lib/components/widgets/SelectWidget.d.ts +52 -0
- package/lib/components/widgets/SelectWidget.js +158 -0
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +19 -0
- package/lib/components/widgets/SeparatedDateTimeWidget.js +59 -0
- package/lib/components/widgets/TaxonImageWidget.d.ts +13 -0
- package/lib/components/widgets/TaxonImageWidget.js +30 -0
- package/lib/components/widgets/TextSelectWidget.d.ts +25 -0
- package/lib/components/widgets/TextSelectWidget.js +94 -0
- package/lib/components/widgets/TextareaWidget.d.ts +32 -0
- package/lib/components/widgets/TextareaWidget.js +87 -0
- package/lib/components/widgets/TimeWidget.d.ts +11 -0
- package/lib/components/widgets/TimeWidget.js +19 -0
- package/lib/components/widgets/URLWidget.d.ts +14 -0
- package/lib/components/widgets/URLWidget.js +12 -0
- package/lib/components/widgets/UpperCaseWidget.d.ts +13 -0
- package/lib/components/widgets/UpperCaseWidget.js +21 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +50 -0
- package/lib/services/blocker-service.d.ts +11 -0
- package/lib/services/blocker-service.js +55 -0
- package/lib/services/custom-event-service.d.ts +17 -0
- package/lib/services/custom-event-service.js +35 -0
- package/lib/services/dom-id-service.d.ts +8 -0
- package/lib/services/dom-id-service.js +30 -0
- package/lib/services/focus-service.d.ts +13 -0
- package/lib/services/focus-service.js +60 -0
- package/lib/services/id-service.d.ts +22 -0
- package/lib/services/id-service.js +130 -0
- package/lib/services/key-handler-service.d.ts +56 -0
- package/lib/services/key-handler-service.js +184 -0
- package/lib/services/root-instance-service.d.ts +25 -0
- package/lib/services/root-instance-service.js +49 -0
- package/lib/services/settings-service.d.ts +34 -0
- package/lib/services/settings-service.js +154 -0
- package/lib/services/singleton-map-service.d.ts +23 -0
- package/lib/services/singleton-map-service.js +44 -0
- package/lib/services/submit-hook-service.d.ts +24 -0
- package/lib/services/submit-hook-service.js +73 -0
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +4 -0
- package/lib/themes/bs3.d.ts +3 -0
- package/lib/themes/bs3.js +133 -0
- package/lib/themes/bs5.d.ts +3 -0
- package/lib/themes/bs5.js +111 -0
- package/lib/themes/glyphicon-fa-mapping.d.ts +3 -0
- package/lib/themes/glyphicon-fa-mapping.js +271 -0
- package/lib/themes/stub.d.ts +3 -0
- package/lib/themes/stub.js +82 -0
- package/lib/themes/theme.d.ts +233 -0
- package/lib/themes/theme.js +2 -0
- package/lib/translations.json +847 -0
- package/lib/utils.d.ts +167 -0
- package/lib/utils.js +1185 -0
- package/lib/validation.d.ts +7 -0
- package/lib/validation.js +141 -0
- package/package.json +2 -2
- package/patches/protractor++webdriver-manager+12.1.8.patch +0 -20395
|
@@ -0,0 +1,606 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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";
|