neo.mjs 8.0.0-alpha.2 → 8.0.0-beta.1
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/.github/CODING_GUIDELINES.md +5 -5
- package/.github/CONCEPT.md +10 -10
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/covid/view/MainContainer.mjs +14 -14
- package/apps/covid/view/TableContainer.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/ViewportController.mjs +2 -2
- package/apps/portal/view/examples/TabContainer.mjs +11 -11
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/home/parts/MainNeo.mjs +6 -2
- package/apps/realworld/view/article/CreateComponent.mjs +1 -1
- package/apps/realworld2/view/HomeContainer.mjs +7 -7
- package/apps/sharedcovid/view/MainContainer.mjs +17 -17
- package/apps/sharedcovid/view/TableContainer.mjs +2 -2
- package/buildScripts/createApp.mjs +2 -2
- package/buildScripts/createClass.mjs +4 -6
- package/docs/app/view/ContentTabContainer.mjs +1 -1
- package/docs/app/view/MainContainer.mjs +3 -3
- package/docs/app/view/MainContainerController.mjs +9 -9
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/mwc/buttons/MainContainer.mjs +2 -2
- package/examples/component/mwc/textFields/MainContainer.mjs +2 -2
- package/examples/fields/MainContainer.mjs +197 -228
- package/examples/preloadingAssets/view/MainContainer.mjs +2 -2
- package/examples/tab/container/MainContainer.mjs +7 -9
- package/examples/tabs/MainContainer.mjs +3 -3
- package/examples/tabs/MainContainer2.mjs +4 -4
- package/examples/videoMove/MainContainer.mjs +14 -7
- package/examples/viewport/MainContainer.mjs +3 -3
- package/package.json +6 -6
- package/resources/data/deck/learnneo/pages/benefits/FormsEngine.md +13 -13
- package/resources/data/deck/training/pages/2022-12-27T21-55-23-144Z.md +2 -2
- package/resources/data/deck/training/pages/2022-12-28T17-11-34-653Z.md +6 -6
- package/resources/data/deck/training/pages/2022-12-29T18-36-08-226Z.md +2 -2
- package/resources/data/deck/training/pages/2022-12-29T18-36-56-893Z.md +2 -2
- package/resources/data/deck/training/pages/2022-12-29T20-37-08-919Z.md +2 -2
- package/resources/data/deck/training/pages/2022-12-29T20-37-20-344Z.md +2 -2
- package/resources/data/deck/training/pages/2023-01-01T21-11-58-025Z.md +3 -3
- package/resources/data/deck/training/pages/2023-01-16T20-24-09-690Z.md +4 -4
- package/resources/data/deck/training/pages/2023-02-05T17-44-53-815Z.md +3 -3
- package/resources/data/deck/training/pages/2023-02-05T17-45-40-114Z.md +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/calendar/view/SettingsContainer.mjs +13 -28
- package/src/calendar/view/calendars/ColorsList.mjs +5 -0
- package/src/code/LivePreview.mjs +10 -10
- package/src/component/Base.mjs +46 -44
- package/src/container/Base.mjs +1 -1
- package/src/form/field/Text.mjs +1 -1
- package/src/form/field/Time.mjs +5 -3
- package/src/form/field/trigger/Time.mjs +2 -1
- package/src/list/Base.mjs +7 -1
- package/src/list/Color.mjs +3 -3
- package/src/main/DomEvents.mjs +1 -1
- package/src/main/DomUtils.mjs +39 -36
- package/src/tab/Container.mjs +3 -5
- package/src/toolbar/Base.mjs +26 -8
- package/src/util/VNode.mjs +6 -8
package/src/main/DomEvents.mjs
CHANGED
package/src/main/DomUtils.mjs
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
import Base from '../core/Base.mjs';
|
2
2
|
|
3
3
|
const focusableTags = {
|
4
|
-
BODY
|
5
|
-
BUTTON
|
6
|
-
EMBED
|
7
|
-
IFRAME
|
8
|
-
INPUT
|
9
|
-
OBJECT
|
10
|
-
SELECT
|
11
|
-
TEXTAREA
|
4
|
+
BODY : 1,
|
5
|
+
BUTTON : 1,
|
6
|
+
EMBED : 1,
|
7
|
+
IFRAME : 1,
|
8
|
+
INPUT : 1,
|
9
|
+
OBJECT : 1,
|
10
|
+
SELECT : 1,
|
11
|
+
TEXTAREA: 1
|
12
12
|
};
|
13
13
|
|
14
14
|
/**
|
15
|
-
* @class Neo.main.DomUtils
|
15
|
+
* @class Neo.main.DomUtils
|
16
16
|
* @extends Neo.core.Base
|
17
17
|
* @singleton
|
18
18
|
*/
|
19
|
-
|
19
|
+
class DomUtils extends Base {
|
20
20
|
static config = {
|
21
21
|
/**
|
22
22
|
* @member {String} className='Neo.main.DomUtils'
|
@@ -31,42 +31,21 @@ export default class DomUtils extends Base {
|
|
31
31
|
* @param {HTMLElement} el The element to start from.
|
32
32
|
* @param {Function} filterFn A function which returns `true` when the desired element is reached.
|
33
33
|
* @param {HTMLElement} [limit] The element to stop at. This is *not* considered for matching.
|
34
|
-
* @returns {
|
34
|
+
* @returns {HTMLElement}
|
35
35
|
*/
|
36
36
|
static closest(el, filterFn, limit = document.body) {
|
37
37
|
while (el?.nodeType === Node.ELEMENT_NODE && el !== limit) {
|
38
38
|
if (filterFn(el)) {
|
39
|
-
return el
|
39
|
+
return el
|
40
40
|
}
|
41
|
-
el = el.parentNode;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Analogous to the `HTMLElement` `querySelectorAll` method. Searches the passed element
|
47
|
-
* and all descendants for all elements for which the passed `filterFn` returns `true`.
|
48
|
-
* @param {HTMLElement} el The element to start from.
|
49
|
-
* @param {Function} filterFn A function which returns `true` when a desired element is reached.
|
50
|
-
* @returns {HTMLElement[]} An array of matching elements
|
51
|
-
*/
|
52
|
-
static queryAll(el, filterFn) {
|
53
|
-
return [el, ...el.querySelectorAll('*')].filter(filterFn);
|
54
|
-
}
|
55
41
|
|
56
|
-
|
57
|
-
|
58
|
-
* and all descendants for the first element for which the passed `filterFn` returns `true`.
|
59
|
-
* @param {HTMLElement} el The element to start from.
|
60
|
-
* @param {Function} filterFn A function which returns `true` when the desired element is reached.
|
61
|
-
* @returns {HTMLElement} The first matching element
|
62
|
-
*/
|
63
|
-
static query(el, filterFn) {
|
64
|
-
return [el, ...el.querySelectorAll('*')].find(filterFn);
|
42
|
+
el = el.parentNode
|
43
|
+
}
|
65
44
|
}
|
66
45
|
|
67
46
|
static isFocusable(e) {
|
68
47
|
// May be used as a scopeless callback, so use "DomUtils", not "this"
|
69
|
-
return DomUtils.isTabbable(e) || Number(e.getAttribute('tabIndex')) < 0
|
48
|
+
return DomUtils.isTabbable(e) || Number(e.getAttribute('tabIndex')) < 0
|
70
49
|
}
|
71
50
|
|
72
51
|
static isTabbable(e) {
|
@@ -86,4 +65,28 @@ export default class DomUtils extends Base {
|
|
86
65
|
(tabIndex != null && Number(tabIndex) >= 0) ||
|
87
66
|
e.contentEditable === 'true'
|
88
67
|
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Analogous to the `HTMLElement` `querySelector` method. Searches the passed element
|
71
|
+
* and all descendants for the first element for which the passed `filterFn` returns `true`.
|
72
|
+
* @param {HTMLElement} el The element to start from.
|
73
|
+
* @param {Function} filterFn A function which returns `true` when the desired element is reached.
|
74
|
+
* @returns {HTMLElement} The first matching element
|
75
|
+
*/
|
76
|
+
static query(el, filterFn) {
|
77
|
+
return [el, ...el.querySelectorAll('*')].find(filterFn);
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Analogous to the `HTMLElement` `querySelectorAll` method. Searches the passed element
|
82
|
+
* and all descendants for all elements for which the passed `filterFn` returns `true`.
|
83
|
+
* @param {HTMLElement} el The element to start from.
|
84
|
+
* @param {Function} filterFn A function which returns `true` when a desired element is reached.
|
85
|
+
* @returns {HTMLElement[]} An array of matching elements
|
86
|
+
*/
|
87
|
+
static queryAll(el, filterFn) {
|
88
|
+
return [el, ...el.querySelectorAll('*')].filter(filterFn)
|
89
|
+
}
|
89
90
|
}
|
91
|
+
|
92
|
+
export default Neo.setupClass(DomUtils);
|
package/src/tab/Container.mjs
CHANGED
@@ -243,7 +243,7 @@ class Container extends BaseContainer {
|
|
243
243
|
});
|
244
244
|
|
245
245
|
items.forEach((item, index) => {
|
246
|
-
tabButtons.push(me.getTabButtonConfig(item.
|
246
|
+
tabButtons.push(me.getTabButtonConfig(item.header, index));
|
247
247
|
|
248
248
|
if (!(item instanceof Neo.component.Base)) {
|
249
249
|
item = {flex: 1, ...me.itemDefaults, isTab: true, ...item}
|
@@ -410,7 +410,7 @@ class Container extends BaseContainer {
|
|
410
410
|
cardContainer = me.getCardContainer(),
|
411
411
|
tabBar = me.getTabBar(),
|
412
412
|
hasItem = false,
|
413
|
-
i, len, returnArray, superItem, tab
|
413
|
+
i, len, returnArray, superItem, tab;
|
414
414
|
|
415
415
|
if (Array.isArray(item)) {
|
416
416
|
i = 0;
|
@@ -441,9 +441,7 @@ class Container extends BaseContainer {
|
|
441
441
|
}
|
442
442
|
|
443
443
|
if (!hasItem) {
|
444
|
-
|
445
|
-
|
446
|
-
tab = tabBar.insert(index, me.getTabButtonConfig(tabButtonConfig, index));
|
444
|
+
tab = tabBar.insert(index, me.getTabButtonConfig(item.header, index));
|
447
445
|
|
448
446
|
// todo: non index based matching of tab buttons and cards
|
449
447
|
i = 0;
|
package/src/toolbar/Base.mjs
CHANGED
@@ -151,14 +151,7 @@ class Base extends Container {
|
|
151
151
|
let items = this._items;
|
152
152
|
|
153
153
|
if (Array.isArray(items)) {
|
154
|
-
items.
|
155
|
-
if (item === '->') {
|
156
|
-
items[index] = Neo.create({
|
157
|
-
module: Component,
|
158
|
-
flex : 1
|
159
|
-
})
|
160
|
-
}
|
161
|
-
})
|
154
|
+
this._items = items.map(item => this.replaceSpacer(item))
|
162
155
|
}
|
163
156
|
|
164
157
|
return super.createItems()
|
@@ -203,6 +196,31 @@ class Base extends Container {
|
|
203
196
|
|
204
197
|
return layoutConfig || me.layout
|
205
198
|
}
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Inserts an item or array of items at a specific index
|
202
|
+
* @param {Number} index
|
203
|
+
* @param {Array|Object} item
|
204
|
+
* @param {Boolean} [silent=false]
|
205
|
+
* @returns {Neo.component.Base|Neo.component.Base[]}
|
206
|
+
*/
|
207
|
+
insert(index, item, silent=false) {
|
208
|
+
if (Array.isArray(item)) {
|
209
|
+
item = item.map(item => this.replaceSpacer(item))
|
210
|
+
} else {
|
211
|
+
item = this.replaceSpacer(item)
|
212
|
+
}
|
213
|
+
|
214
|
+
return super.insert(index, item, silent)
|
215
|
+
}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* @param {Array|Object|String} item
|
219
|
+
* @returns {Array|Object}
|
220
|
+
*/
|
221
|
+
replaceSpacer(item) {
|
222
|
+
return item === '->' ? {module: Component, flex: 1} : item
|
223
|
+
}
|
206
224
|
}
|
207
225
|
|
208
226
|
export default Neo.setupClass(Base);
|
package/src/util/VNode.mjs
CHANGED
@@ -25,7 +25,7 @@ class VNode extends Base {
|
|
25
25
|
* {String} parentId
|
26
26
|
* {Object} vnode
|
27
27
|
*/
|
28
|
-
static
|
28
|
+
static find(vnode, opts, index, parentNode) {
|
29
29
|
vnode = VNode.getVnode(vnode);
|
30
30
|
|
31
31
|
index = index || 0;
|
@@ -68,7 +68,7 @@ class VNode extends Base {
|
|
68
68
|
}
|
69
69
|
} else if (Neo.isArray(value) && Neo.isArray(vnode[key])) {
|
70
70
|
// todo: either search the vnode array for all keys or compare if the arrays are equal.
|
71
|
-
throw new Error('
|
71
|
+
throw new Error('find: cls matching not supported for target & source types of Arrays')
|
72
72
|
}
|
73
73
|
break
|
74
74
|
case 'style':
|
@@ -98,7 +98,7 @@ class VNode extends Base {
|
|
98
98
|
}
|
99
99
|
|
100
100
|
for (; i < len; i++) {
|
101
|
-
subChild = VNode.
|
101
|
+
subChild = VNode.find(vnode.childNodes[i], opts, i, vnode);
|
102
102
|
|
103
103
|
if (subChild) {
|
104
104
|
return subChild
|
@@ -114,7 +114,7 @@ class VNode extends Base {
|
|
114
114
|
* @param {String|null} id
|
115
115
|
* @returns {Object|null} child vnode or null
|
116
116
|
*/
|
117
|
-
static
|
117
|
+
static getById(vnode, id) {
|
118
118
|
vnode = VNode.getVnode(vnode);
|
119
119
|
|
120
120
|
let childNodes = vnode.childNodes || [],
|
@@ -133,7 +133,7 @@ class VNode extends Base {
|
|
133
133
|
return childNode
|
134
134
|
}
|
135
135
|
|
136
|
-
childNode = VNode.
|
136
|
+
childNode = VNode.getById(childNode, id);
|
137
137
|
|
138
138
|
if (childNode) {
|
139
139
|
return childNode
|
@@ -150,9 +150,7 @@ class VNode extends Base {
|
|
150
150
|
* @returns {String[]} childIds
|
151
151
|
*/
|
152
152
|
static getChildIds(vnode, childIds=[]) {
|
153
|
-
|
154
|
-
|
155
|
-
childNodes.forEach(childNode => {
|
153
|
+
vnode?.childNodes?.forEach(childNode => {
|
156
154
|
if (childNode.id && !childNode.componentId) {
|
157
155
|
childIds.push(childNode.id)
|
158
156
|
}
|