sas-ui 0.8.125 → 0.8.126

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.
@@ -3107,6 +3107,8 @@ const SasInputTextarea = class {
3107
3107
  constructor(hostRef) {
3108
3108
  index.registerInstance(this, hostRef);
3109
3109
  this.inputTextareaUpdate = index.createEvent(this, "inputTextareaUpdate", 7);
3110
+ this.lineHeight = 24;
3111
+ this.baseScrollHeight = -1;
3110
3112
  /**
3111
3113
  * Placeholder
3112
3114
  */
@@ -3123,37 +3125,43 @@ const SasInputTextarea = class {
3123
3125
  * Value
3124
3126
  */
3125
3127
  this.value = '';
3126
- this.lineHeight = 24;
3127
3128
  }
3128
- componentDidLoad() {
3129
+ watchHandler() {
3129
3130
  const element = this.el.shadowRoot.querySelector('textarea');
3130
- console.log(element.value);
3131
- this.resize(element);
3131
+ element.value = this.value;
3132
+ this.resize();
3133
+ }
3134
+ componentDidLoad() {
3135
+ this.resize();
3132
3136
  }
3133
3137
  handleInput(event) {
3134
- this.resize(event.target);
3138
+ this.resize();
3135
3139
  this.inputTextareaUpdate.emit(event.target.value);
3136
3140
  }
3137
- resize(element) {
3138
- if (!element._baseScrollHeight) {
3139
- this.getBaseScrollHeight(element);
3141
+ resize() {
3142
+ const element = this.el.shadowRoot.querySelector('textarea');
3143
+ if (this.baseScrollHeight === -1) {
3144
+ this.updateBaseScrollHeight(element);
3140
3145
  }
3141
3146
  element.rows = 1;
3142
- const rows = Math.ceil((element.scrollHeight - element._baseScrollHeight) / this.lineHeight) + 1;
3147
+ const rows = Math.ceil((element.scrollHeight - this.baseScrollHeight) / this.lineHeight) + 1;
3148
+ console.log(element.scrollHeight);
3143
3149
  element.rows = rows;
3144
3150
  }
3145
- getBaseScrollHeight(element) {
3146
- console.log(element);
3151
+ updateBaseScrollHeight(element) {
3147
3152
  let temp = element.value;
3148
3153
  element.value = '';
3149
3154
  element.rows = 1;
3150
- element._baseScrollHeight = element.scrollHeight;
3155
+ this.baseScrollHeight = element.scrollHeight;
3151
3156
  element.value = temp;
3152
3157
  }
3153
3158
  render() {
3154
3159
  return (index.h(index.Host, null, index.h("div", { class: "container", "data-count": this.maxlength && this.value ? this.maxlength - this.value.length : '' }, index.h("textarea", { rows: 1, placeholder: this.placeholder, maxlength: this.maxlength, minlength: this.minlength, value: this.value, onInput: (event) => this.handleInput(event) }))));
3155
3160
  }
3156
3161
  get el() { return index.getElement(this); }
3162
+ static get watchers() { return {
3163
+ "value": ["watchHandler"]
3164
+ }; }
3157
3165
  };
3158
3166
  SasInputTextarea.style = sasInputTextareaCss;
3159
3167
 
@@ -1,6 +1,8 @@
1
- import { Component, Host, h, Prop, Event, Element } from '@stencil/core';
1
+ import { Component, Host, h, Prop, Event, Element, Watch } from '@stencil/core';
2
2
  export class SasInputTextarea {
3
3
  constructor() {
4
+ this.lineHeight = 24;
5
+ this.baseScrollHeight = -1;
4
6
  /**
5
7
  * Placeholder
6
8
  */
@@ -17,31 +19,34 @@ export class SasInputTextarea {
17
19
  * Value
18
20
  */
19
21
  this.value = '';
20
- this.lineHeight = 24;
21
22
  }
22
- componentDidLoad() {
23
+ watchHandler() {
23
24
  const element = this.el.shadowRoot.querySelector('textarea');
24
- console.log(element.value);
25
- this.resize(element);
25
+ element.value = this.value;
26
+ this.resize();
27
+ }
28
+ componentDidLoad() {
29
+ this.resize();
26
30
  }
27
31
  handleInput(event) {
28
- this.resize(event.target);
32
+ this.resize();
29
33
  this.inputTextareaUpdate.emit(event.target.value);
30
34
  }
31
- resize(element) {
32
- if (!element._baseScrollHeight) {
33
- this.getBaseScrollHeight(element);
35
+ resize() {
36
+ const element = this.el.shadowRoot.querySelector('textarea');
37
+ if (this.baseScrollHeight === -1) {
38
+ this.updateBaseScrollHeight(element);
34
39
  }
35
40
  element.rows = 1;
36
- const rows = Math.ceil((element.scrollHeight - element._baseScrollHeight) / this.lineHeight) + 1;
41
+ const rows = Math.ceil((element.scrollHeight - this.baseScrollHeight) / this.lineHeight) + 1;
42
+ console.log(element.scrollHeight);
37
43
  element.rows = rows;
38
44
  }
39
- getBaseScrollHeight(element) {
40
- console.log(element);
45
+ updateBaseScrollHeight(element) {
41
46
  let temp = element.value;
42
47
  element.value = '';
43
48
  element.rows = 1;
44
- element._baseScrollHeight = element.scrollHeight;
49
+ this.baseScrollHeight = element.scrollHeight;
45
50
  element.value = temp;
46
51
  }
47
52
  render() {
@@ -148,4 +153,8 @@ export class SasInputTextarea {
148
153
  }
149
154
  }]; }
150
155
  static get elementRef() { return "el"; }
156
+ static get watchers() { return [{
157
+ "propName": "value",
158
+ "methodName": "watchHandler"
159
+ }]; }
151
160
  }
@@ -9352,6 +9352,8 @@ const SasInputTextarea$1 = class extends HTMLElement {
9352
9352
  this.__registerHost();
9353
9353
  attachShadow(this);
9354
9354
  this.inputTextareaUpdate = createEvent(this, "inputTextareaUpdate", 7);
9355
+ this.lineHeight = 24;
9356
+ this.baseScrollHeight = -1;
9355
9357
  /**
9356
9358
  * Placeholder
9357
9359
  */
@@ -9368,37 +9370,43 @@ const SasInputTextarea$1 = class extends HTMLElement {
9368
9370
  * Value
9369
9371
  */
9370
9372
  this.value = '';
9371
- this.lineHeight = 24;
9372
9373
  }
9373
- componentDidLoad() {
9374
+ watchHandler() {
9374
9375
  const element = this.el.shadowRoot.querySelector('textarea');
9375
- console.log(element.value);
9376
- this.resize(element);
9376
+ element.value = this.value;
9377
+ this.resize();
9378
+ }
9379
+ componentDidLoad() {
9380
+ this.resize();
9377
9381
  }
9378
9382
  handleInput(event) {
9379
- this.resize(event.target);
9383
+ this.resize();
9380
9384
  this.inputTextareaUpdate.emit(event.target.value);
9381
9385
  }
9382
- resize(element) {
9383
- if (!element._baseScrollHeight) {
9384
- this.getBaseScrollHeight(element);
9386
+ resize() {
9387
+ const element = this.el.shadowRoot.querySelector('textarea');
9388
+ if (this.baseScrollHeight === -1) {
9389
+ this.updateBaseScrollHeight(element);
9385
9390
  }
9386
9391
  element.rows = 1;
9387
- const rows = Math.ceil((element.scrollHeight - element._baseScrollHeight) / this.lineHeight) + 1;
9392
+ const rows = Math.ceil((element.scrollHeight - this.baseScrollHeight) / this.lineHeight) + 1;
9393
+ console.log(element.scrollHeight);
9388
9394
  element.rows = rows;
9389
9395
  }
9390
- getBaseScrollHeight(element) {
9391
- console.log(element);
9396
+ updateBaseScrollHeight(element) {
9392
9397
  let temp = element.value;
9393
9398
  element.value = '';
9394
9399
  element.rows = 1;
9395
- element._baseScrollHeight = element.scrollHeight;
9400
+ this.baseScrollHeight = element.scrollHeight;
9396
9401
  element.value = temp;
9397
9402
  }
9398
9403
  render() {
9399
9404
  return (h(Host, null, h("div", { class: "container", "data-count": this.maxlength && this.value ? this.maxlength - this.value.length : '' }, h("textarea", { rows: 1, placeholder: this.placeholder, maxlength: this.maxlength, minlength: this.minlength, value: this.value, onInput: (event) => this.handleInput(event) }))));
9400
9405
  }
9401
9406
  get el() { return this; }
9407
+ static get watchers() { return {
9408
+ "value": ["watchHandler"]
9409
+ }; }
9402
9410
  static get style() { return sasInputTextareaCss; }
9403
9411
  };
9404
9412
 
@@ -3103,6 +3103,8 @@ const SasInputTextarea = class {
3103
3103
  constructor(hostRef) {
3104
3104
  registerInstance(this, hostRef);
3105
3105
  this.inputTextareaUpdate = createEvent(this, "inputTextareaUpdate", 7);
3106
+ this.lineHeight = 24;
3107
+ this.baseScrollHeight = -1;
3106
3108
  /**
3107
3109
  * Placeholder
3108
3110
  */
@@ -3119,37 +3121,43 @@ const SasInputTextarea = class {
3119
3121
  * Value
3120
3122
  */
3121
3123
  this.value = '';
3122
- this.lineHeight = 24;
3123
3124
  }
3124
- componentDidLoad() {
3125
+ watchHandler() {
3125
3126
  const element = this.el.shadowRoot.querySelector('textarea');
3126
- console.log(element.value);
3127
- this.resize(element);
3127
+ element.value = this.value;
3128
+ this.resize();
3129
+ }
3130
+ componentDidLoad() {
3131
+ this.resize();
3128
3132
  }
3129
3133
  handleInput(event) {
3130
- this.resize(event.target);
3134
+ this.resize();
3131
3135
  this.inputTextareaUpdate.emit(event.target.value);
3132
3136
  }
3133
- resize(element) {
3134
- if (!element._baseScrollHeight) {
3135
- this.getBaseScrollHeight(element);
3137
+ resize() {
3138
+ const element = this.el.shadowRoot.querySelector('textarea');
3139
+ if (this.baseScrollHeight === -1) {
3140
+ this.updateBaseScrollHeight(element);
3136
3141
  }
3137
3142
  element.rows = 1;
3138
- const rows = Math.ceil((element.scrollHeight - element._baseScrollHeight) / this.lineHeight) + 1;
3143
+ const rows = Math.ceil((element.scrollHeight - this.baseScrollHeight) / this.lineHeight) + 1;
3144
+ console.log(element.scrollHeight);
3139
3145
  element.rows = rows;
3140
3146
  }
3141
- getBaseScrollHeight(element) {
3142
- console.log(element);
3147
+ updateBaseScrollHeight(element) {
3143
3148
  let temp = element.value;
3144
3149
  element.value = '';
3145
3150
  element.rows = 1;
3146
- element._baseScrollHeight = element.scrollHeight;
3151
+ this.baseScrollHeight = element.scrollHeight;
3147
3152
  element.value = temp;
3148
3153
  }
3149
3154
  render() {
3150
3155
  return (h(Host, null, h("div", { class: "container", "data-count": this.maxlength && this.value ? this.maxlength - this.value.length : '' }, h("textarea", { rows: 1, placeholder: this.placeholder, maxlength: this.maxlength, minlength: this.minlength, value: this.value, onInput: (event) => this.handleInput(event) }))));
3151
3156
  }
3152
3157
  get el() { return getElement(this); }
3158
+ static get watchers() { return {
3159
+ "value": ["watchHandler"]
3160
+ }; }
3153
3161
  };
3154
3162
  SasInputTextarea.style = sasInputTextareaCss;
3155
3163