From 903f14de65d5c3c5203d76b9cc73015aaf056661 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 9 May 2024 12:06:10 -0400 Subject: [PATCH 1/5] CDC #204 - Adding ability to pass arbitrary buttons to AssociatedDropdown component --- .../src/components/AssociatedDropdown.js | 13 +++++++ .../semantic-ui/AssociatedDropdown.stories.js | 38 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/packages/semantic-ui/src/components/AssociatedDropdown.js b/packages/semantic-ui/src/components/AssociatedDropdown.js index a5132b59..5aba9105 100644 --- a/packages/semantic-ui/src/components/AssociatedDropdown.js +++ b/packages/semantic-ui/src/components/AssociatedDropdown.js @@ -224,6 +224,7 @@ class AssociatedDropdown extends Component { { this.renderEditButton() } { this.renderAddButton() } { this.renderClearButton() } + { this.renderButtons() } { this.renderModal() } { this.state.saved && ( @@ -284,6 +285,18 @@ class AssociatedDropdown extends Component { ); } + /** + * Renders the extra buttons. + * + * @returns {*} + */ + renderButtons() { + const excludeButtons = [BUTTON_ADD, BUTTON_CLEAR, BUTTON_EDIT]; + const buttons = _.filter(this.props.buttons, (button) => !excludeButtons.includes(button.name)); + + return _.map(buttons, (button) => this.renderButton(button.name, _.omit(button, 'name'))); + } + /** * Renders the clear button. * diff --git a/packages/storybook/src/semantic-ui/AssociatedDropdown.stories.js b/packages/storybook/src/semantic-ui/AssociatedDropdown.stories.js index d94d4367..bc4619b7 100644 --- a/packages/storybook/src/semantic-ui/AssociatedDropdown.stories.js +++ b/packages/storybook/src/semantic-ui/AssociatedDropdown.stories.js @@ -465,3 +465,41 @@ export const CustomButtons = () => ( upward={boolean('Open upward', false)} /> ); + +export const AdditionalButtons = () => ( + Promise.resolve({ }) + }, + onSave: () => { + action('save')(); + return Promise.resolve({}); + } + }} + onSearch={(search) => Api.onLoad({ items, search, sort_by: 'text' })} + onSelection={action('selection')} + placeholder={text('Placeholder', 'Search')} + renderOption={(item) => ({ + key: item.id, + value: item.id, + text: item.company, + description: item.country + })} + upward={boolean('Open upward', false)} + /> +); From ceabf2d4a6e8ac641113e60e7683b93db3a230cd Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 9 May 2024 12:45:52 -0400 Subject: [PATCH 2/5] CDC #204 - Publishing v2.2.1-beta.0 --- packages/controlled-vocabulary/package.json | 6 +++--- packages/core-data/package.json | 6 +++--- packages/geospatial/package.json | 2 +- packages/semantic-ui/package.json | 4 ++-- packages/shared/package.json | 2 +- packages/user-defined-fields/package.json | 6 +++--- packages/visualize/package.json | 2 +- react-components.json | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index 12c8307e..c18f7c90 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.0", - "@performant-software/shared-components": "^2.2.0", + "@performant-software/semantic-components": "^2.2.1-beta.0", + "@performant-software/shared-components": "^2.2.1-beta.0", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index e81f4370..c3a06c31 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -37,8 +37,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.0", - "@performant-software/geospatial": "^2.2.0", + "@performant-software/shared-components": "^2.2.1-beta.0", + "@performant-software/geospatial": "^2.2.1-beta.0", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index ef79b0f6..d900d968 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index 9132088b..4b809c13 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -35,7 +35,7 @@ "zotero-translation-client": "^5.0.1" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.0", + "@performant-software/shared-components": "^2.2.1-beta.0", "@samvera/clover-iiif": "^2.3.2", "react": ">= 16.13.1 < 19.0.0", "react-dnd": "^11.1.3", diff --git a/packages/shared/package.json b/packages/shared/package.json index 94281da4..865c7798 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/shared-components", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of shared, framework agnostic, components.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index 820fe2b5..fdbaf993 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.0", - "@performant-software/shared-components": "^2.2.0", + "@performant-software/semantic-components": "^2.2.1-beta.0", + "@performant-software/shared-components": "^2.2.1-beta.0", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/visualize/package.json b/packages/visualize/package.json index cfa1e1bf..f5a74b8e 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "2.2.0", + "version": "2.2.1-beta.0", "description": "A package of components used for data visualization", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/react-components.json b/react-components.json index e8503cdc..0209c959 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "2.2.0" + "version": "2.2.1-beta.0" } From 49c80cccd8e63095fcc7d9d8cb813b91254edf5b Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 9 May 2024 12:46:16 -0400 Subject: [PATCH 3/5] CDC #204 - Adding ability to add custom actions to UserDefinedFieldsList and UserDefinedFieldsEmbeddedList components --- .../UserDefinedFieldsEmbeddedList.stories.js | 33 +++++++++++++++++++ .../UserDefinedFieldsEmbeddedList.js | 15 +++++---- .../src/components/UserDefinedFieldsList.js | 14 ++++---- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/packages/storybook/src/user-defined-fields/UserDefinedFieldsEmbeddedList.stories.js b/packages/storybook/src/user-defined-fields/UserDefinedFieldsEmbeddedList.stories.js index ab741fb3..a2a052d1 100644 --- a/packages/storybook/src/user-defined-fields/UserDefinedFieldsEmbeddedList.stories.js +++ b/packages/storybook/src/user-defined-fields/UserDefinedFieldsEmbeddedList.stories.js @@ -98,3 +98,36 @@ export const CustomAddButton = useDragDrop(() => { /> ); }); + +export const CustomActions = useDragDrop(() => { + const [items, setItems] = useState([]); + + /** + * Removes the passed item from the list. + * + * @type {function(*): void} + */ + const onDelete = useCallback((item) => setItems((prevItems) => _.filter(prevItems, (i) => i !== item)), []); + + /** + * Adds the passed item to the list. + * + * @type {function(*): void} + */ + const onSave = useCallback((item) => setItems((prevItems) => [...prevItems, item]), []); + + return ( + + ); +}); diff --git a/packages/user-defined-fields/src/components/UserDefinedFieldsEmbeddedList.js b/packages/user-defined-fields/src/components/UserDefinedFieldsEmbeddedList.js index e83d2810..8739e922 100644 --- a/packages/user-defined-fields/src/components/UserDefinedFieldsEmbeddedList.js +++ b/packages/user-defined-fields/src/components/UserDefinedFieldsEmbeddedList.js @@ -9,12 +9,12 @@ import UserDefinedFieldModal from './UserDefinedFieldModal'; import UserDefinedFields from '../utils/UserDefinedFields'; type Props = EmbeddedListProps & { + actions?: Array, defaults: any, excludeColumns?: Array }; const OMIT_PROPS = [ - 'actions', 'columns', 'defaults', 'excludeColumns', @@ -34,11 +34,6 @@ const UserDefinedFieldsEmbeddedList = (props: Props) => { return ( { ); }; +UserDefinedFieldsEmbeddedList.defaultProps = { + actions: [{ + name: 'edit' + }, { + name: 'delete' + }] +}; + export default UserDefinedFieldsEmbeddedList; diff --git a/packages/user-defined-fields/src/components/UserDefinedFieldsList.js b/packages/user-defined-fields/src/components/UserDefinedFieldsList.js index 03684222..360160ef 100644 --- a/packages/user-defined-fields/src/components/UserDefinedFieldsList.js +++ b/packages/user-defined-fields/src/components/UserDefinedFieldsList.js @@ -15,7 +15,6 @@ type Props = ListTableProps & { }; const OMIT_PROPS = [ - 'actions', 'collectionName', 'columns', 'defaults', @@ -39,11 +38,6 @@ const UserDefinedFieldsList: ComponentType = (props: Props) => { return ( = (props: Props) => { ); }; +UserDefinedFieldsList.defaultProps = { + actions: [{ + name: 'edit' + }, { + name: 'delete' + }] +}; + export default UserDefinedFieldsList; From e89e044efb43f936045efe3d2797904e064a24e6 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 9 May 2024 12:56:40 -0400 Subject: [PATCH 4/5] CDC #204 - Publishing v2.2.1-beta.1 --- packages/controlled-vocabulary/package.json | 6 +++--- packages/core-data/package.json | 6 +++--- packages/geospatial/package.json | 2 +- packages/semantic-ui/package.json | 4 ++-- packages/shared/package.json | 2 +- packages/user-defined-fields/package.json | 6 +++--- packages/visualize/package.json | 2 +- react-components.json | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index c18f7c90..89a89137 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.1-beta.0", - "@performant-software/shared-components": "^2.2.1-beta.0", + "@performant-software/semantic-components": "^2.2.1-beta.1", + "@performant-software/shared-components": "^2.2.1-beta.1", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index c3a06c31..160b2f5d 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -37,8 +37,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.1-beta.0", - "@performant-software/geospatial": "^2.2.1-beta.0", + "@performant-software/shared-components": "^2.2.1-beta.1", + "@performant-software/geospatial": "^2.2.1-beta.1", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index d900d968..36679525 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index 4b809c13..2479daaa 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -35,7 +35,7 @@ "zotero-translation-client": "^5.0.1" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.1-beta.0", + "@performant-software/shared-components": "^2.2.1-beta.1", "@samvera/clover-iiif": "^2.3.2", "react": ">= 16.13.1 < 19.0.0", "react-dnd": "^11.1.3", diff --git a/packages/shared/package.json b/packages/shared/package.json index 865c7798..a61a90a5 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/shared-components", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of shared, framework agnostic, components.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index fdbaf993..82fb6f4f 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.1-beta.0", - "@performant-software/shared-components": "^2.2.1-beta.0", + "@performant-software/semantic-components": "^2.2.1-beta.1", + "@performant-software/shared-components": "^2.2.1-beta.1", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/visualize/package.json b/packages/visualize/package.json index f5a74b8e..fd9bf40d 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "2.2.1-beta.0", + "version": "2.2.1-beta.1", "description": "A package of components used for data visualization", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/react-components.json b/react-components.json index 0209c959..7a46a87f 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "2.2.1-beta.0" + "version": "2.2.1-beta.1" } From 74bd6bc77b00a261b0af9194f8aa14a0c21f7ea4 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 9 May 2024 14:44:10 -0400 Subject: [PATCH 5/5] CDC #204 - Publishing v2.2.1 --- packages/controlled-vocabulary/package.json | 6 +++--- packages/core-data/package.json | 6 +++--- packages/geospatial/package.json | 2 +- packages/semantic-ui/package.json | 4 ++-- packages/shared/package.json | 2 +- packages/user-defined-fields/package.json | 6 +++--- packages/visualize/package.json | 2 +- react-components.json | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index 89a89137..acdece81 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.1-beta.1", - "@performant-software/shared-components": "^2.2.1-beta.1", + "@performant-software/semantic-components": "^2.2.1", + "@performant-software/shared-components": "^2.2.1", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 160b2f5d..9346d330 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -37,8 +37,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.1-beta.1", - "@performant-software/geospatial": "^2.2.1-beta.1", + "@performant-software/shared-components": "^2.2.1", + "@performant-software/geospatial": "^2.2.1", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index 36679525..c083f3b6 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index 2479daaa..a3bf4794 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -35,7 +35,7 @@ "zotero-translation-client": "^5.0.1" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.1-beta.1", + "@performant-software/shared-components": "^2.2.1", "@samvera/clover-iiif": "^2.3.2", "react": ">= 16.13.1 < 19.0.0", "react-dnd": "^11.1.3", diff --git a/packages/shared/package.json b/packages/shared/package.json index a61a90a5..ecda1756 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/shared-components", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of shared, framework agnostic, components.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index 82fb6f4f..ecd894fe 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.1-beta.1", - "@performant-software/shared-components": "^2.2.1-beta.1", + "@performant-software/semantic-components": "^2.2.1", + "@performant-software/shared-components": "^2.2.1", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/visualize/package.json b/packages/visualize/package.json index fd9bf40d..df84b654 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "2.2.1-beta.1", + "version": "2.2.1", "description": "A package of components used for data visualization", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/react-components.json b/react-components.json index 7a46a87f..8e7d4eca 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "2.2.1-beta.1" + "version": "2.2.1" }