@aquera/nile-elements 0.0.24 → 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.css.js +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js +32 -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/src/nile-tooltip/nile-tooltip.css.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tooltip/nile-tooltip.css.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 +11 -5
- 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.css.cjs.js +1 -1
- package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.css.esm.js +4 -0
- package/dist/nile-select/nile-select.esm.js +6 -5
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.esm.js +1 -0
- package/dist/src/nile-select/nile-select.css.js +4 -0
- package/dist/src/nile-select/nile-select.css.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +1 -0
- package/dist/src/nile-select/nile-select.js +32 -19
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js +1 -0
- package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-select/nile-select.css.ts +4 -0
- package/src/nile-select/nile-select.ts +31 -20
- package/src/nile-tooltip/nile-tooltip.css.ts +1 -0
package/package.json
CHANGED
@@ -218,6 +218,8 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
218
218
|
|
219
219
|
@property({ type: Boolean }) showSelected = false;
|
220
220
|
|
221
|
+
@state() oldMaxOptionsVisible: number = 1;
|
222
|
+
|
221
223
|
@property({ type: Boolean }) showNoResults: boolean = false;
|
222
224
|
|
223
225
|
@property({ type: String }) noResultsMessage: string = 'No results found';
|
@@ -611,27 +613,29 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
611
613
|
// Get all options as an array
|
612
614
|
const options = [...this.querySelectorAll<NileOption>('nile-option')];
|
613
615
|
|
614
|
-
// Sort the options based on the order of values
|
615
|
-
|
616
|
-
|
617
|
-
|
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);
|
618
621
|
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
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
|
+
}
|
626
629
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
630
|
+
if (indexA < indexB) {
|
631
|
+
return -1;
|
632
|
+
}
|
633
|
+
if (indexA > indexB) {
|
634
|
+
return 1;
|
635
|
+
}
|
636
|
+
return 0;
|
637
|
+
});
|
638
|
+
}
|
635
639
|
|
636
640
|
return options;
|
637
641
|
}
|
@@ -935,8 +939,12 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
935
939
|
}
|
936
940
|
|
937
941
|
calculateTotalWidthOfTags() {
|
938
|
-
this.maxOptionsVisible = Infinity;
|
939
942
|
|
943
|
+
if(this.maxOptionsVisible !== Infinity){
|
944
|
+
this.oldMaxOptionsVisible = this.maxOptionsVisible;
|
945
|
+
}
|
946
|
+
|
947
|
+
this.maxOptionsVisible = Infinity;
|
940
948
|
setTimeout(() => {
|
941
949
|
let widths: number[] = [];
|
942
950
|
if (this.shadowRoot) {
|
@@ -1088,8 +1096,11 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
1088
1096
|
index < this.maxOptionsVisible ||
|
1089
1097
|
this.maxOptionsVisible <= 0
|
1090
1098
|
) {
|
1099
|
+
const classes = {
|
1100
|
+
'select__invisible': index + 1 > this.oldMaxOptionsVisible && this.maxOptionsVisible === Infinity };
|
1091
1101
|
return html`
|
1092
1102
|
<nile-tag
|
1103
|
+
class=${classMap(classes)}
|
1093
1104
|
part="tag"
|
1094
1105
|
exportparts="
|
1095
1106
|
base:tag__base,
|