@brandup/ui-textbox 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -11,25 +11,25 @@
11
11
  "name": "Dmitry Kovyazin",
12
12
  "email": "it@brandup.online"
13
13
  },
14
- "homepage": "https://github.com/brandup-online/brandup-ui/npm/brandup-ui-textbox",
14
+ "homepage": "https://github.com/brandup-online/brandup-ui-kit/npm/brandup-ui-textbox",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/brandup-online/brandup-ui.git"
17
+ "url": "https://github.com/brandup-online/brandup-ui-kit.git"
18
18
  },
19
19
  "bugs": {
20
- "url": "https://github.com/brandup-online/brandup-ui/issues",
20
+ "url": "https://github.com/brandup-online/brandup-ui-kit/issues",
21
21
  "email": "it@brandup.online"
22
22
  },
23
23
  "license": "Apache-2.0",
24
- "version": "1.0.25",
24
+ "version": "1.0.26",
25
25
  "main": "source/index.ts",
26
26
  "types": "source/index.ts",
27
27
  "dependencies": {
28
- "@brandup/ui": "^1.0.41",
29
- "@brandup/ui-dom": "^1.0.41",
30
- "@brandup/ui-helpers": "^1.0.41",
31
- "@brandup/ui-input": "^1.0.25",
32
- "@brandup/ui-kit": "^1.0.25"
28
+ "@brandup/ui": "^1.0.44",
29
+ "@brandup/ui-dom": "^1.0.44",
30
+ "@brandup/ui-helpers": "^1.0.44",
31
+ "@brandup/ui-input": "^1.0.26",
32
+ "@brandup/ui-kit": "^1.0.26"
33
33
  },
34
34
  "files": [
35
35
  "source",
package/source/textbox.ts CHANGED
@@ -200,7 +200,7 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
200
200
  if (this.type == "number") {
201
201
  const numberData = /[\d\s]+/.exec(pastedData);
202
202
  if (numberData && numberData.length)
203
- pastedData = numberData[0].replace(' ', '');
203
+ pastedData = numberData[0].replace(/\s/g, '');
204
204
  else {
205
205
  this.element.classList.add("incorrect");
206
206
  window.setTimeout(() => this.element?.classList.remove("incorrect"), 300);
@@ -347,24 +347,24 @@ export default class TextBox extends InputControl<HTMLInputElement | HTMLTextAre
347
347
  }
348
348
 
349
349
  private __initText() {
350
- var html = "";
350
+ DOM.empty(this.__inputElem);
351
351
 
352
352
  const text = this.__valueElem.value;
353
353
  if (text) {
354
354
  const lines = text.split(/\n/);
355
- const output = lines.map((line, index) => {
355
+ lines.forEach((line, index) => {
356
356
  line = line.trim();
357
357
 
358
- if (index > 0) line = `<div>${line}</div>`;
359
-
360
- return line;
358
+ if (index === 0)
359
+ this.__inputElem.append(document.createTextNode(line));
360
+ else {
361
+ const lineElem = document.createElement("div");
362
+ lineElem.textContent = line;
363
+ this.__inputElem.append(lineElem);
364
+ }
361
365
  });
362
-
363
- html = output.join("");
364
366
  }
365
367
 
366
- this.__inputElem.innerHTML = html;
367
-
368
368
  this.__refreshSymbolsCount();
369
369
 
370
370
  if (this.autoFocus && !IS_TOUCH_DEVICE && !this.disabled && !this.readonly)
@@ -0,0 +1 @@
1
+ declare module "*.less";