Skip to content

Commit

Permalink
Merge pull request #164 from performant-software/feature/udcsl54_awards
Browse files Browse the repository at this point in the history
UDCSL #54 - Awards
  • Loading branch information
dleadbetter authored Aug 29, 2022
2 parents 0c1813f + dc6d612 commit ae7f2db
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 8 deletions.
File renamed without changes.
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": "0.5.18",
"version": "0.5.19",
"description": "A package of shared components based on the Semantic UI Framework.",
"license": "MIT",
"main": "./build/index.js",
Expand All @@ -12,7 +12,7 @@
"build": "webpack --mode production && flow-copy-source -v src types"
},
"dependencies": {
"@performant-software/shared-components": "^0.5.18",
"@performant-software/shared-components": "^0.5.19",
"@react-google-maps/api": "^2.8.1",
"axios": "^0.26.1",
"i18next": "^19.4.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/semantic-ui/src/components/AssociatedDropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
}

.association-dropdown .buttons {
width: 40%;
display: flex;
flex-wrap: wrap;
flex-grow: 0.1;
}

.association-dropdown .dropdown-container {
width: 60%;
flex-grow: 1;
}

.association-dropdown .inline-dropdown {
Expand Down Expand Up @@ -41,4 +41,4 @@

.ui.dropdown:not(.button) > .default.text {
color: rgba(95, 95, 95, 0.86);
}
}
3 changes: 2 additions & 1 deletion packages/semantic-ui/src/components/ItemsToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Sort = {
};

type Props = {
defaultView?: number,
onSort?: (sortColumn: string, sortDirection?: ?string) => void,
sort?: Array<Sort>,
sortColumn?: string,
Expand Down Expand Up @@ -54,7 +55,7 @@ const useItemsToggle = (WrappedComponent: ComponentType<any>) => (
super(props);

this.state = {
view: Views.list
view: props.defaultView || Views.list
};
}

Expand Down
1 change: 1 addition & 0 deletions packages/semantic-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ export type { Props as ListProps } from './components/List';
export type { BatchEditProps } from './hooks/BatchEdit';

// Constants
export { Views as ItemViews } from './components/ItemsToggle';
export { SORT_ASCENDING, SORT_DESCENDING } from './components/DataList';
export { FilterTypes } from './components/ListFilters';
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": "0.5.18",
"version": "0.5.19",
"description": "A package of shared, framework agnostic, components.",
"license": "MIT",
"main": "./build/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/shared/src/utils/Object.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ const isEqual = (a: any, b: any, userOptions: OptionsProps = {}) => {
}
}

// Test function equality using the toString method
if (_.isFunction(a) && _.isFunction(b) && a.toString() === b.toString()) {
return true;
}

if (a !== null && typeof a === 'object' && b !== null && typeof b === 'object') {
const aKeys = _.keys(a);
const bKeys = _.keys(b);
Expand Down
42 changes: 42 additions & 0 deletions packages/shared/test/utils/Object.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import ObjectUtils from '../../src/utils/Object';

describe('isEqual', () => {
test('should be equal for two null objects', () => {
expect(ObjectUtils.isEqual(null, null)).toBeTruthy();
});

test('should be equal for two strings of the same value', () => {
expect(ObjectUtils.isEqual('abc', 'abc')).toBeTruthy();
});

test('should be equal for the same object', () => {
const obj1 = {
id: 1,
name: 'Test',
children: [{
id: 1
}, {
id: 2
}]
};

const obj2 = {
id: 1,
name: 'Test',
children: [{
id: 1
}, {
id: 2
}]
};

expect(ObjectUtils.isEqual(obj1, obj2)).toBeTruthy();
});

test('should be equal for the same function', () => {
const func1 = () => 'test';
const func2 = () => 'test';

expect(ObjectUtils.isEqual(func1, func2)).toBeTruthy();
});
});
21 changes: 21 additions & 0 deletions packages/storybook/src/semantic-ui/ItemList.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AddModal from '../components/AddModal';
import Api from '../services/Api';
import FilterModal from '../components/FilterModal';
import ItemList from '../../../semantic-ui/src/components/ItemList';
import { Views } from '../../../semantic-ui/src/components/ItemsToggle';
import useDragDrop from '../../../shared/src/utils/DragDrop';

export default {
Expand Down Expand Up @@ -776,3 +777,23 @@ export const Selectable = useDragDrop(() => {
/>
);
});

export const DefaultView = useDragDrop(() => (
<ItemList
actions={actions}
collectionName='items'
defaultView={Views.grid}
onCopy={action('copy')}
onLoad={(params) => Api.onLoad(_.extend(params, {
items,
perPage: number('Per page', 20)
}))}
onDelete={action('delete')}
onSave={action('save')}
renderDescription={(item) => item.vin}
renderExtra={(item) => item.address}
renderHeader={(item) => <Header content={item.model} />}
renderMeta={(item) => item.make}
searchable={boolean('Searchable', true)}
/>
));
2 changes: 1 addition & 1 deletion react-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages/semantic-ui",
"packages/shared"
],
"version": "0.5.18"
"version": "0.5.19"
}

0 comments on commit ae7f2db

Please sign in to comment.