@aquera/nile-elements 0.0.12 → 0.0.14
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/internal/enum.d.ts +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/internal/enum.js +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/internal/enum.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.d.ts +3 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js +70 -23
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.css.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.js +15 -8
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-form-help-text/nile-form-help-text.css.js +10 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-form-help-text/nile-form-help-text.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-form-help-text/nile-form-help-text.d.ts +8 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-form-help-text/nile-form-help-text.js +56 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-form-help-text/nile-form-help-text.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-loop.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-loop.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/array-loop.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/document.d.ts +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/document.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/document.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.d.ts +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/integer.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/integer.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/integer.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.js +7 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.css.js +11 -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.js +10 -1
- 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-switcher/nile-switcher.d.ts +2 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +34 -20
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/demo/filenames.txt +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +104 -57
- package/dist/internal/enum.cjs.js +1 -1
- package/dist/internal/enum.cjs.js.map +1 -1
- package/dist/internal/enum.esm.js +1 -1
- package/dist/nile-badge/index.cjs.js +1 -1
- package/dist/nile-badge/index.esm.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
- package/dist/nile-badge/nile-badge.esm.js +1 -1
- package/dist/nile-button/index.cjs.js +1 -1
- package/dist/nile-button/index.esm.js +1 -1
- package/dist/nile-button/nile-button.cjs.js +1 -1
- package/dist/nile-button/nile-button.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.esm.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.esm.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.esm.js +13 -13
- package/dist/nile-dialog/index.cjs.js +1 -1
- package/dist/nile-dialog/index.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.cjs.js.map +1 -1
- package/dist/nile-error-message/nile-error-message.css.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.css.cjs.js.map +1 -1
- package/dist/nile-error-message/nile-error-message.css.esm.js +1 -0
- package/dist/nile-error-message/nile-error-message.esm.js +13 -10
- package/dist/nile-form-help-text/index.cjs.js +1 -1
- package/dist/nile-form-help-text/index.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.esm.js +10 -0
- package/dist/nile-form-help-text/nile-form-help-text.esm.js +16 -5
- package/dist/nile-icon/icons/svg/array-loop.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/array-loop.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/array-loop.esm.js +1 -0
- package/dist/nile-icon/icons/svg/document.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/document.cjs.js.map +1 -1
- package/dist/nile-icon/icons/svg/document.esm.js +1 -1
- package/dist/nile-icon/icons/svg/index.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/index.esm.js +1 -1
- package/dist/nile-icon/icons/svg/integer.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/integer.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/integer.esm.js +1 -0
- package/dist/nile-icon/index.cjs.js +1 -1
- package/dist/nile-icon/index.cjs.js.map +1 -1
- package/dist/nile-icon/index.esm.js +2 -2
- package/dist/nile-icon-button/index.cjs.js +1 -1
- package/dist/nile-icon-button/index.esm.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
- package/dist/nile-icon-button/nile-icon-button.esm.js +1 -1
- package/dist/nile-input/index.cjs.js +1 -1
- package/dist/nile-input/index.esm.js +1 -1
- 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 +1 -1
- package/dist/nile-menu-item/index.cjs.js +1 -1
- package/dist/nile-menu-item/index.esm.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -1
- package/dist/nile-menu-item/nile-menu-item.esm.js +1 -1
- package/dist/nile-option/index.cjs.js +1 -1
- package/dist/nile-option/index.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 +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.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 +11 -0
- package/dist/nile-select/nile-select.esm.js +8 -2
- package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.esm.js +43 -38
- package/dist/nile-tag/index.cjs.js +1 -1
- package/dist/nile-tag/index.esm.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.esm.js +1 -1
- package/dist/src/internal/enum.d.ts +3 -0
- package/dist/src/internal/enum.js +3 -0
- package/dist/src/internal/enum.js.map +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.css.js +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.d.ts +3 -2
- package/dist/src/nile-content-editor/nile-content-editor.js +70 -23
- package/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/dist/src/nile-error-message/nile-error-message.css.js +1 -0
- package/dist/src/nile-error-message/nile-error-message.css.js.map +1 -1
- package/dist/src/nile-error-message/nile-error-message.d.ts +1 -0
- package/dist/src/nile-error-message/nile-error-message.js +15 -8
- package/dist/src/nile-error-message/nile-error-message.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js +10 -0
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.d.ts +8 -0
- package/dist/src/nile-form-help-text/nile-form-help-text.js +56 -6
- package/dist/src/nile-form-help-text/nile-form-help-text.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/array-loop.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/array-loop.js +5 -0
- package/dist/src/nile-icon/icons/svg/array-loop.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/document.d.ts +1 -1
- package/dist/src/nile-icon/icons/svg/document.js +1 -1
- package/dist/src/nile-icon/icons/svg/document.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/index.d.ts +2 -0
- package/dist/src/nile-icon/icons/svg/index.js +2 -0
- package/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/integer.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/integer.js +5 -0
- package/dist/src/nile-icon/icons/svg/integer.js.map +1 -0
- package/dist/src/nile-option/nile-option.js +7 -0
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-select/nile-select.css.js +11 -0
- package/dist/src/nile-select/nile-select.css.js.map +1 -1
- package/dist/src/nile-select/nile-select.js +10 -1
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +2 -1
- package/dist/src/nile-switcher/nile-switcher.js +34 -20
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/internal/enum.ts +3 -0
- package/src/nile-content-editor/nile-content-editor.css.ts +1 -1
- package/src/nile-content-editor/nile-content-editor.ts +78 -29
- package/src/nile-error-message/nile-error-message.css.ts +1 -0
- package/src/nile-error-message/nile-error-message.ts +17 -9
- package/src/nile-form-help-text/nile-form-help-text.css.ts +10 -0
- package/src/nile-form-help-text/nile-form-help-text.ts +73 -26
- package/src/nile-icon/icons/svg/array-loop.ts +5 -0
- package/src/nile-icon/icons/svg/document.ts +1 -1
- package/src/nile-icon/icons/svg/index.ts +2 -0
- package/src/nile-icon/icons/svg/integer.ts +5 -0
- package/src/nile-option/nile-option.ts +9 -0
- package/src/nile-select/nile-select.css.ts +11 -0
- package/src/nile-select/nile-select.ts +10 -1
- package/src/nile-switcher/nile-switcher.ts +51 -24
package/package.json
CHANGED
package/src/internal/enum.ts
CHANGED
@@ -66,6 +66,7 @@ export class NileContentEditor extends NileElement {
|
|
66
66
|
|
67
67
|
connectedCallback() {
|
68
68
|
this.handleOutsideClick = this.handleOutsideClick.bind(this);
|
69
|
+
this.handleClipboardEvent = this.handleClipboardEvent.bind(this);
|
69
70
|
super.connectedCallback();
|
70
71
|
this.emit('nile-init');
|
71
72
|
this.addOpenListeners();
|
@@ -83,10 +84,40 @@ export class NileContentEditor extends NileElement {
|
|
83
84
|
|
84
85
|
addOpenListeners() {
|
85
86
|
window.addEventListener('click', this.handleOutsideClick);
|
87
|
+
window.addEventListener('cut', this.handleClipboardEvent);
|
88
|
+
window.addEventListener('copy', this.handleClipboardEvent);
|
89
|
+
window.addEventListener('paste', this.handleClipboardEvent);
|
86
90
|
}
|
87
91
|
|
88
92
|
removeOpenListeners() {
|
89
93
|
window.removeEventListener('click', this.handleOutsideClick);
|
94
|
+
window.removeEventListener('cut', this.handleClipboardEvent);
|
95
|
+
window.removeEventListener('copy', this.handleClipboardEvent);
|
96
|
+
window.removeEventListener('paste', this.handleClipboardEvent);
|
97
|
+
}
|
98
|
+
|
99
|
+
async handleClipboardEvent(event: Event) {
|
100
|
+
const selectedText = window?.getSelection()?.toString();
|
101
|
+
switch (event.type) {
|
102
|
+
case 'cut':
|
103
|
+
case 'copy':
|
104
|
+
if (!!selectedText) await navigator.clipboard.writeText(selectedText);
|
105
|
+
document.execCommand(event.type);
|
106
|
+
break;
|
107
|
+
case 'paste':
|
108
|
+
event.preventDefault();
|
109
|
+
let pastedText = await navigator.clipboard.readText();
|
110
|
+
pastedText = pastedText
|
111
|
+
.replace(/<(|\/)(html|body|meta|span)[^>]*?>/gi, '')
|
112
|
+
.trim();
|
113
|
+
document.execCommand('insertText', false, pastedText);
|
114
|
+
break;
|
115
|
+
default:
|
116
|
+
break;
|
117
|
+
}
|
118
|
+
setTimeout(() => {
|
119
|
+
this.emitInputChange();
|
120
|
+
});
|
90
121
|
}
|
91
122
|
|
92
123
|
toggleDropdown(value: boolean) {
|
@@ -110,20 +141,17 @@ export class NileContentEditor extends NileElement {
|
|
110
141
|
this.emit('nile-destroy');
|
111
142
|
}
|
112
143
|
|
113
|
-
handlePaste(event: ClipboardEvent) {
|
114
|
-
event.preventDefault();
|
115
|
-
if (event.clipboardData) {
|
116
|
-
let text = event.clipboardData.getData('text/plain');
|
117
|
-
document.execCommand('insertText', false, text);
|
118
|
-
}
|
119
|
-
this.emitInputChange();
|
120
|
-
}
|
121
|
-
|
122
144
|
private handlekeyDown(event: any) {
|
123
145
|
if (event.code === KeyCode.ENTER && this.type === 'text') {
|
124
146
|
event.preventDefault();
|
125
147
|
return;
|
126
148
|
}
|
149
|
+
if (
|
150
|
+
[KeyCode.CUT, KeyCode.COPY, KeyCode.PASTE].includes(event.code) &&
|
151
|
+
(event.ctrlKey || event.metaKey)
|
152
|
+
) {
|
153
|
+
return;
|
154
|
+
}
|
127
155
|
if (event.code === KeyCode.ESCAPE) {
|
128
156
|
event.preventDefault();
|
129
157
|
this.toggleDropdown(false);
|
@@ -133,19 +161,20 @@ export class NileContentEditor extends NileElement {
|
|
133
161
|
const value = this.contentEditor.innerText;
|
134
162
|
this.emitInputChange();
|
135
163
|
if (value.includes(this.tagIdentifier)) {
|
136
|
-
this.
|
164
|
+
this.insertNodes(this.contentEditor, this.contentEditor.childNodes);
|
137
165
|
this.filterOptions();
|
166
|
+
this.toggleDropdown(true);
|
138
167
|
} else {
|
139
168
|
this.toggleDropdown(false);
|
140
169
|
}
|
141
|
-
});
|
170
|
+
}, 10);
|
142
171
|
}
|
143
172
|
|
144
173
|
filterOptions() {
|
145
174
|
this.filteredOptions = this.options;
|
146
175
|
if (!!this.options.length && !!this.filteredValue) {
|
147
176
|
this.filteredOptions = this.options.filter(item =>
|
148
|
-
item.
|
177
|
+
item.includes(this.filteredValue)
|
149
178
|
);
|
150
179
|
} else {
|
151
180
|
this.filteredOptions = this.options;
|
@@ -166,39 +195,57 @@ export class NileContentEditor extends NileElement {
|
|
166
195
|
var result = string.replace(pattern, (match: any, option: any) => {
|
167
196
|
return this.options.includes(option)
|
168
197
|
? '<span class="chips" contenteditable="false">' + option + '</span>'
|
169
|
-
:
|
170
|
-
option +
|
171
|
-
'</span>';
|
198
|
+
: this.setError(option);
|
172
199
|
});
|
173
200
|
return result;
|
174
201
|
}
|
175
202
|
|
203
|
+
setError(option: any) {
|
204
|
+
this.error = true;
|
205
|
+
return (
|
206
|
+
'<span class="chips chip-error" contenteditable="false">' +
|
207
|
+
option +
|
208
|
+
'</span>'
|
209
|
+
);
|
210
|
+
}
|
211
|
+
|
176
212
|
emitInputChange(): void {
|
177
213
|
if (this.contentEditor) {
|
178
214
|
let fieldValue = this.contentEditor.innerHTML;
|
179
|
-
|
180
215
|
if (this.contentEditor.innerText !== '') {
|
181
216
|
fieldValue = this.generateValuesFromHTMLTags(fieldValue);
|
182
217
|
}
|
183
218
|
fieldValue = fieldValue.replace(/ /g, ' ');
|
184
|
-
fieldValue = fieldValue
|
219
|
+
fieldValue = fieldValue.replace('<br>', '');
|
185
220
|
this.emit('nile-change', {
|
186
221
|
value: this.generateValuesFromHTMLTags(fieldValue),
|
187
222
|
});
|
188
223
|
}
|
189
224
|
}
|
190
225
|
|
191
|
-
insertNodes(parentNode: Node, childNodes: NodeList, autoOptionsTag
|
192
|
-
|
226
|
+
insertNodes(parentNode: Node, childNodes: NodeList, autoOptionsTag?: Node) {
|
227
|
+
[...childNodes].forEach((node: Node, index: number) => {
|
193
228
|
if (node.hasChildNodes()) {
|
194
|
-
|
229
|
+
if (autoOptionsTag) {
|
230
|
+
this.insertNodes(node, node.childNodes, autoOptionsTag);
|
231
|
+
} else {
|
232
|
+
this.insertNodes(node, node.childNodes);
|
233
|
+
}
|
195
234
|
} else {
|
196
235
|
if (node.nodeValue?.includes(this.tagIdentifier)) {
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
236
|
+
if (autoOptionsTag) {
|
237
|
+
parentNode.childNodes[index].nodeValue = node.nodeValue?.replace(
|
238
|
+
this.tagIdentifier + this.filteredValue,
|
239
|
+
''
|
240
|
+
);
|
241
|
+
parentNode.childNodes[index].after(autoOptionsTag);
|
242
|
+
}
|
243
|
+
this.filteredValue =
|
244
|
+
parentNode?.childNodes[index]?.nodeValue
|
245
|
+
?.split(this.tagIdentifier)
|
246
|
+
.slice(1)
|
247
|
+
.join() || '';
|
248
|
+
return;
|
202
249
|
}
|
203
250
|
}
|
204
251
|
});
|
@@ -250,6 +297,7 @@ export class NileContentEditor extends NileElement {
|
|
250
297
|
<nile-popup
|
251
298
|
.active="${live(this.openDropdown)}"
|
252
299
|
sync="width"
|
300
|
+
strategy="fixed"
|
253
301
|
placement="bottom"
|
254
302
|
class=${classMap({
|
255
303
|
dropdown: true,
|
@@ -261,11 +309,12 @@ export class NileContentEditor extends NileElement {
|
|
261
309
|
${this.showLabel && this.labelText
|
262
310
|
? html`<label class="ods-label">${this.labelText} </label> ${this
|
263
311
|
.required
|
264
|
-
? html`<
|
312
|
+
? html`<span class="asterik">*</span>`
|
265
313
|
: ''}`
|
266
314
|
: ''}
|
267
315
|
<div
|
268
316
|
contenteditable="${!readonly}"
|
317
|
+
spellcheck="false"
|
269
318
|
class=${classMap({
|
270
319
|
'content-editable-input': true,
|
271
320
|
error: hasError || hasErrorMessage,
|
@@ -273,7 +322,6 @@ export class NileContentEditor extends NileElement {
|
|
273
322
|
'text-area': type === 'text-area' ? true : false,
|
274
323
|
})}
|
275
324
|
@keydown=${this.handlekeyDown}
|
276
|
-
@paste=${this.handlePaste}
|
277
325
|
></div>
|
278
326
|
${hasHelpText
|
279
327
|
? html`
|
@@ -288,8 +336,9 @@ export class NileContentEditor extends NileElement {
|
|
288
336
|
`
|
289
337
|
: ``}
|
290
338
|
</div>
|
291
|
-
|
292
|
-
|
339
|
+
${this.filteredOptions && !!this.filteredOptions.length
|
340
|
+
? this.renderAutoOptions()
|
341
|
+
: null}
|
293
342
|
</nile-popup>
|
294
343
|
`;
|
295
344
|
}
|
@@ -26,6 +26,10 @@ export class NileErrorMessage extends LitElement {
|
|
26
26
|
@property({ type: String })
|
27
27
|
errorResponse: string;
|
28
28
|
|
29
|
+
// Extended error information
|
30
|
+
@property({ type: String })
|
31
|
+
errorResponseLong: string;
|
32
|
+
|
29
33
|
@property({ type: Boolean })
|
30
34
|
isExpanded: boolean = false;
|
31
35
|
|
@@ -64,22 +68,26 @@ export class NileErrorMessage extends LitElement {
|
|
64
68
|
|
65
69
|
|
66
70
|
${this.errorResponse
|
67
|
-
|
68
|
-
|
69
|
-
|
71
|
+
? html`
|
72
|
+
<div class="nile-error-message__response">
|
73
|
+
${this.errorResponse}
|
74
|
+
${this.errorResponseLong
|
75
|
+
? html`
|
70
76
|
<span
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
77
|
+
class="nile-error-message__more-button"
|
78
|
+
@click=${this.toggleExpanded}
|
79
|
+
>${this.isExpanded ? 'View Less' : 'View More'}</span
|
80
|
+
>`:``}
|
81
|
+
</div>
|
82
|
+
`
|
83
|
+
: ``}
|
76
84
|
|
77
85
|
<div
|
78
86
|
class="nile-error-message__response-expanded ${this.isExpanded
|
79
87
|
? 'expanded'
|
80
88
|
: 'collapsed'}"
|
81
89
|
>
|
82
|
-
${this.
|
90
|
+
${this.errorResponseLong}
|
83
91
|
</div>
|
84
92
|
</div>
|
85
93
|
`;
|
@@ -26,8 +26,18 @@ export const styles = css`
|
|
26
26
|
line-height: 12px;
|
27
27
|
letter-spacing: 0.2px;
|
28
28
|
margin-top: 6px;
|
29
|
+
margin-right: 4px;
|
30
|
+
width: auto;
|
29
31
|
}
|
30
32
|
|
33
|
+
.nile-form-help-text__more-button {
|
34
|
+
display: inline-flex;
|
35
|
+
gap: 4px;
|
36
|
+
color: var(--nile-colors-primary-600);
|
37
|
+
cursor: pointer;
|
38
|
+
white-space: nowrap;
|
39
|
+
align-items: center
|
40
|
+
}
|
31
41
|
`;
|
32
42
|
|
33
43
|
export default [styles];
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
9
|
+
import { customElement, query } from 'lit/decorators.js';
|
10
10
|
import {styles} from './nile-form-help-text.css';
|
11
11
|
|
12
12
|
/**
|
@@ -17,32 +17,79 @@ import {styles} from './nile-form-help-text.css';
|
|
17
17
|
*/
|
18
18
|
@customElement('nile-form-help-text')
|
19
19
|
export class NileFormHelpText extends LitElement {
|
20
|
+
/**
|
21
|
+
* The styles for FormHelpText
|
22
|
+
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
23
|
+
*/
|
24
|
+
public static get styles(): CSSResultArray {
|
25
|
+
return [styles];
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
@property({ type: Boolean })
|
30
|
+
isExpanded: boolean = false;
|
31
|
+
|
32
|
+
@property({ type: String })
|
33
|
+
fullText: string = '';
|
34
|
+
|
35
|
+
@property({ type: String })
|
36
|
+
displayedText: string = '';
|
37
|
+
|
38
|
+
@query('slot')
|
39
|
+
slotElement!: HTMLSlotElement;
|
40
|
+
|
41
|
+
connectedCallback() {
|
42
|
+
super.connectedCallback();
|
43
|
+
requestAnimationFrame(() => {
|
44
|
+
this.slotElement?.addEventListener('slotchange', this.handleSlotChange.bind(this));
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
firstUpdated() {
|
49
|
+
this.handleSlotChange();
|
50
|
+
}
|
51
|
+
|
52
|
+
handleSlotChange() {
|
53
|
+
const nodes = this.slotElement.assignedNodes({flatten: true});
|
54
|
+
const textContent = nodes.map(node => node.textContent).join('');
|
55
|
+
this.fullText = textContent;
|
56
|
+
this.displayedText = textContent.length > 50 ? `${textContent.substring(0, 47)}...` : textContent;
|
57
|
+
}
|
58
|
+
|
59
|
+
toggleExpanded() {
|
60
|
+
this.isExpanded = !this.isExpanded;
|
61
|
+
this.displayedText = this.isExpanded ? this.fullText : `${this.fullText.substring(0, 47)}...`;
|
62
|
+
}
|
20
63
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
64
|
+
/* #endregion */
|
65
|
+
|
66
|
+
/* #region Methods */
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Render method
|
70
|
+
* @slot This is a slot test
|
71
|
+
*/
|
72
|
+
public render(): TemplateResult {
|
73
|
+
const showMoreButton = this.fullText.length > 50;
|
74
|
+
const iconName = this.isExpanded ? 'arrowup' : 'arrowdown';
|
75
|
+
|
76
|
+
return html`
|
77
|
+
<div class="nile-form-help-text" part="container">
|
78
|
+
<slot hidden></slot>
|
79
|
+
<div part="text">${this.displayedText}
|
80
|
+
${showMoreButton ? html`
|
81
|
+
<span
|
82
|
+
class="nile-form-help-text__more-button"
|
83
|
+
part="toggle-button"
|
84
|
+
@click=${this.toggleExpanded}
|
85
|
+
>${this.isExpanded ? 'View Less' : 'View More'}
|
86
|
+
<nile-icon color="#005EA6" part="icon" size="14" name="${iconName}"></nile-icon>
|
87
|
+
</span>
|
88
|
+
` : ''}
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
`;
|
92
|
+
}
|
46
93
|
}
|
47
94
|
|
48
95
|
export default NileFormHelpText;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Do not edit directly
|
3
|
+
*/
|
4
|
+
|
5
|
+
export default "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxMi4zNCI+PHBhdGggZD0ibTEwLjM4LDYuNTloLjM4di0uODRoLS4zOGMtLjg2LDAtMS4zMi0uNS0xLjMyLTEuMzZ2LTIuMzdjMC0uNDctLjEtLjg3LS4zLTEuMTloMHMwLS4wMi0uMDEtLjAyaDBjLS4zMy0uNTEtLjkzLS44MS0xLjgtLjgxaC0uOTJ2Ljg0aC43NWMuOTMsMCwxLjI1LjQ0LDEuMjUsMS4yM3YyLjQxYzAsLjk0LjQyLDEuNTUsMS4zMSwxLjctLjg5LjE1LTEuMzEuNzUtMS4zMSwxLjd2Mi40MWMwLC43OC0uMzIsMS4yMy0xLjI1LDEuMjNoLS43NXYuODRoLjkyYy44NywwLDEuNDctLjMsMS44LS44MmgwczAtLjAxLjAxLS4wMmgwYy4yLS4zMi4zLS43Mi4zLTEuMTl2LTIuMzdjMC0uODYuNDYtMS4zNiwxLjMyLTEuMzZaIi8+PHBhdGggZD0ibTE1LjYyLDUuNzVjLS44NiwwLTEuMzItLjUtMS4zMi0xLjM2di0yLjM3YzAtMS4yNC0uNy0yLjAyLTIuMTItMi4wMmgtLjJjLjI1LjI2LjQzLjU3LjU0Ljg5LjU0LjE0Ljc1LjU1Ljc1LDEuMTd2Mi40MWMwLC45NC40MiwxLjU1LDEuMzEsMS43LS44OS4xNS0xLjMxLjc1LTEuMzEsMS43djIuNDFjMCwuNjItLjIsMS4wMy0uNzUsMS4xNy0uMTIuMzMtLjI5LjYzLS41NC44OWguMmMxLjQxLDAsMi4xMi0uNzgsMi4xMi0yLjAydi0yLjM3YzAtLjg2LjQ2LTEuMzYsMS4zMi0xLjM2aC4zOHYtLjg0aC0uMzhaIi8+PHBhdGggZD0ibTEzLjEsNi41OWguMzh2LS44NGgtLjM4Yy0uODYsMC0xLjMyLS41LTEuMzItMS4zNnYtMi4zN2MwLTEuMjQtLjctMi4wMi0yLjEyLTIuMDJoLS40OWMuMjQuMjUuNDEuNTMuNTIuODQuNzguMDYsMS4wNS41LDEuMDUsMS4yMnYyLjQxYzAsLjk0LjQyLDEuNTUsMS4zMSwxLjctLjg5LjE1LTEuMzEuNzUtMS4zMSwxLjd2Mi40MWMwLC43Mi0uMjgsMS4xNi0xLjA1LDEuMjItLjEyLjMxLS4yOS41OS0uNTIuODRoLjQ5YzEuNDEsMCwyLjEyLS43OCwyLjEyLTIuMDJ2LTIuMzdjMC0uODYuNDYtMS4zNiwxLjMyLTEuMzZaIi8+PHBhdGggZD0ibTEuNywyLjAydjIuMzdjMCwuODYtLjQ2LDEuMzYtMS4zMiwxLjM2aC0uMzh2Ljg0aC4zOGMuODYsMCwxLjMyLjUsMS4zMiwxLjM2djIuMzdjMCwxLjI0LjcsMi4wMiwyLjEyLDIuMDJoLjkydi0uODRoLS43NWMtLjkzLDAtMS4yNS0uNDQtMS4yNS0xLjIzdi0yLjQxYzAtLjk0LS40Mi0xLjU1LTEuMzEtMS43Ljg5LS4xNSwxLjMxLS43NSwxLjMxLTEuN3YtMi40MWMwLS43OC4zMi0xLjIzLDEuMjUtMS4yM2guNzV2LS44NGgtLjkyQzIuNCwwLDEuNy43OCwxLjcsMi4wMloiLz48L3N2Zz4=";
|
@@ -2,4 +2,4 @@
|
|
2
2
|
* Do not edit directly
|
3
3
|
*/
|
4
4
|
|
5
|
-
export default "
|
5
|
+
export default "PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjUiIHZpZXdCb3g9IjAgMCAyNCAyNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNzUgNS43MzgyOEMzLjc1IDQuNDk1NjQgNC43NTczNiAzLjQ4ODI4IDYgMy40ODgyOEgxMy4zNzVWNS43MzgyOEMxMy4zNzUgNy44MDkzNSAxNS4wNTM5IDkuNDg4MjggMTcuMTI1IDkuNDg4MjhIMjAuMjVWMTkuNzM4M0MyMC4yNSAyMC45ODA5IDE5LjI0MjYgMjEuOTg4MyAxOCAyMS45ODgzSDZDNC43NTczNiAyMS45ODgzIDMuNzUgMjAuOTgwOSAzLjc1IDE5LjczODNWNS43MzgyOFpNMTkgNy45ODgyOEwxNC44NzUgNC4zODgyOFY1LjczODI4QzE0Ljg3NSA2Ljk4MDkyIDE1Ljg4MjQgNy45ODgyOCAxNy4xMjUgNy45ODgyOEgxOVpNNiAxLjk4ODI4QzMuOTI4OTMgMS45ODgyOCAyLjI1IDMuNjY3MjEgMi4yNSA1LjczODI4VjE5LjczODNDMi4yNSAyMS44MDkzIDMuOTI4OTMgMjMuNDg4MyA2IDIzLjQ4ODNIMThDMjAuMDcxMSAyMy40ODgzIDIxLjc1IDIxLjgwOTMgMjEuNzUgMTkuNzM4M1Y4LjM5NzM3TDE0LjQwNjIgMS45ODgyOEg2Wk02IDE4LjQ4ODNMMTggMTguNDg4M1YxNi45ODgzTDYgMTYuOTg4M0w2IDE4LjQ4ODNaTTE4IDE0LjIzODNMNiAxNC4yMzgzTDYgMTIuNzM4M0wxOCAxMi43MzgzVjE0LjIzODNaTTYgMTAuMjM4M0gxMVY4LjczODI4TDYgOC43MzgyOEw2IDEwLjIzODNaIiBmaWxsPSJibGFjayIvPjwvc3ZnPg==";
|
@@ -15,6 +15,7 @@ export { default as applyfilter } from './apply-filter';
|
|
15
15
|
export { default as approve } from './approve';
|
16
16
|
export { default as aquera } from './aquera';
|
17
17
|
export { default as aquerasupport } from './aquerasupport';
|
18
|
+
export { default as arrayloop } from './array-loop';
|
18
19
|
export { default as array } from './array';
|
19
20
|
export { default as arrayofobject } from './arrayofobject';
|
20
21
|
export { default as arrow } from './arrow';
|
@@ -192,6 +193,7 @@ export { default as infoicon1 } from './info-icon1';
|
|
192
193
|
export { default as info } from './info';
|
193
194
|
export { default as info2 } from './info2';
|
194
195
|
export { default as inprogress } from './inprogress';
|
196
|
+
export { default as integer } from './integer';
|
195
197
|
export { default as itemplaceholder } from './itemplaceholder';
|
196
198
|
export { default as js } from './js';
|
197
199
|
export { default as kill } from './kill';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Do not edit directly
|
3
|
+
*/
|
4
|
+
|
5
|
+
export default "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJhIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PGRlZnM+PHN0eWxlPi5ie3N0cm9rZS13aWR0aDowcHg7fTwvc3R5bGU+PC9kZWZzPjxwb2x5Z29uIGNsYXNzPSJiIiBwb2ludHM9IjMgNS43MyAzIDYuNzYgNC4yNSA2LjI5IDQuMjUgMTEgNS40MSAxMSA1LjQxIDUuMTIgNC40NSA1LjEyIDMgNS43MyIvPjxwYXRoIGNsYXNzPSJiIiBkPSJtMTEuNTcsOC42NWMuNTUtLjUsMS4xNS0xLjA2LDEuMTUtMS45MiwwLTEuMDUtLjgyLTEuNzMtMi4wMy0xLjczcy0xLjk3LjYzLTEuOTcsMS44di4xN2gxLjF2LS4xMmMwLS41Ni4zLS45Ljg3LS45LjUsMCwuODYuMjkuODYuNzksMCwuNDEtLjIzLjcxLS41NSwxLjAzbC0yLjM5LDIuMzV2Ljg4aDQuMDd2LS45NWgtMi42NWwxLjUzLTEuNFoiLz48L3N2Zz4=";
|
@@ -141,6 +141,15 @@ export class NileOption extends NileElement {
|
|
141
141
|
|
142
142
|
/** Returns a plain text label based on the option's content. */
|
143
143
|
getTextLabel() {
|
144
|
+
// Search for a label element inside the component
|
145
|
+
const labelElement = this.querySelector('label');
|
146
|
+
|
147
|
+
// If a label element is found, return its text content
|
148
|
+
if (labelElement) {
|
149
|
+
return labelElement.textContent?.trim() ?? '';
|
150
|
+
}
|
151
|
+
|
152
|
+
// If no label element is found, return the existing behavior
|
144
153
|
return (this.textContent ?? '').trim();
|
145
154
|
}
|
146
155
|
|
@@ -304,6 +304,13 @@ export const styles = css`
|
|
304
304
|
color: #aaaaaa;
|
305
305
|
}
|
306
306
|
|
307
|
+
.select__suffix {
|
308
|
+
flex: 0;
|
309
|
+
display: inline-flex;
|
310
|
+
align-items: center;
|
311
|
+
color: #aaaaaa;
|
312
|
+
}
|
313
|
+
|
307
314
|
/* Clear button */
|
308
315
|
.select__clear {
|
309
316
|
display: inline-flex;
|
@@ -426,6 +433,10 @@ export const styles = css`
|
|
426
433
|
animation: spin 0.6s linear infinite;
|
427
434
|
}
|
428
435
|
|
436
|
+
.select__no-results {
|
437
|
+
padding: 10px;
|
438
|
+
}
|
439
|
+
|
429
440
|
@keyframes spin {
|
430
441
|
0% {
|
431
442
|
transform: rotate(0deg);
|
@@ -218,7 +218,8 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
218
218
|
|
219
219
|
@property({ type: Boolean }) showSelected = false;
|
220
220
|
|
221
|
-
|
221
|
+
|
222
|
+
@property({ type: Boolean }) showNoResults: boolean = false;
|
222
223
|
|
223
224
|
@property({ type: String }) noResultsMessage: string = "No results found";
|
224
225
|
|
@@ -1054,6 +1055,14 @@ export class NileSelect extends NileElement implements NileFormControl {
|
|
1054
1055
|
`
|
1055
1056
|
: ''}
|
1056
1057
|
|
1058
|
+
<slot
|
1059
|
+
part="suffix"
|
1060
|
+
name="suffix"
|
1061
|
+
class=${classMap({
|
1062
|
+
select__suffix: true,
|
1063
|
+
})}
|
1064
|
+
></slot>
|
1065
|
+
|
1057
1066
|
<slot
|
1058
1067
|
name="expand-icon"
|
1059
1068
|
part="expand-icon"
|
@@ -55,6 +55,7 @@ export interface switchInputType {
|
|
55
55
|
error?: boolean;
|
56
56
|
errorMessage?: string;
|
57
57
|
options?: Array<any>;
|
58
|
+
helperText?: string;
|
58
59
|
multiple?: boolean;
|
59
60
|
}
|
60
61
|
|
@@ -98,6 +99,7 @@ export class NileSwitcher extends NileElement {
|
|
98
99
|
placeholder,
|
99
100
|
disabled,
|
100
101
|
required,
|
102
|
+
error,
|
101
103
|
errorMessage,
|
102
104
|
inputType: inputTypeName,
|
103
105
|
} = Input;
|
@@ -108,7 +110,7 @@ export class NileSwitcher extends NileElement {
|
|
108
110
|
.required=${required}
|
109
111
|
.errorMessage=${errorMessage}
|
110
112
|
.placeholder=${placeholder}
|
111
|
-
.error=${
|
113
|
+
.error=${error}
|
112
114
|
@nile-input=${(e: CustomEvent) => {
|
113
115
|
this.handleChange(e, inputType, inputTypeName);
|
114
116
|
}}
|
@@ -138,10 +140,21 @@ export class NileSwitcher extends NileElement {
|
|
138
140
|
}
|
139
141
|
|
140
142
|
renderNileTextArea(Input: switchInputType, inputType: string) {
|
141
|
-
const {
|
143
|
+
const {
|
144
|
+
value,
|
145
|
+
disabled,
|
146
|
+
readonly,
|
147
|
+
errorMessage,
|
148
|
+
error,
|
149
|
+
inputType: inputTypeName,
|
150
|
+
} = Input;
|
151
|
+
|
142
152
|
return html`<nile-textarea
|
143
153
|
.value=${value}
|
144
154
|
.disabled=${disabled}
|
155
|
+
?readonly=${readonly}
|
156
|
+
.error=${error}
|
157
|
+
.errorMessage=${errorMessage}
|
145
158
|
@nile-input=${(e: CustomEvent) => {
|
146
159
|
this.handleChange(e, inputType, inputTypeName);
|
147
160
|
}}
|
@@ -188,16 +201,16 @@ export class NileSwitcher extends NileElement {
|
|
188
201
|
readonly,
|
189
202
|
} = Input;
|
190
203
|
return html`<nile-content-editor
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
204
|
+
.value=${value}
|
205
|
+
.options=${options}
|
206
|
+
.type=${type}
|
207
|
+
.readonly=${readonly}
|
208
|
+
.errorMessage=${errorMessage}
|
209
|
+
@nile-change=${(e: CustomEvent) => {
|
210
|
+
this.handleChange(e, inputType, inputTypeName);
|
211
|
+
}}
|
212
|
+
>
|
213
|
+
</nile-content-editor>`;
|
201
214
|
}
|
202
215
|
|
203
216
|
handleChange(event: CustomEvent, inputType: string, inputTypeName: string) {
|
@@ -212,20 +225,34 @@ export class NileSwitcher extends NileElement {
|
|
212
225
|
this.emit('nile-change', { config: this.nileSwitchConfig });
|
213
226
|
}
|
214
227
|
|
215
|
-
renderIcon() {
|
228
|
+
renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {
|
229
|
+
const defaultHelperText = defaultInput.helperText;
|
230
|
+
const switchHelperText = switchInput.helperText;
|
231
|
+
|
216
232
|
const icon = !this.nileSwitchConfig.toggleSwitch
|
217
233
|
? 'header-functions'
|
218
234
|
: 'stringinput';
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
235
|
+
|
236
|
+
const helperText = !this.nileSwitchConfig.toggleSwitch
|
237
|
+
? !!switchHelperText
|
238
|
+
? switchHelperText
|
239
|
+
: `switch to ${switchInput.inputType}`
|
240
|
+
: !!defaultHelperText
|
241
|
+
? defaultHelperText
|
242
|
+
: `switch to ${defaultInput.inputType}`;
|
243
|
+
|
244
|
+
return html` <nile-tooltip content=${helperText} placement="bottom">
|
245
|
+
<nile-icon
|
246
|
+
size="14"
|
247
|
+
class=${classMap({
|
248
|
+
'pointer-cursor': true,
|
249
|
+
'flex-start': true,
|
250
|
+
})}
|
251
|
+
.name=${icon}
|
252
|
+
color="#005EA6"
|
253
|
+
@click=${this.toggleField}
|
254
|
+
></nile-icon>
|
255
|
+
</nile-tooltip>`;
|
229
256
|
}
|
230
257
|
|
231
258
|
toggleField() {
|
@@ -305,7 +332,7 @@ export class NileSwitcher extends NileElement {
|
|
305
332
|
|
306
333
|
() => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)
|
307
334
|
)}
|
308
|
-
${!disable ? this.renderIcon() : ''}
|
335
|
+
${!disable ? this.renderIcon(defaultInput, switchInput) : ''}
|
309
336
|
`;
|
310
337
|
}
|
311
338
|
public render(): TemplateResult {
|