@aquera/nile-elements 0.0.51 → 0.0.52
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/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +75 -53
- 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.css.cjs.js +1 -1
- package/dist/nile-input/nile-input.css.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.css.esm.js +22 -6
- package/dist/nile-input/nile-input.esm.js +9 -3
- package/dist/src/nile-input/nile-input.css.js +22 -6
- package/dist/src/nile-input/nile-input.css.js.map +1 -1
- package/dist/src/nile-input/nile-input.d.ts +2 -1
- package/dist/src/nile-input/nile-input.js +20 -6
- package/dist/src/nile-input/nile-input.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-input/nile-input.css.ts +22 -6
- package/src/nile-input/nile-input.ts +23 -9
package/package.json
CHANGED
@@ -477,19 +477,35 @@ export const styles = css`
|
|
477
477
|
}
|
478
478
|
|
479
479
|
.input__non-printable {
|
480
|
-
width: 280px;
|
481
|
-
height: 12px;
|
482
480
|
border-radius: 4px;
|
483
|
-
|
484
|
-
|
485
|
-
|
481
|
+
max-width: 400px;
|
482
|
+
background-color: var(--nile-colors-white-base);
|
483
|
+
border: 1px solid var(--nile-colors-red-500);
|
484
|
+
color: var(--nile-colors-red-500);
|
486
485
|
padding: 10px;
|
487
486
|
font-size: 12px;
|
487
|
+
max-height: 300px;
|
488
|
+
overflow-y: scroll;
|
488
489
|
}
|
489
490
|
|
490
491
|
.input__remove-non-printable {
|
491
|
-
color:
|
492
|
+
color: var(--nile-colors-red-500);
|
492
493
|
margin-left: 10px;
|
494
|
+
font-size: 14px;
|
495
|
+
color: var(--nile-colors-dark-900);
|
496
|
+
}
|
497
|
+
|
498
|
+
.input__srtiked-text-container {
|
499
|
+
margin-top: 4px;
|
500
|
+
color: var(--nile-colors-dark-900);
|
501
|
+
word-wrap: break-all;
|
502
|
+
}
|
503
|
+
|
504
|
+
.input__srtiked-text {
|
505
|
+
text-decoration: line-through;
|
506
|
+
text-decoration-color: var(--nile-colors-white-base);
|
507
|
+
color: var(--nile-colors-white-base);
|
508
|
+
background-color: var(--nile-colors-red-500);
|
493
509
|
}
|
494
510
|
`;
|
495
511
|
|
@@ -25,6 +25,7 @@ import { live } from 'lit/directives/live.js';
|
|
25
25
|
import { watch } from '../internal/watch';
|
26
26
|
import type { CSSResultGroup } from 'lit';
|
27
27
|
import NileElement, { NileFormControl } from '../internal/nile-element';
|
28
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
28
29
|
|
29
30
|
/**
|
30
31
|
* Nile icon component.
|
@@ -227,6 +228,8 @@ export class NileInput extends NileElement implements NileFormControl {
|
|
227
228
|
|
228
229
|
@state() hasPrintableCharacters: boolean = false;
|
229
230
|
|
231
|
+
@state() markedValue: string;
|
232
|
+
|
230
233
|
connectedCallback() {
|
231
234
|
super.connectedCallback();
|
232
235
|
this.emit('nile-init');
|
@@ -360,29 +363,32 @@ export class NileInput extends NileElement implements NileFormControl {
|
|
360
363
|
await this.updateComplete;
|
361
364
|
|
362
365
|
if(this.checkNonPrintableChar){
|
363
|
-
this.
|
366
|
+
this.markNonPrintableCharacters();
|
364
367
|
}
|
365
368
|
}
|
366
369
|
|
367
|
-
|
368
370
|
/** checks non printable characters in the value. */
|
369
|
-
|
371
|
+
markNonPrintableCharacters() {
|
372
|
+
let markedValue = '';
|
370
373
|
this.hasPrintableCharacters = false;
|
371
|
-
|
372
374
|
if (this.value) {
|
373
375
|
for (let i = 0, n = this.value.length; i < n; i++) {
|
374
376
|
const charCode = this.value.charCodeAt(i);
|
375
377
|
|
376
|
-
// Check if the character is non-printable
|
377
378
|
if ((charCode > 255 && charCode !== 9109) || [129, 143, 144, 157, 160].includes(charCode)) {
|
379
|
+
markedValue += `<span class="input__srtiked-text">${this.value.charAt(i)}</span>`;
|
378
380
|
this.hasPrintableCharacters = true;
|
379
|
-
|
380
|
-
|
381
|
+
} else {
|
382
|
+
markedValue += this.value.charAt(i);
|
381
383
|
}
|
382
384
|
}
|
383
385
|
}
|
386
|
+
|
387
|
+
this.markedValue = markedValue;
|
388
|
+
this.emit('nile-value-marked', { value: this.markedValue, hasNonPrintableCharacters: this.hasPrintableCharacters });
|
384
389
|
}
|
385
390
|
|
391
|
+
|
386
392
|
/** Removes all non printable characters from the value. */
|
387
393
|
removeAllNonPrintableCharacters() {
|
388
394
|
let cleanedValue = '';
|
@@ -657,9 +663,17 @@ export class NileInput extends NileElement implements NileFormControl {
|
|
657
663
|
</div>
|
658
664
|
|
659
665
|
<div class="input__non-printable">
|
660
|
-
Non-printable character detected
|
666
|
+
Non-printable character detected.
|
667
|
+
<nile-badge variant="error" @click=${
|
661
668
|
this.removeAllNonPrintableCharacters
|
662
|
-
}>
|
669
|
+
} class="input__remove-non-printable" >
|
670
|
+
Remove All
|
671
|
+
</nile-badge>
|
672
|
+
|
673
|
+
<div class="input__srtiked-text-container"> ${unsafeHTML(
|
674
|
+
this.markedValue
|
675
|
+
)} </div>
|
676
|
+
|
663
677
|
</div>
|
664
678
|
</nile-popup>
|
665
679
|
</div>
|