@performant-software/semantic-components 1.0.10-beta.2 → 1.0.10-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/semantic-components",
3
- "version": "1.0.10-beta.2",
3
+ "version": "1.0.10-beta.4",
4
4
  "description": "A package of shared components based on the Semantic UI Framework.",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",
@@ -12,7 +12,7 @@
12
12
  "build": "webpack --mode production && flow-copy-source -v src types"
13
13
  },
14
14
  "dependencies": {
15
- "@performant-software/shared-components": "^1.0.10-beta.2",
15
+ "@performant-software/shared-components": "^1.0.10-beta.4",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "i18next": "^19.4.4",
@@ -210,6 +210,19 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
210
210
  return Promise.resolve();
211
211
  }, [items, props.onSave]);
212
212
 
213
+ /**
214
+ * Sets the passed item onto the state.
215
+ *
216
+ * @type {function(*): void}
217
+ */
218
+ const onSetState = useCallback((item: any) => (
219
+ setItems((prevItems) => _.map(prevItems, (i) => (i !== item ? i : {
220
+ ...i,
221
+ ...item,
222
+ errors: []
223
+ })))
224
+ ), []);
225
+
213
226
  /**
214
227
  * Updates the text value for the passed item.
215
228
  *
@@ -437,6 +450,7 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
437
450
  key={index}
438
451
  onAssociationInputChange={onAssociationInputChange.bind(this, item)}
439
452
  onDelete={onDelete.bind(this, item)}
453
+ onSetState={onSetState.bind(this, item)}
440
454
  onTextInputChange={onTextInputChange.bind(this, item)}
441
455
  onUpdate={onUpdate.bind(this, item)}
442
456
  renderStatus={renderStatus.bind(this, index)}
@@ -210,6 +210,19 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
210
210
  return Promise.resolve();
211
211
  }, [items, props.onSave]);
212
212
 
213
+ /**
214
+ * Sets the passed item onto the state.
215
+ *
216
+ * @type {function(*): void}
217
+ */
218
+ const onSetState = useCallback((item: any) => (
219
+ setItems((prevItems) => _.map(prevItems, (i) => (i !== item ? i : {
220
+ ...i,
221
+ ...item,
222
+ errors: []
223
+ })))
224
+ ), []);
225
+
213
226
  /**
214
227
  * Updates the text value for the passed item.
215
228
  *
@@ -437,6 +450,7 @@ const FileUploadModal: ComponentType<any> = (props: Props) => {
437
450
  key={index}
438
451
  onAssociationInputChange={onAssociationInputChange.bind(this, item)}
439
452
  onDelete={onDelete.bind(this, item)}
453
+ onSetState={onSetState.bind(this, item)}
440
454
  onTextInputChange={onTextInputChange.bind(this, item)}
441
455
  onUpdate={onUpdate.bind(this, item)}
442
456
  renderStatus={renderStatus.bind(this, index)}