You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
9.3 KiB
21 lines
9.3 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("require exports ./componentsUtils ./label2 ./interactive ./locale ./t9n ./loadable ./form ./chip ./combobox ./combobox-item ./icon ./input-message".split(" "),function(w,r,e,x,y,t,p,u,q,G,H,I,J,K){function z(a){return a.replace(":15",".25").replace(":30",".5").replace(":45",".75").replace("\u2212","-")}function L(a,b){a=A(a,"en-US",b).replace("GMT","");return""===a?0:60*Number(z(a))}async function M(a,b,f,h){const v=h.getTime();h=Intl.supportedValuesOf("timeZone");return"offset"===f?(B||= |
|
Promise.all([new Promise((c,n)=>w(["./index3"],c,n)),new Promise((c,n)=>w(["./index4"],c,n))]),B.then(async([{groupTimeZones:c},{DateEngine:n}])=>{c=await c({dateEngine:new n,groupDateRange:1,startDate:(new Date(v)).toISOString()});const N=new Intl.ListFormat(a,{style:"long",type:"conjunction"});c.forEach(d=>{const k=[];let m=0;d.tzs.forEach((g,l)=>{C.includes(g)&&m++;k[l]=m});d.tzs=d.tzs.filter(g=>!C.includes(g));d.labelTzIndices=d.labelTzIndices.map(g=>g-k[g]).filter(g=>0<=g&&g<d.tzs.length)}); |
|
return c.map(({labelTzIndices:d,tzs:k})=>{var m=k[0];const g=z(A(m,a,v));m=L(m,v);d=d.map(l=>{l=k[l];return b[l]||l.split("/").pop()});return{label:O(b,g,N.format(d)),value:m,filterValue:k.map(l=>l.replace(/_/g," "))}}).filter(d=>!!d).sort((d,k)=>d.value-k.value)})):h.map(c=>({label:c.replace(/_/g," "),value:c,filterValue:c})).filter(c=>!!c).sort()}function O(a,b,f){return a.timeZoneLabel.replace("{offset}",b).replace("{cities}",f)}function A(a,b,f=Date.now()){return t.getDateTimeFormat(b,{timeZone:a, |
|
timeZoneName:"shortOffset"}).formatToParts(f).find(({type:h})=>"timeZoneName"===h).value}function D(a,b,f){return null==f?null:a.find(h=>h[b]==f)}function E(){"undefined"!==typeof customElements&&"calcite-input-time-zone calcite-chip calcite-combobox calcite-combobox-item calcite-icon calcite-input-message".split(" ").forEach(a=>{switch(a){case "calcite-input-time-zone":customElements.get(a)||customElements.define(a,F);break;case "calcite-chip":customElements.get(a)||G.defineCustomElement();break; |
|
case "calcite-combobox":customElements.get(a)||H.defineCustomElement();break;case "calcite-combobox-item":customElements.get(a)||I.defineCustomElement();break;case "calcite-icon":customElements.get(a)||J.defineCustomElement();break;case "calcite-input-message":customElements.get(a)||K.defineCustomElement()}})}const C="CET CST6CDT EET EST EST5EDT Factory HST MET MST MST7MDT PST8PDT UTC WET".split(" ");let B;const F=e.proxyCustomElement(class extends e.H{constructor(){super();this.__registerHost(); |
|
this.__attachShadow();this.calciteInputTimeZoneBeforeClose=e.createEvent(this,"calciteInputTimeZoneBeforeClose",6);this.calciteInputTimeZoneBeforeOpen=e.createEvent(this,"calciteInputTimeZoneBeforeOpen",6);this.calciteInputTimeZoneChange=e.createEvent(this,"calciteInputTimeZoneChange",6);this.calciteInputTimeZoneClose=e.createEvent(this,"calciteInputTimeZoneClose",6);this.calciteInputTimeZoneOpen=e.createEvent(this,"calciteInputTimeZoneOpen",6);this.setComboboxRef=a=>{this.comboboxEl=a};this.onComboboxBeforeClose= |
|
a=>{a.stopPropagation();this.calciteInputTimeZoneBeforeClose.emit()};this.onComboboxBeforeOpen=a=>{a.stopPropagation();this.calciteInputTimeZoneBeforeOpen.emit()};this.onComboboxChange=a=>{a.stopPropagation();if(a=a.target.selectedItems[0]){a=this.findTimeZoneItemByLabel(a.textLabel);var b=`${a.value}`;if(this.value!==b||a.label!==this.selectedTimeZoneItem.label)this.value=b,this.selectedTimeZoneItem=a,this.calciteInputTimeZoneChange.emit()}else this.selectedTimeZoneItem=this.value=null,this.calciteInputTimeZoneChange.emit()}; |
|
this.onComboboxClose=a=>{a.stopPropagation();this.open=!1;this.calciteInputTimeZoneClose.emit()};this.onComboboxOpen=a=>{this.open=!0;a.stopPropagation();this.calciteInputTimeZoneOpen.emit()};this.disabled=this.clearable=!1;this.form=void 0;this.maxItems=0;this.messageOverrides=this.messages=void 0;this.mode="offset";this.validationIcon=this.validationMessage=void 0;this.validity={valid:!1,badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1, |
|
tooShort:!1,typeMismatch:!1,valueMissing:!1};this.name=void 0;this.open=!1;this.overlayPositioning="absolute";this.referenceDate=void 0;this.required=!1;this.scale="m";this.status="idle";this.value=void 0;this.readOnly=!1;this.defaultMessages=void 0;this.effectiveLocale=""}onMessagesChange(){}handleTimeZoneItemPropsChange(){this.updateTimeZoneItemsAndSelection()}handleValueChange(a,b){a=this.normalizeValue(a);!a&&this.clearable?(this.value=a,this.selectedTimeZoneItem=null):(a=this.findTimeZoneItem(a))? |
|
this.selectedTimeZoneItem=a:this.value=b}async setFocus(){await u.componentFocusable(this);await this.comboboxEl.setFocus()}effectiveLocaleWatcher(){p.updateMessages(this,this.effectiveLocale)}onLabelClick(){this.setFocus()}findTimeZoneItem(a){return D(this.timeZoneItems,"value",a)}findTimeZoneItemByLabel(a){return D(this.timeZoneItems,"label",a)}async updateTimeZoneItemsAndSelection(){this.timeZoneItems=await this.createTimeZoneItems();if(""===this.value&&this.clearable)this.selectedTimeZoneItem= |
|
null;else{var a="offset"===this.mode?-1*(new Date).getTimezoneOffset():(new Intl.DateTimeFormat).resolvedOptions().timeZone;this.selectedTimeZoneItem=this.findTimeZoneItem(this.value??a)||this.findTimeZoneItem(a)}}async createTimeZoneItems(){return this.effectiveLocale&&this.messages?M(this.effectiveLocale,this.messages,this.mode,this.referenceDate instanceof Date?this.referenceDate:new Date(this.referenceDate??Date.now())):[]}connectedCallback(){q.connectForm(this);x.connectLabel(this);t.connectLocalized(this); |
|
p.connectMessages(this)}disconnectedCallback(){q.disconnectForm(this);x.disconnectLabel(this);t.disconnectLocalized(this);p.disconnectMessages(this)}normalizeValue(a){return null===a?"":a}async componentWillLoad(){u.setUpLoadableComponent(this);await p.setUpMessages(this);this.value=this.normalizeValue(this.value);await this.updateTimeZoneItemsAndSelection();const a=this.selectedTimeZoneItem?`${this.selectedTimeZoneItem.value}`:null;q.afterConnectDefaultValueSet(this,a);this.value=a}componentDidLoad(){u.setComponentLoaded(this)}componentDidRender(){y.updateHostInteraction(this)}render(){return e.h(e.Host, |
|
{key:"80390d6f555967845c57683286d3bc7a467e986d"},e.h(y.InteractiveContainer,{key:"b2d3bcc8f1ca941fb73bb503e36e06eed541ea48",disabled:this.disabled},e.h("calcite-combobox",{key:"14c3f7559338973e2eb08c528a236d05ec4c489c",clearDisabled:!this.clearable,disabled:this.disabled,label:this.messages.chooseTimeZone,lang:this.effectiveLocale,maxItems:this.maxItems,onCalciteComboboxBeforeClose:this.onComboboxBeforeClose,onCalciteComboboxBeforeOpen:this.onComboboxBeforeOpen,onCalciteComboboxChange:this.onComboboxChange, |
|
onCalciteComboboxClose:this.onComboboxClose,onCalciteComboboxOpen:this.onComboboxOpen,open:this.open,overlayPositioning:this.overlayPositioning,placeholder:"name"===this.mode?this.messages.namePlaceholder:this.messages.offsetPlaceholder,readOnly:this.readOnly,scale:this.scale,selectionMode:this.clearable?"single":"single-persist",status:this.status,"validation-icon":this.validationIcon,"validation-message":this.validationMessage,ref:this.setComboboxRef},this.timeZoneItems.map(a=>{const b=this.selectedTimeZoneItem=== |
|
a,{label:f,value:h}=a;return e.h("calcite-combobox-item",{"data-value":h,key:f,selected:b,textLabel:f,value:`${a.filterValue}`})})),e.h(q.HiddenFormInputSlot,{key:"9be196de8ecde0e10e293cd49b778ce52e75a131",component:this})))}static get delegatesFocus(){return!0}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],messages:["handleTimeZoneItemPropsChange"],mode:["handleTimeZoneItemPropsChange"],referenceDate:["handleTimeZoneItemPropsChange"], |
|
value:["handleValueChange"],effectiveLocale:["effectiveLocaleWatcher"]}}static get style(){return":host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:block}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}::slotted(input[slot\x3dhidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}"}}, |
|
[17,"calcite-input-time-zone",{clearable:[516],disabled:[516],form:[513],maxItems:[514,"max-items"],messages:[1040],messageOverrides:[1040],mode:[513],validationMessage:[1,"validation-message"],validationIcon:[520,"validation-icon"],validity:[1040],name:[513],open:[1540],overlayPositioning:[513,"overlay-positioning"],referenceDate:[1,"reference-date"],required:[516],scale:[513],status:[513],value:[1025],readOnly:[516,"read-only"],defaultMessages:[32],effectiveLocale:[32],setFocus:[64]},void 0,{messageOverrides:["onMessagesChange"], |
|
messages:["handleTimeZoneItemPropsChange"],mode:["handleTimeZoneItemPropsChange"],referenceDate:["handleTimeZoneItemPropsChange"],value:["handleValueChange"],effectiveLocale:["effectiveLocaleWatcher"]}]);E();r.CalciteInputTimeZone=F;r.defineCustomElement=E;Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); |