neo.mjs 4.3.17 → 4.3.19
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/buildScripts/watchThemes.mjs +35 -7
- package/examples/list/circle/neo-config.json +4 -5
- package/package.json +3 -3
- package/src/component/Circle.mjs +85 -16
- package/src/container/Base.mjs +17 -0
- package/src/draggable/DragZone.mjs +1 -1
- package/src/form/Container.mjs +3 -0
- package/src/list/Circle.mjs +1 -1
- package/src/main/addon/DragDrop.mjs +7 -6
@@ -5,12 +5,13 @@ import path from 'path';
|
|
5
5
|
import postcss from 'postcss';
|
6
6
|
import sass from 'sass';
|
7
7
|
|
8
|
-
let cwd
|
9
|
-
requireJson
|
10
|
-
packageJson
|
11
|
-
neoPath
|
12
|
-
mixinPath
|
13
|
-
|
8
|
+
let cwd = process.cwd(),
|
9
|
+
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
10
|
+
packageJson = requireJson(path.resolve(cwd, 'package.json')),
|
11
|
+
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
12
|
+
mixinPath = path.resolve(neoPath, 'resources/scss/mixins/_all.scss'),
|
13
|
+
regexSassImport = /@import[^'"]+?['"](.+?)['"];?/g,
|
14
|
+
scssPath = path.resolve(cwd, 'resources/scss');
|
14
15
|
|
15
16
|
if (path.sep === '\\') {
|
16
17
|
mixinPath = mixinPath.replace(/\\/g, '/');
|
@@ -47,7 +48,7 @@ function buildFile(filename) {
|
|
47
48
|
fs.readFile(filePath).then(content => {
|
48
49
|
try {
|
49
50
|
let result = sass.renderSync({
|
50
|
-
data : data + content.toString(),
|
51
|
+
data : data + scssCombine(content.toString(), path.parse(filePath).dir),
|
51
52
|
outFile : destPath,
|
52
53
|
sourceMap : true,
|
53
54
|
sourceMapEmbed: false
|
@@ -94,6 +95,33 @@ function buildFile(filename) {
|
|
94
95
|
});
|
95
96
|
} catch(error) {
|
96
97
|
console.log('SCSS build failed for', chalk.red(filename));
|
98
|
+
console.log(error);
|
97
99
|
}
|
98
100
|
});
|
99
101
|
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* @param {String} content
|
105
|
+
* @param {String} baseDir
|
106
|
+
* @returns {String}
|
107
|
+
*/
|
108
|
+
function scssCombine (content, baseDir) {
|
109
|
+
if (regexSassImport.test(content)) {
|
110
|
+
content = content.replace(regexSassImport, (m, capture) => {
|
111
|
+
let parse = path.parse(path.resolve(baseDir, capture)),
|
112
|
+
file = path.resolve(`${parse.dir}/${parse.name}.scss`);
|
113
|
+
|
114
|
+
if (!fs.existsSync(file)) {
|
115
|
+
file = path.resolve(`${parse.dir}/_${parse.name}.scss`);
|
116
|
+
|
117
|
+
if (!fs.existsSync(file)) {
|
118
|
+
return '';
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
return scssCombine(fs.readFileSync(file).toString(), path.dirname(file));
|
123
|
+
});
|
124
|
+
}
|
125
|
+
|
126
|
+
return content;
|
127
|
+
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"appPath"
|
3
|
-
"basePath"
|
4
|
-
"environment"
|
5
|
-
"mainPath"
|
6
|
-
"mainThreadAddons": ["Stylesheet"]
|
2
|
+
"appPath" : "examples/list/circle/app.mjs",
|
3
|
+
"basePath" : "../../../",
|
4
|
+
"environment": "development",
|
5
|
+
"mainPath" : "./Main.mjs"
|
7
6
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.19",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"commander": "^9.4.1",
|
51
51
|
"cssnano": "^5.1.14",
|
52
52
|
"envinfo": "^7.8.1",
|
53
|
-
"fs-extra": "^
|
53
|
+
"fs-extra": "^11.1.0",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
55
|
"inquirer": "^9.1.4",
|
56
56
|
"neo-jsdoc": "^1.0.1",
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"postcss": "^8.4.19",
|
59
59
|
"sass": "^1.56.1",
|
60
60
|
"webpack": "^5.75.0",
|
61
|
-
"webpack-cli": "^5.0.
|
61
|
+
"webpack-cli": "^5.0.1",
|
62
62
|
"webpack-dev-server": "4.11.1",
|
63
63
|
"webpack-hook-plugin": "^1.0.7",
|
64
64
|
"webpack-node-externals": "^3.0.0"
|
package/src/component/Circle.mjs
CHANGED
@@ -5,6 +5,8 @@ import Component from './Base.mjs';
|
|
5
5
|
import NeoArray from '../util/Array.mjs';
|
6
6
|
import VDomUtil from '../util/VDom.mjs';
|
7
7
|
|
8
|
+
let DragZone;
|
9
|
+
|
8
10
|
/**
|
9
11
|
* @class Neo.component.Circle
|
10
12
|
* @extends Neo.component.Base
|
@@ -39,6 +41,10 @@ class Circle extends Component {
|
|
39
41
|
* @member {Boolean} collapsed=true
|
40
42
|
*/
|
41
43
|
collapsed: true,
|
44
|
+
/**
|
45
|
+
* @member {Boolean} draggable_=true
|
46
|
+
*/
|
47
|
+
draggable_: true,
|
42
48
|
/**
|
43
49
|
* Additional used keys for the selection model
|
44
50
|
* @member {Object} keys={}
|
@@ -179,6 +185,31 @@ class Circle extends Component {
|
|
179
185
|
me.update();
|
180
186
|
}
|
181
187
|
|
188
|
+
/**
|
189
|
+
* Triggered after the draggable config got changed
|
190
|
+
* @param {Boolean} value
|
191
|
+
* @param {Boolean} oldValue
|
192
|
+
* @protected
|
193
|
+
*/
|
194
|
+
afterSetDraggable(value, oldValue) {
|
195
|
+
let me = this,
|
196
|
+
domListeners = [];
|
197
|
+
|
198
|
+
value && import('../draggable/DragZone.mjs').then(module => {
|
199
|
+
DragZone = module.default;
|
200
|
+
|
201
|
+
if (!me.dragListenersAdded) {
|
202
|
+
domListeners.push(
|
203
|
+
{'drag:end' : me.onDragEnd, scope: me, delegate: 'neo-circle-item'},
|
204
|
+
{'drag:start': me.onDragStart, scope: me, delegate: 'neo-circle-item'}
|
205
|
+
);
|
206
|
+
|
207
|
+
me.addDomListeners(domListeners);
|
208
|
+
me.dragListenersAdded = true;
|
209
|
+
}
|
210
|
+
});
|
211
|
+
}
|
212
|
+
|
182
213
|
/**
|
183
214
|
* Triggered after the innerRadius config got changed
|
184
215
|
* @param {Number} value
|
@@ -244,10 +275,7 @@ class Circle extends Component {
|
|
244
275
|
let me = this;
|
245
276
|
|
246
277
|
if (oldValue && me.rendered) {
|
247
|
-
|
248
|
-
me.updateOuterCircle(true);
|
249
|
-
}
|
250
|
-
|
278
|
+
!me.collapsed && me.updateOuterCircle(true);
|
251
279
|
me.updateItemPositions();
|
252
280
|
}
|
253
281
|
}
|
@@ -365,7 +393,7 @@ class Circle extends Component {
|
|
365
393
|
}
|
366
394
|
|
367
395
|
/**
|
368
|
-
* @param data
|
396
|
+
* @param {Object} data
|
369
397
|
*/
|
370
398
|
collapseItem(data) {
|
371
399
|
let me = this,
|
@@ -383,7 +411,7 @@ class Circle extends Component {
|
|
383
411
|
}
|
384
412
|
|
385
413
|
/**
|
386
|
-
* @param {Boolean}
|
414
|
+
* @param {Boolean} silent=false
|
387
415
|
*/
|
388
416
|
createBacksideItems(silent=false) {
|
389
417
|
let me = this,
|
@@ -411,22 +439,25 @@ class Circle extends Component {
|
|
411
439
|
}
|
412
440
|
|
413
441
|
/**
|
414
|
-
* @param {Number}
|
415
|
-
* @param {Boolean}
|
442
|
+
* @param {Number} startIndex=0
|
443
|
+
* @param {Boolean} silent=false
|
416
444
|
*/
|
417
445
|
createItems(startIndex=0, silent=false) {
|
418
446
|
let me = this,
|
419
447
|
frontEl = me.getFrontEl(),
|
448
|
+
itemCls = ['neo-circle-item'],
|
420
449
|
itemPositions = me.calculateItemPositions(),
|
421
450
|
itemSize = me.itemSize,
|
422
451
|
countItems = Math.min(me.store.getCount(), me.maxItems),
|
423
452
|
i = startIndex,
|
424
453
|
vdom = me.vdom;
|
425
454
|
|
455
|
+
me.draggable && itemCls.push('neo-draggable');
|
456
|
+
|
426
457
|
for (; i < countItems; i++) {
|
427
458
|
frontEl.cn.push({
|
428
459
|
id : me.getItemId(i),
|
429
|
-
cls :
|
460
|
+
cls : itemCls,
|
430
461
|
tabIndex: -1,
|
431
462
|
style: {
|
432
463
|
height: itemSize + 'px',
|
@@ -606,6 +637,44 @@ class Circle extends Component {
|
|
606
637
|
this.flipCircle();
|
607
638
|
}
|
608
639
|
|
640
|
+
/**
|
641
|
+
* @param data
|
642
|
+
*/
|
643
|
+
onDragEnd(data) {
|
644
|
+
console.log('onDragEnd', data);
|
645
|
+
}
|
646
|
+
|
647
|
+
/**
|
648
|
+
* @param data
|
649
|
+
*/
|
650
|
+
onDragStart(data) {
|
651
|
+
console.log('onDragStart', data);
|
652
|
+
|
653
|
+
let me = this,
|
654
|
+
wrapperStyle = me.wrapperStyle || {};
|
655
|
+
|
656
|
+
me.isDragging = true;
|
657
|
+
|
658
|
+
if (!me.dragZone) {
|
659
|
+
me.dragZone = Neo.create({
|
660
|
+
module : DragZone,
|
661
|
+
appName : me.appName,
|
662
|
+
bodyCursorStyle: 'move !important',
|
663
|
+
dragElement : me.vdom,
|
664
|
+
dragProxyConfig: {vdom: me.getProxyVdom()},
|
665
|
+
owner : me,
|
666
|
+
useProxyWrapper: false,
|
667
|
+
...me.dragZoneConfig
|
668
|
+
});
|
669
|
+
}
|
670
|
+
|
671
|
+
me.dragZone.dragStart(data);
|
672
|
+
|
673
|
+
wrapperStyle.opacity = 0.7;
|
674
|
+
|
675
|
+
me.wrapperStyle = wrapperStyle;
|
676
|
+
}
|
677
|
+
|
609
678
|
/**
|
610
679
|
* @param {Object} data
|
611
680
|
*/
|
@@ -664,7 +733,7 @@ class Circle extends Component {
|
|
664
733
|
}
|
665
734
|
|
666
735
|
/**
|
667
|
-
* @param {Boolean}
|
736
|
+
* @param {Boolean} silent=false
|
668
737
|
*/
|
669
738
|
updateInnerCircle(silent=false) {
|
670
739
|
let me = this,
|
@@ -684,7 +753,7 @@ class Circle extends Component {
|
|
684
753
|
}
|
685
754
|
|
686
755
|
/**
|
687
|
-
* @param {Boolean}
|
756
|
+
* @param {Boolean} silent=false
|
688
757
|
*/
|
689
758
|
updateItemAngle(silent=false) {
|
690
759
|
let me = this,
|
@@ -702,8 +771,8 @@ class Circle extends Component {
|
|
702
771
|
|
703
772
|
/**
|
704
773
|
* @param {Number} value
|
705
|
-
* @param {Boolean}
|
706
|
-
* @param {Number}
|
774
|
+
* @param {Boolean} silent=false
|
775
|
+
* @param {Number} startIndex=0
|
707
776
|
*/
|
708
777
|
updateItemOpacity(value, silent=false, startIndex=0) {
|
709
778
|
let me = this,
|
@@ -720,7 +789,7 @@ class Circle extends Component {
|
|
720
789
|
}
|
721
790
|
|
722
791
|
/**
|
723
|
-
* @param {Boolean}
|
792
|
+
* @param {Boolean} silent=false
|
724
793
|
*/
|
725
794
|
updateItemPositions(silent=false) {
|
726
795
|
let me = this,
|
@@ -749,7 +818,7 @@ class Circle extends Component {
|
|
749
818
|
}
|
750
819
|
|
751
820
|
/**
|
752
|
-
* @param {Boolean}
|
821
|
+
* @param {Boolean} silent=false
|
753
822
|
*/
|
754
823
|
updateOuterCircle(silent=false) {
|
755
824
|
let me = this,
|
@@ -782,7 +851,7 @@ class Circle extends Component {
|
|
782
851
|
}
|
783
852
|
|
784
853
|
/**
|
785
|
-
* @param {Boolean}
|
854
|
+
* @param {Boolean} silent=false
|
786
855
|
*/
|
787
856
|
updateTitle(silent=false) {
|
788
857
|
let me = this,
|
package/src/container/Base.mjs
CHANGED
@@ -487,6 +487,23 @@ class Base extends Component {
|
|
487
487
|
}
|
488
488
|
}
|
489
489
|
|
490
|
+
/**
|
491
|
+
* Clears the item array
|
492
|
+
* @param {Boolean} [destroyItem=true]
|
493
|
+
* @param {Boolean} [silent=false]
|
494
|
+
*/
|
495
|
+
removeAll(destroyItem = true, silent = false) {
|
496
|
+
let me = this;
|
497
|
+
|
498
|
+
me.items = [];
|
499
|
+
|
500
|
+
me.getVdomItemsRoot().cn = [];
|
501
|
+
|
502
|
+
if(!silent || destroyItem){
|
503
|
+
me.update();
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
490
507
|
/**
|
491
508
|
* Removes a container item at a given index
|
492
509
|
* @param {Number} index
|
package/src/form/Container.mjs
CHANGED
@@ -151,11 +151,14 @@ class Container extends BaseContainer {
|
|
151
151
|
/**
|
152
152
|
* Updates the invalid state for all fields, which have updateValidationIndicators() implemented.
|
153
153
|
* This can be useful for create entity forms which show up "clean", when pressing a submit button.
|
154
|
+
* @returns {Boolean}
|
154
155
|
*/
|
155
156
|
validate() {
|
156
157
|
this.getFields().forEach(item => {
|
157
158
|
item.validate?.(false);
|
158
159
|
});
|
160
|
+
|
161
|
+
return this.isValid();
|
159
162
|
}
|
160
163
|
}
|
161
164
|
|
package/src/list/Circle.mjs
CHANGED
@@ -181,16 +181,17 @@ class DragDrop extends Base {
|
|
181
181
|
* @returns {Object}
|
182
182
|
*/
|
183
183
|
getEventData(event) {
|
184
|
-
|
184
|
+
let path = event.path || event.composedPath(),
|
185
|
+
detail = event.detail,
|
185
186
|
|
186
|
-
|
187
|
+
e = {
|
187
188
|
...DomEvents.getEventData(event.detail.originalEvent),
|
188
|
-
clientX:
|
189
|
-
clientY:
|
189
|
+
clientX: detail.clientX,
|
190
|
+
clientY: detail.clientY
|
190
191
|
};
|
191
192
|
|
192
|
-
if (
|
193
|
-
e.targetPath =
|
193
|
+
if (detail.eventPath) {
|
194
|
+
e.targetPath = detail.eventPath.map(e => DomEvents.getTargetData(e));
|
194
195
|
} else {
|
195
196
|
e.targetPath = e.path;
|
196
197
|
}
|