@componyx/ui 0.0.0-stage → 1.0.4
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/AppSkin/AppSkin.css +1268 -0
- package/AppSkin/AppSkin.js +2748 -0
- package/AppSkin/Themes/Default.css +241 -0
- package/Base/Base.js +3407 -0
- package/Base/ComponentIcons.css +66 -0
- package/Base/Font/ComponentIcons.woff +0 -0
- package/Base/Font/UI.woff +0 -0
- package/Base/Library.js +8432 -0
- package/Base/NavigationManager.js +462 -0
- package/Base/ResponsiveTemplates.js +371 -0
- package/Base/Sanitizer.js +288 -0
- package/Base/Themes/Default.css +255 -0
- package/Base/UI.css +618 -0
- package/Base/UIResourcePath.js +6 -0
- package/Bindary/Bindary.js +2011 -0
- package/Bindary/Modules/Connection.js +216 -0
- package/Bindary/Modules/Core.js +854 -0
- package/Bindary/Modules/DataUpdater.js +351 -0
- package/Bindary/Modules/ExpressionEngine.js +347 -0
- package/Bindary/Modules/ProxyManager.js +482 -0
- package/Bindary/Modules/Renderer.js +605 -0
- package/Bindary/Modules/Router.js +291 -0
- package/Bindary/Modules/Scroller.js +89 -0
- package/Bindary/Modules/Template.js +1273 -0
- package/BookmarkSpy/BookmarkSpy.js +430 -0
- package/Box/Box.css +36 -0
- package/Box/Box.js +1685 -0
- package/Button/Button.css +470 -0
- package/Button/Button.js +1398 -0
- package/Button/Themes/Default.css +200 -0
- package/Carousel/Carousel.css +273 -0
- package/Carousel/Carousel.js +607 -0
- package/ColorButton/ColorButton.css +39 -0
- package/ColorButton/ColorButton.js +336 -0
- package/ColorPicker/ColorPicker.css +359 -0
- package/ColorPicker/ColorPicker.js +972 -0
- package/ComboBox/ComboBox.css +357 -0
- package/ComboBox/ComboBox.js +2342 -0
- package/ComboBox/Themes/Default.css +23 -0
- package/DataPager/DataPager.css +72 -0
- package/DataPager/DataPager.js +674 -0
- package/DatePicker/DatePicker.css +227 -0
- package/DatePicker/DatePicker.js +1531 -0
- package/DatePicker/Themes/Default.css +26 -0
- package/Dialog/Dialog.css +106 -0
- package/Dialog/Dialog.js +572 -0
- package/Dialog/Themes/Default.css +10 -0
- package/Editor/Data/Emoji.json +8285 -0
- package/Editor/Data/Special.json +1042 -0
- package/Editor/Editor.css +1562 -0
- package/Editor/Editor.js +4058 -0
- package/Editor/Font/Editor.woff +0 -0
- package/Editor/Modules/ComponentFactory.js +565 -0
- package/Editor/Modules/ContentManager.js +748 -0
- package/Editor/Modules/DialogManager.js +1234 -0
- package/Editor/Modules/EventManager.js +458 -0
- package/Editor/Modules/Format.js +950 -0
- package/Editor/Modules/History.js +191 -0
- package/Editor/Modules/LayoutState.js +379 -0
- package/Editor/Modules/ListManager.js +296 -0
- package/Editor/Modules/MenuManager.js +388 -0
- package/Editor/Modules/NodeManager.js +681 -0
- package/Editor/Modules/ParagraphButtons.js +122 -0
- package/Editor/Modules/Resizer.js +176 -0
- package/Editor/Modules/SelectionRange.js +564 -0
- package/Editor/Modules/SourceViewBuilder.js +212 -0
- package/Editor/Modules/SymbolPicker.js +208 -0
- package/Editor/Modules/Table.js +2327 -0
- package/Editor/Modules/TableDialog.js +757 -0
- package/Editor/Modules/Toolbar.js +375 -0
- package/Editor/Modules/TooltipMenu.js +125 -0
- package/Editor/Modules/Utility.js +131 -0
- package/Editor/Themes/Default.css +204 -0
- package/FileUpload/FileUpload.css +156 -0
- package/FileUpload/FileUpload.js +898 -0
- package/FileUpload/Themes/Default.css +17 -0
- package/Form/Form.css +1934 -0
- package/Form/Form.js +4943 -0
- package/Form/Modules/ActionManager.js +368 -0
- package/Form/Modules/BuildPanelManager.js +319 -0
- package/Form/Modules/ComponentFactory.js +468 -0
- package/Form/Modules/ComponentPanel.js +265 -0
- package/Form/Modules/ConfigPanelManager.js +685 -0
- package/Form/Modules/DataBinder.js +602 -0
- package/Form/Modules/DataObserver.js +717 -0
- package/Form/Modules/Draggable.js +756 -0
- package/Form/Modules/OptionsPanel.js +342 -0
- package/Form/Modules/Renderer.js +1889 -0
- package/Form/Modules/RuleEngine.js +585 -0
- package/Form/Modules/RulesPanel.js +1158 -0
- package/Form/Modules/Types.js +1709 -0
- package/Form/Modules/ValidationManager.js +194 -0
- package/Form/Themes/Default.css +216 -0
- package/FormField/FormField.css +468 -0
- package/FormField/FormField.js +576 -0
- package/FormField/Themes/Default.css +99 -0
- package/Grid/Grid.css +544 -0
- package/Grid/Grid.js +3761 -0
- package/Grid/Themes/Default.css +43 -0
- package/LICENSE +126 -0
- package/MaskedTextBox/MaskedTextBox.css +28 -0
- package/MaskedTextBox/MaskedTextBox.js +642 -0
- package/MaskedTextBox/Themes/Default.css +6 -0
- package/Menu/Menu.css +328 -0
- package/Menu/Menu.js +2386 -0
- package/Menu/Themes/Default.css +24 -0
- package/NumericBox/NumericBox.css +120 -0
- package/NumericBox/NumericBox.js +984 -0
- package/PanelBar/PanelBar.css +123 -0
- package/PanelBar/PanelBar.js +505 -0
- package/PanelBar/Themes/Default.css +51 -0
- package/PieChart/PieChart.css +95 -0
- package/PieChart/PieChart.js +820 -0
- package/PieChart/Themes/Default.css +9 -0
- package/README.md +178 -3
- package/Slider/Slider.css +348 -0
- package/Slider/Slider.js +1306 -0
- package/Slider/Themes/Default.css +44 -0
- package/TabStrip/TabStrip.css +52 -0
- package/TabStrip/TabStrip.js +362 -0
- package/TabStrip/Themes/Default.css +35 -0
- package/TimePicker/Themes/Default.css +30 -0
- package/TimePicker/TimePicker.css +253 -0
- package/TimePicker/TimePicker.js +1485 -0
- package/TooltipManager/Themes/Default.css +21 -0
- package/TooltipManager/TooltipManager.css +227 -0
- package/TooltipManager/TooltipManager.js +791 -0
- package/Validator/Validator.css +54 -0
- package/Validator/Validator.js +2508 -0
- package/componyx.html-data.json +619 -0
- package/index.js +27 -0
- package/package.json +43 -4
- package/types/AppSkin.d.ts +842 -0
- package/types/Base.d.ts +1034 -0
- package/types/Bindary.d.ts +1196 -0
- package/types/BookmarkSpy.d.ts +112 -0
- package/types/Box.d.ts +374 -0
- package/types/Button.d.ts +455 -0
- package/types/Carousel.d.ts +136 -0
- package/types/ColorButton.d.ts +120 -0
- package/types/ColorPicker.d.ts +225 -0
- package/types/ComboBox.d.ts +507 -0
- package/types/DataPager.d.ts +152 -0
- package/types/DatePicker.d.ts +354 -0
- package/types/Dialog.d.ts +160 -0
- package/types/Editor.d.ts +1289 -0
- package/types/FileUpload.d.ts +206 -0
- package/types/Form.d.ts +3078 -0
- package/types/FormField.d.ts +204 -0
- package/types/Grid.d.ts +911 -0
- package/types/Library.d.ts +1899 -0
- package/types/MaskedTextBox.d.ts +91 -0
- package/types/Menu.d.ts +577 -0
- package/types/NumericBox.d.ts +310 -0
- package/types/PanelBar.d.ts +223 -0
- package/types/PieChart.d.ts +224 -0
- package/types/ResponsiveTemplates.d.ts +108 -0
- package/types/Slider.d.ts +227 -0
- package/types/TabStrip.d.ts +185 -0
- package/types/TimePicker.d.ts +265 -0
- package/types/TooltipManager.d.ts +178 -0
- package/types/UI.d.ts +29 -0
- package/types/Validator.d.ts +653 -0
- package/types/index.d.ts +59 -0
- package/ui.css +11783 -0
- package/ui.js +79477 -0
- package/ui.min.css +138 -0
- package/ui.min.js +264 -0
- package/ui.min.js.map +1 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
|
|
2
|
+
await (async function ()
|
|
3
|
+
{
|
|
4
|
+
await import(`${$UI.getScriptResourcePath('Base.Bindary.Core')}`);
|
|
5
|
+
await import(`${$UI.getScriptResourcePath('Base.Bindary.Connection')}`);
|
|
6
|
+
await import(`${$UI.getScriptResourcePath('Base.Bindary.DataUpdater')}`);
|
|
7
|
+
const core = componyx.bindary_modules.core;
|
|
8
|
+
const connection = componyx.bindary_modules.connection;
|
|
9
|
+
const dataUpdater = componyx.bindary_modules.dataUpdater;
|
|
10
|
+
|
|
11
|
+
const router = componyx.bindary_modules.router =
|
|
12
|
+
{
|
|
13
|
+
getRouteIndex: function (routePath)
|
|
14
|
+
{
|
|
15
|
+
if (routePath == null)
|
|
16
|
+
return -1;
|
|
17
|
+
|
|
18
|
+
let path, match, index = -1;
|
|
19
|
+
|
|
20
|
+
while (!match && ++index < $bindary.routes.length)
|
|
21
|
+
{
|
|
22
|
+
path = $bindary.routes[index].path;
|
|
23
|
+
|
|
24
|
+
if ($bindary.routes[index].pathExp)
|
|
25
|
+
match = routePath.match(path);
|
|
26
|
+
else
|
|
27
|
+
match = path === routePath;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (match)
|
|
31
|
+
return index;
|
|
32
|
+
else
|
|
33
|
+
return -1;
|
|
34
|
+
},
|
|
35
|
+
load: function (routePath)
|
|
36
|
+
{
|
|
37
|
+
core.routeError = false;
|
|
38
|
+
|
|
39
|
+
let routeIndex = router.getRouteIndex(routePath);
|
|
40
|
+
|
|
41
|
+
router.trackHistory(routePath);
|
|
42
|
+
|
|
43
|
+
if (routeIndex == -1)
|
|
44
|
+
{
|
|
45
|
+
if ($bindary.routes.length && routePath) // with routes defined, a path that matches none of them is an error
|
|
46
|
+
router.error({ type: 'route', routePath: routePath });
|
|
47
|
+
|
|
48
|
+
return routeIndex;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if ($lib.isEmpty($bindary.routeIndex)) // first load
|
|
52
|
+
core.createTempViewContainer();
|
|
53
|
+
else if (router.unload($bindary.routeIndex, routePath) === false) // cancel unload when return value is false
|
|
54
|
+
return;
|
|
55
|
+
|
|
56
|
+
let route = $bindary.routes[routeIndex],
|
|
57
|
+
observing = ($lib.isEmpty(route.observing)) ? $bindary.observing : route.observing,
|
|
58
|
+
data = route.data,
|
|
59
|
+
viewURL = (core.parseExp(route, routePath, route.viewURL) || route.viewURL || ''),
|
|
60
|
+
controllerURL = (core.parseExp(route, routePath, route.controllerURL) || route.controllerURL || '');
|
|
61
|
+
|
|
62
|
+
// new route callback id
|
|
63
|
+
core.routeCallbackId = $lib.guid();
|
|
64
|
+
|
|
65
|
+
// store current route URL's
|
|
66
|
+
core.viewURL = (viewURL) ? $bindary.viewRootURL + viewURL : '';
|
|
67
|
+
core.controllerURL = (controllerURL) ? $bindary.controllerRootURL + controllerURL : '';
|
|
68
|
+
|
|
69
|
+
core.busy = true;
|
|
70
|
+
$bindary.route = route;
|
|
71
|
+
$bindary.routeIndex = routeIndex;
|
|
72
|
+
$bindary.routePath = routePath;
|
|
73
|
+
$bindary.controller = core.cache.controller[core.controllerURL];
|
|
74
|
+
|
|
75
|
+
core.routeRdy[routeIndex] = false;
|
|
76
|
+
core.data = undefined;
|
|
77
|
+
core.preLoad();
|
|
78
|
+
|
|
79
|
+
$bindary.routeData = core.cache.routeData[routeIndex] = (core.cache.routeData[routeIndex]) ? core.cache.routeData[routeIndex] : (observing) ? $bindary.observe({}, core.dataLabel[1]) : {};
|
|
80
|
+
$bindary.viewData = core.cache.viewData[routePath] = (core.cache.viewData[routePath]) ? core.cache.viewData[routePath] : (observing) ? $bindary.observe({}, core.dataLabel[2]) : {};
|
|
81
|
+
|
|
82
|
+
if (core.controllerURL && $bindary.controller)
|
|
83
|
+
core.srcState(core.controllerURL, true);
|
|
84
|
+
|
|
85
|
+
if (core.viewURL)
|
|
86
|
+
{
|
|
87
|
+
core.srcState(core.viewURL, false);
|
|
88
|
+
|
|
89
|
+
if (!core.cache.view[core.viewURL])
|
|
90
|
+
{
|
|
91
|
+
core.xhr.push($lib.load({
|
|
92
|
+
url: core.viewURL,
|
|
93
|
+
onSuccess: function (args)
|
|
94
|
+
{
|
|
95
|
+
core.srcState(core.viewURL, true);
|
|
96
|
+
core.cache.view[core.viewURL] =
|
|
97
|
+
{
|
|
98
|
+
data: args.data,
|
|
99
|
+
html: core.tempViewContainer.innerHTML,
|
|
100
|
+
script: args.script,
|
|
101
|
+
css: args.css,
|
|
102
|
+
title: args.title
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
core.tempViewContainer.innerHTML = '';
|
|
106
|
+
router.loaded();
|
|
107
|
+
},
|
|
108
|
+
onError: (args) => { router.error({ type: 'view', status: args.xhr?.status, url: core.viewURL }); }
|
|
109
|
+
}, core.tempViewContainer, null));
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
{
|
|
113
|
+
$lib.addHTML(core.cache.view[core.viewURL].data, null, null, function (args)
|
|
114
|
+
{
|
|
115
|
+
core.srcState(core.viewURL, true);
|
|
116
|
+
core.cache.view[core.viewURL].script = args.script;
|
|
117
|
+
core.cache.view[core.viewURL].css = args.css;
|
|
118
|
+
core.tempViewContainer.innerHTML = '';
|
|
119
|
+
router.loaded();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!$bindary.controller)
|
|
125
|
+
{
|
|
126
|
+
$bindary.controller = core.cache.controller[core.controllerURL] = {};
|
|
127
|
+
|
|
128
|
+
if (core.controllerURL)
|
|
129
|
+
{
|
|
130
|
+
core.srcState(core.controllerURL, false);
|
|
131
|
+
$lib.addScriptSource(core.controllerURL, null,
|
|
132
|
+
{
|
|
133
|
+
onComplete: function (args)
|
|
134
|
+
{
|
|
135
|
+
core.srcState(core.controllerURL, true);
|
|
136
|
+
router.loaded();
|
|
137
|
+
},
|
|
138
|
+
onError: function (args)
|
|
139
|
+
{
|
|
140
|
+
delete core.cache.controller[core.controllerURL]; // retry on a next visit instead of caching an empty controller
|
|
141
|
+
router.error({ type: 'controller', url: core.controllerURL });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let param =
|
|
148
|
+
{
|
|
149
|
+
dataRequest: connection.createDataRequestMsg(data, route.dataServerLoad, core.routeCallbackId, true),
|
|
150
|
+
routeReady: function (data) { router.loaded(data); }
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (core.fireEvent('dataRequest', [param]) !== false)
|
|
154
|
+
{
|
|
155
|
+
if (route.dataConnect != false && $bindary.dataServerURL)
|
|
156
|
+
connection.dataSend(param.dataRequest); // use default data retrieval
|
|
157
|
+
else
|
|
158
|
+
router.loaded(null); // no data source
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
loaded: function (dataMsg)
|
|
162
|
+
{
|
|
163
|
+
if (core.routeError)
|
|
164
|
+
return;
|
|
165
|
+
|
|
166
|
+
if (dataMsg !== undefined)
|
|
167
|
+
core.data = dataMsg;
|
|
168
|
+
|
|
169
|
+
if (core.data !== undefined && (!core.viewURL || core.cache.srcReady[core.viewURL]) && (!core.controllerURL || core.cache.srcReady[core.controllerURL]))
|
|
170
|
+
{
|
|
171
|
+
let error = router.isError(core.data);
|
|
172
|
+
|
|
173
|
+
core.busy = false;
|
|
174
|
+
|
|
175
|
+
if (core.data && !core.isRouteCallback(core.data) && !error) // null value means no data-source
|
|
176
|
+
return;
|
|
177
|
+
|
|
178
|
+
if (!error)
|
|
179
|
+
core.load();
|
|
180
|
+
|
|
181
|
+
dataUpdater.update(core.data);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
unload: function (routeIndex, routePath, windowUnload)
|
|
185
|
+
{
|
|
186
|
+
let advance = core.fireEvent('unload', [routeIndex, routePath, windowUnload]);
|
|
187
|
+
|
|
188
|
+
if (advance === false)
|
|
189
|
+
{
|
|
190
|
+
window.history.replaceState({ routePath: $bindary.routePath }, '', getFullPath($bindary.routePath)); // rewrite URL to previous one
|
|
191
|
+
return advance;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// clear timers
|
|
195
|
+
clearTimeout(core.liveBindTimerId);
|
|
196
|
+
core.clearPendingUpdate();
|
|
197
|
+
|
|
198
|
+
// abort active xhr's
|
|
199
|
+
$lib.each(core.xhr, function (xhr) { xhr.abort(true); });
|
|
200
|
+
|
|
201
|
+
if (!$bindary.caching)
|
|
202
|
+
$bindary.clearCache();
|
|
203
|
+
else
|
|
204
|
+
{
|
|
205
|
+
if (!$bindary.cacheRouteData)
|
|
206
|
+
delete core.cache.routeData[$bindary.routeIndex];
|
|
207
|
+
|
|
208
|
+
if (!$bindary.cacheViewData)
|
|
209
|
+
delete core.cache.viewData[$bindary.routePath];
|
|
210
|
+
|
|
211
|
+
if (!$bindary.cacheInternalTags)
|
|
212
|
+
$bindary.clearCache(true, true, true, false, false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
core.viewURL = core.controllerURL = null;
|
|
216
|
+
core.callbacks = {};
|
|
217
|
+
core.viewTree = null;
|
|
218
|
+
core.xhr = []; // clear xhr array
|
|
219
|
+
|
|
220
|
+
if ($bindary.clearViewOnUnload && core.getViewContainer())
|
|
221
|
+
core.getViewContainer().innerHTML = '';
|
|
222
|
+
|
|
223
|
+
if ($bindary.route && $bindary.route.dataServerUnload)
|
|
224
|
+
{
|
|
225
|
+
if (windowUnload)
|
|
226
|
+
$bindary.unload(null, $bindary.route.dataServerUnload);
|
|
227
|
+
else
|
|
228
|
+
$bindary.dataSend(null, $bindary.route.dataServerUnload, null, null, false);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
error: function (info)
|
|
232
|
+
{
|
|
233
|
+
if (core.routeError) // report only the first failure of a route load, view and controller may both fail
|
|
234
|
+
return;
|
|
235
|
+
|
|
236
|
+
core.routeError = true;
|
|
237
|
+
core.busy = false; // the route load has ended, so a next navigation (including Back) can proceed
|
|
238
|
+
|
|
239
|
+
if (core.tempViewContainer)
|
|
240
|
+
core.tempViewContainer.innerHTML = '';
|
|
241
|
+
|
|
242
|
+
$lib.each(core.xhr, (xhr) => { xhr.abort(true); }); // stop the remaining requests of this route
|
|
243
|
+
|
|
244
|
+
core.fireEvent('routeError', [Object.assign({ routePath: $bindary.routePath, route: $bindary.route }, info)]);
|
|
245
|
+
},
|
|
246
|
+
trackHistory: function (routePath)
|
|
247
|
+
{
|
|
248
|
+
core.historyAction = false;
|
|
249
|
+
|
|
250
|
+
if (core.allowHistoryScroll && window.history.length == core.historyLength && $bindary.routePath != routePath)
|
|
251
|
+
core.historyAction = true;
|
|
252
|
+
|
|
253
|
+
if ($lib.isEmpty($bindary.routeIndex)) // first load
|
|
254
|
+
{
|
|
255
|
+
let pos = window.JSON.parse(window.sessionStorage.getItem('scrollPosition'));
|
|
256
|
+
|
|
257
|
+
if (pos && pos.path === routePath)
|
|
258
|
+
{
|
|
259
|
+
core.historyAction = true;
|
|
260
|
+
core.scrollPos[routePath] = pos;
|
|
261
|
+
}
|
|
262
|
+
else
|
|
263
|
+
core.historyAction = false;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
core.historyLength = window.history.length;
|
|
267
|
+
core.allowHistoryScroll = !$bindary.prettyURL; // defaults to true for hash routes and to false for prettyURL's
|
|
268
|
+
},
|
|
269
|
+
isError(dataMsg)
|
|
270
|
+
{
|
|
271
|
+
let isError = false;
|
|
272
|
+
|
|
273
|
+
if (!dataMsg)
|
|
274
|
+
return;
|
|
275
|
+
|
|
276
|
+
if (!$lib.isArray(dataMsg))
|
|
277
|
+
dataMsg = [dataMsg];
|
|
278
|
+
|
|
279
|
+
$lib.each(dataMsg, function (msg)
|
|
280
|
+
{
|
|
281
|
+
return !(isError = (msg.isError) ? true : false); // break when error is found
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return isError;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
})();
|
|
288
|
+
|
|
289
|
+
var Router = componyx.bindary_modules.router;
|
|
290
|
+
|
|
291
|
+
export { Router as default };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
|
|
2
|
+
await (async function ()
|
|
3
|
+
{
|
|
4
|
+
await import(`${$UI.getScriptResourcePath('Base.Bindary.Core')}`);
|
|
5
|
+
const core = componyx.bindary_modules.core;
|
|
6
|
+
|
|
7
|
+
const scroller = componyx.bindary_modules.scroller =
|
|
8
|
+
{
|
|
9
|
+
routePath: '',
|
|
10
|
+
timeout: null,
|
|
11
|
+
anchor: null,
|
|
12
|
+
pos: null,
|
|
13
|
+
timerId: null,
|
|
14
|
+
|
|
15
|
+
init(anchorScroll, routePath)
|
|
16
|
+
{
|
|
17
|
+
const pos = core.scrollPos[$bindary.routePath];
|
|
18
|
+
|
|
19
|
+
scroller.routePath = routePath;
|
|
20
|
+
core.scrollableRoot = core.scrollableRoot || $lib.scrollableRoot();
|
|
21
|
+
core.scrollableRoot.scrollTop = 0;
|
|
22
|
+
clearTimeout(scroller.timerId);
|
|
23
|
+
scroller.timeout = new Date().getTime() + $bindary.scrollRetryTimeout;
|
|
24
|
+
|
|
25
|
+
if (!core.historyAction)
|
|
26
|
+
{
|
|
27
|
+
if (anchorScroll || $bindary.anchorScroll)
|
|
28
|
+
{
|
|
29
|
+
scroller.anchor = core.getAnchor();
|
|
30
|
+
|
|
31
|
+
if (scroller.anchor)
|
|
32
|
+
{
|
|
33
|
+
scroller.timerId = setTimeout(scroller.scrollToAnchor, 0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!pos || !(pos.y + pos.x)) return;
|
|
41
|
+
|
|
42
|
+
scroller.pos = pos;
|
|
43
|
+
scroller.timerId = setTimeout(scroller.scrollToPosition, 0);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
scrollToAnchor()
|
|
47
|
+
{
|
|
48
|
+
let el;
|
|
49
|
+
const { routePath, timeout, anchor } = scroller;
|
|
50
|
+
|
|
51
|
+
if ($bindary.routePath !== routePath) return;
|
|
52
|
+
|
|
53
|
+
if ((el = $lib('#' + anchor)) || (el = document.getElementsByName(anchor)[0]))
|
|
54
|
+
{
|
|
55
|
+
if (core.fireEvent('anchorScroll', [el], true) !== false)
|
|
56
|
+
{
|
|
57
|
+
$lib.scrollTo(el, null, 2);
|
|
58
|
+
}
|
|
59
|
+
} else if (new Date().getTime() <= timeout)
|
|
60
|
+
{
|
|
61
|
+
scroller.timerId = setTimeout(scroller.scrollToAnchor, 0);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
scrollToPosition()
|
|
66
|
+
{
|
|
67
|
+
const { routePath, timeout, pos } = scroller;
|
|
68
|
+
|
|
69
|
+
if ($bindary.routePath !== routePath || !core.historyAction) return;
|
|
70
|
+
|
|
71
|
+
const height = core.scrollableRoot.scrollHeight;
|
|
72
|
+
const width = core.scrollableRoot.scrollWidth;
|
|
73
|
+
|
|
74
|
+
if (new Date().getTime() > timeout || (width >= pos.width && height >= pos.height))
|
|
75
|
+
{
|
|
76
|
+
window.scrollTo(pos.x, pos.y);
|
|
77
|
+
core.historyAction = false;
|
|
78
|
+
} else
|
|
79
|
+
{
|
|
80
|
+
scroller.timerId = setTimeout(scroller.scrollToPosition, 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
})();
|
|
86
|
+
|
|
87
|
+
var Scroller = componyx.bindary_modules.scroller;
|
|
88
|
+
|
|
89
|
+
export { Scroller as default };
|