@luomus/laji-form 15.1.92 → 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 +255 -3
- package/lib/components/LajiForm.js +3 -128
- 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 +75 -0
- package/lib/components/fields/index.js +158 -0
- package/lib/components/templates/index.d.ts +8 -0
- package/lib/components/templates/index.js +22 -0
- 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/components/widgets/index.d.ts +20 -0
- package/lib/components/widgets/index.js +46 -0
- 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
|
@@ -19,6 +19,9 @@ import RootInstanceService from "../services/root-instance-service";
|
|
|
19
19
|
import SingletonMapService from "../services/singleton-map-service";
|
|
20
20
|
import { FieldProps, HasMaybeChildren, Lang } from "../types";
|
|
21
21
|
import MultiActiveArrayService from "../services/multi-active-array-service";
|
|
22
|
+
import * as fields from "./fields";
|
|
23
|
+
import * as widgets from "./widgets";
|
|
24
|
+
import * as templates from "./templates";
|
|
22
25
|
export interface LajiFormProps extends HasMaybeChildren {
|
|
23
26
|
apiClient?: ApiClientImplementation;
|
|
24
27
|
lang?: Lang;
|
|
@@ -191,17 +194,266 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
191
194
|
getFields: (_fields?: {
|
|
192
195
|
[name: string]: Field;
|
|
193
196
|
}) => {
|
|
194
|
-
|
|
197
|
+
SchemaField: typeof fields.SchemaField;
|
|
198
|
+
ArrayField: typeof fields.ArrayField;
|
|
199
|
+
ObjectField: (props: any) => JSX.Element;
|
|
200
|
+
NestField: typeof fields.NestField;
|
|
201
|
+
ArrayPropertySumField: typeof fields.ArrayPropertySumField;
|
|
202
|
+
ScopeField: typeof fields.ScopeField;
|
|
203
|
+
SelectTreeField: typeof fields.SelectTreeField;
|
|
204
|
+
GridLayoutField: {
|
|
205
|
+
(props: any): JSX.Element;
|
|
206
|
+
propTypes: {
|
|
207
|
+
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
208
|
+
"ui:grid": PropTypes.Requireable<PropTypes.InferProps<{
|
|
209
|
+
lg: PropTypes.Requireable<NonNullable<number | object | null | undefined>>;
|
|
210
|
+
md: PropTypes.Requireable<NonNullable<number | object | null | undefined>>;
|
|
211
|
+
sm: PropTypes.Requireable<NonNullable<number | object | null | undefined>>;
|
|
212
|
+
xs: PropTypes.Requireable<NonNullable<number | object | null | undefined>>;
|
|
213
|
+
}>>;
|
|
214
|
+
}>>;
|
|
215
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
216
|
+
type: PropTypes.Requireable<string>;
|
|
217
|
+
}>>>;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
TableField: typeof fields.TableField;
|
|
221
|
+
InjectField: typeof fields.InjectField;
|
|
222
|
+
InjectDefaultValueField: typeof fields.InjectDefaultValueField;
|
|
223
|
+
ArrayCombinerField: typeof fields.ArrayCombinerField;
|
|
224
|
+
DependentBooleanField: typeof fields.DependentBooleanField;
|
|
225
|
+
DependentDisableField: typeof fields.DependentDisableField;
|
|
226
|
+
MapArrayField: typeof fields.MapArrayField;
|
|
227
|
+
AutoArrayField: typeof fields.AutoArrayField;
|
|
228
|
+
AutosuggestField: typeof fields.AutosuggestField;
|
|
229
|
+
HiddenField: {
|
|
230
|
+
(): JSX.Element;
|
|
231
|
+
propTypes: {
|
|
232
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
233
|
+
type: PropTypes.Requireable<string>;
|
|
234
|
+
}>>>;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
HiddenWithTextField: {
|
|
238
|
+
(props: FieldProps<import("../types").JSONSchemaArray<import("../types").JSONSchemaString>>): JSX.Element;
|
|
239
|
+
propTypes: {
|
|
240
|
+
uiSchema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
241
|
+
"ui:options": PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
242
|
+
altText: PropTypes.Validator<string>;
|
|
243
|
+
}>>>;
|
|
244
|
+
uiSchema: PropTypes.Requireable<object>;
|
|
245
|
+
}>>>;
|
|
246
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
247
|
+
type: PropTypes.Requireable<string>;
|
|
248
|
+
}>>>;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
InitiallyHiddenField: typeof fields.InitiallyHiddenField;
|
|
252
|
+
ContextInjectionField: typeof fields.ContextInjectionField;
|
|
253
|
+
ImageArrayField: typeof fields.ImageArrayField;
|
|
254
|
+
SplitField: typeof fields.SplitField;
|
|
255
|
+
FlatField: typeof fields.FlatField;
|
|
256
|
+
SingleActiveArrayField: typeof fields.SingleActiveArrayField;
|
|
257
|
+
SingleItemArrayField: typeof fields.SingleItemArrayField;
|
|
258
|
+
UnitShorthandField: typeof fields.UnitShorthandField;
|
|
259
|
+
CombinedValueDisplayField: typeof fields.CombinedValueDisplayField;
|
|
260
|
+
UiFieldMapperArrayField: typeof fields.UiFieldMapperArrayField;
|
|
261
|
+
ExtraLabelRowField: typeof fields.ExtraLabelRowField;
|
|
262
|
+
SumField: typeof fields.SumField;
|
|
263
|
+
NamedPlaceChooserField: typeof fields.NamedPlaceChooserField;
|
|
264
|
+
NamedPlaceSaverField: typeof fields.NamedPlaceSaverField;
|
|
265
|
+
MapField: typeof fields.MapField;
|
|
266
|
+
GeocoderField: typeof fields.GeocoderField;
|
|
267
|
+
TagArrayField: typeof fields.TagArrayField;
|
|
268
|
+
StringToArrayField: typeof fields.StringToArrayField;
|
|
269
|
+
ConditionalOnChangeField: typeof fields.ConditionalOnChangeField;
|
|
270
|
+
ConditionalUiSchemaField: typeof fields.ConditionalUiSchemaField;
|
|
271
|
+
AnnotationField: typeof fields.AnnotationField;
|
|
272
|
+
PrefillingArrayField: typeof fields.PrefillingArrayField;
|
|
273
|
+
AnyToBooleanField: {
|
|
274
|
+
(props: FieldProps): JSX.Element;
|
|
275
|
+
propTypes: {
|
|
276
|
+
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
277
|
+
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
278
|
+
trueValue: PropTypes.Validator<object>;
|
|
279
|
+
falseValue: PropTypes.Requireable<object>;
|
|
280
|
+
allowUndefined: PropTypes.Requireable<boolean>;
|
|
281
|
+
}>>;
|
|
282
|
+
}>>;
|
|
283
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
284
|
+
type: PropTypes.Requireable<string>;
|
|
285
|
+
}>>>;
|
|
286
|
+
formData: PropTypes.Requireable<object>;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
EnumRangeArrayField: typeof fields.EnumRangeArrayField;
|
|
290
|
+
UnitListShorthandArrayField: typeof fields.UnitListShorthandArrayField;
|
|
291
|
+
LocationChooserField: typeof fields.LocationChooserField;
|
|
292
|
+
DataLeakerField: typeof fields.DataLeakerField;
|
|
293
|
+
LocalityField: typeof fields.LocalityField;
|
|
294
|
+
ImageDisplayField: typeof fields.ImageDisplayField;
|
|
295
|
+
FakePropertyField: typeof fields.FakePropertyField;
|
|
296
|
+
SectionArrayField: typeof fields.SectionArrayField;
|
|
297
|
+
MultiArrayField: typeof fields.MultiArrayField;
|
|
298
|
+
AudioArrayField: typeof fields.AudioArrayField;
|
|
299
|
+
FilterArrayField: typeof fields.FilterArrayField;
|
|
300
|
+
MultiAnyToBooleanField: typeof fields.MultiAnyToBooleanField;
|
|
301
|
+
UnitCountShorthandField: typeof fields.UnitCountShorthandField;
|
|
302
|
+
ToggleAdditionalArrayFieldsField: typeof fields.ToggleAdditionalArrayFieldsField;
|
|
303
|
+
DefaultValueArrayField: typeof fields.DefaultValueArrayField;
|
|
304
|
+
UiFieldApplierField: typeof fields.UiFieldApplierField;
|
|
305
|
+
MultiLanguageField: typeof fields.MultiLanguageField;
|
|
306
|
+
SortArrayField: typeof fields.SortArrayField;
|
|
307
|
+
InputWithDefaultValueButtonField: typeof fields.InputWithDefaultValueButtonField;
|
|
308
|
+
MultiTagArrayField: typeof fields.MultiTagArrayField;
|
|
309
|
+
PdfArrayField: typeof fields.PdfArrayField;
|
|
310
|
+
AsArrayField: typeof fields.AsArrayField;
|
|
311
|
+
CondensedObjectField: typeof fields.CondensedObjectField;
|
|
312
|
+
MultiActiveArrayField: typeof fields.MultiActiveArrayField;
|
|
313
|
+
PrefixArrayField: typeof fields.PrefixArrayField;
|
|
314
|
+
FillDateRangeField: typeof fields.FillDateRangeField;
|
|
315
|
+
TaxonSetPopulatorField: typeof fields.TaxonSetPopulatorField;
|
|
316
|
+
ScientificNameTaxonAutosuggestField: typeof fields.ScientificNameTaxonAutosuggestField;
|
|
317
|
+
ArraySchemaField: typeof fields.SchemaField;
|
|
318
|
+
InputTransformerField: typeof fields.ConditionalOnChangeField;
|
|
319
|
+
ConditionalField: typeof fields.ConditionalUiSchemaField;
|
|
320
|
+
UnitRapidField: typeof fields.UnitShorthandField;
|
|
321
|
+
AccordionArrayField: typeof fields.SingleActiveArrayField;
|
|
195
322
|
};
|
|
196
323
|
getWidgets: (_widgets?: {
|
|
197
324
|
[name: string]: Widget;
|
|
198
325
|
}) => {
|
|
199
|
-
|
|
326
|
+
CheckboxWidget: typeof widgets.CheckboxWidget;
|
|
327
|
+
SelectWidget: <T extends string | number>(props: (Omit<import("../types").WidgetProps<import("../types").JSONSchemaEnum>, "value" | "onChange"> & {
|
|
328
|
+
value?: T | undefined;
|
|
329
|
+
onChange: (value?: T | undefined) => void;
|
|
330
|
+
} & {
|
|
331
|
+
includeEmpty?: boolean;
|
|
332
|
+
getEnumOptionsAsync?: (() => Promise<(Omit<import("@rjsf/utils").EnumOptionsType, "value"> & {
|
|
333
|
+
value: T;
|
|
334
|
+
})[]>) | undefined;
|
|
335
|
+
}) | (Omit<import("../types").WidgetProps<import("../types").JSONSchemaArray<import("../types").JSONSchemaEnumOneOf>>, "value" | "onChange"> & {
|
|
336
|
+
value?: T[] | undefined;
|
|
337
|
+
onChange: (value?: T[] | undefined) => void;
|
|
338
|
+
} & {
|
|
339
|
+
includeEmpty?: boolean;
|
|
340
|
+
getEnumOptionsAsync?: (() => Promise<(Omit<import("@rjsf/utils").EnumOptionsType, "value"> & {
|
|
341
|
+
value: T;
|
|
342
|
+
})[]>) | undefined;
|
|
343
|
+
})) => JSX.Element;
|
|
344
|
+
TextareaWidget: typeof widgets.TextareaWidget;
|
|
345
|
+
DateTimeWidget: typeof widgets.DateTimeWidget;
|
|
346
|
+
DateWidget: {
|
|
347
|
+
(props: any): JSX.Element;
|
|
348
|
+
propTypes: {
|
|
349
|
+
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
350
|
+
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
351
|
+
showButtons: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
352
|
+
today: PropTypes.Requireable<boolean>;
|
|
353
|
+
yesterday: PropTypes.Requireable<boolean>;
|
|
354
|
+
same: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
355
|
+
path: PropTypes.Requireable<string>;
|
|
356
|
+
}> | null | undefined>>;
|
|
357
|
+
plusSixMonths: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
358
|
+
path: PropTypes.Requireable<string>;
|
|
359
|
+
}> | null | undefined>>;
|
|
360
|
+
plusSixYear: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
361
|
+
path: PropTypes.Requireable<string>;
|
|
362
|
+
}> | null | undefined>>;
|
|
363
|
+
}> | null | undefined>>;
|
|
364
|
+
allowOnlyYear: PropTypes.Requireable<boolean>;
|
|
365
|
+
}>>;
|
|
366
|
+
}>>;
|
|
367
|
+
schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
368
|
+
type: PropTypes.Requireable<string>;
|
|
369
|
+
}>>;
|
|
370
|
+
value: PropTypes.Requireable<string>;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
TimeWidget: {
|
|
374
|
+
(props: any): JSX.Element;
|
|
375
|
+
propTypes: {
|
|
376
|
+
schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
377
|
+
type: PropTypes.Requireable<string>;
|
|
378
|
+
}>>;
|
|
379
|
+
value: PropTypes.Requireable<string>;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
SeparatedDateTimeWidget: typeof widgets.SeparatedDateTimeWidget;
|
|
383
|
+
AutosuggestWidget: typeof widgets.AutosuggestWidget;
|
|
384
|
+
HiddenWidget: typeof widgets.HiddenWidget;
|
|
385
|
+
PlainTextWidget: typeof widgets.PlainTextWidget;
|
|
386
|
+
TextSelectWidget: typeof widgets.TextSelectWidget;
|
|
387
|
+
ImageSelectWidget: typeof widgets.ImageSelectWidget;
|
|
388
|
+
AnyToBooleanWidget: {
|
|
389
|
+
(props: import("../types").WidgetProps): JSX.Element;
|
|
390
|
+
propTypes: {
|
|
391
|
+
uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
392
|
+
"ui:options": PropTypes.Requireable<PropTypes.InferProps<{
|
|
393
|
+
trueValue: PropTypes.Validator<NonNullable<NonNullable<string | number | boolean | null | undefined>>>;
|
|
394
|
+
falseValue: PropTypes.Requireable<NonNullable<string | number | boolean | null | undefined>>;
|
|
395
|
+
allowUndefined: PropTypes.Requireable<boolean>;
|
|
396
|
+
}>>;
|
|
397
|
+
}>>;
|
|
398
|
+
schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
399
|
+
type: PropTypes.Requireable<string>;
|
|
400
|
+
}>>>;
|
|
401
|
+
formData: PropTypes.Requireable<NonNullable<string | number | boolean | null | undefined>>;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
URLWidget: {
|
|
405
|
+
({ value, options }: {
|
|
406
|
+
value: any;
|
|
407
|
+
options?: {} | undefined;
|
|
408
|
+
}): JSX.Element;
|
|
409
|
+
propTypes: {
|
|
410
|
+
schema: PropTypes.Requireable<PropTypes.InferProps<{
|
|
411
|
+
type: PropTypes.Requireable<string>;
|
|
412
|
+
}>>;
|
|
413
|
+
value: PropTypes.Requireable<string>;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
InformalTaxonGroupChooserWidget: typeof widgets.InformalTaxonGroupChooserWidget;
|
|
417
|
+
TaxonImageWidget: typeof widgets.TaxonImageWidget;
|
|
418
|
+
UpperCaseWidget: typeof widgets.UpperCaseWidget;
|
|
419
|
+
NumberWidget: typeof widgets.NumberWidget;
|
|
420
|
+
InputGroupWidget: typeof widgets.InputGroupWidget;
|
|
421
|
+
InputWithDefaultValueButtonWidget: typeof widgets.InputWithDefaultValueButtonWidget;
|
|
200
422
|
};
|
|
201
423
|
getTemplates: (_templates?: {
|
|
202
424
|
[name: string]: TemplatesType;
|
|
203
425
|
}) => {
|
|
204
|
-
|
|
426
|
+
BaseInputTemplate: typeof templates.BaseInputTemplate;
|
|
427
|
+
DescriptionField: typeof templates.DescriptionField;
|
|
428
|
+
FieldTemplate: typeof templates.FieldTemplate;
|
|
429
|
+
ArrayFieldTemplate: {
|
|
430
|
+
new (): {
|
|
431
|
+
[x: string]: any;
|
|
432
|
+
componentDidMount(): void;
|
|
433
|
+
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
434
|
+
componentWillUnmount(): void;
|
|
435
|
+
addKeyHandlers(): void;
|
|
436
|
+
arrayKeyFunctions: any;
|
|
437
|
+
removeKeyHandlers(props: any): void;
|
|
438
|
+
getKeyHandlers(props: any): any[];
|
|
439
|
+
addChildKeyHandlers(props: any): void;
|
|
440
|
+
childKeyHandlers: any;
|
|
441
|
+
removeChildKeyHandlers(): void;
|
|
442
|
+
getChildKeyHandlers(props: any): any;
|
|
443
|
+
onFocus: (target: any) => void;
|
|
444
|
+
onCopy: (options?: {}) => void;
|
|
445
|
+
getCustomEventListeners(): (string | ((target: any) => void))[][];
|
|
446
|
+
addCustomEventListeners(props: any): void;
|
|
447
|
+
customEventListeners: any;
|
|
448
|
+
removeCustomEventListeners(props: any): void;
|
|
449
|
+
};
|
|
450
|
+
[x: string]: any;
|
|
451
|
+
displayName: string;
|
|
452
|
+
};
|
|
453
|
+
ErrorListTemplate: typeof templates.ErrorListTemplate;
|
|
454
|
+
ObjectFieldTemplate: typeof templates.ObjectFieldTemplate;
|
|
455
|
+
TitleFieldTemplate: (props: any) => JSX.Element | null;
|
|
456
|
+
DescriptionFieldTemplate: typeof templates.DescriptionField;
|
|
205
457
|
};
|
|
206
458
|
getContext: (props: LajiFormProps, context: ContextProps) => ContextProps;
|
|
207
459
|
render(): JSX.Element | null;
|
|
@@ -74,134 +74,9 @@ const id_service_1 = __importDefault(require("../services/id-service"));
|
|
|
74
74
|
const root_instance_service_1 = __importDefault(require("../services/root-instance-service"));
|
|
75
75
|
const singleton_map_service_1 = __importDefault(require("../services/singleton-map-service"));
|
|
76
76
|
const multi_active_array_service_1 = __importDefault(require("../services/multi-active-array-service"));
|
|
77
|
-
const fields =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"ArrayField",
|
|
81
|
-
"ObjectField",
|
|
82
|
-
"NestField",
|
|
83
|
-
"ArrayBulkField",
|
|
84
|
-
"ArrayBulkField",
|
|
85
|
-
"ArrayPropertySumField",
|
|
86
|
-
"ScopeField",
|
|
87
|
-
"SelectTreeField",
|
|
88
|
-
"GridLayoutField",
|
|
89
|
-
"TableField",
|
|
90
|
-
"InjectField",
|
|
91
|
-
"InjectDefaultValueField",
|
|
92
|
-
"ArrayCombinerField",
|
|
93
|
-
"DependentBooleanField",
|
|
94
|
-
"DependentDisableField",
|
|
95
|
-
"MapArrayField",
|
|
96
|
-
"AutoArrayField",
|
|
97
|
-
"AutosuggestField",
|
|
98
|
-
"HiddenField",
|
|
99
|
-
"HiddenWithTextField",
|
|
100
|
-
"InitiallyHiddenField",
|
|
101
|
-
"ContextInjectionField",
|
|
102
|
-
"ImageArrayField",
|
|
103
|
-
"SplitField",
|
|
104
|
-
"FlatField",
|
|
105
|
-
"SingleActiveArrayField",
|
|
106
|
-
"SingleItemArrayField",
|
|
107
|
-
"UnitShorthandField",
|
|
108
|
-
"CombinedValueDisplayField",
|
|
109
|
-
"UiFieldMapperArrayField",
|
|
110
|
-
"ExtraLabelRowField",
|
|
111
|
-
"SumField",
|
|
112
|
-
"NamedPlaceChooserField",
|
|
113
|
-
"NamedPlaceSaverField",
|
|
114
|
-
"MapField",
|
|
115
|
-
"GeocoderField",
|
|
116
|
-
"TagArrayField",
|
|
117
|
-
"StringToArrayField",
|
|
118
|
-
"ConditionalOnChangeField",
|
|
119
|
-
"ConditionalUiSchemaField",
|
|
120
|
-
"AnnotationField",
|
|
121
|
-
"PrefillingArrayField",
|
|
122
|
-
"AnyToBooleanField",
|
|
123
|
-
"EnumRangeArrayField",
|
|
124
|
-
"UnitListShorthandArrayField",
|
|
125
|
-
"LocationChooserField",
|
|
126
|
-
"DataLeakerField",
|
|
127
|
-
"LocalityField",
|
|
128
|
-
"ImageDisplayField",
|
|
129
|
-
"FakePropertyField",
|
|
130
|
-
"SectionArrayField",
|
|
131
|
-
"MultiArrayField",
|
|
132
|
-
"AudioArrayField",
|
|
133
|
-
"FilterArrayField",
|
|
134
|
-
"MultiAnyToBooleanField",
|
|
135
|
-
"UnitCountShorthandField",
|
|
136
|
-
"ToggleAdditionalArrayFieldsField",
|
|
137
|
-
"DefaultValueArrayField",
|
|
138
|
-
"UiFieldApplierField",
|
|
139
|
-
"MultiLanguageField",
|
|
140
|
-
"SortArrayField",
|
|
141
|
-
"InputWithDefaultValueButtonField",
|
|
142
|
-
"MultiTagArrayField",
|
|
143
|
-
"PdfArrayField",
|
|
144
|
-
"AsArrayField",
|
|
145
|
-
"CondensedObjectField",
|
|
146
|
-
"MultiActiveArrayField",
|
|
147
|
-
"PrefixArrayField",
|
|
148
|
-
"FillDateRangeField",
|
|
149
|
-
"TaxonSetPopulatorField",
|
|
150
|
-
"ScientificNameTaxonAutosuggestField",
|
|
151
|
-
{ "InputTransformerField": "ConditionalOnChangeField" }, // Alias for backward compatibility.
|
|
152
|
-
{ "ConditionalField": "ConditionalUiSchemaField" }, // Alias for backward compatibility.
|
|
153
|
-
{ "UnitRapidField": "UnitShorthandField" }, // Alias for backward compatibility.
|
|
154
|
-
{ "AccordionArrayField": "SingleActiveArrayField" } // Alias for backward compatibility.
|
|
155
|
-
]);
|
|
156
|
-
const widgets = importLocalComponents("widgets", [
|
|
157
|
-
"CheckboxWidget",
|
|
158
|
-
"SelectWidget",
|
|
159
|
-
"TextareaWidget",
|
|
160
|
-
"DateTimeWidget",
|
|
161
|
-
"DateWidget",
|
|
162
|
-
"TimeWidget",
|
|
163
|
-
"SeparatedDateTimeWidget",
|
|
164
|
-
"AutosuggestWidget",
|
|
165
|
-
"HiddenWidget",
|
|
166
|
-
"PlainTextWidget",
|
|
167
|
-
"TextSelectWidget",
|
|
168
|
-
"ImageSelectWidget",
|
|
169
|
-
"AnyToBooleanWidget",
|
|
170
|
-
"URLWidget",
|
|
171
|
-
"InformalTaxonGroupChooserWidget",
|
|
172
|
-
"TaxonImageWidget",
|
|
173
|
-
"UpperCaseWidget",
|
|
174
|
-
"NumberWidget",
|
|
175
|
-
"InputGroupWidget",
|
|
176
|
-
"InputWithDefaultValueButtonWidget"
|
|
177
|
-
]);
|
|
178
|
-
const templates = importLocalComponents("templates", [
|
|
179
|
-
"BaseInputTemplate",
|
|
180
|
-
"DescriptionField",
|
|
181
|
-
{ "TitleFieldTemplate": "TitleField" },
|
|
182
|
-
{ "DescriptionFieldTemplate": "DescriptionField" },
|
|
183
|
-
"FieldTemplate",
|
|
184
|
-
"ArrayFieldTemplate",
|
|
185
|
-
"ErrorListTemplate",
|
|
186
|
-
"ObjectFieldTemplate"
|
|
187
|
-
]);
|
|
188
|
-
function importLocalComponents(dir, fieldNames) {
|
|
189
|
-
return fieldNames.reduce((fields, field) => {
|
|
190
|
-
if (typeof field === "string") {
|
|
191
|
-
fields[field] = require(`./${dir}/${field}`).default;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
const fieldName = Object.keys(field)[0];
|
|
195
|
-
if (typeof field[fieldName] === "string") {
|
|
196
|
-
fields[fieldName] = require(`./${dir}/${field[fieldName]}`).default;
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
fields[fieldName] = field[fieldName];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return fields;
|
|
203
|
-
}, {});
|
|
204
|
-
}
|
|
77
|
+
const fields = __importStar(require("./fields"));
|
|
78
|
+
const widgets = __importStar(require("./widgets"));
|
|
79
|
+
const templates = __importStar(require("./templates"));
|
|
205
80
|
// Each form should have a unique id to keep Context private.
|
|
206
81
|
let id = 0;
|
|
207
82
|
function getNewId() {
|
|
@@ -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;
|