@ni/nimble-components 7.4.0 → 7.4.1

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.
@@ -8,8 +8,7 @@ declare global {
8
8
  * A nimble-styed HTML select
9
9
  */
10
10
  export declare class Select extends FoundationSelect {
11
- get value(): string;
12
- set value(value: string);
13
11
  setPositioning(): void;
14
12
  connectedCallback(): void;
13
+ slottedOptionsChanged(prev: Element[], next: Element[]): void;
15
14
  }
@@ -8,8 +8,7 @@ declare global {
8
8
  * A nimble-styed HTML select
9
9
  */
10
10
  export declare class Select extends FoundationSelect {
11
- get value(): string;
12
- set value(value: string);
13
11
  setPositioning(): void;
14
12
  connectedCallback(): void;
13
+ slottedOptionsChanged(prev: Element[], next: Element[]): void;
15
14
  }
@@ -5,24 +5,6 @@ import { styles } from './styles';
5
5
  * A nimble-styed HTML select
6
6
  */
7
7
  export class Select extends FoundationSelect {
8
- get value() {
9
- return super.value;
10
- }
11
- set value(value) {
12
- super.value = value;
13
- // Workaround for https://github.com/microsoft/fast/issues/5139
14
- // When the value property is set very early in the element's lifecycle (e.g. Angular value binding),
15
- // the options property will not be set yet. As a workaround, we mark the listbox-option element with
16
- // the selected attribute, which will set the initial value correctly.
17
- if (value !== null && this.options.length === 0) {
18
- const options = this.querySelectorAll('option,[role="option"]');
19
- options.forEach(option => {
20
- if (option.getAttribute('value') === value) {
21
- option.setAttribute('selected', '');
22
- }
23
- });
24
- }
25
- }
26
8
  // Workaround for https://github.com/microsoft/fast/issues/5123
27
9
  setPositioning() {
28
10
  if (!this.$fastController.isConnected) {
@@ -37,6 +19,14 @@ export class Select extends FoundationSelect {
37
19
  // Call setPositioning() after this.forcedPosition is initialized.
38
20
  this.setPositioning();
39
21
  }
22
+ // Workaround for https://github.com/microsoft/fast/issues/5773
23
+ slottedOptionsChanged(prev, next) {
24
+ const value = this.value;
25
+ super.slottedOptionsChanged(prev, next);
26
+ if (value) {
27
+ this.value = value;
28
+ }
29
+ }
40
30
  }
41
31
  const nimbleSelect = Select.compose({
42
32
  baseName: 'select',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,MAAM,IAAI,gBAAgB,EAE1B,cAAc,IAAI,QAAQ,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,gBAAgB;IACxC,IAAoB,KAAK;QACrB,OAAO,KAAK,CAAC,KAAK,CAAC;IACvB,CAAC;IAED,IAAoB,KAAK,CAAC,KAAa;QACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAEpB,+DAA+D;QAC/D,qGAAqG;QACrG,qGAAqG;QACrG,sEAAsE;QACtE,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;YAChE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACrB,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE;oBACxC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;iBACvC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED,+DAA+D;IAC/C,cAAc;QAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACnC,qDAAqD;YACrD,mDAAmD;YACnD,OAAO;SACV;QACD,KAAK,CAAC,cAAc,EAAE,CAAC;IAC3B,CAAC;IAEe,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,kEAAkE;QAClE,IAAI,CAA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AC,OAAO,CAAgB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,sBAAsB,CAAC,IAAI;CACzC,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/nimble-components",
3
- "version": "7.4.0",
3
+ "version": "7.4.1",
4
4
  "description": "Styled web components for the NI Nimble Design System",
5
5
  "scripts": {
6
6
  "build": "npm run generate-icons && npm run build-components && npm run bundle-components && npm run generate-scss && npm run build-storybook",