• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript sp-lodash-subset.isEmpty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@microsoft/sp-lodash-subset.isEmpty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isEmpty函数的具体用法?TypeScript isEmpty怎么用?TypeScript isEmpty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isEmpty函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: generateTaxonomyFilter

    /*************************************************************************************************
	 * Generates a valid CAML filter string based on the specified taxonomy filter
	 * @param filter : The taxonomy filter that needs to be formatted into a CAML filter string
	 *************************************************************************************************/
    private static generateTaxonomyFilter(filter:IQueryFilter): string
    {
        let filterOutput = '';
        let filterTerms = filter.value as ITag[];

        if(isEmpty(filter.value)) {
            return '';
        }
        else if (filter.operator == QueryFilterOperator.ContainsAny || filterTerms == null) {
            let values = filterTerms != null ? filterTerms.map(x => Text.format("<Value Type='Integer'>{0}</Value>", x.key)).join('') : '';
            filterOutput = Text.format("<In><FieldRef Name='{0}' LookupId='TRUE' /><Values>{1}</Values></In>", filter.field.internalName, values);
        }
        else if (filter.operator == QueryFilterOperator.ContainsAll) {
            let taxFilters: IQueryFilter[] = [];

            for(let term of filterTerms) {
                let termValue:ITag[] = [ term ];

                let taxFilter:IQueryFilter = {
                    index: null,
                    field: filter.field,
                    value: termValue,
                    join: QueryFilterJoin.And,
                    operator: QueryFilterOperator.ContainsAny
                };
                taxFilters.push(taxFilter);
            }

            filterOutput = this.generateFilters(taxFilters);
        }

        return filterOutput;
    }
开发者ID:,项目名称:,代码行数:37,代码来源:


示例2:

					response.json().then((data:any) => {
						let fields:any[] = data.value;
						let fieldTermSetId = null;

						if(fields.length > 0) {
							let field = fields[0];

							if(field.IsTermSetValid && !isEmpty(field.TermSetId)) {
								fieldTermSetId = field.TermSetId;
							}
						}
						resolve(fieldTermSetId);
					})
开发者ID:,项目名称:,代码行数:13,代码来源:


示例3: generateCamlQuery

    /*************************************************************************************************
     * Generates a full CAML query based on the provided IQuerySettings
     * @param querySettings : A IQuerySettings object required for generating the CAML query
     *************************************************************************************************/
    public static generateCamlQuery(querySettings:IQuerySettings): string {
        let query = '';

        // Generates the <Where /> part
        if(querySettings.filters && !isEmpty(querySettings.filters)) {
            let sortedFilters = querySettings.filters.sort((a, b) => { return a.index - b.index; });
            query += Text.format('<Where>{0}</Where>', this.generateFilters(sortedFilters));
        }

        // Generates the <OrderBy /> part
        if(querySettings.orderBy && !isEmpty(querySettings.orderBy)) {
            let isAscending = querySettings.orderByDirection == 'desc' ? 'FALSE' : 'TRUE';
            query += Text.format("<OrderBy><FieldRef Name='{0}' Ascending='{1}' /></OrderBy>", querySettings.orderBy, isAscending);
        }

        // Wraps the <Where /> and <OrderBy /> into a <Query /> tag
        query = Text.format('<Query>{0}</Query>', query);

        // Generates the <RowLimit /> part
        if(querySettings.limitEnabled) {
            query += Text.format('<RowLimit>{0}</RowLimit>', querySettings.itemLimit);
        }

        // Generates the <ViewFields /> part
        if(querySettings.viewFields && !isEmpty(querySettings.viewFields)) {
            query += Text.format('<ViewFields>{0}</ViewFields>', querySettings.viewFields.map(field => Text.format("<FieldRef Name='{0}' />", field)).join(''));
        }

        // Wraps the everything into a final <View /> tag
        if(querySettings.recursiveEnabled) {
            query = Text.format('<View Scope="RecursiveAll">{0}</View>', query);
        }
        else {
            query = Text.format('<View>{0}</View>', query);
        }

        return query;
    }
开发者ID:,项目名称:,代码行数:42,代码来源:


示例4: formatFilterValue

	/*************************************************************************************************
	 * Returns the value of the specified filter correctly formatted based on its type of value
	 * @param filter : The filter that needs its value to be formatted
	 *************************************************************************************************/
    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;
    }
开发者ID:,项目名称:,代码行数:22,代码来源:


示例5: generateUserFilter

    /*************************************************************************************************
	 * Generates a valid CAML filter string based on the specified user filter
	 * @param filter : The user filter that needs to be formatted into a CAML filter string
	 *************************************************************************************************/
    private static generateUserFilter(filter:IQueryFilter): string
    {
        let filterOutput = '';
        let filterUsers = filter.value as IPersonaProps[];

        if(filter.me) {
            filterOutput = Text.format("<Eq><FieldRef Name='{0}' /><Value Type='Integer'><UserID /></Value></Eq>", filter.field.internalName);
        }
        else if(isEmpty(filter.value)) {
            return '';
        }
        else if (filter.operator == QueryFilterOperator.ContainsAny || filterUsers == null)
        {
            let values = filterUsers != null ? filterUsers.map(x => Text.format("<Value Type='Integer'>{0}</Value>", x.optionalText)).join('') : '';
            filterOutput = Text.format("<In><FieldRef Name='{0}' LookupId='TRUE' /><Values>{1}</Values></In>", filter.field.internalName, values);
        }
        else if (filter.operator == QueryFilterOperator.ContainsAll)
        {
            let userFilters: IQueryFilter[] = [];

            for(let user of filterUsers) {
                let userValue:IPersonaProps[] = [ user ];

                let userFilter:IQueryFilter = {
                    index: null,
                    field: filter.field,
                    value: userValue,
                    join: QueryFilterJoin.And,
                    operator: QueryFilterOperator.ContainsAny
                };
                userFilters.push(userFilter);
            }

            filterOutput = this.generateFilters(userFilters);
        }

        return filterOutput;
    }
开发者ID:,项目名称:,代码行数:42,代码来源:



注:本文中的@microsoft/sp-lodash-subset.isEmpty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript sp-webpart-base.PropertyPaneDropdown函数代码示例发布时间:2022-05-28
下一篇:
TypeScript sp-lodash-subset.escape函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap