@luomus/laji-form 15.1.93 → 15.1.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laji-form.js +1 -1
- package/lib/components/LajiForm.d.ts +2 -3
- package/lib/components/VirtualSchemaField.d.ts +1 -1
- package/lib/components/VirtualSchemaField.js +13 -12
- package/lib/components/components/Button.d.ts +1 -1
- package/lib/components/components/GlyphButton.d.ts +1 -1
- package/lib/components/fields/AnnotationField.d.ts +12 -7
- package/lib/components/fields/AnnotationField.js +16 -22
- package/lib/components/fields/AnyToBooleanField.d.ts +11 -10
- package/lib/components/fields/ArrayField.js +2 -12
- package/lib/components/fields/ArrayPropertySumField.d.ts +0 -1
- package/lib/components/fields/ArrayPropertySumField.js +8 -23
- package/lib/components/fields/ExtraLabelRowField.d.ts +1 -1
- package/lib/components/fields/ExtraLabelRowField.js +4 -14
- package/lib/components/fields/FilterArrayField.d.ts +1 -1
- package/lib/components/fields/FilterArrayField.js +4 -17
- package/lib/components/fields/GeocoderField.js +6 -40
- package/lib/components/fields/ImageArrayField.js +2 -6
- package/lib/components/fields/ImageDisplayField.js +2 -12
- package/lib/components/fields/InitiallyHiddenField.d.ts +1 -4
- package/lib/components/fields/InitiallyHiddenField.js +6 -19
- package/lib/components/fields/LocalityField.d.ts +1 -0
- package/lib/components/fields/LocalityField.js +5 -15
- package/lib/components/fields/LocationChooserField.d.ts +44 -2
- package/lib/components/fields/LocationChooserField.js +5 -16
- package/lib/components/fields/MultiActiveArrayField.d.ts +1 -0
- package/lib/components/fields/MultiActiveArrayField.js +5 -12
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +2 -7
- package/lib/components/fields/MultiAnyToBooleanField.js +6 -19
- package/lib/components/fields/MultiArrayField.d.ts +2 -1
- package/lib/components/fields/MultiArrayField.js +5 -14
- package/lib/components/fields/MultiLanguageField.js +2 -15
- package/lib/components/fields/MultiTagArrayField.js +2 -12
- package/lib/components/fields/NamedPlaceSaverField.d.ts +46 -46
- package/lib/components/fields/NamedPlaceSaverField.js +6 -19
- package/lib/components/fields/PrefixArrayField.d.ts +2 -0
- package/lib/components/fields/PrefixArrayField.js +9 -15
- package/lib/components/fields/ScientificNameTaxonAutosuggestField.d.ts +3 -2
- package/lib/components/fields/ScientificNameTaxonAutosuggestField.js +6 -16
- package/lib/components/fields/SingleActiveArrayField.js +2 -6
- package/lib/components/fields/SplitField.js +2 -12
- package/lib/components/fields/TableField.js +2 -6
- package/lib/components/fields/TagArrayField.js +2 -12
- package/lib/components/fields/TaxonSetPopulatorField.js +3 -1
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -4
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +4 -18
- package/lib/components/fields/UnitCountShorthandField.js +2 -6
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +46 -45
- package/lib/components/fields/UnitListShorthandArrayField.js +8 -18
- package/lib/components/fields/UnitShorthandField.js +7 -17
- package/lib/components/fields/index.d.ts +0 -1
- package/lib/components/fields/index.js +2 -4
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +14 -12
- package/lib/components/widgets/AnyToBooleanWidget.js +3 -2
- package/lib/components/widgets/DateTimeWidget.d.ts +9 -0
- package/lib/components/widgets/DateTimeWidget.js +7 -14
- package/lib/components/widgets/ImageSelectWidget.js +2 -12
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +2 -12
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +5 -1
- package/lib/components/widgets/SeparatedDateTimeWidget.js +8 -14
- package/lib/themes/theme.d.ts +1 -0
- package/lib/types.d.ts +1 -1
- package/lib/utils.d.ts +1 -1
- package/package.json +3 -3
- package/lib/components/BaseComponent.d.ts +0 -8
- package/lib/components/BaseComponent.js +0 -28
- package/lib/components/fields/ArrayBulkField.d.ts +0 -28
- package/lib/components/fields/ArrayBulkField.js +0 -118
|
@@ -198,7 +198,6 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
198
198
|
ArrayField: typeof fields.ArrayField;
|
|
199
199
|
ObjectField: (props: any) => JSX.Element;
|
|
200
200
|
NestField: typeof fields.NestField;
|
|
201
|
-
ArrayBulkField: typeof fields.ArrayBulkField;
|
|
202
201
|
ArrayPropertySumField: typeof fields.ArrayPropertySumField;
|
|
203
202
|
ScopeField: typeof fields.ScopeField;
|
|
204
203
|
SelectTreeField: typeof fields.SelectTreeField;
|
|
@@ -272,7 +271,7 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
272
271
|
AnnotationField: typeof fields.AnnotationField;
|
|
273
272
|
PrefillingArrayField: typeof fields.PrefillingArrayField;
|
|
274
273
|
AnyToBooleanField: {
|
|
275
|
-
(props:
|
|
274
|
+
(props: FieldProps): JSX.Element;
|
|
276
275
|
propTypes: {
|
|
277
276
|
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
278
277
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -387,7 +386,7 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
387
386
|
TextSelectWidget: typeof widgets.TextSelectWidget;
|
|
388
387
|
ImageSelectWidget: typeof widgets.ImageSelectWidget;
|
|
389
388
|
AnyToBooleanWidget: {
|
|
390
|
-
(props:
|
|
389
|
+
(props: import("../types").WidgetProps): JSX.Element;
|
|
391
390
|
propTypes: {
|
|
392
391
|
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
393
392
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -11,6 +11,7 @@ interface LajiFormComponentForVirtualSchemaField extends Omit<React.Component<Fi
|
|
|
11
11
|
*/
|
|
12
12
|
export default function VirtualSchemaField<LFC extends Constructor<LajiFormComponentForVirtualSchemaField>>(ComposedComponent: LFC): {
|
|
13
13
|
new (...args: any[]): {
|
|
14
|
+
UNSAFE_componentWillReceiveProps: (props: any, nextContext: any) => void;
|
|
14
15
|
getUiOptions(): any;
|
|
15
16
|
getStateFromProps: (props: FieldProps) => any;
|
|
16
17
|
render: () => React.ReactNode;
|
|
@@ -33,7 +34,6 @@ export default function VirtualSchemaField<LFC extends Constructor<LajiFormCompo
|
|
|
33
34
|
componentWillMount?: (() => void) | undefined;
|
|
34
35
|
UNSAFE_componentWillMount?: (() => void) | undefined;
|
|
35
36
|
componentWillReceiveProps?: ((nextProps: Readonly<FieldProps>, nextContext: any) => void) | undefined;
|
|
36
|
-
UNSAFE_componentWillReceiveProps?: ((nextProps: Readonly<FieldProps>, nextContext: any) => void) | undefined;
|
|
37
37
|
componentWillUpdate?: ((nextProps: Readonly<FieldProps>, nextState: Readonly<{}>, nextContext: any) => void) | undefined;
|
|
38
38
|
UNSAFE_componentWillUpdate?: ((nextProps: Readonly<FieldProps>, nextState: Readonly<{}>, nextContext: any) => void) | undefined;
|
|
39
39
|
};
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -46,7 +40,6 @@ exports.getPropsWithInnerUiSchema = getPropsWithInnerUiSchema;
|
|
|
46
40
|
exports.default = VirtualSchemaField;
|
|
47
41
|
const React = __importStar(require("react"));
|
|
48
42
|
const utils_1 = require("../utils");
|
|
49
|
-
const BaseComponent_1 = __importDefault(require("./BaseComponent"));
|
|
50
43
|
const Context_1 = __importDefault(require("../Context"));
|
|
51
44
|
function getPropsWithInnerUiSchema(props) {
|
|
52
45
|
return Object.assign(Object.assign({}, props), { uiSchema: (0, utils_1.getInnerUiSchema)(props.uiSchema) });
|
|
@@ -55,9 +48,19 @@ function getPropsWithInnerUiSchema(props) {
|
|
|
55
48
|
* Virtual SchemaFields are components which are just state transforming machines.
|
|
56
49
|
*/
|
|
57
50
|
function VirtualSchemaField(ComposedComponent) {
|
|
58
|
-
|
|
51
|
+
class VirtualSchemaField extends ComposedComponent {
|
|
59
52
|
constructor(...args) {
|
|
60
53
|
super(...args);
|
|
54
|
+
this.UNSAFE_componentWillReceiveProps = (props, nextContext) => {
|
|
55
|
+
if (super.UNSAFE_componentWillReceiveProps) {
|
|
56
|
+
super.UNSAFE_componentWillReceiveProps(props, nextContext);
|
|
57
|
+
}
|
|
58
|
+
else if (this.getStateFromProps) {
|
|
59
|
+
const state = this.getStateFromProps(props);
|
|
60
|
+
if (state)
|
|
61
|
+
this.setState(state);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
61
64
|
this.getStateFromProps = (props) => {
|
|
62
65
|
const propsWithInnerUiSchema = getPropsWithInnerUiSchema(props);
|
|
63
66
|
const state = super.getStateFromProps ? super.getStateFromProps(propsWithInnerUiSchema, props) : propsWithInnerUiSchema;
|
|
@@ -86,16 +89,14 @@ function VirtualSchemaField(ComposedComponent) {
|
|
|
86
89
|
return (React.createElement(SchemaField, Object.assign({}, filterProps(Object.assign(Object.assign({}, this.props), this.state)))));
|
|
87
90
|
};
|
|
88
91
|
this.getStateFromProps = this.getStateFromProps.bind(this);
|
|
92
|
+
this.state = this.getStateFromProps(args[0]);
|
|
89
93
|
this.render = this.render.bind(this);
|
|
90
94
|
}
|
|
91
95
|
getUiOptions() {
|
|
92
96
|
return (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
93
97
|
}
|
|
94
|
-
}
|
|
98
|
+
}
|
|
95
99
|
VirtualSchemaField.displayName = (0, utils_1.getReactComponentName)(ComposedComponent);
|
|
96
|
-
VirtualSchemaField = __decorate([
|
|
97
|
-
BaseComponent_1.default
|
|
98
|
-
], VirtualSchemaField);
|
|
99
100
|
if (ComposedComponent.getName) {
|
|
100
101
|
const name = ComposedComponent.getName();
|
|
101
102
|
(0, Context_1.default)("VIRTUAL_SCHEMA_NAMES")[name] = true;
|
|
@@ -11,4 +11,4 @@ export declare const Button: React.ForwardRefExoticComponent<Pick<ThemedButtonPr
|
|
|
11
11
|
tooltipPlacement?: string;
|
|
12
12
|
tooltipTrigger?: string;
|
|
13
13
|
tooltipClass?: string;
|
|
14
|
-
}, "small" | "variant" | "key" | "block" | "id" | "active" | "style" | "className" | "children" | "disabled" | "tooltip" | "onKeyDown" | "onClick" | "tooltipPlacement" | "tooltipTrigger" | "tooltipClass"> & React.RefAttributes<unknown>>;
|
|
14
|
+
}, "small" | "variant" | "type" | "key" | "block" | "id" | "active" | "style" | "className" | "children" | "disabled" | "tooltip" | "onKeyDown" | "onClick" | "tooltipPlacement" | "tooltipTrigger" | "tooltipClass"> & React.RefAttributes<unknown>>;
|
|
@@ -7,4 +7,4 @@ export declare const GlyphButton: React.ForwardRefExoticComponent<Pick<import(".
|
|
|
7
7
|
tooltipClass?: string;
|
|
8
8
|
} & {
|
|
9
9
|
glyph: Glyph;
|
|
10
|
-
}, "small" | "variant" | "key" | "block" | "id" | "active" | "style" | "className" | "children" | "disabled" | "tooltip" | "onKeyDown" | "onClick" | "glyph" | "tooltipPlacement" | "tooltipTrigger" | "tooltipClass"> & React.RefAttributes<unknown>>;
|
|
10
|
+
}, "small" | "variant" | "type" | "key" | "block" | "id" | "active" | "style" | "className" | "children" | "disabled" | "tooltip" | "onKeyDown" | "onClick" | "glyph" | "tooltipPlacement" | "tooltipTrigger" | "tooltipClass"> & React.RefAttributes<unknown>>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PropTypes from "prop-types";
|
|
3
|
+
import { FieldProps } from "../../types";
|
|
4
|
+
import memoize from "memoizee";
|
|
5
|
+
type State = {
|
|
6
|
+
show: boolean;
|
|
7
|
+
};
|
|
8
|
+
export default class AnnotationField extends React.Component<FieldProps, State> {
|
|
2
9
|
static contextType: React.Context<import("../../ReactContext").ContextProps>;
|
|
3
10
|
static propTypes: {
|
|
4
11
|
uiSchema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
@@ -18,21 +25,19 @@ export default class AnnotationField extends React.Component<any, any, any> {
|
|
|
18
25
|
}>>>;
|
|
19
26
|
formData: PropTypes.Validator<object>;
|
|
20
27
|
};
|
|
21
|
-
constructor(props: any);
|
|
22
28
|
state: {
|
|
23
29
|
show: boolean;
|
|
24
30
|
};
|
|
25
31
|
getButton: () => {
|
|
26
32
|
glyph: string;
|
|
27
|
-
tooltip:
|
|
33
|
+
tooltip: string;
|
|
28
34
|
tooltipPlacement: string;
|
|
29
|
-
fn: () => () => void
|
|
35
|
+
fn: (() => () => void) & memoize.Memoized<() => () => void>;
|
|
30
36
|
variant: string;
|
|
31
37
|
};
|
|
32
|
-
onClick: () => () => void
|
|
38
|
+
onClick: (() => () => void) & memoize.Memoized<() => () => void>;
|
|
33
39
|
onHide: () => void;
|
|
34
40
|
getAnnotations: () => any;
|
|
35
41
|
render(): JSX.Element;
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
import * as PropTypes from "prop-types";
|
|
43
|
+
export {};
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -55,15 +49,16 @@ const React = __importStar(require("react"));
|
|
|
55
49
|
const PropTypes = __importStar(require("prop-types"));
|
|
56
50
|
const utils_1 = require("../../utils");
|
|
57
51
|
const LajiForm_1 = __importDefault(require("../LajiForm"));
|
|
58
|
-
const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
59
52
|
const Context_1 = __importDefault(require("../../Context"));
|
|
60
53
|
const ReactContext_1 = __importDefault(require("../../ReactContext"));
|
|
61
54
|
const components_1 = require("../components");
|
|
62
55
|
const react_spinner_1 = __importDefault(require("react-spinner"));
|
|
63
56
|
const utils_2 = require("@luomus/laji-map/lib/utils");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
const memoizee_1 = __importDefault(require("memoizee"));
|
|
58
|
+
class AnnotationField extends React.Component {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(...arguments);
|
|
61
|
+
this.state = { show: false };
|
|
67
62
|
this.getButton = () => {
|
|
68
63
|
const annotations = this.getAnnotations();
|
|
69
64
|
return {
|
|
@@ -74,9 +69,9 @@ let AnnotationField = class AnnotationField extends React.Component {
|
|
|
74
69
|
variant: annotations && annotations.length ? "primary" : "default"
|
|
75
70
|
};
|
|
76
71
|
};
|
|
77
|
-
this.onClick = () => () => {
|
|
72
|
+
this.onClick = (0, memoizee_1.default)(() => () => {
|
|
78
73
|
this.setState({ show: !this.state.show });
|
|
79
|
-
};
|
|
74
|
+
});
|
|
80
75
|
this.onHide = () => {
|
|
81
76
|
this.setState({ show: false });
|
|
82
77
|
};
|
|
@@ -85,7 +80,6 @@ let AnnotationField = class AnnotationField extends React.Component {
|
|
|
85
80
|
const { id } = this.props.formData;
|
|
86
81
|
return (0, Context_1.default)(`${this.props.formContext.contextId}_ANNOTATIONS`)[id] || annotations[id];
|
|
87
82
|
};
|
|
88
|
-
this.state = { show: false };
|
|
89
83
|
}
|
|
90
84
|
render() {
|
|
91
85
|
const { adminOnly, container, add, filter, uiSchema: annotationUiSchema, buttonsPath = "/", formId } = (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
@@ -115,7 +109,7 @@ let AnnotationField = class AnnotationField extends React.Component {
|
|
|
115
109
|
React.createElement(Container, null,
|
|
116
110
|
React.createElement(AnnotationBox, { id: this.props.formData.id, annotations: this.getAnnotations(), lang: this.props.formContext.lang, formContext: this.props.formContext, add: add, uiSchema: annotationUiSchema, filter: filter, formId: formId }))));
|
|
117
111
|
}
|
|
118
|
-
}
|
|
112
|
+
}
|
|
119
113
|
AnnotationField.contextType = ReactContext_1.default;
|
|
120
114
|
AnnotationField.propTypes = {
|
|
121
115
|
uiSchema: PropTypes.shape({
|
|
@@ -135,9 +129,6 @@ AnnotationField.propTypes = {
|
|
|
135
129
|
}).isRequired,
|
|
136
130
|
formData: PropTypes.object.isRequired
|
|
137
131
|
};
|
|
138
|
-
AnnotationField = __decorate([
|
|
139
|
-
BaseComponent_1.default
|
|
140
|
-
], AnnotationField);
|
|
141
132
|
exports.default = AnnotationField;
|
|
142
133
|
(0, Context_1.default)("SCHEMA_FIELD_WRAPPERS").AnnotationField = true;
|
|
143
134
|
class AnnotationBox extends React.Component {
|
|
@@ -173,6 +164,9 @@ class AnnotationBox extends React.Component {
|
|
|
173
164
|
state.addFormData = formData;
|
|
174
165
|
this.setState(state);
|
|
175
166
|
};
|
|
167
|
+
this.onAnnotationSubmitClick = () => {
|
|
168
|
+
this.onAnnotationSubmit({ formData: this.state.addFormData });
|
|
169
|
+
};
|
|
176
170
|
this.getAddOptions = () => {
|
|
177
171
|
const { add, formContext: { uiSchemaContext: { isAdmin } } } = this.props;
|
|
178
172
|
let addOptions = (0, utils_2.isObject)(add) ? add : {};
|
|
@@ -194,7 +188,7 @@ class AnnotationBox extends React.Component {
|
|
|
194
188
|
let submitOnChange = undefined;
|
|
195
189
|
let addFormData = undefined;
|
|
196
190
|
if (add && metadataForm && metadataForm.schema) {
|
|
197
|
-
const { adminOnly, filter: _filter, uiSchema: _addUiSchema, _submitOnChange, formData } = this.getAddOptions();
|
|
191
|
+
const { adminOnly, filter: _filter, uiSchema: _addUiSchema, submitOnChange: _submitOnChange, formData } = this.getAddOptions();
|
|
198
192
|
if (adminOnly && !formContext.uiSchemaContext.isAdmin) {
|
|
199
193
|
return null;
|
|
200
194
|
}
|
|
@@ -217,12 +211,12 @@ class AnnotationBox extends React.Component {
|
|
|
217
211
|
return add && addSchema ? (React.createElement(LajiForm_1.default, Object.assign({}, metadataForm, { schema: addSchema, uiSchema: addUiSchema || _uiSchema, onSubmit: this.onAnnotationSubmit, onChange: this.onAnnotationChange, renderSubmit: renderSubmit, formData: addFormData, lang: lang, apiClient: this.props.formContext.apiClient.apiClient, uiSchemaContext: this.props.formContext.uiSchemaContext }), React.createElement("div", null,
|
|
218
212
|
this.state.fail !== undefined &&
|
|
219
213
|
React.createElement(Alert, { variant: this.state.fail ? "danger" : "success" }, translations[this.state.fail ? "SaveFail" : "SaveSuccess"]),
|
|
220
|
-
renderSubmit && React.createElement(components_1.Button, { id: "submit", type: "submit", onClick: this.
|
|
214
|
+
renderSubmit && React.createElement(components_1.Button, { id: "submit", type: "submit", onClick: this.onAnnotationSubmitClick }, translations.Submit)))) : null;
|
|
221
215
|
};
|
|
222
216
|
this.getUiSchema = () => {
|
|
223
217
|
const { uiSchema } = this.props;
|
|
224
|
-
const
|
|
225
|
-
return uiSchema || Object.assign(Object.assign({}, metadataForm.uiSchema), { "ui:shortcuts": Object.assign(Object.assign({}, ((metadataForm.uiSchema || {})["ui:shorcuts"] || {})), (this.props.formContext.services.keyHandler.shortcuts)), "ui:showShortcutsButton": false });
|
|
218
|
+
const metadataForm = this.state.metadataForm || {};
|
|
219
|
+
return uiSchema || Object.assign(Object.assign({}, (metadataForm.uiSchema || {})), { "ui:shortcuts": Object.assign(Object.assign({}, ((metadataForm.uiSchema || {})["ui:shorcuts"] || {})), (this.props.formContext.services.keyHandler.shortcuts)), "ui:showShortcutsButton": false });
|
|
226
220
|
};
|
|
227
221
|
this.onDelete = (id) => () => __awaiter(this, void 0, void 0, function* () {
|
|
228
222
|
try {
|
|
@@ -240,7 +234,7 @@ class AnnotationBox extends React.Component {
|
|
|
240
234
|
}
|
|
241
235
|
componentDidMount() {
|
|
242
236
|
this.mounted = true;
|
|
243
|
-
this.props.formContext.apiClient.get(
|
|
237
|
+
this.props.formContext.apiClient.get("/forms/{id}", { path: { id: this.props.formId }, query: { format: "schema" } })
|
|
244
238
|
.then(metadataForm => {
|
|
245
239
|
if (!this.mounted)
|
|
246
240
|
return;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as PropTypes from "prop-types";
|
|
2
|
+
import { FieldProps } from "src/types";
|
|
3
|
+
declare const _anyToBoolean: {
|
|
4
|
+
(props: FieldProps): JSX.Element;
|
|
5
|
+
propTypes: {
|
|
6
|
+
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
7
|
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
8
|
trueValue: PropTypes.Validator<object>;
|
|
8
9
|
falseValue: PropTypes.Requireable<object>;
|
|
9
10
|
allowUndefined: PropTypes.Requireable<boolean>;
|
|
10
11
|
}>>;
|
|
11
12
|
}>>;
|
|
12
|
-
|
|
13
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
13
14
|
type: PropTypes.Requireable<string>;
|
|
14
15
|
}>>>;
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
16
|
+
formData: PropTypes.Requireable<object>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default _anyToBoolean;
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -47,7 +41,6 @@ exports.onArrayFieldChange = onArrayFieldChange;
|
|
|
47
41
|
const React = __importStar(require("react"));
|
|
48
42
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
49
43
|
const utils_1 = require("../../utils");
|
|
50
|
-
const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
51
44
|
const ArrayFieldTemplate_1 = require("../templates/ArrayFieldTemplate");
|
|
52
45
|
const ReactContext_1 = __importDefault(require("../../ReactContext"));
|
|
53
46
|
const core_1 = require("@rjsf/core");
|
|
@@ -123,7 +116,7 @@ class ArrayFieldPatched extends ArrayField {
|
|
|
123
116
|
}
|
|
124
117
|
}
|
|
125
118
|
exports.ArrayFieldPatched = ArrayFieldPatched;
|
|
126
|
-
|
|
119
|
+
class _ArrayField extends React.Component {
|
|
127
120
|
constructor() {
|
|
128
121
|
super(...arguments);
|
|
129
122
|
this.onChange = (formData) => {
|
|
@@ -176,9 +169,6 @@ let _ArrayField = class _ArrayField extends React.Component {
|
|
|
176
169
|
? (0, deepmerge_1.default)(this.buttonDefinitions, (0, utils_1.getUiOptions)(props.uiSchema).buttonDefinitions)
|
|
177
170
|
: this.buttonDefinitions }) }), onChange: this.onChange }));
|
|
178
171
|
}
|
|
179
|
-
}
|
|
172
|
+
}
|
|
180
173
|
_ArrayField.contextType = ReactContext_1.default;
|
|
181
|
-
_ArrayField = __decorate([
|
|
182
|
-
BaseComponent_1.default
|
|
183
|
-
], _ArrayField);
|
|
184
174
|
exports.default = _ArrayField;
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -38,26 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
32
|
return result;
|
|
39
33
|
};
|
|
40
34
|
})();
|
|
41
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
-
};
|
|
44
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
const React = __importStar(require("react"));
|
|
46
37
|
const PropTypes = __importStar(require("prop-types"));
|
|
47
|
-
const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
48
38
|
const utils_1 = require("../../utils");
|
|
49
|
-
|
|
39
|
+
class ArrayPropertySumField extends React.Component {
|
|
50
40
|
static getName() { return "ArrayPropertySumField"; }
|
|
51
|
-
getStateFromProps(props) {
|
|
52
|
-
const { formData = [] } = props;
|
|
53
|
-
const state = { sum: 0 };
|
|
54
|
-
const propertyField = (0, utils_1.getUiOptions)(this.props.uiSchema).propertyField;
|
|
55
|
-
state.sum = formData.reduce((acc, item) => acc + (Number(item[propertyField]) || 0), 0);
|
|
56
|
-
return state;
|
|
57
|
-
}
|
|
58
41
|
render() {
|
|
59
42
|
const SchemaField = this.props.registry.fields.SchemaField;
|
|
60
|
-
const
|
|
43
|
+
const sum = getSum(this.props);
|
|
61
44
|
return (React.createElement(React.Fragment, null,
|
|
62
45
|
React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: (0, utils_1.getInnerUiSchema)(this.props.uiSchema) })),
|
|
63
46
|
React.createElement("h4", null,
|
|
@@ -65,7 +48,7 @@ let ArrayPropertySumField = class ArrayPropertySumField extends React.Component
|
|
|
65
48
|
": ",
|
|
66
49
|
sum)));
|
|
67
50
|
}
|
|
68
|
-
}
|
|
51
|
+
}
|
|
69
52
|
ArrayPropertySumField.propTypes = {
|
|
70
53
|
uiSchema: PropTypes.shape({
|
|
71
54
|
"ui:options": PropTypes.shape({
|
|
@@ -76,7 +59,9 @@ ArrayPropertySumField.propTypes = {
|
|
|
76
59
|
schema: PropTypes.object.isRequired,
|
|
77
60
|
formData: PropTypes.array.isRequired
|
|
78
61
|
};
|
|
79
|
-
ArrayPropertySumField = __decorate([
|
|
80
|
-
BaseComponent_1.default
|
|
81
|
-
], ArrayPropertySumField);
|
|
82
62
|
exports.default = ArrayPropertySumField;
|
|
63
|
+
const getSum = (props) => {
|
|
64
|
+
const formData = props.formData || [];
|
|
65
|
+
const propertyField = (0, utils_1.getUiOptions)(props.uiSchema).propertyField;
|
|
66
|
+
return formData.reduce((acc, item) => acc + (Number(item[propertyField]) || 0), 0);
|
|
67
|
+
};
|
|
@@ -18,7 +18,7 @@ export default class ExtraLabelRowField extends React.Component<any, any, any> {
|
|
|
18
18
|
};
|
|
19
19
|
constructor(props: any);
|
|
20
20
|
constructor(props: any, context: any);
|
|
21
|
-
|
|
21
|
+
getNextProps(props: any): {
|
|
22
22
|
schema: any;
|
|
23
23
|
uiSchema: import("../../types").UiSchema<any>;
|
|
24
24
|
options: any;
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -46,10 +40,9 @@ const React = __importStar(require("react"));
|
|
|
46
40
|
const PropTypes = __importStar(require("prop-types"));
|
|
47
41
|
const utils_1 = require("../../utils");
|
|
48
42
|
const components_1 = require("../components");
|
|
49
|
-
const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
50
43
|
const ReactContext_1 = __importDefault(require("../../ReactContext"));
|
|
51
44
|
const utils_2 = require("@rjsf/utils");
|
|
52
|
-
|
|
45
|
+
class ExtraLabelRowField extends React.Component {
|
|
53
46
|
constructor() {
|
|
54
47
|
super(...arguments);
|
|
55
48
|
this.containerRef = React.createRef();
|
|
@@ -80,7 +73,7 @@ let ExtraLabelRowField = class ExtraLabelRowField extends React.Component {
|
|
|
80
73
|
return cols;
|
|
81
74
|
};
|
|
82
75
|
}
|
|
83
|
-
|
|
76
|
+
getNextProps(props) {
|
|
84
77
|
return {
|
|
85
78
|
schema: Object.assign(Object.assign({}, props.schema), { title: "" }),
|
|
86
79
|
uiSchema: (0, utils_1.getInnerUiSchema)(props.uiSchema),
|
|
@@ -105,9 +98,9 @@ let ExtraLabelRowField = class ExtraLabelRowField extends React.Component {
|
|
|
105
98
|
title
|
|
106
99
|
? (React.createElement(TitleFieldTemplate, { title: title, schema: this.props.schema, uiSchema: this.props.uiSchema, id: this.props.idSchema.$id, registry: this.props.registry })) : null,
|
|
107
100
|
labelRow,
|
|
108
|
-
React.createElement(SchemaField, Object.assign({}, this.props, this.
|
|
101
|
+
React.createElement(SchemaField, Object.assign({}, this.props, this.getNextProps(this.props)))));
|
|
109
102
|
}
|
|
110
|
-
}
|
|
103
|
+
}
|
|
111
104
|
ExtraLabelRowField.contextType = ReactContext_1.default;
|
|
112
105
|
ExtraLabelRowField.propTypes = {
|
|
113
106
|
uiSchema: PropTypes.shape({
|
|
@@ -125,7 +118,4 @@ ExtraLabelRowField.propTypes = {
|
|
|
125
118
|
}).isRequired,
|
|
126
119
|
formData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
|
|
127
120
|
};
|
|
128
|
-
ExtraLabelRowField = __decorate([
|
|
129
|
-
BaseComponent_1.default
|
|
130
|
-
], ExtraLabelRowField);
|
|
131
121
|
exports.default = ExtraLabelRowField;
|
|
@@ -70,7 +70,7 @@ export default class FilterArrayField extends React.Component<any, any, any> {
|
|
|
70
70
|
};
|
|
71
71
|
constructor(props: any);
|
|
72
72
|
constructor(props: any, context: any);
|
|
73
|
-
|
|
73
|
+
getNextProps(props: any): any;
|
|
74
74
|
cache: any;
|
|
75
75
|
filteredIdxs: {} | undefined;
|
|
76
76
|
filteredToOffsets: {} | undefined;
|
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -38,16 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
32
|
return result;
|
|
39
33
|
};
|
|
40
34
|
})();
|
|
41
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
-
};
|
|
44
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
exports.arrayRulesPropType = void 0;
|
|
46
37
|
const React = __importStar(require("react"));
|
|
47
38
|
const PropTypes = __importStar(require("prop-types"));
|
|
48
39
|
const utils_1 = require("../../utils");
|
|
49
40
|
const ConditionalUiSchemaField_1 = require("./ConditionalUiSchemaField");
|
|
50
|
-
const BaseComponent_1 = __importDefault(require("../BaseComponent"));
|
|
51
41
|
const arrayRulePropType = PropTypes.shape({
|
|
52
42
|
idx: PropTypes.number,
|
|
53
43
|
isLast: PropTypes.number,
|
|
@@ -58,7 +48,7 @@ exports.arrayRulesPropType = PropTypes.oneOfType([
|
|
|
58
48
|
arrayRulePropType,
|
|
59
49
|
PropTypes.arrayOf(PropTypes.oneOfType([ConditionalUiSchemaField_1.rulePropType, arrayRulePropType]))
|
|
60
50
|
]);
|
|
61
|
-
|
|
51
|
+
class FilterArrayField extends React.Component {
|
|
62
52
|
constructor() {
|
|
63
53
|
super(...arguments);
|
|
64
54
|
this.getOnActiveChange = (idx, prop, callback) => {
|
|
@@ -77,7 +67,7 @@ let FilterArrayField = class FilterArrayField extends React.Component {
|
|
|
77
67
|
}, formData));
|
|
78
68
|
};
|
|
79
69
|
}
|
|
80
|
-
|
|
70
|
+
getNextProps(props) {
|
|
81
71
|
if (props.schema.items.type !== "object") {
|
|
82
72
|
throw new Error("Can't use FilterArrayField if items aren't objects");
|
|
83
73
|
}
|
|
@@ -136,9 +126,9 @@ let FilterArrayField = class FilterArrayField extends React.Component {
|
|
|
136
126
|
}
|
|
137
127
|
render() {
|
|
138
128
|
const SchemaField = this.props.registry.fields.SchemaField;
|
|
139
|
-
return React.createElement(SchemaField, Object.assign({}, this.props, this.
|
|
129
|
+
return React.createElement(SchemaField, Object.assign({}, this.props, this.getNextProps(this.props)));
|
|
140
130
|
}
|
|
141
|
-
}
|
|
131
|
+
}
|
|
142
132
|
FilterArrayField.propTypes = {
|
|
143
133
|
uiSchema: PropTypes.shape({
|
|
144
134
|
"ui:options": PropTypes.shape({
|
|
@@ -151,7 +141,4 @@ FilterArrayField.propTypes = {
|
|
|
151
141
|
}).isRequired,
|
|
152
142
|
formData: PropTypes.array
|
|
153
143
|
};
|
|
154
|
-
FilterArrayField = __decorate([
|
|
155
|
-
BaseComponent_1.default
|
|
156
|
-
], FilterArrayField);
|
|
157
144
|
exports.default = FilterArrayField;
|