UNPKG

@omnia/fx-models

Version:
44 lines (43 loc) 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SharePointTermSetPropertyDefinition = exports.SharePointTermSetPropertyValue = exports.sharePointTermSetPropertyDefinitionId = void 0; const models_1 = require("@omnia/fx-models/internal-do-not-import-from-here/shared/models"); const PropertyDefinition_1 = require("../PropertyDefinition"); const PropertyValue_1 = require("../PropertyValue"); exports.sharePointTermSetPropertyDefinitionId = new models_1.Guid("73b6db0e-27f2-45d6-b57d-1f18db45f182"); class SharePointTermSetPropertyValue extends PropertyValue_1.PropertyValue { constructor(termIds) { super(); this.termIds = termIds; } containValue(other) { if (this?.termIds?.length == 0 && other?.termIds?.length == 0) return true; if (other?.termIds?.length > 0) { return this.termIds.filter(termId => other.termIds.findIndex(id => termId.toString() == id.toString()) > -1).length == this.termIds.length; } return false; } appendValue(other) { const termIds = this?.termIds || []; other?.termIds?.forEach(termId => { const exist = termIds.find(q => q.toString() == termId.toString()); if (!exist) { termIds.push(termId); } }); return new SharePointTermSetPropertyValue(termIds); } isEmpty() { return !this?.termIds || this.termIds.length == 0; } } exports.SharePointTermSetPropertyValue = SharePointTermSetPropertyValue; class SharePointTermSetPropertyDefinition extends PropertyDefinition_1.PropertyDefinition { constructor() { super(...arguments); this.id = exports.sharePointTermSetPropertyDefinitionId; this.typeName = "$Localize:Omnia.Ux.Properties.Definitions.TermSet;"; } } exports.SharePointTermSetPropertyDefinition = SharePointTermSetPropertyDefinition;