neo.mjs 6.5.10 → 6.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/apps/ServiceWorker.mjs +2 -2
- package/apps/sharedcovid/view/MainContainerController.mjs +3 -3
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/dialog/DemoDialog.mjs +42 -3
- package/examples/dialog/MainContainer.mjs +9 -1
- package/examples/tabs/MainContainer.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/dialog/Base.scss +21 -16
- package/src/DefaultConfig.mjs +2 -2
- package/src/calendar/view/SettingsContainer.mjs +2 -2
- package/src/component/Base.mjs +25 -13
- package/src/component/Splitter.mjs +4 -4
- package/src/controller/Component.mjs +2 -6
- package/src/dialog/Base.mjs +165 -161
- package/src/form/field/FileUpload.mjs +35 -21
- package/src/grid/View.mjs +1 -1
- package/src/main/DomAccess.mjs +83 -46
- package/src/model/Component.mjs +2 -6
package/src/grid/View.mjs
CHANGED
@@ -29,7 +29,7 @@ class View extends Component {
|
|
29
29
|
createViewData(inputData) {
|
30
30
|
let me = this,
|
31
31
|
amountRows = inputData.length,
|
32
|
-
container =
|
32
|
+
container = me.parent,
|
33
33
|
columns = container.items[0].items,
|
34
34
|
colCount = columns.length,
|
35
35
|
data = [],
|
package/src/main/DomAccess.mjs
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
import Base from '../core/Base.mjs';
|
2
2
|
import DeltaUpdates from './mixin/DeltaUpdates.mjs';
|
3
3
|
import Observable from '../core/Observable.mjs';
|
4
|
-
import Rectangle
|
4
|
+
import Rectangle from '../util/Rectangle.mjs';
|
5
5
|
|
6
6
|
const
|
7
7
|
lengthRE = /^\d+\w+$/,
|
8
8
|
fontSizeProps = [
|
9
|
+
'font-family',
|
10
|
+
'font-kerning',
|
9
11
|
'font-size',
|
10
12
|
'font-size-adjust',
|
13
|
+
'font-stretch',
|
11
14
|
'font-style',
|
12
15
|
'font-weight',
|
13
|
-
'
|
14
|
-
'font-kerning',
|
15
|
-
'font-stretch',
|
16
|
+
'letter-spacing',
|
16
17
|
'line-height',
|
17
|
-
'text-transform',
|
18
18
|
'text-decoration',
|
19
|
-
'
|
19
|
+
'text-transform',
|
20
20
|
'word-break'
|
21
21
|
];
|
22
22
|
|
@@ -77,6 +77,7 @@ class DomAccess extends Base {
|
|
77
77
|
'selectNode',
|
78
78
|
'setBodyCls',
|
79
79
|
'setStyle',
|
80
|
+
'syncModalMask',
|
80
81
|
'windowScrollTo'
|
81
82
|
]
|
82
83
|
},
|
@@ -96,6 +97,20 @@ class DomAccess extends Base {
|
|
96
97
|
]
|
97
98
|
}
|
98
99
|
|
100
|
+
/**
|
101
|
+
* @returns {HTMLElement}
|
102
|
+
*/
|
103
|
+
get modalMask() {
|
104
|
+
let me = this;
|
105
|
+
|
106
|
+
if (!me._modalMask) {
|
107
|
+
me._modalMask = document.createElement('div');
|
108
|
+
me._modalMask.className = 'neo-dialog-modal-mask';
|
109
|
+
}
|
110
|
+
|
111
|
+
return me._modalMask;
|
112
|
+
}
|
113
|
+
|
99
114
|
/**
|
100
115
|
* @param {Object} config
|
101
116
|
*/
|
@@ -111,16 +126,16 @@ class DomAccess extends Base {
|
|
111
126
|
node = document.getElementById('neo-delta-updates');
|
112
127
|
|
113
128
|
if (node) {
|
114
|
-
node.innerHTML = String(me.countDeltasPer250ms * 4)
|
129
|
+
node.innerHTML = String(me.countDeltasPer250ms * 4)
|
115
130
|
}
|
116
131
|
|
117
|
-
me.countDeltasPer250ms = 0
|
132
|
+
me.countDeltasPer250ms = 0
|
118
133
|
}, 250)
|
119
134
|
}
|
120
135
|
|
121
136
|
// Set up our aligning callback which is called when things change which may
|
122
137
|
// mean that alignments need to be updated.
|
123
|
-
me.syncAligns = me.syncAligns.bind(me)
|
138
|
+
me.syncAligns = me.syncAligns.bind(me)
|
124
139
|
}
|
125
140
|
|
126
141
|
/**
|
@@ -144,7 +159,7 @@ class DomAccess extends Base {
|
|
144
159
|
|
145
160
|
// Realign when constraining element changes size
|
146
161
|
if (constrainToElement) {
|
147
|
-
resizeObserver.observe(constrainToElement)
|
162
|
+
resizeObserver.observe(constrainToElement)
|
148
163
|
}
|
149
164
|
}
|
150
165
|
|
@@ -154,7 +169,7 @@ class DomAccess extends Base {
|
|
154
169
|
passive: true
|
155
170
|
});
|
156
171
|
|
157
|
-
me.hasDocumentScrollListener = true
|
172
|
+
me.hasDocumentScrollListener = true
|
158
173
|
}
|
159
174
|
|
160
175
|
if (!me.documentMutationObserver) {
|
@@ -179,12 +194,12 @@ class DomAccess extends Base {
|
|
179
194
|
let script = document.createElement('script');
|
180
195
|
|
181
196
|
if (!data.hasOwnProperty('async')) {
|
182
|
-
data.async = true
|
197
|
+
data.async = true
|
183
198
|
}
|
184
199
|
|
185
200
|
Object.assign(script, data);
|
186
201
|
|
187
|
-
document.head.appendChild(script)
|
202
|
+
document.head.appendChild(script)
|
188
203
|
}
|
189
204
|
|
190
205
|
/**
|
@@ -627,18 +642,19 @@ class DomAccess extends Base {
|
|
627
642
|
* Resets any DOM sizing configs to the last externally configured value.
|
628
643
|
*
|
629
644
|
* This is used during aligning to release any constraints applied by a previous alignment.
|
645
|
+
* @param {Object} align
|
630
646
|
* @protected
|
631
647
|
*/
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
648
|
+
resetDimensions(align) {
|
649
|
+
Object.assign(this.getElement(align.id).style, {
|
650
|
+
flex : align.configuredFlex,
|
651
|
+
width : align.configuredWidth,
|
652
|
+
height : align.configuredHeight,
|
653
|
+
minWidth : align.configuredMinWidth,
|
654
|
+
minHeight: align.configuredMinHeight,
|
655
|
+
maxWidth : align.configuredMaxWidth,
|
656
|
+
maxHeight: align.configuredMaxHeight
|
657
|
+
})
|
642
658
|
}
|
643
659
|
|
644
660
|
/**
|
@@ -655,7 +671,7 @@ class DomAccess extends Base {
|
|
655
671
|
node[`scroll${Neo.capitalize(data.direction)}`] += data.value;
|
656
672
|
}
|
657
673
|
|
658
|
-
return {id: data.id}
|
674
|
+
return {id: data.id}
|
659
675
|
}
|
660
676
|
|
661
677
|
/**
|
@@ -669,15 +685,13 @@ class DomAccess extends Base {
|
|
669
685
|
scrollIntoView(data) {
|
670
686
|
let node = this.getElement(data.id);
|
671
687
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
});
|
678
|
-
}
|
688
|
+
node?.scrollIntoView({
|
689
|
+
behavior: data.behavior || 'smooth',
|
690
|
+
block : data.block || 'start',
|
691
|
+
inline : data.inline || 'nearest'
|
692
|
+
});
|
679
693
|
|
680
|
-
return {id: data.id}
|
694
|
+
return {id: data.id}
|
681
695
|
}
|
682
696
|
|
683
697
|
/**
|
@@ -694,7 +708,7 @@ class DomAccess extends Base {
|
|
694
708
|
node[`scroll${Neo.capitalize(data.direction)}`] = data.value;
|
695
709
|
}
|
696
710
|
|
697
|
-
return {id: data.id}
|
711
|
+
return {id: data.id}
|
698
712
|
}
|
699
713
|
|
700
714
|
/**
|
@@ -714,12 +728,12 @@ class DomAccess extends Base {
|
|
714
728
|
top = node.getBoundingClientRect().top;
|
715
729
|
|
716
730
|
wrapperNode.scrollTo({
|
717
|
-
|
718
|
-
|
719
|
-
})
|
731
|
+
behavior: data.behavior || 'smooth',
|
732
|
+
top : top - tableTop - (data.hasOwnProperty('offset') ? data.offset : 34)
|
733
|
+
})
|
720
734
|
}
|
721
735
|
|
722
|
-
return {id: data.id}
|
736
|
+
return {id: data.id}
|
723
737
|
}
|
724
738
|
|
725
739
|
/**
|
@@ -739,7 +753,7 @@ class DomAccess extends Base {
|
|
739
753
|
node.setSelectionRange(start, end);
|
740
754
|
}
|
741
755
|
|
742
|
-
return {id: data.id}
|
756
|
+
return {id: data.id}
|
743
757
|
}
|
744
758
|
|
745
759
|
/**
|
@@ -767,14 +781,14 @@ class DomAccess extends Base {
|
|
767
781
|
Object.entries(data.style).forEach(([key, value]) => {
|
768
782
|
if (Neo.isString(value) && value.includes('!important')) {
|
769
783
|
value = value.replace('!important', '').trim();
|
770
|
-
node.style.setProperty(Neo.decamel(key), value, 'important')
|
784
|
+
node.style.setProperty(Neo.decamel(key), value, 'important')
|
771
785
|
} else {
|
772
|
-
node.style[Neo.decamel(key)] = value
|
786
|
+
node.style[Neo.decamel(key)] = value
|
773
787
|
}
|
774
|
-
})
|
788
|
+
})
|
775
789
|
}
|
776
790
|
|
777
|
-
return {id: data.id}
|
791
|
+
return {id: data.id}
|
778
792
|
}
|
779
793
|
|
780
794
|
/**
|
@@ -802,17 +816,40 @@ class DomAccess extends Base {
|
|
802
816
|
_alignResizeObserver.unobserve(align.offsetParent);
|
803
817
|
_alignResizeObserver.unobserve(align.targetElement);
|
804
818
|
if (constrainToElement) {
|
805
|
-
_alignResizeObserver.unobserve(constrainToElement)
|
819
|
+
_alignResizeObserver.unobserve(constrainToElement)
|
806
820
|
}
|
807
821
|
|
808
822
|
// Clear the last aligned class.
|
809
823
|
align.subject.classList.remove(`neo-aligned-${align.result?.position}`);
|
810
824
|
|
811
|
-
_aligns.delete(align.id)
|
825
|
+
_aligns.delete(align.id)
|
812
826
|
}
|
813
827
|
})
|
814
828
|
}
|
815
829
|
|
830
|
+
syncModalMask({ id, modal }) {
|
831
|
+
const el = id && this.getElement(id);
|
832
|
+
|
833
|
+
// If we are visible and modal, the mask needs to be just below this element.
|
834
|
+
if (el && modal && el.ownerDocument.contains(el) && el.ownerDocument.defaultView.getComputedStyle(el).getPropertyValue('display') !== 'none') {
|
835
|
+
document.body.insertBefore(this.modalMask, el);
|
836
|
+
}
|
837
|
+
// Otherwise, the mask needs to be blow the next topmost modal dialog if possible, or hidden
|
838
|
+
else {
|
839
|
+
const
|
840
|
+
modals = document.querySelectorAll('.neo-modal'),
|
841
|
+
topmostModal = modals[modals.length - 1];
|
842
|
+
|
843
|
+
// Move the mask under the next topmost modal now modal "id" is gone.
|
844
|
+
if (topmostModal) {
|
845
|
+
this.syncModalMask({ id : topmostModal.id, modal : true })
|
846
|
+
}
|
847
|
+
else {
|
848
|
+
this._modalMask?.remove()
|
849
|
+
}
|
850
|
+
}
|
851
|
+
}
|
852
|
+
|
816
853
|
/**
|
817
854
|
* @param {Object} data
|
818
855
|
* @param {String} [data.behavior='smooth'] // auto or smooth
|
@@ -824,7 +861,7 @@ class DomAccess extends Base {
|
|
824
861
|
behavior: data.behavior || 'smooth',
|
825
862
|
left : data.left || 0,
|
826
863
|
top : data.top || 0
|
827
|
-
})
|
864
|
+
})
|
828
865
|
}
|
829
866
|
|
830
867
|
/**
|
@@ -836,7 +873,7 @@ class DomAccess extends Base {
|
|
836
873
|
index : data.parentIndex,
|
837
874
|
outerHTML: data.html || data.outerHTML,
|
838
875
|
parentId : data.parentId
|
839
|
-
})
|
876
|
+
})
|
840
877
|
}
|
841
878
|
}
|
842
879
|
|
package/src/model/Component.mjs
CHANGED
@@ -445,17 +445,13 @@ class Component extends Base {
|
|
445
445
|
* @returns {Neo.model.Component|null}
|
446
446
|
*/
|
447
447
|
getParent() {
|
448
|
-
let me = this
|
449
|
-
parentComponent, parentId;
|
448
|
+
let me = this;
|
450
449
|
|
451
450
|
if (me.parent) {
|
452
451
|
return me.parent
|
453
452
|
}
|
454
453
|
|
455
|
-
|
456
|
-
parentComponent = parentId && Neo.getComponent(parentId);
|
457
|
-
|
458
|
-
return parentComponent?.getModel() || null
|
454
|
+
return me.component.parent?.getModel() || null
|
459
455
|
}
|
460
456
|
|
461
457
|
/**
|