neo.mjs 2.3.15 → 2.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/README.md +11 -2
- package/apps/covid/Util.mjs +1 -3
- package/apps/covid/view/GalleryContainer.mjs +0 -1
- package/apps/covid/view/GalleryContainerController.mjs +1 -5
- package/apps/covid/view/HelixContainer.mjs +0 -1
- package/apps/covid/view/HelixContainerController.mjs +1 -4
- package/apps/covid/view/MainContainer.mjs +1 -1
- package/apps/covid/view/MainContainerController.mjs +0 -7
- package/apps/covid/view/MainContainerModel.mjs +0 -1
- package/apps/covid/view/TableContainer.mjs +0 -1
- package/apps/covid/view/TableContainerController.mjs +0 -3
- package/apps/covid/view/WorldMapComponent.mjs +1 -2
- package/apps/covid/view/WorldMapContainerController.mjs +0 -2
- package/apps/covid/view/country/Gallery.mjs +0 -2
- package/apps/covid/view/country/Helix.mjs +0 -3
- package/apps/covid/view/mapboxGl/Container.mjs +1 -1
- package/apps/covid/view/mapboxGl/ContainerController.mjs +1 -6
- package/apps/krausest/TableCollection.mjs +0 -1
- package/apps/krausest/view/MainComponent.mjs +0 -1
- package/apps/krausest/view/MainComponentController.mjs +0 -1
- package/apps/krausest/view/TableComponent.mjs +0 -2
- package/apps/realworld/api/Article.mjs +1 -4
- package/apps/realworld/api/Base.mjs +0 -5
- package/apps/realworld/api/Favorite.mjs +1 -3
- package/apps/realworld/api/Profile.mjs +1 -3
- package/apps/realworld/api/config.mjs +2 -2
- package/apps/realworld/view/HeaderComponent.mjs +1 -2
- package/apps/realworld/view/HomeComponent.mjs +0 -9
- package/apps/realworld/view/MainContainerController.mjs +0 -13
- package/apps/realworld/view/article/CommentComponent.mjs +1 -3
- package/apps/realworld/view/article/Component.mjs +0 -5
- package/apps/realworld/view/article/CreateCommentComponent.mjs +1 -5
- package/apps/realworld/view/article/PreviewComponent.mjs +1 -3
- package/apps/realworld/view/article/TagListComponent.mjs +1 -5
- package/apps/realworld/view/user/ProfileComponent.mjs +0 -6
- package/apps/realworld/view/user/SettingsComponent.mjs +1 -5
- package/apps/realworld/view/user/SignUpComponent.mjs +0 -1
- package/apps/realworld2/api/Article.mjs +1 -4
- package/apps/realworld2/api/Base.mjs +0 -5
- package/apps/realworld2/api/Favorite.mjs +1 -3
- package/apps/realworld2/api/Profile.mjs +1 -3
- package/apps/realworld2/view/HeaderToolbarController.mjs +1 -2
- package/apps/realworld2/view/HomeContainer.mjs +1 -2
- package/apps/realworld2/view/MainContainerController.mjs +1 -14
- package/apps/realworld2/view/article/Gallery.mjs +1 -3
- package/apps/realworld2/view/article/GalleryContainer.mjs +1 -2
- package/apps/realworld2/view/article/Helix.mjs +1 -3
- package/apps/realworld2/view/article/HelixContainer.mjs +1 -3
- package/apps/realworld2/view/article/PreviewComponent.mjs +1 -3
- package/apps/realworld2/view/article/TagListComponent.mjs +1 -5
- package/apps/realworld2/view/user/LoginFormContainer.mjs +1 -2
- package/apps/sharedcovid/Util.mjs +1 -3
- package/apps/sharedcovid/view/GalleryContainer.mjs +0 -1
- package/apps/sharedcovid/view/GalleryContainerController.mjs +1 -5
- package/apps/sharedcovid/view/HelixContainer.mjs +0 -1
- package/apps/sharedcovid/view/HelixContainerController.mjs +1 -4
- package/apps/sharedcovid/view/MainContainer.mjs +1 -1
- package/apps/sharedcovid/view/MainContainerModel.mjs +0 -1
- package/apps/sharedcovid/view/TableContainer.mjs +0 -1
- package/apps/sharedcovid/view/TableContainerController.mjs +0 -3
- package/apps/sharedcovid/view/WorldMapComponent.mjs +1 -2
- package/apps/sharedcovid/view/WorldMapContainerController.mjs +0 -2
- package/apps/sharedcovid/view/country/Gallery.mjs +0 -2
- package/apps/sharedcovid/view/country/Helix.mjs +0 -3
- package/apps/sharedcovid/view/mapboxGl/Container.mjs +0 -1
- package/apps/sharedcovid/view/mapboxGl/ContainerController.mjs +1 -5
- package/apps/shareddialog/view/MainContainerController.mjs +0 -18
- package/apps/shareddialog2/view/MainContainerController.mjs +1 -2
- package/apps/website/view/MainContainerController.mjs +0 -4
- package/buildScripts/webpack/development/webpack.config.main.js +2 -1
- package/buildScripts/webpack/production/webpack.config.main.js +2 -1
- package/examples/ConfigurationViewport.mjs +0 -4
- package/examples/calendar/basic/MainContainerController.mjs +0 -1
- package/examples/component/coronaGallery/CountryGallery.mjs +1 -4
- package/examples/component/coronaGallery/MainContainer.mjs +0 -2
- package/examples/component/coronaHelix/CountryHelix.mjs +0 -4
- package/examples/component/coronaHelix/MainContainer.mjs +0 -2
- package/examples/component/gallery/MainContainer.mjs +0 -2
- package/examples/component/helix/MainContainer.mjs +0 -2
- package/examples/component/splitter/MainContainer.mjs +0 -2
- package/examples/core/config/MainContainer.mjs +1 -3
- package/examples/dialog/MainContainer.mjs +1 -5
- package/examples/list/animate/List.mjs +50 -0
- package/examples/list/animate/MainContainer.mjs +79 -0
- package/examples/list/animate/MainModel.mjs +33 -0
- package/examples/list/animate/MainStore.mjs +31 -0
- package/examples/list/animate/app.mjs +8 -0
- package/examples/list/animate/index.html +11 -0
- package/examples/list/animate/neo-config.json +7 -0
- package/examples/list/base/neo-config.json +1 -1
- package/examples/model/advanced/MainContainerController.mjs +0 -12
- package/examples/model/dialog/EditUserDialogController.mjs +1 -3
- package/examples/model/dialog/MainContainerController.mjs +1 -2
- package/examples/model/extendedClass/MainContainerController.mjs +0 -7
- package/examples/model/inline/MainContainerController.mjs +0 -7
- package/examples/model/inlineNoModel/MainContainerController.mjs +1 -6
- package/examples/model/multiWindow/EditUserDialogController.mjs +1 -3
- package/examples/model/multiWindow/MainContainerController.mjs +1 -3
- package/examples/model/multiWindow/ViewportController.mjs +1 -3
- package/examples/model/nestedData/MainContainerController.mjs +1 -8
- package/examples/tab/container/MainContainer.mjs +1 -6
- package/examples/todoList/version2/TodoList.mjs +1 -1
- package/examples/tree/MainContainer.mjs +0 -2
- package/package.json +11 -11
- package/resources/scss/src/examples/list/animate/List.scss +30 -0
- package/src/Main.mjs +7 -16
- package/src/Neo.mjs +1 -4
- package/src/button/Menu.mjs +0 -1
- package/src/button/Split.mjs +0 -4
- package/src/calendar/store/Events.mjs +0 -1
- package/src/calendar/view/DayComponent.mjs +0 -1
- package/src/calendar/view/EditEventContainer.mjs +0 -7
- package/src/calendar/view/MainContainer.mjs +0 -15
- package/src/calendar/view/MainContainerModel.mjs +0 -2
- package/src/calendar/view/SettingsContainer.mjs +0 -4
- package/src/calendar/view/YearComponent.mjs +0 -9
- package/src/calendar/view/calendars/Container.mjs +0 -1
- package/src/calendar/view/calendars/EditContainer.mjs +0 -5
- package/src/calendar/view/calendars/List.mjs +0 -5
- package/src/calendar/view/month/Component.mjs +0 -12
- package/src/calendar/view/settings/GeneralContainer.mjs +0 -3
- package/src/calendar/view/settings/MonthContainer.mjs +0 -3
- package/src/calendar/view/settings/WeekContainer.mjs +0 -5
- package/src/calendar/view/settings/YearContainer.mjs +0 -3
- package/src/calendar/view/week/Component.mjs +0 -16
- package/src/calendar/view/week/EventDragZone.mjs +0 -3
- package/src/calendar/view/week/TimeAxisComponent.mjs +0 -1
- package/src/calendar/view/week/plugin/DragDrop.mjs +0 -10
- package/src/calendar/view/week/plugin/EventResizable.mjs +0 -3
- package/src/collection/Base.mjs +8 -24
- package/src/collection/Filter.mjs +0 -1
- package/src/collection/Sorter.mjs +0 -3
- package/src/component/Base.mjs +1 -3
- package/src/component/Chip.mjs +0 -2
- package/src/component/Circle.mjs +0 -18
- package/src/component/DateSelector.mjs +0 -13
- package/src/component/Gallery.mjs +0 -12
- package/src/component/Helix.mjs +0 -14
- package/src/component/Splitter.mjs +0 -3
- package/src/component/mwc/TextField.mjs +0 -1
- package/src/component/wrapper/AmChart.mjs +1 -1
- package/src/component/wrapper/MapboxGL.mjs +0 -5
- package/src/container/Base.mjs +1 -7
- package/src/container/Panel.mjs +0 -3
- package/src/controller/Application.mjs +0 -1
- package/src/controller/Base.mjs +0 -1
- package/src/controller/Component.mjs +1 -4
- package/src/core/Base.mjs +2 -3
- package/src/core/Compare.mjs +0 -1
- package/src/core/IdGenerator.mjs +1 -3
- package/src/core/Observable.mjs +0 -3
- package/src/core/Util.mjs +0 -1
- package/src/core/_export.mjs +1 -2
- package/src/data/RecordFactory.mjs +1 -6
- package/src/data/Store.mjs +0 -10
- package/src/data/connection/Xhr.mjs +0 -6
- package/src/dialog/Base.mjs +0 -10
- package/src/draggable/DragProxyComponent.mjs +1 -3
- package/src/draggable/DragZone.mjs +0 -6
- package/src/draggable/DropZone.mjs +1 -7
- package/src/draggable/list/DragZone.mjs +1 -7
- package/src/draggable/tab/header/toolbar/SortZone.mjs +1 -3
- package/src/draggable/toolbar/DragZone.mjs +1 -5
- package/src/draggable/toolbar/SortZone.mjs +0 -5
- package/src/draggable/tree/DragZone.mjs +1 -4
- package/src/filter/BooleanContainer.mjs +0 -1
- package/src/filter/NumberContainer.mjs +0 -2
- package/src/filter/ToggleOperatorsButton.mjs +1 -3
- package/src/form/Container.mjs +0 -2
- package/src/form/Fieldset.mjs +0 -1
- package/src/form/field/Base.mjs +0 -2
- package/src/form/field/CheckBox.mjs +0 -5
- package/src/form/field/Color.mjs +0 -3
- package/src/form/field/Date.mjs +0 -4
- package/src/form/field/Display.mjs +0 -1
- package/src/form/field/Picker.mjs +0 -9
- package/src/form/field/Range.mjs +0 -1
- package/src/form/field/Select.mjs +22 -20
- package/src/form/field/Text.mjs +0 -15
- package/src/form/field/Time.mjs +0 -7
- package/src/form/field/trigger/Base.mjs +0 -2
- package/src/form/field/trigger/Clear.mjs +0 -3
- package/src/form/field/trigger/CopyToClipboard.mjs +0 -3
- package/src/form/field/trigger/Picker.mjs +0 -1
- package/src/form/field/trigger/SpinDown.mjs +0 -1
- package/src/form/field/trigger/SpinUp.mjs +0 -1
- package/src/form/field/trigger/SpinUpDown.mjs +0 -1
- package/src/form/field/trigger/Time.mjs +0 -1
- package/src/grid/Container.mjs +1 -4
- package/src/grid/header/Toolbar.mjs +1 -5
- package/src/list/Base.mjs +39 -8
- package/src/list/Color.mjs +0 -3
- package/src/list/Component.mjs +0 -3
- package/src/list/plugin/Animate.mjs +176 -0
- package/src/main/DomAccess.mjs +7 -22
- package/src/main/DomEvents.mjs +42 -75
- package/src/main/addon/AmCharts.mjs +1 -10
- package/src/main/addon/AnalyticsByGoogle.mjs +1 -2
- package/src/main/addon/CloneNode.mjs +0 -2
- package/src/main/addon/Cookie.mjs +0 -3
- package/src/main/addon/DragDrop.mjs +0 -9
- package/src/main/addon/HighlightJS.mjs +1 -5
- package/src/main/addon/MapboxGL.mjs +1 -14
- package/src/main/addon/Mwc.mjs +0 -2
- package/src/main/addon/Siesta.mjs +0 -1
- package/src/main/addon/Stylesheet.mjs +0 -4
- package/src/main/addon/WindowPosition.mjs +1 -6
- package/src/main/draggable/sensor/Mouse.mjs +0 -4
- package/src/main/draggable/sensor/Touch.mjs +0 -4
- package/src/main/mixin/DeltaUpdates.mjs +0 -8
- package/src/main/mixin/TouchDomEvents.mjs +1 -7
- package/src/manager/Base.mjs +0 -2
- package/src/manager/Component.mjs +0 -3
- package/src/manager/DomEvent.mjs +1 -6
- package/src/manager/Focus.mjs +0 -7
- package/src/manager/Instance.mjs +0 -1
- package/src/manager/Store.mjs +0 -4
- package/src/menu/List.mjs +0 -6
- package/src/model/Component.mjs +3 -15
- package/src/plugin/Base.mjs +0 -1
- package/src/plugin/Resizable.mjs +0 -8
- package/src/selection/CircleModel.mjs +1 -5
- package/src/selection/DateSelectorModel.mjs +1 -9
- package/src/selection/GalleryModel.mjs +0 -9
- package/src/selection/HelixModel.mjs +0 -9
- package/src/selection/ListModel.mjs +0 -8
- package/src/selection/Model.mjs +0 -8
- package/src/selection/menu/ListModel.mjs +0 -2
- package/src/selection/table/CellColumnModel.mjs +0 -4
- package/src/selection/table/CellColumnRowModel.mjs +0 -4
- package/src/selection/table/CellModel.mjs +0 -8
- package/src/selection/table/CellRowModel.mjs +0 -6
- package/src/selection/table/ColumnModel.mjs +0 -6
- package/src/selection/table/RowModel.mjs +0 -5
- package/src/tab/Container.mjs +0 -6
- package/src/tab/header/Button.mjs +1 -2
- package/src/tab/header/Toolbar.mjs +0 -1
- package/src/table/Container.mjs +0 -8
- package/src/table/View.mjs +0 -4
- package/src/table/header/Button.mjs +0 -6
- package/src/table/header/Toolbar.mjs +1 -2
- package/src/tree/List.mjs +0 -4
- package/src/util/Css.mjs +0 -1
- package/src/util/Date.mjs +0 -2
- package/src/util/Function.mjs +0 -2
- package/src/util/HashHistory.mjs +0 -3
- package/src/util/KeyNavigation.mjs +0 -5
- package/src/{core → util}/Logger.mjs +5 -17
- package/src/util/Matrix.mjs +0 -3
- package/src/util/VDom.mjs +0 -5
- package/src/util/_export.mjs +2 -1
- package/src/vdom/Helper.mjs +0 -3
- package/src/vdom/VNode.mjs +0 -1
- package/src/worker/App.mjs +0 -7
- package/src/worker/Base.mjs +0 -6
- package/src/worker/Canvas.mjs +0 -2
- package/src/worker/Manager.mjs +1 -3
- package/src/worker/Message.mjs +0 -1
- package/src/worker/mixin/RemoteMethodAccess.mjs +0 -3
- package/test/siesta/siesta.js +2 -1
- package/test/siesta/tests/ClassConfigsAndFields.mjs +69 -0
- package/test/siesta/tests/ClassSystem.mjs +1 -1
package/src/list/Base.mjs
CHANGED
|
@@ -20,6 +20,10 @@ class Base extends Component {
|
|
|
20
20
|
* @protected
|
|
21
21
|
*/
|
|
22
22
|
ntype: 'list',
|
|
23
|
+
/**
|
|
24
|
+
* @member {Boolean} animate_=false
|
|
25
|
+
*/
|
|
26
|
+
animate_: false,
|
|
23
27
|
/**
|
|
24
28
|
* True will destroy the used collection / store when the component gets destroyed
|
|
25
29
|
* @member {Boolean} autoDestroyStore=true
|
|
@@ -67,6 +71,11 @@ class Base extends Component {
|
|
|
67
71
|
* @member {Object} keys
|
|
68
72
|
*/
|
|
69
73
|
keys: {},
|
|
74
|
+
/**
|
|
75
|
+
* config values for Neo.list.plugin.Animate
|
|
76
|
+
* @member {Object} pluginAnimateConfig=null
|
|
77
|
+
*/
|
|
78
|
+
pluginAnimateConfig: null,
|
|
70
79
|
/**
|
|
71
80
|
* Either pass a selection.Model module, an instance or a config object
|
|
72
81
|
* @member {Object|Neo.selection.Model} selectionModel_=null
|
|
@@ -94,7 +103,6 @@ class Base extends Component {
|
|
|
94
103
|
}}
|
|
95
104
|
|
|
96
105
|
/**
|
|
97
|
-
*
|
|
98
106
|
* @param {Object} config
|
|
99
107
|
*/
|
|
100
108
|
constructor(config) {
|
|
@@ -110,6 +118,28 @@ class Base extends Component {
|
|
|
110
118
|
me.domListeners = domListeners;
|
|
111
119
|
}
|
|
112
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Triggered after the animate config got changed
|
|
123
|
+
* @param {Boolean} value
|
|
124
|
+
* @param {Boolean} oldValue
|
|
125
|
+
* @protected
|
|
126
|
+
*/
|
|
127
|
+
afterSetAnimate(value, oldValue) {
|
|
128
|
+
value && import('./plugin/Animate.mjs').then(module => {
|
|
129
|
+
let me = this,
|
|
130
|
+
plugins = me.plugins || [];
|
|
131
|
+
|
|
132
|
+
plugins.push({
|
|
133
|
+
module : module.default,
|
|
134
|
+
appName: me.appName,
|
|
135
|
+
flag : 'animate',
|
|
136
|
+
...me.pluginAnimateConfig
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
me.plugins = plugins;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
113
143
|
/**
|
|
114
144
|
* Triggered after the disableSelection config got changed
|
|
115
145
|
* @param {Boolean} value
|
|
@@ -236,6 +266,10 @@ class Base extends Component {
|
|
|
236
266
|
};
|
|
237
267
|
|
|
238
268
|
switch (Neo.typeOf(itemContent)) {
|
|
269
|
+
case null: {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
|
|
239
273
|
case 'Array': {
|
|
240
274
|
item.cn = itemContent;
|
|
241
275
|
break;
|
|
@@ -283,12 +317,14 @@ class Base extends Component {
|
|
|
283
317
|
*/
|
|
284
318
|
createItems(silent=false) {
|
|
285
319
|
let me = this,
|
|
286
|
-
vdom = me.vdom
|
|
320
|
+
vdom = me.vdom,
|
|
321
|
+
listItem;
|
|
287
322
|
|
|
288
323
|
vdom.cn = [];
|
|
289
324
|
|
|
290
325
|
me.store.items.forEach((item, index) => {
|
|
291
|
-
|
|
326
|
+
listItem = me.createItem(item, index);
|
|
327
|
+
listItem && vdom.cn.push(listItem);
|
|
292
328
|
});
|
|
293
329
|
|
|
294
330
|
if (silent) {
|
|
@@ -327,7 +363,6 @@ class Base extends Component {
|
|
|
327
363
|
}
|
|
328
364
|
|
|
329
365
|
/**
|
|
330
|
-
*
|
|
331
366
|
* @param {Number|String} recordId
|
|
332
367
|
* @returns {String}
|
|
333
368
|
*/
|
|
@@ -336,7 +371,6 @@ class Base extends Component {
|
|
|
336
371
|
}
|
|
337
372
|
|
|
338
373
|
/**
|
|
339
|
-
*
|
|
340
374
|
* @param {String} vnodeId
|
|
341
375
|
* @returns {String|Number} itemId
|
|
342
376
|
*/
|
|
@@ -361,7 +395,6 @@ class Base extends Component {
|
|
|
361
395
|
}
|
|
362
396
|
|
|
363
397
|
/**
|
|
364
|
-
*
|
|
365
398
|
* @param {Object} data
|
|
366
399
|
*/
|
|
367
400
|
onClick(data) {
|
|
@@ -390,7 +423,6 @@ class Base extends Component {
|
|
|
390
423
|
}
|
|
391
424
|
|
|
392
425
|
/**
|
|
393
|
-
*
|
|
394
426
|
* @param {Object} data
|
|
395
427
|
*/
|
|
396
428
|
onContainerClick(data) {
|
|
@@ -406,7 +438,6 @@ class Base extends Component {
|
|
|
406
438
|
}
|
|
407
439
|
|
|
408
440
|
/**
|
|
409
|
-
*
|
|
410
441
|
* @param {Object} node
|
|
411
442
|
* @param {Object} data
|
|
412
443
|
*/
|
package/src/list/Color.mjs
CHANGED
|
@@ -66,7 +66,6 @@ class Color extends Base {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
69
|
* @param {Number|String} recordId
|
|
71
70
|
* @returns {String}
|
|
72
71
|
*/
|
|
@@ -75,7 +74,6 @@ class Color extends Base {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
/**
|
|
78
|
-
*
|
|
79
77
|
* @param {Number|String} recordId
|
|
80
78
|
* @returns {String}
|
|
81
79
|
*/
|
|
@@ -84,7 +82,6 @@ class Color extends Base {
|
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
/**
|
|
87
|
-
*
|
|
88
85
|
* @param {String[]} items
|
|
89
86
|
*/
|
|
90
87
|
onSelect(items) {
|
package/src/list/Component.mjs
CHANGED
|
@@ -53,7 +53,6 @@ class Component extends Base {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
56
|
* @param {Number} index
|
|
58
57
|
* @returns {String}
|
|
59
58
|
*/
|
|
@@ -62,7 +61,6 @@ class Component extends Base {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
66
64
|
* @param {Number|String} recordId
|
|
67
65
|
* @returns {String}
|
|
68
66
|
*/
|
|
@@ -71,7 +69,6 @@ class Component extends Base {
|
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
/**
|
|
74
|
-
*
|
|
75
72
|
* @param {String} vnodeId
|
|
76
73
|
* @returns {String|Number} itemId
|
|
77
74
|
*/
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import Base from '../../plugin/Base.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class Neo.list.plugin.Animate
|
|
5
|
+
* @extends Neo.plugin.Base
|
|
6
|
+
*/
|
|
7
|
+
class Animate extends Base {
|
|
8
|
+
static getConfig() {return {
|
|
9
|
+
/**
|
|
10
|
+
* @member {String} className='Neo.list.plugin.Animate'
|
|
11
|
+
* @protected
|
|
12
|
+
*/
|
|
13
|
+
className: 'Neo.list.plugin.Animate',
|
|
14
|
+
/**
|
|
15
|
+
* Read only
|
|
16
|
+
* @member {Number|null} columns=null
|
|
17
|
+
*/
|
|
18
|
+
columns: null,
|
|
19
|
+
/**
|
|
20
|
+
* Value in px
|
|
21
|
+
* @member {Number} itemHeight=200
|
|
22
|
+
*/
|
|
23
|
+
itemHeight: 200,
|
|
24
|
+
/**
|
|
25
|
+
* Value in px
|
|
26
|
+
* @member {Number} itemMargin=10
|
|
27
|
+
*/
|
|
28
|
+
itemMargin: 10,
|
|
29
|
+
/**
|
|
30
|
+
* Value in px
|
|
31
|
+
* @member {Number} itemWidth=300
|
|
32
|
+
*/
|
|
33
|
+
itemWidth: 300,
|
|
34
|
+
/**
|
|
35
|
+
* @member {DOMRect|null} ownerRect=null
|
|
36
|
+
*/
|
|
37
|
+
ownerRect: null,
|
|
38
|
+
/**
|
|
39
|
+
* Read only
|
|
40
|
+
* @member {Number|null} rows=null
|
|
41
|
+
*/
|
|
42
|
+
rows: null
|
|
43
|
+
}}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {Object} config
|
|
47
|
+
*/
|
|
48
|
+
constructor(config) {
|
|
49
|
+
super(config);
|
|
50
|
+
|
|
51
|
+
let me = this;
|
|
52
|
+
|
|
53
|
+
me.adjustCreateItem();
|
|
54
|
+
|
|
55
|
+
me.owner.store.on({
|
|
56
|
+
filter: me.onFilter,
|
|
57
|
+
sort : me.onSort,
|
|
58
|
+
scope : me
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
adjustCreateItem() {
|
|
66
|
+
let me = this,
|
|
67
|
+
owner = me.owner;
|
|
68
|
+
|
|
69
|
+
me.ownerCreateItem = owner.createItem.bind(owner);
|
|
70
|
+
owner.createItem = me.createItem.bind(owner, me);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {Neo.list.plugin.Animate} me
|
|
75
|
+
* @param {Object} record
|
|
76
|
+
* @param {Number} index
|
|
77
|
+
* @returns {Object}
|
|
78
|
+
*/
|
|
79
|
+
createItem(me, record, index) {
|
|
80
|
+
let item = me.ownerCreateItem(record, index),
|
|
81
|
+
itemHeight = me.itemHeight,
|
|
82
|
+
itemWidth = me.itemWidth,
|
|
83
|
+
margin = me.itemMargin,
|
|
84
|
+
style = item.style || {},
|
|
85
|
+
column, row, x, y;
|
|
86
|
+
|
|
87
|
+
if (!me.ownerRect) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
column = index % me.columns;
|
|
92
|
+
row = Math.floor(index / me.columns);
|
|
93
|
+
x = column * (margin + itemWidth) + margin;
|
|
94
|
+
y = row * (margin + itemHeight) + margin;
|
|
95
|
+
|
|
96
|
+
Object.assign(style, {
|
|
97
|
+
height : `${itemHeight}px`,
|
|
98
|
+
position : 'absolute',
|
|
99
|
+
transform: `translate(${x}px, ${y}px)`,
|
|
100
|
+
width : `${itemWidth}px`
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
item.style = style;
|
|
104
|
+
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {Object} data
|
|
110
|
+
*/
|
|
111
|
+
onFilter(data) {
|
|
112
|
+
console.log('onFilter', data);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
*/
|
|
118
|
+
onOwnerMounted() {
|
|
119
|
+
let me = this;
|
|
120
|
+
|
|
121
|
+
Neo.main.DomAccess.getBoundingClientRect({
|
|
122
|
+
id: me.owner.id
|
|
123
|
+
}).then(rect => {
|
|
124
|
+
Object.assign(me, {
|
|
125
|
+
columns : Math.floor(rect.width / me.itemWidth),
|
|
126
|
+
ownerRect: rect,
|
|
127
|
+
rows : Math.floor(rect.height / me.itemHeight)
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {Object} data
|
|
134
|
+
* @param {Object[]} data.items
|
|
135
|
+
* @param {Object[]} data.previousItems
|
|
136
|
+
* @param {Neo.data.Store} data.scope
|
|
137
|
+
*/
|
|
138
|
+
onSort(data) {
|
|
139
|
+
let me = this,
|
|
140
|
+
hasChange = false,
|
|
141
|
+
keyProperty = data.scope.keyProperty,
|
|
142
|
+
owner = me.owner,
|
|
143
|
+
newVdomCn = [],
|
|
144
|
+
vdom = owner.vdom,
|
|
145
|
+
vdomMap = vdom.cn.map(e => e.id),
|
|
146
|
+
fromIndex, itemId;
|
|
147
|
+
|
|
148
|
+
if (vdomMap.length > 0) {
|
|
149
|
+
data.items.forEach((item, index) => {
|
|
150
|
+
itemId = owner.getItemId(item[keyProperty]);
|
|
151
|
+
fromIndex = vdomMap.indexOf(itemId);
|
|
152
|
+
|
|
153
|
+
newVdomCn.push(vdom.cn[fromIndex]);
|
|
154
|
+
|
|
155
|
+
if (fromIndex !== index) {
|
|
156
|
+
hasChange = true;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
if (hasChange) {
|
|
161
|
+
owner.vdom.cn = newVdomCn;
|
|
162
|
+
|
|
163
|
+
owner.promiseVdomUpdate().then(() => {
|
|
164
|
+
// we need to ensure to get this call into the next animation frame
|
|
165
|
+
setTimeout(() => {
|
|
166
|
+
owner.createItems();
|
|
167
|
+
}, 50);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
Neo.applyClassConfig(Animate);
|
|
175
|
+
|
|
176
|
+
export {Animate as default};
|
package/src/main/DomAccess.mjs
CHANGED
|
@@ -76,7 +76,6 @@ class DomAccess extends Base {
|
|
|
76
76
|
}}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
79
|
* @param {Object} config
|
|
81
80
|
*/
|
|
82
81
|
constructor(config) {
|
|
@@ -99,14 +98,13 @@ class DomAccess extends Base {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
|
-
*
|
|
103
101
|
* @param {Object} data
|
|
104
102
|
* @param {Boolean} data.async
|
|
105
103
|
* @param {Boolean} [data.defer=false]
|
|
106
104
|
* @param {String} [data.src=true]
|
|
107
105
|
*/
|
|
108
106
|
addScript(data) {
|
|
109
|
-
|
|
107
|
+
let script = document.createElement('script');
|
|
110
108
|
|
|
111
109
|
if (!data.hasOwnProperty('async')) {
|
|
112
110
|
data.async = true;
|
|
@@ -118,17 +116,15 @@ class DomAccess extends Base {
|
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
/**
|
|
121
|
-
*
|
|
122
119
|
* @param {Object} data
|
|
123
120
|
* @param {String[]} data.cls
|
|
124
121
|
*/
|
|
125
122
|
applyBodyCls(data) {
|
|
126
|
-
|
|
123
|
+
let cls = data.cls || [];
|
|
127
124
|
document.body.classList.add(...cls);
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
/**
|
|
131
|
-
*
|
|
132
128
|
* @param {Object} data
|
|
133
129
|
* @param {String} data.command
|
|
134
130
|
* @returns {Object} data
|
|
@@ -237,7 +233,6 @@ class DomAccess extends Base {
|
|
|
237
233
|
}
|
|
238
234
|
|
|
239
235
|
/**
|
|
240
|
-
*
|
|
241
236
|
* @param {String} nodeId
|
|
242
237
|
* @returns {HTMLElement}
|
|
243
238
|
* @protected
|
|
@@ -251,7 +246,6 @@ class DomAccess extends Base {
|
|
|
251
246
|
}
|
|
252
247
|
|
|
253
248
|
/**
|
|
254
|
-
*
|
|
255
249
|
* @param {String} [nodeId='document.body']
|
|
256
250
|
* @returns {HTMLElement}
|
|
257
251
|
* @protected
|
|
@@ -277,10 +271,10 @@ class DomAccess extends Base {
|
|
|
277
271
|
script = document.createElement('script');
|
|
278
272
|
|
|
279
273
|
Object.assign(script, {
|
|
280
|
-
async
|
|
274
|
+
async,
|
|
281
275
|
onerror: reject,
|
|
282
276
|
onload : resolve,
|
|
283
|
-
src
|
|
277
|
+
src
|
|
284
278
|
});
|
|
285
279
|
|
|
286
280
|
document.head.appendChild(script);
|
|
@@ -299,7 +293,7 @@ class DomAccess extends Base {
|
|
|
299
293
|
link = document.createElement('link');
|
|
300
294
|
|
|
301
295
|
Object.assign(link, {
|
|
302
|
-
href
|
|
296
|
+
href,
|
|
303
297
|
onerror: reject,
|
|
304
298
|
onload : resolve,
|
|
305
299
|
rel : 'stylesheet',
|
|
@@ -332,14 +326,13 @@ class DomAccess extends Base {
|
|
|
332
326
|
|
|
333
327
|
Neo.worker.Manager.sendMessage(data.origin, {
|
|
334
328
|
action : 'reply',
|
|
335
|
-
data
|
|
329
|
+
data,
|
|
336
330
|
replyId: data.id,
|
|
337
331
|
success: true
|
|
338
332
|
}, [offscreen]);
|
|
339
333
|
}
|
|
340
334
|
|
|
341
335
|
/**
|
|
342
|
-
*
|
|
343
336
|
* @param {Object} data
|
|
344
337
|
* @param {String[]} data.attributes
|
|
345
338
|
* @param {Array} data.functions An array containing strings and/or objects
|
|
@@ -398,14 +391,13 @@ class DomAccess extends Base {
|
|
|
398
391
|
|
|
399
392
|
Neo.worker.Manager.sendMessage(data.origin, {
|
|
400
393
|
action : 'reply',
|
|
401
|
-
data
|
|
394
|
+
data,
|
|
402
395
|
replyId: data.id,
|
|
403
396
|
success: true
|
|
404
397
|
});
|
|
405
398
|
}
|
|
406
399
|
|
|
407
400
|
/**
|
|
408
|
-
*
|
|
409
401
|
* @param {Object} data
|
|
410
402
|
* @protected
|
|
411
403
|
*/
|
|
@@ -416,7 +408,6 @@ class DomAccess extends Base {
|
|
|
416
408
|
}
|
|
417
409
|
|
|
418
410
|
/**
|
|
419
|
-
*
|
|
420
411
|
* @param {Object} data
|
|
421
412
|
* @param {String} data.direction left, top
|
|
422
413
|
* @param {String} data.id
|
|
@@ -434,7 +425,6 @@ class DomAccess extends Base {
|
|
|
434
425
|
}
|
|
435
426
|
|
|
436
427
|
/**
|
|
437
|
-
*
|
|
438
428
|
* @param {Object} data
|
|
439
429
|
* @param {String} data.id
|
|
440
430
|
* @param {String} [data.behavior='smooth']
|
|
@@ -457,7 +447,6 @@ class DomAccess extends Base {
|
|
|
457
447
|
}
|
|
458
448
|
|
|
459
449
|
/**
|
|
460
|
-
*
|
|
461
450
|
* @param {Object} data
|
|
462
451
|
* @param {String} data.direction left, top
|
|
463
452
|
* @param {String} data.id
|
|
@@ -475,7 +464,6 @@ class DomAccess extends Base {
|
|
|
475
464
|
}
|
|
476
465
|
|
|
477
466
|
/**
|
|
478
|
-
*
|
|
479
467
|
* @param {Object} data
|
|
480
468
|
* @param {String} data.id
|
|
481
469
|
* @param {String} [data.behavior='smooth']
|
|
@@ -501,7 +489,6 @@ class DomAccess extends Base {
|
|
|
501
489
|
}
|
|
502
490
|
|
|
503
491
|
/**
|
|
504
|
-
*
|
|
505
492
|
* @param {Object} data
|
|
506
493
|
* @param {String} data.id
|
|
507
494
|
* @param {Number} [data.start=0]
|
|
@@ -557,7 +544,6 @@ class DomAccess extends Base {
|
|
|
557
544
|
}
|
|
558
545
|
|
|
559
546
|
/**
|
|
560
|
-
*
|
|
561
547
|
* @param {Object} data
|
|
562
548
|
* @param {String} [data.behavior='smooth'] // auto or smooth
|
|
563
549
|
* @param {String} [data.left=0]
|
|
@@ -572,7 +558,6 @@ class DomAccess extends Base {
|
|
|
572
558
|
}
|
|
573
559
|
|
|
574
560
|
/**
|
|
575
|
-
*
|
|
576
561
|
* @param {Object} data
|
|
577
562
|
* @protected
|
|
578
563
|
*/
|