Skip to content

Commit

Permalink
Merge pull request #287 from performant-software/feature/cdc205_merge…
Browse files Browse the repository at this point in the history
…_records

CDC #205 - Merge Records
  • Loading branch information
dleadbetter authored May 30, 2024
2 parents f959d2c + cb26a2e commit a2e965f
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 26 deletions.
6 changes: 3 additions & 3 deletions packages/controlled-vocabulary/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/controlled-vocabulary",
"version": "2.2.3",
"version": "2.2.4",
"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",
Expand All @@ -23,8 +23,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/semantic-components": "^2.2.3",
"@performant-software/shared-components": "^2.2.3",
"@performant-software/semantic-components": "^2.2.4",
"@performant-software/shared-components": "^2.2.4",
"react": ">= 16.13.1 < 19.0.0",
"react-dom": ">= 16.13.1 < 19.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/core-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/core-data",
"version": "2.2.3",
"version": "2.2.4",
"description": "A package of components used with the Core Data platform.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down Expand Up @@ -37,8 +37,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/shared-components": "^2.2.3",
"@performant-software/geospatial": "^2.2.3",
"@performant-software/shared-components": "^2.2.4",
"@performant-software/geospatial": "^2.2.4",
"@peripleo/maplibre": "^0.5.2",
"@peripleo/peripleo": "^0.5.2",
"react": ">= 16.13.1 < 19.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/geospatial/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/geospatial",
"version": "2.2.3",
"version": "2.2.4",
"description": "A package of components for all things map-related.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/semantic-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/semantic-components",
"version": "2.2.3",
"version": "2.2.4",
"description": "A package of shared components based on the Semantic UI Framework.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"zotero-translation-client": "^5.0.1"
},
"peerDependencies": {
"@performant-software/shared-components": "^2.2.3",
"@performant-software/shared-components": "^2.2.4",
"@samvera/clover-iiif": "^2.3.2",
"react": ">= 16.13.1 < 19.0.0",
"react-dnd": "^11.1.3",
Expand Down
9 changes: 4 additions & 5 deletions packages/semantic-ui/src/components/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,26 +288,25 @@ const useList = (WrappedComponent: ComponentType<any>) => (
addButton = {},
csvExportButton = {},
deleteButton = {},
modal,
selectable
modal
} = this.props;

// Add the add button to the list if the location specified is the passed location.
if (addButton.location === location && (addButton.onClick || modal) && !selectable) {
if (addButton.location === location && (addButton.onClick || modal)) {
buttons.push({
render: this.renderAddButton.bind(this)
});
}

// Add the delete all button to the list if the location specified is the passed location.
if (deleteButton.location === location && this.props.onDeleteAll && !selectable) {
if (deleteButton.location === location && this.props.onDeleteAll) {
buttons.push({
render: this.renderDeleteAllButton.bind(this)
});
}

// Add the CSV export button to the list if the csvExport prop is passed
if (csvExportButton.location === location && !selectable) {
if (csvExportButton.location === location) {
buttons.push({
render: this.renderCsvExportButton.bind(this)
});
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/shared-components",
"version": "2.2.3",
"version": "2.2.4",
"description": "A package of shared, framework agnostic, components.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
24 changes: 23 additions & 1 deletion packages/shared/src/utils/Object.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,30 @@ const isEqual = (a: any, b: any, userOptions: OptionsProps = {}) => {

const isPromise = (value: any) => !!value && typeof value === 'object' && typeof value.then === 'function';

/**
* Returns a copy of the passed value (presumably an object) without the passed attribute included. This
* function is recursive and will remove the attribute from nested objects and arrays.
*
* @param value
* @param attribute
*
* @returns {*}
*/
const without = (value: any, attribute: string) => {
if (_.isArray(value)) {
return _.map(value, (entry) => without(entry, attribute));
}

if (_.isObject(value)) {
return _.mapObject(_.omit(value, attribute), (v) => without(v, attribute));
}

return value;
};

export default {
isEmpty,
isEqual,
isPromise
isPromise,
without
};
6 changes: 3 additions & 3 deletions packages/user-defined-fields/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/user-defined-fields",
"version": "2.2.3",
"version": "2.2.4",
"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",
Expand All @@ -23,8 +23,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/semantic-components": "^2.2.3",
"@performant-software/shared-components": "^2.2.3",
"@performant-software/semantic-components": "^2.2.4",
"@performant-software/shared-components": "^2.2.4",
"react": ">= 16.13.1 < 19.0.0",
"react-dom": ">= 16.13.1 < 19.0.0"
},
Expand Down
11 changes: 6 additions & 5 deletions packages/user-defined-fields/src/hooks/UserDefinedFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserDefinedFieldsService from '../services/UserDefinedFields';
* @returns {{userDefinedColumns: [], loading: boolean}}
*/
const useUserDefinedColumns = (defineableId, defineableType, options = {}) => {
const [fields, setFields] = useState([]);
const [userDefinedFields, setUserDefinedFields] = useState([]);
const [loading, setLoading] = useState(false);

const { sortable = true } = options;
Expand Down Expand Up @@ -54,7 +54,7 @@ const useUserDefinedColumns = (defineableId, defineableType, options = {}) => {
const userDefinedColumns = useMemo(() => {
const columns = [];

_.each(fields, (field) => {
_.each(userDefinedFields, (field) => {
const column = {
name: field.uuid,
label: field.column_name,
Expand Down Expand Up @@ -89,7 +89,7 @@ const useUserDefinedColumns = (defineableId, defineableType, options = {}) => {
});

return columns;
}, [fields, resolveValue]);
}, [resolveValue, userDefinedFields]);

/**
* Fetches the user defined fields for the passed defineable ID and defineable type.
Expand All @@ -99,13 +99,14 @@ const useUserDefinedColumns = (defineableId, defineableType, options = {}) => {

UserDefinedFieldsService
.fetchAll({ defineable_id: defineableId, defineable_type: defineableType })
.then(({ data }) => setFields(data.user_defined_fields))
.then(({ data }) => setUserDefinedFields(data.user_defined_fields))
.finally(() => setLoading(false));
}, [defineableId, defineableId]);

return {
loading,
userDefinedColumns
userDefinedColumns,
userDefinedFields
};
};

Expand Down
3 changes: 3 additions & 0 deletions packages/user-defined-fields/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export { default as UserDefinedFieldsEmbeddedList } from './components/UserDefin
export { default as UserDefinedFieldsForm } from './components/UserDefinedFieldsForm';
export { default as UserDefinedFieldsList } from './components/UserDefinedFieldsList';

// Constants
export { DataTypes } from './constants/DataTypes';

// Hooks
export { default as useUserDefinedColumns } from './hooks/UserDefinedFields';

Expand Down
2 changes: 1 addition & 1 deletion packages/visualize/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/visualize",
"version": "2.2.3",
"version": "2.2.4",
"description": "A package of components used for data visualization",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
2 changes: 1 addition & 1 deletion react-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"packages/user-defined-fields",
"packages/visualize"
],
"version": "2.2.3"
"version": "2.2.4"
}

0 comments on commit a2e965f

Please sign in to comment.