@aquera/nile-elements 1.0.1-beta-1.9 → 1.0.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.
- package/README.md +30 -0
- package/dist/index.js +154 -105
- package/dist/internal/resizable-table-styles.cjs.js +1 -1
- package/dist/internal/resizable-table-styles.cjs.js.map +1 -1
- package/dist/internal/resizable-table-styles.esm.js +32 -17
- package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.cjs.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.cjs.js.map +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js.map +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.css.esm.js +12 -2
- package/dist/nile-filter-chip/nile-filter-chip.esm.js +3 -3
- package/dist/nile-input/nile-input.cjs.js +1 -1
- package/dist/nile-input/nile-input.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.esm.js +2 -2
- package/dist/nile-loader/nile-loader.cjs.js +1 -1
- package/dist/nile-loader/nile-loader.cjs.js.map +1 -1
- package/dist/nile-loader/nile-loader.esm.js +3 -3
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.esm.js +2 -2
- package/dist/nile-option-group/nile-option-group.cjs.js +1 -1
- package/dist/nile-option-group/nile-option-group.cjs.js.map +1 -1
- package/dist/nile-option-group/nile-option-group.esm.js +1 -1
- package/dist/nile-radio/nile-radio.cjs.js +1 -1
- package/dist/nile-radio/nile-radio.cjs.js.map +1 -1
- package/dist/nile-radio/nile-radio.esm.js +2 -2
- package/dist/nile-radio-group/nile-radio-group.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.cjs.js.map +1 -1
- package/dist/nile-radio-group/nile-radio-group.esm.js +2 -2
- 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 +11 -9
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +21 -0
- package/dist/nile-table-body/nile-table-body.css.cjs.js +1 -1
- package/dist/nile-table-body/nile-table-body.css.cjs.js.map +1 -1
- package/dist/nile-table-body/nile-table-body.css.esm.js +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js.map +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.css.esm.js +5 -5
- package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js +1 -1
- package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js.map +1 -1
- package/dist/nile-table-header-item/nile-table-header-item.css.esm.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +2 -2
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +11 -10
- package/dist/src/internal/resizable-table-styles.d.ts +2 -1
- package/dist/src/internal/resizable-table-styles.js +27 -11
- package/dist/src/internal/resizable-table-styles.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +1 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +5 -0
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-filter-chip/nile-filter-chip.css.js +10 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.css.js.map +1 -1
- package/dist/src/nile-filter-chip/nile-filter-chip.js +1 -1
- package/dist/src/nile-filter-chip/nile-filter-chip.js.map +1 -1
- package/dist/src/nile-input/nile-input.d.ts +1 -0
- package/dist/src/nile-input/nile-input.js +4 -1
- package/dist/src/nile-input/nile-input.js.map +1 -1
- package/dist/src/nile-loader/nile-loader.js +3 -3
- package/dist/src/nile-loader/nile-loader.js.map +1 -1
- package/dist/src/nile-option/nile-option.js +6 -6
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-option-group/nile-option-group.js +1 -1
- package/dist/src/nile-option-group/nile-option-group.js.map +1 -1
- package/dist/src/nile-radio/nile-radio.d.ts +1 -0
- package/dist/src/nile-radio/nile-radio.js +8 -1
- package/dist/src/nile-radio/nile-radio.js.map +1 -1
- package/dist/src/nile-radio-group/nile-radio-group.d.ts +4 -1
- package/dist/src/nile-radio-group/nile-radio-group.js +25 -2
- package/dist/src/nile-radio-group/nile-radio-group.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +11 -1
- package/dist/src/nile-select/nile-select.js +59 -1
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +21 -0
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-table-body/nile-table-body.css.js +2 -2
- package/dist/src/nile-table-body/nile-table-body.css.js.map +1 -1
- package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js +4 -4
- package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js.map +1 -1
- package/dist/src/nile-table-header-item/nile-table-header-item.css.js +2 -2
- package/dist/src/nile-table-header-item/nile-table-header-item.css.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js +2 -2
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/nile-virtual-select/renderer.js +3 -2
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/internal/resizable-table-styles.ts +28 -11
- package/src/nile-code-editor/nile-code-editor.ts +6 -0
- package/src/nile-filter-chip/nile-filter-chip.css.ts +10 -0
- package/src/nile-filter-chip/nile-filter-chip.ts +1 -1
- package/src/nile-input/nile-input.ts +5 -1
- package/src/nile-loader/nile-loader.ts +3 -3
- package/src/nile-option/nile-option.ts +6 -7
- package/src/nile-option-group/nile-option-group.ts +1 -1
- package/src/nile-radio/nile-radio.ts +7 -1
- package/src/nile-radio-group/nile-radio-group.ts +26 -4
- package/src/nile-select/nile-select.ts +65 -2
- package/src/nile-select/virtual-scroll-helper.ts +21 -0
- package/src/nile-table-body/nile-table-body.css.ts +2 -2
- package/src/nile-table-cell-item/nile-table-cell-item.css.ts +4 -4
- package/src/nile-table-header-item/nile-table-header-item.css.ts +2 -2
- package/src/nile-virtual-select/nile-virtual-select.ts +2 -2
- package/src/nile-virtual-select/renderer.ts +3 -2
- package/vscode-html-custom-data.json +34 -3
package/package.json
CHANGED
@@ -12,16 +12,25 @@ import { css } from 'lit';
|
|
12
12
|
* Centralized styles for resizable table functionality
|
13
13
|
*/
|
14
14
|
|
15
|
-
export const
|
16
|
-
:host([resizable]) {
|
17
|
-
|
18
|
-
|
15
|
+
export const resizableTableStyles = css`
|
16
|
+
:host([resizable]) .base {
|
17
|
+
overflow: unset;
|
18
|
+
}
|
19
|
+
:host([resizable]) .nile__table__body {
|
20
|
+
display: table;
|
19
21
|
table-layout: fixed;
|
22
|
+
border-collapse: collapse;
|
23
|
+
width: 100%;
|
24
|
+
position: relative;
|
20
25
|
}
|
21
26
|
`;
|
22
27
|
|
23
28
|
export const resizableHeaderStyles = css`
|
24
|
-
:host([resizable]) {
|
29
|
+
:host([resizable]) .headers {
|
30
|
+
overflow: hidden;
|
31
|
+
white-space: nowrap;
|
32
|
+
text-overflow: ellipsis;
|
33
|
+
padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));
|
25
34
|
position: relative;
|
26
35
|
}
|
27
36
|
|
@@ -29,14 +38,21 @@ export const resizableHeaderStyles = css`
|
|
29
38
|
border-right: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
30
39
|
position: relative;
|
31
40
|
}
|
41
|
+
|
42
|
+
:host([resizable]) .headers {
|
43
|
+
overflow: hidden;
|
44
|
+
text-overflow: ellipsis;
|
45
|
+
white-space: nowrap;
|
46
|
+
display: block;
|
47
|
+
}
|
32
48
|
`;
|
33
49
|
|
34
50
|
export const resizerStyles = css`
|
35
51
|
.resizer {
|
36
52
|
position: absolute;
|
37
53
|
right: 0;
|
38
|
-
top:
|
39
|
-
bottom:
|
54
|
+
top: 0px;
|
55
|
+
bottom: 0px;
|
40
56
|
width: 8px;
|
41
57
|
cursor: col-resize;
|
42
58
|
user-select: none;
|
@@ -45,7 +61,6 @@ export const resizerStyles = css`
|
|
45
61
|
z-index: 10;
|
46
62
|
opacity: 0;
|
47
63
|
transition: opacity 0.2s ease;
|
48
|
-
pointer-events: none;
|
49
64
|
}
|
50
65
|
|
51
66
|
:host([resizable]):hover .resizer {
|
@@ -56,7 +71,7 @@ export const resizerStyles = css`
|
|
56
71
|
.resizer::before {
|
57
72
|
content: '';
|
58
73
|
position: absolute;
|
59
|
-
right:
|
74
|
+
right: 0px;
|
60
75
|
top: 0;
|
61
76
|
width: 2px;
|
62
77
|
height: 100%;
|
@@ -84,7 +99,9 @@ export const resizerStyles = css`
|
|
84
99
|
opacity: 1;
|
85
100
|
width: 3px;
|
86
101
|
}
|
102
|
+
`;
|
87
103
|
|
104
|
+
export const resizableCellStyles = css`
|
88
105
|
:host([resizable]) .column {
|
89
106
|
overflow: hidden;
|
90
107
|
text-overflow: ellipsis;
|
@@ -120,7 +137,7 @@ export const headerResizerStyles = css`
|
|
120
137
|
}
|
121
138
|
|
122
139
|
.resizer.resizing {
|
123
|
-
border-right: 4px double var(--nile-colors-neutral-400
|
140
|
+
border-right: 4px double var(--nile-colors-neutral-400);
|
124
141
|
background-color: transparent;
|
125
142
|
opacity: 1;
|
126
143
|
}
|
@@ -153,4 +170,4 @@ export const tableLayoutStyles = css`
|
|
153
170
|
.nile__table__body[resizable] {
|
154
171
|
table-layout: fixed;
|
155
172
|
}
|
156
|
-
`;
|
173
|
+
`;
|
@@ -288,6 +288,12 @@ export class NileCodeEditor extends NileElement {
|
|
288
288
|
}
|
289
289
|
}
|
290
290
|
|
291
|
+
public closeCompletion() {
|
292
|
+
if (this.view) {
|
293
|
+
closeCompletion(this.view);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
291
297
|
handleEscapeKey(e: KeyboardEvent) {
|
292
298
|
if (e.key === 'Escape' && this.view && completionStatus(this.view.state) !== null) {
|
293
299
|
e.stopPropagation();
|
@@ -136,6 +136,16 @@ export const styles = css`
|
|
136
136
|
margin-right: 12px;
|
137
137
|
}
|
138
138
|
|
139
|
+
.badge{
|
140
|
+
display: inline-flex;
|
141
|
+
align-items: center;
|
142
|
+
height: 20px;
|
143
|
+
}
|
144
|
+
|
145
|
+
nile-badge::part(content) {
|
146
|
+
line-height: 20px;
|
147
|
+
}
|
148
|
+
|
139
149
|
`;
|
140
150
|
|
141
151
|
export default [styles];
|
@@ -88,7 +88,7 @@ export class NileFilterChip extends NileElement {
|
|
88
88
|
${this.viewMoreCount
|
89
89
|
? html`
|
90
90
|
<span class="badge-wrapper">
|
91
|
-
<nile-badge variant="primary" pilltype="pill-color">
|
91
|
+
<nile-badge class="badge" part="badge" variant="primary" pilltype="pill-color" exportparts="content, base">
|
92
92
|
+${this.viewMoreCount}
|
93
93
|
</nile-badge>
|
94
94
|
</span>
|
@@ -179,7 +179,7 @@ export class NileInput extends NileElement implements NileFormControl {
|
|
179
179
|
@property() autocomplete: string = 'off';
|
180
180
|
|
181
181
|
/** Indicates that the input should receive focus on page load. */
|
182
|
-
@property({ type: Boolean }) autofocus: boolean;
|
182
|
+
@property({ type: Boolean, attribute: true, reflect: true }) autofocus: boolean;
|
183
183
|
|
184
184
|
/** Used to customize the label or icon of the Enter key on virtual keyboards. */
|
185
185
|
@property() enterkeyhint:
|
@@ -505,6 +505,10 @@ export class NileInput extends NileElement implements NileFormControl {
|
|
505
505
|
this.formControlController.updateValidity();
|
506
506
|
}
|
507
507
|
|
508
|
+
public inputFocus() {
|
509
|
+
this.input.focus();
|
510
|
+
}
|
511
|
+
|
508
512
|
render() {
|
509
513
|
const hasLabelSlot = this.hasSlotController.test('label');
|
510
514
|
const hasHelpTextSlot = this.hasSlotController.test('help-text');
|
@@ -61,16 +61,16 @@ export class NileLoader extends LitElement {
|
|
61
61
|
|
62
62
|
override render(){
|
63
63
|
return html`
|
64
|
-
<div class="loader__container" class=${classMap({
|
64
|
+
<div class="loader__container" part="loader-container" class=${classMap({
|
65
65
|
"loader__container":true,
|
66
66
|
"loader__container--sm":this.size=='sm',
|
67
67
|
"loader__container--md":this.size=='md',
|
68
68
|
"loader__container--lg":this.size=='lg',
|
69
69
|
"loader__container--xl":this.size=='xl'
|
70
70
|
})}>
|
71
|
-
<div class=${classMap({"svg__container":this.variant!=='v1'})}>${this.getVariant()}</div>
|
71
|
+
<div part="svg-container" class=${classMap({"svg__container":this.variant!=='v1'})}>${this.getVariant()}</div>
|
72
72
|
${!this.label?nothing:
|
73
|
-
html`<div class="loader__label">${this.label}</div>`
|
73
|
+
html`<div part="loader-label" class="loader__label">${this.label}</div>`
|
74
74
|
}
|
75
75
|
</div>
|
76
76
|
`
|
@@ -60,7 +60,7 @@ export class NileOption extends NileElement {
|
|
60
60
|
*/
|
61
61
|
@property({ reflect: true }) value = '';
|
62
62
|
|
63
|
-
@property({ type: Boolean }) showCheckbox: boolean = false;
|
63
|
+
@property({ type: Boolean, reflect: true, attribute: true }) showCheckbox: boolean = false;
|
64
64
|
|
65
65
|
/** Draws the option in a disabled state, preventing selection. */
|
66
66
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
@@ -69,25 +69,22 @@ export class NileOption extends NileElement {
|
|
69
69
|
@property({ type: Boolean, reflect: true }) selected = false;
|
70
70
|
|
71
71
|
/* used to pass group name to the option, so that grouped options can be shown */
|
72
|
-
@property({ type: String, reflect: true }) groupName: string = '';
|
72
|
+
@property({ type: String, reflect: true, attribute: true }) groupName: string = '';
|
73
73
|
|
74
74
|
connectedCallback() {
|
75
75
|
super.connectedCallback();
|
76
76
|
this.setAttribute('role', 'option');
|
77
77
|
this.setAttribute('aria-selected', 'false');
|
78
78
|
|
79
|
-
// Find the closest parent 'nile-select' or 'nile-virtual-select' element
|
80
|
-
const parentSelect = this.closest('nile-select') || this.closest('nile-virtual-select');
|
81
79
|
this.checkIfMultipleSelect();
|
82
80
|
}
|
83
81
|
|
84
82
|
checkIfMultipleSelect() {
|
85
83
|
// Find the closest parent 'nile-select' element
|
86
|
-
const parentSelect = this.closest('nile-select')
|
87
|
-
|
84
|
+
const parentSelect = this.closest('nile-select');
|
85
|
+
|
88
86
|
// Check if the parent has the 'multiple' attribute
|
89
87
|
if (parentSelect && parentSelect.hasAttribute('multiple')) {
|
90
|
-
// let multipleValue = parentSelect.getAttribute('multiple');
|
91
88
|
if(parentSelect.hasAttribute('multiple') && parentSelect.getAttribute('multiple') === '') {
|
92
89
|
this.isMultipleSelect = true;
|
93
90
|
} else if (parentSelect.getAttribute('multiple') === 'true') {
|
@@ -95,6 +92,8 @@ export class NileOption extends NileElement {
|
|
95
92
|
} else {
|
96
93
|
this.isMultipleSelect = false;
|
97
94
|
}
|
95
|
+
} else {
|
96
|
+
this.isMultipleSelect = this.showCheckbox;
|
98
97
|
}
|
99
98
|
}
|
100
99
|
|
@@ -19,7 +19,7 @@ export class NileOptionGroup extends NileElement {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
@property({type: String, reflect: true, attribute: true}) name: string = "";
|
22
|
-
@property({type: Object, attribute: true}) data: OptionGroupData | null = null;
|
22
|
+
@property({ type: Object, reflect: true, attribute: true}) data: OptionGroupData | null = null;
|
23
23
|
|
24
24
|
private checkForImageOrIcon() {
|
25
25
|
return this.data?.prefix?.icon?.name || this.data?.prefix?.image?.src || this.data?.prefix?.prefixText;
|
@@ -51,6 +51,9 @@ export class NileRadio extends NileElement {
|
|
51
51
|
/** The radio's labelborder. */
|
52
52
|
@property({ type: Boolean, reflect: true }) islabelborder = false;
|
53
53
|
|
54
|
+
|
55
|
+
@property({ type: Boolean, reflect: true }) allowUncheck = false;
|
56
|
+
|
54
57
|
connectedCallback() {
|
55
58
|
super.connectedCallback();
|
56
59
|
this.handleBlur = this.handleBlur.bind(this);
|
@@ -85,7 +88,10 @@ export class NileRadio extends NileElement {
|
|
85
88
|
}
|
86
89
|
|
87
90
|
private handleClick() {
|
88
|
-
|
91
|
+
|
92
|
+
if(this.allowUncheck && !this.disabled) {
|
93
|
+
this.checked = !this.checked;
|
94
|
+
} else if (!this.disabled) {
|
89
95
|
this.checked = true;
|
90
96
|
}
|
91
97
|
}
|
@@ -6,7 +6,7 @@ import { html } from 'lit';
|
|
6
6
|
import { watch } from '../internal/watch';
|
7
7
|
import NileElement from '../internal/nile-element';
|
8
8
|
import styles from './nile-radio-group.css';
|
9
|
-
import type { CSSResultGroup } from 'lit';
|
9
|
+
import type { CSSResultGroup, PropertyValues } from 'lit';
|
10
10
|
import type NileRadio from '../nile-radio/nile-radio';
|
11
11
|
|
12
12
|
/**
|
@@ -73,6 +73,9 @@ export class NileRadioGroup extends NileElement {
|
|
73
73
|
/** The radio's labelborder for whole gp. */
|
74
74
|
@property({ type: Boolean, reflect: true }) islabelborder = false;
|
75
75
|
|
76
|
+
/** Allow the radio to be unchecked. */
|
77
|
+
@property({ type: Boolean, reflect: true, attribute: true }) allowUncheckGroup = false;
|
78
|
+
|
76
79
|
connectedCallback() {
|
77
80
|
super.connectedCallback();
|
78
81
|
this.defaultValue = this.value;
|
@@ -99,11 +102,30 @@ export class NileRadioGroup extends NileElement {
|
|
99
102
|
}
|
100
103
|
|
101
104
|
this.value = target.value;
|
102
|
-
|
105
|
+
if (!this.allowUncheckGroup) {
|
106
|
+
radios.forEach(radio => {
|
107
|
+
radio.checked = radio === target;
|
108
|
+
});
|
109
|
+
}
|
103
110
|
|
104
|
-
if (this.value !== oldValue) {
|
105
|
-
this.emit('change',{value: this.value
|
111
|
+
if (!this.allowUncheckGroup && this.value !== oldValue) {
|
112
|
+
this.emit('change', { value: this.value});
|
106
113
|
this.emit('input');
|
114
|
+
} else if (this.allowUncheckGroup) {
|
115
|
+
this.emit('change', { value: this.value , checked: target.checked});
|
116
|
+
this.emit('input');
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
protected updated(changedProperties: PropertyValues): void {
|
121
|
+
super.updated(changedProperties);
|
122
|
+
|
123
|
+
if (changedProperties.has('allowUncheckGroup')) {
|
124
|
+
if (this.allowUncheckGroup) {
|
125
|
+
this.getAllRadios().forEach(radio => {
|
126
|
+
radio.allowUncheck = true;
|
127
|
+
});
|
128
|
+
}
|
107
129
|
}
|
108
130
|
}
|
109
131
|
|
@@ -77,6 +77,10 @@ type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;
|
|
77
77
|
* @event nile-hide - Emitted when the select's menu closes.
|
78
78
|
* @event nile-after-hide - Emitted after the select's menu closes and all animations are complete.
|
79
79
|
* @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
80
|
+
* @event nile-search - Emitted when the user types in the search input. The event payload includes the search query for backend search functionality.
|
81
|
+
* @event nile-scroll - Emitted when the user scrolls within the listbox. The event payload includes scroll position information.
|
82
|
+
* @event nile-scroll-start - Emitted when the user starts scrolling within the listbox.
|
83
|
+
* @event nile-scroll-end - Emitted when the user stops scrolling and reaches the bottom of the listbox (debounced).
|
80
84
|
*
|
81
85
|
* @csspart form-control - The form control that wraps the label, input, and help text.
|
82
86
|
* @csspart form-control-label - The label's wrapper.
|
@@ -113,6 +117,9 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
113
117
|
);
|
114
118
|
private typeToSelectString = '';
|
115
119
|
private typeToSelectTimeout: number;
|
120
|
+
private scrollTimeout: number | undefined;
|
121
|
+
private scrolling = false;
|
122
|
+
private options: NileOption[] = [];
|
116
123
|
|
117
124
|
@query('.select') popup: NilePopup;
|
118
125
|
@query('.select__combobox') combobox: HTMLSlotElement;
|
@@ -264,6 +271,9 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
264
271
|
/** To enable the group header in the select */
|
265
272
|
@property({ type: Boolean, reflect: true, attribute: true }) enableGroupHeader = false;
|
266
273
|
|
274
|
+
/** To auto focus the search input when the select is opened */
|
275
|
+
@property({ type: Boolean, reflect: true, attribute: true }) autoFocusSearch = false;
|
276
|
+
|
267
277
|
/** Gets the validity state object */
|
268
278
|
get validity() {
|
269
279
|
return this.valueInput?.validity;
|
@@ -297,11 +307,14 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
297
307
|
|
298
308
|
disconnectedCallback() {
|
299
309
|
super.disconnectedCallback();
|
310
|
+
// Clear any pending scroll timeout to prevent memory leaks
|
311
|
+
if (this.scrollTimeout) {
|
312
|
+
clearTimeout(this.scrollTimeout);
|
313
|
+
this.scrollTimeout = undefined;
|
314
|
+
}
|
300
315
|
this.emit('nile-destroy');
|
301
316
|
}
|
302
317
|
|
303
|
-
private options: NileOption[] = [];
|
304
|
-
|
305
318
|
protected updated(_changedProperties: PropertyValues): void {
|
306
319
|
if(_changedProperties.has('multiple')) {
|
307
320
|
this.setCheckBoxInOption(this.multiple as boolean);
|
@@ -835,6 +848,11 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
835
848
|
|
836
849
|
handleSearchChange(e: any) {
|
837
850
|
this.searchValue = e.detail.value;
|
851
|
+
this.emit('nile-search', {
|
852
|
+
query: this.searchValue,
|
853
|
+
name: this.name
|
854
|
+
});
|
855
|
+
|
838
856
|
if(this.enableGroupHeader) {
|
839
857
|
this.handleGroupSearchChange();
|
840
858
|
}
|
@@ -849,6 +867,42 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
849
867
|
}
|
850
868
|
}
|
851
869
|
|
870
|
+
handleScroll(e: Event): void {
|
871
|
+
const target = e.target as HTMLElement;
|
872
|
+
|
873
|
+
this.emit('nile-scroll', {
|
874
|
+
scrollTop: target.scrollTop,
|
875
|
+
scrollLeft: target.scrollLeft,
|
876
|
+
name: this.name
|
877
|
+
});
|
878
|
+
|
879
|
+
if (!this.scrolling) {
|
880
|
+
this.scrolling = true;
|
881
|
+
this.emit('nile-scroll-start', {
|
882
|
+
scrollTop: target.scrollTop,
|
883
|
+
scrollLeft: target.scrollLeft,
|
884
|
+
name: this.name
|
885
|
+
});
|
886
|
+
}
|
887
|
+
|
888
|
+
clearTimeout(this.scrollTimeout);
|
889
|
+
this.scrollTimeout = window.setTimeout(() => {
|
890
|
+
if (this.scrolling) {
|
891
|
+
this.scrolling = false;
|
892
|
+
}
|
893
|
+
}, 300);
|
894
|
+
|
895
|
+
const isAtBottom = Math.ceil(target.scrollTop) >= Math.floor(target.scrollHeight - target.offsetHeight);
|
896
|
+
if (isAtBottom) {
|
897
|
+
this.emit('nile-scroll-end', {
|
898
|
+
scrollTop: target.scrollTop,
|
899
|
+
scrollLeft: target.scrollLeft,
|
900
|
+
name: this.name,
|
901
|
+
isAtBottom: true
|
902
|
+
});
|
903
|
+
}
|
904
|
+
}
|
905
|
+
|
852
906
|
filterOptions(searchValue: string) {
|
853
907
|
const allOptions = this.getAllOptions();
|
854
908
|
const lowerCaseSearchValue = searchValue.toLowerCase();
|
@@ -935,6 +989,9 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
935
989
|
this.filterOptions(this.searchValue);
|
936
990
|
|
937
991
|
this.emit('nile-after-show', { value: this.value, name: this.name });
|
992
|
+
if (this.autoFocusSearch) {
|
993
|
+
this.handleInputAfterInit();
|
994
|
+
}
|
938
995
|
} else {
|
939
996
|
// Hide
|
940
997
|
this.emit('nile-hide', { value: this.value, name: this.name });
|
@@ -1106,6 +1163,10 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1106
1163
|
}, 1);
|
1107
1164
|
}
|
1108
1165
|
|
1166
|
+
handleInputAfterInit() {
|
1167
|
+
this.shadowRoot?.querySelector('nile-input')?.inputFocus();
|
1168
|
+
}
|
1169
|
+
|
1109
1170
|
render() {
|
1110
1171
|
if(this.enableVirtualScroll) {
|
1111
1172
|
return this.virtualScrollHelper.renderVirtualizedContent();
|
@@ -1349,6 +1410,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1349
1410
|
tabindex="-1"
|
1350
1411
|
@mouseup=${this.handleOptionClick}
|
1351
1412
|
@slotchange=${this.handleDefaultSlotChange}
|
1413
|
+
@scroll=${this.handleScroll}
|
1352
1414
|
>
|
1353
1415
|
${this.searchEnabled
|
1354
1416
|
? html` <div class="select__search">
|
@@ -1360,6 +1422,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1360
1422
|
@nile-input=${this.handleSearchChange}
|
1361
1423
|
@nile-focus=${this.handleSearchFocus}
|
1362
1424
|
@nile-change="${this.onInputChange}"
|
1425
|
+
@nile-after-init=${this.handleInputAfterInit}
|
1363
1426
|
>
|
1364
1427
|
<nile-icon name="var(--nile-icon-search, var(--ng-icon-search-lg))" method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))" slot="suffix"> </nile-icon>
|
1365
1428
|
</nile-input>
|
@@ -47,6 +47,27 @@ export class VirtualScrollHelper {
|
|
47
47
|
.noWidthSync=${component.noWidthSync}
|
48
48
|
.maxOptionsVisible=${component.maxOptionsVisible}
|
49
49
|
.data=${component.data}
|
50
|
+
.open=${component.open}
|
51
|
+
exportparts="
|
52
|
+
select-options,
|
53
|
+
select-no-results,
|
54
|
+
virtualized,
|
55
|
+
form-control,
|
56
|
+
form-control-label,
|
57
|
+
form-control-input,
|
58
|
+
combobox,
|
59
|
+
prefix,
|
60
|
+
display-input,
|
61
|
+
tags,
|
62
|
+
tag,
|
63
|
+
clear-button,
|
64
|
+
suffix,
|
65
|
+
expand-icon,
|
66
|
+
listbox,
|
67
|
+
search,
|
68
|
+
loader,
|
69
|
+
footer
|
70
|
+
"
|
50
71
|
>
|
51
72
|
<slot name="prefix" slot="prefix"></slot>
|
52
73
|
</nile-virtual-select>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { css } from 'lit';
|
9
|
-
import {
|
9
|
+
import { resizableTableStyles } from '../internal/resizable-table-styles';
|
10
10
|
|
11
11
|
/**
|
12
12
|
* TableBody CSS
|
@@ -53,7 +53,7 @@ export const styles = css`
|
|
53
53
|
border-bottom: 0px;
|
54
54
|
}
|
55
55
|
|
56
|
-
${
|
56
|
+
${resizableTableStyles}
|
57
57
|
`;
|
58
58
|
|
59
59
|
export default [styles];
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { css } from 'lit';
|
9
|
-
import {
|
9
|
+
import { resizableCellStyles, resizerStyles } from '../internal/resizable-table-styles';
|
10
10
|
|
11
11
|
/**
|
12
12
|
* TableCellItem CSS
|
@@ -17,10 +17,11 @@ export const styles = css`
|
|
17
17
|
--cell-width:auto;
|
18
18
|
--min--height: 52px;
|
19
19
|
--max--cell-width: auto;
|
20
|
+
--padding: var(--nile-spacing-xl , var(--ng-spacing-lg)) var(--nile-spacing-3xl , var(--ng-spacing-3xl));
|
20
21
|
box-sizing: border-box;
|
21
22
|
display: table-cell;
|
22
23
|
vertical-align: middle;
|
23
|
-
padding: var(--
|
24
|
+
padding: var(--padding);
|
24
25
|
max-width: var(--max--cell-width);
|
25
26
|
min-height: var(--min--height);
|
26
27
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
@@ -42,9 +43,8 @@ export const styles = css`
|
|
42
43
|
letter-spacing: 0.2px;
|
43
44
|
}
|
44
45
|
|
45
|
-
${
|
46
|
+
${resizableCellStyles}
|
46
47
|
${resizerStyles}
|
47
|
-
${resizableSlotStyles}
|
48
48
|
`;
|
49
49
|
|
50
50
|
export default [styles];
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { css } from 'lit';
|
9
|
-
import { resizableHeaderStyles,
|
9
|
+
import { resizableHeaderStyles, resizerStyles } from '../internal/resizable-table-styles';
|
10
10
|
|
11
11
|
/**
|
12
12
|
* TableHeaderItem CSS
|
@@ -79,7 +79,7 @@ export const styles = css`
|
|
79
79
|
}
|
80
80
|
|
81
81
|
${resizableHeaderStyles}
|
82
|
-
${
|
82
|
+
${resizerStyles}
|
83
83
|
`;
|
84
84
|
|
85
85
|
export default [styles];
|
@@ -1107,7 +1107,7 @@ export class NileVirtualSelect extends NileElement implements NileFormControl {
|
|
1107
1107
|
private renderSearch(): TemplateResult {
|
1108
1108
|
return this.searchEnabled
|
1109
1109
|
? html`
|
1110
|
-
<div class="select__search">
|
1110
|
+
<div part="search" class="select__search">
|
1111
1111
|
<nile-input
|
1112
1112
|
size="small"
|
1113
1113
|
clearable
|
@@ -1127,7 +1127,7 @@ export class NileVirtualSelect extends NileElement implements NileFormControl {
|
|
1127
1127
|
private renderLoader(): TemplateResult {
|
1128
1128
|
return this.optionsLoading
|
1129
1129
|
? html`
|
1130
|
-
<span class="select__loader">
|
1130
|
+
<span part="loader" class="select__loader">
|
1131
1131
|
<nile-icon
|
1132
1132
|
class="select__loader--icon"
|
1133
1133
|
name="var(--nile-icon-button-loading-blue, var(--ng-icon-button-loading-blue))"
|
@@ -24,18 +24,19 @@ export class VirtualSelectRenderer {
|
|
24
24
|
optionsLoading?: boolean
|
25
25
|
): TemplateResult {
|
26
26
|
return html`
|
27
|
-
<div class="select__options ${
|
27
|
+
<div part="select-options" class="select__options ${
|
28
28
|
searchEnabled ? 'select__options__search-enabled' : ``
|
29
29
|
}">
|
30
30
|
${showNoResults && !optionsLoading
|
31
31
|
? html`
|
32
|
-
<div class="select__no-results">
|
32
|
+
<div part="select-no-results" class="select__no-results">
|
33
33
|
${noResultsMessage || 'No results found'}
|
34
34
|
</div>
|
35
35
|
`
|
36
36
|
: html`
|
37
37
|
<div
|
38
38
|
class="virtualized"
|
39
|
+
part="virtualized"
|
39
40
|
>
|
40
41
|
${VirtualSelectRenderer.shouldUseVirtualizer(data)
|
41
42
|
? html`
|