@web-atoms/core 2.6.24 → 2.6.25

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.
Files changed (120) hide show
  1. package/dist-esm/App.js +231 -235
  2. package/dist-esm/Atom.js +93 -96
  3. package/dist-esm/MockApp.js +17 -18
  4. package/dist-esm/Pack.js +1 -3
  5. package/dist-esm/core/AtomBinder.js +189 -187
  6. package/dist-esm/core/AtomComponent.js +479 -502
  7. package/dist-esm/core/AtomDispatcher.js +46 -48
  8. package/dist-esm/core/AtomDisposableList.js +24 -25
  9. package/dist-esm/core/AtomEnumerator.js +15 -16
  10. package/dist-esm/core/AtomList.js +193 -192
  11. package/dist-esm/core/AtomLoader.js +229 -215
  12. package/dist-esm/core/AtomMap.js +7 -8
  13. package/dist-esm/core/AtomOnce.js +22 -24
  14. package/dist-esm/core/AtomSelectableList.js +240 -243
  15. package/dist-esm/core/AtomUri.js +70 -72
  16. package/dist-esm/core/AtomWatcher.js +105 -111
  17. package/dist-esm/core/Bind.js +271 -269
  18. package/dist-esm/core/BindableProperty.js +26 -27
  19. package/dist-esm/core/CancelTokenFactory.js +21 -24
  20. package/dist-esm/core/Color.js +1 -2
  21. package/dist-esm/core/Colors.js +545 -231
  22. package/dist-esm/core/Command.js +236 -223
  23. package/dist-esm/core/Defer.js +21 -22
  24. package/dist-esm/core/EventScope.js +96 -88
  25. package/dist-esm/core/ExpressionParser.js +132 -144
  26. package/dist-esm/core/ExtendControl.js +7 -8
  27. package/dist-esm/core/FormattedError.js +7 -8
  28. package/dist-esm/core/FormattedString.js +4 -5
  29. package/dist-esm/core/Hacks.js +41 -42
  30. package/dist-esm/core/IFetchEvent.js +1 -2
  31. package/dist-esm/core/IScreen.js +1 -2
  32. package/dist-esm/core/IValueConverter.js +1 -2
  33. package/dist-esm/core/InheritedProperty.js +61 -63
  34. package/dist-esm/core/InjectProperty.js +12 -13
  35. package/dist-esm/core/KeyValuePairs.js +1 -2
  36. package/dist-esm/core/Markdown.js +14 -17
  37. package/dist-esm/core/MarkdownError.js +6 -7
  38. package/dist-esm/core/PropertyBinding.js +1 -2
  39. package/dist-esm/core/PropertyMap.js +28 -27
  40. package/dist-esm/core/Route.js +149 -148
  41. package/dist-esm/core/SingleInvoker.js +32 -35
  42. package/dist-esm/core/StringHelper.js +49 -51
  43. package/dist-esm/core/TransientDisposable.js +14 -16
  44. package/dist-esm/core/WatchProperty.js +18 -17
  45. package/dist-esm/core/WebImage.js +7 -8
  46. package/dist-esm/core/XNode.js +134 -117
  47. package/dist-esm/core/sleep.js +21 -24
  48. package/dist-esm/core/types.js +102 -103
  49. package/dist-esm/di/DISingleton.js +7 -5
  50. package/dist-esm/di/DITransient.js +7 -5
  51. package/dist-esm/di/IMockOrInject.js +1 -2
  52. package/dist-esm/di/IServiceProvider.js +1 -2
  53. package/dist-esm/di/Inject.js +67 -67
  54. package/dist-esm/di/Register.js +25 -26
  55. package/dist-esm/di/RegisterScoped.js +4 -3
  56. package/dist-esm/di/RegisterSingleton.js +4 -3
  57. package/dist-esm/di/ServiceCollection.js +38 -37
  58. package/dist-esm/di/ServiceProvider.js +94 -94
  59. package/dist-esm/di/TypeKey.js +13 -12
  60. package/dist-esm/services/BusyIndicatorService.js +7 -11
  61. package/dist-esm/services/CacheService.js +54 -62
  62. package/dist-esm/services/FetchBuilder.js +327 -278
  63. package/dist-esm/services/JsonService.js +118 -116
  64. package/dist-esm/services/MockNavigationService.js +127 -126
  65. package/dist-esm/services/NavigationService.js +95 -102
  66. package/dist-esm/services/ReferenceService.js +30 -33
  67. package/dist-esm/services/http/AjaxOptions.js +1 -3
  68. package/dist-esm/services/http/JsonError.js +16 -15
  69. package/dist-esm/services/http/RestService.js +314 -323
  70. package/dist-esm/style/StyleRule.js +1 -2
  71. package/dist-esm/test.js +0 -1
  72. package/dist-esm/unit/AtomTest.js +10 -11
  73. package/dist-esm/view-model/Action.js +258 -223
  74. package/dist-esm/view-model/AtomViewModel.js +234 -232
  75. package/dist-esm/view-model/AtomWindowViewModel.js +13 -14
  76. package/dist-esm/view-model/BindableUrlParameter.js +7 -8
  77. package/dist-esm/view-model/Delay.js +21 -25
  78. package/dist-esm/view-model/Disposable.js +28 -29
  79. package/dist-esm/view-model/Load.js +72 -73
  80. package/dist-esm/view-model/Once.js +33 -35
  81. package/dist-esm/view-model/baseTypes.js +4 -5
  82. package/dist-esm/view-model/bindPromise.js +24 -27
  83. package/dist-esm/view-model/bindProperty.js +3 -4
  84. package/dist-esm/view-model/bindUrlParameter.js +39 -43
  85. package/dist-esm/web/controls/AtomComboBox.js +56 -63
  86. package/dist-esm/web/controls/AtomControl.js +485 -490
  87. package/dist-esm/web/controls/AtomGridSplitter.js +57 -50
  88. package/dist-esm/web/controls/AtomGridView.js +230 -222
  89. package/dist-esm/web/controls/AtomItemsControl.js +677 -688
  90. package/dist-esm/web/controls/AtomPage.js +6 -7
  91. package/dist-esm/web/controls/AtomTemplate.js +1 -3
  92. package/dist-esm/web/controls/AtomTemplateControl.js +28 -29
  93. package/dist-esm/web/controls/AtomViewStack.js +19 -20
  94. package/dist-esm/web/core/AtomUI.js +200 -200
  95. package/dist-esm/web/core/Encoder.js +142 -152
  96. package/dist-esm/web/core/HtmlNode.js +141 -139
  97. package/dist-esm/web/images/Busy.js +1 -2
  98. package/dist-esm/web/images/BusyDataUrl.js +2 -869
  99. package/dist-esm/web/images/Button.js +1 -2
  100. package/dist-esm/web/images/ButtonDataUrl.js +2 -30
  101. package/dist-esm/web/images/CloseButton.js +1 -2
  102. package/dist-esm/web/images/CloseButtonDataUrl.js +2 -30
  103. package/dist-esm/web/images/CloseButtonHover.js +1 -2
  104. package/dist-esm/web/images/CloseButtonHoverDataUrl.js +2 -24
  105. package/dist-esm/web/services/LastTarget.js +31 -29
  106. package/dist-esm/web/services/MarkdownService.js +19 -31
  107. package/dist-esm/web/services/NotificationPopup.js +28 -21
  108. package/dist-esm/web/services/PopupService.js +512 -478
  109. package/dist-esm/web/services/PopupWindow.js +266 -247
  110. package/dist-esm/web/styles/AtomAlertWindowStyle.js +39 -40
  111. package/dist-esm/web/styles/AtomFrameStyle.js +15 -16
  112. package/dist-esm/web/styles/AtomNotificationStyle.js +19 -20
  113. package/dist-esm/web/styles/AtomPageLinkStyle.js +11 -12
  114. package/dist-esm/web/styles/AtomPopupStyle.js +9 -10
  115. package/dist-esm/web/styles/AtomStyle.js +61 -64
  116. package/dist-esm/web/styles/AtomStyleSheet.js +50 -51
  117. package/dist-esm/web/styles/AtomWindowStyle.js +116 -117
  118. package/dist-esm/web/styles/IStyleDeclaration.js +1 -2
  119. package/dist-esm/web/styles/StyleBuilder.js +79 -80
  120. package/package.json +1 -1
@@ -1,54 +1,61 @@
1
1
  import { AtomControl } from "./AtomControl.js";
2
2
  import { AtomGridView } from "./AtomGridView.js";
3
3
  export class AtomGridSplitter extends AtomControl {
4
- constructor() {
5
- super(...arguments);
4
+ constructor() {
5
+ super(...arguments);
6
+ this.dragging = false;
7
+ }
8
+ preCreate() {
9
+ this.direction = "vertical";
10
+ this.dragging = false;
11
+ }
12
+ create() {
13
+ this.bind(this.element, "styleCursor", [["direction"]], false, v => v === "vertical" ? "ew-resize" : "ns-resize");
14
+ this.bind(this.element, "styleBackgroundColor", [["dragging"]], false, v => v ? "blue" : "lightgray");
15
+ const style = this.element.style;
16
+ style.position = "absolute";
17
+ style.left = style.top = style.bottom = style.right = "0";
18
+ this.bindEvent(this.element, "mousedown", e => {
19
+ e.preventDefault();
20
+ this.dragging = true;
21
+ const parent = this.parent;
22
+ const isVertical = this.direction === "vertical";
23
+ const disposables = [];
24
+ const rect = {
25
+ x: e.screenX,
26
+ y: e.screenY
27
+ };
28
+ const {
29
+ column,
30
+ row
31
+ } = AtomGridView.getCellInfo(this.element);
32
+ const ss = document.createElement("style");
33
+ ss.textContent = "iframe { pointer-events: none }";
34
+ document.head.appendChild(ss);
35
+ disposables.push({
36
+ dispose: () => ss.remove()
37
+ });
38
+ disposables.push(this.bindEvent(document.body, "mousemove", me => {
39
+ const {
40
+ screenX,
41
+ screenY
42
+ } = me;
43
+ const dx = screenX - rect.x;
44
+ const dy = screenY - rect.y;
45
+ if (isVertical) {
46
+ parent.resize("column", column, dx);
47
+ } else {
48
+ parent.resize("row", row, dy);
49
+ }
50
+ rect.x = screenX;
51
+ rect.y = screenY;
52
+ }));
53
+ disposables.push(this.bindEvent(document.body, "mouseup", mup => {
6
54
  this.dragging = false;
7
- }
8
- preCreate() {
9
- this.direction = "vertical";
10
- this.dragging = false;
11
- }
12
- create() {
13
- this.bind(this.element, "styleCursor", [["direction"]], false, (v) => v === "vertical" ? "ew-resize" : "ns-resize");
14
- this.bind(this.element, "styleBackgroundColor", [["dragging"]], false, (v) => v ? "blue" : "lightgray");
15
- const style = this.element.style;
16
- style.position = "absolute";
17
- style.left = style.top = style.bottom = style.right = "0";
18
- this.bindEvent(this.element, "mousedown", (e) => {
19
- e.preventDefault();
20
- this.dragging = true;
21
- const parent = this.parent;
22
- const isVertical = this.direction === "vertical";
23
- const disposables = [];
24
- const rect = { x: e.screenX, y: e.screenY };
25
- const { column, row } = AtomGridView.getCellInfo(this.element);
26
- const ss = document.createElement("style");
27
- ss.textContent = "iframe { pointer-events: none }";
28
- document.head.appendChild(ss);
29
- disposables.push({
30
- dispose: () => ss.remove()
31
- });
32
- disposables.push(this.bindEvent(document.body, "mousemove", (me) => {
33
- const { screenX, screenY } = me;
34
- const dx = screenX - rect.x;
35
- const dy = screenY - rect.y;
36
- if (isVertical) {
37
- parent.resize("column", column, dx);
38
- }
39
- else {
40
- parent.resize("row", row, dy);
41
- }
42
- rect.x = screenX;
43
- rect.y = screenY;
44
- }));
45
- disposables.push(this.bindEvent(document.body, "mouseup", (mup) => {
46
- this.dragging = false;
47
- for (const iterator of disposables) {
48
- iterator.dispose();
49
- }
50
- }));
51
- });
52
- }
53
- }
54
- //# sourceMappingURL=AtomGridSplitter.js.map
55
+ for (const iterator of disposables) {
56
+ iterator.dispose();
57
+ }
58
+ }));
59
+ });
60
+ }
61
+ }
@@ -1,228 +1,236 @@
1
1
  import { visitDescendents } from "../../core/Hacks.js";
2
2
  import { AtomControl } from "./AtomControl.js";
3
3
  export class AtomGridView extends AtomControl {
4
- constructor() {
5
- super(...arguments);
6
- this.attempt = 0;
7
- this.availableRect = null;
8
- this.childrenReady = false;
9
- }
10
- static getCellInfo(e) {
11
- let row = 0;
12
- let column = 0;
13
- let rowSpan = 1;
14
- let colSpan = 1;
15
- const cell = e.cell;
16
- if (cell) {
17
- console.warn("Attribute `cell` is obsolete, please use row and column attributes separately");
18
- const tokens = cell.split(",")
19
- .map((s) => s.trim().split(":").map((st) => parseInt(st.trim(), 10)));
20
- column = tokens[0][0];
21
- row = tokens[1][0];
22
- colSpan = tokens[0][1] || 1;
23
- rowSpan = tokens[1][1] || 1;
24
- }
25
- else {
26
- let c = ((e.row) || "0");
27
- let tokens = c.split(":").map((st) => parseInt(st.trim(), 10));
28
- row = tokens[0];
29
- rowSpan = tokens[1] || 1;
30
- c = ((e.column) || "0");
31
- tokens = c.split(":").map((st) => parseInt(st.trim(), 10));
32
- column = tokens[0];
33
- colSpan = tokens[1] || 1;
34
- }
35
- return {
36
- row,
37
- rowSpan,
38
- column,
39
- colSpan,
40
- };
41
- }
42
- append(e) {
43
- const ee = e instanceof AtomControl ? e.element : e;
44
- ee._logicalParent = this.element;
45
- this.children = this.children || [];
46
- this.children.push(e instanceof AtomControl ? e.element : e);
47
- return this;
48
- }
49
- onUpdateUI() {
50
- this.attempt++;
51
- const c1 = this.children ??= [];
52
- c1.length = 0;
53
- let child = this.element.firstElementChild;
54
- while (child) {
55
- const c = child;
56
- c1.push(c);
57
- child = child.nextElementSibling;
58
- c.remove();
59
- }
60
- const width = this.element.offsetWidth ||
61
- this.element.clientWidth ||
62
- parseFloat(this.element.style.width) ||
63
- 0;
64
- const height = this.element.offsetHeight ||
65
- this.element.clientHeight ||
66
- parseFloat(this.element.style.height) ||
67
- 0;
68
- if (!(width && height)) {
69
- if (this.childrenReady) {
70
- setTimeout(() => {
71
- this.invalidate();
72
- }, 5000);
73
- return;
74
- }
75
- if (this.attempt > 100) {
76
- console.error(`AtomDockPanel (${width}, ${height}) must both have non zero width and height`);
77
- return;
78
- }
79
- setTimeout(() => {
80
- this.invalidate();
81
- }, 100);
82
- return;
83
- }
84
- if (!this.children) {
85
- return;
86
- }
87
- this.attempt = 0;
88
- this.availableRect = { width, height, x: 0, y: 0 };
89
- this.columnSizes = (this.columns || "*").split(",")
90
- .map((s) => this.toSize(s.trim(), this.availableRect.width));
91
- this.rowSizes = (this.rows || "*").split(",")
92
- .map((s) => this.toSize(s.trim(), this.availableRect.height));
93
- this.assignOffsets(this.columnSizes, this.availableRect.width);
94
- this.assignOffsets(this.rowSizes, this.availableRect.height);
95
- for (const iterator of this.children) {
96
- const host = document.createElement("section");
97
- host.appendChild(iterator);
98
- this.element.appendChild(host);
99
- }
100
- super.onUpdateUI();
101
- this.updateSize();
102
- this.childrenReady = true;
103
- }
104
- resize(item, index, delta) {
105
- const a = item === "column" ? this.columnSizes : this.rowSizes;
106
- const prev = a[index - 1];
107
- const next = a[index + 1];
108
- if ((!prev) || (!next)) {
109
- throw new Error("Grid Splitter cannot be start or end element in GridView");
110
- }
111
- const current = a[index];
112
- prev.size += delta;
113
- current.offset += delta;
114
- next.offset += delta;
115
- next.size -= delta;
116
- this.updateSize();
117
- }
118
- onPropertyChanged(name) {
119
- switch (name) {
120
- case "rows":
121
- case "columns":
122
- if (this.childrenReady) {
123
- this.invalidate();
124
- }
125
- break;
126
- }
4
+ constructor() {
5
+ super(...arguments);
6
+ this.attempt = 0;
7
+ this.availableRect = null;
8
+ this.childrenReady = false;
9
+ }
10
+ static getCellInfo(e) {
11
+ let row = 0;
12
+ let column = 0;
13
+ let rowSpan = 1;
14
+ let colSpan = 1;
15
+ const cell = e.cell;
16
+ if (cell) {
17
+ console.warn("Attribute `cell` is obsolete, please use row and column attributes separately");
18
+ const tokens = cell.split(",").map(s => s.trim().split(":").map(st => parseInt(st.trim(), 10)));
19
+ column = tokens[0][0];
20
+ row = tokens[1][0];
21
+ colSpan = tokens[0][1] || 1;
22
+ rowSpan = tokens[1][1] || 1;
23
+ } else {
24
+ let c = e.row || "0";
25
+ let tokens = c.split(":").map(st => parseInt(st.trim(), 10));
26
+ row = tokens[0];
27
+ rowSpan = tokens[1] || 1;
28
+ c = e.column || "0";
29
+ tokens = c.split(":").map(st => parseInt(st.trim(), 10));
30
+ column = tokens[0];
31
+ colSpan = tokens[1] || 1;
127
32
  }
128
- onUpdateSize() {
129
- if (!this.children) {
130
- return;
131
- }
132
- for (const iterator of this.children) {
133
- this.updateStyle(iterator);
134
- }
33
+ return {
34
+ row,
35
+ rowSpan,
36
+ column,
37
+ colSpan
38
+ };
39
+ }
40
+ append(e) {
41
+ const ee = e instanceof AtomControl ? e.element : e;
42
+ ee._logicalParent = this.element;
43
+ this.children = this.children || [];
44
+ this.children.push(e instanceof AtomControl ? e.element : e);
45
+ return this;
46
+ }
47
+ onUpdateUI() {
48
+ this.attempt++;
49
+ const c1 = this.children ??= [];
50
+ c1.length = 0;
51
+ let child = this.element.firstElementChild;
52
+ while (child) {
53
+ const c = child;
54
+ c1.push(c);
55
+ child = child.nextElementSibling;
56
+ c.remove();
135
57
  }
136
- preCreate() {
137
- this.columns = null;
138
- this.rows = null;
139
- const style = this.element.style;
140
- style.position = "absolute";
141
- style.left = style.right = style.top = style.bottom = "0";
142
- style.overflow = "hidden";
143
- this.bindEvent(window, "resize", () => {
144
- this.updateSize();
145
- });
146
- this.bindEvent(document.body, "resize", () => {
147
- this.updateSize();
148
- });
149
- }
150
- updateStyle(e) {
151
- const { colSpan, column, row, rowSpan } = AtomGridView.getCellInfo(e);
152
- const host = e.parentElement;
153
- if (!host) {
154
- return;
155
- }
156
- host.style.position = "absolute";
157
- host.style.overflow = "hidden";
158
- host.style.padding = "0";
159
- host.style.margin = "0";
160
- if (this.rowSizes.length <= row || this.columnSizes.length <= column) {
161
- return;
162
- }
163
- const rowStart = this.rowSizes[row].offset;
164
- let rowSize = 0;
165
- for (let i = row; i < row + rowSpan; i++) {
166
- rowSize += this.rowSizes[i].size;
167
- }
168
- host.style.top = `${rowStart}px`;
169
- host.style.height = `${rowSize}px`;
170
- const colStart = this.columnSizes[column].offset;
171
- let colSize = 0;
172
- for (let i = column; i < column + colSpan; i++) {
173
- colSize += this.columnSizes[i].size;
174
- }
175
- host.style.left = `${colStart}px`;
176
- host.style.width = `${colSize}px`;
177
- visitDescendents(host, (el, ac) => {
178
- if (ac) {
179
- ac.invalidate();
180
- return false;
181
- }
182
- return true;
183
- });
184
- }
185
- toSize(s, total) {
186
- if (!s || s === "*") {
187
- return { offset: -1, size: NaN };
188
- }
189
- let n = 0;
190
- if (s.endsWith("%")) {
191
- s = s.substr(0, s.length - 1);
192
- n = parseFloat(s);
193
- return { offset: -1, size: total * n / 100 };
194
- }
195
- return { offset: -1, size: parseFloat(s) };
196
- }
197
- assignOffsets(a, end) {
198
- let start = 0;
199
- let fill = null;
200
- for (const item of a) {
201
- item.offset = start;
202
- if (isNaN(item.size)) {
203
- fill = item;
204
- break;
205
- }
206
- start += item.size;
207
- }
208
- if (!fill) {
209
- return;
210
- }
211
- const lastStart = start;
212
- start = end;
213
- const r = a.map((x) => x).reverse();
214
- for (const item of r) {
215
- if (isNaN(item.size)) {
216
- if (fill !== item) {
217
- throw new Error("Multiple * cannot be defined");
218
- }
219
- break;
220
- }
221
- start -= item.size;
222
- item.offset = start;
223
- }
224
- fill.offset = lastStart;
225
- fill.size = start - lastStart;
58
+ const width = this.element.offsetWidth || this.element.clientWidth || parseFloat(this.element.style.width) || 0;
59
+ const height = this.element.offsetHeight || this.element.clientHeight || parseFloat(this.element.style.height) || 0;
60
+ if (!(width && height)) {
61
+ if (this.childrenReady) {
62
+ setTimeout(() => {
63
+ this.invalidate();
64
+ }, 5000);
65
+ return;
66
+ }
67
+ if (this.attempt > 100) {
68
+ console.error(`AtomDockPanel (${width}, ${height}) must both have non zero width and height`);
69
+ return;
70
+ }
71
+ setTimeout(() => {
72
+ this.invalidate();
73
+ }, 100);
74
+ return;
75
+ }
76
+ if (!this.children) {
77
+ return;
78
+ }
79
+ this.attempt = 0;
80
+ this.availableRect = {
81
+ width,
82
+ height,
83
+ x: 0,
84
+ y: 0
85
+ };
86
+ this.columnSizes = (this.columns || "*").split(",").map(s => this.toSize(s.trim(), this.availableRect.width));
87
+ this.rowSizes = (this.rows || "*").split(",").map(s => this.toSize(s.trim(), this.availableRect.height));
88
+ this.assignOffsets(this.columnSizes, this.availableRect.width);
89
+ this.assignOffsets(this.rowSizes, this.availableRect.height);
90
+ for (const iterator of this.children) {
91
+ const host = document.createElement("section");
92
+ host.appendChild(iterator);
93
+ this.element.appendChild(host);
94
+ }
95
+ super.onUpdateUI();
96
+ this.updateSize();
97
+ this.childrenReady = true;
98
+ }
99
+ resize(item, index, delta) {
100
+ const a = item === "column" ? this.columnSizes : this.rowSizes;
101
+ const prev = a[index - 1];
102
+ const next = a[index + 1];
103
+ if (!prev || !next) {
104
+ throw new Error("Grid Splitter cannot be start or end element in GridView");
105
+ }
106
+ const current = a[index];
107
+ prev.size += delta;
108
+ current.offset += delta;
109
+ next.offset += delta;
110
+ next.size -= delta;
111
+ this.updateSize();
112
+ }
113
+ onPropertyChanged(name) {
114
+ switch (name) {
115
+ case "rows":
116
+ case "columns":
117
+ if (this.childrenReady) {
118
+ this.invalidate();
119
+ }
120
+ break;
121
+ }
122
+ }
123
+ onUpdateSize() {
124
+ if (!this.children) {
125
+ return;
126
+ }
127
+ for (const iterator of this.children) {
128
+ this.updateStyle(iterator);
129
+ }
130
+ }
131
+ preCreate() {
132
+ this.columns = null;
133
+ this.rows = null;
134
+ const style = this.element.style;
135
+ style.position = "absolute";
136
+ style.left = style.right = style.top = style.bottom = "0";
137
+ style.overflow = "hidden";
138
+ this.bindEvent(window, "resize", () => {
139
+ this.updateSize();
140
+ });
141
+ this.bindEvent(document.body, "resize", () => {
142
+ this.updateSize();
143
+ });
144
+ }
145
+ updateStyle(e) {
146
+ const {
147
+ colSpan,
148
+ column,
149
+ row,
150
+ rowSpan
151
+ } = AtomGridView.getCellInfo(e);
152
+ const host = e.parentElement;
153
+ if (!host) {
154
+ return;
155
+ }
156
+ host.style.position = "absolute";
157
+ host.style.overflow = "hidden";
158
+ host.style.padding = "0";
159
+ host.style.margin = "0";
160
+ if (this.rowSizes.length <= row || this.columnSizes.length <= column) {
161
+ return;
162
+ }
163
+ const rowStart = this.rowSizes[row].offset;
164
+ let rowSize = 0;
165
+ for (let i = row; i < row + rowSpan; i++) {
166
+ rowSize += this.rowSizes[i].size;
167
+ }
168
+ host.style.top = `${rowStart}px`;
169
+ host.style.height = `${rowSize}px`;
170
+ const colStart = this.columnSizes[column].offset;
171
+ let colSize = 0;
172
+ for (let i = column; i < column + colSpan; i++) {
173
+ colSize += this.columnSizes[i].size;
174
+ }
175
+ host.style.left = `${colStart}px`;
176
+ host.style.width = `${colSize}px`;
177
+ visitDescendents(host, (el, ac) => {
178
+ if (ac) {
179
+ ac.invalidate();
180
+ return false;
181
+ }
182
+ return true;
183
+ });
184
+ }
185
+ toSize(s, total) {
186
+ if (!s || s === "*") {
187
+ return {
188
+ offset: -1,
189
+ size: NaN
190
+ };
191
+ }
192
+ let n = 0;
193
+ if (s.endsWith("%")) {
194
+ s = s.substr(0, s.length - 1);
195
+ n = parseFloat(s);
196
+ return {
197
+ offset: -1,
198
+ size: total * n / 100
199
+ };
200
+ }
201
+ return {
202
+ offset: -1,
203
+ size: parseFloat(s)
204
+ };
205
+ }
206
+ assignOffsets(a, end) {
207
+ let start = 0;
208
+ let fill = null;
209
+ for (const item of a) {
210
+ item.offset = start;
211
+ if (isNaN(item.size)) {
212
+ fill = item;
213
+ break;
214
+ }
215
+ start += item.size;
216
+ }
217
+ if (!fill) {
218
+ return;
219
+ }
220
+ const lastStart = start;
221
+ start = end;
222
+ const r = a.map(x => x).reverse();
223
+ for (const item of r) {
224
+ if (isNaN(item.size)) {
225
+ if (fill !== item) {
226
+ throw new Error("Multiple * cannot be defined");
227
+ }
228
+ break;
229
+ }
230
+ start -= item.size;
231
+ item.offset = start;
226
232
  }
227
- }
228
- //# sourceMappingURL=AtomGridView.js.map
233
+ fill.offset = lastStart;
234
+ fill.size = start - lastStart;
235
+ }
236
+ }