@aquera/nile-elements 0.0.25 → 0.0.26
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.
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js +21 -19
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +1 -1
- package/dist/src/nile-select/nile-select.js +21 -19
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-select/nile-select.ts +22 -20
package/package.json
CHANGED
@@ -613,27 +613,29 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
613
613
|
// Get all options as an array
|
614
614
|
const options = [...this.querySelectorAll<NileOption>('nile-option')];
|
615
615
|
|
616
|
-
// Sort the options based on the order of values
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
indexA
|
624
|
-
|
625
|
-
|
626
|
-
indexB
|
627
|
-
|
616
|
+
// Sort the options based on the order of values selected
|
617
|
+
if (this.multiple && this.oldValue?.length > 0) {
|
618
|
+
options.sort((a, b) => {
|
619
|
+
let indexA = this.oldValue.indexOf(a.value);
|
620
|
+
let indexB = this.oldValue.indexOf(b.value);
|
621
|
+
|
622
|
+
// Handle cases where a __value is not found
|
623
|
+
if (indexA === -1) {
|
624
|
+
indexA = Infinity; // Place at the end if not found
|
625
|
+
}
|
626
|
+
if (indexB === -1) {
|
627
|
+
indexB = Infinity; // Place at the end if not found
|
628
|
+
}
|
628
629
|
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
630
|
+
if (indexA < indexB) {
|
631
|
+
return -1;
|
632
|
+
}
|
633
|
+
if (indexA > indexB) {
|
634
|
+
return 1;
|
635
|
+
}
|
636
|
+
return 0;
|
637
|
+
});
|
638
|
+
}
|
637
639
|
|
638
640
|
return options;
|
639
641
|
}
|