@ni/ok-components 0.2.1 → 0.2.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.
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
// eslint-disable-next-line no-new-func
|
|
112
112
|
return new Function("return this")();
|
|
113
113
|
}
|
|
114
|
-
catch
|
|
114
|
+
catch {
|
|
115
115
|
// If all fails, give up and create an object.
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
117
117
|
return {};
|
|
@@ -127,7 +127,10 @@
|
|
|
127
127
|
writable: false,
|
|
128
128
|
};
|
|
129
129
|
if ($global.FAST === void 0) {
|
|
130
|
-
Reflect.defineProperty($global, "FAST",
|
|
130
|
+
Reflect.defineProperty($global, "FAST", {
|
|
131
|
+
value: Object.create(null),
|
|
132
|
+
...propConfig,
|
|
133
|
+
});
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
136
|
* The FAST global.
|
|
@@ -136,13 +139,16 @@
|
|
|
136
139
|
const FAST = $global.FAST;
|
|
137
140
|
if (FAST.getById === void 0) {
|
|
138
141
|
const storage = Object.create(null);
|
|
139
|
-
Reflect.defineProperty(FAST, "getById",
|
|
142
|
+
Reflect.defineProperty(FAST, "getById", {
|
|
143
|
+
value(id, initialize) {
|
|
140
144
|
let found = storage[id];
|
|
141
145
|
if (found === void 0) {
|
|
142
146
|
found = initialize ? (storage[id] = initialize()) : null;
|
|
143
147
|
}
|
|
144
148
|
return found;
|
|
145
|
-
}
|
|
149
|
+
},
|
|
150
|
+
...propConfig,
|
|
151
|
+
});
|
|
146
152
|
}
|
|
147
153
|
/**
|
|
148
154
|
* A readonly, empty array.
|
|
@@ -511,12 +517,11 @@
|
|
|
511
517
|
* @param propertyName - The property name, passed along to subscribers during notification.
|
|
512
518
|
*/
|
|
513
519
|
notify(propertyName) {
|
|
514
|
-
var _a;
|
|
515
520
|
const subscribers = this.subscribers[propertyName];
|
|
516
521
|
if (subscribers !== void 0) {
|
|
517
522
|
subscribers.notify(propertyName);
|
|
518
523
|
}
|
|
519
|
-
|
|
524
|
+
this.sourceSubscribers?.notify(propertyName);
|
|
520
525
|
}
|
|
521
526
|
/**
|
|
522
527
|
* Subscribes to notification of changes in an object's state.
|
|
@@ -524,7 +529,6 @@
|
|
|
524
529
|
* @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
|
|
525
530
|
*/
|
|
526
531
|
subscribe(subscriber, propertyToWatch) {
|
|
527
|
-
var _a;
|
|
528
532
|
if (propertyToWatch) {
|
|
529
533
|
let subscribers = this.subscribers[propertyToWatch];
|
|
530
534
|
if (subscribers === void 0) {
|
|
@@ -534,7 +538,7 @@
|
|
|
534
538
|
}
|
|
535
539
|
else {
|
|
536
540
|
this.sourceSubscribers =
|
|
537
|
-
|
|
541
|
+
this.sourceSubscribers ?? new SubscriberSet(this.source);
|
|
538
542
|
this.sourceSubscribers.subscribe(subscriber);
|
|
539
543
|
}
|
|
540
544
|
}
|
|
@@ -544,7 +548,6 @@
|
|
|
544
548
|
* @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
|
|
545
549
|
*/
|
|
546
550
|
unsubscribe(subscriber, propertyToUnwatch) {
|
|
547
|
-
var _a;
|
|
548
551
|
if (propertyToUnwatch) {
|
|
549
552
|
const subscribers = this.subscribers[propertyToUnwatch];
|
|
550
553
|
if (subscribers !== void 0) {
|
|
@@ -552,7 +555,7 @@
|
|
|
552
555
|
}
|
|
553
556
|
}
|
|
554
557
|
else {
|
|
555
|
-
|
|
558
|
+
this.sourceSubscribers?.unsubscribe(subscriber);
|
|
556
559
|
}
|
|
557
560
|
}
|
|
558
561
|
}
|
|
@@ -562,7 +565,7 @@
|
|
|
562
565
|
* @public
|
|
563
566
|
*/
|
|
564
567
|
const Observable = FAST.getById(2 /* KernelServiceId.observable */, () => {
|
|
565
|
-
const volatileRegex = /(
|
|
568
|
+
const volatileRegex = /(\?\?|:|&&|\|\||if)/;
|
|
566
569
|
const notifierLookup = new WeakMap();
|
|
567
570
|
const queueUpdate = DOM.queueUpdate;
|
|
568
571
|
let watcher = void 0;
|
|
@@ -1110,14 +1113,15 @@
|
|
|
1110
1113
|
/**
|
|
1111
1114
|
* Creates an instance of BindingDirective.
|
|
1112
1115
|
* @param binding - A binding that returns the data used to update the DOM.
|
|
1116
|
+
* @param isVolatile - Optional parameter indicating whether the binding is volatile. If not provided, the volatility of the binding is determined by Observable.isVolatileBinding().
|
|
1113
1117
|
*/
|
|
1114
|
-
constructor(binding) {
|
|
1118
|
+
constructor(binding, isVolatile) {
|
|
1115
1119
|
super();
|
|
1116
1120
|
this.binding = binding;
|
|
1117
1121
|
this.bind = normalBind;
|
|
1118
1122
|
this.unbind = normalUnbind;
|
|
1119
1123
|
this.updateTarget = updateAttributeTarget;
|
|
1120
|
-
this.isBindingVolatile = Observable.isVolatileBinding(this.binding);
|
|
1124
|
+
this.isBindingVolatile = isVolatile ?? Observable.isVolatileBinding(this.binding);
|
|
1121
1125
|
}
|
|
1122
1126
|
/**
|
|
1123
1127
|
* Gets/sets the name of the attribute or property that this
|
|
@@ -1252,12 +1256,14 @@
|
|
|
1252
1256
|
return parts[0];
|
|
1253
1257
|
}
|
|
1254
1258
|
let targetName;
|
|
1259
|
+
let isVolatile = false;
|
|
1255
1260
|
const partCount = parts.length;
|
|
1256
1261
|
const finalParts = parts.map((x) => {
|
|
1257
1262
|
if (typeof x === "string") {
|
|
1258
1263
|
return () => x;
|
|
1259
1264
|
}
|
|
1260
1265
|
targetName = x.targetName || targetName;
|
|
1266
|
+
isVolatile = isVolatile || Observable.isVolatileBinding(x.binding);
|
|
1261
1267
|
return x.binding;
|
|
1262
1268
|
});
|
|
1263
1269
|
const binding = (scope, context) => {
|
|
@@ -1267,7 +1273,7 @@
|
|
|
1267
1273
|
}
|
|
1268
1274
|
return output;
|
|
1269
1275
|
};
|
|
1270
|
-
const directive = new HTMLBindingDirective(binding);
|
|
1276
|
+
const directive = new HTMLBindingDirective(binding, isVolatile);
|
|
1271
1277
|
directive.targetName = targetName;
|
|
1272
1278
|
return directive;
|
|
1273
1279
|
}
|
|
@@ -1739,20 +1745,20 @@
|
|
|
1739
1745
|
this.behaviors === null ? behaviors : this.behaviors.concat(behaviors);
|
|
1740
1746
|
return this;
|
|
1741
1747
|
}
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1748
|
+
/**
|
|
1749
|
+
* Create ElementStyles from ComposableStyles.
|
|
1750
|
+
*/
|
|
1751
|
+
static { this.create = (() => {
|
|
1752
|
+
if (DOM.supportsAdoptedStyleSheets) {
|
|
1753
|
+
const styleSheetCache = new Map();
|
|
1754
|
+
return (styles) =>
|
|
1755
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1756
|
+
new AdoptedStyleSheetsStyles(styles, styleSheetCache);
|
|
1757
|
+
}
|
|
1750
1758
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1751
|
-
new
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
return (styles) => new StyleElementStyles(styles);
|
|
1755
|
-
})();
|
|
1759
|
+
return (styles) => new StyleElementStyles(styles);
|
|
1760
|
+
})(); }
|
|
1761
|
+
}
|
|
1756
1762
|
function reduceStyles(styles) {
|
|
1757
1763
|
return styles
|
|
1758
1764
|
.map((x) => x instanceof ElementStyles ? reduceStyles(x.styles) : [x])
|
|
@@ -1812,7 +1818,7 @@
|
|
|
1812
1818
|
}
|
|
1813
1819
|
};
|
|
1814
1820
|
}
|
|
1815
|
-
catch
|
|
1821
|
+
catch {
|
|
1816
1822
|
// Do nothing if an error is thrown, the default
|
|
1817
1823
|
// case handles FrozenArray.
|
|
1818
1824
|
}
|
|
@@ -2159,11 +2165,11 @@
|
|
|
2159
2165
|
? defaultShadowOptions
|
|
2160
2166
|
: nameOrConfig.shadowOptions === null
|
|
2161
2167
|
? void 0
|
|
2162
|
-
:
|
|
2168
|
+
: { ...defaultShadowOptions, ...nameOrConfig.shadowOptions };
|
|
2163
2169
|
this.elementOptions =
|
|
2164
2170
|
nameOrConfig.elementOptions === void 0
|
|
2165
2171
|
? defaultElementOptions
|
|
2166
|
-
:
|
|
2172
|
+
: { ...defaultElementOptions, ...nameOrConfig.elementOptions };
|
|
2167
2173
|
this.styles =
|
|
2168
2174
|
nameOrConfig.styles === void 0
|
|
2169
2175
|
? void 0
|
|
@@ -2195,12 +2201,12 @@
|
|
|
2195
2201
|
}
|
|
2196
2202
|
return this;
|
|
2197
2203
|
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Gets the element definition associated with the specified type.
|
|
2206
|
+
* @param type - The custom element type to retrieve the definition for.
|
|
2207
|
+
*/
|
|
2208
|
+
static { this.forType = fastRegistry.getByType; }
|
|
2198
2209
|
}
|
|
2199
|
-
/**
|
|
2200
|
-
* Gets the element definition associated with the specified type.
|
|
2201
|
-
* @param type - The custom element type to retrieve the definition for.
|
|
2202
|
-
*/
|
|
2203
|
-
FASTElementDefinition.forType = fastRegistry.getByType;
|
|
2204
2210
|
|
|
2205
2211
|
const shadowRoots = new WeakMap();
|
|
2206
2212
|
const defaultEventOptions = {
|
|
@@ -2479,7 +2485,7 @@
|
|
|
2479
2485
|
*/
|
|
2480
2486
|
emit(type, detail, options) {
|
|
2481
2487
|
if (this._isConnected) {
|
|
2482
|
-
return this.element.dispatchEvent(new CustomEvent(type,
|
|
2488
|
+
return this.element.dispatchEvent(new CustomEvent(type, { detail, ...defaultEventOptions, ...options }));
|
|
2483
2489
|
}
|
|
2484
2490
|
return false;
|
|
2485
2491
|
}
|
|
@@ -3566,7 +3572,10 @@
|
|
|
3566
3572
|
const templateBinding = typeof templateOrTemplateBinding === "function"
|
|
3567
3573
|
? templateOrTemplateBinding
|
|
3568
3574
|
: () => templateOrTemplateBinding;
|
|
3569
|
-
return new RepeatDirective(itemsBinding, templateBinding,
|
|
3575
|
+
return new RepeatDirective(itemsBinding, templateBinding, {
|
|
3576
|
+
...defaultRepeatOptions,
|
|
3577
|
+
...options,
|
|
3578
|
+
});
|
|
3570
3579
|
}
|
|
3571
3580
|
|
|
3572
3581
|
/**
|
|
@@ -4239,7 +4248,7 @@
|
|
|
4239
4248
|
Interface.friendlyName = friendlyName == null ? "(anonymous)" : friendlyName;
|
|
4240
4249
|
if (configure != null) {
|
|
4241
4250
|
Interface.register = function (container, key) {
|
|
4242
|
-
return configure(new ResolverBuilder(container, key
|
|
4251
|
+
return configure(new ResolverBuilder(container, key ?? Interface));
|
|
4243
4252
|
};
|
|
4244
4253
|
}
|
|
4245
4254
|
Interface.toString = function toString() {
|
|
@@ -4417,13 +4426,12 @@
|
|
|
4417
4426
|
}
|
|
4418
4427
|
}
|
|
4419
4428
|
getFactory(container) {
|
|
4420
|
-
var _a, _b, _c;
|
|
4421
4429
|
switch (this.strategy) {
|
|
4422
4430
|
case 1 /* ResolverStrategy.singleton */:
|
|
4423
4431
|
case 2 /* ResolverStrategy.transient */:
|
|
4424
4432
|
return container.getFactory(this.state);
|
|
4425
4433
|
case 5 /* ResolverStrategy.alias */:
|
|
4426
|
-
return
|
|
4434
|
+
return container.getResolver(this.state)?.getFactory?.(container) ?? null;
|
|
4427
4435
|
default:
|
|
4428
4436
|
return null;
|
|
4429
4437
|
}
|
|
@@ -5164,7 +5172,10 @@
|
|
|
5164
5172
|
this.type = type;
|
|
5165
5173
|
this.elementDefinition = elementDefinition;
|
|
5166
5174
|
this.overrideDefinition = overrideDefinition;
|
|
5167
|
-
this.definition =
|
|
5175
|
+
this.definition = {
|
|
5176
|
+
...this.elementDefinition,
|
|
5177
|
+
...this.overrideDefinition,
|
|
5178
|
+
};
|
|
5168
5179
|
}
|
|
5169
5180
|
register(container, context) {
|
|
5170
5181
|
const definition = this.definition;
|
|
@@ -5616,14 +5627,12 @@
|
|
|
5616
5627
|
* Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
|
|
5617
5628
|
*/
|
|
5618
5629
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
5619
|
-
var _a;
|
|
5620
5630
|
// Check to see if delegatesFocus is supported
|
|
5621
5631
|
if (window.ShadowRoot &&
|
|
5622
5632
|
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
5623
|
-
|
|
5633
|
+
this.$fastController.definition.shadowOptions?.delegatesFocus) {
|
|
5624
5634
|
this.focus = () => {
|
|
5625
|
-
|
|
5626
|
-
(_a = this.control) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5635
|
+
this.control?.focus();
|
|
5627
5636
|
};
|
|
5628
5637
|
}
|
|
5629
5638
|
};
|
|
@@ -5713,12 +5722,11 @@
|
|
|
5713
5722
|
* @internal
|
|
5714
5723
|
*/
|
|
5715
5724
|
this.requestPosition = (target, callback) => {
|
|
5716
|
-
var _a;
|
|
5717
5725
|
if (this.intersectionDetector === null) {
|
|
5718
5726
|
return;
|
|
5719
5727
|
}
|
|
5720
5728
|
if (this.observedElements.has(target)) {
|
|
5721
|
-
|
|
5729
|
+
this.observedElements.get(target)?.push(callback);
|
|
5722
5730
|
return;
|
|
5723
5731
|
}
|
|
5724
5732
|
this.observedElements.set(target, [callback]);
|
|
@@ -5763,9 +5771,8 @@
|
|
|
5763
5771
|
const pendingCallbackParams = [];
|
|
5764
5772
|
// go through the entries to build a list of callbacks and params for each
|
|
5765
5773
|
entries.forEach((entry) => {
|
|
5766
|
-
var _a;
|
|
5767
5774
|
// stop watching this element until we get new update requests for it
|
|
5768
|
-
|
|
5775
|
+
this.intersectionDetector?.unobserve(entry.target);
|
|
5769
5776
|
const thisElementCallbacks = this.observedElements.get(entry.target);
|
|
5770
5777
|
if (thisElementCallbacks !== undefined) {
|
|
5771
5778
|
thisElementCallbacks.forEach((callback) => {
|
|
@@ -6592,6 +6599,7 @@
|
|
|
6592
6599
|
this.initialize();
|
|
6593
6600
|
}
|
|
6594
6601
|
}
|
|
6602
|
+
static { this.intersectionService = new IntersectionService(); }
|
|
6595
6603
|
/**
|
|
6596
6604
|
* @internal
|
|
6597
6605
|
*/
|
|
@@ -6689,7 +6697,6 @@
|
|
|
6689
6697
|
this.updateRegionStyle();
|
|
6690
6698
|
}
|
|
6691
6699
|
};
|
|
6692
|
-
AnchoredRegion$1.intersectionService = new IntersectionService();
|
|
6693
6700
|
__decorate([
|
|
6694
6701
|
attr
|
|
6695
6702
|
], AnchoredRegion$1.prototype, "anchor", void 0);
|
|
@@ -6821,12 +6828,11 @@
|
|
|
6821
6828
|
* We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
|
|
6822
6829
|
*/
|
|
6823
6830
|
findChildWithHref(node) {
|
|
6824
|
-
var _a, _b;
|
|
6825
6831
|
if (node.childElementCount > 0) {
|
|
6826
6832
|
return node.querySelector("a[href]");
|
|
6827
6833
|
}
|
|
6828
|
-
else if (
|
|
6829
|
-
return
|
|
6834
|
+
else if (node.shadowRoot?.childElementCount) {
|
|
6835
|
+
return node.shadowRoot?.querySelector("a[href]");
|
|
6830
6836
|
}
|
|
6831
6837
|
else
|
|
6832
6838
|
return null;
|
|
@@ -7213,7 +7219,6 @@
|
|
|
7213
7219
|
* Attach the proxy element to the DOM
|
|
7214
7220
|
*/
|
|
7215
7221
|
attachProxy() {
|
|
7216
|
-
var _a;
|
|
7217
7222
|
if (!this.proxyInitialized) {
|
|
7218
7223
|
this.proxyInitialized = true;
|
|
7219
7224
|
this.proxy.style.display = "none";
|
|
@@ -7234,16 +7239,15 @@
|
|
|
7234
7239
|
this.proxySlot = document.createElement("slot");
|
|
7235
7240
|
this.proxySlot.setAttribute("name", proxySlotName);
|
|
7236
7241
|
}
|
|
7237
|
-
|
|
7242
|
+
this.shadowRoot?.appendChild(this.proxySlot);
|
|
7238
7243
|
this.appendChild(this.proxy);
|
|
7239
7244
|
}
|
|
7240
7245
|
/**
|
|
7241
7246
|
* Detach the proxy element from the DOM
|
|
7242
7247
|
*/
|
|
7243
7248
|
detachProxy() {
|
|
7244
|
-
var _a;
|
|
7245
7249
|
this.removeChild(this.proxy);
|
|
7246
|
-
|
|
7250
|
+
this.shadowRoot?.removeChild(this.proxySlot);
|
|
7247
7251
|
}
|
|
7248
7252
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
7249
7253
|
validate(anchor) {
|
|
@@ -7267,7 +7271,7 @@
|
|
|
7267
7271
|
if (this.form instanceof HTMLFormElement) {
|
|
7268
7272
|
// Implicit submission
|
|
7269
7273
|
const defaultButton = this.form.querySelector("[type=submit]");
|
|
7270
|
-
defaultButton
|
|
7274
|
+
defaultButton?.click();
|
|
7271
7275
|
}
|
|
7272
7276
|
break;
|
|
7273
7277
|
}
|
|
@@ -7409,8 +7413,7 @@
|
|
|
7409
7413
|
* @internal
|
|
7410
7414
|
*/
|
|
7411
7415
|
this.handleClick = (e) => {
|
|
7412
|
-
|
|
7413
|
-
if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) {
|
|
7416
|
+
if (this.disabled && this.defaultSlottedContent?.length <= 1) {
|
|
7414
7417
|
e.stopPropagation();
|
|
7415
7418
|
}
|
|
7416
7419
|
};
|
|
@@ -7441,8 +7444,7 @@
|
|
|
7441
7444
|
* Resets the parent form
|
|
7442
7445
|
*/
|
|
7443
7446
|
this.handleFormReset = () => {
|
|
7444
|
-
|
|
7445
|
-
(_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
|
|
7447
|
+
this.form?.reset();
|
|
7446
7448
|
};
|
|
7447
7449
|
/**
|
|
7448
7450
|
* Overrides the focus call for where delegatesFocus is unsupported.
|
|
@@ -7450,11 +7452,10 @@
|
|
|
7450
7452
|
* Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
|
|
7451
7453
|
*/
|
|
7452
7454
|
this.handleUnsupportedDelegatesFocus = () => {
|
|
7453
|
-
var _a;
|
|
7454
7455
|
// Check to see if delegatesFocus is supported
|
|
7455
7456
|
if (window.ShadowRoot &&
|
|
7456
7457
|
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
7457
|
-
|
|
7458
|
+
this.$fastController.definition.shadowOptions?.delegatesFocus) {
|
|
7458
7459
|
this.focus = () => {
|
|
7459
7460
|
this.control.focus();
|
|
7460
7461
|
};
|
|
@@ -7507,11 +7508,10 @@
|
|
|
7507
7508
|
* @internal
|
|
7508
7509
|
*/
|
|
7509
7510
|
connectedCallback() {
|
|
7510
|
-
var _a;
|
|
7511
7511
|
super.connectedCallback();
|
|
7512
7512
|
this.proxy.setAttribute("type", this.type);
|
|
7513
7513
|
this.handleUnsupportedDelegatesFocus();
|
|
7514
|
-
const elements = Array.from(
|
|
7514
|
+
const elements = Array.from(this.control?.children);
|
|
7515
7515
|
if (elements) {
|
|
7516
7516
|
elements.forEach((span) => {
|
|
7517
7517
|
span.addEventListener("click", this.handleClick);
|
|
@@ -7522,9 +7522,8 @@
|
|
|
7522
7522
|
* @internal
|
|
7523
7523
|
*/
|
|
7524
7524
|
disconnectedCallback() {
|
|
7525
|
-
var _a;
|
|
7526
7525
|
super.disconnectedCallback();
|
|
7527
|
-
const elements = Array.from(
|
|
7526
|
+
const elements = Array.from(this.control?.children);
|
|
7528
7527
|
if (elements) {
|
|
7529
7528
|
elements.forEach((span) => {
|
|
7530
7529
|
span.removeEventListener("click", this.handleClick);
|
|
@@ -7760,15 +7759,13 @@
|
|
|
7760
7759
|
}
|
|
7761
7760
|
}
|
|
7762
7761
|
get label() {
|
|
7763
|
-
|
|
7764
|
-
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
7762
|
+
return this.value ?? this.text;
|
|
7765
7763
|
}
|
|
7766
7764
|
get text() {
|
|
7767
|
-
|
|
7768
|
-
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
7765
|
+
return this.textContent?.replace(/\s+/g, " ").trim() ?? "";
|
|
7769
7766
|
}
|
|
7770
7767
|
set value(next) {
|
|
7771
|
-
const newValue = `${next
|
|
7768
|
+
const newValue = `${next ?? ""}`;
|
|
7772
7769
|
this._value = newValue;
|
|
7773
7770
|
this.dirtyValue = true;
|
|
7774
7771
|
if (this.proxy instanceof HTMLOptionElement) {
|
|
@@ -7777,9 +7774,8 @@
|
|
|
7777
7774
|
Observable.notify(this, "value");
|
|
7778
7775
|
}
|
|
7779
7776
|
get value() {
|
|
7780
|
-
var _a;
|
|
7781
7777
|
Observable.track(this, "value");
|
|
7782
|
-
return
|
|
7778
|
+
return this._value ?? this.text;
|
|
7783
7779
|
}
|
|
7784
7780
|
get form() {
|
|
7785
7781
|
return this.proxy ? this.proxy.form : null;
|
|
@@ -7926,8 +7922,7 @@
|
|
|
7926
7922
|
* @internal
|
|
7927
7923
|
*/
|
|
7928
7924
|
get firstSelectedOption() {
|
|
7929
|
-
|
|
7930
|
-
return (_a = this.selectedOptions[0]) !== null && _a !== void 0 ? _a : null;
|
|
7925
|
+
return this.selectedOptions[0] ?? null;
|
|
7931
7926
|
}
|
|
7932
7927
|
/**
|
|
7933
7928
|
* Returns true if there is one or more selectable option.
|
|
@@ -7943,8 +7938,7 @@
|
|
|
7943
7938
|
* @public
|
|
7944
7939
|
*/
|
|
7945
7940
|
get length() {
|
|
7946
|
-
|
|
7947
|
-
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7941
|
+
return this.options?.length ?? 0;
|
|
7948
7942
|
}
|
|
7949
7943
|
/**
|
|
7950
7944
|
* The list of options.
|
|
@@ -7971,6 +7965,19 @@
|
|
|
7971
7965
|
set typeAheadExpired(value) {
|
|
7972
7966
|
this.typeaheadExpired = value;
|
|
7973
7967
|
}
|
|
7968
|
+
/**
|
|
7969
|
+
* A static filter to include only selectable options.
|
|
7970
|
+
*
|
|
7971
|
+
* @param n - element to filter
|
|
7972
|
+
* @public
|
|
7973
|
+
*/
|
|
7974
|
+
static { this.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden; }
|
|
7975
|
+
/**
|
|
7976
|
+
* Typeahead timeout in milliseconds.
|
|
7977
|
+
*
|
|
7978
|
+
* @internal
|
|
7979
|
+
*/
|
|
7980
|
+
static { this.TYPE_AHEAD_TIMEOUT_MS = 1000; }
|
|
7974
7981
|
/**
|
|
7975
7982
|
* Handle click events for listbox options.
|
|
7976
7983
|
*
|
|
@@ -8191,12 +8198,11 @@
|
|
|
8191
8198
|
* @internal
|
|
8192
8199
|
*/
|
|
8193
8200
|
selectedIndexChanged(prev, next) {
|
|
8194
|
-
var _a;
|
|
8195
8201
|
if (!this.hasSelectableOptions) {
|
|
8196
8202
|
this.selectedIndex = -1;
|
|
8197
8203
|
return;
|
|
8198
8204
|
}
|
|
8199
|
-
if (
|
|
8205
|
+
if (this.options[this.selectedIndex]?.disabled && typeof prev === "number") {
|
|
8200
8206
|
const selectableIndex = this.getSelectableIndex(prev, next);
|
|
8201
8207
|
const newNext = selectableIndex > -1 ? selectableIndex : prev;
|
|
8202
8208
|
this.selectedIndex = newNext;
|
|
@@ -8216,9 +8222,8 @@
|
|
|
8216
8222
|
* @internal
|
|
8217
8223
|
*/
|
|
8218
8224
|
selectedOptionsChanged(prev, next) {
|
|
8219
|
-
var _a;
|
|
8220
8225
|
const filteredNext = next.filter(Listbox.slottedOptionFilter);
|
|
8221
|
-
|
|
8226
|
+
this.options?.forEach(o => {
|
|
8222
8227
|
const notifier = Observable.getNotifier(o);
|
|
8223
8228
|
notifier.unsubscribe(this, "selected");
|
|
8224
8229
|
o.selected = filteredNext.includes(o);
|
|
@@ -8231,9 +8236,8 @@
|
|
|
8231
8236
|
* @public
|
|
8232
8237
|
*/
|
|
8233
8238
|
selectFirstOption() {
|
|
8234
|
-
var _a, _b;
|
|
8235
8239
|
if (!this.disabled) {
|
|
8236
|
-
this.selectedIndex =
|
|
8240
|
+
this.selectedIndex = this.options?.findIndex(o => !o.disabled) ?? -1;
|
|
8237
8241
|
}
|
|
8238
8242
|
}
|
|
8239
8243
|
/**
|
|
@@ -8272,8 +8276,7 @@
|
|
|
8272
8276
|
* @internal
|
|
8273
8277
|
*/
|
|
8274
8278
|
setDefaultSelectedOption() {
|
|
8275
|
-
|
|
8276
|
-
this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;
|
|
8279
|
+
this.selectedIndex = this.options?.findIndex(el => el.defaultSelected) ?? -1;
|
|
8277
8280
|
}
|
|
8278
8281
|
/**
|
|
8279
8282
|
* Sets an option as selected and gives it focus.
|
|
@@ -8281,10 +8284,9 @@
|
|
|
8281
8284
|
* @public
|
|
8282
8285
|
*/
|
|
8283
8286
|
setSelectedOptions() {
|
|
8284
|
-
|
|
8285
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
8287
|
+
if (this.options?.length) {
|
|
8286
8288
|
this.selectedOptions = [this.options[this.selectedIndex]];
|
|
8287
|
-
this.ariaActiveDescendant =
|
|
8289
|
+
this.ariaActiveDescendant = this.firstSelectedOption?.id ?? "";
|
|
8288
8290
|
this.focusAndScrollOptionIntoView();
|
|
8289
8291
|
}
|
|
8290
8292
|
}
|
|
@@ -8337,19 +8339,6 @@
|
|
|
8337
8339
|
}
|
|
8338
8340
|
}
|
|
8339
8341
|
}
|
|
8340
|
-
/**
|
|
8341
|
-
* A static filter to include only selectable options.
|
|
8342
|
-
*
|
|
8343
|
-
* @param n - element to filter
|
|
8344
|
-
* @public
|
|
8345
|
-
*/
|
|
8346
|
-
Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
|
|
8347
|
-
/**
|
|
8348
|
-
* Typeahead timeout in milliseconds.
|
|
8349
|
-
*
|
|
8350
|
-
* @internal
|
|
8351
|
-
*/
|
|
8352
|
-
Listbox.TYPE_AHEAD_TIMEOUT_MS = 1000;
|
|
8353
8342
|
__decorate([
|
|
8354
8343
|
attr({ mode: "boolean" })
|
|
8355
8344
|
], Listbox.prototype, "disabled", void 0);
|
|
@@ -8568,17 +8557,16 @@
|
|
|
8568
8557
|
return this._value;
|
|
8569
8558
|
}
|
|
8570
8559
|
set value(next) {
|
|
8571
|
-
var _a, _b, _c;
|
|
8572
8560
|
const prev = `${this._value}`;
|
|
8573
8561
|
if (this.$fastController.isConnected && this.options) {
|
|
8574
8562
|
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
8575
|
-
const prevSelectedValue =
|
|
8576
|
-
const nextSelectedValue =
|
|
8563
|
+
const prevSelectedValue = this.options[this.selectedIndex]?.text;
|
|
8564
|
+
const nextSelectedValue = this.options[selectedIndex]?.text;
|
|
8577
8565
|
this.selectedIndex =
|
|
8578
8566
|
prevSelectedValue !== nextSelectedValue
|
|
8579
8567
|
? selectedIndex
|
|
8580
8568
|
: this.selectedIndex;
|
|
8581
|
-
next =
|
|
8569
|
+
next = this.firstSelectedOption?.text || next;
|
|
8582
8570
|
}
|
|
8583
8571
|
if (prev !== next) {
|
|
8584
8572
|
this._value = next;
|
|
@@ -8594,7 +8582,7 @@
|
|
|
8594
8582
|
*/
|
|
8595
8583
|
clickHandler(e) {
|
|
8596
8584
|
const captured = e.target.closest(`option,[role=option]`);
|
|
8597
|
-
if (this.disabled ||
|
|
8585
|
+
if (this.disabled || captured?.disabled) {
|
|
8598
8586
|
return;
|
|
8599
8587
|
}
|
|
8600
8588
|
if (this.open) {
|
|
@@ -8667,8 +8655,7 @@
|
|
|
8667
8655
|
this.control.focus();
|
|
8668
8656
|
if (this.firstSelectedOption) {
|
|
8669
8657
|
requestAnimationFrame(() => {
|
|
8670
|
-
|
|
8671
|
-
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
8658
|
+
this.firstSelectedOption?.scrollIntoView({ block: "nearest" });
|
|
8672
8659
|
});
|
|
8673
8660
|
}
|
|
8674
8661
|
}
|
|
@@ -8887,8 +8874,7 @@
|
|
|
8887
8874
|
* @internal
|
|
8888
8875
|
*/
|
|
8889
8876
|
syncValue() {
|
|
8890
|
-
|
|
8891
|
-
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
8877
|
+
const newValue = this.selectedIndex > -1 ? this.firstSelectedOption?.text : this.control.value;
|
|
8892
8878
|
this.updateValue(this.value !== newValue);
|
|
8893
8879
|
}
|
|
8894
8880
|
/**
|
|
@@ -8949,9 +8935,8 @@
|
|
|
8949
8935
|
* @internal
|
|
8950
8936
|
*/
|
|
8951
8937
|
updateValue(shouldEmit) {
|
|
8952
|
-
var _a;
|
|
8953
8938
|
if (this.$fastController.isConnected) {
|
|
8954
|
-
this.value =
|
|
8939
|
+
this.value = this.firstSelectedOption?.text || this.control.value;
|
|
8955
8940
|
this.control.value = this.value;
|
|
8956
8941
|
}
|
|
8957
8942
|
if (shouldEmit) {
|
|
@@ -9180,6 +9165,8 @@
|
|
|
9180
9165
|
* @internal
|
|
9181
9166
|
*/
|
|
9182
9167
|
class RootStyleSheetTarget {
|
|
9168
|
+
static { this.roots = new Set(); }
|
|
9169
|
+
static { this.properties = {}; }
|
|
9183
9170
|
setProperty(name, value) {
|
|
9184
9171
|
RootStyleSheetTarget.properties[name] = value;
|
|
9185
9172
|
for (const target of RootStyleSheetTarget.roots.values()) {
|
|
@@ -9221,8 +9208,6 @@
|
|
|
9221
9208
|
return root === defaultElement ? document : root;
|
|
9222
9209
|
}
|
|
9223
9210
|
}
|
|
9224
|
-
RootStyleSheetTarget.roots = new Set();
|
|
9225
|
-
RootStyleSheetTarget.properties = {};
|
|
9226
9211
|
// Caches PropertyTarget instances
|
|
9227
9212
|
const propertyTargetCache = new WeakMap();
|
|
9228
9213
|
// Use Constructable StyleSheets for FAST elements when supported, otherwise use
|
|
@@ -9284,6 +9269,13 @@
|
|
|
9284
9269
|
static isDerivedDesignTokenValue(value) {
|
|
9285
9270
|
return typeof value === "function";
|
|
9286
9271
|
}
|
|
9272
|
+
static { this.uniqueId = (() => {
|
|
9273
|
+
let id = 0;
|
|
9274
|
+
return () => {
|
|
9275
|
+
id++;
|
|
9276
|
+
return id.toString(16);
|
|
9277
|
+
};
|
|
9278
|
+
})(); }
|
|
9287
9279
|
/**
|
|
9288
9280
|
* Gets a token by ID. Returns undefined if the token was not found.
|
|
9289
9281
|
* @param id - The ID of the token
|
|
@@ -9292,6 +9284,10 @@
|
|
|
9292
9284
|
static getTokenById(id) {
|
|
9293
9285
|
return DesignTokenImpl.tokensById.get(id);
|
|
9294
9286
|
}
|
|
9287
|
+
/**
|
|
9288
|
+
* Token storage by token ID
|
|
9289
|
+
*/
|
|
9290
|
+
static { this.tokensById = new Map(); }
|
|
9295
9291
|
getOrCreateSubscriberSet(target = this) {
|
|
9296
9292
|
return (this.subscribers.get(target) ||
|
|
9297
9293
|
(this.subscribers.set(target, new Set()) && this.subscribers.get(target)));
|
|
@@ -9373,17 +9369,6 @@
|
|
|
9373
9369
|
return ((target) => token.getValueFor(target));
|
|
9374
9370
|
}
|
|
9375
9371
|
}
|
|
9376
|
-
DesignTokenImpl.uniqueId = (() => {
|
|
9377
|
-
let id = 0;
|
|
9378
|
-
return () => {
|
|
9379
|
-
id++;
|
|
9380
|
-
return id.toString(16);
|
|
9381
|
-
};
|
|
9382
|
-
})();
|
|
9383
|
-
/**
|
|
9384
|
-
* Token storage by token ID
|
|
9385
|
-
*/
|
|
9386
|
-
DesignTokenImpl.tokensById = new Map();
|
|
9387
9372
|
class CustomPropertyReflector {
|
|
9388
9373
|
startReflection(token, target) {
|
|
9389
9374
|
token.subscribe(this, target);
|
|
@@ -9530,6 +9515,10 @@
|
|
|
9530
9515
|
} while (current !== null);
|
|
9531
9516
|
return null;
|
|
9532
9517
|
}
|
|
9518
|
+
/**
|
|
9519
|
+
* Responsible for reflecting tokens to CSS custom properties
|
|
9520
|
+
*/
|
|
9521
|
+
static { this.cssCustomPropertyReflector = new CustomPropertyReflector(); }
|
|
9533
9522
|
/**
|
|
9534
9523
|
* The parent DesignTokenNode, or null.
|
|
9535
9524
|
*/
|
|
@@ -9630,11 +9619,10 @@
|
|
|
9630
9619
|
* @returns
|
|
9631
9620
|
*/
|
|
9632
9621
|
getRaw(token) {
|
|
9633
|
-
var _a;
|
|
9634
9622
|
if (this.assignedValues.has(token)) {
|
|
9635
9623
|
return this.assignedValues.get(token);
|
|
9636
9624
|
}
|
|
9637
|
-
return
|
|
9625
|
+
return DesignTokenNode.findClosestAssignedNode(token, this)?.getRaw(token);
|
|
9638
9626
|
}
|
|
9639
9627
|
/**
|
|
9640
9628
|
* Sets a token to a value for a node
|
|
@@ -9835,10 +9823,6 @@
|
|
|
9835
9823
|
return false;
|
|
9836
9824
|
}
|
|
9837
9825
|
}
|
|
9838
|
-
/**
|
|
9839
|
-
* Responsible for reflecting tokens to CSS custom properties
|
|
9840
|
-
*/
|
|
9841
|
-
DesignTokenNode.cssCustomPropertyReflector = new CustomPropertyReflector();
|
|
9842
9826
|
__decorate([
|
|
9843
9827
|
observable
|
|
9844
9828
|
], DesignTokenNode.prototype, "children", void 0);
|
|
@@ -10108,7 +10092,10 @@
|
|
|
10108
10092
|
ComponentPresentation.define(this.name, presentation, this.container);
|
|
10109
10093
|
}
|
|
10110
10094
|
defineElement(definition) {
|
|
10111
|
-
this.definition = new FASTElementDefinition(this.type,
|
|
10095
|
+
this.definition = new FASTElementDefinition(this.type, {
|
|
10096
|
+
...definition,
|
|
10097
|
+
name: this.name,
|
|
10098
|
+
});
|
|
10112
10099
|
}
|
|
10113
10100
|
tagFor(type) {
|
|
10114
10101
|
return DesignSystem.tagFor(type);
|
|
@@ -10404,8 +10391,7 @@
|
|
|
10404
10391
|
* @internal
|
|
10405
10392
|
*/
|
|
10406
10393
|
get checkedOptions() {
|
|
10407
|
-
|
|
10408
|
-
return (_a = this.options) === null || _a === void 0 ? void 0 : _a.filter(o => o.checked);
|
|
10394
|
+
return this.options?.filter(o => o.checked);
|
|
10409
10395
|
}
|
|
10410
10396
|
/**
|
|
10411
10397
|
* Returns the index of the first selected option.
|
|
@@ -10424,8 +10410,7 @@
|
|
|
10424
10410
|
* @internal
|
|
10425
10411
|
*/
|
|
10426
10412
|
activeIndexChanged(prev, next) {
|
|
10427
|
-
|
|
10428
|
-
this.ariaActiveDescendant = (_b = (_a = this.options[next]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : "";
|
|
10413
|
+
this.ariaActiveDescendant = this.options[next]?.id ?? "";
|
|
10429
10414
|
this.focusAndScrollOptionIntoView();
|
|
10430
10415
|
}
|
|
10431
10416
|
/**
|
|
@@ -10573,11 +10558,10 @@
|
|
|
10573
10558
|
* @internal
|
|
10574
10559
|
*/
|
|
10575
10560
|
clickHandler(e) {
|
|
10576
|
-
var _a;
|
|
10577
10561
|
if (!this.multiple) {
|
|
10578
10562
|
return super.clickHandler(e);
|
|
10579
10563
|
}
|
|
10580
|
-
const captured =
|
|
10564
|
+
const captured = e.target?.closest(`[role=option]`);
|
|
10581
10565
|
if (!captured || captured.disabled) {
|
|
10582
10566
|
return;
|
|
10583
10567
|
}
|
|
@@ -10710,9 +10694,8 @@
|
|
|
10710
10694
|
* @internal
|
|
10711
10695
|
*/
|
|
10712
10696
|
multipleChanged(prev, next) {
|
|
10713
|
-
var _a;
|
|
10714
10697
|
this.ariaMultiSelectable = next ? "true" : null;
|
|
10715
|
-
|
|
10698
|
+
this.options?.forEach(o => {
|
|
10716
10699
|
o.checked = next ? false : undefined;
|
|
10717
10700
|
});
|
|
10718
10701
|
this.setSelectedOptions();
|
|
@@ -10742,8 +10725,7 @@
|
|
|
10742
10725
|
* @internal
|
|
10743
10726
|
*/
|
|
10744
10727
|
sizeChanged(prev, next) {
|
|
10745
|
-
|
|
10746
|
-
const size = Math.max(0, parseInt((_a = next === null || next === void 0 ? void 0 : next.toFixed()) !== null && _a !== void 0 ? _a : "", 10));
|
|
10728
|
+
const size = Math.max(0, parseInt(next?.toFixed() ?? "", 10));
|
|
10747
10729
|
if (size !== next) {
|
|
10748
10730
|
DOM.queueUpdate(() => {
|
|
10749
10731
|
this.size = size;
|
|
@@ -11423,8 +11405,7 @@
|
|
|
11423
11405
|
* @internal
|
|
11424
11406
|
*/
|
|
11425
11407
|
maxChanged(previous, next) {
|
|
11426
|
-
|
|
11427
|
-
this.max = Math.max(next, (_a = this.min) !== null && _a !== void 0 ? _a : next);
|
|
11408
|
+
this.max = Math.max(next, this.min ?? next);
|
|
11428
11409
|
const min = Math.min(this.min, this.max);
|
|
11429
11410
|
if (this.min !== undefined && this.min !== min) {
|
|
11430
11411
|
this.min = min;
|
|
@@ -11440,8 +11421,7 @@
|
|
|
11440
11421
|
* @internal
|
|
11441
11422
|
*/
|
|
11442
11423
|
minChanged(previous, next) {
|
|
11443
|
-
|
|
11444
|
-
this.min = Math.min(next, (_a = this.max) !== null && _a !== void 0 ? _a : next);
|
|
11424
|
+
this.min = Math.min(next, this.max ?? next);
|
|
11445
11425
|
const max = Math.max(this.min, this.max);
|
|
11446
11426
|
if (this.max !== undefined && this.max !== max) {
|
|
11447
11427
|
this.max = max;
|
|
@@ -11737,12 +11717,10 @@
|
|
|
11737
11717
|
radio.focus();
|
|
11738
11718
|
};
|
|
11739
11719
|
this.moveRightOffGroup = () => {
|
|
11740
|
-
|
|
11741
|
-
(_a = this.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
11720
|
+
this.nextElementSibling?.focus();
|
|
11742
11721
|
};
|
|
11743
11722
|
this.moveLeftOffGroup = () => {
|
|
11744
|
-
|
|
11745
|
-
(_a = this.previousElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
11723
|
+
this.previousElementSibling?.focus();
|
|
11746
11724
|
};
|
|
11747
11725
|
/**
|
|
11748
11726
|
* @internal
|
|
@@ -11968,12 +11946,10 @@
|
|
|
11968
11946
|
return this.closest('[role="toolbar"]');
|
|
11969
11947
|
}
|
|
11970
11948
|
get isInsideToolbar() {
|
|
11971
|
-
|
|
11972
|
-
return ((_a = this.parentToolbar) !== null && _a !== void 0 ? _a : false);
|
|
11949
|
+
return (this.parentToolbar ?? false);
|
|
11973
11950
|
}
|
|
11974
11951
|
get isInsideFoundationToolbar() {
|
|
11975
|
-
|
|
11976
|
-
return !!((_a = this.parentToolbar) === null || _a === void 0 ? void 0 : _a["$fastController"]);
|
|
11952
|
+
return !!this.parentToolbar?.["$fastController"];
|
|
11977
11953
|
}
|
|
11978
11954
|
/**
|
|
11979
11955
|
* @internal
|
|
@@ -12130,13 +12106,12 @@
|
|
|
12130
12106
|
* @internal
|
|
12131
12107
|
*/
|
|
12132
12108
|
defaultCheckedChanged() {
|
|
12133
|
-
var _a;
|
|
12134
12109
|
if (this.$fastController.isConnected && !this.dirtyChecked) {
|
|
12135
12110
|
// Setting this.checked will cause us to enter a dirty state,
|
|
12136
12111
|
// but if we are clean when defaultChecked is changed, we want to stay
|
|
12137
12112
|
// in a clean state, so reset this.dirtyChecked
|
|
12138
12113
|
if (!this.isInsideRadioGroup()) {
|
|
12139
|
-
this.checked =
|
|
12114
|
+
this.checked = this.defaultChecked ?? false;
|
|
12140
12115
|
this.dirtyChecked = false;
|
|
12141
12116
|
}
|
|
12142
12117
|
}
|
|
@@ -12169,10 +12144,9 @@
|
|
|
12169
12144
|
* @internal
|
|
12170
12145
|
*/
|
|
12171
12146
|
connectedCallback() {
|
|
12172
|
-
var _a, _b;
|
|
12173
12147
|
super.connectedCallback();
|
|
12174
12148
|
this.validate();
|
|
12175
|
-
if (
|
|
12149
|
+
if (this.parentElement?.getAttribute("role") !== "radiogroup" &&
|
|
12176
12150
|
this.getAttribute("tabindex") === null) {
|
|
12177
12151
|
if (!this.disabled) {
|
|
12178
12152
|
this.setAttribute("tabindex", "0");
|
|
@@ -12184,7 +12158,7 @@
|
|
|
12184
12158
|
// but if we are clean when defaultChecked is changed, we want to stay
|
|
12185
12159
|
// in a clean state, so reset this.dirtyChecked
|
|
12186
12160
|
if (!this.isInsideRadioGroup()) {
|
|
12187
|
-
this.checked =
|
|
12161
|
+
this.checked = this.defaultChecked ?? false;
|
|
12188
12162
|
this.dirtyChecked = false;
|
|
12189
12163
|
}
|
|
12190
12164
|
}
|
|
@@ -12333,17 +12307,16 @@
|
|
|
12333
12307
|
return this._value;
|
|
12334
12308
|
}
|
|
12335
12309
|
set value(next) {
|
|
12336
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
12337
12310
|
const prev = `${this._value}`;
|
|
12338
|
-
if (
|
|
12311
|
+
if (this._options?.length) {
|
|
12339
12312
|
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
12340
|
-
const prevSelectedValue =
|
|
12341
|
-
const nextSelectedValue =
|
|
12313
|
+
const prevSelectedValue = this._options[this.selectedIndex]?.value ?? null;
|
|
12314
|
+
const nextSelectedValue = this._options[selectedIndex]?.value ?? null;
|
|
12342
12315
|
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
12343
12316
|
next = "";
|
|
12344
12317
|
this.selectedIndex = selectedIndex;
|
|
12345
12318
|
}
|
|
12346
|
-
next =
|
|
12319
|
+
next = this.firstSelectedOption?.value ?? next;
|
|
12347
12320
|
}
|
|
12348
12321
|
if (prev !== next) {
|
|
12349
12322
|
this._value = next;
|
|
@@ -12360,9 +12333,8 @@
|
|
|
12360
12333
|
* @internal
|
|
12361
12334
|
*/
|
|
12362
12335
|
updateValue(shouldEmit) {
|
|
12363
|
-
var _a, _b;
|
|
12364
12336
|
if (this.$fastController.isConnected) {
|
|
12365
|
-
this.value =
|
|
12337
|
+
this.value = this.firstSelectedOption?.value ?? "";
|
|
12366
12338
|
}
|
|
12367
12339
|
if (shouldEmit) {
|
|
12368
12340
|
this.$emit("input");
|
|
@@ -12414,9 +12386,8 @@
|
|
|
12414
12386
|
* @public
|
|
12415
12387
|
*/
|
|
12416
12388
|
get displayValue() {
|
|
12417
|
-
var _a, _b;
|
|
12418
12389
|
Observable.track(this, "displayValue");
|
|
12419
|
-
return
|
|
12390
|
+
return this.firstSelectedOption?.text ?? "";
|
|
12420
12391
|
}
|
|
12421
12392
|
/**
|
|
12422
12393
|
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
@@ -12477,7 +12448,6 @@
|
|
|
12477
12448
|
* @internal
|
|
12478
12449
|
*/
|
|
12479
12450
|
focusoutHandler(e) {
|
|
12480
|
-
var _a;
|
|
12481
12451
|
super.focusoutHandler(e);
|
|
12482
12452
|
if (!this.open) {
|
|
12483
12453
|
return true;
|
|
@@ -12487,7 +12457,7 @@
|
|
|
12487
12457
|
this.focus();
|
|
12488
12458
|
return;
|
|
12489
12459
|
}
|
|
12490
|
-
if (!
|
|
12460
|
+
if (!this.options?.includes(focusTarget)) {
|
|
12491
12461
|
this.open = false;
|
|
12492
12462
|
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
12493
12463
|
this.updateValue(true);
|
|
@@ -12539,8 +12509,7 @@
|
|
|
12539
12509
|
* @internal
|
|
12540
12510
|
*/
|
|
12541
12511
|
mousedownHandler(e) {
|
|
12542
|
-
|
|
12543
|
-
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
12512
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {
|
|
12544
12513
|
return super.mousedownHandler(e);
|
|
12545
12514
|
}
|
|
12546
12515
|
return this.collapsible;
|
|
@@ -12567,11 +12536,9 @@
|
|
|
12567
12536
|
* @internal
|
|
12568
12537
|
*/
|
|
12569
12538
|
selectedOptionsChanged(prev, next) {
|
|
12570
|
-
var _a;
|
|
12571
12539
|
super.selectedOptionsChanged(prev, next);
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
12540
|
+
this.options?.forEach((o, i) => {
|
|
12541
|
+
const proxyOption = this.proxy?.options.item(i);
|
|
12575
12542
|
if (proxyOption) {
|
|
12576
12543
|
proxyOption.selected = o.selected;
|
|
12577
12544
|
}
|
|
@@ -12585,9 +12552,8 @@
|
|
|
12585
12552
|
* @internal
|
|
12586
12553
|
*/
|
|
12587
12554
|
setDefaultSelectedOption() {
|
|
12588
|
-
|
|
12589
|
-
const
|
|
12590
|
-
const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
12555
|
+
const options = this.options ?? Array.from(this.children).filter(Listbox.slottedOptionFilter);
|
|
12556
|
+
const selectedIndex = options?.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
12591
12557
|
if (selectedIndex !== -1) {
|
|
12592
12558
|
this.selectedIndex = selectedIndex;
|
|
12593
12559
|
return;
|
|
@@ -13133,14 +13099,12 @@
|
|
|
13133
13099
|
}
|
|
13134
13100
|
getTabIds() {
|
|
13135
13101
|
return this.tabs.map((tab) => {
|
|
13136
|
-
|
|
13137
|
-
return (_a = tab.getAttribute("id")) !== null && _a !== void 0 ? _a : `tab-${uniqueId()}`;
|
|
13102
|
+
return tab.getAttribute("id") ?? `tab-${uniqueId()}`;
|
|
13138
13103
|
});
|
|
13139
13104
|
}
|
|
13140
13105
|
getTabPanelIds() {
|
|
13141
13106
|
return this.tabpanels.map((tabPanel) => {
|
|
13142
|
-
|
|
13143
|
-
return (_a = tabPanel.getAttribute("id")) !== null && _a !== void 0 ? _a : `panel-${uniqueId()}`;
|
|
13107
|
+
return tabPanel.getAttribute("id") ?? `panel-${uniqueId()}`;
|
|
13144
13108
|
});
|
|
13145
13109
|
}
|
|
13146
13110
|
setComponent() {
|
|
@@ -13537,8 +13501,7 @@
|
|
|
13537
13501
|
* @internal
|
|
13538
13502
|
*/
|
|
13539
13503
|
mouseDownHandler(e) {
|
|
13540
|
-
|
|
13541
|
-
const activeIndex = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a.findIndex(x => x.contains(e.target));
|
|
13504
|
+
const activeIndex = this.focusableElements?.findIndex(x => x.contains(e.target));
|
|
13542
13505
|
if (activeIndex > -1 && this.activeIndex !== activeIndex) {
|
|
13543
13506
|
this.setFocusedElement(activeIndex);
|
|
13544
13507
|
}
|
|
@@ -13576,8 +13539,9 @@
|
|
|
13576
13539
|
* @internal
|
|
13577
13540
|
*/
|
|
13578
13541
|
getDirectionalIncrementer(key) {
|
|
13579
|
-
|
|
13580
|
-
|
|
13542
|
+
return (ToolbarArrowKeyMap[key]?.[this.orientation]?.[this.direction] ??
|
|
13543
|
+
ToolbarArrowKeyMap[key]?.[this.orientation] ??
|
|
13544
|
+
0);
|
|
13581
13545
|
}
|
|
13582
13546
|
/**
|
|
13583
13547
|
* Handle keyboard events for the toolbar.
|
|
@@ -13617,8 +13581,7 @@
|
|
|
13617
13581
|
* @internal
|
|
13618
13582
|
*/
|
|
13619
13583
|
reduceFocusableElements() {
|
|
13620
|
-
|
|
13621
|
-
const previousFocusedElement = (_a = this.focusableElements) === null || _a === void 0 ? void 0 : _a[this.activeIndex];
|
|
13584
|
+
const previousFocusedElement = this.focusableElements?.[this.activeIndex];
|
|
13622
13585
|
this.focusableElements = this.allSlottedItems.reduce(Toolbar.reduceFocusableItems, []);
|
|
13623
13586
|
// If the previously active item is still focusable, adjust the active index to the
|
|
13624
13587
|
// index of that item.
|
|
@@ -13651,10 +13614,9 @@
|
|
|
13651
13614
|
* @internal
|
|
13652
13615
|
*/
|
|
13653
13616
|
static reduceFocusableItems(elements, element) {
|
|
13654
|
-
var _a, _b, _c, _d;
|
|
13655
13617
|
const isRoleRadio = element.getAttribute("role") === "radio";
|
|
13656
|
-
const isFocusableFastElement =
|
|
13657
|
-
const hasFocusableShadow = Array.from(
|
|
13618
|
+
const isFocusableFastElement = element.$fastController?.definition.shadowOptions?.delegatesFocus;
|
|
13619
|
+
const hasFocusableShadow = Array.from(element.shadowRoot?.querySelectorAll("*") ?? []).some(x => isFocusable(x));
|
|
13658
13620
|
if (!element.hasAttribute("disabled") &&
|
|
13659
13621
|
!element.hasAttribute("hidden") &&
|
|
13660
13622
|
(isFocusable(element) ||
|