@ni/ok-components 1.18.1 → 1.18.3

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.
@@ -20153,11 +20153,11 @@ function ttt(t,e,n,i,o=!1){if(o&&"datetime-local"===e){const{dayPeriod:o}=Z9(n,i
20153
20153
  for(const t of s){const o=ttt(t,e,n,i)
20154
20154
  if(o)return o}return""}const{mode:s,separator:r}=K9(n),a=s.split("/").join(r).length,l=t.slice(0,a).split(r),c=s.split("/"),d=j9(`${l[c.indexOf("yyyy")]}-${l[c.indexOf("mm")]}-${l[c.indexOf("dd")]}`,"date")
20155
20155
  if(!d)return""
20156
- if("date"!==e){const e=function(t,e){const{mode:n,dayPeriod:i,timeSegmentMaxValues:o}=D9(e),s=o.milliseconds+1,r=(o.seconds+1)*s,a=(o.minutes+1)*r,l=a9(c9(t,n))
20156
+ if("date"!==e){const e=Z9(n,i),[o,s]=e.dayPeriod,r=function(t,e){const{mode:n,dayPeriod:i,timeSegmentMaxValues:o}=D9(e),s=o.milliseconds+1,r=(o.seconds+1)*s,a=(o.minutes+1)*r,l=a9(c9(t,n))
20157
20157
  let c=Number(l.hours??"")
20158
- return o9(i)&&Number.isFinite(c)&&(c=t.includes(i[1])?c<12?c+12:c:12===c?0:c),c*a+Number(l.minutes??"")*r+Number(l.seconds??"")*s+Number(l.milliseconds??"")}(t.slice(a+1),Z9(n,i))
20159
- if(!Number.isFinite(e))return""
20160
- d.setUTCMilliseconds(e)}return Q9(Y9(d,e,n,i))===Q9(t)?W9(d,e):""}const ett=(t,e)=>ki.create({name:`ok-fv-date-time-picker-${t}`,cssCustomPropertyName:null}).withDefault(e),ntt={chooseDate:ett("choose-date","Choose date"),chooseDateTime:ett("choose-date-time","Choose date and time"),month:ett("month","Month"),year:ett("year","Year"),previousMonth:ett("previous-month","Previous month"),nextMonth:ett("next-month","Next month"),time:ett("time","Time"),invalidDate:ett("invalid-date","Enter a valid date."),invalidDateTime:ett("invalid-date-time","Enter a valid date and time."),invalidTime:ett("invalid-time","Enter a valid time.")}
20158
+ return o9(i)&&Number.isFinite(c)&&(c=t.includes(i[1])?c<12?c+12:c:12===c?0:c),c*a+Number(l.minutes??"")*r+Number(l.seconds??"")*s+Number(l.milliseconds??"")}(t.slice(a+1).toLocaleLowerCase(n),{...e,dayPeriod:[o.toLocaleLowerCase(n),s.toLocaleLowerCase(n)]})
20159
+ if(!Number.isFinite(r))return""
20160
+ d.setUTCMilliseconds(r)}return Q9(Y9(d,e,n,i))===Q9(t)?W9(d,e):""}const ett=(t,e)=>ki.create({name:`ok-fv-date-time-picker-${t}`,cssCustomPropertyName:null}).withDefault(e),ntt={chooseDate:ett("choose-date","Choose date"),chooseDateTime:ett("choose-date-time","Choose date and time"),month:ett("month","Month"),year:ett("year","Year"),previousMonth:ett("previous-month","Previous month"),nextMonth:ett("next-month","Next month"),time:ett("time","Time"),invalidDate:ett("invalid-date","Enter a valid date."),invalidDateTime:ett("invalid-date-time","Enter a valid date and time."),invalidTime:ett("invalid-time","Enter a valid time.")}
20161
20161
  class itt extends uy{constructor(){super(...arguments),this.supportedLabels=ntt}}t([ft({attribute:"choose-date"})],itt.prototype,"chooseDate",void 0),t([ft({attribute:"choose-date-time"})],itt.prototype,"chooseDateTime",void 0),t([ft],itt.prototype,"month",void 0),t([ft],itt.prototype,"year",void 0),t([ft({attribute:"previous-month"})],itt.prototype,"previousMonth",void 0),t([ft({attribute:"next-month"})],itt.prototype,"nextMonth",void 0),t([ft],itt.prototype,"time",void 0),t([ft({attribute:"invalid-date"})],itt.prototype,"invalidDate",void 0),t([ft({attribute:"invalid-date-time"})],itt.prototype,"invalidDateTime",void 0),t([ft({attribute:"invalid-time"})],itt.prototype,"invalidTime",void 0)
20162
20162
  const ott=itt.compose({baseName:"fv-date-time-picker-label-provider",styles:py})
20163
20163
  Ei.getOrCreate().withPrefix("ok").register(ott())
@@ -20473,7 +20473,7 @@ const stt=ki.create("ok-fv-date-time-picker-selected-day-fill").withDefault(t=>O
20473
20473
  </div>
20474
20474
  ${qt(t=>!t.open,ltt)}
20475
20475
  ${qt(t=>t.open,Q`
20476
- <${Av} ${Vt("region")} auto-update-mode="auto"
20476
+ <${Av} ${Vt("region")} auto-update-mode="auto" fixed-placement
20477
20477
  @loaded="${t=>t.focusDay(!0)}"
20478
20478
  vertical-default-position="bottom" vertical-positioning-mode="dynamic"
20479
20479
  horizontal-inset
@@ -21565,7 +21565,7 @@ const Rtt=It`
21565
21565
  `
21566
21566
  class Ltt extends qe{}class Ptt extends(Rn(Ltt)){constructor(){super(...arguments),this.proxy=Object.assign(document.createElement("select"),{multiple:!0})}}class Btt extends Ptt{constructor(){super(...arguments),this.appearance=vb,this.label="",this.placeholder="",this.filterable=!1,this.clearable=!1,this.open=!1,this.options=[],this.selectedValues=[],this.filter="",this.activeIndex=-1,this.keyboardNavigation=!1,this.controlId=xn("ok-fv-multi-select-"),this.listboxId=`${this.controlId}-listbox`,this.formDisabled=!1,this.updatePopupLayout=()=>{if(this.open&&this.isConnected){const t=this.controlField.getBoundingClientRect(),e=Math.max(0,t.top,window.innerHeight-t.bottom)
21567
21567
  this.style.setProperty("--ok-fv-multi-select-available-height",`${e}px`),this.region.update()}},this.documentClickHandler=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}get effectiveDisabled(){return this.disabled||this.formDisabled}get visibleOptions(){const t=nO(this.filter)
21568
- return this.options.filter(e=>!this.filterable||nO(e.label).includes(t))}get displayValue(){return this.selectedValues.map(t=>this.options.find(e=>e.value===t)?.label??t).join(", ")}get activeOptionId(){return this.open&&this.activeIndex>=0?`${this.listboxId}-${this.activeIndex}`:null}connectedCallback(){this.initialSelectedValues??(this.initialSelectedValues=[...this.selectedValues]),super.connectedCallback(),this.syncFormValue(),document.addEventListener("click",this.documentClickHandler),window.addEventListener("resize",this.updatePopupLayout),window.addEventListener("scroll",this.updatePopupLayout,!0),this.resetActiveOption(),this.open&&this.openChanged()}disconnectedCallback(){document.removeEventListener("click",this.documentClickHandler),window.removeEventListener("resize",this.updatePopupLayout),window.removeEventListener("scroll",this.updatePopupLayout,!0),super.disconnectedCallback()}disabledChanged(t,e){super.disabledChanged?.(t,e),this.disabled&&(this.open=!1),this.syncFormValue()}formDisabledCallback(t){this.formDisabled=t,t&&(this.open=!1),this.syncFormValue()}selectedValuesChanged(){this.syncFormValue()}nameChanged(t,e){super.nameChanged?.(t,e),this.syncFormValue()}valueChanged(){this.syncFormValue()}validate(){this.effectiveDisabled?this.setValidity({}):super.validate(this.control)}formResetCallback(){this.open=!1,this.selectedValues=[...this.initialSelectedValues??[]]}async openChanged(){if(!this.open||!this.effectiveDisabled)return this.open?void(this.$fastController.isConnected&&(this.region.anchorElement=this.controlField,this.updatePopupLayout(),this.resetActiveOption(),await y.nextUpdate(),this.focusPopup())):(this.$fastController.isConnected&&(this.region.anchorElement=null),this.filter="",this.activeIndex=-1,void(this.keyboardNavigation=!1))
21568
+ return this.options.filter(e=>!this.filterable||nO(e.label).includes(t))}get displayValue(){return this.selectedValues.map(t=>this.options.find(e=>e.value===t)?.label??t).join(", ")}get activeOptionId(){return this.open&&this.activeIndex>=0?`${this.listboxId}-${this.activeIndex}`:null}connectedCallback(){this.initialSelectedValues??(this.initialSelectedValues=[...this.selectedValues]),super.connectedCallback(),this.syncFormValue(),document.addEventListener("click",this.documentClickHandler),window.addEventListener("resize",this.updatePopupLayout),window.addEventListener("scroll",this.updatePopupLayout,!0),this.resetActiveOption(),this.open&&this.openChanged()}disconnectedCallback(){document.removeEventListener("click",this.documentClickHandler),window.removeEventListener("resize",this.updatePopupLayout),window.removeEventListener("scroll",this.updatePopupLayout,!0),super.disconnectedCallback()}disabledChanged(t,e){super.disabledChanged?.(t,e),this.disabled&&(this.open=!1),this.syncFormValue()}formDisabledCallback(t){this.formDisabled=t,t&&(this.open=!1),this.syncFormValue()}selectedValuesChanged(){this.syncFormValue()}nameChanged(t,e){super.nameChanged?.(t,e),this.syncFormValue()}valueChanged(){this.syncFormValue()}validate(){this.effectiveDisabled?this.setValidity({}):super.validate(this.control)}formResetCallback(){this.open=!1,this.selectedValues=[...this.initialSelectedValues??[]]}async openChanged(){if(!this.open||!this.effectiveDisabled)return this.open?void(this.$fastController.isConnected&&(this.control.focus(),this.region.anchorElement=this.controlField,this.updatePopupLayout(),this.resetActiveOption(),await y.nextUpdate(),this.focusPopup())):(this.$fastController.isConnected&&(this.region.anchorElement=null),this.filter="",this.activeIndex=-1,void(this.keyboardNavigation=!1))
21569
21569
  this.open=!1}focusPopup(){this.open&&this.isConnected&&((this.filterable?this.filterInput:this.listbox)?.focus(),this.scrollActiveOptionIntoView())}optionsChanged(){this.resetActiveOption()}filterChanged(){this.resetActiveOption()}async filterableChanged(){if(this.filter="",this.open){if(this.resetActiveOption(),!this.filterable)return void this.listbox?.focus()
21570
21570
  await y.nextUpdate(),this.focusPopup()}}toggleOption(t){this.effectiveDisabled||t.disabled||(this.selectedValues=this.selectedValues.includes(t.value)?this.selectedValues.filter(e=>e!==t.value):[...this.selectedValues,t.value],this.$emit("input"),this.$emit("change"))}clearSelection(){!this.effectiveDisabled&&this.clearable&&0!==this.selectedValues.length&&(this.open=!1,this.selectedValues=[],this.control.focus(),this.$emit("input"),this.$emit("change"))}handleInput(t){this.filter=t.target.value,t.stopPropagation()}handleControlKeydown(t){return this.keyboardNavigation=!0,"Escape"!==t.key||this.open||this.clearSelection(),"ArrowDown"!==t.key&&"ArrowUp"!==t.key||(this.open=!this.effectiveDisabled,"ArrowUp"===t.key&&this.moveActiveOption(-1,!0),!1)}handlePopupKeydown(t){if(t.isComposing)return!0
21571
21571
  if("Escape"===t.key||"Tab"===t.key)return this.open=!1,y.processUpdates(),this.control.focus(),"Tab"===t.key