@talxis/base-controls 1.2406.7 → 1.2406.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e,Fragment as i}from"react/jsx-runtime";import{useRef as r,useState as s,useEffect as n}from"react";import{useComponent as a}from"./hooks/useComponent.js";import{mergeStyleSets as l,useTheme as o,Link as u,ContextualMenuItemType as h}from"@fluentui/react";import{TagPicker as c}from"@talxis/react-components/dist/components/TagPicker";import{Text as d}from"@fluentui/react/lib/Text";import{useMouseOver as m}from"./hooks/useMouseOver.js";import{CommandBarButton as f}from"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";import{useFocusIn as g}from"./hooks/useFocusIn.js";function y(t,e,i,r){var s,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(n<3?s(a):n>3?s(e,i,a):s(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function p(t,e,i,r){return new(i||(i=Promise))((function(s,n){function a(t){try{o(r.next(t))}catch(t){n(t)}}function l(t){try{o(r.throw(t))}catch(t){n(t)}}function o(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,l)}o((r=r.apply(t,e||[])).next())}))}const b={search:{1033:"Search",1029:"Vyhledejte"},newRecord:{1033:"New record",1029:"Nový záznam"},searching:{1033:"Searching...",1029:"Hledám..."},noRecordsFound:{1033:"No records found",1029:"Nebyly nalezeny žádné záznamy"},resultsFrom:{1033:"Results from:",1029:"Výsledky z:"},noName:{1033:"(No Name)",1029:"(Bez názvu)"}};var v;function k(t){Object.seal(t),Object.seal(t.prototype)}function F(t){Object.freeze(t),Object.freeze(t.prototype)}!function(t){!function(e){var i,r,s,n,a;let l=i=class{constructor(t){if(this._build=null,this._addedBy=null,this._alias=null,this._aggregate=null,this._groupBy=null,this._dateGrouping=null,this._userTimeZone=null,!(this instanceof i))return new i(t);this.name=t}get name(){return this._name}set name(t){if(!g.isString(t))throw new Error("Sdk.FetchXml.attribute name property must be an string.");this._name=t}get build(){return this._build}set build(t){if(!g.isEnumMemberOrNull(v,t))throw new Error("Sdk.FetchXml.attribute build property must be an Sdk.FetchXml.Build value or null.");this._build=t}get addedBy(){return this._addedBy}set addedBy(t){if(!g.isStringOrNull(t))throw new Error("Sdk.FetchXml.attribute addedBy property must be an string value or null.");this._addedBy=t}get alias(){return this._alias}set alias(t){if(!g.isStringOrNull(t))throw new Error("Sdk.FetchXml.attribute alias property must be an string value or null.");this._alias=t}get aggregate(){return this._aggregate}set aggregate(t){if(!g.isEnumMemberOrNull(X,t))throw new Error("Sdk.FetchXml.attribute aggregate property must be an Sdk.FetchXml.Aggregate value or null.");this._aggregate=t}get groupBy(){return this._groupBy}set groupBy(t){if(!g.isBooleanOrNull(t))throw new Error("Sdk.FetchXml.attribute groupBy property must be an boolean value or null.");this._groupBy=t}get dateGrouping(){return this._dateGrouping}set dateGrouping(t){if(!g.isEnumMemberOrNull(E,t))throw new Error("Sdk.FetchXml.attribute dateGrouping property must be an Sdk.FetchXml.DateGrouping value or null.");this._dateGrouping=t}get userTimeZone(){return this._userTimeZone}set userTimeZone(t){if(!g.isBooleanOrNull(t))throw new Error("Sdk.FetchXml.attribute userTimeZone property must be an boolean value or null.");this._userTimeZone=t}setName(t){return this.name=t,this}setBuild(t){return this.build=t||null,this}setAddedBy(t){return this.addedBy=t||null,this}setAlias(t){return this.alias=t||null,this}setAggregate(t){return this.aggregate=t||null,this}setGroupBy(t){return t?this.groupBy=t:t=null,this}setDateGrouping(t){return this.dateGrouping=t||null,this}setUserTimeZone(t){return this.userTimeZone=t||null,this}toXml(t){var e=t.createElement("attribute");return e.setAttribute("name",this.name),this.build&&e.setAttribute("build",this.build),this.addedBy&&e.setAttribute("addedby",this.addedBy),this.alias&&e.setAttribute("alias",this.alias),this.aggregate&&e.setAttribute("aggregate",this.aggregate),g.isBoolean(this.groupBy)&&e.setAttribute("groupby",this.groupBy?"true":"false"),this.dateGrouping&&e.setAttribute("dategrouping",this.dateGrouping),g.isBoolean(this.userTimeZone)&&e.setAttribute("usertimezone",this.userTimeZone?"true":"false"),e}static attributeFromXml(t){var e=new i(t.attributes.getNamedItem("name").nodeValue);return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"build":case"alias":case"aggregate":t[e]=i;break;case"addedby":t.addedBy=i;break;case"dategrouping":t.dateGrouping=i;break;case"groupby":t.groupBy=g.convertFetchBoolType(i);case"usertimezone":t.userTimeZone=g.convertFetchBoolType(i)}})),e}};l=i=y([k],l),e.attribute=l;let o=class{constructor(e,i,r){if(this._aggregate=null,this._alias=null,this._attribute=null,this._column=null,this._entityname=null,this._operator=null,this._rowAggregate=null,this._uihidden=null,this._uiname=null,this._uitype=null,this._values=[],!(this instanceof t.FetchXml.condition))return new t.FetchXml.condition(e,i,r);if(!e||!i)throw new Error("Sdk.FetchXml.condition constructor parameters attribute and operator are required.");this.attribute=e,this.operator=i,r&&(this.values=r)}get aggregate(){return this._aggregate}set aggregate(t){this._aggregate=t}get alias(){return this._alias}set alias(t){this._alias=t}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get column(){return this._column}set column(t){this._column=t}get entityname(){return this._entityname}set entityname(t){this._entityname=t}get operator(){return this._operator}set operator(t){this._operator=t}get rowAggregate(){return this._rowAggregate}set rowAggregate(t){this._rowAggregate=t}get uihidden(){return this._uihidden}set uihidden(t){this._uihidden=t}get uiname(){return this._uiname}set uiname(t){this._uiname=t}get uitype(){return this._uitype}set uitype(t){this._uitype=t}get values(){return this._values}set values(e){if(!t.FetchXml.Util.isValueArrayOrNull(e))throw new Error("Sdk.FetchXml.condition.values must be an array of Sdk.FetchXml.value or null.");this._values=null==e?[]:e}get hash(){return this._attribute.concat(this._operator,this._aggregate?this._aggregate:"",this._alias?this._alias:"",this._column?this._column:"",this._entityname?this._entityname:"",this._rowAggregate?this._rowAggregate:"",t.FetchXml.Util.isNullOrUndefined(this._uihidden)?"":this._uihidden.toString(),this._uiname?this._uiname:"",this._uitype?this._uitype:"",t.FetchXml.Util.getCollectionHash(this._values)).hashCode()}setAttribute(t){return this.attribute=t,this}setOperator(t){return this.operator=t,this}setValues(t){return this.values=t,this}addValue(e){return t.FetchXml.Util.isValue(e)?this.values.push(e):this.values.push(new t.FetchXml.value(e)),this}removeValueByRef(e){if(!t.FetchXml.Util.isValue(e))throw new Error("Sdk.FetchXml.condition removeValueByRef method value parameter must be an Sdk.FetchXml.value.");return t.FetchXml.Util.removeCollectionValueByRef(this.values,e),this}removeValue(e){if(!t.FetchXml.Util.isValue(e))throw new Error("Sdk.FetchXml.condition removeValue method value parameter must be an Sdk.FetchXml.value.");return t.FetchXml.Util.removeCollectionValue(this.values,e),this}removeValueByValue(e){return t.FetchXml.Util.removeCollectionValueByProperty(this.values,"value",e),this}setAggregate(t){return this.aggregate=t,this}setAlias(t){return this.alias=t,this}setColumn(t){return this.column=t,this}setEntityname(t){return this.entityname=t,this}setRowAggregate(t){return this.rowAggregate=t,this}setUIhidden(t){return this.uihidden=t,this}setUIname(t){return this.uiname=t,this}setUItype(t){return this.uitype=t,this}toXml(e){var i=e.createElement("condition");switch(this.aggregate&&i.setAttribute("aggregate",this.aggregate),this.alias&&i.setAttribute("alias",this.alias),this.attribute&&i.setAttribute("attribute",this.attribute),this.column&&i.setAttribute("column",this.column),this.entityname&&i.setAttribute("entityname",this.entityname),this.operator&&i.setAttribute("operator",this.operator),this.rowAggregate&&i.setAttribute("rowAggregate",this.rowAggregate),t.FetchXml.Util.isBoolean(this.uihidden)&&i.setAttribute("uihidden",this.uihidden.toString()),this.uiname&&i.setAttribute("uiname",this.uiname),this.uitype&&i.setAttribute("uitype",this.uitype),this.operator){case"begins-with":case"ends-with":case"eq":case"ge":case"gt":case"last-x-days":case"last-x-fiscal-periods":case"last-x-fiscal-years":case"last-x-hours":case"last-x-months":case"last-x-weeks":case"last-x-years":case"last-year":case"le":case"like":case"lt":case"ne":case"neq":case"next-x-days":case"next-x-fiscal-periods":case"next-x-fiscal-years":case"next-x-hours":case"next-x-months":case"next-x-weeks":case"next-x-years":case"not-begin-with":case"not-end-with":case"not-like":case"olderthan-x-days":case"olderthan-x-hours":case"olderthan-x-minutes":case"olderthan-x-months":case"olderthan-x-weeks":case"olderthan-x-years":case"on":case"on-or-after":case"on-or-before":case"in-fiscal-period":case"in-fiscal-year":if(1!=this.values.length){var r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);throw new Error("Sdk.FetchXml.condition values property must contain single value when the Sdk.FetchXml.Operator."+r+" operator is used.")}i.setAttribute("value",this.values[0].value);break;case"between":case"in":case"not-between":case"not-in":case"in-fiscal-period-and-year":case"in-or-after-fiscal-period-and-year":case"in-or-before-fiscal-period-and-year":if(!(this.values.length>1)){r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);throw new Error("Sdk.FetchXml.condition values property must contain multiple values when the Sdk.FetchXml.Operator."+r+" operator is used.")}this.values.forEach((function(t){i.appendChild(t.toXml(e))}));break;case"above":case"eq-businessid":case"eq-or-above":case"eq-or-under":case"eq-userid":case"eq-userlanguage":case"eq-useroruserhierarchy":case"eq-useroruserhierarchyandteams":case"eq-useroruserteams":case"eq-userteams":case"last-fiscal-period":case"last-fiscal-year":case"last-month":case"last-seven-days":case"last-week":case"ne-businessid":case"ne-userid":case"next-fiscal-period":case"next-fiscal-year":case"next-month":case"next-seven-days":case"next-week":case"next-year":case"not-null":case"not-under":case"null":case"this-fiscal-period":case"this-fiscal-year":case"this-month":case"this-week":case"this-year":case"today":case"tomorrow":case"under":case"yesterday":if(this.values.length>0){r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);console.log("Sdk.FetchXml.condition doesn't require values when the Sdk.FetchXml.Operator.%s operator is used. The values passed were ignored.",r)}break;default:throw new Error(this.operator+" is an unexpected Sdk.FetchXml.Operator value.")}return i}static conditionFromXml(e){var i=e.attributes.getNamedItem("attribute").nodeValue,r=e.attributes.getNamedItem("operator").nodeValue,s=new t.FetchXml.condition(i,r);t.FetchXml.Util.parseAttributes(e,s,((t,e,i)=>{switch(e){case"column":case"entityname":case"aggregate":case"alias":case"uiname":case"uitype":t[e]=i;break;case"rowaggregate":t.rowAggregate=i;break;case"uihidden":t.uihidden=g.convertFetchBoolType(i);break;case"value":t.addValue(i)}}));for(var n=0;n<e.childNodes.length;n++)"value"==e.childNodes[n].nodeName&&s.addValue(f.valueFromXml(e.childNodes[n]));return s}};o=y([k],o),e.condition=o;let u=class{constructor(e,i,r,s){if(this._allAttributes=null,this._attributes=[],this._orders=[],this._linkEntities=[],this._filters=[],!(this instanceof t.FetchXml.entity))return new t.FetchXml.entity(e,i,r,s);this.name=e,i&&(this.attributes=i),r&&(this.orders=r),s&&(this.filters=s)}get allAttributes(){return this._allAttributes}set allAttributes(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.entity.allAttributes must be a boolean value or null.");this._allAttributes=e}get attributes(){return this._attributes}set attributes(e){if(!t.FetchXml.Util.isAttributeArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.attributes must be an array of Sdk.FetchXml.attribute or null.");this._attributes=null==e?[]:e}get orders(){return this._orders}set orders(e){if(!t.FetchXml.Util.isOrderArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.orders must be an array of Sdk.FetchXml.order or null.");this._orders=null==e?[]:e}get linkEntities(){return this._linkEntities}set linkEntities(e){if(!t.FetchXml.Util.isLinkEntityArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.linkEntities must be an array of Sdk.FetchXml.linkEntity or null.");this._linkEntities=null==e?[]:e}get filters(){return this._filters}set filters(e){if(!t.FetchXml.Util.isFilterArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==e?[]:e}get name(){return this._name}set name(e){if(!t.FetchXml.Util.isString(e))throw new Error("Sdk.FetchXml.entity.name must be a string.");this._name=e}addAttribute(e){if(t.FetchXml.Util.isString(e)){var i=!1;return this.attributes.forEach((function(t){t.name==e&&(i=!0)})),i||this.attributes.push(new t.FetchXml.attribute(e)),this}if(!t.FetchXml.Util.isAttribute(e))throw new Error("Sdk.FetchXml.entity addAttribute method attributeOrAttributeName parameter must be an Sdk.FetchXml.attribute or a string value.");i=!1;return this.attributes.forEach((function(t){t.name==e.name&&(i=!0)})),i||this.attributes.push(e),this}removeAttributeByName(e){t.FetchXml.Util.removeCollectionValueByProperty(this.attributes,"name",e)}removeAttributeByRef(e){t.FetchXml.Util.removeCollectionValueByRef(this.attributes,e)}removeAttribute(e){t.FetchXml.Util.removeCollectionValue(this.attributes,e)}addOrder(e,i,r){if(t.FetchXml.Util.isOrder(e))return this.orders.push(e),this;if(!t.FetchXml.Util.isString(e))throw new Error("Sdk.FetchXml.entity addOrder method orderOrAttribute parameter must be a Sdk.FetchXml.order value or a string.");return this.orders.push(new t.FetchXml.order(e,i,r)),this}removeOrderByRef(e){if(!t.FetchXml.Util.isOrder(e))throw new Error("Sdk.FetchXml.entity removeOrderByRef method order parameter must be an Sdk.FetchXml.order.");return t.FetchXml.Util.removeCollectionValueByRef(this.orders,e),this}removeOrder(e){if(!t.FetchXml.Util.isOrder(e))throw new Error("Sdk.FetchXml.entity removeOrder method order parameter must be an Sdk.FetchXml.order.");return t.FetchXml.Util.removeCollectionValue(this.orders,e),this}setName(t){return this.name=t,this}setAllAttributes(e){if(t.FetchXml.Util.isBoolean(e))this.allAttributes=e;else{if(!t.FetchXml.Util.isNullOrUndefined(e))throw new Error("Sdk.FetchXml.entity setAllAttributes method allAttributes parameter must be a boolean value or null.");this.allAttributes=!0}return this}addLinkEntity(e){if(t.FetchXml.Util.isLinkEntity(e))return this.linkEntities.push(e),this;throw new Error("Sdk.FetchXml.entity addLinkEntity method linkEntity parameter must be a Sdk.FetchXml.linkEntity value.")}removeLinkEntityByRef(e){if(!t.FetchXml.Util.isLinkEntity(e))throw new Error("Sdk.FetchXml.entity removeLinkEntityByRef method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return t.FetchXml.Util.removeCollectionValueByRef(this.linkEntities,e),this}removeLinkEntity(e){if(!t.FetchXml.Util.isLinkEntity(e))throw new Error("Sdk.FetchXml.entity removeLinkEntity method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return t.FetchXml.Util.removeCollectionValue(this.linkEntities,e),this}addFilter(e){if(t.FetchXml.Util.isFilter(e))return this.filters.push(e),this;throw new Error("Sdk.FetchXml.entity addFilter method filter parameter must be a Sdk.FetchXml.filter value.")}removeFilterByRef(e){if(!t.FetchXml.Util.isFilter(e))throw new Error("Sdk.FetchXml.entity removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return t.FetchXml.Util.removeCollectionValueByRef(this.filters,e),this}removeFilter(e){if(!t.FetchXml.Util.isFilter(e))throw new Error("Sdk.FetchXml.entity removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return t.FetchXml.Util.removeCollectionValue(this.filters,e),this}toXml(t){var e=t.createElement("entity");return this.allAttributes?e.appendChild(t.createElement("all-attributes")):this.attributes.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.orders.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.linkEntities.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i,r){e.appendChild(i.toXml(t))})),e.setAttribute("name",this.name),e}static entityFromXml(e){var i=new t.FetchXml.entity(e.attributes.getNamedItem("name").nodeValue);i.allAttributes=1==e.getElementsByTagName("all-attributes").length;for(var r=0;r<e.childNodes.length;r++)"attribute"==e.childNodes[r].nodeName&&i.addAttribute(l.attributeFromXml(e.childNodes[r])),"order"==e.childNodes[r].nodeName&&i.addOrder(m.orderFromXml(e.childNodes[r])),"link-entity"==e.childNodes[r].nodeName&&i.addLinkEntity(d.linkEntityFromXml(e.childNodes[r])),"filter"==e.childNodes[r].nodeName&&i.addFilter(c.filterFromXml(e.childNodes[r]));return i}};u=y([k],u),e.entity=u;let h=class{constructor(e){if(this._aggregate=null,this._count=null,this._distinct=null,this._mapping=null,this._minActiveRowVersion=null,this._noLock=null,this._order=null,this._outputFormat=null,this._page=null,this._pagingCookie=null,this._returnTotalRecordCount=null,this._top=null,this._utcOffset=null,this._version=null,!(this instanceof t.FetchXml.fetch))return new t.FetchXml.fetch(e);e&&(this.entity=e)}get aggregate(){return this._aggregate}set aggregate(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.aggregate must be a boolean value or null.");this._aggregate=e}get count(){return this._count}set count(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.count must be a number value or null.");this._count=e}get distinct(){return this._distinct}set distinct(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.distinct must be a boolean value or null.");this._distinct=e}get entity(){return this._entity}set entity(e){if(!t.FetchXml.Util.isEntity(e))throw new Error("Sdk.FetchXml.fetch.entity must be a Sdk.FetchXml.entity value.");this._entity=e}get mapping(){return this._mapping}set mapping(e){if(!t.FetchXml.Util.isEnumMemberOrNull(t.FetchXml.Mapping,e))throw new Error("Sdk.FetchXml.fetch.mapping must be a Sdk.FetchXml.Mapping value or null.");this._mapping=e}get minActiveRowVersion(){return this._minActiveRowVersion}set minActiveRowVersion(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.minActiveRowVersion must be a boolean value or null.");this._minActiveRowVersion=e}get noLock(){return this._noLock}set noLock(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.noLock must be a boolean value or null.");this._noLock=e}get order(){return this._order}set order(e){if(!t.FetchXml.Util.isOrderOrNull(e))throw new Error("Sdk.FetchXml.fetch.order must be a Sdk.FetchXml.order value or null.");this._order=e}get outputFormat(){return this._outputFormat}set outputFormat(e){if(!t.FetchXml.Util.isEnumMemberOrNull(t.FetchXml.OutputFormat,e))throw new Error("Sdk.FetchXml.fetch.outputFormat must be a Sdk.FetchXml.OutputFormat value or null.");this._outputFormat=e}get page(){return this._page}set page(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.page must be a number value or null.");this._page=e}get pagingCookie(){return this._pagingCookie}set pagingCookie(e){if(!t.FetchXml.Util.isStringOrNull(e))throw new Error("Sdk.FetchXml.fetch.pagingCookie must be a string value or null.");this._pagingCookie=e}get returnTotalRecordCount(){return this._returnTotalRecordCount}set returnTotalRecordCount(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.returnTotalRecordCount must be a boolean value or null.");this._returnTotalRecordCount=e}get top(){return this._top}set top(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.top must be a number value or null.");this._top=e}get utcOffset(){return this._utcOffset}set utcOffset(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.utcOffset must be a number value or null.");this._utcOffset=e}get version(){return this._version}set version(e){if(!t.FetchXml.Util.isStringOrNull(e))throw new Error("Sdk.FetchXml.fetch.version must be a string value or null.");this._version=e}setAggregate(t){return this.aggregate=t||null,this}setCount(t){return this.count=t||null,this}setDistinct(t){return this.distinct=t||null,this}setEntity(t){return this.entity=t,this}setMapping(t){return this.mapping=t||null,this}setMinActiveRowVersion(t){return this.minActiveRowVersion=t||null,this}setNoLock(t=null){return this.noLock=t,this}setOrder(t=null){return this.order=t,this}setOutputFormat(t){return this.outputFormat=t||null,this}setPage(t){return this.page=t||null,this}setPagingCookie(t=null){return this.pagingCookie=t,this}setReturnTotalRecordCount(t){return this.returnTotalRecordCount=t||null,this}setTop(t){return this.top=t||null,this}setUtcOffset(t){return this.utcOffset=t||null,this}setVersion(t){return this.version=t||null,this}toXml(){var t=(new DOMParser).parseFromString("<fetch />","text/xml");return this.version&&t.documentElement.setAttribute("version",this.version),this.outputFormat&&t.documentElement.setAttribute("output-format",this.outputFormat),this.mapping&&t.documentElement.setAttribute("mapping",this.mapping),this.aggregate&&t.documentElement.setAttribute("aggregate",this.aggregate?"true":"false"),this.count&&t.documentElement.setAttribute("count",this.count.toString()),this.distinct&&t.documentElement.setAttribute("distinct",this.distinct?"true":"false"),this.entity&&t.documentElement.appendChild(this.entity.toXml(t)),this.minActiveRowVersion&&t.documentElement.setAttribute("min-active-row-version",this.minActiveRowVersion?"true":"false"),this.noLock&&t.documentElement.setAttribute("no-lock",this.noLock?"true":"false"),this.order&&t.documentElement.appendChild(this.order.toXml(t)),this.page&&t.documentElement.setAttribute("page",this.page.toString()),this.pagingCookie&&t.documentElement.setAttribute("paging-cookie",this.pagingCookie),this.returnTotalRecordCount&&t.documentElement.setAttribute("returntotalrecordcount",this.returnTotalRecordCount?"true":"false"),this.top&&t.documentElement.setAttribute("top",this.top.toString()),this.utcOffset&&t.documentElement.setAttribute("utc-offset",this.utcOffset.toString()),(new XMLSerializer).serializeToString(t)}static fromXml(e){var i=(new DOMParser).parseFromString(e,"text/xml"),r=new t.FetchXml.fetch;if("fetch"!=i.documentElement.localName)throw new Error("The XML string is not a valid fetchXML document");t.FetchXml.Util.parseAttributes(i.documentElement,r,((t,e,i)=>{switch(e){case"count":case"top":case"page":t[e]=parseInt(i,10);break;case"utc-offset":isNaN(i)?t.utcOffset=null:t.utcOffset=parseInt(i,10);break;case"paging-cookie":t.pagingCookie=i;break;case"min-active-row-version":t.minActiveRowVersion="true"==i;break;case"output-format":t.outputFormat=i;break;case"returntotalrecordcount":t.returnTotalRecordCount="true"==i;break;case"no-lock":t.noLock="true"==i;break;case"aggregate":case"distinct":t[e]="true"==i;break;default:t[e]=i}}));for(var s=0;s<i.documentElement.childNodes.length;s++)"entity"==i.documentElement.childNodes[s].nodeName&&(r.entity=t.FetchXml.entity.entityFromXml(i.documentElement.childNodes[s])),"order"==i.documentElement.childNodes[s].nodeName&&(r.order=t.FetchXml.order.orderFromXml(i.documentElement.childNodes[s]));return r}};h=y([k],h),e.fetch=h;let c=r=class{constructor(t,e,i){if(this._conditions=[],this._filters=[],this._type=null,this._isQuickFindFields=null,!(this instanceof r))return new r(t,e,i);t&&(this.type=t),e&&(this.conditions=e),i&&(this.filters=i)}get conditions(){return this._conditions}set conditions(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.filter.conditions must be an array of Sdk.FetchXml.condition or null.");this._conditions=null==t?[]:t}get filters(){return this._filters}set filters(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.filter.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==t?[]:t}get type(){return this._type}set type(t){this._type=t}get isQuickFindFields(){return this._isQuickFindFields}set isQuickFindFields(t){this._isQuickFindFields=t}addCondition(t,e,i){return g.isCondition(t)?this.conditions.push(t):this.conditions.push(new o(t,e,i)),this}removeConditionByRef(t){if(!g.isCondition(t))throw new Error("Sdk.FetchXml.filter removeConditionByRef method condition parameter must be an Sdk.FetchXml.condition.");return g.removeCollectionValueByRef(this.conditions,t),this}removeCondition(t){if(!g.isCondition(t))throw new Error("Sdk.FetchXml.filter removeCondition method condition parameter must be an Sdk.FetchXml.condition.");return g.removeCollectionValue(this.conditions,t),this}addFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter addFilter method filter parameter must be a Sdk.FetchXml.filter value.");return this.filters.push(t),this}removeFilterByRef(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValueByRef(this.filters,t),this}removeFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValue(this.filters,t),this}setIsQuickFindFields(t){return this.isQuickFindFields=t,this}setType(t){return this.type=t,this}toXml(t){var e=t.createElement("filter");return this.type&&e.setAttribute("type",this.type),g.isBoolean(this.isQuickFindFields)&&e.setAttribute("isquickfindfields",this.isQuickFindFields.toString()),this.conditions.forEach((function(i){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i){e.appendChild(i.toXml(t))})),e}static filterFromXml(t){var e=new r;g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"type":t.type=i;break;case"isquickfindfields":t.isQuickFindFields="true"==i||"1"==i}}));for(var i=0;i<t.childNodes.length;i++)"condition"==t.childNodes[i].nodeName&&e.addCondition(o.conditionFromXml(t.childNodes[i])),"filter"==t.childNodes[i].nodeName&&e.addFilter(r.filterFromXml(t.childNodes[i]));return e}};c=r=y([k],c),e.filter=c;let d=s=class{constructor(t,e,i,r,n){if(this._name=null,this._alias=null,this._from=null,this._intersect=null,this._linktype=null,this._to=null,this._visible=null,this._allAttributes=null,this._attributes=[],this._orders=[],this._linkEntities=[],this._filters=[],!(this instanceof s))return new s(t,e,i,r,n);this.name=t,e&&(this.from=e),i&&(this.to=i),r&&(this.linktype=r),n&&(this.alias=n)}get name(){return this._name}set name(t){this._name=t}get alias(){return this._alias}set alias(t){this._alias=t}get from(){return this._from}set from(t){this._from=t}get intersect(){return this._intersect}set intersect(t){this._intersect=t}get linktype(){return this._linktype}set linktype(t){this._linktype=t}get to(){return this._to}set to(t){this._to=t}get visible(){return this._visible}set visible(t){this._visible=t}get allAttributes(){return this._allAttributes}set allAttributes(t){this._allAttributes=t}get attributes(){return this._attributes}set attributes(t){if(!g.isAttributeArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.attributes must be an array of Sdk.FetchXml.attribute or null.");this._attributes=null==t?[]:t}get orders(){return this._orders}set orders(t){if(!g.isOrderArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.orders must be an array of Sdk.FetchXml.order or null.");this._orders=null==t?[]:t}get linkEntities(){return this._linkEntities}set linkEntities(t){if(!g.isLinkEntityArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.linkEntities must be an array of Sdk.FetchXml.linkEntity or null.");this._linkEntities=null==t?[]:t}get filters(){return this._filters}set filters(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==t?[]:t}get hash(){return this._name.concat(this._alias?this._alias:"",this._from?this._from:"",g.isNullOrUndefined(this._intersect)?"":this._intersect.toString(),this._linktype?this._linktype:"",this._to?this._to:"",g.isNullOrUndefined(this._visible)?"":this._visible.toString(),g.isNullOrUndefined(this._allAttributes)?"":this._allAttributes.toString(),g.getCollectionHash(this._attributes),g.getCollectionHash(this._orders),g.getCollectionHash(this._linkEntities),g.getCollectionHash(this._filters)).hashCode()}setAlias(t){return this.alias=t,this}setFrom(t){return this.from=t,this}setIntersect(t){return this.intersect=t,this}setName(t){return this.name=t,this}setTo(t){return this.to=t,this}setVisible(t){return this.visible=t,this}setAllAttributes(t){return this.allAttributes=t,this}addLinkEntity(t){if(g.isLinkEntity(t))return this.linkEntities.push(t),this;throw new Error("Sdk.FetchXml.linkEntity addLinkEntity method linkEntity parameter must be a Sdk.FetchXml.linkEntity value.")}removeLinkEntityByRef(t){if(!g.isLinkEntity(t))throw new Error("Sdk.FetchXml.linkEntity removeLinkEntityByRef method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return g.removeCollectionValueByRef(this.linkEntities,t),this}removeLinkEntity(t){if(!g.isLinkEntity(t))throw new Error("Sdk.FetchXml.linkEntity removeLinkEntity method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return g.removeCollectionValue(this.linkEntities,t),this}addAttribute(t){if(g.isAttribute(t))return this.attributes.push(t),this;if(g.isString(t))return this.attributes.push(new t(t)),this;throw new Error("Sdk.FetchXml.linkEntity addAttribute method attribute parameter must be a Sdk.FetchXml.attribute value or a string.")}removeAttributeByRef(t){if(!g.isAttribute(t))throw new Error("Sdk.FetchXml.linkEntity removeAttributeByRef method attribute parameter must be an Sdk.FetchXml.attribute.");return g.removeCollectionValueByRef(this.attributes,t),this}removeAttribute(t){if(!g.isAttribute(t))throw new Error("Sdk.FetchXml.linkEntity removeAttribute method attribute parameter must be an Sdk.FetchXml.attribute.");return g.removeCollectionValue(this.attributes,t),this}removeAttributeByName(t){if(!g.isString(t))throw new Error("Sdk.FetchXml.linkEntity removeAttributeByName method attributeName parameter must be a string.");return g.removeCollectionValueByProperty(this.attributes,"name",t),this}addOrder(t,e,i){if(g.isOrder(t))return this.orders.push(t),this;if(g.isString(t))return this.orders.push(new m(t,e,i)),this;throw new Error("Sdk.FetchXml.linkEntity addOrder method orderOrAttribute parameter must be a Sdk.FetchXml.order value or a string.")}removeOrderByRef(t){if(!g.isOrder(t))throw new Error("Sdk.FetchXml.linkEntity removeOrderByRef method order parameter must be an Sdk.FetchXml.order.");return g.removeCollectionValueByRef(this.orders,t),this}removeOrder(t){if(!g.isOrder(t))throw new Error("Sdk.FetchXml.linkEntity removeOrder method order parameter must be an Sdk.FetchXml.order.");return g.removeCollectionValue(this.orders,t),this}addFilter(t){if(g.isFilter(t))return this.filters.push(t),this;throw new Error("Sdk.FetchXml.linkEntity addFilter method filter parameter must be a Sdk.FetchXml.filter value.")}removeFilterByRef(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.linkEntity removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValueByRef(this.filters,t),this}removeFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.linkEntity removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValue(this.filters,t),this}toXml(t){var e=t.createElement("link-entity");return this.alias&&e.setAttribute("alias",this.alias),this.allAttributes&&e.appendChild(t.createElement("all-attributes")),this.from&&e.setAttribute("from",this.from),g.isBoolean(this.intersect)&&e.setAttribute("intersect",this.intersect.toString()),this.linktype&&e.setAttribute("link-type",this.linktype),this.name&&e.setAttribute("name",this.name),this.to&&e.setAttribute("to",this.to),g.isBoolean(this.visible)&&e.setAttribute("visible",this.visible.toString()),this.attributes.forEach((function(i){e.appendChild(i.toXml(t))})),this.orders.forEach((function(i){e.appendChild(i.toXml(t))})),this.linkEntities.forEach((function(i){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i){e.appendChild(i.toXml(t))})),e}static linkEntityFromXml(t){var e=t.attributes.getNamedItem("name").nodeValue,i=new s(e);i.allAttributes=1==t.getElementsByTagName("all-attributes").length,g.parseAttributes(t,i,((t,e,i)=>{switch(e){case"to":case"from":case"alias":t[e]=i;break;case"link-type":t.linktype=i;break;case"visible":case"intersect":t[e]="true"==i}}));for(var r=0;r<t.childNodes.length;r++)"attribute"==t.childNodes[r].nodeName&&i.addAttribute(l.attributeFromXml(t.childNodes[r])),"order"==t.childNodes[r].nodeName&&i.addOrder(m.orderFromXml(t.childNodes[r])),"filter"==t.childNodes[r].nodeName&&i.addFilter(c.filterFromXml(t.childNodes[r])),"link-entity"==t.childNodes[r].nodeName&&i.addLinkEntity(s.linkEntityFromXml(t.childNodes[r]));return i}};d=s=y([k],d),e.linkEntity=d;let m=n=class{constructor(t,e,i){if(this._attribute=null,this._descending=null,this._alias=null,!(this instanceof n))return new n(t,e,i);t&&(this.attribute=t),e&&(this.descending=e),i&&(this.alias=i)}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get descending(){return this._descending}set descending(t){this._descending=t}get alias(){return this._alias}set alias(t){this._alias=t}get hash(){return"".concat(this._attribute?this._attribute:"",this._alias?this._alias:"",this._descending.toString()).hashCode()}setAttribute(t){return this.attribute=t,this}setAlias(t){return this.alias=t,this}setDescending(t){return this.descending=t,this}toXml(t){var e=t.createElement("order");return this.attribute&&e.setAttribute("attribute",this.attribute),this.alias&&e.setAttribute("alias",this.alias),g.isNullOrUndefined(this.descending)||e.setAttribute("descending",this.descending.toString()),e}static orderFromXml(t){var e=new n;return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"attribute":t.attribute=i;break;case"alias":t.alias=i;break;case"descending":t.descending="true"==i}})),e}};m=n=y([k],m),e.order=m;let f=a=class{constructor(e,i,r){if(this._value=null,this._uiname=null,this._uitype=null,!(this instanceof t.FetchXml.value))return new e(e,i,r);e&&(this.value=e),i&&(this.uiname=i),r&&(this.uitype=r)}get value(){return this._value}set value(t){this._value=t}get uiname(){return this._uiname}set uiname(t){this._uiname=t}get uitype(){return this._uitype}set uitype(t){this._uitype=t}setValue(t){return this.value=t,this}setUIname(t){return this.uiname=t,this}setUItype(t){return this.uitype=t,this}toXml(t){var e=t.createElement("value");return this.uitype&&e.setAttribute("uitype",this.uitype),this.uiname&&e.setAttribute("uiname",this.uiname),e.appendChild(t.createTextNode(this.value)),e}static valueFromXml(t){var e=new a(t.textContent);return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"uiname":case"uitype":t[e]=i}})),e}};f=a=y([k],f),e.value=f;class g{static isBoolean(t){return"boolean"==typeof t}static isBooleanOrNull(t){return g.isNull(t)||g.isBoolean(t)}static isNumber(t){return"number"==typeof t}static isNumberOrNull(t){return g.isNull(t)||g.isNumber(t)}static isNull(t){return null===t}static isNullOrUndefined(t){return null==t}static isEnumMember(t,e){for(var i in t)if(e===t[i])return!0;return!1}static isEnumMemberOrNull(t,e){return g.isNull(e)||g.isEnumMember(t,e)}static isString(t){return"string"==typeof t}static isStringOrNull(t){return g.isNull(t)||g.isString(t)}static isOrder(t){return t instanceof m}static isOrderOrNull(t){return g.isNull(t)||g.isOrder(t)}static isOrderArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isOrder(t))return!1})),!0)}static isOrderArrayOrNull(t){return g.isNull(t)||g.isOrderArray(t)}static isEntity(t){return t instanceof u}static isAttribute(t){return t instanceof l}static isAttributeArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isAttribute(t))return!1})),!0)}static isAttributeArrayOrNull(t){return g.isNull(t)||g.isAttributeArray(t)}static isLinkEntity(t){return t instanceof d}static isLinkEntityOrNull(t){return g.isNull(t)||g.isLinkEntity(t)}static isLinkEntityArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isLinkEntity(t))return!1})),!0)}static isLinkEntityArrayOrNull(t){return g.isNull(t)||g.isLinkEntityArray(t)}static isFilter(t){return t instanceof c}static isFilterOrNull(t){return g.isNull(t)||g.isFilter(t)}static isFilterArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isFilter(t))return!1})),!0)}static isFilterArrayOrNull(t){return g.isNull(t)||g.isFilterArray(t)}static isCondition(t){return t instanceof o}static isConditionOrNull(t){return g.isNull(t)||g.isCondition(t)}static isConditionArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isCondition(t))return!1})),!0)}static isConditionArrayOrNull(t){return g.isNull(t)||g.isConditionArray(t)}static isValue(t){return t instanceof f}static isValueOrNull(t){return g.isNull(t)||g.isValue(t)}static isValueArray(t){if(Array.isArray(t)){var e=!0;return t.forEach((function(t){g.isValue(t)||(e=!1)})),e}return!1}static isValueArrayOrNull(t){return g.isNull(t)||g.isValueArray(t)}static getEnumNameFromValue(t,e){for(var i in t)if(t[i]==e)return i}static getCollectionHash(t){var e=[];return t.forEach((function(t){e.push(t.hash)})),e.join()}static removeCollectionValue(t,e){g.removeCollectionValueByProperty(t,"hash",e)}static removeCollectionValueByProperty(t,e,i){var r=[];t.forEach((function(t,s){t[e]==i[e]&&r.push(t)})),r.forEach((function(e){g.removeCollectionValueByRef(t,e)}))}static removeCollectionValueByRef(t,e){var i=[];if(t.forEach((function(t,r){t===e&&i.push(r)})),i.length>0)for(var r=i.length-1;r>=0;r--)t.splice(i[r],1)}static convertFetchBoolType(t){switch(t){case"true":case"1":return!0;case"false":case"0":return!1;default:throw new Error("Unexpected FetchBoolType value")}}static parseAttributes(t,e,i){for(var r=t.attributes,s=0;s<r.length;s++){i(e,r[s].nodeName,r[s].nodeValue)}}}e.Util=g;let p=class{};p.Internal="internal",p.Logical="logical",p=y([F],p),e.Mapping=p;let b=class{};b.Ado="xml-ado",b.Auto="xml-auto",b.Elements="xml-elements",b.Raw="xml-raw",b.Platform="xml-platform",b=y([F],b),e.OutputFormat=b;let v=class{};v.OnePoint504021="1.504021",v.OnePoint003017="1.003017",v=y([F],v),e.Build=v;let X=class{};X.Count="count",X.CountColumn="countcolumn",X.Sum="sum",X.Avg="avg",X.Min="min",X.Max="max",X=y([F],X),e.Aggregate=X;let w=class{};w.Countchildren="countchildren",w=y([F],w),e.RowAggregate=w;let E=class{};E.Day="day",E.Week="week",E.Month="month",E.Quarter="quarter",E.Year="year",E.FiscalPeriod="fiscal-period",E.FiscalYear="fiscal-year",E=y([F],E),e.DateGrouping=E;let _=class{};_.Above="above",_.BeginsWith="begins-with",_.Between="between",_.EndsWith="ends-with",_.Equal="eq",_.EqualBusinessId="eq-businessid",_.EqualOrAbove="eq-or-above",_.EqualOrUnder="eq-or-under",_.EqualUserId="eq-userid",_.EqualUserLanguage="eq-userlanguage",_.EqualUserOrUserHierarchy="eq-useroruserhierarchy",_.EqualUserOrUserHierarchyAndTeams="eq-useroruserhierarchyandteams",_.EqualUserOrUserTeams="eq-useroruserteams",_.EqualUserTeams="eq-userteams",_.GreaterOrEqual="ge",_.GreaterThan="gt",_.In="in",_.InFiscalPeriod="in-fiscal-period",_.InFiscalPeriodAndYear="in-fiscal-period-and-year",_.InFiscalYear="in-fiscal-year",_.InOrAfterFiscalPeriodAndYear="in-or-after-fiscal-period-and-year",_.InOrBeforeFiscalPeriodAndYear="in-or-before-fiscal-period-and-year",_.LastFiscalPeriod="last-fiscal-period",_.LastFiscalYear="last-fiscal-year",_.LastMonth="last-month",_.LastSevenDays="last-seven-days",_.LastWeek="last-week",_.LastXDays="last-x-days",_.LastXFiscalPeriods="last-x-fiscal-periods",_.LastXFiscalYears="last-x-fiscal-years",_.LastXHours="last-x-hours",_.LastXMonths="last-x-months",_.LastXWeeks="last-x-weeks",_.LastXYears="last-x-years",_.LastYear="last-year",_.LessOrEqual="le",_.Like="like",_.LessThan="lt",_.NotEqual="ne",_.NotEqualBusinessId="ne-businessid",_.NotEqualUserId="ne-userid",_.Neq="neq",_.NextFiscalPeriod="next-fiscal-period",_.NextFiscalYear="next-fiscal-year",_.NextMonth="next-month",_.NextSevenDays="next-seven-days",_.NextWeek="next-week",_.NextXDays="next-x-days",_.NextXFiscalPeriods="next-x-fiscal-periods",_.NextXFiscalYears="next-x-fiscal-years",_.NextXHours="next-x-hours",_.NextXMonths="next-x-months",_.NextXWeeks="next-x-weeks",_.NextXYears="next-x-years",_.NextYear="next-year",_.NotBeginWith="not-begin-with",_.NotBetween="not-between",_.NotEndWith="not-end-with",_.NotIn="not-in",_.NotLike="not-like",_.NotNull="not-null",_.NotUnder="not-under",_.Null="null",_.OlderThanXDays="olderthan-x-days",_.OlderThanXHours="olderthan-x-hours",_.OlderThanXMinutes="olderthan-x-minutes",_.OlderThanXMonths="olderthan-x-months",_.OlderThanXWeeks="olderthan-x-weeks",_.OlderThanXYears="olderthan-x-years",_.On="on",_.OnOrAfter="on-or-after",_.OnOrBefore="on-or-before",_.ThisFiscalPeriod="this-fiscal-period",_.ThisFiscalYear="this-fiscal-year",_.ThisMonth="this-month",_.ThisWeek="this-week",_.ThisYear="this-year",_.Today="today",_.Tomorrow="tomorrow",_.Under="under",_.Yesterday="yesterday",_=y([F],_),e.Operator=_;let N=class{};N.And="and",N.Or="or",N=y([F],N),e.FilterType=N}(t.FetchXml||(t.FetchXml={}))}(v||(v={})),String.prototype.hashCode=function(){let t=0;if(0==this.length)return t.toString();for(let e=0;e<this.length;e++){t=(t<<5)-t+this.charCodeAt(e),t&=t}return t.toString()};const X=t=>{const e=t.parameters.value.attributes.Targets,i=t.parameters.value.raw,n=t.context,[l,o]=a("Lookup",t,b),[u,h]=(t=>{const e=r({});return[i=>p(void 0,void 0,void 0,(function*(){return e.current[i]||(e.current[i]=t.webAPI.retrieveRecord("savedquery",i,"?$select=fetchxml")),(yield e.current[i]).fetchxml})),(t,e,i)=>p(void 0,void 0,void 0,(function*(){if(!i)return e;const r=yield t.metadata,s=v.FetchXml.fetch.fromXml(e);return s.entity.addFilter(new v.FetchXml.filter(v.FetchXml.FilterType.Or,[new v.FetchXml.condition(r.PrimaryNameAttribute,v.FetchXml.Operator.Like,[new v.FetchXml.value(`%${i}%`)])])),s.toXml()}))]})(n),[c,d]=s((()=>e.map((i=>({entityName:i,selected:1===e.length,metadata:t.context.utils.getEntityMetadata(i,[])}))))),m=c.find((t=>t.selected)),f=(e,i)=>p(void 0,void 0,void 0,(function*(){const r=(yield t.parameters.value.getAllViews(e)).find((t=>t.isDefault));if(!(null==r?void 0:r.viewId))throw new Error(`Entity ${e} does not have a default view id!`);let s=null==r?void 0:r.fetchXml;return s||(s=yield u(r.viewId)),h(c.find((t=>t.entityName===e)),s,i)}));return[i,c,l,{create:t=>p(void 0,void 0,void 0,(function*(){const e=yield n.navigation.openForm({entityName:t,useQuickCreateForm:!0});e.savedEntityReference&&o({value:e.savedEntityReference})})),deselect:t=>{const e=new Map(i.map((t=>[t.id,t])));e.delete(t.id),o({value:[...e.values()]})},select:t=>{o({value:t})}},t=>{d([...c].map((e=>({entityName:e.entityName,metadata:e.metadata,selected:e.entityName===t}))))},t=>p(void 0,void 0,void 0,(function*(){const i=new Map;if(m)i.set(m.entityName,f(m.entityName,t));else for(const r of e)i.set(r,f(r,t));yield Promise.all(i.values());const r=new Map;for(const[t,e]of i)r.set(t,n.webAPI.retrieveMultipleRecords(t,`?fetchXml=${encodeURIComponent(yield e)}`));yield Promise.all(r.values());const s=[];for(const[t,e]of r)for(const i of(yield e).entities){const e=yield c.find((e=>e.entityName===t)).metadata;s.push({entityType:t,id:i[e.PrimaryIdAttribute],name:i[e.PrimaryNameAttribute]})}return s}))]},w=(t,e,i)=>{const r=(t=>{if(-1!==t&&0!==t)return t})(e);return l({root:{'[class*="TALXIS__tag-picker__search-btn"][class*="TALXIS__tag-picker__search-btn"]':{top:0,bottom:0,margin:"auto 0",right:5},'[data-navigation-enabled="true"]':{"> span > div > span":{color:t.semanticColors.link,cursor:"pointer"},":hover":{textDecoration:"underline",cursor:"pointer !important"}},".ms-BasePicker-itemsWrapper .ms-CommandBar":{height:r&&i?r-6:void 0},".ms-BasePicker-text":{minHeight:null!=r?r:36,height:"min-content",paddingRight:i?void 0:36,alignItems:"baseline",input:{alignSelf:"center"},".hover-only":{animationName:"none"},"::after":{inset:"0px !important"}}},suggestions:{".ms-Suggestions-title":{padding:0,display:"flex",flexDirection:"column"}},createRecordBtn:{height:38,width:"100%",".ms-Button-menuIcon":{display:"none"},">.ms-Button-flexContainer.ms-Button-flexContainer":{justifyContent:"flex-start"},".ms-Button-textContainer":{flexGrow:"initial",">span":{fontWeight:600}}}})},E=t=>{const[e,i]=s(null);return n((()=>{p(void 0,void 0,void 0,(function*(){i(yield Promise.all(t.map((t=>p(void 0,void 0,void 0,(function*(){return{entityName:t.entityName,selected:t.selected,metadata:yield t.metadata}}))))))}))}),[t]),[e]},_=r=>{const{labels:s,entities:n,onEntitySelected:a}=Object.assign({},r),[h]=E(n),c=(t=>l({targetSelector:{display:"flex",paddingLeft:8,paddingRight:8,paddingBottom:8,gap:8,paddingTop:8,">span":{lineHeight:15,minWidth:"fit-content",color:t.semanticColors.listText,fontWeight:600}},targetSelectorLinks:{display:"flex",gap:5,flexWrap:"wrap"},targetSelectorLink:{color:t.palette.blackTranslucent40,'&[data-selected="true"]':{color:t.semanticColors.link,fontWeight:600}}}))(o());return t("div",Object.assign({className:c.targetSelector},{children:[t(d,Object.assign({variant:"small"},{children:[s.resultsFrom()," "]})),t("div",Object.assign({className:c.targetSelectorLinks},{children:[e(u,Object.assign({onClick:()=>a(null),className:c.targetSelectorLink,"data-selected":!n.find((t=>t.selected))},{children:"All"})),h&&e(i,{children:h.map((t=>e(u,Object.assign({className:c.targetSelectorLink,"data-selected":t.selected,onClick:()=>a(t.entityName)},{children:t.metadata.DisplayName}))))})]}))]}))},N=t=>{const{labels:i,entities:r,onCreateRecord:s}=Object.assign({},t),[n]=E(r),a=o(),l=w(a,0),u=r.find((t=>t.selected));return e(f,{className:l.createRecordBtn,iconProps:{iconName:"Add"},onClick:u?()=>s(u.entityName):void 0,menuProps:u?void 0:{calloutProps:{coverTarget:!1},isBeakVisible:!0,items:n?[{key:"header",itemType:h.Header,text:"Vyberte tabulku"},...n.map((t=>({key:t.entityName,text:t.metadata.DisplayName,onClick:()=>s(t.entityName)})))]:[]},text:i.newRecord()})},A=s=>{var a,l;const u=s.context,h=r(null),d=r(null),f=!0===(null===(a=s.parameters.MultipleEnabled)||void 0===a?void 0:a.raw)?1/0:1,y=o(),b=w(y,u.mode.allocatedHeight,1===f),[v,k,F,E,A,S]=X(s),O=m(h),x=g(h),C=r(!0),B=r(!1);n((()=>{C.current?C.current=!1:d.current.state.suggestionsVisible&&V()}),[k]),n((()=>{const t=t=>{var e;if("Backspace"===t.key){const t=null===(e=h.current)||void 0===e?void 0:e.querySelector('[class*="TALXIS__tag-picker__root"]');document.activeElement===t&&1===v.length&&(E.select(void 0),setTimeout((()=>{var t;null===(t=d.current)||void 0===t||t.focusInput()}),200))}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[v]),n((()=>{var t;!0===(null===(t=s.parameters.AutoFocus)||void 0===t?void 0:t.raw)&&U()}),[]);const U=()=>{var t,e,i,r;(null===(e=null===(t=d.current)||void 0===t?void 0:t.items)||void 0===e?void 0:e.length)!==f?null===(r=d.current)||void 0===r||r.focusInput():null===(i=h.current)||void 0===i||i.querySelector('[class*="TALXIS__tag-picker__root"]').focus()},V=()=>p(void 0,void 0,void 0,(function*(){d.current.suggestionStore.updateSuggestions([]),d.current.setState({suggestionsVisible:!0,suggestionsLoading:!0});const t=yield T(d.current.input.current.value);d.current.updateSuggestionsList(t),d.current.setState({isMostRecentlyUsedVisible:!1,suggestionsVisible:!0,moreSuggestionsAvailable:!1})})),R=()=>O||x,T=(t,e)=>p(void 0,void 0,void 0,(function*(){var i;const r=yield S(t),s=[];for(const t of r){if(null==e?void 0:e.find((e=>e.key===t.id)))continue;const r=yield null===(i=k.find((e=>e.entityName===t.entityType)))||void 0===i?void 0:i.metadata;s.push({key:t.id,text:t.name||F.noName(),secondaryText:null==r?void 0:r.DisplayName,"data-entity":t.entityType})}return s}));return e("div",Object.assign({className:b.root,ref:h},{children:e(c,{componentRef:d,resolveDelay:200,stackItems:1===f,pickerCalloutProps:{className:b.suggestions},pickerSuggestionsProps:{loadingText:F.searching(),noResultsFoundText:F.noRecordsFound(),suggestionsHeaderText:t(i,{children:[!1!==(null===(l=s.parameters.IsInlineNewEnabled)||void 0===l?void 0:l.raw)&&e(N,{labels:F,entities:k,onCreateRecord:E.create}),s.parameters.value.attributes.Targets.length>1&&e(_,{labels:F,entities:k,onEntitySelected:t=>{A(t)}})]})},transparent:!R()&&1===f,onChange:t=>{E.select(null==t?void 0:t.map((t=>({entityType:t["data-entity"],id:t.key,name:t.text}))))},searchBtnProps:{iconProps:{iconName:"Search"}},selectedItems:v.map((t=>{var e;return{key:t.id,text:t.name||F.noName(),"data-entity":t.entityType,"data-navigation-enabled":!1!==(null===(e=s.parameters.EnableNavigation)||void 0===e?void 0:e.raw),onClick:()=>{var e;!1!==(null===(e=s.parameters.EnableNavigation)||void 0===e?void 0:e.raw)&&u.navigation.openForm({entityName:t.entityType,entityId:t.id})},deleteButtonProps:R()||f>1?{key:"delete",iconProps:{iconName:"ChromeClose",styles:{root:{fontSize:12,width:16,color:`${y.palette.black} !important`}}},onClick:()=>{B.current=!1,E.deselect(t),setTimeout((()=>{U()}),200)}}:void 0}})),itemLimit:f,onResolveSuggestions:T})}))};export{A as L,p as _};
1
+ import{jsxs as t,jsx as e,Fragment as i}from"react/jsx-runtime";import{useRef as r,useState as s,useEffect as n}from"react";import{useComponent as a}from"./hooks/useComponent.js";import{mergeStyleSets as l,useTheme as o,Link as u,ContextualMenuItemType as h}from"@fluentui/react";import{TagPicker as c}from"@talxis/react-components/dist/components/TagPicker";import{Text as d}from"@fluentui/react/lib/Text";import{useMouseOver as m}from"./hooks/useMouseOver.js";import{CommandBarButton as f}from"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";import{useFocusIn as g}from"./hooks/useFocusIn.js";function y(t,e,i,r){var s,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(n<3?s(a):n>3?s(e,i,a):s(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function p(t,e,i,r){return new(i||(i=Promise))((function(s,n){function a(t){try{o(r.next(t))}catch(t){n(t)}}function l(t){try{o(r.throw(t))}catch(t){n(t)}}function o(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,l)}o((r=r.apply(t,e||[])).next())}))}const b={search:{1033:"Search",1029:"Vyhledejte"},newRecord:{1033:"New record",1029:"Nový záznam"},searching:{1033:"Searching...",1029:"Hledám..."},noRecordsFound:{1033:"No records found",1029:"Nebyly nalezeny žádné záznamy"},resultsFrom:{1033:"Results from:",1029:"Výsledky z:"},noName:{1033:"(No Name)",1029:"(Bez názvu)"}};var v;function k(t){Object.seal(t),Object.seal(t.prototype)}function F(t){Object.freeze(t),Object.freeze(t.prototype)}!function(t){!function(e){var i,r,s,n,a;let l=i=class{constructor(t){if(this._build=null,this._addedBy=null,this._alias=null,this._aggregate=null,this._groupBy=null,this._dateGrouping=null,this._userTimeZone=null,!(this instanceof i))return new i(t);this.name=t}get name(){return this._name}set name(t){if(!g.isString(t))throw new Error("Sdk.FetchXml.attribute name property must be an string.");this._name=t}get build(){return this._build}set build(t){if(!g.isEnumMemberOrNull(v,t))throw new Error("Sdk.FetchXml.attribute build property must be an Sdk.FetchXml.Build value or null.");this._build=t}get addedBy(){return this._addedBy}set addedBy(t){if(!g.isStringOrNull(t))throw new Error("Sdk.FetchXml.attribute addedBy property must be an string value or null.");this._addedBy=t}get alias(){return this._alias}set alias(t){if(!g.isStringOrNull(t))throw new Error("Sdk.FetchXml.attribute alias property must be an string value or null.");this._alias=t}get aggregate(){return this._aggregate}set aggregate(t){if(!g.isEnumMemberOrNull(X,t))throw new Error("Sdk.FetchXml.attribute aggregate property must be an Sdk.FetchXml.Aggregate value or null.");this._aggregate=t}get groupBy(){return this._groupBy}set groupBy(t){if(!g.isBooleanOrNull(t))throw new Error("Sdk.FetchXml.attribute groupBy property must be an boolean value or null.");this._groupBy=t}get dateGrouping(){return this._dateGrouping}set dateGrouping(t){if(!g.isEnumMemberOrNull(E,t))throw new Error("Sdk.FetchXml.attribute dateGrouping property must be an Sdk.FetchXml.DateGrouping value or null.");this._dateGrouping=t}get userTimeZone(){return this._userTimeZone}set userTimeZone(t){if(!g.isBooleanOrNull(t))throw new Error("Sdk.FetchXml.attribute userTimeZone property must be an boolean value or null.");this._userTimeZone=t}setName(t){return this.name=t,this}setBuild(t){return this.build=t||null,this}setAddedBy(t){return this.addedBy=t||null,this}setAlias(t){return this.alias=t||null,this}setAggregate(t){return this.aggregate=t||null,this}setGroupBy(t){return t?this.groupBy=t:t=null,this}setDateGrouping(t){return this.dateGrouping=t||null,this}setUserTimeZone(t){return this.userTimeZone=t||null,this}toXml(t){var e=t.createElement("attribute");return e.setAttribute("name",this.name),this.build&&e.setAttribute("build",this.build),this.addedBy&&e.setAttribute("addedby",this.addedBy),this.alias&&e.setAttribute("alias",this.alias),this.aggregate&&e.setAttribute("aggregate",this.aggregate),g.isBoolean(this.groupBy)&&e.setAttribute("groupby",this.groupBy?"true":"false"),this.dateGrouping&&e.setAttribute("dategrouping",this.dateGrouping),g.isBoolean(this.userTimeZone)&&e.setAttribute("usertimezone",this.userTimeZone?"true":"false"),e}static attributeFromXml(t){var e=new i(t.attributes.getNamedItem("name").nodeValue);return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"build":case"alias":case"aggregate":t[e]=i;break;case"addedby":t.addedBy=i;break;case"dategrouping":t.dateGrouping=i;break;case"groupby":t.groupBy=g.convertFetchBoolType(i);case"usertimezone":t.userTimeZone=g.convertFetchBoolType(i)}})),e}};l=i=y([k],l),e.attribute=l;let o=class{constructor(e,i,r){if(this._aggregate=null,this._alias=null,this._attribute=null,this._column=null,this._entityname=null,this._operator=null,this._rowAggregate=null,this._uihidden=null,this._uiname=null,this._uitype=null,this._values=[],!(this instanceof t.FetchXml.condition))return new t.FetchXml.condition(e,i,r);if(!e||!i)throw new Error("Sdk.FetchXml.condition constructor parameters attribute and operator are required.");this.attribute=e,this.operator=i,r&&(this.values=r)}get aggregate(){return this._aggregate}set aggregate(t){this._aggregate=t}get alias(){return this._alias}set alias(t){this._alias=t}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get column(){return this._column}set column(t){this._column=t}get entityname(){return this._entityname}set entityname(t){this._entityname=t}get operator(){return this._operator}set operator(t){this._operator=t}get rowAggregate(){return this._rowAggregate}set rowAggregate(t){this._rowAggregate=t}get uihidden(){return this._uihidden}set uihidden(t){this._uihidden=t}get uiname(){return this._uiname}set uiname(t){this._uiname=t}get uitype(){return this._uitype}set uitype(t){this._uitype=t}get values(){return this._values}set values(e){if(!t.FetchXml.Util.isValueArrayOrNull(e))throw new Error("Sdk.FetchXml.condition.values must be an array of Sdk.FetchXml.value or null.");this._values=null==e?[]:e}get hash(){return this._attribute.concat(this._operator,this._aggregate?this._aggregate:"",this._alias?this._alias:"",this._column?this._column:"",this._entityname?this._entityname:"",this._rowAggregate?this._rowAggregate:"",t.FetchXml.Util.isNullOrUndefined(this._uihidden)?"":this._uihidden.toString(),this._uiname?this._uiname:"",this._uitype?this._uitype:"",t.FetchXml.Util.getCollectionHash(this._values)).hashCode()}setAttribute(t){return this.attribute=t,this}setOperator(t){return this.operator=t,this}setValues(t){return this.values=t,this}addValue(e){return t.FetchXml.Util.isValue(e)?this.values.push(e):this.values.push(new t.FetchXml.value(e)),this}removeValueByRef(e){if(!t.FetchXml.Util.isValue(e))throw new Error("Sdk.FetchXml.condition removeValueByRef method value parameter must be an Sdk.FetchXml.value.");return t.FetchXml.Util.removeCollectionValueByRef(this.values,e),this}removeValue(e){if(!t.FetchXml.Util.isValue(e))throw new Error("Sdk.FetchXml.condition removeValue method value parameter must be an Sdk.FetchXml.value.");return t.FetchXml.Util.removeCollectionValue(this.values,e),this}removeValueByValue(e){return t.FetchXml.Util.removeCollectionValueByProperty(this.values,"value",e),this}setAggregate(t){return this.aggregate=t,this}setAlias(t){return this.alias=t,this}setColumn(t){return this.column=t,this}setEntityname(t){return this.entityname=t,this}setRowAggregate(t){return this.rowAggregate=t,this}setUIhidden(t){return this.uihidden=t,this}setUIname(t){return this.uiname=t,this}setUItype(t){return this.uitype=t,this}toXml(e){var i=e.createElement("condition");switch(this.aggregate&&i.setAttribute("aggregate",this.aggregate),this.alias&&i.setAttribute("alias",this.alias),this.attribute&&i.setAttribute("attribute",this.attribute),this.column&&i.setAttribute("column",this.column),this.entityname&&i.setAttribute("entityname",this.entityname),this.operator&&i.setAttribute("operator",this.operator),this.rowAggregate&&i.setAttribute("rowAggregate",this.rowAggregate),t.FetchXml.Util.isBoolean(this.uihidden)&&i.setAttribute("uihidden",this.uihidden.toString()),this.uiname&&i.setAttribute("uiname",this.uiname),this.uitype&&i.setAttribute("uitype",this.uitype),this.operator){case"begins-with":case"ends-with":case"eq":case"ge":case"gt":case"last-x-days":case"last-x-fiscal-periods":case"last-x-fiscal-years":case"last-x-hours":case"last-x-months":case"last-x-weeks":case"last-x-years":case"last-year":case"le":case"like":case"lt":case"ne":case"neq":case"next-x-days":case"next-x-fiscal-periods":case"next-x-fiscal-years":case"next-x-hours":case"next-x-months":case"next-x-weeks":case"next-x-years":case"not-begin-with":case"not-end-with":case"not-like":case"olderthan-x-days":case"olderthan-x-hours":case"olderthan-x-minutes":case"olderthan-x-months":case"olderthan-x-weeks":case"olderthan-x-years":case"on":case"on-or-after":case"on-or-before":case"in-fiscal-period":case"in-fiscal-year":if(1!=this.values.length){var r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);throw new Error("Sdk.FetchXml.condition values property must contain single value when the Sdk.FetchXml.Operator."+r+" operator is used.")}i.setAttribute("value",this.values[0].value);break;case"between":case"in":case"not-between":case"not-in":case"in-fiscal-period-and-year":case"in-or-after-fiscal-period-and-year":case"in-or-before-fiscal-period-and-year":if(!(this.values.length>1)){r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);throw new Error("Sdk.FetchXml.condition values property must contain multiple values when the Sdk.FetchXml.Operator."+r+" operator is used.")}this.values.forEach((function(t){i.appendChild(t.toXml(e))}));break;case"above":case"eq-businessid":case"eq-or-above":case"eq-or-under":case"eq-userid":case"eq-userlanguage":case"eq-useroruserhierarchy":case"eq-useroruserhierarchyandteams":case"eq-useroruserteams":case"eq-userteams":case"last-fiscal-period":case"last-fiscal-year":case"last-month":case"last-seven-days":case"last-week":case"ne-businessid":case"ne-userid":case"next-fiscal-period":case"next-fiscal-year":case"next-month":case"next-seven-days":case"next-week":case"next-year":case"not-null":case"not-under":case"null":case"this-fiscal-period":case"this-fiscal-year":case"this-month":case"this-week":case"this-year":case"today":case"tomorrow":case"under":case"yesterday":if(this.values.length>0){r=t.FetchXml.Util.getEnumNameFromValue(t.FetchXml.Operator,this.operator);console.log("Sdk.FetchXml.condition doesn't require values when the Sdk.FetchXml.Operator.%s operator is used. The values passed were ignored.",r)}break;default:throw new Error(this.operator+" is an unexpected Sdk.FetchXml.Operator value.")}return i}static conditionFromXml(e){var i=e.attributes.getNamedItem("attribute").nodeValue,r=e.attributes.getNamedItem("operator").nodeValue,s=new t.FetchXml.condition(i,r);t.FetchXml.Util.parseAttributes(e,s,((t,e,i)=>{switch(e){case"column":case"entityname":case"aggregate":case"alias":case"uiname":case"uitype":t[e]=i;break;case"rowaggregate":t.rowAggregate=i;break;case"uihidden":t.uihidden=g.convertFetchBoolType(i);break;case"value":t.addValue(i)}}));for(var n=0;n<e.childNodes.length;n++)"value"==e.childNodes[n].nodeName&&s.addValue(f.valueFromXml(e.childNodes[n]));return s}};o=y([k],o),e.condition=o;let u=class{constructor(e,i,r,s){if(this._allAttributes=null,this._attributes=[],this._orders=[],this._linkEntities=[],this._filters=[],!(this instanceof t.FetchXml.entity))return new t.FetchXml.entity(e,i,r,s);this.name=e,i&&(this.attributes=i),r&&(this.orders=r),s&&(this.filters=s)}get allAttributes(){return this._allAttributes}set allAttributes(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.entity.allAttributes must be a boolean value or null.");this._allAttributes=e}get attributes(){return this._attributes}set attributes(e){if(!t.FetchXml.Util.isAttributeArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.attributes must be an array of Sdk.FetchXml.attribute or null.");this._attributes=null==e?[]:e}get orders(){return this._orders}set orders(e){if(!t.FetchXml.Util.isOrderArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.orders must be an array of Sdk.FetchXml.order or null.");this._orders=null==e?[]:e}get linkEntities(){return this._linkEntities}set linkEntities(e){if(!t.FetchXml.Util.isLinkEntityArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.linkEntities must be an array of Sdk.FetchXml.linkEntity or null.");this._linkEntities=null==e?[]:e}get filters(){return this._filters}set filters(e){if(!t.FetchXml.Util.isFilterArrayOrNull(e))throw new Error("Sdk.FetchXml.entity.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==e?[]:e}get name(){return this._name}set name(e){if(!t.FetchXml.Util.isString(e))throw new Error("Sdk.FetchXml.entity.name must be a string.");this._name=e}addAttribute(e){if(t.FetchXml.Util.isString(e)){var i=!1;return this.attributes.forEach((function(t){t.name==e&&(i=!0)})),i||this.attributes.push(new t.FetchXml.attribute(e)),this}if(!t.FetchXml.Util.isAttribute(e))throw new Error("Sdk.FetchXml.entity addAttribute method attributeOrAttributeName parameter must be an Sdk.FetchXml.attribute or a string value.");i=!1;return this.attributes.forEach((function(t){t.name==e.name&&(i=!0)})),i||this.attributes.push(e),this}removeAttributeByName(e){t.FetchXml.Util.removeCollectionValueByProperty(this.attributes,"name",e)}removeAttributeByRef(e){t.FetchXml.Util.removeCollectionValueByRef(this.attributes,e)}removeAttribute(e){t.FetchXml.Util.removeCollectionValue(this.attributes,e)}addOrder(e,i,r){if(t.FetchXml.Util.isOrder(e))return this.orders.push(e),this;if(!t.FetchXml.Util.isString(e))throw new Error("Sdk.FetchXml.entity addOrder method orderOrAttribute parameter must be a Sdk.FetchXml.order value or a string.");return this.orders.push(new t.FetchXml.order(e,i,r)),this}removeOrderByRef(e){if(!t.FetchXml.Util.isOrder(e))throw new Error("Sdk.FetchXml.entity removeOrderByRef method order parameter must be an Sdk.FetchXml.order.");return t.FetchXml.Util.removeCollectionValueByRef(this.orders,e),this}removeOrder(e){if(!t.FetchXml.Util.isOrder(e))throw new Error("Sdk.FetchXml.entity removeOrder method order parameter must be an Sdk.FetchXml.order.");return t.FetchXml.Util.removeCollectionValue(this.orders,e),this}setName(t){return this.name=t,this}setAllAttributes(e){if(t.FetchXml.Util.isBoolean(e))this.allAttributes=e;else{if(!t.FetchXml.Util.isNullOrUndefined(e))throw new Error("Sdk.FetchXml.entity setAllAttributes method allAttributes parameter must be a boolean value or null.");this.allAttributes=!0}return this}addLinkEntity(e){if(t.FetchXml.Util.isLinkEntity(e))return this.linkEntities.push(e),this;throw new Error("Sdk.FetchXml.entity addLinkEntity method linkEntity parameter must be a Sdk.FetchXml.linkEntity value.")}removeLinkEntityByRef(e){if(!t.FetchXml.Util.isLinkEntity(e))throw new Error("Sdk.FetchXml.entity removeLinkEntityByRef method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return t.FetchXml.Util.removeCollectionValueByRef(this.linkEntities,e),this}removeLinkEntity(e){if(!t.FetchXml.Util.isLinkEntity(e))throw new Error("Sdk.FetchXml.entity removeLinkEntity method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return t.FetchXml.Util.removeCollectionValue(this.linkEntities,e),this}addFilter(e){if(t.FetchXml.Util.isFilter(e))return this.filters.push(e),this;throw new Error("Sdk.FetchXml.entity addFilter method filter parameter must be a Sdk.FetchXml.filter value.")}removeFilterByRef(e){if(!t.FetchXml.Util.isFilter(e))throw new Error("Sdk.FetchXml.entity removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return t.FetchXml.Util.removeCollectionValueByRef(this.filters,e),this}removeFilter(e){if(!t.FetchXml.Util.isFilter(e))throw new Error("Sdk.FetchXml.entity removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return t.FetchXml.Util.removeCollectionValue(this.filters,e),this}toXml(t){var e=t.createElement("entity");return this.allAttributes?e.appendChild(t.createElement("all-attributes")):this.attributes.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.orders.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.linkEntities.forEach((function(i,r){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i,r){e.appendChild(i.toXml(t))})),e.setAttribute("name",this.name),e}static entityFromXml(e){var i=new t.FetchXml.entity(e.attributes.getNamedItem("name").nodeValue);i.allAttributes=1==e.getElementsByTagName("all-attributes").length;for(var r=0;r<e.childNodes.length;r++)"attribute"==e.childNodes[r].nodeName&&i.addAttribute(l.attributeFromXml(e.childNodes[r])),"order"==e.childNodes[r].nodeName&&i.addOrder(m.orderFromXml(e.childNodes[r])),"link-entity"==e.childNodes[r].nodeName&&i.addLinkEntity(d.linkEntityFromXml(e.childNodes[r])),"filter"==e.childNodes[r].nodeName&&i.addFilter(c.filterFromXml(e.childNodes[r]));return i}};u=y([k],u),e.entity=u;let h=class{constructor(e){if(this._aggregate=null,this._count=null,this._distinct=null,this._mapping=null,this._minActiveRowVersion=null,this._noLock=null,this._order=null,this._outputFormat=null,this._page=null,this._pagingCookie=null,this._returnTotalRecordCount=null,this._top=null,this._utcOffset=null,this._version=null,!(this instanceof t.FetchXml.fetch))return new t.FetchXml.fetch(e);e&&(this.entity=e)}get aggregate(){return this._aggregate}set aggregate(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.aggregate must be a boolean value or null.");this._aggregate=e}get count(){return this._count}set count(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.count must be a number value or null.");this._count=e}get distinct(){return this._distinct}set distinct(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.distinct must be a boolean value or null.");this._distinct=e}get entity(){return this._entity}set entity(e){if(!t.FetchXml.Util.isEntity(e))throw new Error("Sdk.FetchXml.fetch.entity must be a Sdk.FetchXml.entity value.");this._entity=e}get mapping(){return this._mapping}set mapping(e){if(!t.FetchXml.Util.isEnumMemberOrNull(t.FetchXml.Mapping,e))throw new Error("Sdk.FetchXml.fetch.mapping must be a Sdk.FetchXml.Mapping value or null.");this._mapping=e}get minActiveRowVersion(){return this._minActiveRowVersion}set minActiveRowVersion(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.minActiveRowVersion must be a boolean value or null.");this._minActiveRowVersion=e}get noLock(){return this._noLock}set noLock(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.noLock must be a boolean value or null.");this._noLock=e}get order(){return this._order}set order(e){if(!t.FetchXml.Util.isOrderOrNull(e))throw new Error("Sdk.FetchXml.fetch.order must be a Sdk.FetchXml.order value or null.");this._order=e}get outputFormat(){return this._outputFormat}set outputFormat(e){if(!t.FetchXml.Util.isEnumMemberOrNull(t.FetchXml.OutputFormat,e))throw new Error("Sdk.FetchXml.fetch.outputFormat must be a Sdk.FetchXml.OutputFormat value or null.");this._outputFormat=e}get page(){return this._page}set page(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.page must be a number value or null.");this._page=e}get pagingCookie(){return this._pagingCookie}set pagingCookie(e){if(!t.FetchXml.Util.isStringOrNull(e))throw new Error("Sdk.FetchXml.fetch.pagingCookie must be a string value or null.");this._pagingCookie=e}get returnTotalRecordCount(){return this._returnTotalRecordCount}set returnTotalRecordCount(e){if(!t.FetchXml.Util.isBooleanOrNull(e))throw new Error("Sdk.FetchXml.fetch.returnTotalRecordCount must be a boolean value or null.");this._returnTotalRecordCount=e}get top(){return this._top}set top(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.top must be a number value or null.");this._top=e}get utcOffset(){return this._utcOffset}set utcOffset(e){if(!t.FetchXml.Util.isNumberOrNull(e))throw new Error("Sdk.FetchXml.fetch.utcOffset must be a number value or null.");this._utcOffset=e}get version(){return this._version}set version(e){if(!t.FetchXml.Util.isStringOrNull(e))throw new Error("Sdk.FetchXml.fetch.version must be a string value or null.");this._version=e}setAggregate(t){return this.aggregate=t||null,this}setCount(t){return this.count=t||null,this}setDistinct(t){return this.distinct=t||null,this}setEntity(t){return this.entity=t,this}setMapping(t){return this.mapping=t||null,this}setMinActiveRowVersion(t){return this.minActiveRowVersion=t||null,this}setNoLock(t=null){return this.noLock=t,this}setOrder(t=null){return this.order=t,this}setOutputFormat(t){return this.outputFormat=t||null,this}setPage(t){return this.page=t||null,this}setPagingCookie(t=null){return this.pagingCookie=t,this}setReturnTotalRecordCount(t){return this.returnTotalRecordCount=t||null,this}setTop(t){return this.top=t||null,this}setUtcOffset(t){return this.utcOffset=t||null,this}setVersion(t){return this.version=t||null,this}toXml(){var t=(new DOMParser).parseFromString("<fetch />","text/xml");return this.version&&t.documentElement.setAttribute("version",this.version),this.outputFormat&&t.documentElement.setAttribute("output-format",this.outputFormat),this.mapping&&t.documentElement.setAttribute("mapping",this.mapping),this.aggregate&&t.documentElement.setAttribute("aggregate",this.aggregate?"true":"false"),this.count&&t.documentElement.setAttribute("count",this.count.toString()),this.distinct&&t.documentElement.setAttribute("distinct",this.distinct?"true":"false"),this.entity&&t.documentElement.appendChild(this.entity.toXml(t)),this.minActiveRowVersion&&t.documentElement.setAttribute("min-active-row-version",this.minActiveRowVersion?"true":"false"),this.noLock&&t.documentElement.setAttribute("no-lock",this.noLock?"true":"false"),this.order&&t.documentElement.appendChild(this.order.toXml(t)),this.page&&t.documentElement.setAttribute("page",this.page.toString()),this.pagingCookie&&t.documentElement.setAttribute("paging-cookie",this.pagingCookie),this.returnTotalRecordCount&&t.documentElement.setAttribute("returntotalrecordcount",this.returnTotalRecordCount?"true":"false"),this.top&&t.documentElement.setAttribute("top",this.top.toString()),this.utcOffset&&t.documentElement.setAttribute("utc-offset",this.utcOffset.toString()),(new XMLSerializer).serializeToString(t)}static fromXml(e){var i=(new DOMParser).parseFromString(e,"text/xml"),r=new t.FetchXml.fetch;if("fetch"!=i.documentElement.localName)throw new Error("The XML string is not a valid fetchXML document");t.FetchXml.Util.parseAttributes(i.documentElement,r,((t,e,i)=>{switch(e){case"count":case"top":case"page":t[e]=parseInt(i,10);break;case"utc-offset":isNaN(i)?t.utcOffset=null:t.utcOffset=parseInt(i,10);break;case"paging-cookie":t.pagingCookie=i;break;case"min-active-row-version":t.minActiveRowVersion="true"==i;break;case"output-format":t.outputFormat=i;break;case"returntotalrecordcount":t.returnTotalRecordCount="true"==i;break;case"no-lock":t.noLock="true"==i;break;case"aggregate":case"distinct":t[e]="true"==i;break;default:t[e]=i}}));for(var s=0;s<i.documentElement.childNodes.length;s++)"entity"==i.documentElement.childNodes[s].nodeName&&(r.entity=t.FetchXml.entity.entityFromXml(i.documentElement.childNodes[s])),"order"==i.documentElement.childNodes[s].nodeName&&(r.order=t.FetchXml.order.orderFromXml(i.documentElement.childNodes[s]));return r}};h=y([k],h),e.fetch=h;let c=r=class{constructor(t,e,i){if(this._conditions=[],this._filters=[],this._type=null,this._isQuickFindFields=null,!(this instanceof r))return new r(t,e,i);t&&(this.type=t),e&&(this.conditions=e),i&&(this.filters=i)}get conditions(){return this._conditions}set conditions(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.filter.conditions must be an array of Sdk.FetchXml.condition or null.");this._conditions=null==t?[]:t}get filters(){return this._filters}set filters(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.filter.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==t?[]:t}get type(){return this._type}set type(t){this._type=t}get isQuickFindFields(){return this._isQuickFindFields}set isQuickFindFields(t){this._isQuickFindFields=t}addCondition(t,e,i){return g.isCondition(t)?this.conditions.push(t):this.conditions.push(new o(t,e,i)),this}removeConditionByRef(t){if(!g.isCondition(t))throw new Error("Sdk.FetchXml.filter removeConditionByRef method condition parameter must be an Sdk.FetchXml.condition.");return g.removeCollectionValueByRef(this.conditions,t),this}removeCondition(t){if(!g.isCondition(t))throw new Error("Sdk.FetchXml.filter removeCondition method condition parameter must be an Sdk.FetchXml.condition.");return g.removeCollectionValue(this.conditions,t),this}addFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter addFilter method filter parameter must be a Sdk.FetchXml.filter value.");return this.filters.push(t),this}removeFilterByRef(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValueByRef(this.filters,t),this}removeFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.filter removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValue(this.filters,t),this}setIsQuickFindFields(t){return this.isQuickFindFields=t,this}setType(t){return this.type=t,this}toXml(t){var e=t.createElement("filter");return this.type&&e.setAttribute("type",this.type),g.isBoolean(this.isQuickFindFields)&&e.setAttribute("isquickfindfields",this.isQuickFindFields.toString()),this.conditions.forEach((function(i){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i){e.appendChild(i.toXml(t))})),e}static filterFromXml(t){var e=new r;g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"type":t.type=i;break;case"isquickfindfields":t.isQuickFindFields="true"==i||"1"==i}}));for(var i=0;i<t.childNodes.length;i++)"condition"==t.childNodes[i].nodeName&&e.addCondition(o.conditionFromXml(t.childNodes[i])),"filter"==t.childNodes[i].nodeName&&e.addFilter(r.filterFromXml(t.childNodes[i]));return e}};c=r=y([k],c),e.filter=c;let d=s=class{constructor(t,e,i,r,n){if(this._name=null,this._alias=null,this._from=null,this._intersect=null,this._linktype=null,this._to=null,this._visible=null,this._allAttributes=null,this._attributes=[],this._orders=[],this._linkEntities=[],this._filters=[],!(this instanceof s))return new s(t,e,i,r,n);this.name=t,e&&(this.from=e),i&&(this.to=i),r&&(this.linktype=r),n&&(this.alias=n)}get name(){return this._name}set name(t){this._name=t}get alias(){return this._alias}set alias(t){this._alias=t}get from(){return this._from}set from(t){this._from=t}get intersect(){return this._intersect}set intersect(t){this._intersect=t}get linktype(){return this._linktype}set linktype(t){this._linktype=t}get to(){return this._to}set to(t){this._to=t}get visible(){return this._visible}set visible(t){this._visible=t}get allAttributes(){return this._allAttributes}set allAttributes(t){this._allAttributes=t}get attributes(){return this._attributes}set attributes(t){if(!g.isAttributeArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.attributes must be an array of Sdk.FetchXml.attribute or null.");this._attributes=null==t?[]:t}get orders(){return this._orders}set orders(t){if(!g.isOrderArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.orders must be an array of Sdk.FetchXml.order or null.");this._orders=null==t?[]:t}get linkEntities(){return this._linkEntities}set linkEntities(t){if(!g.isLinkEntityArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.linkEntities must be an array of Sdk.FetchXml.linkEntity or null.");this._linkEntities=null==t?[]:t}get filters(){return this._filters}set filters(t){if(!g.isFilterArrayOrNull(t))throw new Error("Sdk.FetchXml.linkEntity.filters must be an array of Sdk.FetchXml.filter or null.");this._filters=null==t?[]:t}get hash(){return this._name.concat(this._alias?this._alias:"",this._from?this._from:"",g.isNullOrUndefined(this._intersect)?"":this._intersect.toString(),this._linktype?this._linktype:"",this._to?this._to:"",g.isNullOrUndefined(this._visible)?"":this._visible.toString(),g.isNullOrUndefined(this._allAttributes)?"":this._allAttributes.toString(),g.getCollectionHash(this._attributes),g.getCollectionHash(this._orders),g.getCollectionHash(this._linkEntities),g.getCollectionHash(this._filters)).hashCode()}setAlias(t){return this.alias=t,this}setFrom(t){return this.from=t,this}setIntersect(t){return this.intersect=t,this}setName(t){return this.name=t,this}setTo(t){return this.to=t,this}setVisible(t){return this.visible=t,this}setAllAttributes(t){return this.allAttributes=t,this}addLinkEntity(t){if(g.isLinkEntity(t))return this.linkEntities.push(t),this;throw new Error("Sdk.FetchXml.linkEntity addLinkEntity method linkEntity parameter must be a Sdk.FetchXml.linkEntity value.")}removeLinkEntityByRef(t){if(!g.isLinkEntity(t))throw new Error("Sdk.FetchXml.linkEntity removeLinkEntityByRef method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return g.removeCollectionValueByRef(this.linkEntities,t),this}removeLinkEntity(t){if(!g.isLinkEntity(t))throw new Error("Sdk.FetchXml.linkEntity removeLinkEntity method linkEntity parameter must be an Sdk.FetchXml.linkEntity.");return g.removeCollectionValue(this.linkEntities,t),this}addAttribute(t){if(g.isAttribute(t))return this.attributes.push(t),this;if(g.isString(t))return this.attributes.push(new t(t)),this;throw new Error("Sdk.FetchXml.linkEntity addAttribute method attribute parameter must be a Sdk.FetchXml.attribute value or a string.")}removeAttributeByRef(t){if(!g.isAttribute(t))throw new Error("Sdk.FetchXml.linkEntity removeAttributeByRef method attribute parameter must be an Sdk.FetchXml.attribute.");return g.removeCollectionValueByRef(this.attributes,t),this}removeAttribute(t){if(!g.isAttribute(t))throw new Error("Sdk.FetchXml.linkEntity removeAttribute method attribute parameter must be an Sdk.FetchXml.attribute.");return g.removeCollectionValue(this.attributes,t),this}removeAttributeByName(t){if(!g.isString(t))throw new Error("Sdk.FetchXml.linkEntity removeAttributeByName method attributeName parameter must be a string.");return g.removeCollectionValueByProperty(this.attributes,"name",t),this}addOrder(t,e,i){if(g.isOrder(t))return this.orders.push(t),this;if(g.isString(t))return this.orders.push(new m(t,e,i)),this;throw new Error("Sdk.FetchXml.linkEntity addOrder method orderOrAttribute parameter must be a Sdk.FetchXml.order value or a string.")}removeOrderByRef(t){if(!g.isOrder(t))throw new Error("Sdk.FetchXml.linkEntity removeOrderByRef method order parameter must be an Sdk.FetchXml.order.");return g.removeCollectionValueByRef(this.orders,t),this}removeOrder(t){if(!g.isOrder(t))throw new Error("Sdk.FetchXml.linkEntity removeOrder method order parameter must be an Sdk.FetchXml.order.");return g.removeCollectionValue(this.orders,t),this}addFilter(t){if(g.isFilter(t))return this.filters.push(t),this;throw new Error("Sdk.FetchXml.linkEntity addFilter method filter parameter must be a Sdk.FetchXml.filter value.")}removeFilterByRef(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.linkEntity removeFilterByRef method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValueByRef(this.filters,t),this}removeFilter(t){if(!g.isFilter(t))throw new Error("Sdk.FetchXml.linkEntity removeFilter method filter parameter must be an Sdk.FetchXml.filter.");return g.removeCollectionValue(this.filters,t),this}toXml(t){var e=t.createElement("link-entity");return this.alias&&e.setAttribute("alias",this.alias),this.allAttributes&&e.appendChild(t.createElement("all-attributes")),this.from&&e.setAttribute("from",this.from),g.isBoolean(this.intersect)&&e.setAttribute("intersect",this.intersect.toString()),this.linktype&&e.setAttribute("link-type",this.linktype),this.name&&e.setAttribute("name",this.name),this.to&&e.setAttribute("to",this.to),g.isBoolean(this.visible)&&e.setAttribute("visible",this.visible.toString()),this.attributes.forEach((function(i){e.appendChild(i.toXml(t))})),this.orders.forEach((function(i){e.appendChild(i.toXml(t))})),this.linkEntities.forEach((function(i){e.appendChild(i.toXml(t))})),this.filters.forEach((function(i){e.appendChild(i.toXml(t))})),e}static linkEntityFromXml(t){var e=t.attributes.getNamedItem("name").nodeValue,i=new s(e);i.allAttributes=1==t.getElementsByTagName("all-attributes").length,g.parseAttributes(t,i,((t,e,i)=>{switch(e){case"to":case"from":case"alias":t[e]=i;break;case"link-type":t.linktype=i;break;case"visible":case"intersect":t[e]="true"==i}}));for(var r=0;r<t.childNodes.length;r++)"attribute"==t.childNodes[r].nodeName&&i.addAttribute(l.attributeFromXml(t.childNodes[r])),"order"==t.childNodes[r].nodeName&&i.addOrder(m.orderFromXml(t.childNodes[r])),"filter"==t.childNodes[r].nodeName&&i.addFilter(c.filterFromXml(t.childNodes[r])),"link-entity"==t.childNodes[r].nodeName&&i.addLinkEntity(s.linkEntityFromXml(t.childNodes[r]));return i}};d=s=y([k],d),e.linkEntity=d;let m=n=class{constructor(t,e,i){if(this._attribute=null,this._descending=null,this._alias=null,!(this instanceof n))return new n(t,e,i);t&&(this.attribute=t),e&&(this.descending=e),i&&(this.alias=i)}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get descending(){return this._descending}set descending(t){this._descending=t}get alias(){return this._alias}set alias(t){this._alias=t}get hash(){return"".concat(this._attribute?this._attribute:"",this._alias?this._alias:"",this._descending.toString()).hashCode()}setAttribute(t){return this.attribute=t,this}setAlias(t){return this.alias=t,this}setDescending(t){return this.descending=t,this}toXml(t){var e=t.createElement("order");return this.attribute&&e.setAttribute("attribute",this.attribute),this.alias&&e.setAttribute("alias",this.alias),g.isNullOrUndefined(this.descending)||e.setAttribute("descending",this.descending.toString()),e}static orderFromXml(t){var e=new n;return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"attribute":t.attribute=i;break;case"alias":t.alias=i;break;case"descending":t.descending="true"==i}})),e}};m=n=y([k],m),e.order=m;let f=a=class{constructor(e,i,r){if(this._value=null,this._uiname=null,this._uitype=null,!(this instanceof t.FetchXml.value))return new e(e,i,r);e&&(this.value=e),i&&(this.uiname=i),r&&(this.uitype=r)}get value(){return this._value}set value(t){this._value=t}get uiname(){return this._uiname}set uiname(t){this._uiname=t}get uitype(){return this._uitype}set uitype(t){this._uitype=t}setValue(t){return this.value=t,this}setUIname(t){return this.uiname=t,this}setUItype(t){return this.uitype=t,this}toXml(t){var e=t.createElement("value");return this.uitype&&e.setAttribute("uitype",this.uitype),this.uiname&&e.setAttribute("uiname",this.uiname),e.appendChild(t.createTextNode(this.value)),e}static valueFromXml(t){var e=new a(t.textContent);return g.parseAttributes(t,e,((t,e,i)=>{switch(e){case"uiname":case"uitype":t[e]=i}})),e}};f=a=y([k],f),e.value=f;class g{static isBoolean(t){return"boolean"==typeof t}static isBooleanOrNull(t){return g.isNull(t)||g.isBoolean(t)}static isNumber(t){return"number"==typeof t}static isNumberOrNull(t){return g.isNull(t)||g.isNumber(t)}static isNull(t){return null===t}static isNullOrUndefined(t){return null==t}static isEnumMember(t,e){for(var i in t)if(e===t[i])return!0;return!1}static isEnumMemberOrNull(t,e){return g.isNull(e)||g.isEnumMember(t,e)}static isString(t){return"string"==typeof t}static isStringOrNull(t){return g.isNull(t)||g.isString(t)}static isOrder(t){return t instanceof m}static isOrderOrNull(t){return g.isNull(t)||g.isOrder(t)}static isOrderArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isOrder(t))return!1})),!0)}static isOrderArrayOrNull(t){return g.isNull(t)||g.isOrderArray(t)}static isEntity(t){return t instanceof u}static isAttribute(t){return t instanceof l}static isAttributeArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isAttribute(t))return!1})),!0)}static isAttributeArrayOrNull(t){return g.isNull(t)||g.isAttributeArray(t)}static isLinkEntity(t){return t instanceof d}static isLinkEntityOrNull(t){return g.isNull(t)||g.isLinkEntity(t)}static isLinkEntityArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isLinkEntity(t))return!1})),!0)}static isLinkEntityArrayOrNull(t){return g.isNull(t)||g.isLinkEntityArray(t)}static isFilter(t){return t instanceof c}static isFilterOrNull(t){return g.isNull(t)||g.isFilter(t)}static isFilterArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isFilter(t))return!1})),!0)}static isFilterArrayOrNull(t){return g.isNull(t)||g.isFilterArray(t)}static isCondition(t){return t instanceof o}static isConditionOrNull(t){return g.isNull(t)||g.isCondition(t)}static isConditionArray(t){return!!Array.isArray(t)&&(t.forEach((function(t){if(!g.isCondition(t))return!1})),!0)}static isConditionArrayOrNull(t){return g.isNull(t)||g.isConditionArray(t)}static isValue(t){return t instanceof f}static isValueOrNull(t){return g.isNull(t)||g.isValue(t)}static isValueArray(t){if(Array.isArray(t)){var e=!0;return t.forEach((function(t){g.isValue(t)||(e=!1)})),e}return!1}static isValueArrayOrNull(t){return g.isNull(t)||g.isValueArray(t)}static getEnumNameFromValue(t,e){for(var i in t)if(t[i]==e)return i}static getCollectionHash(t){var e=[];return t.forEach((function(t){e.push(t.hash)})),e.join()}static removeCollectionValue(t,e){g.removeCollectionValueByProperty(t,"hash",e)}static removeCollectionValueByProperty(t,e,i){var r=[];t.forEach((function(t,s){t[e]==i[e]&&r.push(t)})),r.forEach((function(e){g.removeCollectionValueByRef(t,e)}))}static removeCollectionValueByRef(t,e){var i=[];if(t.forEach((function(t,r){t===e&&i.push(r)})),i.length>0)for(var r=i.length-1;r>=0;r--)t.splice(i[r],1)}static convertFetchBoolType(t){switch(t){case"true":case"1":return!0;case"false":case"0":return!1;default:throw new Error("Unexpected FetchBoolType value")}}static parseAttributes(t,e,i){for(var r=t.attributes,s=0;s<r.length;s++){i(e,r[s].nodeName,r[s].nodeValue)}}}e.Util=g;let p=class{};p.Internal="internal",p.Logical="logical",p=y([F],p),e.Mapping=p;let b=class{};b.Ado="xml-ado",b.Auto="xml-auto",b.Elements="xml-elements",b.Raw="xml-raw",b.Platform="xml-platform",b=y([F],b),e.OutputFormat=b;let v=class{};v.OnePoint504021="1.504021",v.OnePoint003017="1.003017",v=y([F],v),e.Build=v;let X=class{};X.Count="count",X.CountColumn="countcolumn",X.Sum="sum",X.Avg="avg",X.Min="min",X.Max="max",X=y([F],X),e.Aggregate=X;let w=class{};w.Countchildren="countchildren",w=y([F],w),e.RowAggregate=w;let E=class{};E.Day="day",E.Week="week",E.Month="month",E.Quarter="quarter",E.Year="year",E.FiscalPeriod="fiscal-period",E.FiscalYear="fiscal-year",E=y([F],E),e.DateGrouping=E;let _=class{};_.Above="above",_.BeginsWith="begins-with",_.Between="between",_.EndsWith="ends-with",_.Equal="eq",_.EqualBusinessId="eq-businessid",_.EqualOrAbove="eq-or-above",_.EqualOrUnder="eq-or-under",_.EqualUserId="eq-userid",_.EqualUserLanguage="eq-userlanguage",_.EqualUserOrUserHierarchy="eq-useroruserhierarchy",_.EqualUserOrUserHierarchyAndTeams="eq-useroruserhierarchyandteams",_.EqualUserOrUserTeams="eq-useroruserteams",_.EqualUserTeams="eq-userteams",_.GreaterOrEqual="ge",_.GreaterThan="gt",_.In="in",_.InFiscalPeriod="in-fiscal-period",_.InFiscalPeriodAndYear="in-fiscal-period-and-year",_.InFiscalYear="in-fiscal-year",_.InOrAfterFiscalPeriodAndYear="in-or-after-fiscal-period-and-year",_.InOrBeforeFiscalPeriodAndYear="in-or-before-fiscal-period-and-year",_.LastFiscalPeriod="last-fiscal-period",_.LastFiscalYear="last-fiscal-year",_.LastMonth="last-month",_.LastSevenDays="last-seven-days",_.LastWeek="last-week",_.LastXDays="last-x-days",_.LastXFiscalPeriods="last-x-fiscal-periods",_.LastXFiscalYears="last-x-fiscal-years",_.LastXHours="last-x-hours",_.LastXMonths="last-x-months",_.LastXWeeks="last-x-weeks",_.LastXYears="last-x-years",_.LastYear="last-year",_.LessOrEqual="le",_.Like="like",_.LessThan="lt",_.NotEqual="ne",_.NotEqualBusinessId="ne-businessid",_.NotEqualUserId="ne-userid",_.Neq="neq",_.NextFiscalPeriod="next-fiscal-period",_.NextFiscalYear="next-fiscal-year",_.NextMonth="next-month",_.NextSevenDays="next-seven-days",_.NextWeek="next-week",_.NextXDays="next-x-days",_.NextXFiscalPeriods="next-x-fiscal-periods",_.NextXFiscalYears="next-x-fiscal-years",_.NextXHours="next-x-hours",_.NextXMonths="next-x-months",_.NextXWeeks="next-x-weeks",_.NextXYears="next-x-years",_.NextYear="next-year",_.NotBeginWith="not-begin-with",_.NotBetween="not-between",_.NotEndWith="not-end-with",_.NotIn="not-in",_.NotLike="not-like",_.NotNull="not-null",_.NotUnder="not-under",_.Null="null",_.OlderThanXDays="olderthan-x-days",_.OlderThanXHours="olderthan-x-hours",_.OlderThanXMinutes="olderthan-x-minutes",_.OlderThanXMonths="olderthan-x-months",_.OlderThanXWeeks="olderthan-x-weeks",_.OlderThanXYears="olderthan-x-years",_.On="on",_.OnOrAfter="on-or-after",_.OnOrBefore="on-or-before",_.ThisFiscalPeriod="this-fiscal-period",_.ThisFiscalYear="this-fiscal-year",_.ThisMonth="this-month",_.ThisWeek="this-week",_.ThisYear="this-year",_.Today="today",_.Tomorrow="tomorrow",_.Under="under",_.Yesterday="yesterday",_=y([F],_),e.Operator=_;let N=class{};N.And="and",N.Or="or",N=y([F],N),e.FilterType=N}(t.FetchXml||(t.FetchXml={}))}(v||(v={})),String.prototype.hashCode=function(){let t=0;if(0==this.length)return t.toString();for(let e=0;e<this.length;e++){t=(t<<5)-t+this.charCodeAt(e),t&=t}return t.toString()};const X=t=>{const e=t.parameters.value.attributes.Targets,i=t.parameters.value.raw,n=t.context,[l,o]=a("Lookup",t,b),[u,h]=(t=>{const e=r({});return[i=>p(void 0,void 0,void 0,(function*(){return e.current[i]||(e.current[i]=t.webAPI.retrieveRecord("savedquery",i,"?$select=fetchxml")),(yield e.current[i]).fetchxml})),(t,e,i)=>p(void 0,void 0,void 0,(function*(){if(!i)return e;const r=yield t.metadata,s=v.FetchXml.fetch.fromXml(e);return s.entity.addFilter(new v.FetchXml.filter(v.FetchXml.FilterType.Or,[new v.FetchXml.condition(r.PrimaryNameAttribute,v.FetchXml.Operator.Like,[new v.FetchXml.value(`%${i}%`)])])),s.toXml()}))]})(n),[c,d]=s((()=>e.map((i=>({entityName:i,selected:1===e.length,metadata:t.context.utils.getEntityMetadata(i,[])}))))),m=c.find((t=>t.selected)),f=(e,i)=>p(void 0,void 0,void 0,(function*(){const r=(yield t.parameters.value.getAllViews(e)).find((t=>t.isDefault));if(!(null==r?void 0:r.viewId))throw new Error(`Entity ${e} does not have a default view id!`);let s=null==r?void 0:r.fetchXml;return s||(s=yield u(r.viewId)),h(c.find((t=>t.entityName===e)),s,i)}));return[i,c,l,{create:t=>p(void 0,void 0,void 0,(function*(){const e=yield n.navigation.openForm({entityName:t,useQuickCreateForm:!0});e.savedEntityReference&&o({value:e.savedEntityReference})})),deselect:t=>{const e=new Map(i.map((t=>[t.id,t])));e.delete(t.id),o({value:[...e.values()]})},select:t=>{o({value:t})}},t=>{d([...c].map((e=>({entityName:e.entityName,metadata:e.metadata,selected:e.entityName===t}))))},i=>p(void 0,void 0,void 0,(function*(){if(t.onSearch)return t.onSearch(m?[null==m?void 0:m.entityName]:e,i);const r=new Map;if(m)r.set(m.entityName,f(m.entityName,i));else for(const t of e)r.set(t,f(t,i));yield Promise.all(r.values());const s=new Map;for(const[t,e]of r)s.set(t,n.webAPI.retrieveMultipleRecords(t,`?fetchXml=${encodeURIComponent(yield e)}`));yield Promise.all(s.values());const a=[];for(const[t,e]of s)for(const i of(yield e).entities){const e=yield c.find((e=>e.entityName===t)).metadata;a.push({entityType:t,id:i[e.PrimaryIdAttribute],name:i[e.PrimaryNameAttribute]})}return a}))]},w=(t,e,i)=>{const r=(t=>{if(-1!==t&&0!==t)return t})(e);return l({root:{'[class*="TALXIS__tag-picker__search-btn"][class*="TALXIS__tag-picker__search-btn"]':{top:0,bottom:0,margin:"auto 0",right:5},'[data-navigation-enabled="true"]':{"> span > div > span":{color:t.semanticColors.link,cursor:"pointer"},":hover":{textDecoration:"underline",cursor:"pointer !important"}},".ms-BasePicker-itemsWrapper .ms-CommandBar":{height:r&&i?r-6:void 0},".ms-BasePicker-text":{minHeight:null!=r?r:36,height:"min-content",paddingRight:i?void 0:36,alignItems:"baseline",input:{alignSelf:"center"},".hover-only":{animationName:"none"},"::after":{inset:"0px !important"}}},suggestions:{".ms-Suggestions-title":{padding:0,display:"flex",flexDirection:"column"}},createRecordBtn:{height:38,width:"100%",".ms-Button-menuIcon":{display:"none"},">.ms-Button-flexContainer.ms-Button-flexContainer":{justifyContent:"flex-start"},".ms-Button-textContainer":{flexGrow:"initial",">span":{fontWeight:600}}}})},E=t=>{const[e,i]=s(null);return n((()=>{p(void 0,void 0,void 0,(function*(){i(yield Promise.all(t.map((t=>p(void 0,void 0,void 0,(function*(){return{entityName:t.entityName,selected:t.selected,metadata:yield t.metadata}}))))))}))}),[t]),[e]},_=r=>{const{labels:s,entities:n,onEntitySelected:a}=Object.assign({},r),[h]=E(n),c=(t=>l({targetSelector:{display:"flex",paddingLeft:8,paddingRight:8,paddingBottom:8,gap:8,paddingTop:8,">span":{lineHeight:15,minWidth:"fit-content",color:t.semanticColors.listText,fontWeight:600}},targetSelectorLinks:{display:"flex",gap:5,flexWrap:"wrap"},targetSelectorLink:{color:t.palette.blackTranslucent40,'&[data-selected="true"]':{color:t.semanticColors.link,fontWeight:600}}}))(o());return t("div",Object.assign({className:c.targetSelector},{children:[t(d,Object.assign({variant:"small"},{children:[s.resultsFrom()," "]})),t("div",Object.assign({className:c.targetSelectorLinks},{children:[e(u,Object.assign({onClick:()=>a(null),className:c.targetSelectorLink,"data-selected":!n.find((t=>t.selected))},{children:"All"})),h&&e(i,{children:h.map((t=>e(u,Object.assign({className:c.targetSelectorLink,"data-selected":t.selected,onClick:()=>a(t.entityName)},{children:t.metadata.DisplayName}))))})]}))]}))},N=t=>{const{labels:i,entities:r,onCreateRecord:s}=Object.assign({},t),[n]=E(r),a=o(),l=w(a,0),u=r.find((t=>t.selected));return e(f,{className:l.createRecordBtn,iconProps:{iconName:"Add"},onClick:u?()=>s(u.entityName):void 0,menuProps:u?void 0:{calloutProps:{coverTarget:!1},isBeakVisible:!0,items:n?[{key:"header",itemType:h.Header,text:"Vyberte tabulku"},...n.map((t=>({key:t.entityName,text:t.metadata.DisplayName,onClick:()=>s(t.entityName)})))]:[]},text:i.newRecord()})},A=s=>{var a,l;const u=s.context,h=r(null),d=r(null),f=!0===(null===(a=s.parameters.MultipleEnabled)||void 0===a?void 0:a.raw)?1/0:1,y=o(),b=w(y,u.mode.allocatedHeight,1===f),[v,k,F,E,A,S]=X(s),O=m(h),x=g(h),C=r(!0),B=r(!1);n((()=>{C.current?C.current=!1:d.current.state.suggestionsVisible&&V()}),[k]),n((()=>{const t=t=>{var e;if("Backspace"===t.key){const t=null===(e=h.current)||void 0===e?void 0:e.querySelector('[class*="TALXIS__tag-picker__root"]');document.activeElement===t&&1===v.length&&(E.select(void 0),setTimeout((()=>{var t;null===(t=d.current)||void 0===t||t.focusInput()}),200))}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[v]),n((()=>{var t;!0===(null===(t=s.parameters.AutoFocus)||void 0===t?void 0:t.raw)&&U()}),[]);const U=()=>{var t,e,i,r;(null===(e=null===(t=d.current)||void 0===t?void 0:t.items)||void 0===e?void 0:e.length)!==f?null===(r=d.current)||void 0===r||r.focusInput():null===(i=h.current)||void 0===i||i.querySelector('[class*="TALXIS__tag-picker__root"]').focus()},V=()=>p(void 0,void 0,void 0,(function*(){d.current.suggestionStore.updateSuggestions([]),d.current.setState({suggestionsVisible:!0,suggestionsLoading:!0});const t=yield T(d.current.input.current.value);d.current.updateSuggestionsList(t),d.current.setState({isMostRecentlyUsedVisible:!1,suggestionsVisible:!0,moreSuggestionsAvailable:!1})})),R=()=>O||x,T=(t,e)=>p(void 0,void 0,void 0,(function*(){var i;const r=yield S(t),s=[];for(const t of r){if(null==e?void 0:e.find((e=>e.key===t.id)))continue;const r=yield null===(i=k.find((e=>e.entityName===t.entityType)))||void 0===i?void 0:i.metadata;s.push({key:t.id,text:t.name||F.noName(),secondaryText:null==r?void 0:r.DisplayName,"data-entity":t.entityType})}return s}));return e("div",Object.assign({className:b.root,ref:h},{children:e(c,{componentRef:d,resolveDelay:200,stackItems:1===f,pickerCalloutProps:{className:b.suggestions},pickerSuggestionsProps:{loadingText:F.searching(),noResultsFoundText:F.noRecordsFound(),suggestionsHeaderText:t(i,{children:[!1!==(null===(l=s.parameters.IsInlineNewEnabled)||void 0===l?void 0:l.raw)&&e(N,{labels:F,entities:k,onCreateRecord:E.create}),s.parameters.value.attributes.Targets.length>1&&e(_,{labels:F,entities:k,onEntitySelected:t=>{A(t)}})]})},transparent:!R()&&1===f,onChange:t=>{E.select(null==t?void 0:t.map((t=>({entityType:t["data-entity"],id:t.key,name:t.text}))))},searchBtnProps:{iconProps:{iconName:"Search"}},selectedItems:v.map((t=>{var e;return{key:t.id,text:t.name||F.noName(),"data-entity":t.entityType,"data-navigation-enabled":!1!==(null===(e=s.parameters.EnableNavigation)||void 0===e?void 0:e.raw),onClick:()=>{var e;!1!==(null===(e=s.parameters.EnableNavigation)||void 0===e?void 0:e.raw)&&u.navigation.openForm({entityName:t.entityType,entityId:t.id})},deleteButtonProps:R()||f>1?{key:"delete",iconProps:{iconName:"ChromeClose",styles:{root:{fontSize:12,width:16,color:`${y.palette.black} !important`}}},onClick:()=>{B.current=!1,E.deselect(t),setTimeout((()=>{U()}),200)}}:void 0}})),itemLimit:f,onResolveSuggestions:T})}))};export{A as L,p as _};
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import o,{createContext as r,memo as s,forwardRef as a,useContext as l,useRef as d,useState as c,useImperativeHandle as g,useLayoutEffect as u,useCallback as h,useMemo as p,useEffect as m,createElement as v,Component as f}from"react";import{useComponent as C}from"../../hooks/useComponent.js";import{_ as w,L as y}from"../../Lookup-eb1505b3.js";import b from"validator/lib/isNumeric";import E from"validator/lib/isEmail";import S from"validator/lib/isURL";import D from"dayjs";import T from"fast-deep-equal/es6";import R from"numeral";import{N as A}from"../../Numeral-a0284afb.js";import x,{createPortal as M}from"react-dom";import{renderToStaticMarkup as P}from"react-dom/server";import{mergeStyleSets as N,keyframes as I,useTheme as L,TooltipHost as F,Icon as O,Checkbox as _,Image as k,Callout as G,IconButton as z,PrimaryButton as V,Button as H,ContextualMenuItemType as B,ContextualMenu as W,CommandBarButton as U,Label as j,DialogFooter as K,Spinner as Y,SpinnerSize as $,MessageBar as Q,MessageBarType as q}from"@fluentui/react";import{DateTime as X}from"../DateTime/DateTime.js";import{Decimal as Z}from"../Decimal/Decimal.js";import{MultiSelectOptionSet as J}from"../MultiSelectOptionSet/MultiSelectOptionSet.js";import{OptionSet as ee}from"../OptionSet/OptionSet.js";import{TextField as te}from"../TextField/TextField.js";import{TwoOptions as ne}from"../TwoOptions/TwoOptions.js";import{Duration as ie}from"../Duration/Duration.js";import{Link as oe}from"@fluentui/react/lib/components/Link/Link";import{Text as re}from"@fluentui/react/lib/Text";import"external-svg-loader";import{CommandBar as se}from"@talxis/react-components/dist/components/CommandBar";import{FileAttribute as ae}from"@talxis/client-libraries";import le from"color";import{ComboBox as de}from"@talxis/react-components/dist/components/ComboBox";import{useDebounce as ce}from"use-debounce";import{useStateValues as ge}from"@talxis/react-components/dist/hooks";import{CommandBar as ue}from"@fluentui/react/lib/components/CommandBar/CommandBar";import{Dialog as he}from"@fluentui/react/lib/Dialog";import{getTheme as pe,mergeStyles as me}from"@fluentui/react/lib/Styling";import{Icon as ve}from"@fluentui/react/lib/components/Icon/Icon";import{Spinner as fe}from"@fluentui/react/lib/components/Spinner/Spinner";import"merge-anything";import"liquidjs";import"@talxis/react-components/dist/components/TagPicker";import"../../hooks/useMouseOver.js";import"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";import"../../hooks/useFocusIn.js";import"../../hooks/useInputBasedComponent.js";import"dayjs/plugin/utc";import"dayjs/plugin/customParseFormat";import"@fluentui/react/lib/utilities/ThemeProvider/useTheme";import"@fluentui/react/lib/Calendar";import"@talxis/react-components/dist/components/TimePicker";import"@talxis/react-components/dist/components/DatePicker";import"@talxis/react-components/dist/components/TextField";class Ce{constructor(e){this._refreshCallbacks=new Map,this._grid=e}addRefreshCallback(e,t){this._refreshCallbacks.set(e,t)}removeRefreshCallback(e){this._refreshCallbacks.delete(e)}onDependenciesUpdated(){}_triggerRefreshCallbacks(){for(const e of this._refreshCallbacks.values())e()}get _dataset(){return this._grid.dataset}get _pcfContext(){return this._grid.pcfContext}}var we,ye;!function(e){e[e.None=-1]="None",e[e.Equal=0]="Equal",e[e.NotEqual=1]="NotEqual",e[e.GreaterThan=2]="GreaterThan",e[e.LessThan=3]="LessThan",e[e.GreaterEqual=4]="GreaterEqual",e[e.LessEqual=5]="LessEqual",e[e.Like=6]="Like",e[e.NotLike=7]="NotLike",e[e.In=8]="In",e[e.NotIn=9]="NotIn",e[e.Null=12]="Null",e[e.NotNull=13]="NotNull",e[e.Yesterday=14]="Yesterday",e[e.Today=15]="Today",e[e.Tomorrow=16]="Tomorrow",e[e.Last7Days=17]="Last7Days",e[e.Next7Days=18]="Next7Days",e[e.LastWeek=19]="LastWeek",e[e.ThisWeek=20]="ThisWeek",e[e.LastMonth=22]="LastMonth",e[e.ThisMonth=23]="ThisMonth",e[e.On=25]="On",e[e.OnOrBefore=26]="OnOrBefore",e[e.OnOrAfter=27]="OnOrAfter",e[e.LastYear=28]="LastYear",e[e.ThisYear=29]="ThisYear",e[e.LastXDays=33]="LastXDays",e[e.NextXDays=34]="NextXDays",e[e.LastXMonths=37]="LastXMonths",e[e.NextXMonths=38]="NextXMonths",e[e.Contains=49]="Contains",e[e.BeginWith=54]="BeginWith",e[e.DoesNotBeginWith=55]="DoesNotBeginWith",e[e.EndsWith=56]="EndsWith",e[e.DoesNotEndWith=57]="DoesNotEndWith",e[e.InFiscalPeriodAndYear=70]="InFiscalPeriodAndYear",e[e.Above=75]="Above",e[e.Under=76]="Under",e[e.NotUnder=77]="NotUnder",e[e.AboveOrEqual=78]="AboveOrEqual",e[e.UnderOrEqual=79]="UnderOrEqual",e[e.ContainValues=87]="ContainValues",e[e.DoesNotContainValues=88]="DoesNotContainValues"}(we||(we={})),function(e){e.SINGLE_LINE_TEXT="SingleLine.Text",e.SINGLE_LINE_TEXT_AREA="SingleLine.TextArea",e.SINGLE_LINE_EMAIL="SingleLine.Email",e.SINGLE_LINE_PHONE="SingleLine.Phone",e.SINGLE_LINE_URL="SingleLine.URL",e.MULTIPLE="Multiple",e.WHOLE_NONE="Whole.None",e.DECIMAL="Decimal",e.FP="FP",e.DATE_AND_TIME_DATE_AND_TIME="DateAndTime.DateAndTime",e.DATE_AND_TIME_DATE_ONLY="DateAndTime.DateOnly",e.CURRENCY="Currency",e.OPTIONSET="OptionSet",e.MULTI_SELECT_OPTIONSET="MultiSelectPicklist",e.TWO_OPTIONS="TwoOptions",e.LOOKUP_SIMPLE="Lookup.Simple",e.LOOKUP_OWNER="Lookup.Owner",e.WHOLE_LANGUAGE="Whole.Language",e.WHOLE_DURATION="Whole.Duration",e.WHOLE_TIMEZONE="Whole.TimeZone",e.FILE="File",e.IMAGE="Image"}(ye||(ye={}));class be extends Ce{constructor(e,t,n){super(e),this._column=t,this._forceNullCheck=null!=n&&n}validate(e){const t=this._isNull(e);if(this._column.isRequired||this._forceNullCheck){if(t)return[!1,this._labels["validation-input-value"]()]}else if(t)return[!0,""];switch(this._column.dataType){case ye.WHOLE_NONE:case ye.DECIMAL:if(!b(e=`${e}`))return[!1,"Invalid input!"];break;case ye.SINGLE_LINE_EMAIL:if(!E(e=`${e}`))return[!1,this._labels["validation-email"]()];break;case ye.SINGLE_LINE_URL:if(!S(e=`${e}`))return[!1,this._labels["validation-url"]()];break;case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:if(!D(e).isValid())return[!1,this._labels["validation-date"]()];break;default:if(!e)return[!1,this._labels["validation-input-value"]()]}return[!0,""]}_isNull(e){return!e||(0===(null==e?void 0:e.length)||void 0)}get _labels(){return this._grid.labels}}const Ee=[{type:we.None,key:"condition-none"},{type:we.Equal,key:"condition-equal"},{type:we.NotEqual,key:"condition-notequal"},{type:we.GreaterThan,key:"condition-greaterthan"},{type:we.LessThan,key:"condition-lessthan"},{type:we.GreaterEqual,key:"condition-greaterequal"},{type:we.LessEqual,key:"condition-lessequal"},{type:we.Like,key:"condition-like"},{type:we.NotLike,key:"condition-notlike"},{type:we.In,key:"condition-in"},{type:we.NotIn,key:"condition-notin"},{type:we.Null,key:"condition-null"},{type:we.NotNull,key:"condition-notnull"},{type:we.Yesterday,key:"condition-yesterday"},{type:we.Today,key:"condition-today"},{type:we.Tomorrow,key:"condition-tomorrow"},{type:we.Last7Days,key:"condition-last7days"},{type:we.Next7Days,key:"condition-next7days"},{type:we.LastWeek,key:"condition-lastweek"},{type:we.ThisWeek,key:"condition-thisweek"},{type:we.LastMonth,key:"condition-lastmonth"},{type:we.ThisMonth,key:"condition-thismonth"},{type:we.On,key:"condition-on"},{type:we.OnOrBefore,key:"condition-onorbefore"},{type:we.OnOrAfter,key:"condition-onorafter"},{type:we.LastYear,key:"condition-lastyear"},{type:we.ThisYear,key:"condition-thisyear"},{type:we.LastXDays,key:"condition-lastxdays"},{type:we.NextXDays,key:"condition-nextxdays"},{type:we.LastXMonths,key:"condition-lastxmonths"},{type:we.NextXMonths,key:"condition-nextxmonths"},{type:we.Contains,key:"condition-contains"},{type:we.BeginWith,key:"condition-beginwith"},{type:we.DoesNotBeginWith,key:"condition-doesnotbeginwith"},{type:we.EndsWith,key:"condition-endswith"},{type:we.DoesNotEndWith,key:"condition-doesnotendwith"},{type:we.InFiscalPeriodAndYear,key:"condition-infiscalperiodandyear"},{type:we.Above,key:"condition-above"},{type:we.Under,key:"condition-under"},{type:we.NotUnder,key:"condition-notunder"},{type:we.AboveOrEqual,key:"condition-aboveorequal"},{type:we.UnderOrEqual,key:"condition-underorequal"},{type:we.ContainValues,key:"condition-containvalues"},{type:we.DoesNotContainValues,key:"condition-doesnotcontainvalues"}];class Se{static condition(){return{operator:e=>({textFieldOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.Like:case we.NotLike:case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.NotNull:case we.Null:return!0;default:return!1}})),numberOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.GreaterThan:case we.GreaterEqual:case we.LessThan:case we.LessEqual:case we.Null:return!0;default:return!1}})),dateOperators:Ee.filter((e=>{switch(e.type){case we.On:case we.OnOrAfter:case we.OnOrBefore:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisWeek:case we.ThisMonth:case we.ThisYear:case we.Next7Days:case we.NextXDays:case we.NextXMonths:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:case we.LastXDays:case we.LastXMonths:case we.Null:return!0;default:return!1}})),multipleOptionSetOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.ContainValues:case we.DoesNotContainValues:case we.Null:case we.NotNull:return!0;default:return!1}})),fileOperators:Ee.filter((e=>{switch(e.type){case we.Null:case we.NotNull:return!0;default:return!1}})),allowsOnlyFreeText:(()=>{switch(e){case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.Like:case we.NotLike:return!0}return!1})(),allowsOnlyNumber:(()=>{switch(e){case we.LastXDays:case we.LastXMonths:case we.NextXMonths:case we.NextXDays:return!0}return!1})(),doesNotAllowValue:(()=>{switch(e){case we.Null:case we.NotNull:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisWeek:case we.ThisMonth:case we.ThisYear:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:return!0;default:return!1}})()}),value:e=>({isEditable:(()=>{switch(e){case we.Null:case we.NotNull:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisMonth:case we.ThisWeek:case we.InFiscalPeriodAndYear:case we.Next7Days:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:return!1}return!0})(),isManuallyEditable:(()=>{switch(e){case we.Like:case we.NotLike:case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.LastXDays:case we.LastXMonths:case we.NextXMonths:case we.NextXDays:return!0}return!1})()})}}}class De extends Ce{constructor(e,t){return super(e),this._isAppliedToDataset=!1,this._conditionExpression={},this._conditionUtils=Se.condition(),this._isValid=!0,this._initialized=!1,this._column=t,new Proxy(this,{get:(e,t)=>{if("init"!==t&&!e._initialized)throw new Error("Condition has not been initialized. Make sure to call the init() method on the condition object before any operations.");return"function"==typeof e[t]?e[t].bind(e):e[t]}})}init(){return w(this,void 0,void 0,(function*(){return this._inicializationPromise||(this._inicializationPromise=new Promise((e=>w(this,void 0,void 0,(function*(){const[t,n]=yield this._getConditionFromFilterExpression();n?(this._isAppliedToDataset=!0,this._conditionExpression=t.get(n)):this._conditionExpression=this._getDefault(),this._conditionExpression.conditionOperator=this._operatorDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value,!0),this._conditionExpression.value=this._valueDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value,!0),this._conditionExpression.attributeName=yield this._attributeNameDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.attributeName,!0),e(!0),this._initialized=!0}))))),this._inicializationPromise}))}get isRemoved(){return this._isRemoved}get column(){return this._column}get isAppliedToDataset(){return this._isAppliedToDataset}get isValid(){return this._isValid}getExpression(){return w(this,void 0,void 0,(function*(){const e=Object.assign({},this._conditionExpression);return e.conditionOperator=this._operatorDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value),e.value=this._valueDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value),e.attributeName=yield this._attributeNameDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.attributeName),e}))}save(){return w(this,void 0,void 0,(function*(){if(!(yield this.value.isValid()))return this._isValid=!1,this._triggerRefreshCallbacks(),!1;const e=this._filterExpression;if(this._isAppliedToDataset||this._isRemoved){const[t,n]=yield this._getConditionFromFilterExpression();t.delete(n),e.conditions=[...t.values()]}return this._isRemoved||e.conditions.push(yield this.getExpression()),this._dataset.filtering.setFilter(e),!0}))}remove(){this._isRemoved=!0}clear(){this._inicializationPromise=void 0}get operator(){return{get:()=>this._get("operator"),set:e=>{const t=this._conditionExpression.conditionOperator;this._set("operator",e,null);if(this._conditionUtils.value(e).isManuallyEditable!==this._conditionUtils.value(t).isManuallyEditable)switch(this._column.dataType){case ye.MULTI_SELECT_OPTIONSET:case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_SIMPLE:case ye.LOOKUP_OWNER:case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:this._conditionExpression.value=""}}}}get value(){return{get:()=>this._get("value"),set:e=>this._set("value",void 0,e),isValid:()=>w(this,void 0,void 0,(function*(){if(this._conditionUtils.operator(this.operator.get()).doesNotAllowValue)return!0;const[e,t]=yield new be(this._grid,this._column,!0).validate(yield this.value.get());return e}))}}_get(e){return"operator"===e?this._conditionExpression.conditionOperator:this._conditionExpression.value}_set(e,t,n){this._isValid=!0,"operator"===e?this._conditionExpression.conditionOperator=t:this._conditionExpression.value=n,this._triggerRefreshCallbacks()}_attributeNameDecorator(e,t,n){return w(this,void 0,void 0,(function*(){if(!this._conditionUtils.value(e).isManuallyEditable)return t;switch(this._column.dataType){case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_OWNER:case ye.LOOKUP_SIMPLE:return n?t.endsWith("name")?t.slice(0,-4):t:t.endsWith("name")?t:`${t}name`;default:return t}}))}_valueDecorator(e,t,n){switch(e){case we.BeginWith:case we.DoesNotBeginWith:return n?t.slice(0,-1):`${t}%`;case we.EndsWith:case we.DoesNotEndWith:return n?t.slice(1):`%${t}`;case we.Like:case we.NotLike:return n?t.slice(1,-1):`%${t}%`;default:return t}}_operatorDecorator(e,t,n){switch(this._column.dataType){case ye.MULTI_SELECT_OPTIONSET:case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_OWNER:case ye.LOOKUP_SIMPLE:if("string"!=typeof t){if(n)switch(e){case we.In:return we.Equal;case we.NotIn:return we.NotEqual}switch(e){case we.Equal:return we.In;case we.NotEqual:return we.NotIn}}else switch(e){case we.In:return we.Equal;case we.NotIn:return we.NotEqual}}return e}_getDefault(){const e={attributeName:this._column.attributeName,conditionOperator:we.Equal,entityAliasName:this._column.entityAliasName,value:""};switch(this._column.dataType){case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:e.conditionOperator=we.On;break;case ye.IMAGE:case ye.FILE:e.conditionOperator=we.NotNull}return e}get _filterExpression(){var e;return null!==(e=structuredClone(this._dataset.filtering.getFilter()))&&void 0!==e?e:{conditions:[],filterOperator:0}}_getConditionFromFilterExpression(){return w(this,void 0,void 0,(function*(){const e=new Map(this._filterExpression.conditions.map((e=>[e.attributeName,e])));for(const t of e.values()){if((yield this._attributeNameDecorator(t.conditionOperator,t.attributeName,!0))===this._column.attributeName)return[e,t.attributeName]}return[e,""]}))}}class Te extends Ce{constructor(){super(...arguments),this._conditions=new Map}save(){return w(this,void 0,void 0,(function*(){const e=this._filterExpression;for(const t of this._conditions.values()){if(!t.value.isValid())return!1;const n=yield t.getExpression();(t.isAppliedToDataset||t.isRemoved)&&(e.conditions=this._filterExpression.conditions.filter((e=>this._getColumnKeyFromCondition(e)!==t.column.key))),t.isRemoved||e.conditions.push(n)}return this.clear(),this._dataset.filtering.setFilter(e),this._dataset.refresh(),!0}))}clear(){this._conditions.clear()}condition(e){return w(this,void 0,void 0,(function*(){const t=e.key;this._conditions.get(t)||this._conditions.set(t,new De(this._grid,e));const n=new Proxy(this._conditions.get(t),{get:(e,t)=>"save"===t?()=>w(this,void 0,void 0,(function*(){const t=yield e.save();return t&&(this._conditions.delete(e.column.key),this._dataset.refresh()),t})):("clear"===t&&this._conditions.delete(e.column.key),"function"==typeof e[t]?e[t].bind(e):e[t])});return yield n.init(),n}))}get _filterExpression(){var e;return null!==(e=structuredClone(this._grid.dataset.filtering.getFilter()))&&void 0!==e?e:{conditions:[],filterOperator:0}}_getColumnKeyFromCondition(e){return e.entityAliasName?`${e.entityAliasName}.${e.attributeName}`:e.attributeName}}class Re extends Ce{get pageNumber(){return this._dataset.paging.pageNumber}get pageSize(){return this._dataset.paging.pageSize}get totalResultCount(){return this._dataset.paging.totalResultCount}get hasPreviousPage(){return this._dataset.paging.hasPreviousPage}get hasNextPage(){return this._dataset.paging.hasNextPage}get pageFirstRecordOrder(){return(this.pageNumber-1)*this.pageSize+(0===this.totalResultCount?0:1)}get pageLastRecordOrder(){return this.pageNumber*this.pageSize}get isEnabled(){var e;return!1!==(null===(e=this._grid.parameters.EnablePagination)||void 0===e?void 0:e.raw)}loadNextPage(){this.loadExactPage(this.pageNumber+1)}loadPreviousPage(){this.loadExactPage(this.pageNumber-1)}loadExactPage(e){this._dataset.paging.loadExactPage(e)}setPageSize(e){var t;this._dataset.paging.setPageSize(e),this._dataset.refresh(),(null===(t=window.TALXIS)||void 0===t?void 0:t.Portal)||this._dataset.refresh()}reset(){this._dataset.paging.reset()}}class Ae extends Ce{constructor(){super(...arguments),this._selectedRecordIdsSet=new Set,this.debounceTimer=null}toggle(e,t,n,i){const o=e.getRecordId();this.debounceTimer||(this._selectedRecordIdsSet=new Set(this.selectedRecordIds)),n&&this._selectedRecordIdsSet.clear(),!1===t?this._selectedRecordIdsSet.delete(o):("single"===this.type&&this._selectedRecordIdsSet.clear(),this._selectedRecordIdsSet.add(o)),null!==this.debounceTimer&&clearTimeout(this.debounceTimer),i?this._setSelectedRecords():this.debounceTimer=setTimeout((()=>{this._setSelectedRecords()}),0)}get selectedRecordIds(){return this._dataset.getSelectedRecordIds()}get allRecordsSelected(){return this.selectedRecordIds.length===this._dataset.sortedRecordIds.length}get type(){var e,t;switch(null===(e=this._grid.props.parameters.SelectableRows)||void 0===e?void 0:e.raw){case void 0:case null:return"multiple";case"none":return;default:return null===(t=this._grid.props.parameters.SelectableRows)||void 0===t?void 0:t.raw}}clear(){this._grid.dataset.setSelectedRecordIds([])}selectAll(){this._grid.dataset.setSelectedRecordIds(this._dataset.sortedRecordIds)}_setSelectedRecords(){this._grid.dataset.setSelectedRecordIds([...this._selectedRecordIdsSet.values()]),this.debounceTimer=null,this._selectedRecordIdsSet=new Set}}class xe extends Ce{get(e){return{value:this._dataset.sorting.find((t=>t.name===e.key)),sort:t=>{var n;const i=new Map(this._dataset.sorting.map((e=>[e.name,e])));for((null===(n=window.TALXIS)||void 0===n?void 0:n.Portal)&&i.clear(),i.set(e.key,{name:e.key,sortDirection:t});this._dataset.sorting.length;)this._dataset.sorting.pop();for(const e of i.values())this._dataset.sorting.push(e);this._dataset.refresh()}}}}var Me,Pe,Ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ie={exports:{}};
1
+ import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import o,{createContext as r,memo as s,forwardRef as a,useContext as l,useRef as d,useState as c,useImperativeHandle as g,useLayoutEffect as u,useCallback as h,useMemo as p,useEffect as m,createElement as v,Component as f}from"react";import{useComponent as C}from"../../hooks/useComponent.js";import{_ as w,L as y}from"../../Lookup-eef0ab34.js";import b from"validator/lib/isNumeric";import E from"validator/lib/isEmail";import S from"validator/lib/isURL";import D from"dayjs";import T from"fast-deep-equal/es6";import R from"numeral";import{N as A}from"../../Numeral-a0284afb.js";import x,{createPortal as M}from"react-dom";import{renderToStaticMarkup as P}from"react-dom/server";import{mergeStyleSets as N,keyframes as I,useTheme as L,TooltipHost as F,Icon as O,Checkbox as _,Image as k,Callout as G,IconButton as z,PrimaryButton as V,Button as H,ContextualMenuItemType as B,ContextualMenu as W,CommandBarButton as U,Label as j,DialogFooter as K,Spinner as Y,SpinnerSize as $,MessageBar as Q,MessageBarType as q}from"@fluentui/react";import{DateTime as X}from"../DateTime/DateTime.js";import{Decimal as Z}from"../Decimal/Decimal.js";import{MultiSelectOptionSet as J}from"../MultiSelectOptionSet/MultiSelectOptionSet.js";import{OptionSet as ee}from"../OptionSet/OptionSet.js";import{TextField as te}from"../TextField/TextField.js";import{TwoOptions as ne}from"../TwoOptions/TwoOptions.js";import{Duration as ie}from"../Duration/Duration.js";import{Link as oe}from"@fluentui/react/lib/components/Link/Link";import{Text as re}from"@fluentui/react/lib/Text";import"external-svg-loader";import{CommandBar as se}from"@talxis/react-components/dist/components/CommandBar";import{FileAttribute as ae}from"@talxis/client-libraries";import le from"color";import{ComboBox as de}from"@talxis/react-components/dist/components/ComboBox";import{useDebounce as ce}from"use-debounce";import{useStateValues as ge}from"@talxis/react-components/dist/hooks";import{CommandBar as ue}from"@fluentui/react/lib/components/CommandBar/CommandBar";import{Dialog as he}from"@fluentui/react/lib/Dialog";import{getTheme as pe,mergeStyles as me}from"@fluentui/react/lib/Styling";import{Icon as ve}from"@fluentui/react/lib/components/Icon/Icon";import{Spinner as fe}from"@fluentui/react/lib/components/Spinner/Spinner";import"merge-anything";import"liquidjs";import"@talxis/react-components/dist/components/TagPicker";import"../../hooks/useMouseOver.js";import"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";import"../../hooks/useFocusIn.js";import"../../hooks/useInputBasedComponent.js";import"dayjs/plugin/utc";import"dayjs/plugin/customParseFormat";import"@fluentui/react/lib/utilities/ThemeProvider/useTheme";import"@fluentui/react/lib/Calendar";import"@talxis/react-components/dist/components/TimePicker";import"@talxis/react-components/dist/components/DatePicker";import"@talxis/react-components/dist/components/TextField";class Ce{constructor(e){this._refreshCallbacks=new Map,this._grid=e}addRefreshCallback(e,t){this._refreshCallbacks.set(e,t)}removeRefreshCallback(e){this._refreshCallbacks.delete(e)}onDependenciesUpdated(){}_triggerRefreshCallbacks(){for(const e of this._refreshCallbacks.values())e()}get _dataset(){return this._grid.dataset}get _pcfContext(){return this._grid.pcfContext}}var we,ye;!function(e){e[e.None=-1]="None",e[e.Equal=0]="Equal",e[e.NotEqual=1]="NotEqual",e[e.GreaterThan=2]="GreaterThan",e[e.LessThan=3]="LessThan",e[e.GreaterEqual=4]="GreaterEqual",e[e.LessEqual=5]="LessEqual",e[e.Like=6]="Like",e[e.NotLike=7]="NotLike",e[e.In=8]="In",e[e.NotIn=9]="NotIn",e[e.Null=12]="Null",e[e.NotNull=13]="NotNull",e[e.Yesterday=14]="Yesterday",e[e.Today=15]="Today",e[e.Tomorrow=16]="Tomorrow",e[e.Last7Days=17]="Last7Days",e[e.Next7Days=18]="Next7Days",e[e.LastWeek=19]="LastWeek",e[e.ThisWeek=20]="ThisWeek",e[e.LastMonth=22]="LastMonth",e[e.ThisMonth=23]="ThisMonth",e[e.On=25]="On",e[e.OnOrBefore=26]="OnOrBefore",e[e.OnOrAfter=27]="OnOrAfter",e[e.LastYear=28]="LastYear",e[e.ThisYear=29]="ThisYear",e[e.LastXDays=33]="LastXDays",e[e.NextXDays=34]="NextXDays",e[e.LastXMonths=37]="LastXMonths",e[e.NextXMonths=38]="NextXMonths",e[e.Contains=49]="Contains",e[e.BeginWith=54]="BeginWith",e[e.DoesNotBeginWith=55]="DoesNotBeginWith",e[e.EndsWith=56]="EndsWith",e[e.DoesNotEndWith=57]="DoesNotEndWith",e[e.InFiscalPeriodAndYear=70]="InFiscalPeriodAndYear",e[e.Above=75]="Above",e[e.Under=76]="Under",e[e.NotUnder=77]="NotUnder",e[e.AboveOrEqual=78]="AboveOrEqual",e[e.UnderOrEqual=79]="UnderOrEqual",e[e.ContainValues=87]="ContainValues",e[e.DoesNotContainValues=88]="DoesNotContainValues"}(we||(we={})),function(e){e.SINGLE_LINE_TEXT="SingleLine.Text",e.SINGLE_LINE_TEXT_AREA="SingleLine.TextArea",e.SINGLE_LINE_EMAIL="SingleLine.Email",e.SINGLE_LINE_PHONE="SingleLine.Phone",e.SINGLE_LINE_URL="SingleLine.URL",e.MULTIPLE="Multiple",e.WHOLE_NONE="Whole.None",e.DECIMAL="Decimal",e.FP="FP",e.DATE_AND_TIME_DATE_AND_TIME="DateAndTime.DateAndTime",e.DATE_AND_TIME_DATE_ONLY="DateAndTime.DateOnly",e.CURRENCY="Currency",e.OPTIONSET="OptionSet",e.MULTI_SELECT_OPTIONSET="MultiSelectPicklist",e.TWO_OPTIONS="TwoOptions",e.LOOKUP_SIMPLE="Lookup.Simple",e.LOOKUP_OWNER="Lookup.Owner",e.WHOLE_LANGUAGE="Whole.Language",e.WHOLE_DURATION="Whole.Duration",e.WHOLE_TIMEZONE="Whole.TimeZone",e.FILE="File",e.IMAGE="Image"}(ye||(ye={}));class be extends Ce{constructor(e,t,n){super(e),this._column=t,this._forceNullCheck=null!=n&&n}validate(e){const t=this._isNull(e);if(this._column.isRequired||this._forceNullCheck){if(t)return[!1,this._labels["validation-input-value"]()]}else if(t)return[!0,""];switch(this._column.dataType){case ye.WHOLE_NONE:case ye.DECIMAL:if(!b(e=`${e}`))return[!1,"Invalid input!"];break;case ye.SINGLE_LINE_EMAIL:if(!E(e=`${e}`))return[!1,this._labels["validation-email"]()];break;case ye.SINGLE_LINE_URL:if(!S(e=`${e}`))return[!1,this._labels["validation-url"]()];break;case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:if(!D(e).isValid())return[!1,this._labels["validation-date"]()];break;default:if(!e)return[!1,this._labels["validation-input-value"]()]}return[!0,""]}_isNull(e){return!e||(0===(null==e?void 0:e.length)||void 0)}get _labels(){return this._grid.labels}}const Ee=[{type:we.None,key:"condition-none"},{type:we.Equal,key:"condition-equal"},{type:we.NotEqual,key:"condition-notequal"},{type:we.GreaterThan,key:"condition-greaterthan"},{type:we.LessThan,key:"condition-lessthan"},{type:we.GreaterEqual,key:"condition-greaterequal"},{type:we.LessEqual,key:"condition-lessequal"},{type:we.Like,key:"condition-like"},{type:we.NotLike,key:"condition-notlike"},{type:we.In,key:"condition-in"},{type:we.NotIn,key:"condition-notin"},{type:we.Null,key:"condition-null"},{type:we.NotNull,key:"condition-notnull"},{type:we.Yesterday,key:"condition-yesterday"},{type:we.Today,key:"condition-today"},{type:we.Tomorrow,key:"condition-tomorrow"},{type:we.Last7Days,key:"condition-last7days"},{type:we.Next7Days,key:"condition-next7days"},{type:we.LastWeek,key:"condition-lastweek"},{type:we.ThisWeek,key:"condition-thisweek"},{type:we.LastMonth,key:"condition-lastmonth"},{type:we.ThisMonth,key:"condition-thismonth"},{type:we.On,key:"condition-on"},{type:we.OnOrBefore,key:"condition-onorbefore"},{type:we.OnOrAfter,key:"condition-onorafter"},{type:we.LastYear,key:"condition-lastyear"},{type:we.ThisYear,key:"condition-thisyear"},{type:we.LastXDays,key:"condition-lastxdays"},{type:we.NextXDays,key:"condition-nextxdays"},{type:we.LastXMonths,key:"condition-lastxmonths"},{type:we.NextXMonths,key:"condition-nextxmonths"},{type:we.Contains,key:"condition-contains"},{type:we.BeginWith,key:"condition-beginwith"},{type:we.DoesNotBeginWith,key:"condition-doesnotbeginwith"},{type:we.EndsWith,key:"condition-endswith"},{type:we.DoesNotEndWith,key:"condition-doesnotendwith"},{type:we.InFiscalPeriodAndYear,key:"condition-infiscalperiodandyear"},{type:we.Above,key:"condition-above"},{type:we.Under,key:"condition-under"},{type:we.NotUnder,key:"condition-notunder"},{type:we.AboveOrEqual,key:"condition-aboveorequal"},{type:we.UnderOrEqual,key:"condition-underorequal"},{type:we.ContainValues,key:"condition-containvalues"},{type:we.DoesNotContainValues,key:"condition-doesnotcontainvalues"}];class Se{static condition(){return{operator:e=>({textFieldOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.Like:case we.NotLike:case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.NotNull:case we.Null:return!0;default:return!1}})),numberOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.GreaterThan:case we.GreaterEqual:case we.LessThan:case we.LessEqual:case we.Null:return!0;default:return!1}})),dateOperators:Ee.filter((e=>{switch(e.type){case we.On:case we.OnOrAfter:case we.OnOrBefore:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisWeek:case we.ThisMonth:case we.ThisYear:case we.Next7Days:case we.NextXDays:case we.NextXMonths:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:case we.LastXDays:case we.LastXMonths:case we.Null:return!0;default:return!1}})),multipleOptionSetOperators:Ee.filter((e=>{switch(e.type){case we.Equal:case we.NotEqual:case we.ContainValues:case we.DoesNotContainValues:case we.Null:case we.NotNull:return!0;default:return!1}})),fileOperators:Ee.filter((e=>{switch(e.type){case we.Null:case we.NotNull:return!0;default:return!1}})),allowsOnlyFreeText:(()=>{switch(e){case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.Like:case we.NotLike:return!0}return!1})(),allowsOnlyNumber:(()=>{switch(e){case we.LastXDays:case we.LastXMonths:case we.NextXMonths:case we.NextXDays:return!0}return!1})(),doesNotAllowValue:(()=>{switch(e){case we.Null:case we.NotNull:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisWeek:case we.ThisMonth:case we.ThisYear:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:return!0;default:return!1}})()}),value:e=>({isEditable:(()=>{switch(e){case we.Null:case we.NotNull:case we.Today:case we.Yesterday:case we.Tomorrow:case we.ThisMonth:case we.ThisWeek:case we.InFiscalPeriodAndYear:case we.Next7Days:case we.LastWeek:case we.Last7Days:case we.LastMonth:case we.LastYear:return!1}return!0})(),isManuallyEditable:(()=>{switch(e){case we.Like:case we.NotLike:case we.BeginWith:case we.DoesNotBeginWith:case we.EndsWith:case we.DoesNotEndWith:case we.LastXDays:case we.LastXMonths:case we.NextXMonths:case we.NextXDays:return!0}return!1})()})}}}class De extends Ce{constructor(e,t){return super(e),this._isAppliedToDataset=!1,this._conditionExpression={},this._conditionUtils=Se.condition(),this._isValid=!0,this._initialized=!1,this._column=t,new Proxy(this,{get:(e,t)=>{if("init"!==t&&!e._initialized)throw new Error("Condition has not been initialized. Make sure to call the init() method on the condition object before any operations.");return"function"==typeof e[t]?e[t].bind(e):e[t]}})}init(){return w(this,void 0,void 0,(function*(){return this._inicializationPromise||(this._inicializationPromise=new Promise((e=>w(this,void 0,void 0,(function*(){const[t,n]=yield this._getConditionFromFilterExpression();n?(this._isAppliedToDataset=!0,this._conditionExpression=t.get(n)):this._conditionExpression=this._getDefault(),this._conditionExpression.conditionOperator=this._operatorDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value,!0),this._conditionExpression.value=this._valueDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value,!0),this._conditionExpression.attributeName=yield this._attributeNameDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.attributeName,!0),e(!0),this._initialized=!0}))))),this._inicializationPromise}))}get isRemoved(){return this._isRemoved}get column(){return this._column}get isAppliedToDataset(){return this._isAppliedToDataset}get isValid(){return this._isValid}getExpression(){return w(this,void 0,void 0,(function*(){const e=Object.assign({},this._conditionExpression);return e.conditionOperator=this._operatorDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value),e.value=this._valueDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.value),e.attributeName=yield this._attributeNameDecorator(this._conditionExpression.conditionOperator,this._conditionExpression.attributeName),e}))}save(){return w(this,void 0,void 0,(function*(){if(!(yield this.value.isValid()))return this._isValid=!1,this._triggerRefreshCallbacks(),!1;const e=this._filterExpression;if(this._isAppliedToDataset||this._isRemoved){const[t,n]=yield this._getConditionFromFilterExpression();t.delete(n),e.conditions=[...t.values()]}return this._isRemoved||e.conditions.push(yield this.getExpression()),this._dataset.filtering.setFilter(e),!0}))}remove(){this._isRemoved=!0}clear(){this._inicializationPromise=void 0}get operator(){return{get:()=>this._get("operator"),set:e=>{const t=this._conditionExpression.conditionOperator;this._set("operator",e,null);if(this._conditionUtils.value(e).isManuallyEditable!==this._conditionUtils.value(t).isManuallyEditable)switch(this._column.dataType){case ye.MULTI_SELECT_OPTIONSET:case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_SIMPLE:case ye.LOOKUP_OWNER:case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:this._conditionExpression.value=""}}}}get value(){return{get:()=>this._get("value"),set:e=>this._set("value",void 0,e),isValid:()=>w(this,void 0,void 0,(function*(){if(this._conditionUtils.operator(this.operator.get()).doesNotAllowValue)return!0;const[e,t]=yield new be(this._grid,this._column,!0).validate(yield this.value.get());return e}))}}_get(e){return"operator"===e?this._conditionExpression.conditionOperator:this._conditionExpression.value}_set(e,t,n){this._isValid=!0,"operator"===e?this._conditionExpression.conditionOperator=t:this._conditionExpression.value=n,this._triggerRefreshCallbacks()}_attributeNameDecorator(e,t,n){return w(this,void 0,void 0,(function*(){if(!this._conditionUtils.value(e).isManuallyEditable)return t;switch(this._column.dataType){case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_OWNER:case ye.LOOKUP_SIMPLE:return n?t.endsWith("name")?t.slice(0,-4):t:t.endsWith("name")?t:`${t}name`;default:return t}}))}_valueDecorator(e,t,n){switch(e){case we.BeginWith:case we.DoesNotBeginWith:return n?t.slice(0,-1):`${t}%`;case we.EndsWith:case we.DoesNotEndWith:return n?t.slice(1):`%${t}`;case we.Like:case we.NotLike:return n?t.slice(1,-1):`%${t}%`;default:return t}}_operatorDecorator(e,t,n){switch(this._column.dataType){case ye.MULTI_SELECT_OPTIONSET:case ye.OPTIONSET:case ye.TWO_OPTIONS:case ye.LOOKUP_OWNER:case ye.LOOKUP_SIMPLE:if("string"!=typeof t){if(n)switch(e){case we.In:return we.Equal;case we.NotIn:return we.NotEqual}switch(e){case we.Equal:return we.In;case we.NotEqual:return we.NotIn}}else switch(e){case we.In:return we.Equal;case we.NotIn:return we.NotEqual}}return e}_getDefault(){const e={attributeName:this._column.attributeName,conditionOperator:we.Equal,entityAliasName:this._column.entityAliasName,value:""};switch(this._column.dataType){case ye.DATE_AND_TIME_DATE_AND_TIME:case ye.DATE_AND_TIME_DATE_ONLY:e.conditionOperator=we.On;break;case ye.IMAGE:case ye.FILE:e.conditionOperator=we.NotNull}return e}get _filterExpression(){var e;return null!==(e=structuredClone(this._dataset.filtering.getFilter()))&&void 0!==e?e:{conditions:[],filterOperator:0}}_getConditionFromFilterExpression(){return w(this,void 0,void 0,(function*(){const e=new Map(this._filterExpression.conditions.map((e=>[e.attributeName,e])));for(const t of e.values()){if((yield this._attributeNameDecorator(t.conditionOperator,t.attributeName,!0))===this._column.attributeName)return[e,t.attributeName]}return[e,""]}))}}class Te extends Ce{constructor(){super(...arguments),this._conditions=new Map}save(){return w(this,void 0,void 0,(function*(){const e=this._filterExpression;for(const t of this._conditions.values()){if(!t.value.isValid())return!1;const n=yield t.getExpression();(t.isAppliedToDataset||t.isRemoved)&&(e.conditions=this._filterExpression.conditions.filter((e=>this._getColumnKeyFromCondition(e)!==t.column.key))),t.isRemoved||e.conditions.push(n)}return this.clear(),this._dataset.filtering.setFilter(e),this._dataset.refresh(),!0}))}clear(){this._conditions.clear()}condition(e){return w(this,void 0,void 0,(function*(){const t=e.key;this._conditions.get(t)||this._conditions.set(t,new De(this._grid,e));const n=new Proxy(this._conditions.get(t),{get:(e,t)=>"save"===t?()=>w(this,void 0,void 0,(function*(){const t=yield e.save();return t&&(this._conditions.delete(e.column.key),this._dataset.refresh()),t})):("clear"===t&&this._conditions.delete(e.column.key),"function"==typeof e[t]?e[t].bind(e):e[t])});return yield n.init(),n}))}get _filterExpression(){var e;return null!==(e=structuredClone(this._grid.dataset.filtering.getFilter()))&&void 0!==e?e:{conditions:[],filterOperator:0}}_getColumnKeyFromCondition(e){return e.entityAliasName?`${e.entityAliasName}.${e.attributeName}`:e.attributeName}}class Re extends Ce{get pageNumber(){return this._dataset.paging.pageNumber}get pageSize(){return this._dataset.paging.pageSize}get totalResultCount(){return this._dataset.paging.totalResultCount}get hasPreviousPage(){return this._dataset.paging.hasPreviousPage}get hasNextPage(){return this._dataset.paging.hasNextPage}get pageFirstRecordOrder(){return(this.pageNumber-1)*this.pageSize+(0===this.totalResultCount?0:1)}get pageLastRecordOrder(){return this.pageNumber*this.pageSize}get isEnabled(){var e;return!1!==(null===(e=this._grid.parameters.EnablePagination)||void 0===e?void 0:e.raw)}loadNextPage(){this.loadExactPage(this.pageNumber+1)}loadPreviousPage(){this.loadExactPage(this.pageNumber-1)}loadExactPage(e){this._dataset.paging.loadExactPage(e)}setPageSize(e){var t;this._dataset.paging.setPageSize(e),this._dataset.refresh(),(null===(t=window.TALXIS)||void 0===t?void 0:t.Portal)||this._dataset.refresh()}reset(){this._dataset.paging.reset()}}class Ae extends Ce{constructor(){super(...arguments),this._selectedRecordIdsSet=new Set,this.debounceTimer=null}toggle(e,t,n,i){const o=e.getRecordId();this.debounceTimer||(this._selectedRecordIdsSet=new Set(this.selectedRecordIds)),n&&this._selectedRecordIdsSet.clear(),!1===t?this._selectedRecordIdsSet.delete(o):("single"===this.type&&this._selectedRecordIdsSet.clear(),this._selectedRecordIdsSet.add(o)),null!==this.debounceTimer&&clearTimeout(this.debounceTimer),i?this._setSelectedRecords():this.debounceTimer=setTimeout((()=>{this._setSelectedRecords()}),0)}get selectedRecordIds(){return this._dataset.getSelectedRecordIds()}get allRecordsSelected(){return this.selectedRecordIds.length===this._dataset.sortedRecordIds.length}get type(){var e,t;switch(null===(e=this._grid.props.parameters.SelectableRows)||void 0===e?void 0:e.raw){case void 0:case null:return"multiple";case"none":return;default:return null===(t=this._grid.props.parameters.SelectableRows)||void 0===t?void 0:t.raw}}clear(){this._grid.dataset.setSelectedRecordIds([])}selectAll(){this._grid.dataset.setSelectedRecordIds(this._dataset.sortedRecordIds)}_setSelectedRecords(){this._grid.dataset.setSelectedRecordIds([...this._selectedRecordIdsSet.values()]),this.debounceTimer=null,this._selectedRecordIdsSet=new Set}}class xe extends Ce{get(e){return{value:this._dataset.sorting.find((t=>t.name===e.key)),sort:t=>{var n;const i=new Map(this._dataset.sorting.map((e=>[e.name,e])));for((null===(n=window.TALXIS)||void 0===n?void 0:n.Portal)&&i.clear(),i.set(e.key,{name:e.key,sortDirection:t});this._dataset.sorting.length;)this._dataset.sorting.pop();for(const e of i.values())this._dataset.sorting.push(e);this._dataset.refresh()}}}}var Me,Pe,Ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ie={exports:{}};
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -1 +1 @@
1
- export{L as Lookup}from"../../Lookup-eb1505b3.js";import"react/jsx-runtime";import"react";import"@fluentui/react";import"@talxis/react-components/dist/components/TagPicker";import"../../hooks/useMouseOver.js";import"../../hooks/useFocusIn.js";import"../../hooks/useComponent.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"@fluentui/react/lib/Text";import"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";
1
+ export{L as Lookup}from"../../Lookup-eef0ab34.js";import"react/jsx-runtime";import"react";import"@fluentui/react";import"@talxis/react-components/dist/components/TagPicker";import"../../hooks/useMouseOver.js";import"../../hooks/useFocusIn.js";import"../../hooks/useComponent.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"@fluentui/react/lib/Text";import"@fluentui/react/lib/components/Button/CommandBarButton/CommandBarButton";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talxis/base-controls",
3
- "version": "1.2406.7",
3
+ "version": "1.2406.8",
4
4
  "description": "Set of React components that natively work with Power Apps Component Framework API's",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",