@aquera/nile-elements 0.1.67-beta-1.9 → 0.1.67-beta-2.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 +1 -23
- package/demo/index.html +61 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +5640 -7857
- package/dist/internal/form.cjs.js +1 -1
- package/dist/internal/form.cjs.js.map +1 -1
- package/dist/internal/form.esm.js +1 -1
- 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 +3 -15
- package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
- package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/index.esm.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +17 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +29 -8
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.test.esm.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js +1 -1
- package/dist/nile-button/nile-button.test.esm.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
- package/dist/nile-card/nile-card.test.cjs.js +1 -1
- package/dist/nile-card/nile-card.test.esm.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.esm.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +5 -5
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.test.esm.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
- package/dist/nile-icon/nile-icon.test.esm.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js +1 -1
- package/dist/nile-input/nile-input.test.esm.js +1 -1
- package/dist/nile-link/nile-link.test.cjs.js +1 -1
- package/dist/nile-link/nile-link.test.esm.js +1 -1
- package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
- package/dist/nile-loader/nile-loader.test.esm.js +1 -1
- 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 +3 -3
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/index.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +11 -3
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.esm.js +13 -7
- package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.test.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.test.esm.js +3 -3
- package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.test.esm.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
- package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
- package/dist/nile-radio/nile-radio.test.esm.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/index.esm.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 +9 -9
- package/dist/nile-select/nile-select.test.cjs.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.test.esm.js +2 -2
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.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 +6 -2
- 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 +4 -2
- package/dist/nile-table-row/nile-table-row.cjs.js +1 -1
- package/dist/nile-table-row/nile-table-row.cjs.js.map +1 -1
- package/dist/nile-table-row/nile-table-row.css.cjs.js +1 -1
- package/dist/nile-table-row/nile-table-row.css.cjs.js.map +1 -1
- package/dist/nile-table-row/nile-table-row.css.esm.js +51 -0
- package/dist/nile-table-row/nile-table-row.esm.js +26 -6
- package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/form.js +3 -3
- package/dist/src/internal/form.js.map +1 -1
- package/dist/src/internal/resizable-table-styles.js +0 -12
- package/dist/src/internal/resizable-table-styles.js.map +1 -1
- package/dist/src/nile-chip/nile-chip.js +1 -10
- package/dist/src/nile-chip/nile-chip.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +0 -3
- package/dist/src/nile-code-editor/nile-code-editor.js +3 -23
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +0 -6
- package/dist/src/nile-code-editor/theme.js +2 -8
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-option/nile-option.d.ts +1 -4
- package/dist/src/nile-option/nile-option.js +15 -27
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +3 -20
- package/dist/src/nile-select/nile-select.js +22 -123
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js +4 -0
- 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 -0
- package/dist/src/nile-table-header-item/nile-table-header-item.css.js.map +1 -1
- package/dist/src/nile-table-row/nile-table-row-expandable.d.ts +37 -0
- package/dist/src/nile-table-row/nile-table-row-expandable.js +105 -0
- package/dist/src/nile-table-row/nile-table-row-expandable.js.map +1 -0
- package/dist/src/nile-table-row/nile-table-row.css.js +51 -0
- package/dist/src/nile-table-row/nile-table-row.css.js.map +1 -1
- package/dist/src/nile-table-row/nile-table-row.d.ts +4 -0
- package/dist/src/nile-table-row/nile-table-row.js +58 -11
- package/dist/src/nile-table-row/nile-table-row.js.map +1 -1
- package/dist/src/nile-table-row-expandable/index.d.ts +1 -0
- package/dist/src/nile-table-row-expandable/index.js +2 -0
- package/dist/src/nile-table-row-expandable/index.js.map +1 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.css.d.ts +12 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.css.js +17 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.css.js.map +1 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.d.ts +37 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.js +103 -0
- package/dist/src/nile-table-row-expandable/nile-table-row-expandable.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/index.ts +1 -5
- package/src/internal/form.ts +3 -3
- package/src/internal/resizable-table-styles.ts +0 -12
- package/src/nile-chip/nile-chip.ts +1 -9
- package/src/nile-code-editor/nile-code-editor.ts +4 -25
- package/src/nile-code-editor/theme.ts +2 -8
- package/src/nile-option/nile-option.ts +12 -22
- package/src/nile-select/nile-select.ts +15 -139
- package/src/nile-table-cell-item/nile-table-cell-item.css.ts +4 -0
- package/src/nile-table-header-item/nile-table-header-item.css.ts +2 -0
- package/src/nile-table-row/nile-table-row.css.ts +51 -0
- package/src/nile-table-row/nile-table-row.ts +50 -7
- package/vscode-html-custom-data.json +23 -400
- package/src/nile-file-preview/index.ts +0 -1
- package/src/nile-file-preview/nile-file-preview.css.ts +0 -589
- package/src/nile-file-preview/nile-file-preview.template.ts +0 -259
- package/src/nile-file-preview/nile-file-preview.test.ts +0 -38
- package/src/nile-file-preview/nile-file-preview.ts +0 -205
- package/src/nile-file-preview/types/index.ts +0 -2
- package/src/nile-file-preview/types/nile-file-preview.enums.ts +0 -32
- package/src/nile-file-preview/types/nile-file-preview.interface.ts +0 -4
- package/src/nile-file-preview/utils/index.ts +0 -1
- package/src/nile-file-preview/utils/nile-file-preview.util.ts +0 -72
- package/src/nile-file-upload/index.ts +0 -1
- package/src/nile-file-upload/nile-file-upload.css.ts +0 -624
- package/src/nile-file-upload/nile-file-upload.template.ts +0 -217
- package/src/nile-file-upload/nile-file-upload.test.ts +0 -38
- package/src/nile-file-upload/nile-file-upload.ts +0 -161
- package/src/nile-file-upload/types/file-upload.enums.ts +0 -46
- package/src/nile-file-upload/types/file-upload.type.ts +0 -5
- package/src/nile-file-upload/types/index.ts +0 -2
- package/src/nile-file-upload/utils/drag-drop.util.ts +0 -106
- package/src/nile-file-upload/utils/file-validation.util.ts +0 -216
- package/src/nile-option-group/index.ts +0 -1
- package/src/nile-option-group/nile-option-group.css.ts +0 -60
- package/src/nile-option-group/nile-option-group.interface.ts +0 -24
- package/src/nile-option-group/nile-option-group.ts +0 -84
- package/src/nile-select/nile-select.interface.ts +0 -5
- package/src/nile-select/virtual-scroll-helper.ts +0 -56
- package/src/nile-virtual-select/index.ts +0 -1
- package/src/nile-virtual-select/nile-virtual-select.css.ts +0 -491
- package/src/nile-virtual-select/nile-virtual-select.test.ts +0 -774
- package/src/nile-virtual-select/nile-virtual-select.ts +0 -1314
- package/src/nile-virtual-select/renderer.ts +0 -102
- package/src/nile-virtual-select/search-manager.ts +0 -50
- package/src/nile-virtual-select/selection-manager.ts +0 -75
- package/src/nile-virtual-select/types.ts +0 -54
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.1.67-beta-1
|
6
|
+
"version": "0.1.67-beta-2.1",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -87,8 +87,7 @@
|
|
87
87
|
"./nile-tour": "./dist/src/nile-tour/index.js",
|
88
88
|
"./nile-table": "./dist/src/nile-table/index.js",
|
89
89
|
"./nile-pagination": "./dist/src/nile-pagination/index.js",
|
90
|
-
"./nile-slider": "./dist/src/nile-slider/index.js"
|
91
|
-
"./nile-option-group": "./dist/src/nile-option-group/index.js"
|
90
|
+
"./nile-slider": "./dist/src/nile-slider/index.js"
|
92
91
|
},
|
93
92
|
"scripts": {
|
94
93
|
"analyze": "cem analyze --litelement",
|
@@ -192,4 +191,4 @@
|
|
192
191
|
"prettier --write"
|
193
192
|
]
|
194
193
|
}
|
195
|
-
}
|
194
|
+
}
|
package/src/index.ts
CHANGED
@@ -16,7 +16,6 @@ export { NileLoader } from './nile-loader';
|
|
16
16
|
export { NileProgressBar } from './nile-progress-bar';
|
17
17
|
export { NileSpinner } from './nile-spinner';
|
18
18
|
export { NileSelect } from './nile-select';
|
19
|
-
export { NileVirtualSelect } from './nile-virtual-select';
|
20
19
|
export { NileOption } from './nile-option';
|
21
20
|
export { NileTag } from './nile-tag';
|
22
21
|
export { NileIconButton } from './nile-icon-button';
|
@@ -79,7 +78,4 @@ export { NileInlineEdit } from './nile-inline-edit';
|
|
79
78
|
export { NileTable } from './nile-table';
|
80
79
|
export { NileFilterChip } from './nile-filter-chip';
|
81
80
|
export {NilePagination } from './nile-pagination';
|
82
|
-
export { NileSlider } from './nile-slider';
|
83
|
-
export { NileFileUpload } from './nile-file-upload';
|
84
|
-
export { NileFilePreview } from './nile-file-preview';
|
85
|
-
export { NileOptionGroup } from './nile-option-group';
|
81
|
+
export { NileSlider } from './nile-slider';
|
package/src/internal/form.ts
CHANGED
@@ -89,7 +89,7 @@ export class FormControlController implements ReactiveController {
|
|
89
89
|
}
|
90
90
|
|
91
91
|
hostConnected() {
|
92
|
-
const form = this.options
|
92
|
+
const form = this.options.form(this.host);
|
93
93
|
|
94
94
|
if (form) {
|
95
95
|
this.attachForm(form);
|
@@ -97,7 +97,7 @@ export class FormControlController implements ReactiveController {
|
|
97
97
|
|
98
98
|
// Listen for interactions
|
99
99
|
interactions.set(this.host, []);
|
100
|
-
this.options
|
100
|
+
this.options.assumeInteractionOn.forEach(event => {
|
101
101
|
this.host.addEventListener(event, this.handleInteraction);
|
102
102
|
});
|
103
103
|
}
|
@@ -107,7 +107,7 @@ export class FormControlController implements ReactiveController {
|
|
107
107
|
|
108
108
|
// Clean up interactions
|
109
109
|
interactions.delete(this.host);
|
110
|
-
this.options
|
110
|
+
this.options.assumeInteractionOn.forEach(event => {
|
111
111
|
this.host.removeEventListener(event, this.handleInteraction);
|
112
112
|
});
|
113
113
|
}
|
@@ -84,13 +84,6 @@ export const resizerStyles = css`
|
|
84
84
|
opacity: 1;
|
85
85
|
width: 3px;
|
86
86
|
}
|
87
|
-
|
88
|
-
:host([resizable]) .column {
|
89
|
-
overflow: hidden;
|
90
|
-
text-overflow: ellipsis;
|
91
|
-
white-space: nowrap;
|
92
|
-
display: block;
|
93
|
-
}
|
94
87
|
`;
|
95
88
|
|
96
89
|
export const headerResizerStyles = css`
|
@@ -124,11 +117,6 @@ export const headerResizerStyles = css`
|
|
124
117
|
background-color: transparent;
|
125
118
|
opacity: 1;
|
126
119
|
}
|
127
|
-
|
128
|
-
:host([resizable]) .headers {
|
129
|
-
text-overflow: ellipsis;
|
130
|
-
white-space: nowrap;
|
131
|
-
}
|
132
120
|
`;
|
133
121
|
|
134
122
|
export const resizableSlotStyles = css`
|
@@ -100,15 +100,7 @@ export class NileChip extends NileElement {
|
|
100
100
|
protected updated(changedProperties: PropertyValues): void {
|
101
101
|
super.updated(changedProperties);
|
102
102
|
if (changedProperties.has('autoCompleteOptions')) {
|
103
|
-
|
104
|
-
if (typeof options === 'string') {
|
105
|
-
try {
|
106
|
-
options = JSON.parse(options);
|
107
|
-
} catch (e) {
|
108
|
-
options = [];
|
109
|
-
}
|
110
|
-
}
|
111
|
-
this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];
|
103
|
+
this.filteredAutoCompleteOptions = [...this.autoCompleteOptions];
|
112
104
|
if (this.noDuplicates) {
|
113
105
|
this.filteredAutoCompleteOptions =
|
114
106
|
this.filteredAutoCompleteOptions.filter(
|
@@ -35,7 +35,7 @@ import {
|
|
35
35
|
import { sql } from '@codemirror/lang-sql';
|
36
36
|
import { json } from '@codemirror/lang-json';
|
37
37
|
import { html as htmlLang } from '@codemirror/lang-html';
|
38
|
-
import { autocompletion,
|
38
|
+
import { autocompletion,CompletionContext,CompletionResult } from '@codemirror/autocomplete';
|
39
39
|
import NileElement from '../internal/nile-element';
|
40
40
|
import { basicSetup } from './extensionSetup';
|
41
41
|
import { classMap } from 'lit/directives/class-map.js';
|
@@ -102,7 +102,7 @@ export class NileCodeEditor extends NileElement {
|
|
102
102
|
|
103
103
|
@property({ type: Boolean, reflect: true , attribute: true}) aboveCursor: boolean = false;
|
104
104
|
|
105
|
-
@property({ type: Boolean, reflect: true, attribute: true }) tabCompletion: boolean =
|
105
|
+
@property({ type: Boolean, reflect: true, attribute: true }) tabCompletion: boolean = false;
|
106
106
|
|
107
107
|
public view: EditorView;
|
108
108
|
public viewState:EditorState;
|
@@ -117,7 +117,6 @@ export class NileCodeEditor extends NileElement {
|
|
117
117
|
private defaultSyntaxHighlightingComp = new Compartment();
|
118
118
|
private themeComp = new Compartment();
|
119
119
|
|
120
|
-
private isSpacePressed:boolean = false;
|
121
120
|
/**
|
122
121
|
* The styles for CodeEditor
|
123
122
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
@@ -261,27 +260,7 @@ export class NileCodeEditor extends NileElement {
|
|
261
260
|
parent: this.codeEditor
|
262
261
|
});
|
263
262
|
|
264
|
-
this.
|
265
|
-
this.checkForSpaceKey(e);
|
266
|
-
this.handleEscapeKey(e);
|
267
|
-
}, true);
|
268
|
-
if (emitEvent) this.emit('nile-after-update', { createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );
|
269
|
-
}
|
270
|
-
|
271
|
-
checkForSpaceKey(e: KeyboardEvent) {
|
272
|
-
if (e.code === 'Space' && !e.ctrlKey) {
|
273
|
-
this.isSpacePressed = true;
|
274
|
-
} else {
|
275
|
-
this.isSpacePressed = false;
|
276
|
-
}
|
277
|
-
}
|
278
|
-
|
279
|
-
handleEscapeKey(e: KeyboardEvent) {
|
280
|
-
if (e.key === 'Escape' && this.view && completionStatus(this.view.state) !== null) {
|
281
|
-
e.stopPropagation();
|
282
|
-
e.preventDefault();
|
283
|
-
closeCompletion(this.view);
|
284
|
-
}
|
263
|
+
if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );
|
285
264
|
}
|
286
265
|
|
287
266
|
createState(){
|
@@ -402,7 +381,7 @@ export class NileCodeEditor extends NileElement {
|
|
402
381
|
|
403
382
|
if (!baseMatch) {
|
404
383
|
const trimmedText = textBeforeCursor.trim();
|
405
|
-
if (trimmedText === ''
|
384
|
+
if (trimmedText === '') {
|
406
385
|
const optionsList = Object.keys(this.customAutoCompletions).filter(key =>
|
407
386
|
Object.keys(this.customAutoCompletions[key]).length
|
408
387
|
);
|
@@ -39,12 +39,6 @@ export const CustomTheme = {
|
|
39
39
|
};
|
40
40
|
|
41
41
|
export const customisedThemeCss = {
|
42
|
-
'.cm-content' : {
|
43
|
-
fontFamily: 'inherit',
|
44
|
-
},
|
45
|
-
'.cm-scroller' : {
|
46
|
-
fontFamily: 'inherit',
|
47
|
-
},
|
48
42
|
'.cm-tooltip-autocomplete': {
|
49
43
|
padding: '9px 12px',
|
50
44
|
backgroundColor: '#FFFFFF',
|
@@ -59,7 +53,7 @@ export const customisedThemeCss = {
|
|
59
53
|
color: 'hsl(240 5.3% 26.1%)',
|
60
54
|
},
|
61
55
|
'.cm-tooltip.cm-completionInfo.cm-completionInfo-right': {
|
62
|
-
fontFamily: '
|
56
|
+
fontFamily: 'colfax-regular',
|
63
57
|
backgroundColor: '#FFFFFF',
|
64
58
|
color: 'hsl(240 5.3% 26.1%)',
|
65
59
|
padding: "6px 12px",
|
@@ -69,7 +63,7 @@ export const customisedThemeCss = {
|
|
69
63
|
fontSize: '14px',
|
70
64
|
},
|
71
65
|
'.cm-tooltip.cm-tooltip-autocomplete > ul': {
|
72
|
-
fontFamily: '
|
66
|
+
fontFamily: 'colfax-regular',
|
73
67
|
fontWeight: '400',
|
74
68
|
},
|
75
69
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > li': {
|
@@ -49,6 +49,7 @@ export class NileOption extends NileElement {
|
|
49
49
|
@query('.option__label') defaultSlot: HTMLSlotElement;
|
50
50
|
|
51
51
|
@state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)
|
52
|
+
@state() selected = false; // the option is selected and has aria-selected="true"
|
52
53
|
@state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging
|
53
54
|
@state() hidden = false; // the option is hidden
|
54
55
|
@state() isMultipleSelect = false;
|
@@ -65,41 +66,30 @@ export class NileOption extends NileElement {
|
|
65
66
|
/** Draws the option in a disabled state, preventing selection. */
|
66
67
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
67
68
|
|
68
|
-
/** Indicates whether the option is selected. */
|
69
|
-
@property({ type: Boolean, reflect: true }) selected = false;
|
70
|
-
|
71
|
-
/* used to pass group name to the option, so that grouped options can be shown */
|
72
|
-
@property({ type: String, reflect: true }) groupName: string = '';
|
73
|
-
|
74
69
|
connectedCallback() {
|
75
70
|
super.connectedCallback();
|
76
71
|
this.setAttribute('role', 'option');
|
77
72
|
this.setAttribute('aria-selected', 'false');
|
78
73
|
|
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
|
-
this.checkIfMultipleSelect();
|
82
|
-
}
|
83
|
-
|
84
|
-
checkIfMultipleSelect() {
|
85
74
|
// Find the closest parent 'nile-select' element
|
86
|
-
const parentSelect = this.closest('nile-select')
|
75
|
+
const parentSelect = this.closest('nile-select');
|
87
76
|
|
88
77
|
// Check if the parent has the 'multiple' attribute
|
89
78
|
if (parentSelect && parentSelect.hasAttribute('multiple')) {
|
90
|
-
|
91
|
-
if
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
this.isMultipleSelect = false;
|
79
|
+
let multipleValue = parentSelect.getAttribute('multiple');
|
80
|
+
if (multipleValue !== 'false') {
|
81
|
+
if(multipleValue === ''){
|
82
|
+
multipleValue = 'true';
|
83
|
+
}
|
84
|
+
this.isMultipleSelect = Boolean(multipleValue);
|
97
85
|
}
|
98
86
|
}
|
99
87
|
}
|
100
88
|
|
101
89
|
protected updated(_changedProperties: PropertyValues): void {
|
102
|
-
|
90
|
+
if(_changedProperties.has('showCheckbox')) {
|
91
|
+
this.isMultipleSelect = this.showCheckbox;
|
92
|
+
}
|
103
93
|
}
|
104
94
|
|
105
95
|
private handleDefaultSlotChange() {
|
@@ -184,7 +174,7 @@ export class NileOption extends NileElement {
|
|
184
174
|
@mouseleave=${this.handleMouseLeave}
|
185
175
|
>
|
186
176
|
|
187
|
-
${this.isMultipleSelect ? html`<nile-checkbox
|
177
|
+
${this.isMultipleSelect ? html`<nile-checkbox class="option--checkbox" .checked=${this.selected}></nile-checkbox>` : ''}
|
188
178
|
|
189
179
|
<slot part="prefix" name="prefix" class="option__prefix"></slot>
|
190
180
|
<slot
|
@@ -33,13 +33,8 @@ import type { CSSResultGroup, PropertyValues } from 'lit';
|
|
33
33
|
import type { NileFormControl } from '../internal/nile-element';
|
34
34
|
import type NileOption from '../nile-option/nile-option';
|
35
35
|
import type NilePopup from '../nile-popup/nile-popup';
|
36
|
-
import type { RenderItemConfig } from '../nile-virtual-select/types.js';
|
37
36
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
38
37
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
39
|
-
import '../nile-virtual-select/nile-virtual-select';
|
40
|
-
import { VirtualScrollHelper } from './virtual-scroll-helper';
|
41
|
-
import NileOptionGroup from '../nile-option-group/nile-option-group';
|
42
|
-
import { GroupAttributes } from './nile-select.interface';
|
43
38
|
|
44
39
|
type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;
|
45
40
|
|
@@ -58,7 +53,6 @@ type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;
|
|
58
53
|
* @dependency nile-icon
|
59
54
|
* @dependency nile-popup
|
60
55
|
* @dependency nile-tag
|
61
|
-
* @dependency nile-virtual-select
|
62
56
|
*
|
63
57
|
* @slot - The listbox options. Must be `<nile-option>` elements. You can use `<nile-divider>` to group items visually.
|
64
58
|
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
|
@@ -97,15 +91,14 @@ type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;
|
|
97
91
|
*/
|
98
92
|
|
99
93
|
@customElement('nile-select')
|
100
|
-
export class NileSelect extends NileElement implements NileFormControl{
|
94
|
+
export class NileSelect extends NileElement implements NileFormControl {
|
101
95
|
static styles: CSSResultGroup = styles;
|
102
96
|
|
103
97
|
// protected override BUBBLES=false;
|
104
98
|
|
105
|
-
private formControlController
|
106
|
-
|
107
|
-
|
108
|
-
|
99
|
+
private readonly formControlController = new FormControlController(this, {
|
100
|
+
assumeInteractionOn: ['nile-blur', 'nile-input'],
|
101
|
+
});
|
109
102
|
private readonly hasSlotController = new HasSlotController(
|
110
103
|
this,
|
111
104
|
'help-text',
|
@@ -166,21 +159,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
166
159
|
@property({ type: Boolean, reflect: true }) noWidthSync = false;
|
167
160
|
|
168
161
|
/** Allows more than one option to be selected. */
|
169
|
-
@property({
|
170
|
-
reflect: true,
|
171
|
-
converter: {
|
172
|
-
fromAttribute(value) {
|
173
|
-
if (value === '' || value === 'true') return true;
|
174
|
-
if (value === 'false') return false;
|
175
|
-
return value;
|
176
|
-
},
|
177
|
-
toAttribute(value) {
|
178
|
-
return typeof value === 'boolean' ? String(value) : value;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
})
|
182
|
-
multiple = false as boolean | string;
|
183
|
-
|
162
|
+
@property({ type: Boolean, reflect: true }) multiple = false;
|
184
163
|
|
185
164
|
@property({ attribute: 'help-text', reflect: true }) helpText = '';
|
186
165
|
|
@@ -253,16 +232,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
253
232
|
|
254
233
|
@property({ type: String }) noResultsMessage: string = 'No results found';
|
255
234
|
|
256
|
-
/** Enhanced configuration for rendering items with support for display text, value, and search text */
|
257
|
-
@property({ attribute: false }) renderItemConfig?: RenderItemConfig;
|
258
|
-
|
259
|
-
@property({ type: Array }) data: any = [];
|
260
|
-
|
261
|
-
@property({ type: Boolean }) enableVirtualScroll = false;
|
262
|
-
|
263
|
-
/** To enable the group header in the select */
|
264
|
-
@property({ type: Boolean, reflect: true, attribute: true }) enableGroupHeader = false;
|
265
|
-
|
266
235
|
/** Gets the validity state object */
|
267
236
|
get validity() {
|
268
237
|
return this.valueInput?.validity;
|
@@ -273,18 +242,8 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
273
242
|
return this.valueInput?.validationMessage;
|
274
243
|
}
|
275
244
|
|
276
|
-
constructor() {
|
277
|
-
super();
|
278
|
-
}
|
279
|
-
|
280
245
|
connectedCallback() {
|
281
246
|
super.connectedCallback();
|
282
|
-
if(!this.enableVirtualScroll) {
|
283
|
-
this.formControlController = new FormControlController(this, {
|
284
|
-
assumeInteractionOn: ['nile-blur', 'nile-input'],
|
285
|
-
});
|
286
|
-
}
|
287
|
-
this.virtualScrollHelper = new VirtualScrollHelper(this);
|
288
247
|
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
289
248
|
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
290
249
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
@@ -299,29 +258,15 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
299
258
|
this.emit('nile-destroy');
|
300
259
|
}
|
301
260
|
|
302
|
-
private options: NileOption[] = [];
|
303
|
-
|
304
261
|
protected updated(_changedProperties: PropertyValues): void {
|
305
262
|
if(_changedProperties.has('multiple')) {
|
306
|
-
this.setCheckBoxInOption(this.multiple
|
307
|
-
}
|
308
|
-
}
|
309
|
-
|
310
|
-
protected firstUpdated(_changedProperties: PropertyValues): void {
|
311
|
-
if(this.enableGroupHeader) {
|
312
|
-
this.handleGroupSearchChange();
|
313
|
-
}
|
314
|
-
|
315
|
-
if(_changedProperties.has('multiple')) {
|
316
|
-
this.setCheckBoxInOption(this.multiple as boolean);
|
263
|
+
this.setCheckBoxInOption(this.multiple);
|
317
264
|
}
|
318
265
|
}
|
319
266
|
|
320
267
|
setCheckBoxInOption(checked: boolean): void {
|
321
|
-
|
322
|
-
|
323
|
-
}
|
324
|
-
this.options.forEach((option: NileOption) => {
|
268
|
+
const options = this.getAllOptions();
|
269
|
+
options.forEach((option: NileOption) => {
|
325
270
|
option.showCheckbox = checked;
|
326
271
|
})
|
327
272
|
}
|
@@ -388,9 +333,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
388
333
|
}
|
389
334
|
});
|
390
335
|
|
391
|
-
if(this.enableGroupHeader) {
|
392
|
-
this.handleGroupShowSelected();
|
393
|
-
}
|
394
336
|
// this.requestUpdate();
|
395
337
|
}
|
396
338
|
|
@@ -404,9 +346,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
404
346
|
el.selected = false;
|
405
347
|
el.hidden = false;
|
406
348
|
});
|
407
|
-
if(this.enableGroupHeader) {
|
408
|
-
this.handleGroupShowSelected();
|
409
|
-
}
|
410
349
|
this.value = '';
|
411
350
|
this.selectionChanged();
|
412
351
|
this.emit('nile-change', { value: this.value, name: this.name });
|
@@ -553,12 +492,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
553
492
|
|
554
493
|
if (this.value !== '') {
|
555
494
|
this.setSelectedOptions([]);
|
556
|
-
this.showSelected = false;
|
557
|
-
this.value = '';
|
558
495
|
this.displayInput.focus({ preventScroll: true });
|
559
|
-
if(this.enableGroupHeader) {
|
560
|
-
this.handleGroupShowSelected();
|
561
|
-
}
|
562
496
|
|
563
497
|
// Emit after update
|
564
498
|
this.updateComplete.then(() => {
|
@@ -622,9 +556,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
622
556
|
el.hidden = this.showSelected;
|
623
557
|
}
|
624
558
|
});
|
625
|
-
|
626
|
-
this.handleGroupShowSelected();
|
627
|
-
}
|
559
|
+
|
628
560
|
this.requestUpdate();
|
629
561
|
}
|
630
562
|
}
|
@@ -662,9 +594,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
662
594
|
el.hidden = this.showSelected;
|
663
595
|
}
|
664
596
|
});
|
665
|
-
if(this.enableGroupHeader) {
|
666
|
-
this.handleGroupShowSelected();
|
667
|
-
}
|
668
597
|
|
669
598
|
// Emit after updating
|
670
599
|
this.updateComplete.then(() => {
|
@@ -818,7 +747,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
818
747
|
|
819
748
|
// Update validity
|
820
749
|
this.updateComplete.then(() => {
|
821
|
-
this.formControlController
|
750
|
+
this.formControlController.updateValidity();
|
822
751
|
});
|
823
752
|
|
824
753
|
this.calculateTotalWidthOfTags();
|
@@ -834,9 +763,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
834
763
|
|
835
764
|
handleSearchChange(e: any) {
|
836
765
|
this.searchValue = e.detail.value;
|
837
|
-
if(this.enableGroupHeader) {
|
838
|
-
this.handleGroupSearchChange();
|
839
|
-
}
|
840
766
|
if (!this.disableLocalSearch) {
|
841
767
|
let filteredOptions = this.filterOptions(this.searchValue);
|
842
768
|
if (filteredOptions.length === 0) {
|
@@ -872,8 +798,8 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
872
798
|
}
|
873
799
|
|
874
800
|
private handleInvalid(event: Event) {
|
875
|
-
this.formControlController
|
876
|
-
this.formControlController
|
801
|
+
this.formControlController.setValidity(false);
|
802
|
+
this.formControlController.emitInvalidEvent(event);
|
877
803
|
}
|
878
804
|
|
879
805
|
@watch('disabled', { waitUntilFirstUpdate: true })
|
@@ -900,14 +826,8 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
900
826
|
// Reset the current option
|
901
827
|
this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption());
|
902
828
|
|
829
|
+
// Show
|
903
830
|
this.emit('nile-show', { value: this.value, name: this.name });
|
904
|
-
|
905
|
-
if(this.enableGroupHeader) {
|
906
|
-
this.getAllGroupAttributes().forEach((el: GroupAttributes) => {
|
907
|
-
el.element.classList.remove('nile-group-hidden');
|
908
|
-
});
|
909
|
-
}
|
910
|
-
|
911
831
|
this.addOpenListeners();
|
912
832
|
|
913
833
|
this.showNoResults = !this.getAllOptions()?.length;
|
@@ -953,46 +873,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
953
873
|
}
|
954
874
|
}
|
955
875
|
|
956
|
-
private getAllGroupAttributes() {
|
957
|
-
return Array.from(
|
958
|
-
this.querySelectorAll<NileOptionGroup>('nile-option-group[name]')
|
959
|
-
).map((el: HTMLElement) => ({
|
960
|
-
name: el?.getAttribute('name') || '',
|
961
|
-
data: el?.getAttribute('data'),
|
962
|
-
element: el
|
963
|
-
}));
|
964
|
-
}
|
965
|
-
|
966
|
-
getUniqueGroupNames(arr: NileOption[]) {
|
967
|
-
return Array.from(new Set(arr.map(obj => obj?.groupName)));
|
968
|
-
}
|
969
|
-
|
970
|
-
handleGroupSearchChange() {
|
971
|
-
const filtered = new Set(
|
972
|
-
this.getUniqueGroupNames(this.filterOptions(this.searchValue))
|
973
|
-
);
|
974
|
-
this.getAllGroupAttributes().forEach(({ name, element }) => {
|
975
|
-
element?.classList.toggle('nile-group-hidden', !filtered.has(name));
|
976
|
-
});
|
977
|
-
}
|
978
|
-
|
979
|
-
handleGroupShowSelected() {
|
980
|
-
const visibleGroups = new Set<string>();
|
981
|
-
|
982
|
-
if (this.showSelected) {
|
983
|
-
this.getAllOptions().forEach((option: NileOption) => {
|
984
|
-
if (!option.hidden) visibleGroups.add(option.groupName);
|
985
|
-
});
|
986
|
-
}
|
987
|
-
|
988
|
-
this.getAllGroupAttributes().forEach(({ name, element }) => {
|
989
|
-
element?.classList.toggle(
|
990
|
-
'nile-group-hidden',
|
991
|
-
this.showSelected && !visibleGroups.has(name)
|
992
|
-
);
|
993
|
-
});
|
994
|
-
}
|
995
|
-
|
996
876
|
/** Shows the listbox. */
|
997
877
|
async show() {
|
998
878
|
if (this.open || this.disabled) {
|
@@ -1022,7 +902,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1022
902
|
|
1023
903
|
/** Gets the associated form, if one exists. */
|
1024
904
|
getForm(): HTMLFormElement | null {
|
1025
|
-
return this.formControlController
|
905
|
+
return this.formControlController.getForm();
|
1026
906
|
}
|
1027
907
|
|
1028
908
|
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
@@ -1033,7 +913,7 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1033
913
|
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
1034
914
|
setCustomValidity(message: string) {
|
1035
915
|
this.valueInput.setCustomValidity(message);
|
1036
|
-
this.formControlController
|
916
|
+
this.formControlController.updateValidity();
|
1037
917
|
}
|
1038
918
|
|
1039
919
|
/** Sets focus on the control. */
|
@@ -1106,10 +986,6 @@ export class NileSelect extends NileElement implements NileFormControl{
|
|
1106
986
|
}
|
1107
987
|
|
1108
988
|
render() {
|
1109
|
-
if(this.enableVirtualScroll) {
|
1110
|
-
return this.virtualScrollHelper.renderVirtualizedContent();
|
1111
|
-
}
|
1112
|
-
|
1113
989
|
const hasLabelSlot = this.hasSlotController.test('label');
|
1114
990
|
const hasHelpTextSlot = this.hasSlotController.test('help-text');
|
1115
991
|
const hasLabelSuffixSlot = this.hasSlotController.test('label-suffix');
|
@@ -27,6 +27,57 @@ export const styles = css`
|
|
27
27
|
nile-table-row > slot::slotted(nile-table-cell-item:first-child) {
|
28
28
|
color: red;
|
29
29
|
}
|
30
|
+
|
31
|
+
.row-container {
|
32
|
+
display: flex;
|
33
|
+
flex-direction: column;
|
34
|
+
}
|
35
|
+
|
36
|
+
.row {
|
37
|
+
cursor: default;
|
38
|
+
position: relative;
|
39
|
+
display: flex;
|
40
|
+
align-items: center;
|
41
|
+
}
|
42
|
+
|
43
|
+
.row.expandable {
|
44
|
+
border-bottom: 1px solid var(--nile-table-row-border-color);
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
.expanded-content {
|
49
|
+
overflow: hidden;
|
50
|
+
transition: max-height 0.3s ease;
|
51
|
+
}
|
52
|
+
|
53
|
+
.row.expandable .expand-icon {
|
54
|
+
margin-right: 4px;
|
55
|
+
}
|
56
|
+
|
57
|
+
.row ::slotted(nile-table-cell-item),
|
58
|
+
.row ::slotted(nile-table-header-item) {
|
59
|
+
flex: 1 1 0;
|
60
|
+
box-sizing: border-box;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
.row-container {
|
65
|
+
display: flex;
|
66
|
+
flex-direction: column;
|
67
|
+
}
|
68
|
+
|
69
|
+
.expand-icon {
|
70
|
+
position: absolute;
|
71
|
+
left: 0.40em;
|
72
|
+
top: 50%;
|
73
|
+
transform: translateY(-50%);
|
74
|
+
cursor: pointer;
|
75
|
+
font-size: 1em;
|
76
|
+
line-height: 1;
|
77
|
+
user-select: none;
|
78
|
+
z-index: 2;
|
79
|
+
}
|
80
|
+
|
30
81
|
`;
|
31
82
|
|
32
83
|
export default [styles];
|