@luomus/laji-form 15.1.24 → 15.1.26

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.
Files changed (41) hide show
  1. package/dist/laji-form.js +1 -1
  2. package/dist/styles.css +96 -5
  3. package/lib/ApiClient.d.ts +2 -1
  4. package/lib/components/BaseComponent.d.ts +1 -1
  5. package/lib/components/LajiForm.d.ts +3 -13
  6. package/lib/components/VirtualSchemaField.d.ts +10 -10
  7. package/lib/components/fields/AsArrayField.d.ts +131 -7
  8. package/lib/components/fields/ExtraLabelRowField.d.ts +1 -1
  9. package/lib/components/fields/ImageArrayField.d.ts +12 -12
  10. package/lib/components/fields/InitiallyHiddenField.d.ts +1 -1
  11. package/lib/components/fields/LocationChooserField.d.ts +1 -1
  12. package/lib/components/fields/MultiTagArrayField.d.ts +2 -2
  13. package/lib/components/fields/MultiTagArrayField.js +2 -1
  14. package/lib/components/fields/NamedPlaceChooserField.d.ts +88 -2
  15. package/lib/components/fields/NamedPlaceChooserField.js +1 -1
  16. package/lib/components/fields/NamedPlaceSaverField.d.ts +44 -1
  17. package/lib/components/fields/PdfArrayField.d.ts +2 -2
  18. package/lib/components/fields/ScopeField.d.ts +1 -1
  19. package/lib/components/fields/SingleActiveArrayField.js +1 -1
  20. package/lib/components/fields/SortArrayField.d.ts +93 -6
  21. package/lib/components/fields/SortArrayField.js +1 -1
  22. package/lib/components/fields/SplitField.d.ts +1 -1
  23. package/lib/components/fields/SplitField.js +3 -2
  24. package/lib/components/fields/StringToArrayField.d.ts +44 -1
  25. package/lib/components/fields/TagArrayField.js +1 -1
  26. package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +1 -1
  27. package/lib/components/fields/UnitListShorthandArrayField.d.ts +44 -1
  28. package/lib/components/widgets/AutosuggestWidget.js +1 -1
  29. package/lib/components/widgets/CheckboxWidget.js +7 -6
  30. package/lib/components/widgets/SelectWidget.d.ts +13 -52
  31. package/lib/components/widgets/SelectWidget.js +234 -145
  32. package/lib/services/focus-service.js +3 -2
  33. package/lib/services/settings-service.d.ts +2 -2
  34. package/lib/services/submit-hook-service.d.ts +1 -1
  35. package/lib/themes/theme.d.ts +4 -7
  36. package/lib/types.d.ts +59 -0
  37. package/lib/types.js +11 -0
  38. package/lib/utils.d.ts +13 -7
  39. package/lib/utils.js +19 -7
  40. package/package.json +3 -3
  41. package/test-export/test-utils.js +4 -4
@@ -325,7 +325,7 @@ class NamedPlaceChooser extends React.Component {
325
325
  return data;
326
326
  }, []);
327
327
  return (React.createElement("div", { style: { height: "inherit" } },
328
- React.createElement(SelectWidget_1.default, { disabled: !places, options: { enumOptions: enums, placeholder: `${translations.SelectPlaceFromList}...` }, onChange: this.onSelectChange, selectOnChange: false, schema: {}, id: "named-place-chooser-select", formContext: this.props.formContext }),
328
+ React.createElement(SelectWidget_1.default, { disabled: !places, options: { enumOptions: enums, placeholder: `${translations.SelectPlaceFromList}...` }, onChange: this.onSelectChange, selectOnChange: false, includeEmpty: false, schema: {}, id: "named-place-chooser-select", formContext: this.props.formContext }),
329
329
  React.createElement(MapArrayField_1.Map, { ref: getMapRef, data: data, markerPopupOffset: 45, featurePopupOffset: 5, controls: { draw: false }, lang: this.props.formContext.lang, bodyAsDialogRoot: false, formContext: this.props.formContext }),
330
330
  (!places) ? React.createElement(Spinner, null) : null,
331
331
  React.createElement("div", { style: { display: "none" }, ref: this.setPopupContainerRef },
@@ -12,7 +12,50 @@ export default class NamedPlaceSaverField extends React.Component<any, any, any>
12
12
  constructor(props: any);
13
13
  constructor(props: any, context: any);
14
14
  getStateFromProps(props: any): {
15
- uiSchema: any;
15
+ uiSchema: {
16
+ "ui:options": any;
17
+ "ui:ArrayFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
18
+ "ui:ArrayFieldDescriptionTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldDescriptionProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
19
+ "ui:ArrayFieldItemTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateItemType<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
20
+ "ui:ArrayFieldTitleTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTitleProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
21
+ "ui:BaseInputTemplate"?: React.ComponentType<import("@rjsf/utils").WidgetProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
22
+ "ui:DescriptionFieldTemplate"?: React.ComponentType<import("@rjsf/utils").DescriptionFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
23
+ "ui:ErrorListTemplate"?: React.ComponentType<import("@rjsf/utils").ErrorListProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
24
+ "ui:FieldErrorTemplate"?: React.ComponentType<import("@rjsf/utils").FieldErrorProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
25
+ "ui:FieldHelpTemplate"?: React.ComponentType<import("@rjsf/utils").FieldHelpProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
26
+ "ui:FieldTemplate"?: React.ComponentType<import("@rjsf/utils").FieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
27
+ "ui:ObjectFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ObjectFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
28
+ "ui:TitleFieldTemplate"?: React.ComponentType<import("@rjsf/utils").TitleFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
29
+ "ui:UnsupportedFieldTemplate"?: React.ComponentType<import("@rjsf/utils").UnsupportedFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
30
+ "ui:WrapIfAdditionalTemplate"?: React.ComponentType<import("@rjsf/utils").WrapIfAdditionalTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
31
+ "ui:classNames"?: string | undefined;
32
+ "ui:style"?: React.StyleHTMLAttributes<any> | undefined;
33
+ "ui:title"?: string | undefined;
34
+ "ui:description"?: string | undefined;
35
+ "ui:placeholder"?: string | undefined;
36
+ "ui:help"?: string | undefined;
37
+ "ui:autofocus"?: boolean | undefined;
38
+ "ui:autocomplete"?: string | undefined;
39
+ "ui:disabled"?: boolean | undefined;
40
+ "ui:emptyValue"?: any;
41
+ "ui:enumDisabled"?: (string | number | boolean)[] | undefined;
42
+ "ui:hideError"?: boolean | undefined;
43
+ "ui:readonly"?: boolean | undefined;
44
+ "ui:order"?: string[] | undefined;
45
+ "ui:addable"?: boolean | undefined;
46
+ "ui:orderable"?: boolean | undefined;
47
+ "ui:removable"?: boolean | undefined;
48
+ "ui:inline"?: boolean | undefined;
49
+ "ui:inputType"?: string | undefined;
50
+ "ui:label"?: boolean | undefined;
51
+ "ui:rows"?: number | undefined;
52
+ "ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
53
+ "ui:widget"?: string | import("@rjsf/utils").Widget<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
54
+ "ui:duplicateKeySuffixSeparator"?: string | undefined;
55
+ "ui:rootFieldId"?: string | undefined;
56
+ "ui:field"?: string | import("@rjsf/utils").Field<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
57
+ "ui:fieldReplacesAnyOrOneOf"?: boolean | undefined;
58
+ };
16
59
  };
17
60
  getButton(props: any): {
18
61
  label: any;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import { FieldProps } from "../LajiForm";
2
+ import { FieldProps, JSONSchemaArray, JSONSchemaObject } from "../../types";
3
3
  import { MediaArrayState } from "./ImageArrayField";
4
- export default class PdfArrayField extends React.Component<FieldProps, MediaArrayState> {
4
+ export default class PdfArrayField extends React.Component<FieldProps<JSONSchemaArray<JSONSchemaObject>>, MediaArrayState> {
5
5
  ALLOWED_FILE_TYPES: string[];
6
6
  ACCEPT_FILE_TYPES: string[];
7
7
  MAX_FILE_SIZE: number;
@@ -60,7 +60,7 @@ export default class ScopeField extends React.Component<any, any, any> {
60
60
  _globals: any;
61
61
  getSchemasAndAdditionals: (props: any, state: any) => {
62
62
  schema: any;
63
- uiSchema: any;
63
+ uiSchema: import("../../types").UiSchema;
64
64
  additionalFields: any;
65
65
  defaultFields: any;
66
66
  fieldsToShow: {};
@@ -769,7 +769,7 @@ let TableArrayFieldTemplate = class TableArrayFieldTemplate extends React.Compon
769
769
  if (utils_1.filteredErrors(errorSchema)[utils_1.getFormDataIndex(idx, uiSchema)])
770
770
  className = className ? `${className} bg-danger` : "bg-danger";
771
771
  return [
772
- React.createElement("tr", { key: utils_1.getUUID(this.props.formData[item.index]) || item.key, onClick: this.getOnChangeActive(idx), className: className, tabIndex: idx === activeIdx ? undefined : 0, id: idx !== activeIdx ? `_laji-form_${ArrayField_2.ArrayFieldPatched.prototype.getIdSchema(this.props, idx).$id}` : undefined, ref: setItemRef(idx), style: idx === activeIdx ? this.state.activeTrStyle : undefined, onMouseEnter: onMouseEnter(idx), onMouseLeave: onMouseLeave(idx), onKeyDown: this.onKeyDownActivate(idx) },
772
+ React.createElement("tr", { key: utils_1.getUUID(this.props.formData[item.index]) || item.key, onClick: this.getOnChangeActive(idx), className: className, tabIndex: idx === activeIdx ? undefined : 0, role: idx === activeIdx ? undefined : "button", id: idx !== activeIdx ? `_laji-form_${ArrayField_2.ArrayFieldPatched.prototype.getIdSchema(this.props, idx).$id}` : undefined, ref: setItemRef(idx), style: idx === activeIdx ? this.state.activeTrStyle : undefined, onMouseEnter: onMouseEnter(idx), onMouseLeave: onMouseLeave(idx), onKeyDown: this.onKeyDownActivate(idx) },
773
773
  cols.length ? cols.map(col => React.createElement("td", { key: col }, utils_1.formatValue(Object.assign(Object.assign({}, that.props), { schema: schema.items.properties[col], uiSchema: (uiSchema.items || {})[col], formData: formData[idx][col] }), formatters[col], { formData: formData[idx] }))) : React.createElement("td", null),
774
774
  (activeIdx !== undefined && items[activeIdx] && idx === activeIdx) ? (React.createElement("td", { key: utils_1.getUUID(formData[activeIdx]) || activeIdx, className: "single-active-array-table-content-col" },
775
775
  React.createElement("div", { className: "laji-form-field-template-item keep-vertical", style: this.state.activeStyle, ref: this.setActiveRef },
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import { FieldProps } from "../LajiForm";
2
+ import { FormContext } from "../LajiForm";
3
+ import { FieldProps, JSONSchemaArray, JSONSchemaObject } from "../../types";
3
4
  export declare const colIsLoading: (col: SortCol) => boolean;
4
5
  interface SortCol {
5
6
  name: string;
@@ -43,24 +44,110 @@ declare type CompareStrategy = DefaultCompareStrategy | TaxonomicCompareStrategy
43
44
  * Can be used only if items are objects (non-objects don't have UUIDs which are used for
44
45
  * keeping the original order intact upon changes);
45
46
  */
46
- export default class SortArrayField extends React.Component<FieldProps, State> {
47
+ export default class SortArrayField extends React.Component<FieldProps<JSONSchemaArray<JSONSchemaObject>>, State> {
47
48
  state: State;
48
49
  sortTimeIdToSortedIdx: Record<string, number>;
49
50
  /**
50
51
  * Id-to-idx mapping when the sorting was touched. Used to sorting newly items where they are put, instead of sorting them according to the sort cols.
51
52
  */
52
53
  sortTimeIdToOrigIdx: Record<string, number>;
53
- constructor(props: FieldProps);
54
+ constructor(props: FieldProps<JSONSchemaArray<JSONSchemaObject>>);
54
55
  componentDidUpdate(): void;
55
56
  /**
56
57
  * Sort cols might be retrieved from settings JSON, which doesn't hold the 'compare' fn. We add the fn
57
58
  * asynchronously when the component updates according to the comparison strategy name.
58
59
  */
59
60
  syncColumns(): void;
60
- getUiShema(props: FieldProps, { sortCols }: State, sortedData: any[]): any;
61
- getSortableColumns(props: FieldProps): string[] | undefined;
61
+ getUiShema(props: FieldProps<JSONSchemaArray<JSONSchemaObject>>, { sortCols }: State, sortedData: any[]): {
62
+ "ui:options": any;
63
+ "ui:ArrayFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
64
+ "ui:ArrayFieldDescriptionTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldDescriptionProps<any, JSONSchemaObject, FormContext>> | undefined;
65
+ "ui:ArrayFieldItemTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateItemType<any, JSONSchemaObject, FormContext>> | undefined;
66
+ "ui:ArrayFieldTitleTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTitleProps<any, JSONSchemaObject, FormContext>> | undefined;
67
+ "ui:BaseInputTemplate"?: React.ComponentType<import("@rjsf/utils").WidgetProps<any, JSONSchemaObject, FormContext>> | undefined;
68
+ "ui:DescriptionFieldTemplate"?: React.ComponentType<import("@rjsf/utils").DescriptionFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
69
+ "ui:ErrorListTemplate"?: React.ComponentType<import("@rjsf/utils").ErrorListProps<any, JSONSchemaObject, FormContext>> | undefined;
70
+ "ui:FieldErrorTemplate"?: React.ComponentType<import("@rjsf/utils").FieldErrorProps<any, JSONSchemaObject, FormContext>> | undefined;
71
+ "ui:FieldHelpTemplate"?: React.ComponentType<import("@rjsf/utils").FieldHelpProps<any, JSONSchemaObject, FormContext>> | undefined;
72
+ "ui:FieldTemplate"?: React.ComponentType<import("@rjsf/utils").FieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
73
+ "ui:ObjectFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ObjectFieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
74
+ "ui:TitleFieldTemplate"?: React.ComponentType<import("@rjsf/utils").TitleFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
75
+ "ui:UnsupportedFieldTemplate"?: React.ComponentType<import("@rjsf/utils").UnsupportedFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
76
+ "ui:WrapIfAdditionalTemplate"?: React.ComponentType<import("@rjsf/utils").WrapIfAdditionalTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
77
+ "ui:classNames"?: string | undefined;
78
+ "ui:style"?: React.StyleHTMLAttributes<any> | undefined;
79
+ "ui:title"?: string | undefined;
80
+ "ui:description"?: string | undefined;
81
+ "ui:placeholder"?: string | undefined;
82
+ "ui:help"?: string | undefined;
83
+ "ui:autofocus"?: boolean | undefined;
84
+ "ui:autocomplete"?: string | undefined;
85
+ "ui:disabled"?: boolean | undefined;
86
+ "ui:emptyValue"?: any;
87
+ "ui:enumDisabled"?: (string | number | boolean)[] | undefined;
88
+ "ui:hideError"?: boolean | undefined;
89
+ "ui:readonly"?: boolean | undefined;
90
+ "ui:order"?: string[] | undefined;
91
+ "ui:addable"?: boolean | undefined;
92
+ "ui:orderable"?: boolean | undefined;
93
+ "ui:removable"?: boolean | undefined;
94
+ "ui:inline"?: boolean | undefined;
95
+ "ui:inputType"?: string | undefined;
96
+ "ui:label"?: boolean | undefined;
97
+ "ui:rows"?: number | undefined;
98
+ "ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
99
+ "ui:widget"?: string | import("@rjsf/utils").Widget<any, JSONSchemaObject, FormContext> | undefined;
100
+ "ui:duplicateKeySuffixSeparator"?: string | undefined;
101
+ "ui:rootFieldId"?: string | undefined;
102
+ "ui:field"?: string | import("@rjsf/utils").Field<any, JSONSchemaObject, FormContext> | undefined;
103
+ "ui:fieldReplacesAnyOrOneOf"?: boolean | undefined;
104
+ };
105
+ getSortableColumns(props: FieldProps<JSONSchemaArray<JSONSchemaObject>>): string[] | undefined;
62
106
  getNextComponentProps(props: any, state: State): {
63
- uiSchema: any;
107
+ uiSchema: {
108
+ "ui:options": any;
109
+ "ui:ArrayFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
110
+ "ui:ArrayFieldDescriptionTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldDescriptionProps<any, JSONSchemaObject, FormContext>> | undefined;
111
+ "ui:ArrayFieldItemTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateItemType<any, JSONSchemaObject, FormContext>> | undefined;
112
+ "ui:ArrayFieldTitleTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTitleProps<any, JSONSchemaObject, FormContext>> | undefined;
113
+ "ui:BaseInputTemplate"?: React.ComponentType<import("@rjsf/utils").WidgetProps<any, JSONSchemaObject, FormContext>> | undefined;
114
+ "ui:DescriptionFieldTemplate"?: React.ComponentType<import("@rjsf/utils").DescriptionFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
115
+ "ui:ErrorListTemplate"?: React.ComponentType<import("@rjsf/utils").ErrorListProps<any, JSONSchemaObject, FormContext>> | undefined;
116
+ "ui:FieldErrorTemplate"?: React.ComponentType<import("@rjsf/utils").FieldErrorProps<any, JSONSchemaObject, FormContext>> | undefined;
117
+ "ui:FieldHelpTemplate"?: React.ComponentType<import("@rjsf/utils").FieldHelpProps<any, JSONSchemaObject, FormContext>> | undefined;
118
+ "ui:FieldTemplate"?: React.ComponentType<import("@rjsf/utils").FieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
119
+ "ui:ObjectFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ObjectFieldTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
120
+ "ui:TitleFieldTemplate"?: React.ComponentType<import("@rjsf/utils").TitleFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
121
+ "ui:UnsupportedFieldTemplate"?: React.ComponentType<import("@rjsf/utils").UnsupportedFieldProps<any, JSONSchemaObject, FormContext>> | undefined;
122
+ "ui:WrapIfAdditionalTemplate"?: React.ComponentType<import("@rjsf/utils").WrapIfAdditionalTemplateProps<any, JSONSchemaObject, FormContext>> | undefined;
123
+ "ui:classNames"?: string | undefined;
124
+ "ui:style"?: React.StyleHTMLAttributes<any> | undefined;
125
+ "ui:title"?: string | undefined;
126
+ "ui:description"?: string | undefined;
127
+ "ui:placeholder"?: string | undefined;
128
+ "ui:help"?: string | undefined;
129
+ "ui:autofocus"?: boolean | undefined;
130
+ "ui:autocomplete"?: string | undefined;
131
+ "ui:disabled"?: boolean | undefined;
132
+ "ui:emptyValue"?: any;
133
+ "ui:enumDisabled"?: (string | number | boolean)[] | undefined;
134
+ "ui:hideError"?: boolean | undefined;
135
+ "ui:readonly"?: boolean | undefined;
136
+ "ui:order"?: string[] | undefined;
137
+ "ui:addable"?: boolean | undefined;
138
+ "ui:orderable"?: boolean | undefined;
139
+ "ui:removable"?: boolean | undefined;
140
+ "ui:inline"?: boolean | undefined;
141
+ "ui:inputType"?: string | undefined;
142
+ "ui:label"?: boolean | undefined;
143
+ "ui:rows"?: number | undefined;
144
+ "ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
145
+ "ui:widget"?: string | import("@rjsf/utils").Widget<any, JSONSchemaObject, FormContext> | undefined;
146
+ "ui:duplicateKeySuffixSeparator"?: string | undefined;
147
+ "ui:rootFieldId"?: string | undefined;
148
+ "ui:field"?: string | import("@rjsf/utils").Field<any, JSONSchemaObject, FormContext> | undefined;
149
+ "ui:fieldReplacesAnyOrOneOf"?: boolean | undefined;
150
+ };
64
151
  formData: any[];
65
152
  onChange: (formData: any[]) => void;
66
153
  };
@@ -343,7 +343,7 @@ class SortArrayField extends React.Component {
343
343
  this.setSortCols(sortCols);
344
344
  }
345
345
  render() {
346
- const { SchemaField } = this.props.registry.fields;
346
+ const SchemaField = this.props.registry.fields.SchemaField; // TODO as any
347
347
  const nextProps = this.getNextComponentProps(this.props, this.state);
348
348
  return (React.createElement(SchemaField, Object.assign({}, this.props, nextProps, { onChange: this.onChange })));
349
349
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import * as PropTypes from "prop-types";
3
- import { FieldProps } from "../LajiForm";
3
+ import { FieldProps } from "../../types";
4
4
  export default class SplitField extends React.Component<FieldProps> {
5
5
  static contextType: React.Context<import("../../ReactContext").ContextProps>;
6
6
  static propTypes: {
@@ -29,12 +29,13 @@ let SplitField = class SplitField extends React.Component {
29
29
  };
30
30
  }
31
31
  render() {
32
+ var _a;
32
33
  const TitleFieldTemplate = utils_2.getTemplate("TitleFieldTemplate", this.props.registry, utils_1.getUiOptions(this.props.uiSchema));
33
34
  const DescriptionFieldTemplate = utils_2.getTemplate("DescriptionFieldTemplate", this.props.registry, utils_1.getUiOptions(this.props.uiSchema));
34
- const { "ui:title": _title } = this.props.uiSchema;
35
+ const { "ui:title": _title } = this.props.uiSchema || {};
35
36
  const { Row, Col } = this.context.theme;
36
37
  return (React.createElement("div", null,
37
- React.createElement(TitleFieldTemplate, { id: `${this.props.idSchema.$id}__title`, title: _title !== undefined ? _title : this.props.title, required: this.props.required || this.props.uiSchema["ui:required"], schema: this.props.schema, uiSchema: this.props.uiSchema, registry: this.props.registry }),
38
+ React.createElement(TitleFieldTemplate, { id: `${this.props.idSchema.$id}__title`, title: _title !== undefined ? _title : this.props.title, required: this.props.required || ((_a = this.props.uiSchema) === null || _a === void 0 ? void 0 : _a["ui:required"]), schema: this.props.schema, uiSchema: this.props.uiSchema, registry: this.props.registry }),
38
39
  React.createElement(DescriptionFieldTemplate, { id: `${this.props.idSchema.$id}__description`, schema: this.props.schema, description: this.props.description, registry: this.props.registry }),
39
40
  React.createElement(Row, null, utils_1.getUiOptions(this.props.uiSchema).splits.map((split, i) => React.createElement(Col, { md: split.md, lg: split.lg, xs: split.xs, sm: split.sm, key: i }, this.renderSplitField(split))))));
40
41
  }
@@ -15,7 +15,50 @@ export default class StringToArrayField extends React.Component<any, any, any> {
15
15
  items: any;
16
16
  };
17
17
  formData: any;
18
- uiSchema: any;
18
+ uiSchema: {
19
+ "ui:ArrayFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
20
+ "ui:ArrayFieldDescriptionTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldDescriptionProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
21
+ "ui:ArrayFieldItemTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateItemType<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
22
+ "ui:ArrayFieldTitleTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTitleProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
23
+ "ui:BaseInputTemplate"?: React.ComponentType<import("@rjsf/utils").WidgetProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
24
+ "ui:DescriptionFieldTemplate"?: React.ComponentType<import("@rjsf/utils").DescriptionFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
25
+ "ui:ErrorListTemplate"?: React.ComponentType<import("@rjsf/utils").ErrorListProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
26
+ "ui:FieldErrorTemplate"?: React.ComponentType<import("@rjsf/utils").FieldErrorProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
27
+ "ui:FieldHelpTemplate"?: React.ComponentType<import("@rjsf/utils").FieldHelpProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
28
+ "ui:FieldTemplate"?: React.ComponentType<import("@rjsf/utils").FieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
29
+ "ui:ObjectFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ObjectFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
30
+ "ui:TitleFieldTemplate"?: React.ComponentType<import("@rjsf/utils").TitleFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
31
+ "ui:UnsupportedFieldTemplate"?: React.ComponentType<import("@rjsf/utils").UnsupportedFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
32
+ "ui:WrapIfAdditionalTemplate"?: React.ComponentType<import("@rjsf/utils").WrapIfAdditionalTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
33
+ "ui:classNames"?: string | undefined;
34
+ "ui:style"?: React.StyleHTMLAttributes<any> | undefined;
35
+ "ui:title"?: string | undefined;
36
+ "ui:description"?: string | undefined;
37
+ "ui:placeholder"?: string | undefined;
38
+ "ui:help"?: string | undefined;
39
+ "ui:autofocus"?: boolean | undefined;
40
+ "ui:autocomplete"?: string | undefined;
41
+ "ui:disabled": any;
42
+ "ui:emptyValue"?: any;
43
+ "ui:enumDisabled"?: (string | number | boolean)[] | undefined;
44
+ "ui:hideError"?: boolean | undefined;
45
+ "ui:readonly": any;
46
+ "ui:order"?: string[] | undefined;
47
+ "ui:addable"?: boolean | undefined;
48
+ "ui:orderable"?: boolean | undefined;
49
+ "ui:removable"?: boolean | undefined;
50
+ "ui:inline"?: boolean | undefined;
51
+ "ui:inputType"?: string | undefined;
52
+ "ui:label"?: boolean | undefined;
53
+ "ui:rows"?: number | undefined;
54
+ "ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
55
+ "ui:widget"?: string | import("@rjsf/utils").Widget<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
56
+ "ui:duplicateKeySuffixSeparator"?: string | undefined;
57
+ "ui:rootFieldId"?: string | undefined;
58
+ "ui:field"?: string | import("@rjsf/utils").Field<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
59
+ "ui:fieldReplacesAnyOrOneOf"?: boolean | undefined;
60
+ "ui:options"?: import("@rjsf/utils").UIOptionsType<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
61
+ };
19
62
  onChange: (formData: any) => void;
20
63
  };
21
64
  onChange: (formData: any) => void;
@@ -136,7 +136,7 @@ class TagInputComponent extends React.Component {
136
136
  }
137
137
  return item;
138
138
  });
139
- return (React.createElement("div", { className: `rw-multiselect rw-widget${this.state.focused ? " rw-state-focus" : ""}${readonly || disabled ? " rw-state-disabled" : ""}`, onClick: this.onClick },
139
+ return (React.createElement("div", { className: `rw-multiselect rw-widget${this.state.focused ? " rw-state-focus" : ""}${(readonly || disabled) ? " rw-state-disabled" : ""}`, onClick: this.onClick },
140
140
  React.createElement("div", { className: "rw-widget-input rw-widget-picked rw-widget-container" },
141
141
  React.createElement("ul", { className: "rw-multiselect-taglist" }, tagElems.map((item, idx) => React.createElement("li", { key: idx, className: "rw-multiselect-tag", onClick: this.onTagClick(idx) },
142
142
  item,
@@ -18,7 +18,7 @@ export default class ToggleAdditionalArrayFieldsField extends React.Component<an
18
18
  getTogglePersistenceContextKey: (props: any) => string;
19
19
  getInitialVisible(props: any): unknown;
20
20
  getStateFromProps(props: any): {
21
- uiSchema: any;
21
+ uiSchema: import("../../types").UiSchema;
22
22
  };
23
23
  toggleVisibility: () => void;
24
24
  }
@@ -12,7 +12,50 @@ export default class UnitListShorthandArrayField extends React.Component<any, an
12
12
  constructor(props: any);
13
13
  constructor(props: any, context: any);
14
14
  getStateFromProps(props: any): {
15
- uiSchema: any;
15
+ uiSchema: {
16
+ "ui:options": any;
17
+ "ui:ArrayFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
18
+ "ui:ArrayFieldDescriptionTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldDescriptionProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
19
+ "ui:ArrayFieldItemTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTemplateItemType<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
20
+ "ui:ArrayFieldTitleTemplate"?: React.ComponentType<import("@rjsf/utils").ArrayFieldTitleProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
21
+ "ui:BaseInputTemplate"?: React.ComponentType<import("@rjsf/utils").WidgetProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
22
+ "ui:DescriptionFieldTemplate"?: React.ComponentType<import("@rjsf/utils").DescriptionFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
23
+ "ui:ErrorListTemplate"?: React.ComponentType<import("@rjsf/utils").ErrorListProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
24
+ "ui:FieldErrorTemplate"?: React.ComponentType<import("@rjsf/utils").FieldErrorProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
25
+ "ui:FieldHelpTemplate"?: React.ComponentType<import("@rjsf/utils").FieldHelpProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
26
+ "ui:FieldTemplate"?: React.ComponentType<import("@rjsf/utils").FieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
27
+ "ui:ObjectFieldTemplate"?: React.ComponentType<import("@rjsf/utils").ObjectFieldTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
28
+ "ui:TitleFieldTemplate"?: React.ComponentType<import("@rjsf/utils").TitleFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
29
+ "ui:UnsupportedFieldTemplate"?: React.ComponentType<import("@rjsf/utils").UnsupportedFieldProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
30
+ "ui:WrapIfAdditionalTemplate"?: React.ComponentType<import("@rjsf/utils").WrapIfAdditionalTemplateProps<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext>> | undefined;
31
+ "ui:classNames"?: string | undefined;
32
+ "ui:style"?: React.StyleHTMLAttributes<any> | undefined;
33
+ "ui:title"?: string | undefined;
34
+ "ui:description"?: string | undefined;
35
+ "ui:placeholder"?: string | undefined;
36
+ "ui:help"?: string | undefined;
37
+ "ui:autofocus"?: boolean | undefined;
38
+ "ui:autocomplete"?: string | undefined;
39
+ "ui:disabled"?: boolean | undefined;
40
+ "ui:emptyValue"?: any;
41
+ "ui:enumDisabled"?: (string | number | boolean)[] | undefined;
42
+ "ui:hideError"?: boolean | undefined;
43
+ "ui:readonly"?: boolean | undefined;
44
+ "ui:order"?: string[] | undefined;
45
+ "ui:addable"?: boolean | undefined;
46
+ "ui:orderable"?: boolean | undefined;
47
+ "ui:removable"?: boolean | undefined;
48
+ "ui:inline"?: boolean | undefined;
49
+ "ui:inputType"?: string | undefined;
50
+ "ui:label"?: boolean | undefined;
51
+ "ui:rows"?: number | undefined;
52
+ "ui:submitButtonOptions"?: import("@rjsf/utils").UISchemaSubmitButtonOptions | undefined;
53
+ "ui:widget"?: string | import("@rjsf/utils").Widget<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
54
+ "ui:duplicateKeySuffixSeparator"?: string | undefined;
55
+ "ui:rootFieldId"?: string | undefined;
56
+ "ui:field"?: string | import("@rjsf/utils").Field<any, import("../../types").JSONSchemaObject, import("../LajiForm").FormContext> | undefined;
57
+ "ui:fieldReplacesAnyOrOneOf"?: boolean | undefined;
58
+ };
16
59
  };
17
60
  onButtonClick: () => () => void;
18
61
  onHide: () => void;
@@ -748,7 +748,7 @@ class Autosuggest extends React.Component {
748
748
  render() {
749
749
  const { props } = this;
750
750
  let { suggestions, inputValue = "" } = this.state;
751
- const inputProps = Object.assign(Object.assign({ id: this.props.id, value: inputValue, readonly: props.readonly, disabled: props.disabled, placeholder: props.placeholder }, (this.props.inputProps || {})), { onChange: this.onInputChange, onBlur: this.onBlur, onFocus: this.onFocus });
751
+ const inputProps = Object.assign(Object.assign({ id: this.props.id, value: inputValue, readonly: props.readonly, disabled: props.disabled, placeholder: props.placeholder }, (this.props.inputProps || {})), { onChange: this.onInputChange, onBlur: this.onBlur, onFocus: this.onFocus, autoComplete: "off" });
752
752
  let cssClasses = {
753
753
  suggestionsContainer: "rw-popup-container rw-popup-transition",
754
754
  suggestionsContainerOpen: "rw-popup",
@@ -45,19 +45,19 @@ class CheckboxWidget extends React.Component {
45
45
  };
46
46
  this.onGroupKeyDown = this.props.formContext.utils.keyboardClick((e) => {
47
47
  this.getToggleMode(this.props) && this.toggle(e);
48
- });
48
+ }, [" "]);
49
49
  this.onTrueKeyDown = this.props.formContext.utils.keyboardClick(() => {
50
50
  if (this.props.disabled || this.props.readonly) {
51
51
  return;
52
52
  }
53
53
  this.onChange(true);
54
- });
54
+ }, [" "]);
55
55
  this.onFalseKeyDown = this.props.formContext.utils.keyboardClick(() => {
56
56
  if (this.props.disabled || this.props.readonly) {
57
57
  return;
58
58
  }
59
59
  this.onChange(false);
60
- });
60
+ }, [" "]);
61
61
  this.onUndefinedKeyDown = this.props.formContext.utils.keyboardClick(() => {
62
62
  this.onChange(undefined);
63
63
  });
@@ -105,9 +105,10 @@ class CheckboxWidget extends React.Component {
105
105
  const tabTargetClass = "laji-form-checkbox-widget-tab-target";
106
106
  const checkbox = (React.createElement(ButtonToolbar, { className: utils_1.classNames(toggleMode && "desktop-layout") },
107
107
  React.createElement(ToggleButtonGroup, Object.assign({ ref: this.groupRef, type: "radio", value: [_value], name: this.props.id, onChange: this.onButtonGroupChange, onKeyDown: this.onGroupKeyDown, className: utils_1.classNames(toggleMode && tabTargetClass) }, commonProps, { tabIndex: (toggleMode && !_disabled) ? 0 : undefined }),
108
- React.createElement(ToggleButton, Object.assign({ id: `${id}-true`, ref: this.trueRef, value: true, onClick: toggleMode ? this.toggle : undefined, className: utils_1.classNames(toggleMode && _value === false && "laji-form-hide-btn-label", !toggleMode && tabTargetClass), onKeyDown: this.onTrueKeyDown }, commonProps), trueLabel),
109
- React.createElement(ToggleButton, Object.assign({ id: `${id}-false`, ref: this.falseRef, value: false, onClick: toggleMode ? this.toggle : undefined, className: utils_1.classNames(toggleMode && _value === true && "laji-form-hide-btn-label"), onKeyDown: this.onFalseKeyDown }, commonProps), falseLabel),
110
- (displayUndefined ? React.createElement(ToggleButton, Object.assign({ id: `${id}-undefined`, ref: this.undefinedRef, value: "undefined" }, commonProps, { onKeyDown: this.onUndefinedKeyDown }), unknownLabel) : null))));
108
+ React.createElement(ToggleButton, Object.assign({ id: `${id}-true`, ref: this.trueRef, value: true, onClick: toggleMode ? this.toggle : undefined, className: utils_1.classNames(toggleMode && _value === false && "laji-form-hide-btn-label", _value === true && tabTargetClass), onKeyDown: this.onTrueKeyDown }, commonProps), trueLabel),
109
+ React.createElement(ToggleButton, Object.assign({ id: `${id}-false`, ref: this.falseRef, value: false, onClick: toggleMode ? this.toggle : undefined, className: utils_1.classNames(toggleMode && _value === true && "laji-form-hide-btn-label", _value === false && tabTargetClass), onKeyDown: this.onFalseKeyDown }, commonProps), falseLabel),
110
+ (displayUndefined ?
111
+ React.createElement(ToggleButton, Object.assign({ id: `${id}-undefined`, ref: this.undefinedRef, value: "undefined", className: utils_1.classNames(_value === undefined && tabTargetClass) }, commonProps, { onKeyDown: this.onUndefinedKeyDown }), unknownLabel) : null))));
111
112
  const { Label } = this.props.formContext;
112
113
  return !hasLabel ? checkbox : (React.createElement(Label, { label: label, required: required, uiSchema: options, contextId: this.props.formContext.contextId }, checkbox));
113
114
  }
@@ -1,52 +1,13 @@
1
- export default SelectWidget;
2
- declare class SelectWidget extends React.Component<any, any, any> {
3
- static contextType: React.Context<import("../../ReactContext").ContextProps>;
4
- constructor(props: any);
5
- _context: Record<string, unknown>;
6
- mounted: boolean | undefined;
7
- getEnumOptions(props: any): any;
8
- getStateFromProps(props: any): {
9
- valsToItems: any;
10
- enumOptions: any;
11
- value: any;
12
- };
13
- multiSelectOnChange: (values: any) => void;
14
- selectOnChange: (item: any) => void;
15
- onClick: () => void;
16
- onFocus: () => void;
17
- onBlur: () => void;
18
- onSelect: (item: any) => void;
19
- onToggle: () => void;
20
- onKeyDown: (e: any) => void;
21
- setRef: (elem: any) => void;
22
- elemRef: any;
23
- getEnum: (val: any) => any;
24
- }
25
- declare namespace SelectWidget {
26
- namespace defaultProps {
27
- const autofocus: boolean;
28
- }
29
- namespace propTypes {
30
- export const schema: PropTypes.Requireable<PropTypes.InferProps<{
31
- type: PropTypes.Requireable<string>;
32
- }>>;
33
- export const id: PropTypes.Validator<string>;
34
- export const uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
35
- "ui:options": PropTypes.Requireable<PropTypes.InferProps<{
36
- enumOptions: PropTypes.Requireable<any[]>;
37
- order: PropTypes.Requireable<any[]>;
38
- filter: PropTypes.Requireable<any[]>;
39
- filterType: PropTypes.Requireable<string>;
40
- labels: PropTypes.Requireable<object>;
41
- }>>;
42
- }>>;
43
- export const value: PropTypes.Requireable<string | any[]>;
44
- export const required: PropTypes.Requireable<boolean>;
45
- export const multiple: PropTypes.Requireable<boolean>;
46
- const autofocus_1: PropTypes.Requireable<boolean>;
47
- export { autofocus_1 as autofocus };
48
- export const onChange: PropTypes.Requireable<(...args: any[]) => any>;
49
- }
50
- }
51
- import * as React from "react";
52
- import * as PropTypes from "prop-types";
1
+ /// <reference types="react" />
2
+ import { JSONSchemaArray, JSONSchemaEnum, JSONSchemaEnumOneOf, WidgetProps } from "../../types";
3
+ declare type SingleSelectWidgetProps = Omit<WidgetProps<JSONSchemaEnum>, "value" | "onChange"> & {
4
+ value?: string;
5
+ onChange: (value?: string) => void;
6
+ };
7
+ declare type MultiSelectWidgetProps = Omit<WidgetProps<JSONSchemaArray<JSONSchemaEnumOneOf>>, "value" | "onChange"> & {
8
+ value?: string[];
9
+ onChange: (value?: string[]) => void;
10
+ };
11
+ declare type SelectWidgetProps = SingleSelectWidgetProps | MultiSelectWidgetProps;
12
+ export default function SelectWidget(props: SelectWidgetProps): JSX.Element | null;
13
+ export {};