diff --git a/package-lock.json b/package-lock.json index ab99a69fb..7063a9c54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@pnp/spfx-controls-react", - "version": "1.14.0", + "version": "1.15.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -6690,8 +6690,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -7106,8 +7105,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7163,7 +7161,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7207,14 +7204,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/src/webparts/controlsTest/components/ControlsTest.tsx b/src/webparts/controlsTest/components/ControlsTest.tsx index f3e9e3759..651a88f58 100644 --- a/src/webparts/controlsTest/components/ControlsTest.tsx +++ b/src/webparts/controlsTest/components/ControlsTest.tsx @@ -34,8 +34,65 @@ import { ListItemAttachments } from '../../../ListItemAttachments'; import { RichText } from '../../../RichText'; import { Link } from 'office-ui-fabric-react/lib/components/Link'; import { Carousel, CarouselButtonsLocation, CarouselButtonsDisplay } from '../../../controls/carousel'; +import { GridLayout } from '../../../GridLayout'; + +import { ISize } from 'office-ui-fabric-react/lib/Utilities'; + +// Used to render document cards +import { + DocumentCard, + DocumentCardActivity, + DocumentCardPreview, + //DocumentCardDetails, + DocumentCardTitle, + IDocumentCardPreviewProps, + DocumentCardLocation, + DocumentCardType +} from 'office-ui-fabric-react/lib/DocumentCard'; +import { ImageFit } from 'office-ui-fabric-react/lib/Image'; import { FilePicker, IFilePickerResult } from '../../../FilePicker'; + +/** + * The sample data below was randomly generated (except for the title). It is used by the grid layout + */ +const sampleGridData: any[] = [{ + thumbnail: "https://pixabay.com/get/57e9dd474952a414f1dc8460825668204022dfe05555754d742e7bd6/hot-air-balloons-1984308_640.jpg", + title: "Adventures in SPFx", + name: "Perry Losselyong", + profileImageSrc: "https://robohash.org/blanditiisadlabore.png?size=50x50&set=set1", + location: "SharePoint", + activity: "3/13/2019" +}, { + thumbnail: "https://pixabay.com/get/55e8d5474a52ad14f1dc8460825668204022dfe05555754d742d79d0/autumn-3804001_640.jpg", + title: "The Wild, Untold Story of SharePoint!", + name: "Ebonee Gallyhaock", + profileImageSrc: "https://robohash.org/delectusetcorporis.bmp?size=50x50&set=set1", + location: "SharePoint", + activity: "6/29/2019" +}, { + thumbnail: "https://pixabay.com/get/57e8dd454c50ac14f1dc8460825668204022dfe05555754d742c72d7/log-cabin-1886620_640.jpg", + title: "Low Code Solutions: PowerApps", + name: "Seward Keith", + profileImageSrc: "https://robohash.org/asperioresautquasi.jpg?size=50x50&set=set1", + location: "PowerApps", + activity: "12/31/2018" +}, { + thumbnail: "https://pixabay.com/get/55e3d445495aa514f1dc8460825668204022dfe05555754d742b7dd5/portrait-3316389_640.jpg", + title: "Not Your Grandpa's SharePoint", + name: "Sharona Selkirk", + profileImageSrc: "https://robohash.org/velnammolestiae.png?size=50x50&set=set1", + location: "SharePoint", + activity: "11/20/2018" +}, { + thumbnail: "https://pixabay.com/get/57e6dd474352ae14f1dc8460825668204022dfe05555754d742a7ed1/faucet-1684902_640.jpg", + title: "Get with the Flow", + name: "Boyce Batstone", + profileImageSrc: "https://robohash.org/nulladistinctiomollitia.jpg?size=50x50&set=set1", + location: "Flow", + activity: "5/26/2019" +}]; + /** * Component that can be used to test out the React controls from this project */ @@ -338,24 +395,489 @@ export default class ControlsTest extends React.Component - { this.setState({filePickerResult }) }} - onChanged={(filePickerResult: IFilePickerResult) => { this.setState({filePickerResult }) }} - webPartContext={this.props.context} + See all + } /> + + console.log("DateTimePicker value:", value)} /> + console.log("DateTimePicker value:", value)} /> + console.log("DateTimePicker value:", value)} /> + console.log("DateTimePicker value:", value)} /> + console.log("DateTimePicker value:", value)} /> + + {/* { this.richTextValue = value; return value; }} /> */} + { this.setState({ richTextValue: value }); return value; }} /> + + {/* */} + + + + + + + + + + + + + + + + + + + + + + - { - this.state.filePickerResult && -
- FileName: {this.state.filePickerResult.fileName} + + + + + + `${d.getFullYear()} - ${d.getMonth() + 1} - ${d.getDate()}`} + dateConvention={DateConvention.DateTime} + timeConvention={TimeConvention.Hours24} + firstDayOfWeek={DayOfWeek.Monday} + value={this.state.dateTimeValue} + onChange={this._onDateTimePickerChange} + isMonthPickerVisible={false} + showMonthPickerAsOverlay={true} + showWeekNumbers={true} + showSeconds={true} + /> + + + + + + + + + + + console.log("Updated location:", coordinates)} + // zoom={15} + //mapType={MapType.cycle} + //width="50" + //height={150} + //loadingMessage="Loading maps" + //errorMessage="Hmmm, we do not have maps for Mars yet. Working on it..." + /> + +
+
+
+ Controls testing + + +

You have permissions to view list items.

+
+ +

+ File type icon control +

+
+ Font icons:  +   +   +   +   +   + +
+
+ Image icons:  +   +   +   +   +   + +
+
Icon size tester: + + + + +
+ +
List picker tester: + +
+ +
Field picker list data tester: + +
+ +
Services tester: + { + // const labels = await taxService.getTermLabels(term.Id); + // if (labels) { + // let termLabel: string = labels.join(" ; "); + // const updateAction = { + // updateActionType: UpdateType.updateTermLabel, + // value: `${termLabel} (updated)` + // }; + // return updateAction; + // } + const updateAction = { + updateActionType: UpdateType.updateTermLabel, + value: `${term.Name} (updated)` + }; + return updateAction; + }, + applyToTerm: (term: ITerm) => (term && term.Name && term.Name.toLowerCase() === "about us") + }, + // new TermLabelAction("Get Labels") + ], + termActionsDisplayMode: TermActionsDisplayMode.buttons, + termActionsDisplayStyle: TermActionsDisplayStyle.textAndIcon + }} + /> + + + + + + { + this.setState({ + initialValues: [{ + key: "ab703558-2546-4b23-b8b8-2bcb2c0086f5", + name: "HR", + path: "HR", + termSet: "b3e9b754-2593-4ae6-abc2-35345402e186" + }] + }); + }} /> +
+
iframe dialog tester: + { this.setState({ iFrameDialogOpened: true }); }} /> + { console.log('iframe loaded'); }} + hidden={!this.state.iFrameDialogOpened} + onDismiss={() => { this.setState({ iFrameDialogOpened: false }); }} + modalProps={{ + isBlocking: true + }} + dialogContentProps={{ + type: DialogType.close, + showCloseButton: true + }} + width={'570px'} + height={'315px'} /> +
+
iframe Panel tester: + { this.setState({ iFramePanelOpened: true }); }} /> + { this.setState({ iFramePanelOpened: false }); }} + iframeOnLoad={(iframe: any) => { console.log('iframe loaded'); }} + /> +
+
- } +
+ +
+

Carousel with fixed elements:

+ { console.log(`Next button clicked: ${index}`); }} + onMovePrevClicked={(index: number) => { console.log(`Prev button clicked: ${index}`); }} + /> +
+ +
+

Carousel with triggerPageElement:

+ +
+ +
+ +
+ +
+ { this.setState({ filePickerResult }); }} + onChanged={(filePickerResult: IFilePickerResult) => { this.setState({ filePickerResult }); }} + webPartContext={this.props.context} + /> + { + this.state.filePickerResult && +
+ FileName: {this.state.filePickerResult.fileName} +
+ } +
+ +

Deletes second item

+
+ + +
+ +
Grid Layout
+ this._onRenderGridItem(item, finalSize, isCompact)} + />
- ); } + private _onRenderGridItem = (item: any, _finalSize: ISize, isCompact: boolean): JSX.Element => { + const previewProps: IDocumentCardPreviewProps = { + previewImages: [ + { + previewImageSrc: item.thumbnail, + imageFit: ImageFit.cover, + height: 130 + } + ] + }; + return
+ ) => alert("You clicked on a grid item")} + + > + + {!isCompact && } +
+ + +
+
+
; + } }