How to use the @microsoft/sp-lodash-subset.find function in @microsoft/sp-lodash-subset

To help you get started, we’ve selected a few @microsoft/sp-lodash-subset examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-fx-webparts / samples / react-search-refiners / spfx / src / webparts / searchResults / SearchResultsWebPart.ts View on Github external
},
                    ]
                })
            );
        }
        // Only show the template external URL for 'Custom' option
        if (this.properties.selectedLayout === ResultsLayoutOption.Custom) {
            stylingFields.splice(6, 0, PropertyPaneTextField('externalTemplateUrl', {
                label: strings.TemplateUrlFieldLabel,
                placeholder: strings.TemplateUrlPlaceholder,
                deferredValidationTime: 500,
                onGetErrorMessage: this._onTemplateUrlChange.bind(this)
            }));
        }
        if (this.codeRendererIsSelected()) {
            const currentCodeRenderer = find(this._codeRenderers, (renderer) => renderer.id === (this.properties.selectedLayout as any));
            if (!this.properties.customTemplateFieldValues) {
                this.properties.customTemplateFieldValues = currentCodeRenderer.customFields.map(field => {
                    return {
                        fieldName: field,
                        searchProperty: ''
                    };
                });
            }
            if (currentCodeRenderer.customFields && currentCodeRenderer.customFields.length > 0) {
                const searchPropertyOptions = this.properties.selectedProperties.split(',').map(prop => {
                    return ({
                        key: prop,
                        text: prop
                    });
                });
                stylingFields.push(PropertyFieldCollectionData('customTemplateFieldValues', {
github SharePoint / sp-dev-fx-webparts / samples / react-visio / src / shared / services / VisioService.ts View on Github external
private _onSelectionChanged = async (args: Visio.SelectionChangedEventArgs): Promise => {

    try {
      console.log("Selection Changed Event " + JSON.stringify(args));

      if (args.shapeNames.length > 0 && this._shapes && this._shapes.length > 0) {

        // get name of selected item
        const selectedShapeText: string = args.shapeNames[0];

        // find selected shape on the list of pre-loaded shapes
        this._selectedShape = find(this._shapes,
          s => s.name === selectedShapeText
        );

        // call delegate function from the react component
        this.onSelectionChanged(this._selectedShape);

      } else {
        // shape was deselected
        this._selectedShape = null;
      }
    } catch (error) {
      this.logError(error);
    }
  }
github SharePoint / sp-dev-fx-webparts / samples / react-visio / src / shared / services / VisioService.ts View on Github external
public selectShape = async (name: string): Promise => {

    try {

      // find the correct shape from the pre-loaded list of shapes
      // check the ShapeData item with the 'Name' key
      const shape: Visio.Shape = find(this._shapes,
        s => (find(s.shapeDataItems.items, i => i.label === "Name").value === name)
      );

      // only select shape if not the currently selected one
      if (this._selectedShape === null
        || this._selectedShape === undefined
        || (this._selectedShape && this._selectedShape.name !== shape.name)) {

        await Visio.run(this._session, async (context: Visio.RequestContext) => {
          const page: Visio.Page = context.document.getActivePage();
          const shapesCollection: Visio.ShapeCollection = page.shapes;
          shapesCollection.load();
          await context.sync();

          const diagramShape: Visio.Shape = shapesCollection.getItem(shape.name);
          // select shape on diagram
github SharePoint / sp-dev-fx-webparts / samples / react-visio / src / shared / services / VisioService.ts View on Github external
        s => (find(s.shapeDataItems.items, i => i.label === "Name").value === name)
      );
github Puzzlepart / spfx-solutions / Pzl.Part.QuickLinks / src / webparts / quickLinks / components / QuickLinks.tsx View on Github external
userFavoriteLinks.forEach(userLink => {
            let linkMatch = find(allFavoriteLinks, (favoriteLink => favoriteLink.id === userLink.id));
            if (linkMatch && (!isEqual(linkMatch.url, userLink.url) || !isEqual(linkMatch.displayText, userLink.displayText) || !isEqual(linkMatch.icon, userLink.icon))) {
                shouldUpdate = true;
                personalLinks.push(linkMatch);
            } else {
                personalLinks.push(userLink);
            }
        });
        if (shouldUpdate) {
github Puzzlepart / spfx-solutions / Pzl.Part.QuickLinks / src / webparts / allLinks / components / AllLinks.tsx View on Github external
userFavoriteLinks.forEach(userLink => {
      let linkMatch = find(allFavoriteLinks, (favoriteLink => favoriteLink.id === userLink.id));
      if (linkMatch && (!isEqual(linkMatch.url, userLink.url) || !isEqual(linkMatch.displayText, userLink.displayText) || !isEqual(linkMatch.icon, userLink.icon))) {
        shouldUpdate = true;
        personalLinks.push(linkMatch);
      } else {
        personalLinks.push(userLink);
      }
    });