Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#292 added ComboBoxListItemPicker SecurityTrimmedControl - No permissions template #307 #474

Merged
merged 6 commits into from
Mar 23, 2020
Merged

Conversation

mgwojciech
Copy link

Q A
Bug fix? [ ]
New feature? [*]
New sample? [ ]
Related issues? fixes #292

What's in this Pull Request

Added ComboBoxListItemPicker - list item picker based on Fabric UI Combo Box component.
To improve testability this PR also included mock for RequestClient (from pnpjs).
This means that the SPHttpClient used in Props is also the one from pnpjs (not from spfx)

Example usage:
const element: React.ReactElement = React.createElement(
ComboBoxListItemPicker,
{
webUrl: this.context.pageContext.web.absoluteUrl,
spHttpClient: new SPHttpClient(),
columnInternalName: "Title",
listId: "490fae3c-f8cb-4b50-9737-f2c94f6b6727",
filter: "Id gt 0",
itemLimit: 50,
defaultSelectedItems: [{Id:2, Title: "Test 2"}],
//
onSelectedItem:(selected)=>{
console.log(selected);
}
}
);

ReactDom.render(element, this.domElement);

Or provide defaultSelectedItems with Id only:
const element: React.ReactElement = React.createElement(
ComboBoxListItemPicker,
{
webUrl: this.context.pageContext.web.absoluteUrl,
spHttpClient: new SPHttpClient(),
columnInternalName: "Title",
listId: "490fae3c-f8cb-4b50-9737-f2c94f6b6727",
filter: "Id gt 0",
itemLimit: 50,
defaultSelectedItems: [2],
//
onSelectedItem:(selected)=>{
console.log(selected);
}
}
);

ReactDom.render(element, this.domElement);

@msftclas
Copy link

msftclas commented Jan 29, 2020

CLA assistant check
All CLA requirements met.

@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #474 into dev will increase coverage by 0.07%.
The diff coverage is 74.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #474      +/-   ##
==========================================
+ Coverage   73.31%   73.39%   +0.07%     
==========================================
  Files          18       21       +3     
  Lines         802      887      +85     
  Branches      154      175      +21     
==========================================
+ Hits          588      651      +63     
- Misses        164      176      +12     
- Partials       50       60      +10
Impacted Files Coverage Δ
src/common/dal/ListItemRepository.ts 61.53% <61.53%> (ø)
src/common/mocks/RequestClientMock.ts 67.85% <67.85%> (ø)
...controls/listItemPicker/ComboBoxListItemPicker.tsx 81.81% <81.81%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3540d1...85a37af. Read the comment docs.

@mgwojciech mgwojciech changed the title #292 added ComboBoxListItemPicker #292 added ComboBoxListItemPicker SecurityTrimmedControl - No permissions template #307 Feb 27, 2020
@estruyf estruyf merged commit e6ebb17 into pnp:dev Mar 23, 2020
@estruyf
Copy link
Member

estruyf commented Mar 23, 2020

@mgwojciech thanks for the control + enhancement.

In the future, please do a PR per control change. There were some issues in the ComboBoxListItemPicker which are now solved. I had to do updates to it first in order to get the SecurityTrimmedControl merged.

@mgwojciech
Copy link
Author

Sure, I will.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SecurityTrimmedControl - No permissions template ListItemPicker could be a combo box
4 participants