Skip to content

Commit ae7f2db

Browse files
authored
Merge pull request #164 from performant-software/feature/udcsl54_awards
UDCSL #54 - Awards
2 parents 0c1813f + dc6d612 commit ae7f2db

File tree

10 files changed

+78
-8
lines changed

10 files changed

+78
-8
lines changed
File renamed without changes.

packages/semantic-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@performant-software/semantic-components",
3-
"version": "0.5.18",
3+
"version": "0.5.19",
44
"description": "A package of shared components based on the Semantic UI Framework.",
55
"license": "MIT",
66
"main": "./build/index.js",
@@ -12,7 +12,7 @@
1212
"build": "webpack --mode production && flow-copy-source -v src types"
1313
},
1414
"dependencies": {
15-
"@performant-software/shared-components": "^0.5.18",
15+
"@performant-software/shared-components": "^0.5.19",
1616
"@react-google-maps/api": "^2.8.1",
1717
"axios": "^0.26.1",
1818
"i18next": "^19.4.4",

packages/semantic-ui/src/components/AssociatedDropdown.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
}
77

88
.association-dropdown .buttons {
9-
width: 40%;
109
display: flex;
1110
flex-wrap: wrap;
11+
flex-grow: 0.1;
1212
}
1313

1414
.association-dropdown .dropdown-container {
15-
width: 60%;
15+
flex-grow: 1;
1616
}
1717

1818
.association-dropdown .inline-dropdown {
@@ -41,4 +41,4 @@
4141

4242
.ui.dropdown:not(.button) > .default.text {
4343
color: rgba(95, 95, 95, 0.86);
44-
}
44+
}

packages/semantic-ui/src/components/ItemsToggle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type Sort = {
1313
};
1414

1515
type Props = {
16+
defaultView?: number,
1617
onSort?: (sortColumn: string, sortDirection?: ?string) => void,
1718
sort?: Array<Sort>,
1819
sortColumn?: string,
@@ -54,7 +55,7 @@ const useItemsToggle = (WrappedComponent: ComponentType<any>) => (
5455
super(props);
5556

5657
this.state = {
57-
view: Views.list
58+
view: props.defaultView || Views.list
5859
};
5960
}
6061

packages/semantic-ui/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,6 @@ export type { Props as ListProps } from './components/List';
9595
export type { BatchEditProps } from './hooks/BatchEdit';
9696

9797
// Constants
98+
export { Views as ItemViews } from './components/ItemsToggle';
9899
export { SORT_ASCENDING, SORT_DESCENDING } from './components/DataList';
99100
export { FilterTypes } from './components/ListFilters';

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@performant-software/shared-components",
3-
"version": "0.5.18",
3+
"version": "0.5.19",
44
"description": "A package of shared, framework agnostic, components.",
55
"license": "MIT",
66
"main": "./build/index.js",

packages/shared/src/utils/Object.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ const isEqual = (a: any, b: any, userOptions: OptionsProps = {}) => {
7979
}
8080
}
8181

82+
// Test function equality using the toString method
83+
if (_.isFunction(a) && _.isFunction(b) && a.toString() === b.toString()) {
84+
return true;
85+
}
86+
8287
if (a !== null && typeof a === 'object' && b !== null && typeof b === 'object') {
8388
const aKeys = _.keys(a);
8489
const bKeys = _.keys(b);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import ObjectUtils from '../../src/utils/Object';
2+
3+
describe('isEqual', () => {
4+
test('should be equal for two null objects', () => {
5+
expect(ObjectUtils.isEqual(null, null)).toBeTruthy();
6+
});
7+
8+
test('should be equal for two strings of the same value', () => {
9+
expect(ObjectUtils.isEqual('abc', 'abc')).toBeTruthy();
10+
});
11+
12+
test('should be equal for the same object', () => {
13+
const obj1 = {
14+
id: 1,
15+
name: 'Test',
16+
children: [{
17+
id: 1
18+
}, {
19+
id: 2
20+
}]
21+
};
22+
23+
const obj2 = {
24+
id: 1,
25+
name: 'Test',
26+
children: [{
27+
id: 1
28+
}, {
29+
id: 2
30+
}]
31+
};
32+
33+
expect(ObjectUtils.isEqual(obj1, obj2)).toBeTruthy();
34+
});
35+
36+
test('should be equal for the same function', () => {
37+
const func1 = () => 'test';
38+
const func2 = () => 'test';
39+
40+
expect(ObjectUtils.isEqual(func1, func2)).toBeTruthy();
41+
});
42+
});

packages/storybook/src/semantic-ui/ItemList.stories.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import AddModal from '../components/AddModal';
1010
import Api from '../services/Api';
1111
import FilterModal from '../components/FilterModal';
1212
import ItemList from '../../../semantic-ui/src/components/ItemList';
13+
import { Views } from '../../../semantic-ui/src/components/ItemsToggle';
1314
import useDragDrop from '../../../shared/src/utils/DragDrop';
1415

1516
export default {
@@ -776,3 +777,23 @@ export const Selectable = useDragDrop(() => {
776777
/>
777778
);
778779
});
780+
781+
export const DefaultView = useDragDrop(() => (
782+
<ItemList
783+
actions={actions}
784+
collectionName='items'
785+
defaultView={Views.grid}
786+
onCopy={action('copy')}
787+
onLoad={(params) => Api.onLoad(_.extend(params, {
788+
items,
789+
perPage: number('Per page', 20)
790+
}))}
791+
onDelete={action('delete')}
792+
onSave={action('save')}
793+
renderDescription={(item) => item.vin}
794+
renderExtra={(item) => item.address}
795+
renderHeader={(item) => <Header content={item.model} />}
796+
renderMeta={(item) => item.make}
797+
searchable={boolean('Searchable', true)}
798+
/>
799+
));

react-components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages/semantic-ui",
44
"packages/shared"
55
],
6-
"version": "0.5.18"
6+
"version": "0.5.19"
77
}

0 commit comments

Comments
 (0)