@luomus/laji-form 15.1.31 → 15.1.33

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.
@@ -40,7 +40,8 @@ function VirtualSchemaField(ComposedComponent) {
40
40
  "registry",
41
41
  "onChange",
42
42
  "disabled",
43
- "readonly"
43
+ "readonly",
44
+ "required"
44
45
  ].reduce((_props, prop) => {
45
46
  if (prop in props)
46
47
  _props[prop] = props[prop];
@@ -71,7 +71,7 @@ class ErrorListTemplate extends React.Component {
71
71
  _path = `${_path}/items`;
72
72
  else
73
73
  _path = `${_path}/properties/${prop}`;
74
- const _defaultTitle = uiSchema["ui:multiLanguage"] ? `${title} (${prop})` : prop;
74
+ const _defaultTitle = _schema.type === "array" || uiSchema["ui:multiLanguage"] ? `${title} (${prop})` : prop;
75
75
  const childErrors = walkErrors(_path, `${id}_${prop}`, errorSchema[prop], uiSchema[prop] || {}, _defaultTitle);
76
76
  errors = [...errors, ...childErrors.errors];
77
77
  warnings = [...warnings, ...childErrors.warnings];
@@ -37,7 +37,7 @@ export class Autosuggest extends React.Component<any, any, any> {
37
37
  getSuggestionValue: (suggestion: any) => any;
38
38
  renderSuggestion: (suggestion: any) => JSX.Element;
39
39
  selectSuggestion: (suggestion: any) => void;
40
- selectUnsuggested: (value: any) => void;
40
+ selectUnsuggested: (inputValue: any) => void;
41
41
  onSuggestionSelected: (suggestion: any) => void;
42
42
  onUnsuggestedSelected: (inputValue: any) => void;
43
43
  findExactMatch: (suggestions: any, inputValue?: string) => any;
@@ -469,16 +469,17 @@ class Autosuggest extends React.Component {
469
469
  ? this.setState(state, afterStateChange)
470
470
  : afterStateChange();
471
471
  };
472
- this.selectUnsuggested = (value) => {
473
- if (utils_1.isEmptyString(value) && utils_1.isEmptyString(this.props.value))
472
+ this.selectUnsuggested = (inputValue) => {
473
+ if (utils_1.isEmptyString(inputValue) && utils_1.isEmptyString(this.props.value))
474
474
  return;
475
+ const value = !utils_1.isEmptyString(inputValue) ? inputValue : undefined;
475
476
  const { onUnsuggestedSelected, onChange } = this.props;
476
477
  const afterStateChange = () => {
477
478
  onUnsuggestedSelected ?
478
479
  onUnsuggestedSelected(value) :
479
480
  onChange(value);
480
481
  };
481
- const state = { inputValue: value, suggestion: undefined, suggestionForValue: value };
482
+ const state = { inputValue, suggestion: undefined, suggestionForValue: inputValue };
482
483
  this.mounted
483
484
  ? this.setState(state, afterStateChange)
484
485
  : afterStateChange();
@@ -607,7 +608,7 @@ class Autosuggest extends React.Component {
607
608
  this.selectUnsuggested(parsedInputValue);
608
609
  }
609
610
  else if (!allowNonsuggestedValue) {
610
- this.setState({ inputValue: "" }, () => this.props.onChange && this.props.onChange(""));
611
+ this.setState({ inputValue: "" }, () => this.props.onChange && this.props.onChange(undefined));
611
612
  }
612
613
  callback && callback();
613
614
  };
@@ -747,7 +748,7 @@ class Autosuggest extends React.Component {
747
748
  render() {
748
749
  const { props } = this;
749
750
  let { suggestions, inputValue = "" } = this.state;
750
- 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" });
751
+ const inputProps = Object.assign(Object.assign({ id: this.props.id, value: inputValue, disabled: props.disabled || props.readonly, placeholder: props.placeholder }, (this.props.inputProps || {})), { onChange: this.onInputChange, onBlur: this.onBlur, onFocus: this.onFocus, autoComplete: "off" });
751
752
  let cssClasses = {
752
753
  suggestionsContainer: "rw-popup-container rw-popup-transition",
753
754
  suggestionsContainerOpen: "rw-popup",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.31",
3
+ "version": "15.1.33",
4
4
  "description": "React module capable of building dynamic forms from Laji form json schemas",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -148,6 +148,7 @@ export declare class Form {
148
148
  $input: Locator;
149
149
  $suggestionsContainer: Locator;
150
150
  $suggestions: Locator;
151
+ $loadingSpinner: Locator;
151
152
  };
152
153
  getTaxonAutosuggestWidget: (lajiFormLocator: string) => {
153
154
  $powerUserButton: Locator;
@@ -156,12 +157,14 @@ export declare class Form {
156
157
  $input: Locator;
157
158
  $suggestionsContainer: Locator;
158
159
  $suggestions: Locator;
160
+ $loadingSpinner: Locator;
159
161
  };
160
162
  getPersonAutosuggestWidget: (lajiFormLocator: string) => {
161
163
  $suggestedGlyph: Locator;
162
164
  $input: Locator;
163
165
  $suggestionsContainer: Locator;
164
166
  $suggestions: Locator;
167
+ $loadingSpinner: Locator;
165
168
  };
166
169
  getScopeField: (lajiFormLocator: string) => {
167
170
  $button: Locator;
@@ -88,6 +88,7 @@ class Form {
88
88
  $input: this.$locate(lajiFormLocator).locator("input"),
89
89
  $suggestionsContainer: this.$locate(lajiFormLocator).locator(".rw-list"),
90
90
  $suggestions: this.$locate(lajiFormLocator).locator(".rw-list-option"),
91
+ $loadingSpinner: this.$locate(lajiFormLocator).locator(".react-spinner"),
91
92
  };
92
93
  };
93
94
  this.getTaxonAutosuggestWidget = (lajiFormLocator) => {