@sankhyalabs/core 5.20.0-dev.14 → 5.20.0-dev.17

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.
@@ -2,14 +2,19 @@ import { OverflowDirection } from "./types/overflow-direction.js";
2
2
  import { OnOverflowCallBack } from "./types/overflow-callback.js";
3
3
  export * from "./types/overflow-direction.js";
4
4
  export * from "./types/overflow-callback.js";
5
+ export declare const OVERFLOWED_CLASS_NAME = "overflowed";
5
6
  export default class OverflowWatcher {
6
7
  private _onResize;
7
8
  private _resizeObserver;
8
- private _lastContentRect;
9
+ private _lastContainerSize;
10
+ private _lastContainerInstance;
9
11
  private _scrollDirection;
10
12
  private _propSize;
11
- private _hiddenItems;
13
+ private _hiddenItemsProps;
14
+ private _notOverFlowPros;
12
15
  private _deltaSize;
16
+ private _notOverFlow;
17
+ readonly DATA_ELEMENT_ID = "data-element-id";
13
18
  /**
14
19
  * Cria uma instancia do OverflowWatcher
15
20
  *
@@ -17,15 +22,38 @@ export default class OverflowWatcher {
17
22
  * @param callback - Função que sera chamada quando ocorrer overflow no elemento.
18
23
  * @param overFlowDirection - Indica direção que o overflow será monitorado.
19
24
  * @param deltaSize - Variação de tamanho que será considerada como overflow.
25
+ * @param debounce - Tempo até execução do callback em milissegundos.
26
+ * @param notOverFlow - Lista de ids ou data-element-ids dos elementos que não devem sofrer overFlow.
20
27
  */
21
- constructor(element: HTMLElement, callback: OnOverflowCallBack, overFlowDirection?: OverflowDirection, deltaSize?: number);
28
+ constructor({ element, callback, overFlowDirection, debounce, deltaSize, notOverFlow }: OverFlowWatcherParams);
29
+ addNotOverFlowElement(elementId: string): void;
22
30
  destroy(): void;
31
+ forceUpdate(): void;
23
32
  private handleResize;
24
- private isChangedSize;
25
- private getPropSizeByDirection;
33
+ private updateOverFlowedItems;
34
+ private registerNotOverflowProps;
35
+ private canNotRegisterNotOverFlow;
36
+ private hasChangedSize;
26
37
  private proccessElements;
27
- private proccessElementsWithoutOverFlow;
38
+ private clearOverFlow;
28
39
  private proccessElementsOverFlow;
40
+ private isElementOverFlowing;
41
+ private canOverFlowElement;
42
+ private getDataElementId;
43
+ private exceedsAvaliableSize;
44
+ private calculateVariation;
45
+ private canNotOverFlowNotIncludedIds;
46
+ private registerElementSize;
47
+ private getElementSizeProps;
29
48
  private calcChildrenSize;
30
- private calcMarginSize;
49
+ private calcElementSize;
50
+ private isOverFlowed;
51
+ }
52
+ export interface OverFlowWatcherParams {
53
+ element: HTMLElement;
54
+ callback: OnOverflowCallBack;
55
+ overFlowDirection?: OverflowDirection;
56
+ deltaSize?: number;
57
+ debounce?: number;
58
+ notOverFlow?: string[];
31
59
  }
@@ -1,7 +1,9 @@
1
1
  import { JSUtils } from "../JSUtils.js";
2
2
  import { OverflowDirection } from "./types/overflow-direction.js";
3
+ import { calcMarginSize } from '../ElementUtils.js';
3
4
  export * from "./types/overflow-direction.js";
4
5
  export * from "./types/overflow-callback.js";
6
+ export const OVERFLOWED_CLASS_NAME = 'overflowed';
5
7
  export default class OverflowWatcher {
6
8
  /**
7
9
  * Cria uma instancia do OverflowWatcher
@@ -10,98 +12,177 @@ export default class OverflowWatcher {
10
12
  * @param callback - Função que sera chamada quando ocorrer overflow no elemento.
11
13
  * @param overFlowDirection - Indica direção que o overflow será monitorado.
12
14
  * @param deltaSize - Variação de tamanho que será considerada como overflow.
15
+ * @param debounce - Tempo até execução do callback em milissegundos.
16
+ * @param notOverFlow - Lista de ids ou data-element-ids dos elementos que não devem sofrer overFlow.
13
17
  */
14
- constructor(element, callback, overFlowDirection = OverflowDirection.HORIZONTAL, deltaSize = 10) {
15
- this._lastContentRect = undefined;
18
+ constructor({ element, callback, overFlowDirection = OverflowDirection.HORIZONTAL, debounce = 200, deltaSize = 0, notOverFlow = [] }) {
19
+ this._lastContainerSize = undefined;
20
+ this._lastContainerInstance = undefined;
16
21
  this._scrollDirection = OverflowDirection.HORIZONTAL;
17
- this._hiddenItems = [];
22
+ this._hiddenItemsProps = new Map();
23
+ this._notOverFlowPros = new Map();
24
+ this._notOverFlow = [];
25
+ this.DATA_ELEMENT_ID = 'data-element-id';
18
26
  this._onResize = callback;
19
27
  this._scrollDirection = overFlowDirection;
20
- this._resizeObserver = new ResizeObserver(JSUtils.debounce((entries) => this.handleResize(entries), 200));
28
+ this._propSize = (OverflowDirection.HORIZONTAL === overFlowDirection) ? "width" : "height";
29
+ this._resizeObserver = new ResizeObserver(JSUtils.debounce((entries) => this.handleResize(entries), debounce));
21
30
  this._resizeObserver.observe(element);
22
- this._propSize = this.getPropSizeByDirection();
23
31
  this._deltaSize = deltaSize;
32
+ this._notOverFlow = notOverFlow;
33
+ }
34
+ addNotOverFlowElement(elementId) {
35
+ if (!this._notOverFlow.includes(elementId)) {
36
+ this._notOverFlow.push(elementId);
37
+ }
24
38
  }
25
39
  destroy() {
26
40
  this._resizeObserver.disconnect();
27
41
  }
42
+ forceUpdate() {
43
+ if (this._lastContainerSize && this._lastContainerInstance) {
44
+ this.updateOverFlowedItems(this._lastContainerInstance, this._lastContainerSize);
45
+ }
46
+ }
28
47
  handleResize(entries) {
29
- if (!entries || entries.length === 0) {
48
+ if (!entries || entries.length === 0)
30
49
  return;
31
- }
32
- const resizeItem = entries[0];
33
- const contentRect = resizeItem.contentRect;
34
- if (this.isChangedSize(contentRect)) {
35
- const children = Array.from(resizeItem.target.children);
36
- this.proccessElements(contentRect[this._propSize], children);
37
- this._lastContentRect = contentRect;
50
+ const container = entries[0];
51
+ const containerSize = container.contentRect[this._propSize];
52
+ if (!containerSize)
53
+ return;
54
+ if (this.hasChangedSize(containerSize)) {
55
+ this.updateOverFlowedItems(container.target, containerSize);
38
56
  }
39
57
  }
40
- isChangedSize(newContentRect) {
41
- if (this._lastContentRect == undefined) {
42
- return true;
43
- }
44
- return Math.abs(newContentRect[this._propSize] - this._lastContentRect[this._propSize]) >= this._deltaSize;
58
+ updateOverFlowedItems(container, containerSize) {
59
+ const children = Array.from(container.children);
60
+ this.registerNotOverflowProps(children);
61
+ this.proccessElements(containerSize, children);
62
+ this._lastContainerSize = containerSize;
63
+ this._lastContainerInstance = container;
45
64
  }
46
- getPropSizeByDirection() {
47
- if (OverflowDirection.HORIZONTAL === this._scrollDirection) {
48
- return "width";
65
+ registerNotOverflowProps(children) {
66
+ children.forEach(childElement => {
67
+ const id = childElement.id || this.getDataElementId(childElement);
68
+ if (this.canNotRegisterNotOverFlow(id))
69
+ return;
70
+ this._notOverFlowPros.set(id, this.getElementSizeProps(childElement));
71
+ });
72
+ }
73
+ canNotRegisterNotOverFlow(id) {
74
+ return !id || !this._notOverFlow.includes(id) || this._notOverFlowPros.has(id);
75
+ }
76
+ hasChangedSize(elementSize) {
77
+ if (!this._lastContainerSize)
78
+ return true;
79
+ const variation = elementSize - this._lastContainerSize;
80
+ if (variation < 0) {
81
+ const absoluteVariation = Math.abs(variation);
82
+ return (absoluteVariation > this._deltaSize);
49
83
  }
50
- return "height";
84
+ return variation > 0;
51
85
  }
52
86
  proccessElements(elementSize, children) {
53
- if (children.length === 0) {
87
+ if (children.length === 0)
54
88
  return;
55
- }
56
89
  const childrenSize = this.calcChildrenSize(children);
57
90
  let diff = Number((elementSize - childrenSize).toFixed(4));
58
91
  if (diff > 0) {
59
- this.proccessElementsWithoutOverFlow(diff);
92
+ this.clearOverFlow();
60
93
  return;
61
94
  }
62
- this.proccessElementsOverFlow(children, diff);
95
+ this.proccessElementsOverFlow(children, elementSize);
96
+ }
97
+ clearOverFlow() {
98
+ this._hiddenItemsProps = new Map();
99
+ this._onResize([]);
63
100
  }
64
- proccessElementsWithoutOverFlow(diff) {
65
- this._hiddenItems.forEach((item) => {
66
- if (item.getBoundingClientRect().width < diff) {
67
- this._hiddenItems.pop();
101
+ proccessElementsOverFlow(allElements, avaliableSize) {
102
+ const elementsThatFit = [];
103
+ const avaliableSizeConsideringDelta = (avaliableSize - this._deltaSize);
104
+ let sumElementsSize = 0;
105
+ for (const element of allElements) {
106
+ sumElementsSize += this.calcElementSize(element);
107
+ if (this.exceedsAvaliableSize(sumElementsSize, elementsThatFit, avaliableSizeConsideringDelta))
108
+ break;
109
+ elementsThatFit.push(element);
110
+ }
111
+ const overFlowedElements = allElements.filter(element => this.isElementOverFlowing(elementsThatFit, element));
112
+ overFlowedElements.forEach(overFlowed => {
113
+ if (!this._hiddenItemsProps.has(overFlowed)) {
114
+ this.registerElementSize(overFlowed);
68
115
  }
69
116
  });
70
- this._onResize(this._hiddenItems);
71
- }
72
- proccessElementsOverFlow(children, diff) {
73
- const elementsOverflow = [];
74
- let sumRemovedItems = 0;
75
- while (elementsOverflow.length < children.length && sumRemovedItems < (diff * -1)) {
76
- const itemToRemove = children.pop();
77
- if (itemToRemove != undefined && itemToRemove.style.display === 'none') {
78
- continue;
79
- }
80
- if (itemToRemove != undefined) {
81
- elementsOverflow.push(itemToRemove);
82
- sumRemovedItems += itemToRemove.getBoundingClientRect()[this._propSize];
83
- }
84
- }
85
- this._hiddenItems = elementsOverflow;
86
- this._onResize(elementsOverflow);
117
+ this._onResize(overFlowedElements);
118
+ }
119
+ isElementOverFlowing(elementsThatFit, element) {
120
+ return !elementsThatFit.includes(element) && this.canOverFlowElement(element);
121
+ }
122
+ canOverFlowElement(element) {
123
+ return !this._notOverFlow.includes(element.id)
124
+ && !this._notOverFlow.includes(this.getDataElementId(element));
125
+ }
126
+ getDataElementId(element) {
127
+ var _a;
128
+ return (_a = element.getAttribute('data-element-id')) !== null && _a !== void 0 ? _a : "";
129
+ }
130
+ exceedsAvaliableSize(sumElementsSize, elements, avaliableSize) {
131
+ if (!this._notOverFlow.length)
132
+ return sumElementsSize > avaliableSize;
133
+ const elementIdsToCalculate = this.canNotOverFlowNotIncludedIds(elements);
134
+ if (!elementIdsToCalculate.length)
135
+ return sumElementsSize > avaliableSize;
136
+ const variation = this.calculateVariation(elementIdsToCalculate);
137
+ const occupiedSize = sumElementsSize + variation;
138
+ return occupiedSize > avaliableSize;
139
+ }
140
+ calculateVariation(elementIdsToCalculate) {
141
+ let variation = 0;
142
+ elementIdsToCalculate.forEach(id => {
143
+ var _a, _b;
144
+ const sizeProps = this._notOverFlowPros.get(id);
145
+ variation += (_a = sizeProps === null || sizeProps === void 0 ? void 0 : sizeProps.size) !== null && _a !== void 0 ? _a : 0;
146
+ variation += (_b = sizeProps === null || sizeProps === void 0 ? void 0 : sizeProps.margin) !== null && _b !== void 0 ? _b : 0;
147
+ });
148
+ return variation;
149
+ }
150
+ canNotOverFlowNotIncludedIds(elements) {
151
+ const elementsIdList = elements.map(el => el.id || this.getDataElementId(el)).filter(id => !!id);
152
+ return this._notOverFlow.filter(id => !elementsIdList.includes(id));
153
+ }
154
+ registerElementSize(element) {
155
+ const sizeProps = this.getElementSizeProps(element);
156
+ this._hiddenItemsProps.set(element, sizeProps);
157
+ }
158
+ getElementSizeProps(element) {
159
+ const sizeProps = {
160
+ size: element.getBoundingClientRect()[this._propSize],
161
+ margin: calcMarginSize(element, this._scrollDirection),
162
+ };
163
+ return sizeProps;
87
164
  }
88
165
  calcChildrenSize(children) {
89
166
  let sumChildren = 0;
90
- Array.from(children).forEach(el => {
91
- sumChildren += el.getBoundingClientRect()[this._propSize];
92
- sumChildren += this.calcMarginSize(el);
93
- });
94
- if (sumChildren > 0) {
95
- sumChildren += this._deltaSize;
96
- }
167
+ sumChildren += this._deltaSize;
168
+ Array.from(children).forEach(el => sumChildren += this.calcElementSize(el));
97
169
  return sumChildren;
98
170
  }
99
- calcMarginSize(el) {
100
- const computedStyle = getComputedStyle(el);
101
- if (OverflowDirection.HORIZONTAL === this._scrollDirection) {
102
- return (parseInt(computedStyle.marginLeft || '0') + parseInt(computedStyle.marginRight || '0'));
171
+ calcElementSize(el) {
172
+ var _a, _b;
173
+ let size = 0;
174
+ if (this.isOverFlowed(el)) {
175
+ const sizeProps = this._hiddenItemsProps.get(el);
176
+ size += (_a = sizeProps === null || sizeProps === void 0 ? void 0 : sizeProps.size) !== null && _a !== void 0 ? _a : 0;
177
+ size += (_b = sizeProps === null || sizeProps === void 0 ? void 0 : sizeProps.margin) !== null && _b !== void 0 ? _b : 0;
178
+ return size;
103
179
  }
104
- return (parseInt(computedStyle.marginTop || '0') + parseInt(computedStyle.marginBottom || '0'));
180
+ size += el.getBoundingClientRect()[this._propSize];
181
+ size += calcMarginSize(el, this._scrollDirection);
182
+ return size;
183
+ }
184
+ isOverFlowed(el) {
185
+ return el.classList.contains(OVERFLOWED_CLASS_NAME);
105
186
  }
106
187
  }
107
188
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/OverflowWatcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,eAAe;IAShC;;;;;;;OAOG;IACH,YAAY,OAAmB,EACnB,QAA2B,EAC3B,oBAAsC,iBAAiB,CAAC,UAAU,EAClE,YAAmB,EAAE;QAjBzB,qBAAgB,GAA6B,SAAS,CAAC;QACvD,qBAAgB,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAEhD,iBAAY,GAAa,EAAE,CAAC;QAehC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAA8B,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACjI,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,SAAS,C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SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,mCAAI,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAK,EAAE,CAAC,qBAAqB,EAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,IAAI,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,YAAY,CAAC,EAAW;QAC5B,OAAO,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACxD,CAAC;CACJ"}
package/jest.config.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  module.exports = {
2
+ preset: 'ts-jest',
3
+ setupFiles: ['./setupTests.js'],
2
4
  transform: {'^.+\\.ts?$': 'ts-jest'},
3
5
  testEnvironment: 'jsdom',
4
6
  testRegex: '\\.(test|spec)?\\.(ts|tsx)$',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/core",
3
- "version": "5.20.0-dev.14",
3
+ "version": "5.20.0-dev.17",
4
4
  "description": "Modulo core JavaScript da Sankhya.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -43,8 +43,9 @@
43
43
  "eslint-plugin-import": "^2.26.0",
44
44
  "husky": "^8.0.3",
45
45
  "jest": "^29.4.1",
46
- "jest-sonar-reporter": "^2.0.0",
47
46
  "jest-environment-jsdom": "^29.4.1",
47
+ "jest-sonar-reporter": "^2.0.0",
48
+ "resize-observer-polyfill": "^1.5.1",
48
49
  "ts-jest": "^29.0.5",
49
50
  "ts-node": "^10.9.1",
50
51
  "typedoc": "^0.25.13",
@@ -1,78 +1,43 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <unitTest version="1">
3
- <file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
4
- <testCase name="HttpProvider Metodo POST" duration="65"/>
5
- </file>
6
- <file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
7
- <testCase name="HttpProvider Metodo GET" duration="209"/>
8
- </file>
9
- <file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
10
- <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the constructor" duration="7"/>
11
- <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the setters methods" duration="1"/>
12
- <testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
13
- </file>
14
3
  <file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaModel.spec.ts">
15
- <testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="87"/>
4
+ <testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="99"/>
16
5
  <testCase name="StringUtils it should modify &quot;expressions&quot; and &quot;parameters&quot; properties through Setters methods" duration="1"/>
17
- <testCase name="StringUtils it should return &quot;expression&quot; and &quot;parameters&quot; setted through constructor method" duration="0"/>
6
+ <testCase name="StringUtils it should return &quot;expression&quot; and &quot;parameters&quot; setted through constructor method" duration="1"/>
18
7
  <testCase name="StringUtils it should return a Criteria class with &quot;expression&quot; and &quot;parameters&quot; as needed setted through &quot;append&quot; method" duration="1"/>
19
- <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;append&quot; method" duration="1"/>
20
- <testCase name="StringUtils it should return undefined as &quot;expression&quot; and &quot;[]&quot; as parameters as we use an empty criteria as first entry in the constructor" duration="0"/>
21
- <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="5"/>
8
+ <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;append&quot; method" duration="5"/>
9
+ <testCase name="StringUtils it should return undefined as &quot;expression&quot; and &quot;[]&quot; as parameters as we use an empty criteria as first entry in the constructor" duration="1"/>
10
+ <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
22
11
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
23
12
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;OR&quot; method" duration="1"/>
24
- <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="4"/>
13
+ <testCase name="StringUtils it should return a Criteria class with &quot;Expression&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="3"/>
25
14
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
26
15
  <testCase name="StringUtils it should return a Criteria class with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
27
16
  <testCase name="StringUtils it should return a toJSON object with &quot;Criteria class&quot; and &quot;parameters&quot; concatenaded as needed setted through &quot;AND&quot; method" duration="1"/>
28
- <testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="87"/>
29
- </file>
30
- <file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
31
- <testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="7"/>
32
- <testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="73"/>
33
- <testCase name="TimeFormatter Case: validateTime" duration="1"/>
17
+ <testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="0"/>
34
18
  </file>
35
- <file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
36
- <testCase name="OverflowWatcher constructor initializes properties correctly" duration="16"/>
37
- <testCase name="OverflowWatcher handleResize horizontal calls callback with hidden items" duration="290"/>
38
- <testCase name="OverflowWatcher handleResize vertical calls callback with hidden items" duration="8"/>
39
- <testCase name="OverflowWatcher isChangedSize returns true if no previous size" duration="2"/>
40
- <testCase name="OverflowWatcher prevent resize without entries" duration="2"/>
41
- </file>
42
- <file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
43
- <testCase name="StringUtils valor vazio" duration="6"/>
44
- <testCase name="StringUtils valor em branco" duration="72"/>
45
- <testCase name="StringUtils valor null" duration="0"/>
46
- <testCase name="StringUtils valor undefined" duration="1"/>
47
- <testCase name="StringUtils valor 0" duration="1"/>
48
- <testCase name="StringUtils com valor" duration="1"/>
49
- <testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="1"/>
50
- <testCase name="StringUtils should return the original value when called with an object without a toString method" duration="3"/>
51
- <testCase name="StringUtils should return the original value when called with undefined" duration="0"/>
19
+ <file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
20
+ <testCase name="HttpProvider Metodo GET" duration="0"/>
52
21
  </file>
53
- <file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
54
- <testCase name="StringUtils stringToNumber" duration="15"/>
55
- <testCase name="StringUtils format" duration="95"/>
56
- <testCase name="StringUtils format without formatnumber parameter" duration="1"/>
57
- <testCase name="StringUtils format without formatnumber parameter" duration="1"/>
58
- <testCase name="StringUtils format round number" duration="2"/>
22
+ <file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
23
+ <testCase name="HttpProvider Metodo POST" duration="1"/>
59
24
  </file>
60
25
  <file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
61
- <testCase name="Mask Formatter mask:CPF complete valid" duration="6"/>
26
+ <testCase name="Mask Formatter mask:CPF complete valid" duration="11"/>
62
27
  <testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
63
- <testCase name="Mask Formatter mask:CPF incomplete valid" duration="0"/>
64
- <testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="70"/>
65
- <testCase name="Mask Formatter mask:CPF too long valid" duration="1"/>
66
- <testCase name="Mask Formatter mask:CPF invalid for string" duration="23"/>
67
- <testCase name="Mask Formatter mask:CPF invalid for being too long" duration="0"/>
68
- <testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
69
- <testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="0"/>
28
+ <testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
29
+ <testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
30
+ <testCase name="Mask Formatter mask:CPF too long valid" duration="0"/>
31
+ <testCase name="Mask Formatter mask:CPF invalid for string" duration="183"/>
32
+ <testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
33
+ <testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="0"/>
34
+ <testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
70
35
  <testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
71
36
  <testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="1"/>
72
37
  <testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="0"/>
73
- <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
74
- <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
75
- <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
38
+ <testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
39
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
40
+ <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
76
41
  <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
77
42
  <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
78
43
  <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
@@ -81,36 +46,80 @@
81
46
  <testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
82
47
  <testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
83
48
  </file>
49
+ <file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
50
+ <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the constructor" duration="12"/>
51
+ <testCase name="StringUtils it should return the correct values of &quot;value&quot; and &quot;type&quot; through the getters methods initial setted by the setters methods" duration="1"/>
52
+ <testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
53
+ </file>
54
+ <file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
55
+ <testCase name="StringUtils valor vazio" duration="6"/>
56
+ <testCase name="StringUtils valor em branco" duration="1"/>
57
+ <testCase name="StringUtils valor null" duration="1"/>
58
+ <testCase name="StringUtils valor undefined" duration="0"/>
59
+ <testCase name="StringUtils valor 0" duration="1"/>
60
+ <testCase name="StringUtils com valor" duration="0"/>
61
+ <testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="1"/>
62
+ <testCase name="StringUtils should return the original value when called with an object without a toString method" duration="2"/>
63
+ <testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
64
+ </file>
65
+ <file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
66
+ <testCase name="OverflowWatcher should initialize with provided parameters" duration="72"/>
67
+ <testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="2"/>
68
+ <testCase name="OverflowWatcher Should call callback on forceUpdate" duration="291"/>
69
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="27"/>
70
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="15"/>
71
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="10"/>
72
+ <testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="76"/>
73
+ <testCase name="OverflowWatcher should ignore elements that can not overflow" duration="21"/>
74
+ <testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
75
+ </file>
76
+ <file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
77
+ <testCase name="StringUtils stringToNumber" duration="73"/>
78
+ <testCase name="StringUtils format" duration="21"/>
79
+ <testCase name="StringUtils format without formatnumber parameter" duration="1"/>
80
+ <testCase name="StringUtils format without formatnumber parameter" duration="2"/>
81
+ <testCase name="StringUtils format round number" duration="2"/>
82
+ </file>
83
+ <file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
84
+ <testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="2"/>
85
+ <testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="0"/>
86
+ <testCase name="TimeFormatter Case: validateTime" duration="1"/>
87
+ </file>
84
88
  <file path="/builds/dti/design-system/sankhyacore/test/util/DataUnitStorage.spec.ts">
85
89
  <testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="5"/>
86
- <testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="1"/>
90
+ <testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="0"/>
87
91
  <testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="1"/>
88
92
  <testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="0"/>
89
- <testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="1"/>
90
- <testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="0"/>
93
+ <testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="53"/>
94
+ <testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="1"/>
91
95
  </file>
92
96
  <file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
93
- <testCase name="addIDInfo 1 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="12"/>
97
+ <testCase name="addIDInfo 1 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="70"/>
94
98
  <testCase name="addIDInfo 2 - should add data-element-id with valid id &quot;brComSankhyaFinCadMovimentacaofinanceira_snkApplication&quot;" duration="2"/>
95
99
  <testCase name="addIDInfo 3 - should add data-element-id with valid id &quot;movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="1"/>
96
100
  <testCase name="addIDInfo 4 - should add data-element-id with valid id &quot;meuID2_snkApplication&quot;" duration="1"/>
97
101
  <testCase name="addIDInfo 5 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="1"/>
98
- <testCase name="addIDInfo 6 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="2"/>
99
- <testCase name="addIDInfo 7 - should add data-element-id with valid id &quot;componenteNameTest_snkApplication&quot;" duration="1"/>
102
+ <testCase name="addIDInfo 6 - should add data-element-id with valid id &quot;movFinanceira_snkApplication&quot;" duration="1"/>
103
+ <testCase name="addIDInfo 7 - should add data-element-id with valid id &quot;componenteNameTest_snkApplication&quot;" duration="6"/>
100
104
  <testCase name="addIDInfo 8 - should add data-element-id with valid id &quot;componentLabel_snkApplication&quot;" duration="1"/>
101
105
  <testCase name="addIDInfo 9 - should add data-element-id with valid id &quot;dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="1"/>
102
- <testCase name="addIDInfo 10 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="40"/>
106
+ <testCase name="addIDInfo 10 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira&quot;" duration="1"/>
103
107
  <testCase name="addIDInfo 11 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="2"/>
104
108
  <testCase name="addIDInfo 12 - should add data-element-id with valid id &quot;dataunitFinanceiro_movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
105
109
  <testCase name="addIDInfo 13 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira&quot;" duration="1"/>
106
- <testCase name="addIDInfo 14 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira&quot;" duration="6"/>
110
+ <testCase name="addIDInfo 14 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira&quot;" duration="2"/>
107
111
  <testCase name="addIDInfo 15 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_snkApplication&quot;" duration="1"/>
108
112
  <testCase name="addIDInfo 16 - should add data-element-id with valid id &quot;dataunitFinanceiro_meuIdTeste_snkApplication&quot;" duration="1"/>
109
113
  <testCase name="addIDInfo 17 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
110
114
  <testCase name="addIDInfo 18 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
111
- <testCase name="addIDInfo 19 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
112
- <testCase name="addIDInfo 20 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
115
+ <testCase name="addIDInfo 19 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="0"/>
116
+ <testCase name="addIDInfo 20 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="0"/>
113
117
  <testCase name="addIDInfo 21 - should add data-element-id with valid id &quot;movFinanceira_movimentacaoFinanceira&quot;" duration="1"/>
114
- <testCase name="addIDInfo 22 - should add data-element-id with valid id &quot;bancoObrigatorio_movimentacaoFinanceira&quot;" duration="0"/>
118
+ <testCase name="addIDInfo 22 - should add data-element-id with valid id &quot;bancoObrigatorio_movimentacaoFinanceira&quot;" duration="1"/>
119
+ </file>
120
+ <file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
121
+ <testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="80"/>
122
+ <testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="3"/>
123
+ <testCase name="calcMarginSize should threat values defined as zero" duration="5"/>
115
124
  </file>
116
125
  </unitTest>
package/setupTests.js ADDED
@@ -0,0 +1 @@
1
+ global.ResizeObserver = require('resize-observer-polyfill');
@@ -2,6 +2,7 @@ sonar.testExecutionReportPaths=./reports/test-report.xml
2
2
  sonar.typescript.lcov.reportPaths=./coverage/lcov.info
3
3
  sonar.test.inclusions=coverage/**,**/test/*.e2e.ts,**/test/*.spec.ts,**/test/*.spec.tsx,**/utils/*.spec.ts,**/test/**/*.ts
4
4
  sonar.tests=test
5
+ sonar.sourceEncoding=UTF-8
5
6
  sonar.c.file.suffixes=-
6
7
  sonar.cpp.file.suffixes=-
7
8
  sonar.objc.file.suffixes=-
package/src/index.ts CHANGED
@@ -39,7 +39,7 @@ import { IRepositoryIndex } from "./repository/indexeddb/IRepositoryIndex.js"
39
39
  import { FieldComparator } from "./dataunit/sorting/FieldComparator.js";
40
40
  import { KeyboardManager } from "./utils/KeyboardManager/index.js";
41
41
  import { SearchUtils } from "./utils/SearchUtils.js";
42
- import OverflowWatcher, { OnOverflowCallBack, OverflowDirection } from "./utils/OverflowWatcher/index.js";
42
+ import OverflowWatcher, { OnOverflowCallBack, OverflowDirection, OverFlowWatcherParams, OVERFLOWED_CLASS_NAME } from "./utils/OverflowWatcher/index.js";
43
43
 
44
44
  /*Classes públicas no pacote*/
45
45
  export {
@@ -109,5 +109,7 @@ export {
109
109
  SearchUtils,
110
110
  OverflowWatcher,
111
111
  OnOverflowCallBack,
112
- OverflowDirection
112
+ OverflowDirection,
113
+ OverFlowWatcherParams,
114
+ OVERFLOWED_CLASS_NAME
113
115
  };