How to use the @microsoft/sp-lodash-subset.isEmpty 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-content-query-webpart / src / controls / PropertyPaneQueryFilterPanel / components / QueryFilter / QueryFilter.tsx View on Github external
private onDateExpressionChange(newValue: string): string {

        // Validates the picker
        let regex = new RegExp(/^\[Today\](\s{0,}[\+-]\s{0,}\[{0,1}\d{1,4}\]{0,1}){0,1}$/);
        let isValid = regex.test(newValue) || isEmpty(newValue);
        let errorMsg = isValid ? '' : this.props.strings.datePickerExpressionError;
        
        if(isValid) {
            // If the change is NOT triggered by the date picker change
            if(!(isEmpty(newValue) && this.state.filter.value != null)) {
                this.state.filter.value = null;
                this.state.filter.expression = newValue;
                this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
                this.onAnyChange();
            }
        }

        return errorMsg;
    }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / components / ContentQuery.tsx View on Github external
return (
      <div>

        {loading}

        {error}

        {/* Shows the validation checklist if mandatory properties aren't all configured */}
        { !mandatoryFieldsConfigured &amp;&amp; !this.state.loading &amp;&amp; !this.state.error &amp;&amp;
          <div>
              { this.props.strings.mandatoryProperties }
              
              
              
              
              
              
          </div>
        }

        {/* Shows the query results once loaded */}
        { mandatoryFieldsConfigured &amp;&amp; !this.state.loading &amp;&amp; !this.state.error &amp;&amp;
          <div></div>
        }

      </div>
    );
  }
}
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / controls / PropertyPaneQueryFilterPanel / components / QueryFilterPanel / QueryFilterPanel.tsx View on Github external
private isFilterEmpty(filter:IQueryFilter) {
        let isFilterEmpty = false;

        // If the filter has no field
        if(filter.field == null) {
            isFilterEmpty = true;
        }

        // If the filter has a null or empty value
        if(filter.value == null || isEmpty(filter.value.toString())) {
            
            // And has no date time expression
            if(isEmpty(filter.expression)) {

                // And isn't a [Me] switch
                if(!filter.me) {

                    // And isn't a  or  operator
                    if(filter.operator != QueryFilterOperator.IsNull &amp;&amp; filter.operator != QueryFilterOperator.IsNotNull) {
                        isFilterEmpty = true;
                    }
                }
            }
        }
        return isFilterEmpty;
    }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / components / ContentQuery.tsx View on Github external
const mandatoryFieldsConfigured = this.areMandatoryFieldsConfigured();

    return (
      <div>

        {loading}

        {error}

        {/* Shows the validation checklist if mandatory properties aren't all configured */}
        { !mandatoryFieldsConfigured &amp;&amp; !this.state.loading &amp;&amp; !this.state.error &amp;&amp;
          <div>
              { this.props.strings.mandatoryProperties }
              
              
              
              
              
              
          </div>
        }

        {/* Shows the query results once loaded */}
        { mandatoryFieldsConfigured &amp;&amp; !this.state.loading &amp;&amp; !this.state.error &amp;&amp;
          <div></div>
        }

      </div>
    );
  }
}
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / common / services / ContentQueryService.ts View on Github external
public getFilterFields(webUrl: string, listId: string):Promise {
        Log.verbose(this.logSource, "Loading dropdown options for toolpart property 'Filters'...", this.context.serviceScope);

        // Resolves an empty array if no web or no list has been selected
        if (isEmpty(webUrl) || isEmpty(listId)) {
            return Promise.resolve(new Array());
        }

        // Resolves the already loaded data if available
        if(this.filterFields) {
            return Promise.resolve(this.filterFields);
        }

        // Otherwise gets the options asynchronously
        return new Promise((resolve, reject) =&gt; {
            this.listService.getListFields(webUrl, listId, ['InternalName', 'Title', 'TypeAsString'], 'Title').then((data:any) =&gt; {
                let fields:any[] = data.value;
                let options:IQueryFilterField[] = fields.map((field) =&gt; { return { 
                    internalName: field.InternalName, 
                    displayName: field.Title,
                    type: this.getFieldTypeFromString(field.TypeAsString)
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / ContentQueryWebPart.ts View on Github external
private resetWebUrlPropertyPane() {
    Log.verbose(this.logSource, "Resetting 'webUrl' property...", this.context.serviceScope);

    this.properties.webUrl = "";
    this.ContentQueryService.clearCachedWebUrlOptions();
    update(this.properties, ContentQueryConstants.propertyWebUrl, (): any => { return this.properties.webUrl; });
    this.webUrlDropdown.properties.selectedKey = "";
    this.webUrlDropdown.properties.disabled = isEmpty(this.properties.siteUrl);
    this.webUrlDropdown.render();
  }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / common / helpers / CamlQueryHelper.ts View on Github external
private static formatFilterValue(filter:IQueryFilter): string
    {
        let filterValue = "";

        if(filter.field.type == QueryFilterFieldType.Datetime) {
            if(filter.expression != null && !isEmpty(filter.expression)) {
                filterValue = this.formatDateExpressionFilterValue(filter.expression);
            }
            else {
                filterValue = this.formatDateFilterValue(filter.value as string);
            }
        }
        else {
            filterValue = this.formatTextFilterValue(filter.value as string);
        }

        return filterValue;
    }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / ContentQueryWebPart.ts View on Github external
private resetListTitlePropertyPane() {
    Log.verbose(this.logSource, "Resetting 'listTitle' property...", this.context.serviceScope);

    this.properties.listId = null;
    this.ContentQueryService.clearCachedListTitleOptions();
    update(this.properties, ContentQueryConstants.propertyListId, (): any => { return this.properties.listId; });
    this.listTitleDropdown.properties.selectedKey = "";
    this.listTitleDropdown.properties.disabled = isEmpty(this.properties.webUrl);
    this.listTitleDropdown.render();
  }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / components / ContentQuery.tsx View on Github external
private areMandatoryFieldsConfigured(): boolean {
    return !isEmpty(this.props.siteUrl) && 
           !isEmpty(this.props.querySettings.webUrl) && 
           !isEmpty(this.props.querySettings.listId) && 
           !isEmpty(this.props.querySettings.viewFields) && 
           (!isEmpty(this.props.templateUrl) || !isEmpty(this.props.templateText));
  }
github SharePoint / sp-dev-fx-webparts / samples / react-content-query-webpart / src / webparts / contentQuery / ContentQueryWebPart.ts View on Github external
private resetFiltersPropertyPane() {
    Log.verbose(this.logSource, "Resetting 'filters' property...", this.context.serviceScope);

    this.properties.filters = null;
    this.ContentQueryService.clearCachedFilterFields();
    update(this.properties, ContentQueryConstants.propertyFilters, (): any => { return this.properties.filters; });
    this.filtersPanel.properties.filters = null;
    this.filtersPanel.properties.disabled = isEmpty(this.properties.webUrl) || isEmpty(this.properties.listId);
    this.filtersPanel.render();
  }