/** * DevExtreme (ui/scroll_view/ui.scroll_view.js) * Version: 19.1.16 * Build date: Tue Oct 18 2022 * * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; var $ = require("../../core/renderer"); var devices = require("../../core/devices"); var windowUtils = require("../../core/utils/window"); var messageLocalization = require("../../localization/message"); var registerComponent = require("../../core/component_registrator"); var getPublicElement = require("../../core/utils/dom").getPublicElement; var extend = require("../../core/utils/extend").extend; var noop = require("../../core/utils/common").noop; var PullDownStrategy = require("./ui.scroll_view.native.pull_down"); var SwipeDownStrategy = require("./ui.scroll_view.native.swipe_down"); var SlideDownStrategy = require("./ui.scroll_view.native.slide_down"); var SimulatedStrategy = require("./ui.scroll_view.simulated"); var Scrollable = require("./ui.scrollable"); var LoadIndicator = require("../load_indicator"); var themes = require("./../themes"); var LoadPanel = require("../load_panel"); var SCROLLVIEW_CLASS = "dx-scrollview"; var SCROLLVIEW_CONTENT_CLASS = SCROLLVIEW_CLASS + "-content"; var SCROLLVIEW_TOP_POCKET_CLASS = SCROLLVIEW_CLASS + "-top-pocket"; var SCROLLVIEW_BOTTOM_POCKET_CLASS = SCROLLVIEW_CLASS + "-bottom-pocket"; var SCROLLVIEW_PULLDOWN_CLASS = SCROLLVIEW_CLASS + "-pull-down"; var SCROLLVIEW_REACHBOTTOM_CLASS = SCROLLVIEW_CLASS + "-scrollbottom"; var SCROLLVIEW_REACHBOTTOM_INDICATOR_CLASS = SCROLLVIEW_REACHBOTTOM_CLASS + "-indicator"; var SCROLLVIEW_REACHBOTTOM_TEXT_CLASS = SCROLLVIEW_REACHBOTTOM_CLASS + "-text"; var SCROLLVIEW_LOADPANEL = SCROLLVIEW_CLASS + "-loadpanel"; var refreshStrategies = { pullDown: PullDownStrategy, swipeDown: SwipeDownStrategy, slideDown: SlideDownStrategy, simulated: SimulatedStrategy }; var isServerSide = !windowUtils.hasWindow(); var scrollViewServerConfig = { finishLoading: noop, release: noop, refresh: noop, _optionChanged: function(args) { if ("onUpdated" !== args.name) { return this.callBase.apply(this, arguments) } } }; var ScrollView = Scrollable.inherit(isServerSide ? scrollViewServerConfig : { _getDefaultOptions: function() { return extend(this.callBase(), { pullingDownText: messageLocalization.format("dxScrollView-pullingDownText"), pulledDownText: messageLocalization.format("dxScrollView-pulledDownText"), refreshingText: messageLocalization.format("dxScrollView-refreshingText"), reachBottomText: messageLocalization.format("dxScrollView-reachBottomText"), onPullDown: null, onReachBottom: null, refreshStrategy: "pullDown" }) }, _defaultOptionsRules: function() { return this.callBase().concat([{ device: function() { var realDevice = devices.real(); return "android" === realDevice.platform }, options: { refreshStrategy: "swipeDown" } }, { device: function() { return "win" === devices.real().platform }, options: { refreshStrategy: "slideDown" } }, { device: function() { return themes.isMaterial() }, options: { pullingDownText: "", pulledDownText: "", refreshingText: "", reachBottomText: "" } }]) }, _init: function() { this.callBase(); this._loadingIndicatorEnabled = true }, _initScrollableMarkup: function() { this.callBase(); this.$element().addClass(SCROLLVIEW_CLASS); this._initContent(); this._initTopPocket(); this._initBottomPocket(); this._initLoadPanel() }, _initContent: function() { var $content = $("