@ni/spright-components 0.0.12 → 0.0.14
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.
|
@@ -1712,11 +1712,6 @@ const Kd=xe`
|
|
|
1712
1712
|
font: ${wc};
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
|
-
:host(:focus-within:not(:active)) {
|
|
1716
|
-
outline: 2px solid ${ja};
|
|
1717
|
-
outline-offset: -2px;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
1715
|
:host(:hover) {
|
|
1721
1716
|
background: ${La};
|
|
1722
1717
|
}
|
|
@@ -1747,6 +1742,13 @@ const Kd=xe`
|
|
|
1747
1742
|
cursor: pointer;
|
|
1748
1743
|
text-decoration: none;
|
|
1749
1744
|
outline: none;
|
|
1745
|
+
padding-left: 8px;
|
|
1746
|
+
padding-right: 8px;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
a${Po} {
|
|
1750
|
+
outline: 2px solid ${ja};
|
|
1751
|
+
outline-offset: -2px;
|
|
1750
1752
|
}
|
|
1751
1753
|
|
|
1752
1754
|
:host([disabled]) a {
|
|
@@ -4081,6 +4083,7 @@ const yv=xe`
|
|
|
4081
4083
|
|
|
4082
4084
|
:host([slot='submenu']) {
|
|
4083
4085
|
margin: 0 ${rl};
|
|
4086
|
+
cursor: default;
|
|
4084
4087
|
}
|
|
4085
4088
|
|
|
4086
4089
|
::slotted(*) {
|
|
@@ -4105,6 +4108,10 @@ const yv=xe`
|
|
|
4105
4108
|
padding-top: ${ol};
|
|
4106
4109
|
padding-bottom: ${ol};
|
|
4107
4110
|
}
|
|
4111
|
+
|
|
4112
|
+
::slotted(${"nimble-anchor-menu-item"}) {
|
|
4113
|
+
padding: 0px;
|
|
4114
|
+
}
|
|
4108
4115
|
`.withBehaviors(fh(Ar.color,xe`
|
|
4109
4116
|
slot {
|
|
4110
4117
|
background: ${Mr(rr,.15)};
|
|
@@ -11220,83 +11227,32 @@ wi.getOrCreate().withPrefix("nimble").register(CF())
|
|
|
11220
11227
|
class kF extends(rF(oF)){constructor(){super(...arguments),this.langSubscriber={handleChange:()=>{this.updateColumnConfig()}}}connectedCallback(){super.connectedCallback(),_a.subscribe(this.langSubscriber,this),this.updateColumnConfig()}disconnectedCallback(){super.disconnectedCallback(),_a.unsubscribe(this.langSubscriber,this)}placeholderChanged(){this.updateColumnConfig()}getColumnInternalsOptions(){return{cellRecordFieldNames:["value"],cellViewTag:"nimble-table-column-duration-text-cell-view",groupHeaderViewTag:"nimble-table-column-duration-text-group-header-view",delegatedEvents:[],sortOperation:_O,validator:new zR([])}}updateColumnConfig(){const e={formatter:new xF(_a.getValueFor(this)),placeholder:this.placeholder}
|
|
11221
11228
|
this.columnInternals.columnConfig=e}}const SF=kF.compose({baseName:"table-column-duration-text",template:qR,styles:BR})
|
|
11222
11229
|
wi.getOrCreate().withPrefix("nimble").register(SF())
|
|
11223
|
-
const $F=
|
|
11224
|
-
${Zm("hasOverflow")}
|
|
11225
|
-
class="header-content"
|
|
11226
|
-
title=${e=>e.hasOverflow&&e.headerTextContent?e.headerTextContent:null}
|
|
11227
|
-
>
|
|
11228
|
-
<slot ${Ne("contentSlot")}></slot>
|
|
11229
|
-
<slot ${Ye({property:"unitElements",filter:Ge()})} name="unit"></slot>
|
|
11230
|
-
</span>`
|
|
11231
|
-
const MF=class extends YR{updateText(){this.text=this.columnConfig?.formatter?.format(this.groupHeaderValue)??""}}.compose({baseName:"table-column-number-text-group-header-view",template:JR,styles:QR})
|
|
11232
|
-
wi.getOrCreate().withPrefix("nimble").register(MF())
|
|
11233
|
-
const EF=class extends uF{columnConfigChanged(){super.columnConfigChanged(),this.alignment=this.columnConfig?.alignment??lF}updateText(){this.text=this.columnConfig?.formatter?.format(this.cellRecord?.value)??""}}.compose({baseName:"table-column-number-text-cell-view",template:dF,styles:hF})
|
|
11234
|
-
wi.getOrCreate().withPrefix("nimble").register(EF())
|
|
11235
|
-
const _F={default:void 0,decimal:"decimal"},IF="left",DF="right"
|
|
11236
|
-
class AF{format(e){if("number"!=typeof e)return""
|
|
11237
|
-
try{return this.tryFormat(e)}catch{return""}}}class TF{constructor(e){this.locale=e.locale,this.intlNumberFormatOptions=e.intlNumberFormatOptions}}class OF extends TF{constructor(e,t){super(e),this.formatter=new Intl.NumberFormat(this.locale,{...t,...this.intlNumberFormatOptions})}static createFactory(e){return t=>new OF(t,e)}format(e){return this.formatter.format(e)}}class RF{constructor(e,t){this.scaleFactor=e,this.scaledUnitFormatFactory=t}isBase(){return 1===this.scaleFactor}}class FF{constructor(e){this.supportedScaledUnits=e
|
|
11238
|
-
const t=e.every(((e,t,n)=>0===t||n[t-1].scaleFactor<e.scaleFactor))
|
|
11239
|
-
if(!t)throw new Error("Supported scaled units must have unique and ordered scale factors")
|
|
11240
|
-
const n=e.find((e=>e.isBase()))
|
|
11241
|
-
if(!n)throw new Error("Supported scaled units must include a base scaled unit (scale factor=1)")
|
|
11242
|
-
this.supportedScaledUnits=e,this.baseScaledUnit=n}scaleNumber(e){const t=Math.abs(e)
|
|
11243
|
-
if(1===this.supportedScaledUnits.length||0===t||t===1/0||Number.isNaN(t))return{scaledValue:e,scaledUnit:this.baseScaledUnit}
|
|
11244
|
-
for(let n=this.supportedScaledUnits.length-1;n>=0;n-=1){const i=this.supportedScaledUnits[n]
|
|
11245
|
-
if(t/i.scaleFactor>=1)return{scaledValue:e/i.scaleFactor,scaledUnit:i}}const n=this.supportedScaledUnits[0]
|
|
11246
|
-
return{scaledValue:e/n.scaleFactor,scaledUnit:n}}}const PF=new class extends FF{constructor(){super([new RF(1,OF.createFactory({}))])}},NF="negative"
|
|
11247
|
-
class LF extends AF{constructor(e,{unitScale:t=PF}={unitScale:PF}){super(),this.defaultIntlNumberFormatOptions={maximumSignificantDigits:LF.maximumDigits,maximumFractionDigits:LF.maximumDigits-1,roundingPriority:"lessPrecision",signDisplay:NF},this.defaultScaledUnitFormatters=new Map,this.exponentialIntlNumberFormatOptions={maximumSignificantDigits:LF.maximumDigits,notation:"scientific",signDisplay:NF}
|
|
11248
|
-
for(const n of t.supportedScaledUnits)this.defaultScaledUnitFormatters.set(n.scaleFactor,n.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:this.defaultIntlNumberFormatOptions}))
|
|
11249
|
-
this.exponentialScaledUnitFormatter=t.baseScaledUnit.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:this.exponentialIntlNumberFormatOptions}),this.unitScale=t}resolvedOptions(){return{unitScale:this.unitScale}}tryFormat(e){const{scaledValue:t,scaledUnit:n}=this.unitScale.scaleNumber(e),i=Math.abs(t)
|
|
11250
|
-
return 0!==i&&(i>=LF.exponentialUpperBound||i<LF.exponentialLowerBound)?this.exponentialScaledUnitFormatter.format(e):this.defaultScaledUnitFormatters.get(n.scaleFactor).format(t)}}LF.maximumDigits=6,LF.exponentialLowerBound=995e-6,LF.exponentialUpperBound=999999.5
|
|
11251
|
-
class zF extends AF{constructor(e,{minimumFractionDigits:t=0,maximumFractionDigits:n=Math.max(3,t),unitScale:i=PF}={minimumFractionDigits:0,maximumFractionDigits:3,unitScale:PF}){super(),this.scaledUnitFormatters=new Map
|
|
11252
|
-
const o={maximumFractionDigits:n,minimumFractionDigits:t,signDisplay:"negative"}
|
|
11253
|
-
for(const t of i.supportedScaledUnits)this.scaledUnitFormatters.set(t.scaleFactor,t.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:o}))
|
|
11254
|
-
this.unitScale=i,this.minimumFractionDigits=t,this.maximumFractionDigits=n}resolvedOptions(){return{unitScale:this.unitScale,maximumFractionDigits:this.maximumFractionDigits,minimumFractionDigits:this.minimumFractionDigits}}tryFormat(e){const{scaledValue:t,scaledUnit:n}=this.unitScale.scaleNumber(e)
|
|
11255
|
-
return this.scaledUnitFormatters.get(n.scaleFactor).format(t)}}class VF extends AF{constructor(e,t){super(),this._resolvedOptions=this.resolveOptions(t),this.resolvedUnitFormat=this.resolveUnitFormat(e,this._resolvedOptions)}resolvedOptions(){return{...this._resolvedOptions}}optionsMatch(e){const t=this.resolveOptions(e)
|
|
11256
|
-
return this._resolvedOptions.decimalDigits===t.decimalDigits&&this._resolvedOptions.decimalMaximumDigits===t.decimalMaximumDigits&&this._resolvedOptions.numberTextFormat===t.numberTextFormat&&this._resolvedOptions.unitScale===t.unitScale}tryFormat(e){return this.resolvedUnitFormat.format(e)}resolveUnitFormat(e,t){const{numberTextFormat:n,decimalMaximumDigits:i,decimalDigits:o,unitScale:r}=t
|
|
11257
|
-
return n===_F.default?new LF(e,{unitScale:r}):new zF(e,"number"==typeof o?{minimumFractionDigits:o,maximumFractionDigits:o,unitScale:r}:{minimumFractionDigits:0,maximumFractionDigits:i,unitScale:r})}resolveOptions(e){if(!e||e.numberTextFormat===_F.default)return{numberTextFormat:_F.default,decimalDigits:void 0,decimalMaximumDigits:void 0,unitScale:e?.unitScale??PF}
|
|
11258
|
-
const t="number"==typeof e.decimalDigits,n="number"==typeof e.decimalMaximumDigits
|
|
11259
|
-
if(t&&n)throw new Error("decimalDigits and decimalMaximumDigits are mutually exclusive. Do not specify both.")
|
|
11260
|
-
return t||n?{numberTextFormat:_F.decimal,decimalDigits:e.decimalDigits,decimalMaximumDigits:e.decimalMaximumDigits,unitScale:e.unitScale??PF}:{numberTextFormat:_F.decimal,decimalDigits:VF.defaultDecimalDigits,decimalMaximumDigits:void 0,unitScale:e.unitScale??PF}}}VF.defaultDecimalDigits=2
|
|
11261
|
-
const HF=["invalidDecimalDigits","invalidDecimalMaximumDigits","decimalDigitsMutuallyExclusiveWithDecimalMaximumDigits","moreThanOneUnitSpecified"]
|
|
11262
|
-
class BF extends zR{constructor(){super(HF)}validateDecimalDigits(e,t){const n=!!(e===_F.decimal&&"number"==typeof t)&&this.isInvalidDecimalDigitsValue(t)
|
|
11263
|
-
this.setConditionValue("invalidDecimalDigits",n)}validateDecimalMaximumDigits(e,t){const n=!!(e===_F.decimal&&"number"==typeof t)&&this.isInvalidDecimalDigitsValue(t)
|
|
11264
|
-
this.setConditionValue("invalidDecimalMaximumDigits",n)}validateNoMutuallyExclusiveProperties(e,t,n){const i=!!(e===_F.decimal)&&("number"==typeof t&&"number"==typeof n)
|
|
11265
|
-
this.setConditionValue("decimalDigitsMutuallyExclusiveWithDecimalMaximumDigits",i)}validateAtMostOneUnit(e){const t=e.length>1
|
|
11266
|
-
this.setConditionValue("moreThanOneUnitSpecified",t)}isInvalidDecimalDigitsValue(e){return e<0||e>20}}class qF extends Vt{}e([g],qF.prototype,"resolvedUnitScale",void 0)
|
|
11267
|
-
class UF extends(rF(oF)){constructor(){super(...arguments),this.langSubscriber={handleChange:()=>{this.updateColumnConfig()}},this.unitSubscriber={handleChange:()=>{this.updateColumnConfig()}}}connectedCallback(){super.connectedCallback(),_a.subscribe(this.langSubscriber,this),this.updateColumnConfig()}disconnectedCallback(){super.disconnectedCallback(),_a.unsubscribe(this.langSubscriber,this)}placeholderChanged(){this.updateColumnConfig()}getColumnInternalsOptions(){return{cellRecordFieldNames:["value"],cellViewTag:"nimble-table-column-number-text-cell-view",groupHeaderViewTag:"nimble-table-column-number-text-group-header-view",delegatedEvents:[],sortOperation:_O,validator:new BF}}updateUnitNotifier(){if(this.unitNotifier&&(this.unitNotifier.unsubscribe(this.unitSubscriber),this.unitNotifier=void 0),this.unit){const e=m.getNotifier(this.unit)
|
|
11268
|
-
e.subscribe(this.unitSubscriber,"resolvedUnitScale"),this.unitNotifier=e}}formatChanged(){this.updateColumnConfig()}alignmentChanged(){this.updateColumnConfig()}decimalDigitsChanged(){this.updateColumnConfig()}decimalMaximumDigitsChanged(){this.updateColumnConfig()}unitElementsChanged(){this.updateUnit()}async updateUnit(){this.unit=void 0,this.unitElements&&(await Y_(this.unitElements),this.unit=this.unitElements.find((e=>e instanceof qF))),this.updateUnitNotifier()}unitChanged(){this.updateColumnConfig()}updateColumnConfig(){const e=this.columnInternals.validator
|
|
11269
|
-
if(e.validateDecimalDigits(this.format,this.decimalDigits),e.validateDecimalMaximumDigits(this.format,this.decimalMaximumDigits),e.validateNoMutuallyExclusiveProperties(this.format,this.decimalDigits,this.decimalMaximumDigits),e.validateAtMostOneUnit(this.unitElements??[]),e.isValid()){const e={formatter:this.createFormatter(),alignment:this.determineCellContentAlignment(),placeholder:this.placeholder}
|
|
11270
|
-
this.columnInternals.columnConfig=e}else this.columnInternals.columnConfig=void 0}createFormatter(){const e=this.unit?.resolvedUnitScale
|
|
11271
|
-
return new VF(_a.getValueFor(this),{numberTextFormat:this.format??void 0,decimalDigits:this.decimalDigits??void 0,decimalMaximumDigits:this.decimalMaximumDigits??void 0,unitScale:e})}determineCellContentAlignment(){return this.alignment===IF?lF:this.alignment===DF?cF:this.format!==_F.decimal||"number"==typeof this.decimalMaximumDigits||this.unit?lF:cF}}e([le],UF.prototype,"format",void 0),e([le],UF.prototype,"alignment",void 0),e([le({attribute:"decimal-digits",converter:se})],UF.prototype,"decimalDigits",void 0),e([le({attribute:"decimal-maximum-digits",converter:se})],UF.prototype,"decimalMaximumDigits",void 0),e([g],UF.prototype,"unitElements",void 0),e([g],UF.prototype,"unit",void 0)
|
|
11272
|
-
const jF=UF.compose({baseName:"table-column-number-text",template:$F,styles:BR})
|
|
11273
|
-
wi.getOrCreate().withPrefix("nimble").register(jF())
|
|
11274
|
-
const WF=(e,t)=>{if("number"===t){const t=se.fromView(e)
|
|
11230
|
+
const $F=(e,t)=>{if("number"===t){const t=se.fromView(e)
|
|
11275
11231
|
return null===t?void 0:t}return"boolean"===t?!1!==e&&"false"!==e&&(!0===e||"true"===e||void 0):e?.toString()??void 0}
|
|
11276
|
-
class
|
|
11277
|
-
return this.mappings.forEach((t=>{const n
|
|
11232
|
+
class MF extends LO{constructor(){super(...arguments),this.mappingNotifiers=[],this.mappings=[],this.keyType="string"}handleChange(e,t){e instanceof dv&&"string"==typeof t&&this.updateColumnConfig()}updateColumnConfig(){this.columnInternals.validator.validate(this.mappings,this.keyType),this.columnInternals.columnConfig=this.checkValidity()?this.createColumnConfig(this.getMappingConfigs()):void 0}getMappingConfigs(){const e=new Map
|
|
11233
|
+
return this.mappings.forEach((t=>{const n=$F(t.key,this.keyType)
|
|
11278
11234
|
if(void 0===n)throw Error("Key was invalid for type. Validation should have prevented this.")
|
|
11279
11235
|
const i=this.createMappingConfig(t)
|
|
11280
11236
|
e.set(n,i)})),e}fieldNameChanged(){this.columnInternals.dataRecordFieldNames=[this.fieldName],this.columnInternals.operandDataRecordFieldName=this.fieldName}mappingsChanged(){this.updateColumnConfig(),this.observeMappings()}keyTypeChanged(){this.updateColumnConfig()}removeMappingObservers(){this.mappingNotifiers.forEach((e=>{e.unsubscribe(this)})),this.mappingNotifiers=[]}observeMappings(){this.removeMappingObservers()
|
|
11281
11237
|
for(const e of this.mappings){const t=m.getNotifier(e)
|
|
11282
|
-
t.subscribe(this),this.mappingNotifiers.push(t)}}}e([g],
|
|
11283
|
-
const
|
|
11238
|
+
t.subscribe(this),this.mappingNotifiers.push(t)}}}e([g],MF.prototype,"mappings",void 0),e([le({attribute:"field-name"})],MF.prototype,"fieldName",void 0),e([le({attribute:"key-type"})],MF.prototype,"keyType",void 0)
|
|
11239
|
+
const EF=xe`
|
|
11284
11240
|
${BR}
|
|
11285
11241
|
|
|
11286
11242
|
slot[name='mapping'] {
|
|
11287
11243
|
display: none;
|
|
11288
11244
|
}
|
|
11289
|
-
`,
|
|
11290
|
-
class
|
|
11245
|
+
`,_F=Z`${qR}<slot ${Ye("mappings")} name="mapping"></slot>`
|
|
11246
|
+
class IF extends zR{constructor(e){super(e)}validate(e,t){this.untrackAll()
|
|
11291
11247
|
const n=e.map((e=>e.key))
|
|
11292
|
-
this.validateKeyValuesForType(n,t),this.validateUniqueKeys(n,t),this.validateNoMissingKeys(e)}validateKeyValuesForType(e,t){const n=e.some((e=>void 0!==e&&void 0
|
|
11293
|
-
this.setConditionValue("invalidMappingKeyValueForType",n)}validateUniqueKeys(e,t){const n=e.map((e
|
|
11248
|
+
this.validateKeyValuesForType(n,t),this.validateUniqueKeys(n,t),this.validateNoMissingKeys(e)}validateKeyValuesForType(e,t){const n=e.some((e=>void 0!==e&&void 0===$F(e,t)))
|
|
11249
|
+
this.setConditionValue("invalidMappingKeyValueForType",n)}validateUniqueKeys(e,t){const n=e.map((e=>$F(e,t))),i=new Set(n).size!==n.length
|
|
11294
11250
|
this.setConditionValue("duplicateMappingKey",i)}validateNoMissingKeys(e){const t=e.some((e=>void 0===e.key))
|
|
11295
|
-
this.setConditionValue("missingKeyValue",t)}}const
|
|
11296
|
-
class
|
|
11297
|
-
this.setConditionValue("invalidIconName",t)}validateNoMissingText(e){const t=e.filter(
|
|
11298
|
-
this.setConditionValue("missingTextValue",t)}validateMappingTypes(e){const t=e.every(
|
|
11299
|
-
this.setConditionValue("unsupportedMappingType",!t)}}const
|
|
11251
|
+
this.setConditionValue("missingKeyValue",t)}}const DF=["invalidMappingKeyValueForType","duplicateMappingKey","missingKeyValue","unsupportedMappingType","invalidIconName","missingTextValue"]
|
|
11252
|
+
class AF extends IF{constructor(){super(DF)}static isIconMappingElement(e){return e instanceof mv}static isSupportedMappingElement(e){return e instanceof mv||e instanceof vv||e instanceof uv}static hasUnresolvedIcon(e){return"string"==typeof e.icon&&void 0===e.resolvedIcon}validate(e,t){super.validate(e,t),this.validateMappingTypes(e),this.validateIconNames(e),this.validateNoMissingText(e)}validateIconNames(e){const t=e.filter(AF.isIconMappingElement).some(AF.hasUnresolvedIcon)
|
|
11253
|
+
this.setConditionValue("invalidIconName",t)}validateNoMissingText(e){const t=e.filter(AF.isSupportedMappingElement).some((e=>void 0===e.text))
|
|
11254
|
+
this.setConditionValue("missingTextValue",t)}validateMappingTypes(e){const t=e.every(AF.isSupportedMappingElement)
|
|
11255
|
+
this.setConditionValue("unsupportedMappingType",!t)}}const TF=xe`
|
|
11300
11256
|
${Oo("inline-flex")}
|
|
11301
11257
|
|
|
11302
11258
|
:host {
|
|
@@ -11318,7 +11274,7 @@ this.setConditionValue("unsupportedMappingType",!t)}}const QF=xe`
|
|
|
11318
11274
|
overflow: hidden;
|
|
11319
11275
|
text-overflow: ellipsis;
|
|
11320
11276
|
}
|
|
11321
|
-
`,
|
|
11277
|
+
`,OF=Z`
|
|
11322
11278
|
${He((e=>e.visualizationTemplate),Z`
|
|
11323
11279
|
<span class="reserve-icon-size">
|
|
11324
11280
|
${e=>e.visualizationTemplate}
|
|
@@ -11329,10 +11285,10 @@ this.setConditionValue("unsupportedMappingType",!t)}}const QF=xe`
|
|
|
11329
11285
|
title="${e=>e.hasOverflow&&e.text?e.text:null}"
|
|
11330
11286
|
class="text"
|
|
11331
11287
|
>${e=>e.text}</span>
|
|
11332
|
-
`,
|
|
11333
|
-
class
|
|
11334
|
-
class
|
|
11335
|
-
super(n),this.severity=t,this.textHidden=i,this.iconTemplate=void 0===(o=e)?
|
|
11288
|
+
`,RF={default:void 0,error:"error",warning:"warning",success:"success",information:"information"}
|
|
11289
|
+
class FF{constructor(e){this.text=e}}const PF=Z` `
|
|
11290
|
+
class NF extends FF{constructor(e,t,n,i){var o
|
|
11291
|
+
super(n),this.severity=t,this.textHidden=i,this.iconTemplate=void 0===(o=e)?PF:Z`
|
|
11336
11292
|
<${o}
|
|
11337
11293
|
title="${e=>e.textHidden?e.text:""}"
|
|
11338
11294
|
role="img"
|
|
@@ -11341,7 +11297,7 @@ super(n),this.severity=t,this.textHidden=i,this.iconTemplate=void 0===(o=e)?iP:Z
|
|
|
11341
11297
|
severity="${e=>e.severity}"
|
|
11342
11298
|
>
|
|
11343
11299
|
</${o}>
|
|
11344
|
-
`}}const
|
|
11300
|
+
`}}const LF=Z`
|
|
11345
11301
|
<${uT}
|
|
11346
11302
|
title="${e=>e.textHidden?e.text:""}"
|
|
11347
11303
|
aria-label="${e=>e.text}"
|
|
@@ -11349,12 +11305,12 @@ super(n),this.severity=t,this.textHidden=i,this.iconTemplate=void 0===(o=e)?iP:Z
|
|
|
11349
11305
|
>
|
|
11350
11306
|
</${uT}>
|
|
11351
11307
|
`
|
|
11352
|
-
class
|
|
11308
|
+
class zF extends FF{constructor(e,t){super(e),this.textHidden=t,this.spinnerTemplate=LF}}class VF extends FF{}class HF extends YR{constructor(){super(...arguments),this.textHidden=!1}updateText(){if(this.resetState(),!this.columnConfig)return
|
|
11353
11309
|
const e=this.groupHeaderValue,t=this.columnConfig.mappingConfigs.get(e)
|
|
11354
|
-
t instanceof
|
|
11355
|
-
const
|
|
11356
|
-
wi.getOrCreate().withPrefix("nimble").register(
|
|
11357
|
-
const
|
|
11310
|
+
t instanceof NF?(this.severity=t.severity,this.text=t.text??"",this.visualizationTemplate=t.iconTemplate):t instanceof zF?(this.text=t.text??"",this.visualizationTemplate=t.spinnerTemplate):t instanceof VF&&(this.text=t.text??"")}resetState(){this.text="",this.visualizationTemplate=void 0,this.severity=RF.default}}e([g],HF.prototype,"severity",void 0),e([g],HF.prototype,"visualizationTemplate",void 0)
|
|
11311
|
+
const BF=HF.compose({baseName:"table-column-mapping-group-header-view",template:OF,styles:TF})
|
|
11312
|
+
wi.getOrCreate().withPrefix("nimble").register(BF())
|
|
11313
|
+
const qF=xe`
|
|
11358
11314
|
${Oo("inline-flex")}
|
|
11359
11315
|
|
|
11360
11316
|
:host {
|
|
@@ -11376,7 +11332,7 @@ const dP=xe`
|
|
|
11376
11332
|
overflow: hidden;
|
|
11377
11333
|
text-overflow: ellipsis;
|
|
11378
11334
|
}
|
|
11379
|
-
`,
|
|
11335
|
+
`,UF=Z`
|
|
11380
11336
|
${He((e=>e.visualizationTemplate),Z`
|
|
11381
11337
|
<span class="reserve-icon-size">
|
|
11382
11338
|
${e=>e.visualizationTemplate}
|
|
@@ -11392,19 +11348,70 @@ const dP=xe`
|
|
|
11392
11348
|
</span>
|
|
11393
11349
|
`)}
|
|
11394
11350
|
`
|
|
11395
|
-
class
|
|
11351
|
+
class jF extends RO{constructor(){super(...arguments),this.textHidden=!1,this.hasOverflow=!1}columnConfigChanged(){this.updateState()}cellRecordChanged(){this.updateState()}updateState(){if(this.resetState(),!this.columnConfig||!this.cellRecord)return
|
|
11396
11352
|
const e=this.cellRecord.value
|
|
11397
11353
|
if(null==e)return
|
|
11398
11354
|
const t=this.columnConfig.mappingConfigs.get(e)
|
|
11399
|
-
t instanceof
|
|
11400
|
-
const
|
|
11401
|
-
wi.getOrCreate().withPrefix("nimble").register(
|
|
11402
|
-
const
|
|
11403
|
-
class
|
|
11404
|
-
if(e instanceof vv)return new
|
|
11405
|
-
if(e instanceof uv)return new
|
|
11406
|
-
throw new Error("Unsupported mapping")}widthModeChanged(){this.widthMode===
|
|
11407
|
-
const
|
|
11355
|
+
t instanceof NF?(this.severity=t.severity,this.text=t.text,this.visualizationTemplate=t.iconTemplate,this.textHidden=t.textHidden):t instanceof zF?(this.text=t.text,this.visualizationTemplate=t.spinnerTemplate,this.textHidden=t.textHidden):t instanceof VF&&(this.text=t.text,this.textHidden=!1)}resetState(){this.text=void 0,this.textHidden=!1,this.visualizationTemplate=void 0,this.severity=RF.default}}e([g],jF.prototype,"severity",void 0),e([g],jF.prototype,"text",void 0),e([g],jF.prototype,"visualizationTemplate",void 0),e([g],jF.prototype,"textHidden",void 0),e([g],jF.prototype,"hasOverflow",void 0)
|
|
11356
|
+
const WF=jF.compose({baseName:"table-column-mapping-cell-view",template:UF,styles:qF})
|
|
11357
|
+
wi.getOrCreate().withPrefix("nimble").register(WF())
|
|
11358
|
+
const ZF="icon-size"
|
|
11359
|
+
class GF extends(jR(UR(MF))){minPixelWidthChanged(){this.widthMode!==ZF&&(this.columnInternals.minPixelWidth=this.getConfiguredMinPixelWidth())}getColumnInternalsOptions(){return{cellRecordFieldNames:["value"],cellViewTag:"nimble-table-column-mapping-cell-view",groupHeaderViewTag:"nimble-table-column-mapping-group-header-view",delegatedEvents:[],sortOperation:_O,validator:new AF}}createColumnConfig(e){return{mappingConfigs:e}}createMappingConfig(e){if(e instanceof mv)return new NF(e.resolvedIcon,e.severity,e.text,e.textHidden)
|
|
11360
|
+
if(e instanceof vv)return new zF(e.text,e.textHidden)
|
|
11361
|
+
if(e instanceof uv)return new VF(e.text)
|
|
11362
|
+
throw new Error("Unsupported mapping")}widthModeChanged(){this.widthMode===ZF?(this.columnInternals.resizingDisabled=!0,this.columnInternals.hideHeaderIndicators=!0,this.columnInternals.pixelWidth=32,this.columnInternals.minPixelWidth=32):(this.columnInternals.resizingDisabled=!1,this.columnInternals.hideHeaderIndicators=!1,this.columnInternals.pixelWidth=void 0,this.columnInternals.minPixelWidth=this.getConfiguredMinPixelWidth())}getConfiguredMinPixelWidth(){return"number"==typeof this.minPixelWidth?this.minPixelWidth:DO}}e([le({attribute:"width-mode"})],GF.prototype,"widthMode",void 0)
|
|
11363
|
+
const KF=GF.compose({baseName:"table-column-mapping",template:_F,styles:EF})
|
|
11364
|
+
wi.getOrCreate().withPrefix("nimble").register(KF())
|
|
11365
|
+
const XF=Z`<span
|
|
11366
|
+
${Zm("hasOverflow")}
|
|
11367
|
+
class="header-content"
|
|
11368
|
+
title=${e=>e.hasOverflow&&e.headerTextContent?e.headerTextContent:null}
|
|
11369
|
+
>
|
|
11370
|
+
<slot ${Ne("contentSlot")}></slot>
|
|
11371
|
+
<slot ${Ye({property:"unitElements",filter:Ge()})} name="unit"></slot>
|
|
11372
|
+
</span>`
|
|
11373
|
+
const YF=class extends YR{updateText(){this.text=this.columnConfig?.formatter?.format(this.groupHeaderValue)??""}}.compose({baseName:"table-column-number-text-group-header-view",template:JR,styles:QR})
|
|
11374
|
+
wi.getOrCreate().withPrefix("nimble").register(YF())
|
|
11375
|
+
const JF=class extends uF{columnConfigChanged(){super.columnConfigChanged(),this.alignment=this.columnConfig?.alignment??lF}updateText(){this.text=this.columnConfig?.formatter?.format(this.cellRecord?.value)??""}}.compose({baseName:"table-column-number-text-cell-view",template:dF,styles:hF})
|
|
11376
|
+
wi.getOrCreate().withPrefix("nimble").register(JF())
|
|
11377
|
+
const QF={default:void 0,decimal:"decimal"},eP="left",tP="right"
|
|
11378
|
+
class nP{format(e){if("number"!=typeof e)return""
|
|
11379
|
+
try{return this.tryFormat(e)}catch{return""}}}class iP{constructor(e){this.locale=e.locale,this.intlNumberFormatOptions=e.intlNumberFormatOptions}}class oP extends iP{constructor(e,t){super(e),this.formatter=new Intl.NumberFormat(this.locale,{...t,...this.intlNumberFormatOptions})}static createFactory(e){return t=>new oP(t,e)}format(e){return this.formatter.format(e)}}class rP{constructor(e,t){this.scaleFactor=e,this.scaledUnitFormatFactory=t}isBase(){return 1===this.scaleFactor}}class sP{constructor(e){this.supportedScaledUnits=e
|
|
11380
|
+
const t=e.every(((e,t,n)=>0===t||n[t-1].scaleFactor<e.scaleFactor))
|
|
11381
|
+
if(!t)throw new Error("Supported scaled units must have unique and ordered scale factors")
|
|
11382
|
+
const n=e.find((e=>e.isBase()))
|
|
11383
|
+
if(!n)throw new Error("Supported scaled units must include a base scaled unit (scale factor=1)")
|
|
11384
|
+
this.supportedScaledUnits=e,this.baseScaledUnit=n}scaleNumber(e){const t=Math.abs(e)
|
|
11385
|
+
if(1===this.supportedScaledUnits.length||0===t||t===1/0||Number.isNaN(t))return{scaledValue:e,scaledUnit:this.baseScaledUnit}
|
|
11386
|
+
for(let n=this.supportedScaledUnits.length-1;n>=0;n-=1){const i=this.supportedScaledUnits[n]
|
|
11387
|
+
if(t/i.scaleFactor>=1)return{scaledValue:e/i.scaleFactor,scaledUnit:i}}const n=this.supportedScaledUnits[0]
|
|
11388
|
+
return{scaledValue:e/n.scaleFactor,scaledUnit:n}}}const aP=new class extends sP{constructor(){super([new rP(1,oP.createFactory({}))])}},lP="negative"
|
|
11389
|
+
class cP extends nP{constructor(e,{unitScale:t=aP}={unitScale:aP}){super(),this.defaultIntlNumberFormatOptions={maximumSignificantDigits:cP.maximumDigits,maximumFractionDigits:cP.maximumDigits-1,roundingPriority:"lessPrecision",signDisplay:lP},this.defaultScaledUnitFormatters=new Map,this.exponentialIntlNumberFormatOptions={maximumSignificantDigits:cP.maximumDigits,notation:"scientific",signDisplay:lP}
|
|
11390
|
+
for(const n of t.supportedScaledUnits)this.defaultScaledUnitFormatters.set(n.scaleFactor,n.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:this.defaultIntlNumberFormatOptions}))
|
|
11391
|
+
this.exponentialScaledUnitFormatter=t.baseScaledUnit.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:this.exponentialIntlNumberFormatOptions}),this.unitScale=t}resolvedOptions(){return{unitScale:this.unitScale}}tryFormat(e){const{scaledValue:t,scaledUnit:n}=this.unitScale.scaleNumber(e),i=Math.abs(t)
|
|
11392
|
+
return 0!==i&&(i>=cP.exponentialUpperBound||i<cP.exponentialLowerBound)?this.exponentialScaledUnitFormatter.format(e):this.defaultScaledUnitFormatters.get(n.scaleFactor).format(t)}}cP.maximumDigits=6,cP.exponentialLowerBound=995e-6,cP.exponentialUpperBound=999999.5
|
|
11393
|
+
class dP extends nP{constructor(e,{minimumFractionDigits:t=0,maximumFractionDigits:n=Math.max(3,t),unitScale:i=aP}={minimumFractionDigits:0,maximumFractionDigits:3,unitScale:aP}){super(),this.scaledUnitFormatters=new Map
|
|
11394
|
+
const o={maximumFractionDigits:n,minimumFractionDigits:t,signDisplay:"negative"}
|
|
11395
|
+
for(const t of i.supportedScaledUnits)this.scaledUnitFormatters.set(t.scaleFactor,t.scaledUnitFormatFactory({locale:e,intlNumberFormatOptions:o}))
|
|
11396
|
+
this.unitScale=i,this.minimumFractionDigits=t,this.maximumFractionDigits=n}resolvedOptions(){return{unitScale:this.unitScale,maximumFractionDigits:this.maximumFractionDigits,minimumFractionDigits:this.minimumFractionDigits}}tryFormat(e){const{scaledValue:t,scaledUnit:n}=this.unitScale.scaleNumber(e)
|
|
11397
|
+
return this.scaledUnitFormatters.get(n.scaleFactor).format(t)}}class hP extends nP{constructor(e,t){super(),this._resolvedOptions=this.resolveOptions(t),this.resolvedUnitFormat=this.resolveUnitFormat(e,this._resolvedOptions)}resolvedOptions(){return{...this._resolvedOptions}}optionsMatch(e){const t=this.resolveOptions(e)
|
|
11398
|
+
return this._resolvedOptions.decimalDigits===t.decimalDigits&&this._resolvedOptions.decimalMaximumDigits===t.decimalMaximumDigits&&this._resolvedOptions.numberTextFormat===t.numberTextFormat&&this._resolvedOptions.unitScale===t.unitScale}tryFormat(e){return this.resolvedUnitFormat.format(e)}resolveUnitFormat(e,t){const{numberTextFormat:n,decimalMaximumDigits:i,decimalDigits:o,unitScale:r}=t
|
|
11399
|
+
return n===QF.default?new cP(e,{unitScale:r}):new dP(e,"number"==typeof o?{minimumFractionDigits:o,maximumFractionDigits:o,unitScale:r}:{minimumFractionDigits:0,maximumFractionDigits:i,unitScale:r})}resolveOptions(e){if(!e||e.numberTextFormat===QF.default)return{numberTextFormat:QF.default,decimalDigits:void 0,decimalMaximumDigits:void 0,unitScale:e?.unitScale??aP}
|
|
11400
|
+
const t="number"==typeof e.decimalDigits,n="number"==typeof e.decimalMaximumDigits
|
|
11401
|
+
if(t&&n)throw new Error("decimalDigits and decimalMaximumDigits are mutually exclusive. Do not specify both.")
|
|
11402
|
+
return t||n?{numberTextFormat:QF.decimal,decimalDigits:e.decimalDigits,decimalMaximumDigits:e.decimalMaximumDigits,unitScale:e.unitScale??aP}:{numberTextFormat:QF.decimal,decimalDigits:hP.defaultDecimalDigits,decimalMaximumDigits:void 0,unitScale:e.unitScale??aP}}}hP.defaultDecimalDigits=2
|
|
11403
|
+
const uP=["invalidDecimalDigits","invalidDecimalMaximumDigits","decimalDigitsMutuallyExclusiveWithDecimalMaximumDigits","moreThanOneUnitSpecified"]
|
|
11404
|
+
class pP extends zR{constructor(){super(uP)}validateDecimalDigits(e,t){const n=!!(e===QF.decimal&&"number"==typeof t)&&this.isInvalidDecimalDigitsValue(t)
|
|
11405
|
+
this.setConditionValue("invalidDecimalDigits",n)}validateDecimalMaximumDigits(e,t){const n=!!(e===QF.decimal&&"number"==typeof t)&&this.isInvalidDecimalDigitsValue(t)
|
|
11406
|
+
this.setConditionValue("invalidDecimalMaximumDigits",n)}validateNoMutuallyExclusiveProperties(e,t,n){const i=!!(e===QF.decimal)&&("number"==typeof t&&"number"==typeof n)
|
|
11407
|
+
this.setConditionValue("decimalDigitsMutuallyExclusiveWithDecimalMaximumDigits",i)}validateAtMostOneUnit(e){const t=e.length>1
|
|
11408
|
+
this.setConditionValue("moreThanOneUnitSpecified",t)}isInvalidDecimalDigitsValue(e){return e<0||e>20}}class fP extends Vt{}e([g],fP.prototype,"resolvedUnitScale",void 0)
|
|
11409
|
+
class mP extends(rF(oF)){constructor(){super(...arguments),this.langSubscriber={handleChange:()=>{this.updateColumnConfig()}},this.unitSubscriber={handleChange:()=>{this.updateColumnConfig()}}}connectedCallback(){super.connectedCallback(),_a.subscribe(this.langSubscriber,this),this.updateColumnConfig()}disconnectedCallback(){super.disconnectedCallback(),_a.unsubscribe(this.langSubscriber,this)}placeholderChanged(){this.updateColumnConfig()}getColumnInternalsOptions(){return{cellRecordFieldNames:["value"],cellViewTag:"nimble-table-column-number-text-cell-view",groupHeaderViewTag:"nimble-table-column-number-text-group-header-view",delegatedEvents:[],sortOperation:_O,validator:new pP}}updateUnitNotifier(){if(this.unitNotifier&&(this.unitNotifier.unsubscribe(this.unitSubscriber),this.unitNotifier=void 0),this.unit){const e=m.getNotifier(this.unit)
|
|
11410
|
+
e.subscribe(this.unitSubscriber,"resolvedUnitScale"),this.unitNotifier=e}}formatChanged(){this.updateColumnConfig()}alignmentChanged(){this.updateColumnConfig()}decimalDigitsChanged(){this.updateColumnConfig()}decimalMaximumDigitsChanged(){this.updateColumnConfig()}unitElementsChanged(){this.updateUnit()}async updateUnit(){this.unit=void 0,this.unitElements&&(await Y_(this.unitElements),this.unit=this.unitElements.find((e=>e instanceof fP))),this.updateUnitNotifier()}unitChanged(){this.updateColumnConfig()}updateColumnConfig(){const e=this.columnInternals.validator
|
|
11411
|
+
if(e.validateDecimalDigits(this.format,this.decimalDigits),e.validateDecimalMaximumDigits(this.format,this.decimalMaximumDigits),e.validateNoMutuallyExclusiveProperties(this.format,this.decimalDigits,this.decimalMaximumDigits),e.validateAtMostOneUnit(this.unitElements??[]),e.isValid()){const e={formatter:this.createFormatter(),alignment:this.determineCellContentAlignment(),placeholder:this.placeholder}
|
|
11412
|
+
this.columnInternals.columnConfig=e}else this.columnInternals.columnConfig=void 0}createFormatter(){const e=this.unit?.resolvedUnitScale
|
|
11413
|
+
return new hP(_a.getValueFor(this),{numberTextFormat:this.format??void 0,decimalDigits:this.decimalDigits??void 0,decimalMaximumDigits:this.decimalMaximumDigits??void 0,unitScale:e})}determineCellContentAlignment(){return this.alignment===eP?lF:this.alignment===tP?cF:this.format!==QF.decimal||"number"==typeof this.decimalMaximumDigits||this.unit?lF:cF}}e([le],mP.prototype,"format",void 0),e([le],mP.prototype,"alignment",void 0),e([le({attribute:"decimal-digits",converter:se})],mP.prototype,"decimalDigits",void 0),e([le({attribute:"decimal-maximum-digits",converter:se})],mP.prototype,"decimalMaximumDigits",void 0),e([g],mP.prototype,"unitElements",void 0),e([g],mP.prototype,"unit",void 0)
|
|
11414
|
+
const gP=mP.compose({baseName:"table-column-number-text",template:XF,styles:BR})
|
|
11408
11415
|
wi.getOrCreate().withPrefix("nimble").register(gP())
|
|
11409
11416
|
const vP=class extends uF{updateText(){this.text="string"==typeof this.cellRecord?.value?this.cellRecord.value:""}}.compose({baseName:"table-column-text-cell-view",template:dF,styles:hF})
|
|
11410
11417
|
wi.getOrCreate().withPrefix("nimble").register(vP())
|
|
@@ -12392,19 +12399,19 @@ e instanceof ZP&&(e.groupSelected=!0)}}}e([le({attribute:"selection-mode"})],YP.
|
|
|
12392
12399
|
const JP=YP.compose({baseName:"tree-view",baseClass:To,template:XP,styles:KP})
|
|
12393
12400
|
wi.getOrCreate().withPrefix("nimble").register(JP())
|
|
12394
12401
|
const QP=Z`<template slot="unit"></template>`
|
|
12395
|
-
class eN{constructor(e,t,n){this.singular=e,this.plural=t,this.symbol=n}}class tN extends
|
|
12402
|
+
class eN{constructor(e,t,n){this.singular=e,this.plural=t,this.symbol=n}}class tN extends iP{constructor(e,{unitTranslations:t,scaledPrefixText:n}){if(super(e),!t.get("en"))throw new Error('English translations must exist with locale string "en"')
|
|
12396
12403
|
this.pluralRules=new Intl.PluralRules(this.locale),this.formatter=new Intl.NumberFormat(this.locale,this.intlNumberFormatOptions),this.unitTranslation=this.getTranslationToUse(t,this.locale),this.scaledPrefixText=n}static createFactory(e){return t=>new tN(t,e)}format(e){const t=this.formatter.format(e)
|
|
12397
12404
|
if(""!==this.scaledPrefixText)return`${t} ${this.scaledPrefixText}${this.unitTranslation.symbol}`
|
|
12398
12405
|
return`${t} ${"one"===this.pluralRules.select(e)?this.unitTranslation.singular:this.unitTranslation.plural}`}getTranslationToUse(e,t){const n=new Intl.Locale(t??"en"),i=n.language,o=n.region
|
|
12399
12406
|
return(o?e.get(`${i}-${o}`):void 0)??e.get(i)??e.get("en")}}const nN=new Map([["en",new eN("byte","bytes","B")],["fr",new eN("octet","octets","o")],["de",new eN("Byte","Byte","B")],["ja",new eN("バイト","バイト","B")],["zh",new eN("字节","字节","B")]]),iN=[[1,""],[1024,"Ki"],[1048576,"Mi"],[1024**3,"Gi"],[1024**4,"Ti"],[1024**5,"Pi"]]
|
|
12400
|
-
const oN=new class extends
|
|
12401
|
-
const sN=new class extends
|
|
12402
|
-
class aN extends
|
|
12407
|
+
const oN=new class extends sP{constructor(){super(iN.map((([e,t])=>new rP(e,tN.createFactory({unitTranslations:nN,scaledPrefixText:t})))))}},rN=[[1,"byte","long"],[1e3,"kilobyte","short"],[1e6,"megabyte","short"],[1e3**3,"gigabyte","short"],[1e3**4,"terabyte","short"],[1e3**5,"petabyte","short"]]
|
|
12408
|
+
const sN=new class extends sP{constructor(){super(rN.map((([e,t,n])=>new rP(e,oP.createFactory({style:"unit",unit:t,unitDisplay:n})))))}}
|
|
12409
|
+
class aN extends fP{constructor(){super(),this.binary=!1,this.resolvedUnitScale=sN}binaryChanged(){this.resolvedUnitScale=this.binary?oN:sN}}e([le({mode:"boolean"})],aN.prototype,"binary",void 0)
|
|
12403
12410
|
const lN=aN.compose({baseName:"unit-byte",template:QP})
|
|
12404
12411
|
wi.getOrCreate().withPrefix("nimble").register(lN())
|
|
12405
12412
|
const cN=[[1e-15,"f"],[1e-12,"p"],[1e-9,"n"],[10**-6,"μ"],[.001,"m"],[.01,"c"],[.1,"d"],[1,""],[1e3,"k"],[10**6,"M"],[10**9,"G"],[10**12,"T"],[10**15,"P"],[10**18,"E"]],dN=new Map([["en",new eN("volt","volts","V")],["fr",new eN("volt","volts","V")],["de",new eN("Volt","Volt","V")],["ja",new eN("ボルト","ボルト","V")],["zh",new eN("伏特","伏特","V")]])
|
|
12406
|
-
const hN=new class extends
|
|
12407
|
-
const uN=class extends
|
|
12413
|
+
const hN=new class extends sP{constructor(){super(cN.map((([e,t])=>new rP(e,tN.createFactory({unitTranslations:dN,scaledPrefixText:t})))))}}
|
|
12414
|
+
const uN=class extends fP{constructor(){super(),this.resolvedUnitScale=hN}}.compose({baseName:"unit-volt",template:QP})
|
|
12408
12415
|
wi.getOrCreate().withPrefix("nimble").register(uN())
|
|
12409
12416
|
var pN={value:()=>{}}
|
|
12410
12417
|
function fN(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e)
|