@jinntec/fore 2.5.0 → 2.6.0
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/fore-dev.js +34261 -9
- package/dist/fore.js +34123 -9
- package/index.js +1 -1
- package/package.json +1 -1
- package/resources/fore.css +29 -0
- package/src/DataObserver.js +181 -0
- package/src/DependentXPathQueries.js +32 -0
- package/src/ForeElementMixin.js +289 -260
- package/src/actions/abstract-action.js +24 -24
- package/src/actions/fx-append.js +2 -0
- package/src/actions/fx-delete.js +14 -2
- package/src/actions/fx-hide.js +1 -1
- package/src/actions/fx-insert.js +47 -41
- package/src/actions/fx-load.js +7 -2
- package/src/actions/fx-setvalue.js +104 -86
- package/src/actions/fx-show.js +4 -2
- package/src/fore.js +40 -23
- package/src/fx-fore.js +92 -93
- package/src/fx-submission.js +28 -23
- package/src/getInScopeContext.js +1 -0
- package/src/modelitem.js +107 -96
- package/src/ui/UIElement.js +91 -0
- package/src/ui/abstract-control.js +10 -7
- package/src/ui/fx-container.js +5 -3
- package/src/ui/fx-control-menu.js +198 -0
- package/src/ui/fx-control.js +61 -17
- package/src/ui/fx-dialog.js +2 -2
- package/src/ui/fx-group.js +14 -0
- package/src/ui/fx-repeat.js +33 -3
- package/src/xpath-util.js +284 -256
- package/dist/fore-dev.js.map +0 -1
- package/dist/fore.js.map +0 -1
- package/src/ui/fx-select.js +0 -89
package/src/ui/fx-select.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export class FxSelect extends HTMLElement {
|
|
2
|
-
constructor() {
|
|
3
|
-
super();
|
|
4
|
-
|
|
5
|
-
// Attach Shadow DOM to encapsulate the component
|
|
6
|
-
this.attachShadow({ mode: 'open' });
|
|
7
|
-
|
|
8
|
-
// Create and attach the <select> element
|
|
9
|
-
this.selectElement = document.createElement('select');
|
|
10
|
-
this.shadowRoot.appendChild(this.selectElement);
|
|
11
|
-
|
|
12
|
-
// Set default values
|
|
13
|
-
this.batchSize = parseInt(this.getAttribute('batch-size')) || 20;
|
|
14
|
-
this.size = parseInt(this.getAttribute('size')) || 5;
|
|
15
|
-
this.currentLoadedItems = 0;
|
|
16
|
-
this.hasMoreItems = true; // Assume there are more items initially
|
|
17
|
-
|
|
18
|
-
// Set the size of the <select> element
|
|
19
|
-
this.selectElement.setAttribute('size', this.size);
|
|
20
|
-
|
|
21
|
-
// Bind the scroll event handler
|
|
22
|
-
this.handleScroll = this.handleScroll.bind(this);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
// Initial load of options
|
|
27
|
-
this.loadOptions(this.currentLoadedItems, this.batchSize);
|
|
28
|
-
|
|
29
|
-
// Attach scroll event listener
|
|
30
|
-
this.selectElement.addEventListener('scroll', this.handleScroll);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
// Clean up event listeners when the element is removed
|
|
35
|
-
this.selectElement.removeEventListener('scroll', this.handleScroll);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Mock function to simulate fetching more options
|
|
39
|
-
fetchMoreItems(start, count) {
|
|
40
|
-
// Simulate an async fetch or data load (replace with real fetch if needed)
|
|
41
|
-
return new Promise((resolve) => {
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
const items = [];
|
|
44
|
-
for (let i = start; i < start + count; i++) {
|
|
45
|
-
if (i < 200) { // Let's say we stop after 200 items (remove this limit for real use)
|
|
46
|
-
items.push({ value: i, label: `Option ${i + 1}` });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
resolve(items);
|
|
50
|
-
}, 500); // Simulate fetch delay
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Method to load a batch of options
|
|
55
|
-
async loadOptions(start, count) {
|
|
56
|
-
const fragment = document.createDocumentFragment();
|
|
57
|
-
const newItems = await this.fetchMoreItems(start, count);
|
|
58
|
-
|
|
59
|
-
if (newItems.length > 0) {
|
|
60
|
-
newItems.forEach(item => {
|
|
61
|
-
const option = document.createElement('option');
|
|
62
|
-
option.value = item.value;
|
|
63
|
-
option.textContent = item.label;
|
|
64
|
-
fragment.appendChild(option);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
this.selectElement.appendChild(fragment);
|
|
68
|
-
this.currentLoadedItems += newItems.length;
|
|
69
|
-
} else {
|
|
70
|
-
// If no more items are returned, stop further loading
|
|
71
|
-
this.hasMoreItems = false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Scroll event handler to load more items
|
|
76
|
-
handleScroll() {
|
|
77
|
-
const { scrollTop, scrollHeight, clientHeight } = this.selectElement;
|
|
78
|
-
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 10;
|
|
79
|
-
|
|
80
|
-
if (isNearBottom && this.hasMoreItems) {
|
|
81
|
-
this.loadOptions(this.currentLoadedItems, this.batchSize);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Register the custom element
|
|
87
|
-
if (!customElements.get('fx-select')) {
|
|
88
|
-
customElements.define('fx-select', FxSelect);
|
|
89
|
-
}
|