@luomus/laji-form 15.1.65 → 15.1.66

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.
@@ -24,6 +24,7 @@ export declare class DeleteButton extends React.Component<Props, State> {
24
24
  onButtonKeyDown: ({ key }: React.KeyboardEvent) => void;
25
25
  onHideConfirm: () => void;
26
26
  onShowConfirm: (e: React.MouseEvent) => void;
27
+ onCancelClick: (e: React.MouseEvent) => void;
27
28
  onConfirmedClick: (e?: React.KeyboardEvent | React.MouseEvent) => void;
28
29
  onClick: (e: React.MouseEvent) => void;
29
30
  setConfirmAutofocus: (elem?: React.ReactInstance) => void;
@@ -74,6 +74,11 @@ class DeleteButton extends React.Component {
74
74
  }
75
75
  });
76
76
  };
77
+ this.onCancelClick = (e) => {
78
+ e.preventDefault();
79
+ e.stopPropagation();
80
+ this.onHideConfirm();
81
+ };
77
82
  this.onConfirmedClick = (e) => {
78
83
  e && e.preventDefault();
79
84
  e && e.stopPropagation();
@@ -130,7 +135,7 @@ class DeleteButton extends React.Component {
130
135
  React.createElement("span", null, translations.ConfirmRemove),
131
136
  React.createElement(ButtonGroup, null,
132
137
  React.createElement(components_1.Button, { variant: "danger", onClick: this.onConfirmedClick, ref: this.setConfirmAutofocus, id: `${this.props.id}-delete-confirm-yes` }, translations.Remove),
133
- React.createElement(components_1.Button, { variant: "default", onClick: this.onHideConfirm, id: `${this.props.id}-delete-confirm-no` }, translations.Cancel)))));
138
+ React.createElement(components_1.Button, { variant: "default", onClick: this.onCancelClick, id: `${this.props.id}-delete-confirm-no` }, translations.Cancel)))));
134
139
  }
135
140
  browserConfirm() {
136
141
  const choice = confirm(this.props.translations.ConfirmRemove);
@@ -139,6 +139,7 @@ export declare function MediaArrayField<LFC extends Constructor<React.Component<
139
139
  autoOpenMetadataModal: PropTypes.Requireable<boolean>;
140
140
  sideEffects: PropTypes.Requireable<object>;
141
141
  exifParsers: PropTypes.Requireable<(object | null | undefined)[]>;
142
+ metadataFormId: PropTypes.Requireable<string>;
142
143
  }>>;
143
144
  }>>;
144
145
  schema: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
@@ -184,7 +184,8 @@ function MediaArrayField(ComposedComponent) {
184
184
  const { lang, translations } = this.props.registry.formContext;
185
185
  const metadataForm = this.state.metadataForm || {};
186
186
  if (typeof metadataModalOpen === "number" && !this.state.metadataForm) {
187
- this.apiClient.fetchCached(`/forms/${this.METADATA_FORM_ID}`, { lang, format: "schema" })
187
+ const { metadataFormId = this.METADATA_FORM_ID } = (0, utils_1.getUiOptions)(this.props.uiSchema);
188
+ this.apiClient.fetchCached(`/forms/${metadataFormId}`, { lang, format: "schema" })
188
189
  .then(metadataForm => {
189
190
  if (this.mounted) {
190
191
  this.setState({ metadataForm });
@@ -684,7 +685,8 @@ function MediaArrayField(ComposedComponent) {
684
685
  autoOpenAddModal: PropTypes.bool,
685
686
  autoOpenMetadataModal: PropTypes.bool,
686
687
  sideEffects: PropTypes.object,
687
- exifParsers: PropTypes.arrayOf(PropTypes.object)
688
+ exifParsers: PropTypes.arrayOf(PropTypes.object),
689
+ metadataFormId: PropTypes.string
688
690
  })
689
691
  }),
690
692
  schema: PropTypes.shape({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.65",
3
+ "version": "15.1.66",
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",