mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
ENH: model info display UI
Change-Id: I066c0e7f8ce87ec00b1141a1b44430444a819b42 (cherry picked from commit 05907a1a42da82737090d55046974d401f8af057)
This commit is contained in:
parent
0cc953ad41
commit
b4ffa91cb4
343 changed files with 54828 additions and 2 deletions
|
@ -83,7 +83,21 @@ var LangText={
|
||||||
"t88": "Remove",
|
"t88": "Remove",
|
||||||
"t89": "Open Containing Folder",
|
"t89": "Open Containing Folder",
|
||||||
"t90": "3D Model",
|
"t90": "3D Model",
|
||||||
"t91": "Download 3D models"
|
"t91": "Download 3D models",
|
||||||
|
"t92": "Create by",
|
||||||
|
"t93": "Remixed by",
|
||||||
|
"t94": "Shared by",
|
||||||
|
"t95": "Model Information",
|
||||||
|
"t96": "Accessories",
|
||||||
|
"t97": "Profile Information",
|
||||||
|
"t98": "Model name",
|
||||||
|
"t100":"Model description",
|
||||||
|
"t101":"BOM",
|
||||||
|
"t102":"Assembly Guide",
|
||||||
|
"t103":"Other",
|
||||||
|
"t104":"Profile name",
|
||||||
|
"t105":"Profile Author",
|
||||||
|
"t106":"Profile description"
|
||||||
},
|
},
|
||||||
"zh_CN": {
|
"zh_CN": {
|
||||||
"t1": "欢迎使用Bambu Studio",
|
"t1": "欢迎使用Bambu Studio",
|
||||||
|
@ -170,6 +184,20 @@ var LangText={
|
||||||
"t89": "打开所在的文件夹",
|
"t89": "打开所在的文件夹",
|
||||||
"t90": "3D 模型",
|
"t90": "3D 模型",
|
||||||
"t91": "下载3D模型",
|
"t91": "下载3D模型",
|
||||||
|
"t92": "创作",
|
||||||
|
"t93": "修改",
|
||||||
|
"t94": "分享",
|
||||||
|
"t95": "模型信息",
|
||||||
|
"t96": "附件",
|
||||||
|
"t97": "配置信息",
|
||||||
|
"t98": "模型名称",
|
||||||
|
"t100":"模型介绍",
|
||||||
|
"t101":"物料清单",
|
||||||
|
"t102":"装备指导",
|
||||||
|
"t103":"其他",
|
||||||
|
"t104":"配置名称",
|
||||||
|
"t105":"配置作者",
|
||||||
|
"t106":"配置介绍",
|
||||||
"wk1": "快速入门指南",
|
"wk1": "快速入门指南",
|
||||||
"wk2": "本文介绍了Bambu Studio的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。",
|
"wk2": "本文介绍了Bambu Studio的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。",
|
||||||
"wk3": "基于项目的工作流",
|
"wk3": "基于项目的工作流",
|
||||||
|
@ -271,7 +299,21 @@ var LangText={
|
||||||
"t88": "削除",
|
"t88": "削除",
|
||||||
"t89": "フォルダを開く",
|
"t89": "フォルダを開く",
|
||||||
"t90": "3Dモデル",
|
"t90": "3Dモデル",
|
||||||
"t91": "モデルをダウンロード"
|
"t91": "モデルをダウンロード",
|
||||||
|
"t92": "創作",
|
||||||
|
"t93": "修正",
|
||||||
|
"t94": "共有",
|
||||||
|
"t95": "モデル情報",
|
||||||
|
"t96": "添付ファイル",
|
||||||
|
"t97": "構成情報",
|
||||||
|
"t98": "モデル名",
|
||||||
|
"t100":"モデルの紹介",
|
||||||
|
"t101":"BOM",
|
||||||
|
"t102":"装備指導",
|
||||||
|
"t103":"その他",
|
||||||
|
"t104":"構成名",
|
||||||
|
"t105":"構成著者",
|
||||||
|
"t106":"構成の概要",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
407
resources/web/include/globalapi.js
Normal file
407
resources/web/include/globalapi.js
Normal file
|
@ -0,0 +1,407 @@
|
||||||
|
|
||||||
|
/*------------------ Date Function ------------------------*/
|
||||||
|
function GetFullToday( )
|
||||||
|
{
|
||||||
|
var d=new Date();
|
||||||
|
|
||||||
|
var nday=d.getDate();
|
||||||
|
var nmonth=d.getMonth()+1;
|
||||||
|
var nyear=d.getFullYear();
|
||||||
|
|
||||||
|
var strM=nmonth+'';
|
||||||
|
if( nmonth<10 )
|
||||||
|
strM='0'+nmonth;
|
||||||
|
|
||||||
|
var strD=nday+'';
|
||||||
|
if( nday<10 )
|
||||||
|
strD='0'+nday;
|
||||||
|
|
||||||
|
return nyear+'-'+strM+'-'+strD;
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetFullDate()
|
||||||
|
{
|
||||||
|
var d=new Date();
|
||||||
|
|
||||||
|
var tDate={};
|
||||||
|
|
||||||
|
tDate.nyear=d.getFullYear();
|
||||||
|
tDate.nmonth=d.getMonth()+1;
|
||||||
|
tDate.nday=d.getDate();
|
||||||
|
|
||||||
|
tDate.nhour=d.getHours();
|
||||||
|
tDate.nminute=d.getMinutes();
|
||||||
|
tDate.nsecond=d.getSeconds();
|
||||||
|
|
||||||
|
tDate.nweek=d.getDay();
|
||||||
|
tDate.ndate=d.getDate();
|
||||||
|
|
||||||
|
var strM=tDate.nmonth+'';
|
||||||
|
if( tDate.nmonth<10 )
|
||||||
|
strM='0'+tDate.nmonth;
|
||||||
|
|
||||||
|
var strD=tDate.nday+'';
|
||||||
|
if( tDate.nday<10 )
|
||||||
|
strD='0'+tDate.nday;
|
||||||
|
|
||||||
|
var strH=tDate.nhour+'';
|
||||||
|
if( tDate.nhour<10 )
|
||||||
|
strH='0'+tDate.nhour;
|
||||||
|
|
||||||
|
var strMin=tDate.nminute+'';
|
||||||
|
if( tDate.nminute<10 )
|
||||||
|
strMin='0'+tDate.nminute;
|
||||||
|
|
||||||
|
var strS=tDate.nsecond+'';
|
||||||
|
if( tDate.nsecond<10 )
|
||||||
|
strS='0'+tDate.nsecond;
|
||||||
|
|
||||||
|
tDate.strdate=tDate.nyear+'-'+strM+'-'+strD;
|
||||||
|
tDate.strFulldate=tDate.strdate+' '+strH+':'+strMin+':'+strS;
|
||||||
|
|
||||||
|
return tDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Unixtimestamp2Date( nSecond )
|
||||||
|
{
|
||||||
|
var d=new Date(nSecond*1000);
|
||||||
|
|
||||||
|
var tDate={};
|
||||||
|
|
||||||
|
tDate.nyear=d.getFullYear();
|
||||||
|
tDate.nmonth=d.getMonth()+1;
|
||||||
|
tDate.nday=d.getDate();
|
||||||
|
|
||||||
|
tDate.nhour=d.getHours();
|
||||||
|
tDate.nminute=d.getMinutes();
|
||||||
|
tDate.nsecond=d.getSeconds();
|
||||||
|
|
||||||
|
tDate.nweek=d.getDay();
|
||||||
|
tDate.ndate=d.getDate();
|
||||||
|
|
||||||
|
var strM=tDate.nmonth+'';
|
||||||
|
if( tDate.nmonth<10 )
|
||||||
|
strM='0'+tDate.nmonth;
|
||||||
|
|
||||||
|
var strD=tDate.nday+'';
|
||||||
|
if( tDate.nday<10 )
|
||||||
|
strD='0'+tDate.nday;
|
||||||
|
|
||||||
|
tDate.strdate=tDate.nyear+'-'+strM+'-'+strD;
|
||||||
|
|
||||||
|
return tDate.strdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------Array Function-------------
|
||||||
|
Array.prototype.in_array = function (e) {
|
||||||
|
let sArray= ',' + this.join(this.S) + ',';
|
||||||
|
let skey=','+e+',';
|
||||||
|
|
||||||
|
if(sArray.indexOf(skey)>=0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//------------String Function------------------
|
||||||
|
/**
|
||||||
|
* Delete Left/Right Side Blank
|
||||||
|
*/
|
||||||
|
String.prototype.trim=function()
|
||||||
|
{
|
||||||
|
return this.replace(/(^\s*)|(\s*$)/g, '');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Delete Left Side Blank
|
||||||
|
*/
|
||||||
|
String.prototype.ltrim=function()
|
||||||
|
{
|
||||||
|
return this.replace(/(^\s*)/g,'');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Delete Right Side Blank
|
||||||
|
*/
|
||||||
|
String.prototype.rtrim=function()
|
||||||
|
{
|
||||||
|
return this.replace(/(\s*$)/g,'');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------Get Param-------------
|
||||||
|
function GetQueryString(name)
|
||||||
|
{
|
||||||
|
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
|
||||||
|
var r = window.location.search.substr(1).match(reg);
|
||||||
|
if (r!=null)
|
||||||
|
{
|
||||||
|
return unescape(r[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetGetStr()
|
||||||
|
{
|
||||||
|
let strGet="";
|
||||||
|
|
||||||
|
//获取当前URL
|
||||||
|
let url = document.location.href;
|
||||||
|
|
||||||
|
//获取?的位置
|
||||||
|
let index = url.indexOf("?")
|
||||||
|
if(index != -1) {
|
||||||
|
//截取出?后面的字符串
|
||||||
|
strGet = url.substr(index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return strGet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------File Function--------------*/
|
||||||
|
function getFileName(path)
|
||||||
|
{
|
||||||
|
var pos1 = path.lastIndexOf('/');
|
||||||
|
var pos2 = path.lastIndexOf('\\');
|
||||||
|
var pos = Math.max(pos1, pos2);
|
||||||
|
if (pos < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return path.substring(pos + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFileTail(path)
|
||||||
|
{
|
||||||
|
var pos = path.lastIndexOf('.');
|
||||||
|
if (pos < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return path.substring(pos + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------String Function-----------*/
|
||||||
|
function html_encode(str)
|
||||||
|
{
|
||||||
|
var s = "";
|
||||||
|
if (str.length == 0) return "";
|
||||||
|
s = str.replace(/&/g, "&");
|
||||||
|
s = s.replace(/</g, "<");
|
||||||
|
s = s.replace(/>/g, ">");
|
||||||
|
s = s.replace(/ /g, " ");
|
||||||
|
s = s.replace(/\'/g, "'");
|
||||||
|
s = s.replace(/\"/g, """);
|
||||||
|
s = s.replace(/\n/g, "<br/>");
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
function html_decode(str)
|
||||||
|
{
|
||||||
|
var s = "";
|
||||||
|
if (str.length == 0) return "";
|
||||||
|
s = str.replace(/&/g, "&");
|
||||||
|
s = s.replace(/</g, "<");
|
||||||
|
s = s.replace(/>/g, ">");
|
||||||
|
s = s.replace(/ /g, " ");
|
||||||
|
s = s.replace(/'/g, "\'");
|
||||||
|
s = s.replace(/"/g, "\"");
|
||||||
|
s = s.replace(/<br\/>/g, "\n");
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------JSON Function------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
功能:检查一个字符串是不是标准的JSON格式
|
||||||
|
参数: strJson 被检查的字符串
|
||||||
|
返回值: 如果字符串是一个标准的JSON格式,则返回JSON对象
|
||||||
|
如果字符串不是标准JSON格式,则返回null
|
||||||
|
*/
|
||||||
|
function IsJson( strJson )
|
||||||
|
{
|
||||||
|
var tJson=null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tJson=JSON.parse(strJson);
|
||||||
|
}
|
||||||
|
catch(exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------Ajax Function--------------------*/
|
||||||
|
/*对JQuery的Ajax函数的封装,只支持异步
|
||||||
|
参数说明:
|
||||||
|
url 目标地址
|
||||||
|
action post/get
|
||||||
|
data 字符串格式的发送内容
|
||||||
|
asyn true---异步模式;false-----同步模式;
|
||||||
|
*/
|
||||||
|
function HttpReq( url,action, data,callbackfunc)
|
||||||
|
{
|
||||||
|
var strAction=action.toLowerCase();
|
||||||
|
|
||||||
|
if( strAction=="post")
|
||||||
|
{
|
||||||
|
$.post(url,data,callbackfunc);
|
||||||
|
}
|
||||||
|
else if( strAction=="get")
|
||||||
|
{
|
||||||
|
$.get(url,callbackfunc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------Cookie Function-------------------*/
|
||||||
|
function setCookie(name, value, time='',path='') {
|
||||||
|
if(time && path){
|
||||||
|
var strsec = time * 1000;
|
||||||
|
var exp = new Date();
|
||||||
|
exp.setTime(exp.getTime() + strsec * 1);
|
||||||
|
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path="+path;
|
||||||
|
}else if(time){
|
||||||
|
var strsec = time * 1000;
|
||||||
|
var exp = new Date();
|
||||||
|
exp.setTime(exp.getTime() + strsec * 1);
|
||||||
|
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
|
||||||
|
}else if(path){
|
||||||
|
document.cookie = name + "=" + escape(value) + ";path="+path;
|
||||||
|
}else{
|
||||||
|
document.cookie = name + "=" + escape(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(c_name)
|
||||||
|
{
|
||||||
|
if(document.cookie.length > 0) {
|
||||||
|
c_start = document.cookie.indexOf(c_name + "=");//获取字符串的起点
|
||||||
|
if(c_start != -1) {
|
||||||
|
c_start = c_start + c_name.length + 1;//获取值的起点
|
||||||
|
c_end = document.cookie.indexOf(";", c_start);//获取结尾处
|
||||||
|
if(c_end == -1) c_end = document.cookie.length;//如果是最后一个,结尾就是cookie字符串的结尾
|
||||||
|
return decodeURI(document.cookie.substring(c_start, c_end));//截取字符串返回
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkCookie(c_name) {
|
||||||
|
username = getCookie(c_name);
|
||||||
|
console.log(username);
|
||||||
|
if (username != null && username != "")
|
||||||
|
{ return true; }
|
||||||
|
else
|
||||||
|
{ return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCookie(name) {
|
||||||
|
setCookie(name, "", -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------Studio WX Message-------*/
|
||||||
|
function IsInSlicer()
|
||||||
|
{
|
||||||
|
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
|
||||||
|
|
||||||
|
return bMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function SendWXMessage( strMsg )
|
||||||
|
{
|
||||||
|
let bCheck=IsInSlicer();
|
||||||
|
|
||||||
|
if(bCheck!=null)
|
||||||
|
{
|
||||||
|
window.wx.postMessage(strMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SendWXDebugInfo( strMsg )
|
||||||
|
{
|
||||||
|
var tSend={};
|
||||||
|
tSend['sequence_id']=Math.round(new Date() / 1000);
|
||||||
|
tSend['command']="debug_info";
|
||||||
|
tSend['msg']=strMsg;
|
||||||
|
|
||||||
|
SendWXMessage( JSON.stringify(tSend) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------CSS Link Control----*/
|
||||||
|
function RemoveCssLink( LinkPath )
|
||||||
|
{
|
||||||
|
let pNow=$("head link[href='"+LinkPath+"']");
|
||||||
|
|
||||||
|
let nTotal=pNow.length;
|
||||||
|
for( let n=0;n<nTotal;n++ )
|
||||||
|
{
|
||||||
|
pNow[n].remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddCssLink( LinkPath )
|
||||||
|
{
|
||||||
|
var head = document.getElementsByTagName('head')[0];
|
||||||
|
var link = document.createElement('link');
|
||||||
|
link.href = LinkPath;
|
||||||
|
link.rel = 'stylesheet';
|
||||||
|
link.type = 'text/css';
|
||||||
|
head.appendChild(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckCssLinkExist( LinkPath )
|
||||||
|
{
|
||||||
|
let pNow=$("head link[href='"+LinkPath+"']");
|
||||||
|
let nTotal=pNow.length;
|
||||||
|
|
||||||
|
return nTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------Dark Mode------*/
|
||||||
|
|
||||||
|
function SwitchDarkMode( DarkCssPath )
|
||||||
|
{
|
||||||
|
ExecuteDarkMode( DarkCssPath );
|
||||||
|
setInterval("ExecuteDarkMode('"+DarkCssPath+"')",1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExecuteDarkMode( DarkCssPath )
|
||||||
|
{
|
||||||
|
let nMode=0;
|
||||||
|
let bDarkMode=navigator.userAgent.match( RegExp('dark','i') );
|
||||||
|
if( bDarkMode!=null )
|
||||||
|
nMode=1;
|
||||||
|
|
||||||
|
let nNow=CheckCssLinkExist(DarkCssPath);
|
||||||
|
if( nMode==0 )
|
||||||
|
{
|
||||||
|
if(nNow>0)
|
||||||
|
RemoveCssLink(DarkCssPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(nNow==0)
|
||||||
|
AddCssLink(DarkCssPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchDarkMode( "./css/dark.css" );
|
4
resources/web/include/jquery-2.1.1.min.js
vendored
Normal file
4
resources/web/include/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
resources/web/include/jquery-3.6.0.min.js
vendored
Normal file
2
resources/web/include/jquery-3.6.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
185
resources/web/include/json2.js
Normal file
185
resources/web/include/json2.js
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
var JSON;
|
||||||
|
if (!JSON) {
|
||||||
|
JSON = {};
|
||||||
|
}
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
function f(n) {
|
||||||
|
// Format integers to have at least two digits.
|
||||||
|
return n < 10 ? '0' + n : n;
|
||||||
|
}
|
||||||
|
if (typeof Date.prototype.toJSON !== 'function') {
|
||||||
|
Date.prototype.toJSON = function (key) {
|
||||||
|
|
||||||
|
return isFinite(this.valueOf())
|
||||||
|
? this.getUTCFullYear() + '-' +
|
||||||
|
f(this.getUTCMonth() + 1) + '-' +
|
||||||
|
f(this.getUTCDate()) + 'T' +
|
||||||
|
f(this.getUTCHours()) + ':' +
|
||||||
|
f(this.getUTCMinutes()) + ':' +
|
||||||
|
f(this.getUTCSeconds()) + 'Z'
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
String.prototype.toJSON =
|
||||||
|
Number.prototype.toJSON =
|
||||||
|
Boolean.prototype.toJSON = function (key) {
|
||||||
|
return this.valueOf();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||||
|
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||||
|
gap,
|
||||||
|
indent,
|
||||||
|
meta = { // table of character substitutions
|
||||||
|
'\b': '\\b',
|
||||||
|
'\t': '\\t',
|
||||||
|
'\n': '\\n',
|
||||||
|
'\f': '\\f',
|
||||||
|
'\r': '\\r',
|
||||||
|
'"' : '\\"',
|
||||||
|
'\\': '\\\\'
|
||||||
|
},
|
||||||
|
rep;
|
||||||
|
function quote(string) {
|
||||||
|
escapable.lastIndex = 0;
|
||||||
|
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||||
|
var c = meta[a];
|
||||||
|
return typeof c === 'string'
|
||||||
|
? c
|
||||||
|
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||||
|
}) + '"' : '"' + string + '"';
|
||||||
|
}
|
||||||
|
function str(key, holder) {
|
||||||
|
var i, // The loop counter.
|
||||||
|
k, // The member key.
|
||||||
|
v, // The member value.
|
||||||
|
length,
|
||||||
|
mind = gap,
|
||||||
|
partial,
|
||||||
|
value = holder[key];
|
||||||
|
if (value && typeof value === 'object' &&
|
||||||
|
typeof value.toJSON === 'function') {
|
||||||
|
value = value.toJSON(key);
|
||||||
|
}
|
||||||
|
if (typeof rep === 'function') {
|
||||||
|
value = rep.call(holder, key, value);
|
||||||
|
}
|
||||||
|
switch (typeof value) {
|
||||||
|
case 'string':
|
||||||
|
return quote(value);
|
||||||
|
case 'number':
|
||||||
|
return isFinite(value) ? String(value) : 'null';
|
||||||
|
case 'boolean':
|
||||||
|
case 'null':
|
||||||
|
return String(value);
|
||||||
|
case 'object':
|
||||||
|
if (!value) {
|
||||||
|
return 'null';
|
||||||
|
}
|
||||||
|
gap += indent;
|
||||||
|
partial = [];
|
||||||
|
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||||
|
length = value.length;
|
||||||
|
for (i = 0; i < length; i += 1) {
|
||||||
|
partial[i] = str(i, value) || 'null';
|
||||||
|
}
|
||||||
|
v = partial.length === 0
|
||||||
|
? '[]'
|
||||||
|
: gap
|
||||||
|
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||||
|
: '[' + partial.join(',') + ']';
|
||||||
|
gap = mind;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
if (rep && typeof rep === 'object') {
|
||||||
|
length = rep.length;
|
||||||
|
for (i = 0; i < length; i += 1) {
|
||||||
|
if (typeof rep[i] === 'string') {
|
||||||
|
k = rep[i];
|
||||||
|
v = str(k, value);
|
||||||
|
if (v) {
|
||||||
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (k in value) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||||
|
v = str(k, value);
|
||||||
|
if (v) {
|
||||||
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v = partial.length === 0
|
||||||
|
? '{}'
|
||||||
|
: gap
|
||||||
|
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||||
|
: '{' + partial.join(',') + '}';
|
||||||
|
gap = mind;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof JSON.stringify !== 'function') {
|
||||||
|
JSON.stringify = function (value, replacer, space) {
|
||||||
|
var i;
|
||||||
|
gap = '';
|
||||||
|
indent = '';
|
||||||
|
if (typeof space === 'number') {
|
||||||
|
for (i = 0; i < space; i += 1) {
|
||||||
|
indent += ' ';
|
||||||
|
}
|
||||||
|
} else if (typeof space === 'string') {
|
||||||
|
indent = space;
|
||||||
|
}
|
||||||
|
rep = replacer;
|
||||||
|
if (replacer && typeof replacer !== 'function' &&
|
||||||
|
(typeof replacer !== 'object' ||
|
||||||
|
typeof replacer.length !== 'number')) {
|
||||||
|
throw new Error('JSON.stringify');
|
||||||
|
}
|
||||||
|
return str('', {'': value});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof JSON.parse !== 'function') {
|
||||||
|
JSON.parse = function (text, reviver) {
|
||||||
|
var j;
|
||||||
|
function walk(holder, key) {
|
||||||
|
var k, v, value = holder[key];
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
for (k in value) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||||
|
v = walk(value, k);
|
||||||
|
if (v !== undefined) {
|
||||||
|
value[k] = v;
|
||||||
|
} else {
|
||||||
|
delete value[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reviver.call(holder, key, value);
|
||||||
|
}
|
||||||
|
text = String(text);
|
||||||
|
cx.lastIndex = 0;
|
||||||
|
if (cx.test(text)) {
|
||||||
|
text = text.replace(cx, function (a) {
|
||||||
|
return '\\u' +
|
||||||
|
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (/^[\],:{}\s]*$/
|
||||||
|
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||||
|
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||||
|
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||||
|
j = eval('(' + text + ')');
|
||||||
|
return typeof reviver === 'function'
|
||||||
|
? walk({'': j}, '')
|
||||||
|
: j;
|
||||||
|
}
|
||||||
|
throw new SyntaxError('JSON.parse');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}());
|
20
resources/web/include/swiper/LICENSE
Normal file
20
resources/web/include/swiper/LICENSE
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2019 Vladimir Kharlampidi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
resources/web/include/swiper/README.md
Normal file
11
resources/web/include/swiper/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Swiper
|
||||||
|
==========
|
||||||
|
|
||||||
|
Swiper - is the free and most modern mobile touch slider with hardware accelerated transitions and amazing native behavior. It is intended to be used in mobile websites, mobile web apps, and mobile native/hybrid apps.
|
||||||
|
|
||||||
|
Swiper is not compatible with all platforms, it is a modern touch slider which is focused only on modern apps/platforms to bring the best experience and simplicity.
|
||||||
|
|
||||||
|
# Getting Started
|
||||||
|
* [Getting Started Guide](https://swiperjs.com/get-started/)
|
||||||
|
* [API](https://swiperjs.com/swiper-api/)
|
||||||
|
* [Demos](https://swiperjs.com/demos/)
|
3
resources/web/include/swiper/angular/angular/src/public-api.d.ts
vendored
Normal file
3
resources/web/include/swiper/angular/angular/src/public-api.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './swiper.module';
|
||||||
|
export * from './swiper.component';
|
||||||
|
export * from './swiper-slide.directive';
|
26
resources/web/include/swiper/angular/angular/src/swiper-slide.directive.d.ts
vendored
Normal file
26
resources/web/include/swiper/angular/angular/src/swiper-slide.directive.d.ts
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import { TemplateRef } from '@angular/core';
|
||||||
|
import * as i0 from "@angular/core";
|
||||||
|
export declare class SwiperSlideDirective {
|
||||||
|
template: TemplateRef<any>;
|
||||||
|
virtualIndex: number;
|
||||||
|
class: string;
|
||||||
|
autoplayDelay: string | null;
|
||||||
|
set zoom(val: boolean);
|
||||||
|
get zoom(): boolean;
|
||||||
|
private _zoom;
|
||||||
|
slideIndex: number;
|
||||||
|
get classNames(): string;
|
||||||
|
set classNames(val: string);
|
||||||
|
private _hasClass;
|
||||||
|
slideData: {
|
||||||
|
isActive: boolean;
|
||||||
|
isPrev: boolean;
|
||||||
|
isNext: boolean;
|
||||||
|
isVisible: boolean;
|
||||||
|
isDuplicate: boolean;
|
||||||
|
};
|
||||||
|
private _classNames;
|
||||||
|
constructor(template: TemplateRef<any>);
|
||||||
|
static ɵfac: i0.ɵɵFactoryDeclaration<SwiperSlideDirective, never>;
|
||||||
|
static ɵdir: i0.ɵɵDirectiveDeclaration<SwiperSlideDirective, "ng-template[swiperSlide]", never, { "virtualIndex": "virtualIndex"; "class": "class"; "autoplayDelay": "data-swiper-autoplay"; "zoom": "zoom"; }, {}, never>;
|
||||||
|
}
|
252
resources/web/include/swiper/angular/angular/src/swiper.component.d.ts
vendored
Normal file
252
resources/web/include/swiper/angular/angular/src/swiper.component.d.ts
vendored
Normal file
File diff suppressed because one or more lines are too long
9
resources/web/include/swiper/angular/angular/src/swiper.module.d.ts
vendored
Normal file
9
resources/web/include/swiper/angular/angular/src/swiper.module.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import * as i0 from "@angular/core";
|
||||||
|
import * as i1 from "./swiper.component";
|
||||||
|
import * as i2 from "./swiper-slide.directive";
|
||||||
|
import * as i3 from "@angular/common";
|
||||||
|
export declare class SwiperModule {
|
||||||
|
static ɵfac: i0.ɵɵFactoryDeclaration<SwiperModule, never>;
|
||||||
|
static ɵmod: i0.ɵɵNgModuleDeclaration<SwiperModule, [typeof i1.SwiperComponent, typeof i2.SwiperSlideDirective], [typeof i3.CommonModule], [typeof i1.SwiperComponent, typeof i2.SwiperSlideDirective]>;
|
||||||
|
static ɵinj: i0.ɵɵInjectorDeclaration<SwiperModule>;
|
||||||
|
}
|
6
resources/web/include/swiper/angular/angular/src/utils/get-params.d.ts
vendored
Normal file
6
resources/web/include/swiper/angular/angular/src/utils/get-params.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export declare const allowedParams: string[];
|
||||||
|
export declare function getParams(obj?: any): {
|
||||||
|
params: any;
|
||||||
|
passedParams: any;
|
||||||
|
rest: any;
|
||||||
|
};
|
1
resources/web/include/swiper/angular/angular/src/utils/params-list.d.ts
vendored
Normal file
1
resources/web/include/swiper/angular/angular/src/utils/params-list.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export declare const paramsList: string[];
|
6
resources/web/include/swiper/angular/angular/src/utils/utils.d.ts
vendored
Normal file
6
resources/web/include/swiper/angular/angular/src/utils/utils.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export declare function isObject(o: any): boolean;
|
||||||
|
export declare function isShowEl(val: any, obj: any, el: any): boolean;
|
||||||
|
export declare function extend(target: any, src: any): void;
|
||||||
|
export declare function coerceBooleanProperty(value: any): boolean;
|
||||||
|
export declare const ignoreNgOnChanges: string[];
|
||||||
|
export declare function setProperty(val: any, obj?: {}): {} | false;
|
1830
resources/web/include/swiper/angular/bundles/swiper_angular.umd.js
Normal file
1830
resources/web/include/swiper/angular/bundles/swiper_angular.umd.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7
resources/web/include/swiper/angular/esm2015/angular/src/public-api.js
vendored
Normal file
7
resources/web/include/swiper/angular/esm2015/angular/src/public-api.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* Public API Surface of angular
|
||||||
|
*/
|
||||||
|
export * from './swiper.module';
|
||||||
|
export * from './swiper.component';
|
||||||
|
export * from './swiper-slide.directive';
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hbmd1bGFyL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsMEJBQTBCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGFuZ3VsYXJcbiAqL1xuZXhwb3J0ICogZnJvbSAnLi9zd2lwZXIubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vc3dpcGVyLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL3N3aXBlci1zbGlkZS5kaXJlY3RpdmUnO1xuIl19
|
|
@ -0,0 +1,60 @@
|
||||||
|
import { Directive, Input } from '@angular/core';
|
||||||
|
import { coerceBooleanProperty } from './utils/utils';
|
||||||
|
import * as i0 from "@angular/core";
|
||||||
|
export class SwiperSlideDirective {
|
||||||
|
constructor(template) {
|
||||||
|
this.template = template;
|
||||||
|
this.class = '';
|
||||||
|
this.autoplayDelay = null;
|
||||||
|
this.slideData = {
|
||||||
|
isActive: false,
|
||||||
|
isPrev: false,
|
||||||
|
isNext: false,
|
||||||
|
isVisible: false,
|
||||||
|
isDuplicate: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
set zoom(val) {
|
||||||
|
this._zoom = coerceBooleanProperty(val);
|
||||||
|
}
|
||||||
|
get zoom() {
|
||||||
|
return this._zoom;
|
||||||
|
}
|
||||||
|
get classNames() {
|
||||||
|
return this._classNames;
|
||||||
|
}
|
||||||
|
set classNames(val) {
|
||||||
|
if (this._classNames === val) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._classNames = val;
|
||||||
|
this.slideData = {
|
||||||
|
isActive: this._hasClass(['swiper-slide-active', 'swiper-slide-duplicate-active']),
|
||||||
|
isVisible: this._hasClass(['swiper-slide-visible']),
|
||||||
|
isDuplicate: this._hasClass(['swiper-slide-duplicate']),
|
||||||
|
isPrev: this._hasClass(['swiper-slide-prev', 'swiper-slide-duplicate-prev']),
|
||||||
|
isNext: this._hasClass(['swiper-slide-next', 'swiper-slide-duplicate-next']),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
_hasClass(classNames) {
|
||||||
|
return classNames.some((className) => this._classNames.indexOf(className) >= 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SwiperSlideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperSlideDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||||||
|
SwiperSlideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.2", type: SwiperSlideDirective, selector: "ng-template[swiperSlide]", inputs: { virtualIndex: "virtualIndex", class: "class", autoplayDelay: ["data-swiper-autoplay", "autoplayDelay"], zoom: "zoom" }, ngImport: i0 });
|
||||||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperSlideDirective, decorators: [{
|
||||||
|
type: Directive,
|
||||||
|
args: [{
|
||||||
|
selector: 'ng-template[swiperSlide]',
|
||||||
|
}]
|
||||||
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { virtualIndex: [{
|
||||||
|
type: Input
|
||||||
|
}], class: [{
|
||||||
|
type: Input
|
||||||
|
}], autoplayDelay: [{
|
||||||
|
type: Input,
|
||||||
|
args: ['data-swiper-autoplay']
|
||||||
|
}], zoom: [{
|
||||||
|
type: Input
|
||||||
|
}] } });
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpcGVyLXNsaWRlLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hbmd1bGFyL3NyYy9zd2lwZXItc2xpZGUuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFlLE1BQU0sZUFBZSxDQUFDO0FBQzlELE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFJdEQsTUFBTSxPQUFPLG9CQUFvQjtJQTBDL0IsWUFBbUIsUUFBMEI7UUFBMUIsYUFBUSxHQUFSLFFBQVEsQ0FBa0I7UUF4Q3BDLFVBQUssR0FBVyxFQUFFLENBQUM7UUFDRyxrQkFBYSxHQUFrQixJQUFJLENBQUM7UUE4Qm5FLGNBQVMsR0FBRztZQUNWLFFBQVEsRUFBRSxLQUFLO1lBQ2YsTUFBTSxFQUFFLEtBQUs7WUFDYixNQUFNLEVBQUUsS0FBSztZQUNiLFNBQVMsRUFBRSxLQUFLO1lBQ2hCLFdBQVcsRUFBRSxLQUFLO1NBQ25CLENBQUM7SUFHOEMsQ0FBQztJQXRDakQsSUFDSSxJQUFJLENBQUMsR0FBWTtRQUNuQixJQUFJLENBQUMsS0FBSyxHQUFHLHFCQUFxQixDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQzFDLENBQUM7SUFDRCxJQUFJLElBQUk7UUFDTixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDcEIsQ0FBQztJQUdELElBQUksVUFBVTtRQUNaLE9BQU8sSUFBSSxDQUFDLFdBQVcsQ0FBQztJQUMxQixDQUFDO0lBQ0QsSUFBSSxVQUFVLENBQUMsR0FBRztRQUNoQixJQUFJLElBQUksQ0FBQyxXQUFXLEtBQUssR0FBRyxFQUFFO1lBQzVCLE9BQU87U0FDUjtRQUNELElBQUksQ0FBQyxXQUFXLEdBQUcsR0FBRyxDQUFDO1FBQ3ZCLElBQUksQ0FBQyxTQUFTLEdBQUc7WUFDZixRQUFRLEVBQUUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLHFCQUFxQixFQUFFLCtCQUErQixDQUFDLENBQUM7WUFDbEYsU0FBUyxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxzQkFBc0IsQ0FBQyxDQUFDO1lBQ25ELFdBQVcsRUFBRSxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsd0JBQXdCLENBQUMsQ0FBQztZQUN2RCxNQUFNLEVBQUUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLG1CQUFtQixFQUFFLDZCQUE2QixDQUFDLENBQUM7WUFDNUUsTUFBTSxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxtQkFBbUIsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO1NBQzdFLENBQUM7SUFDSixDQUFDO0lBRU8sU0FBUyxDQUFDLFVBQW9CO1FBQ3BDLE9BQU8sVUFBVSxDQUFDLElBQUksQ0FBQyxDQUFDLFNBQVMsRUFBRSxFQUFFLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDbEYsQ0FBQzs7aUhBaENVLG9CQUFvQjtxR0FBcEIsb0JBQW9COzJGQUFwQixvQkFBb0I7a0JBSGhDLFNBQVM7bUJBQUM7b0JBQ1QsUUFBUSxFQUFFLDBCQUEwQjtpQkFDckM7a0dBRVUsWUFBWTtzQkFBcEIsS0FBSztnQkFDRyxLQUFLO3NCQUFiLEtBQUs7Z0JBQ3lCLGFBQWE7c0JBQTNDLEtBQUs7dUJBQUMsc0JBQXNCO2dCQUV6QixJQUFJO3NCQURQLEtBQUsiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUsIElucHV0LCBUZW1wbGF0ZVJlZiB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgY29lcmNlQm9vbGVhblByb3BlcnR5IH0gZnJvbSAnLi91dGlscy91dGlscyc7XG5ARGlyZWN0aXZlKHtcbiAgc2VsZWN0b3I6ICduZy10ZW1wbGF0ZVtzd2lwZXJTbGlkZV0nLFxufSlcbmV4cG9ydCBjbGFzcyBTd2lwZXJTbGlkZURpcmVjdGl2ZSB7XG4gIEBJbnB1dCgpIHZpcnR1YWxJbmRleDogbnVtYmVyO1xuICBASW5wdXQoKSBjbGFzczogc3RyaW5nID0gJyc7XG4gIEBJbnB1dCgnZGF0YS1zd2lwZXItYXV0b3BsYXknKSBhdXRvcGxheURlbGF5OiBzdHJpbmcgfCBudWxsID0gbnVsbDtcbiAgQElucHV0KClcbiAgc2V0IHpvb20odmFsOiBib29sZWFuKSB7XG4gICAgdGhpcy5fem9vbSA9IGNvZXJjZUJvb2xlYW5Qcm9wZXJ0eSh2YWwpO1xuICB9XG4gIGdldCB6b29tKCkge1xuICAgIHJldHVybiB0aGlzLl96b29tO1xuICB9XG4gIHByaXZhdGUgX3pvb206IGJvb2xlYW47XG4gIHNsaWRlSW5kZXg6IG51bWJlcjtcbiAgZ2V0IGNsYXNzTmFtZXMoKSB7XG4gICAgcmV0dXJuIHRoaXMuX2NsYXNzTmFtZXM7XG4gIH1cbiAgc2V0IGNsYXNzTmFtZXModmFsKSB7XG4gICAgaWYgKHRoaXMuX2NsYXNzTmFtZXMgPT09IHZhbCkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cbiAgICB0aGlzLl9jbGFzc05hbWVzID0gdmFsO1xuICAgIHRoaXMuc2xpZGVEYXRhID0ge1xuICAgICAgaXNBY3RpdmU6IHRoaXMuX2hhc0NsYXNzKFsnc3dpcGVyLXNsaWRlLWFjdGl2ZScsICdzd2lwZXItc2xpZGUtZHVwbGljYXRlLWFjdGl2ZSddKSxcbiAgICAgIGlzVmlzaWJsZTogdGhpcy5faGFzQ2xhc3MoWydzd2lwZXItc2xpZGUtdmlzaWJsZSddKSxcbiAgICAgIGlzRHVwbGljYXRlOiB0aGlzLl9oYXNDbGFzcyhbJ3N3aXBlci1zbGlkZS1kdXBsaWNhdGUnXSksXG4gICAgICBpc1ByZXY6IHRoaXMuX2hhc0NsYXNzKFsnc3dpcGVyLXNsaWRlLXByZXYnLCAnc3dpcGVyLXNsaWRlLWR1cGxpY2F0ZS1wcmV2J10pLFxuICAgICAgaXNOZXh0OiB0aGlzLl9oYXNDbGFzcyhbJ3N3aXBlci1zbGlkZS1uZXh0JywgJ3N3aXBlci1zbGlkZS1kdXBsaWNhdGUtbmV4dCddKSxcbiAgICB9O1xuICB9XG5cbiAgcHJpdmF0ZSBfaGFzQ2xhc3MoY2xhc3NOYW1lczogc3RyaW5nW10pIHtcbiAgICByZXR1cm4gY2xhc3NOYW1lcy5zb21lKChjbGFzc05hbWUpID0+IHRoaXMuX2NsYXNzTmFtZXMuaW5kZXhPZihjbGFzc05hbWUpID49IDApO1xuICB9XG4gIHNsaWRlRGF0YSA9IHtcbiAgICBpc0FjdGl2ZTogZmFsc2UsXG4gICAgaXNQcmV2OiBmYWxzZSxcbiAgICBpc05leHQ6IGZhbHNlLFxuICAgIGlzVmlzaWJsZTogZmFsc2UsXG4gICAgaXNEdXBsaWNhdGU6IGZhbHNlLFxuICB9O1xuXG4gIHByaXZhdGUgX2NsYXNzTmFtZXM6IHN0cmluZztcbiAgY29uc3RydWN0b3IocHVibGljIHRlbXBsYXRlOiBUZW1wbGF0ZVJlZjxhbnk+KSB7fVxufVxuIl19
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,19 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SwiperComponent } from './swiper.component';
|
||||||
|
import { SwiperSlideDirective } from './swiper-slide.directive';
|
||||||
|
import * as i0 from "@angular/core";
|
||||||
|
export class SwiperModule {
|
||||||
|
}
|
||||||
|
SwiperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
||||||
|
SwiperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperModule, declarations: [SwiperComponent, SwiperSlideDirective], imports: [CommonModule], exports: [SwiperComponent, SwiperSlideDirective] });
|
||||||
|
SwiperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperModule, imports: [[CommonModule]] });
|
||||||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.2", ngImport: i0, type: SwiperModule, decorators: [{
|
||||||
|
type: NgModule,
|
||||||
|
args: [{
|
||||||
|
declarations: [SwiperComponent, SwiperSlideDirective],
|
||||||
|
exports: [SwiperComponent, SwiperSlideDirective],
|
||||||
|
imports: [CommonModule],
|
||||||
|
}]
|
||||||
|
}] });
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpcGVyLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hbmd1bGFyL3NyYy9zd2lwZXIubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNyRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQzs7QUFNaEUsTUFBTSxPQUFPLFlBQVk7O3lHQUFaLFlBQVk7MEdBQVosWUFBWSxpQkFKUixlQUFlLEVBQUUsb0JBQW9CLGFBRTFDLFlBQVksYUFEWixlQUFlLEVBQUUsb0JBQW9COzBHQUdwQyxZQUFZLFlBRmQsQ0FBQyxZQUFZLENBQUM7MkZBRVosWUFBWTtrQkFMeEIsUUFBUTttQkFBQztvQkFDUixZQUFZLEVBQUUsQ0FBQyxlQUFlLEVBQUUsb0JBQW9CLENBQUM7b0JBQ3JELE9BQU8sRUFBRSxDQUFDLGVBQWUsRUFBRSxvQkFBb0IsQ0FBQztvQkFDaEQsT0FBTyxFQUFFLENBQUMsWUFBWSxDQUFDO2lCQUN4QiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE5nTW9kdWxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQgeyBDb21tb25Nb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb21tb24nO1xuaW1wb3J0IHsgU3dpcGVyQ29tcG9uZW50IH0gZnJvbSAnLi9zd2lwZXIuY29tcG9uZW50JztcbmltcG9ydCB7IFN3aXBlclNsaWRlRGlyZWN0aXZlIH0gZnJvbSAnLi9zd2lwZXItc2xpZGUuZGlyZWN0aXZlJztcbkBOZ01vZHVsZSh7XG4gIGRlY2xhcmF0aW9uczogW1N3aXBlckNvbXBvbmVudCwgU3dpcGVyU2xpZGVEaXJlY3RpdmVdLFxuICBleHBvcnRzOiBbU3dpcGVyQ29tcG9uZW50LCBTd2lwZXJTbGlkZURpcmVjdGl2ZV0sXG4gIGltcG9ydHM6IFtDb21tb25Nb2R1bGVdLFxufSlcbmV4cG9ydCBjbGFzcyBTd2lwZXJNb2R1bGUge31cbiJdfQ==
|
38
resources/web/include/swiper/angular/esm2015/angular/src/utils/get-params.js
vendored
Normal file
38
resources/web/include/swiper/angular/esm2015/angular/src/utils/get-params.js
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// eslint-disable-next-line
|
||||||
|
import { isObject, extend } from './utils';
|
||||||
|
import { paramsList } from './params-list';
|
||||||
|
// @ts-ignore
|
||||||
|
import Swiper from 'swiper';
|
||||||
|
export const allowedParams = paramsList.map((key) => key.replace(/_/, ''));
|
||||||
|
export function getParams(obj = {}) {
|
||||||
|
const params = {
|
||||||
|
on: {},
|
||||||
|
};
|
||||||
|
const passedParams = {};
|
||||||
|
extend(params, Swiper.defaults);
|
||||||
|
extend(params, Swiper.extendedDefaults);
|
||||||
|
params._emitClasses = true;
|
||||||
|
const rest = {};
|
||||||
|
Object.keys(obj).forEach((key) => {
|
||||||
|
const _key = key.replace(/^_/, '');
|
||||||
|
if (typeof obj[_key] === 'undefined')
|
||||||
|
return;
|
||||||
|
if (allowedParams.indexOf(_key) >= 0) {
|
||||||
|
if (isObject(obj[_key])) {
|
||||||
|
params[_key] = {};
|
||||||
|
passedParams[_key] = {};
|
||||||
|
extend(params[_key], obj[_key]);
|
||||||
|
extend(passedParams[_key], obj[_key]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
params[_key] = obj[_key];
|
||||||
|
passedParams[_key] = obj[_key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rest[_key] = obj[_key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return { params, passedParams, rest };
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXBhcmFtcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hbmd1bGFyL3NyYy91dGlscy9nZXQtcGFyYW1zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDJCQUEyQjtBQUMzQixPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUMzQyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNDLGFBQWE7QUFDYixPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFFNUIsTUFBTSxDQUFDLE1BQU0sYUFBYSxHQUFHLFVBQVUsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUM7QUFDM0UsTUFBTSxVQUFVLFNBQVMsQ0FBQyxNQUFXLEVBQUU7SUFDckMsTUFBTSxNQUFNLEdBQVE7UUFDbEIsRUFBRSxFQUFFLEVBQUU7S0FDUCxDQUFDO0lBQ0YsTUFBTSxZQUFZLEdBQVEsRUFBRSxDQUFDO0lBQzdCLE1BQU0sQ0FBQyxNQUFNLEVBQUUsTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQ2hDLE1BQU0sQ0FBQyxNQUFNLEVBQUUsTUFBTSxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDeEMsTUFBTSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7SUFFM0IsTUFBTSxJQUFJLEdBQVEsRUFBRSxDQUFDO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBVyxFQUFFLEVBQUU7UUFDdkMsTUFBTSxJQUFJLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFDbkMsSUFBSSxPQUFPLEdBQUcsQ0FBQyxJQUFJLENBQUMsS0FBSyxXQUFXO1lBQUUsT0FBTztRQUM3QyxJQUFJLGFBQWEsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFO1lBQ3BDLElBQUksUUFBUSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFO2dCQUN2QixNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDO2dCQUNsQixZQUFZLENBQUMsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDO2dCQUN4QixNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxFQUFFLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO2dCQUNoQyxNQUFNLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxFQUFFLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO2FBQ3ZDO2lCQUFNO2dCQUNMLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ3pCLFlBQVksQ0FBQyxJQUFJLENBQUMsR0FBRyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7YUFDaEM7U0FDRjthQUFNO1lBQ0wsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztTQUN4QjtJQUNILENBQUMsQ0FBQyxDQUFDO0lBRUgsT0FBTyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsSUFBSSxFQUFFLENBQUM7QUFDeEMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZVxuaW1wb3J0IHsgaXNPYmplY3QsIGV4dGVuZCB9IGZyb20gJy4vdXRpbHMnO1xuaW1wb3J0IHsgcGFyYW1zTGlzdCB9IGZyb20gJy4vcGFyYW1zLWxpc3QnO1xuLy8gQHRzLWlnbm9yZVxuaW1wb3J0IFN3aXBlciBmcm9tICdzd2lwZXInO1xuXG5leHBvcnQgY29uc3QgYWxsb3dlZFBhcmFtcyA9IHBhcmFtc0xpc3QubWFwKChrZXkpID0+IGtleS5yZXBsYWNlKC9fLywgJycpKTtcbmV4cG9ydCBmdW5jdGlvbiBnZXRQYXJhbXMob2JqOiBhbnkgPSB7fSkge1xuICBjb25zdCBwYXJhbXM6IGFueSA9IHtcbiAgICBvbjoge30sXG4gIH07XG4gIGNvbnN0IHBhc3NlZFBhcmFtczogYW55ID0ge307XG4gIGV4dGVuZChwYXJhbXMsIFN3aXBlci5kZWZhdWx0cyk7XG4gIGV4dGVuZChwYXJhbXMsIFN3aXBlci5leHRlbmRlZERlZmF1bHRzKTtcbiAgcGFyYW1zLl9lbWl0Q2xhc3NlcyA9IHRydWU7XG5cbiAgY29uc3QgcmVzdDogYW55ID0ge307XG4gIE9iamVjdC5rZXlzKG9iaikuZm9yRWFjaCgoa2V5OiBzdHJpbmcpID0+IHtcbiAgICBjb25zdCBfa2V5ID0ga2V5LnJlcGxhY2UoL15fLywgJycpO1xuICAgIGlmICh0eXBlb2Ygb2JqW19rZXldID09PSAndW5kZWZpbmVkJykgcmV0dXJuO1xuICAgIGlmIChhbGxvd2VkUGFyYW1zLmluZGV4T2YoX2tleSkgPj0gMCkge1xuICAgICAgaWYgKGlzT2JqZWN0KG9ialtfa2V5XSkpIHtcbiAgICAgICAgcGFyYW1zW19rZXldID0ge307XG4gICAgICAgIHBhc3NlZFBhcmFtc1tfa2V5XSA9IHt9O1xuICAgICAgICBleHRlbmQocGFyYW1zW19rZXldLCBvYmpbX2tleV0pO1xuICAgICAgICBleHRlbmQocGFzc2VkUGFyYW1zW19rZXldLCBvYmpbX2tleV0pO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGFyYW1zW19rZXldID0gb2JqW19rZXldO1xuICAgICAgICBwYXNzZWRQYXJhbXNbX2tleV0gPSBvYmpbX2tleV07XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIHJlc3RbX2tleV0gPSBvYmpbX2tleV07XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4geyBwYXJhbXMsIHBhc3NlZFBhcmFtcywgcmVzdCB9O1xufVxuIl19
|
115
resources/web/include/swiper/angular/esm2015/angular/src/utils/params-list.js
vendored
Normal file
115
resources/web/include/swiper/angular/esm2015/angular/src/utils/params-list.js
vendored
Normal file
File diff suppressed because one or more lines are too long
49
resources/web/include/swiper/angular/esm2015/angular/src/utils/utils.js
vendored
Normal file
49
resources/web/include/swiper/angular/esm2015/angular/src/utils/utils.js
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
export function isObject(o) {
|
||||||
|
return (typeof o === 'object' &&
|
||||||
|
o !== null &&
|
||||||
|
o.constructor &&
|
||||||
|
Object.prototype.toString.call(o).slice(8, -1) === 'Object');
|
||||||
|
}
|
||||||
|
export function isShowEl(val, obj, el) {
|
||||||
|
return ((coerceBooleanProperty(val) === true && obj && !obj.el) ||
|
||||||
|
!(typeof obj !== 'boolean' &&
|
||||||
|
obj.el !== (el === null || el === void 0 ? void 0 : el.nativeElement) &&
|
||||||
|
(typeof obj.el === 'string' || typeof obj.el === 'object')));
|
||||||
|
}
|
||||||
|
export function extend(target, src) {
|
||||||
|
const noExtend = ['__proto__', 'constructor', 'prototype'];
|
||||||
|
Object.keys(src)
|
||||||
|
.filter((key) => noExtend.indexOf(key) < 0)
|
||||||
|
.forEach((key) => {
|
||||||
|
if (typeof target[key] === 'undefined') {
|
||||||
|
target[key] = src[key];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (target[key] && !src[key]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
|
||||||
|
if (src[key].__swiper__)
|
||||||
|
target[key] = src[key];
|
||||||
|
else
|
||||||
|
extend(target[key], src[key]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
target[key] = src[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function coerceBooleanProperty(value) {
|
||||||
|
return value != null && `${value}` !== 'false';
|
||||||
|
}
|
||||||
|
export const ignoreNgOnChanges = ['pagination', 'navigation', 'scrollbar', 'virtual'];
|
||||||
|
export function setProperty(val, obj = {}) {
|
||||||
|
if (isObject(val)) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
if (coerceBooleanProperty(val) === true) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYW5ndWxhci9zcmMvdXRpbHMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFFBQVEsQ0FBQyxDQUFNO0lBQzdCLE9BQU8sQ0FDTCxPQUFPLENBQUMsS0FBSyxRQUFRO1FBQ3JCLENBQUMsS0FBSyxJQUFJO1FBQ1YsQ0FBQyxDQUFDLFdBQVc7UUFDYixNQUFNLENBQUMsU0FBUyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVEsQ0FDNUQsQ0FBQztBQUNKLENBQUM7QUFFRCxNQUFNLFVBQVUsUUFBUSxDQUFDLEdBQVEsRUFBRSxHQUFRLEVBQUUsRUFBTztJQUNsRCxPQUFPLENBQ0wsQ0FBQyxxQkFBcUIsQ0FBQyxHQUFHLENBQUMsS0FBSyxJQUFJLElBQUksR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQztRQUN2RCxDQUFDLENBQ0MsT0FBTyxHQUFHLEtBQUssU0FBUztZQUN4QixHQUFHLENBQUMsRUFBRSxNQUFLLEVBQUUsYUFBRixFQUFFLHVCQUFGLEVBQUUsQ0FBRSxhQUFhLENBQUE7WUFDNUIsQ0FBQyxPQUFPLEdBQUcsQ0FBQyxFQUFFLEtBQUssUUFBUSxJQUFJLE9BQU8sR0FBRyxDQUFDLEVBQUUsS0FBSyxRQUFRLENBQUMsQ0FDM0QsQ0FDRixDQUFDO0FBQ0osQ0FBQztBQUVELE1BQU0sVUFBVSxNQUFNLENBQUMsTUFBVyxFQUFFLEdBQVE7SUFDMUMsTUFBTSxRQUFRLEdBQUcsQ0FBQyxXQUFXLEVBQUUsYUFBYSxFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBQzNELE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDO1NBQ2IsTUFBTSxDQUFDLENBQUMsR0FBRyxFQUFFLEVBQUUsQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQztTQUMxQyxPQUFPLENBQUMsQ0FBQyxHQUFHLEVBQUUsRUFBRTtRQUNmLElBQUksT0FBTyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssV0FBVyxFQUFFO1lBQ3RDLE1BQU0sQ0FBQyxHQUFHLENBQUMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUM7WUFDdkIsT0FBTztTQUNSO1FBQ0QsSUFBSSxNQUFNLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDNUIsT0FBTztTQUNSO1FBQ0QsSUFBSSxRQUFRLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksUUFBUSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBRTtZQUNuRixJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxVQUFVO2dCQUFFLE1BQU0sQ0FBQyxHQUFHLENBQUMsR0FBRyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUM7O2dCQUMzQyxNQUFNLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO1NBQ3BDO2FBQU07WUFDTCxNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1NBQ3hCO0lBQ0gsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDO0FBRUQsTUFBTSxVQUFVLHFCQUFxQixDQUFDLEtBQVU7SUFDOUMsT0FBTyxLQUFLLElBQUksSUFBSSxJQUFJLEdBQUcsS0FBSyxFQUFFLEtBQUssT0FBTyxDQUFDO0FBQ2pELENBQUM7QUFFRCxNQUFNLENBQUMsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLFlBQVksRUFBRSxZQUFZLEVBQUUsV0FBVyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0FBRXRGLE1BQU0sVUFBVSxXQUFXLENBQUMsR0FBUSxFQUFFLEdBQUcsR0FBRyxFQUFFO0lBQzVDLElBQUksUUFBUSxDQUFDLEdBQUcsQ0FBQyxFQUFFO1FBQ2pCLE9BQU8sR0FBRyxDQUFDO0tBQ1o7SUFFRCxJQUFJLHFCQUFxQixDQUFDLEdBQUcsQ0FBQyxLQUFLLElBQUksRUFBRTtRQUN2QyxPQUFPLEdBQUcsQ0FBQztLQUNaO0lBRUQsT0FBTyxLQUFLLENBQUM7QUFDZixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGlzT2JqZWN0KG86IGFueSk6IGJvb2xlYW4ge1xuICByZXR1cm4gKFxuICAgIHR5cGVvZiBvID09PSAnb2JqZWN0JyAmJlxuICAgIG8gIT09IG51bGwgJiZcbiAgICBvLmNvbnN0cnVjdG9yICYmXG4gICAgT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKG8pLnNsaWNlKDgsIC0xKSA9PT0gJ09iamVjdCdcbiAgKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGlzU2hvd0VsKHZhbDogYW55LCBvYmo6IGFueSwgZWw6IGFueSk6IGJvb2xlYW4ge1xuICByZXR1cm4gKFxuICAgIChjb2VyY2VCb29sZWFuUHJvcGVydHkodmFsKSA9PT0gdHJ1ZSAmJiBvYmogJiYgIW9iai5lbCkgfHxcbiAgICAhKFxuICAgICAgdHlwZW9mIG9iaiAhPT0gJ2Jvb2xlYW4nICYmXG4gICAgICBvYmouZWwgIT09IGVsPy5uYXRpdmVFbGVtZW50ICYmXG4gICAgICAodHlwZW9mIG9iai5lbCA9PT0gJ3N0cmluZycgfHwgdHlwZW9mIG9iai5lbCA9PT0gJ29iamVjdCcpXG4gICAgKVxuICApO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZXh0ZW5kKHRhcmdldDogYW55LCBzcmM6IGFueSkge1xuICBjb25zdCBub0V4dGVuZCA9IFsnX19wcm90b19fJywgJ2NvbnN0cnVjdG9yJywgJ3Byb3RvdHlwZSddO1xuICBPYmplY3Qua2V5cyhzcmMpXG4gICAgLmZpbHRlcigoa2V5KSA9PiBub0V4dGVuZC5pbmRleE9mKGtleSkgPCAwKVxuICAgIC5mb3JFYWNoKChrZXkpID0+IHtcbiAgICAgIGlmICh0eXBlb2YgdGFyZ2V0W2tleV0gPT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgIHRhcmdldFtrZXldID0gc3JjW2tleV07XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cbiAgICAgIGlmICh0YXJnZXRba2V5XSAmJiAhc3JjW2tleV0pIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgaWYgKGlzT2JqZWN0KHNyY1trZXldKSAmJiBpc09iamVjdCh0YXJnZXRba2V5XSkgJiYgT2JqZWN0LmtleXMoc3JjW2tleV0pLmxlbmd0aCA+IDApIHtcbiAgICAgICAgaWYgKHNyY1trZXldLl9fc3dpcGVyX18pIHRhcmdldFtrZXldID0gc3JjW2tleV07XG4gICAgICAgIGVsc2UgZXh0ZW5kKHRhcmdldFtrZXldLCBzcmNba2V5XSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB0YXJnZXRba2V5XSA9IHNyY1trZXldO1xuICAgICAgfVxuICAgIH0pO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY29lcmNlQm9vbGVhblByb3BlcnR5KHZhbHVlOiBhbnkpOiBib29sZWFuIHtcbiAgcmV0dXJuIHZhbHVlICE9IG51bGwgJiYgYCR7dmFsdWV9YCAhPT0gJ2ZhbHNlJztcbn1cblxuZXhwb3J0IGNvbnN0IGlnbm9yZU5nT25DaGFuZ2VzID0gWydwYWdpbmF0aW9uJywgJ25hdmlnYXRpb24nLCAnc2Nyb2xsYmFyJywgJ3ZpcnR1YWwnXTtcblxuZXhwb3J0IGZ1bmN0aW9uIHNldFByb3BlcnR5KHZhbDogYW55LCBvYmogPSB7fSk6IHt9IHwgZmFsc2Uge1xuICBpZiAoaXNPYmplY3QodmFsKSkge1xuICAgIHJldHVybiB2YWw7XG4gIH1cblxuICBpZiAoY29lcmNlQm9vbGVhblByb3BlcnR5KHZhbCkgPT09IHRydWUpIHtcbiAgICByZXR1cm4gb2JqO1xuICB9XG5cbiAgcmV0dXJuIGZhbHNlO1xufVxuIl19
|
2
resources/web/include/swiper/angular/esm2015/swiper-angular.js
vendored
Normal file
2
resources/web/include/swiper/angular/esm2015/swiper-angular.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export * from './angular/src/public-api';
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpcGVyLWFuZ3VsYXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3dpcGVyLWFuZ3VsYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywwQkFBMEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vYW5ndWxhci9zcmMvcHVibGljLWFwaSc7XG4iXX0=
|
5
resources/web/include/swiper/angular/esm2015/swiper_angular.js
vendored
Normal file
5
resources/web/include/swiper/angular/esm2015/swiper_angular.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Generated bundle index. Do not edit.
|
||||||
|
*/
|
||||||
|
export * from './swiper-angular';
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpcGVyX2FuZ3VsYXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3dpcGVyX2FuZ3VsYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3N3aXBlci1hbmd1bGFyJztcbiJdfQ==
|
1402
resources/web/include/swiper/angular/fesm2015/swiper_angular.js
vendored
Normal file
1402
resources/web/include/swiper/angular/fesm2015/swiper_angular.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
19
resources/web/include/swiper/angular/package.json
Normal file
19
resources/web/include/swiper/angular/package.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "swiper_angular",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": "true",
|
||||||
|
"peerDependencies": {
|
||||||
|
"@angular/common": "^12.2.0",
|
||||||
|
"@angular/core": "^12.2.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"main": "bundles/swiper_angular.umd.js",
|
||||||
|
"module": "fesm2015/swiper_angular.js",
|
||||||
|
"es2015": "fesm2015/swiper_angular.js",
|
||||||
|
"esm2015": "esm2015/swiper_angular.js",
|
||||||
|
"fesm2015": "fesm2015/swiper_angular.js",
|
||||||
|
"typings": "swiper_angular.d.ts",
|
||||||
|
"sideEffects": false
|
||||||
|
}
|
1
resources/web/include/swiper/angular/swiper-angular.d.ts
vendored
Normal file
1
resources/web/include/swiper/angular/swiper-angular.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './angular/src/public-api';
|
5
resources/web/include/swiper/angular/swiper_angular.d.ts
vendored
Normal file
5
resources/web/include/swiper/angular/swiper_angular.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Generated bundle index. Do not edit.
|
||||||
|
*/
|
||||||
|
/// <amd-module name="swiper_angular" />
|
||||||
|
export * from './swiper-angular';
|
|
@ -0,0 +1,40 @@
|
||||||
|
import { getWindow } from 'ssr-window';
|
||||||
|
export default function getBreakpoint(breakpoints, base = 'window', containerEl) {
|
||||||
|
if (!breakpoints || base === 'container' && !containerEl) return undefined;
|
||||||
|
let breakpoint = false;
|
||||||
|
const window = getWindow();
|
||||||
|
const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
|
||||||
|
const points = Object.keys(breakpoints).map(point => {
|
||||||
|
if (typeof point === 'string' && point.indexOf('@') === 0) {
|
||||||
|
const minRatio = parseFloat(point.substr(1));
|
||||||
|
const value = currentHeight * minRatio;
|
||||||
|
return {
|
||||||
|
value,
|
||||||
|
point
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
value: point,
|
||||||
|
point
|
||||||
|
};
|
||||||
|
});
|
||||||
|
points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
|
||||||
|
|
||||||
|
for (let i = 0; i < points.length; i += 1) {
|
||||||
|
const {
|
||||||
|
point,
|
||||||
|
value
|
||||||
|
} = points[i];
|
||||||
|
|
||||||
|
if (base === 'window') {
|
||||||
|
if (window.matchMedia(`(min-width: ${value}px)`).matches) {
|
||||||
|
breakpoint = point;
|
||||||
|
}
|
||||||
|
} else if (value <= containerEl.clientWidth) {
|
||||||
|
breakpoint = point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return breakpoint || 'max';
|
||||||
|
}
|
6
resources/web/include/swiper/core/breakpoints/index.js
Normal file
6
resources/web/include/swiper/core/breakpoints/index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import setBreakpoint from './setBreakpoint.js';
|
||||||
|
import getBreakpoint from './getBreakpoint.js';
|
||||||
|
export default {
|
||||||
|
setBreakpoint,
|
||||||
|
getBreakpoint
|
||||||
|
};
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { extend } from '../../shared/utils.js';
|
||||||
|
|
||||||
|
const isGridEnabled = (swiper, params) => {
|
||||||
|
return swiper.grid && params.grid && params.grid.rows > 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function setBreakpoint() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
activeIndex,
|
||||||
|
initialized,
|
||||||
|
loopedSlides = 0,
|
||||||
|
params,
|
||||||
|
$el
|
||||||
|
} = swiper;
|
||||||
|
const breakpoints = params.breakpoints;
|
||||||
|
if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
|
||||||
|
|
||||||
|
const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
|
||||||
|
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
|
||||||
|
const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
|
||||||
|
const breakpointParams = breakpointOnlyParams || swiper.originalParams;
|
||||||
|
const wasMultiRow = isGridEnabled(swiper, params);
|
||||||
|
const isMultiRow = isGridEnabled(swiper, breakpointParams);
|
||||||
|
const wasEnabled = params.enabled;
|
||||||
|
|
||||||
|
if (wasMultiRow && !isMultiRow) {
|
||||||
|
$el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`);
|
||||||
|
swiper.emitContainerClasses();
|
||||||
|
} else if (!wasMultiRow && isMultiRow) {
|
||||||
|
$el.addClass(`${params.containerModifierClass}grid`);
|
||||||
|
|
||||||
|
if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
|
||||||
|
$el.addClass(`${params.containerModifierClass}grid-column`);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emitContainerClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
||||||
|
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
||||||
|
|
||||||
|
if (directionChanged && initialized) {
|
||||||
|
swiper.changeDirection();
|
||||||
|
}
|
||||||
|
|
||||||
|
extend(swiper.params, breakpointParams);
|
||||||
|
const isEnabled = swiper.params.enabled;
|
||||||
|
Object.assign(swiper, {
|
||||||
|
allowTouchMove: swiper.params.allowTouchMove,
|
||||||
|
allowSlideNext: swiper.params.allowSlideNext,
|
||||||
|
allowSlidePrev: swiper.params.allowSlidePrev
|
||||||
|
});
|
||||||
|
|
||||||
|
if (wasEnabled && !isEnabled) {
|
||||||
|
swiper.disable();
|
||||||
|
} else if (!wasEnabled && isEnabled) {
|
||||||
|
swiper.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.currentBreakpoint = breakpoint;
|
||||||
|
swiper.emit('_beforeBreakpoint', breakpointParams);
|
||||||
|
|
||||||
|
if (needsReLoop && initialized) {
|
||||||
|
swiper.loopDestroy();
|
||||||
|
swiper.loopCreate();
|
||||||
|
swiper.updateSlides();
|
||||||
|
swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('breakpoint', breakpointParams);
|
||||||
|
}
|
38
resources/web/include/swiper/core/check-overflow/index.js
Normal file
38
resources/web/include/swiper/core/check-overflow/index.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
function checkOverflow() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
isLocked: wasLocked,
|
||||||
|
params
|
||||||
|
} = swiper;
|
||||||
|
const {
|
||||||
|
slidesOffsetBefore
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
if (slidesOffsetBefore) {
|
||||||
|
const lastSlideIndex = swiper.slides.length - 1;
|
||||||
|
const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
|
||||||
|
swiper.isLocked = swiper.size > lastSlideRightEdge;
|
||||||
|
} else {
|
||||||
|
swiper.isLocked = swiper.snapGrid.length === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.allowSlideNext === true) {
|
||||||
|
swiper.allowSlideNext = !swiper.isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.allowSlidePrev === true) {
|
||||||
|
swiper.allowSlidePrev = !swiper.isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wasLocked && wasLocked !== swiper.isLocked) {
|
||||||
|
swiper.isEnd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wasLocked !== swiper.isLocked) {
|
||||||
|
swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
checkOverflow
|
||||||
|
};
|
52
resources/web/include/swiper/core/classes/addClasses.js
Normal file
52
resources/web/include/swiper/core/classes/addClasses.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
function prepareClasses(entries, prefix) {
|
||||||
|
const resultClasses = [];
|
||||||
|
entries.forEach(item => {
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
Object.keys(item).forEach(classNames => {
|
||||||
|
if (item[classNames]) {
|
||||||
|
resultClasses.push(prefix + classNames);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (typeof item === 'string') {
|
||||||
|
resultClasses.push(prefix + item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return resultClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function addClasses() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
classNames,
|
||||||
|
params,
|
||||||
|
rtl,
|
||||||
|
$el,
|
||||||
|
device,
|
||||||
|
support
|
||||||
|
} = swiper; // prettier-ignore
|
||||||
|
|
||||||
|
const suffixes = prepareClasses(['initialized', params.direction, {
|
||||||
|
'pointer-events': !support.touch
|
||||||
|
}, {
|
||||||
|
'free-mode': swiper.params.freeMode && params.freeMode.enabled
|
||||||
|
}, {
|
||||||
|
'autoheight': params.autoHeight
|
||||||
|
}, {
|
||||||
|
'rtl': rtl
|
||||||
|
}, {
|
||||||
|
'grid': params.grid && params.grid.rows > 1
|
||||||
|
}, {
|
||||||
|
'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
|
||||||
|
}, {
|
||||||
|
'android': device.android
|
||||||
|
}, {
|
||||||
|
'ios': device.ios
|
||||||
|
}, {
|
||||||
|
'css-mode': params.cssMode
|
||||||
|
}, {
|
||||||
|
'centered': params.cssMode && params.centeredSlides
|
||||||
|
}], params.containerModifierClass);
|
||||||
|
classNames.push(...suffixes);
|
||||||
|
$el.addClass([...classNames].join(' '));
|
||||||
|
swiper.emitContainerClasses();
|
||||||
|
}
|
6
resources/web/include/swiper/core/classes/index.js
Normal file
6
resources/web/include/swiper/core/classes/index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import addClasses from './addClasses.js';
|
||||||
|
import removeClasses from './removeClasses.js';
|
||||||
|
export default {
|
||||||
|
addClasses,
|
||||||
|
removeClasses
|
||||||
|
};
|
|
@ -0,0 +1,9 @@
|
||||||
|
export default function removeClasses() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
$el,
|
||||||
|
classNames
|
||||||
|
} = swiper;
|
||||||
|
$el.removeClass(classNames.join(' '));
|
||||||
|
swiper.emitContainerClasses();
|
||||||
|
}
|
610
resources/web/include/swiper/core/core.js
Normal file
610
resources/web/include/swiper/core/core.js
Normal file
|
@ -0,0 +1,610 @@
|
||||||
|
/* eslint no-param-reassign: "off" */
|
||||||
|
import { getDocument } from 'ssr-window';
|
||||||
|
import $ from '../shared/dom.js';
|
||||||
|
import { extend, now, deleteProps } from '../shared/utils.js';
|
||||||
|
import { getSupport } from '../shared/get-support.js';
|
||||||
|
import { getDevice } from '../shared/get-device.js';
|
||||||
|
import { getBrowser } from '../shared/get-browser.js';
|
||||||
|
import Resize from './modules/resize/resize.js';
|
||||||
|
import Observer from './modules/observer/observer.js';
|
||||||
|
import eventsEmitter from './events-emitter.js';
|
||||||
|
import update from './update/index.js';
|
||||||
|
import translate from './translate/index.js';
|
||||||
|
import transition from './transition/index.js';
|
||||||
|
import slide from './slide/index.js';
|
||||||
|
import loop from './loop/index.js';
|
||||||
|
import grabCursor from './grab-cursor/index.js';
|
||||||
|
import events from './events/index.js';
|
||||||
|
import breakpoints from './breakpoints/index.js';
|
||||||
|
import classes from './classes/index.js';
|
||||||
|
import images from './images/index.js';
|
||||||
|
import checkOverflow from './check-overflow/index.js';
|
||||||
|
import defaults from './defaults.js';
|
||||||
|
import moduleExtendParams from './moduleExtendParams.js';
|
||||||
|
const prototypes = {
|
||||||
|
eventsEmitter,
|
||||||
|
update,
|
||||||
|
translate,
|
||||||
|
transition,
|
||||||
|
slide,
|
||||||
|
loop,
|
||||||
|
grabCursor,
|
||||||
|
events,
|
||||||
|
breakpoints,
|
||||||
|
checkOverflow,
|
||||||
|
classes,
|
||||||
|
images
|
||||||
|
};
|
||||||
|
const extendedDefaults = {};
|
||||||
|
|
||||||
|
class Swiper {
|
||||||
|
constructor(...args) {
|
||||||
|
let el;
|
||||||
|
let params;
|
||||||
|
|
||||||
|
if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
|
||||||
|
params = args[0];
|
||||||
|
} else {
|
||||||
|
[el, params] = args;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params) params = {};
|
||||||
|
params = extend({}, params);
|
||||||
|
if (el && !params.el) params.el = el;
|
||||||
|
|
||||||
|
if (params.el && $(params.el).length > 1) {
|
||||||
|
const swipers = [];
|
||||||
|
$(params.el).each(containerEl => {
|
||||||
|
const newParams = extend({}, params, {
|
||||||
|
el: containerEl
|
||||||
|
});
|
||||||
|
swipers.push(new Swiper(newParams));
|
||||||
|
});
|
||||||
|
return swipers;
|
||||||
|
} // Swiper Instance
|
||||||
|
|
||||||
|
|
||||||
|
const swiper = this;
|
||||||
|
swiper.__swiper__ = true;
|
||||||
|
swiper.support = getSupport();
|
||||||
|
swiper.device = getDevice({
|
||||||
|
userAgent: params.userAgent
|
||||||
|
});
|
||||||
|
swiper.browser = getBrowser();
|
||||||
|
swiper.eventsListeners = {};
|
||||||
|
swiper.eventsAnyListeners = [];
|
||||||
|
swiper.modules = [...swiper.__modules__];
|
||||||
|
|
||||||
|
if (params.modules && Array.isArray(params.modules)) {
|
||||||
|
swiper.modules.push(...params.modules);
|
||||||
|
}
|
||||||
|
|
||||||
|
const allModulesParams = {};
|
||||||
|
swiper.modules.forEach(mod => {
|
||||||
|
mod({
|
||||||
|
swiper,
|
||||||
|
extendParams: moduleExtendParams(params, allModulesParams),
|
||||||
|
on: swiper.on.bind(swiper),
|
||||||
|
once: swiper.once.bind(swiper),
|
||||||
|
off: swiper.off.bind(swiper),
|
||||||
|
emit: swiper.emit.bind(swiper)
|
||||||
|
});
|
||||||
|
}); // Extend defaults with modules params
|
||||||
|
|
||||||
|
const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params
|
||||||
|
|
||||||
|
swiper.params = extend({}, swiperParams, extendedDefaults, params);
|
||||||
|
swiper.originalParams = extend({}, swiper.params);
|
||||||
|
swiper.passedParams = extend({}, params); // add event listeners
|
||||||
|
|
||||||
|
if (swiper.params && swiper.params.on) {
|
||||||
|
Object.keys(swiper.params.on).forEach(eventName => {
|
||||||
|
swiper.on(eventName, swiper.params.on[eventName]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params && swiper.params.onAny) {
|
||||||
|
swiper.onAny(swiper.params.onAny);
|
||||||
|
} // Save Dom lib
|
||||||
|
|
||||||
|
|
||||||
|
swiper.$ = $; // Extend Swiper
|
||||||
|
|
||||||
|
Object.assign(swiper, {
|
||||||
|
enabled: swiper.params.enabled,
|
||||||
|
el,
|
||||||
|
// Classes
|
||||||
|
classNames: [],
|
||||||
|
// Slides
|
||||||
|
slides: $(),
|
||||||
|
slidesGrid: [],
|
||||||
|
snapGrid: [],
|
||||||
|
slidesSizesGrid: [],
|
||||||
|
|
||||||
|
// isDirection
|
||||||
|
isHorizontal() {
|
||||||
|
return swiper.params.direction === 'horizontal';
|
||||||
|
},
|
||||||
|
|
||||||
|
isVertical() {
|
||||||
|
return swiper.params.direction === 'vertical';
|
||||||
|
},
|
||||||
|
|
||||||
|
// Indexes
|
||||||
|
activeIndex: 0,
|
||||||
|
realIndex: 0,
|
||||||
|
//
|
||||||
|
isBeginning: true,
|
||||||
|
isEnd: false,
|
||||||
|
// Props
|
||||||
|
translate: 0,
|
||||||
|
previousTranslate: 0,
|
||||||
|
progress: 0,
|
||||||
|
velocity: 0,
|
||||||
|
animating: false,
|
||||||
|
// Locks
|
||||||
|
allowSlideNext: swiper.params.allowSlideNext,
|
||||||
|
allowSlidePrev: swiper.params.allowSlidePrev,
|
||||||
|
// Touch Events
|
||||||
|
touchEvents: function touchEvents() {
|
||||||
|
const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
||||||
|
const desktop = ['pointerdown', 'pointermove', 'pointerup'];
|
||||||
|
swiper.touchEventsTouch = {
|
||||||
|
start: touch[0],
|
||||||
|
move: touch[1],
|
||||||
|
end: touch[2],
|
||||||
|
cancel: touch[3]
|
||||||
|
};
|
||||||
|
swiper.touchEventsDesktop = {
|
||||||
|
start: desktop[0],
|
||||||
|
move: desktop[1],
|
||||||
|
end: desktop[2]
|
||||||
|
};
|
||||||
|
return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
|
||||||
|
}(),
|
||||||
|
touchEventsData: {
|
||||||
|
isTouched: undefined,
|
||||||
|
isMoved: undefined,
|
||||||
|
allowTouchCallbacks: undefined,
|
||||||
|
touchStartTime: undefined,
|
||||||
|
isScrolling: undefined,
|
||||||
|
currentTranslate: undefined,
|
||||||
|
startTranslate: undefined,
|
||||||
|
allowThresholdMove: undefined,
|
||||||
|
// Form elements to match
|
||||||
|
focusableElements: swiper.params.focusableElements,
|
||||||
|
// Last click time
|
||||||
|
lastClickTime: now(),
|
||||||
|
clickTimeout: undefined,
|
||||||
|
// Velocities
|
||||||
|
velocities: [],
|
||||||
|
allowMomentumBounce: undefined,
|
||||||
|
isTouchEvent: undefined,
|
||||||
|
startMoving: undefined
|
||||||
|
},
|
||||||
|
// Clicks
|
||||||
|
allowClick: true,
|
||||||
|
// Touches
|
||||||
|
allowTouchMove: swiper.params.allowTouchMove,
|
||||||
|
touches: {
|
||||||
|
startX: 0,
|
||||||
|
startY: 0,
|
||||||
|
currentX: 0,
|
||||||
|
currentY: 0,
|
||||||
|
diff: 0
|
||||||
|
},
|
||||||
|
// Images
|
||||||
|
imagesToLoad: [],
|
||||||
|
imagesLoaded: 0
|
||||||
|
});
|
||||||
|
swiper.emit('_swiper'); // Init
|
||||||
|
|
||||||
|
if (swiper.params.init) {
|
||||||
|
swiper.init();
|
||||||
|
} // Return app instance
|
||||||
|
|
||||||
|
|
||||||
|
return swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
enable() {
|
||||||
|
const swiper = this;
|
||||||
|
if (swiper.enabled) return;
|
||||||
|
swiper.enabled = true;
|
||||||
|
|
||||||
|
if (swiper.params.grabCursor) {
|
||||||
|
swiper.setGrabCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('enable');
|
||||||
|
}
|
||||||
|
|
||||||
|
disable() {
|
||||||
|
const swiper = this;
|
||||||
|
if (!swiper.enabled) return;
|
||||||
|
swiper.enabled = false;
|
||||||
|
|
||||||
|
if (swiper.params.grabCursor) {
|
||||||
|
swiper.unsetGrabCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('disable');
|
||||||
|
}
|
||||||
|
|
||||||
|
setProgress(progress, speed) {
|
||||||
|
const swiper = this;
|
||||||
|
progress = Math.min(Math.max(progress, 0), 1);
|
||||||
|
const min = swiper.minTranslate();
|
||||||
|
const max = swiper.maxTranslate();
|
||||||
|
const current = (max - min) * progress + min;
|
||||||
|
swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
|
||||||
|
swiper.updateActiveIndex();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
emitContainerClasses() {
|
||||||
|
const swiper = this;
|
||||||
|
if (!swiper.params._emitClasses || !swiper.el) return;
|
||||||
|
const cls = swiper.el.className.split(' ').filter(className => {
|
||||||
|
return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
|
||||||
|
});
|
||||||
|
swiper.emit('_containerClasses', cls.join(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
getSlideClasses(slideEl) {
|
||||||
|
const swiper = this;
|
||||||
|
return slideEl.className.split(' ').filter(className => {
|
||||||
|
return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
|
||||||
|
}).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
emitSlidesClasses() {
|
||||||
|
const swiper = this;
|
||||||
|
if (!swiper.params._emitClasses || !swiper.el) return;
|
||||||
|
const updates = [];
|
||||||
|
swiper.slides.each(slideEl => {
|
||||||
|
const classNames = swiper.getSlideClasses(slideEl);
|
||||||
|
updates.push({
|
||||||
|
slideEl,
|
||||||
|
classNames
|
||||||
|
});
|
||||||
|
swiper.emit('_slideClass', slideEl, classNames);
|
||||||
|
});
|
||||||
|
swiper.emit('_slideClasses', updates);
|
||||||
|
}
|
||||||
|
|
||||||
|
slidesPerViewDynamic(view = 'current', exact = false) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
slides,
|
||||||
|
slidesGrid,
|
||||||
|
slidesSizesGrid,
|
||||||
|
size: swiperSize,
|
||||||
|
activeIndex
|
||||||
|
} = swiper;
|
||||||
|
let spv = 1;
|
||||||
|
|
||||||
|
if (params.centeredSlides) {
|
||||||
|
let slideSize = slides[activeIndex].swiperSlideSize;
|
||||||
|
let breakLoop;
|
||||||
|
|
||||||
|
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
||||||
|
if (slides[i] && !breakLoop) {
|
||||||
|
slideSize += slides[i].swiperSlideSize;
|
||||||
|
spv += 1;
|
||||||
|
if (slideSize > swiperSize) breakLoop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
||||||
|
if (slides[i] && !breakLoop) {
|
||||||
|
slideSize += slides[i].swiperSlideSize;
|
||||||
|
spv += 1;
|
||||||
|
if (slideSize > swiperSize) breakLoop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
if (view === 'current') {
|
||||||
|
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
||||||
|
const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
|
||||||
|
|
||||||
|
if (slideInView) {
|
||||||
|
spv += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// previous
|
||||||
|
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
||||||
|
const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
|
||||||
|
|
||||||
|
if (slideInView) {
|
||||||
|
spv += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return spv;
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
const swiper = this;
|
||||||
|
if (!swiper || swiper.destroyed) return;
|
||||||
|
const {
|
||||||
|
snapGrid,
|
||||||
|
params
|
||||||
|
} = swiper; // Breakpoints
|
||||||
|
|
||||||
|
if (params.breakpoints) {
|
||||||
|
swiper.setBreakpoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.updateSize();
|
||||||
|
swiper.updateSlides();
|
||||||
|
swiper.updateProgress();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
|
||||||
|
function setTranslate() {
|
||||||
|
const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
|
||||||
|
const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
|
||||||
|
swiper.setTranslate(newTranslate);
|
||||||
|
swiper.updateActiveIndex();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
let translated;
|
||||||
|
|
||||||
|
if (swiper.params.freeMode && swiper.params.freeMode.enabled) {
|
||||||
|
setTranslate();
|
||||||
|
|
||||||
|
if (swiper.params.autoHeight) {
|
||||||
|
swiper.updateAutoHeight();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
|
||||||
|
translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
||||||
|
} else {
|
||||||
|
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!translated) {
|
||||||
|
setTranslate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
||||||
|
swiper.checkOverflow();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('update');
|
||||||
|
}
|
||||||
|
|
||||||
|
changeDirection(newDirection, needUpdate = true) {
|
||||||
|
const swiper = this;
|
||||||
|
const currentDirection = swiper.params.direction;
|
||||||
|
|
||||||
|
if (!newDirection) {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
|
||||||
|
return swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`);
|
||||||
|
swiper.emitContainerClasses();
|
||||||
|
swiper.params.direction = newDirection;
|
||||||
|
swiper.slides.each(slideEl => {
|
||||||
|
if (newDirection === 'vertical') {
|
||||||
|
slideEl.style.width = '';
|
||||||
|
} else {
|
||||||
|
slideEl.style.height = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
swiper.emit('changeDirection');
|
||||||
|
if (needUpdate) swiper.update();
|
||||||
|
return swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
mount(el) {
|
||||||
|
const swiper = this;
|
||||||
|
if (swiper.mounted) return true; // Find el
|
||||||
|
|
||||||
|
const $el = $(el || swiper.params.el);
|
||||||
|
el = $el[0];
|
||||||
|
|
||||||
|
if (!el) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
el.swiper = swiper;
|
||||||
|
|
||||||
|
const getWrapperSelector = () => {
|
||||||
|
return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getWrapper = () => {
|
||||||
|
if (el && el.shadowRoot && el.shadowRoot.querySelector) {
|
||||||
|
const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items
|
||||||
|
|
||||||
|
res.children = options => $el.children(options);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $el.children(getWrapperSelector());
|
||||||
|
}; // Find Wrapper
|
||||||
|
|
||||||
|
|
||||||
|
let $wrapperEl = getWrapper();
|
||||||
|
|
||||||
|
if ($wrapperEl.length === 0 && swiper.params.createElements) {
|
||||||
|
const document = getDocument();
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
$wrapperEl = $(wrapper);
|
||||||
|
wrapper.className = swiper.params.wrapperClass;
|
||||||
|
$el.append(wrapper);
|
||||||
|
$el.children(`.${swiper.params.slideClass}`).each(slideEl => {
|
||||||
|
$wrapperEl.append(slideEl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(swiper, {
|
||||||
|
$el,
|
||||||
|
el,
|
||||||
|
$wrapperEl,
|
||||||
|
wrapperEl: $wrapperEl[0],
|
||||||
|
mounted: true,
|
||||||
|
// RTL
|
||||||
|
rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
|
||||||
|
rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
|
||||||
|
wrongRTL: $wrapperEl.css('display') === '-webkit-box'
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
init(el) {
|
||||||
|
const swiper = this;
|
||||||
|
if (swiper.initialized) return swiper;
|
||||||
|
const mounted = swiper.mount(el);
|
||||||
|
if (mounted === false) return swiper;
|
||||||
|
swiper.emit('beforeInit'); // Set breakpoint
|
||||||
|
|
||||||
|
if (swiper.params.breakpoints) {
|
||||||
|
swiper.setBreakpoint();
|
||||||
|
} // Add Classes
|
||||||
|
|
||||||
|
|
||||||
|
swiper.addClasses(); // Create loop
|
||||||
|
|
||||||
|
if (swiper.params.loop) {
|
||||||
|
swiper.loopCreate();
|
||||||
|
} // Update size
|
||||||
|
|
||||||
|
|
||||||
|
swiper.updateSize(); // Update slides
|
||||||
|
|
||||||
|
swiper.updateSlides();
|
||||||
|
|
||||||
|
if (swiper.params.watchOverflow) {
|
||||||
|
swiper.checkOverflow();
|
||||||
|
} // Set Grab Cursor
|
||||||
|
|
||||||
|
|
||||||
|
if (swiper.params.grabCursor && swiper.enabled) {
|
||||||
|
swiper.setGrabCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params.preloadImages) {
|
||||||
|
swiper.preloadImages();
|
||||||
|
} // Slide To Initial Slide
|
||||||
|
|
||||||
|
|
||||||
|
if (swiper.params.loop) {
|
||||||
|
swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
|
||||||
|
} // Attach events
|
||||||
|
|
||||||
|
|
||||||
|
swiper.attachEvents(); // Init Flag
|
||||||
|
|
||||||
|
swiper.initialized = true; // Emit
|
||||||
|
|
||||||
|
swiper.emit('init');
|
||||||
|
swiper.emit('afterInit');
|
||||||
|
return swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy(deleteInstance = true, cleanStyles = true) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
$el,
|
||||||
|
$wrapperEl,
|
||||||
|
slides
|
||||||
|
} = swiper;
|
||||||
|
|
||||||
|
if (typeof swiper.params === 'undefined' || swiper.destroyed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('beforeDestroy'); // Init Flag
|
||||||
|
|
||||||
|
swiper.initialized = false; // Detach events
|
||||||
|
|
||||||
|
swiper.detachEvents(); // Destroy loop
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
swiper.loopDestroy();
|
||||||
|
} // Cleanup styles
|
||||||
|
|
||||||
|
|
||||||
|
if (cleanStyles) {
|
||||||
|
swiper.removeClasses();
|
||||||
|
$el.removeAttr('style');
|
||||||
|
$wrapperEl.removeAttr('style');
|
||||||
|
|
||||||
|
if (slides && slides.length) {
|
||||||
|
slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('destroy'); // Detach emitter events
|
||||||
|
|
||||||
|
Object.keys(swiper.eventsListeners).forEach(eventName => {
|
||||||
|
swiper.off(eventName);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (deleteInstance !== false) {
|
||||||
|
swiper.$el[0].swiper = null;
|
||||||
|
deleteProps(swiper);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.destroyed = true;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static extendDefaults(newDefaults) {
|
||||||
|
extend(extendedDefaults, newDefaults);
|
||||||
|
}
|
||||||
|
|
||||||
|
static get extendedDefaults() {
|
||||||
|
return extendedDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaults() {
|
||||||
|
return defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
static installModule(mod) {
|
||||||
|
if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
|
||||||
|
const modules = Swiper.prototype.__modules__;
|
||||||
|
|
||||||
|
if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
|
||||||
|
modules.push(mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static use(module) {
|
||||||
|
if (Array.isArray(module)) {
|
||||||
|
module.forEach(m => Swiper.installModule(m));
|
||||||
|
return Swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
Swiper.installModule(module);
|
||||||
|
return Swiper;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(prototypes).forEach(prototypeGroup => {
|
||||||
|
Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
|
||||||
|
Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Swiper.use([Resize, Observer]);
|
||||||
|
export default Swiper;
|
120
resources/web/include/swiper/core/defaults.js
Normal file
120
resources/web/include/swiper/core/defaults.js
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
export default {
|
||||||
|
init: true,
|
||||||
|
direction: 'horizontal',
|
||||||
|
touchEventsTarget: 'wrapper',
|
||||||
|
initialSlide: 0,
|
||||||
|
speed: 300,
|
||||||
|
cssMode: false,
|
||||||
|
updateOnWindowResize: true,
|
||||||
|
resizeObserver: true,
|
||||||
|
nested: false,
|
||||||
|
createElements: false,
|
||||||
|
enabled: true,
|
||||||
|
focusableElements: 'input, select, option, textarea, button, video, label',
|
||||||
|
// Overrides
|
||||||
|
width: null,
|
||||||
|
height: null,
|
||||||
|
//
|
||||||
|
preventInteractionOnTransition: false,
|
||||||
|
// ssr
|
||||||
|
userAgent: null,
|
||||||
|
url: null,
|
||||||
|
// To support iOS's swipe-to-go-back gesture (when being used in-app).
|
||||||
|
edgeSwipeDetection: false,
|
||||||
|
edgeSwipeThreshold: 20,
|
||||||
|
// Autoheight
|
||||||
|
autoHeight: false,
|
||||||
|
// Set wrapper width
|
||||||
|
setWrapperSize: false,
|
||||||
|
// Virtual Translate
|
||||||
|
virtualTranslate: false,
|
||||||
|
// Effects
|
||||||
|
effect: 'slide',
|
||||||
|
// 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
|
||||||
|
// Breakpoints
|
||||||
|
breakpoints: undefined,
|
||||||
|
breakpointsBase: 'window',
|
||||||
|
// Slides grid
|
||||||
|
spaceBetween: 0,
|
||||||
|
slidesPerView: 1,
|
||||||
|
slidesPerGroup: 1,
|
||||||
|
slidesPerGroupSkip: 0,
|
||||||
|
slidesPerGroupAuto: false,
|
||||||
|
centeredSlides: false,
|
||||||
|
centeredSlidesBounds: false,
|
||||||
|
slidesOffsetBefore: 0,
|
||||||
|
// in px
|
||||||
|
slidesOffsetAfter: 0,
|
||||||
|
// in px
|
||||||
|
normalizeSlideIndex: true,
|
||||||
|
centerInsufficientSlides: false,
|
||||||
|
// Disable swiper and hide navigation when container not overflow
|
||||||
|
watchOverflow: true,
|
||||||
|
// Round length
|
||||||
|
roundLengths: false,
|
||||||
|
// Touches
|
||||||
|
touchRatio: 1,
|
||||||
|
touchAngle: 45,
|
||||||
|
simulateTouch: true,
|
||||||
|
shortSwipes: true,
|
||||||
|
longSwipes: true,
|
||||||
|
longSwipesRatio: 0.5,
|
||||||
|
longSwipesMs: 300,
|
||||||
|
followFinger: true,
|
||||||
|
allowTouchMove: true,
|
||||||
|
threshold: 0,
|
||||||
|
touchMoveStopPropagation: false,
|
||||||
|
touchStartPreventDefault: true,
|
||||||
|
touchStartForcePreventDefault: false,
|
||||||
|
touchReleaseOnEdges: false,
|
||||||
|
// Unique Navigation Elements
|
||||||
|
uniqueNavElements: true,
|
||||||
|
// Resistance
|
||||||
|
resistance: true,
|
||||||
|
resistanceRatio: 0.85,
|
||||||
|
// Progress
|
||||||
|
watchSlidesProgress: false,
|
||||||
|
// Cursor
|
||||||
|
grabCursor: false,
|
||||||
|
// Clicks
|
||||||
|
preventClicks: true,
|
||||||
|
preventClicksPropagation: true,
|
||||||
|
slideToClickedSlide: false,
|
||||||
|
// Images
|
||||||
|
preloadImages: true,
|
||||||
|
updateOnImagesReady: true,
|
||||||
|
// loop
|
||||||
|
loop: false,
|
||||||
|
loopAdditionalSlides: 0,
|
||||||
|
loopedSlides: null,
|
||||||
|
loopFillGroupWithBlank: false,
|
||||||
|
loopPreventsSlide: true,
|
||||||
|
// Swiping/no swiping
|
||||||
|
allowSlidePrev: true,
|
||||||
|
allowSlideNext: true,
|
||||||
|
swipeHandler: null,
|
||||||
|
// '.swipe-handler',
|
||||||
|
noSwiping: true,
|
||||||
|
noSwipingClass: 'swiper-no-swiping',
|
||||||
|
noSwipingSelector: null,
|
||||||
|
// Passive Listeners
|
||||||
|
passiveListeners: true,
|
||||||
|
// NS
|
||||||
|
containerModifierClass: 'swiper-',
|
||||||
|
// NEW
|
||||||
|
slideClass: 'swiper-slide',
|
||||||
|
slideBlankClass: 'swiper-slide-invisible-blank',
|
||||||
|
slideActiveClass: 'swiper-slide-active',
|
||||||
|
slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
|
||||||
|
slideVisibleClass: 'swiper-slide-visible',
|
||||||
|
slideDuplicateClass: 'swiper-slide-duplicate',
|
||||||
|
slideNextClass: 'swiper-slide-next',
|
||||||
|
slideDuplicateNextClass: 'swiper-slide-duplicate-next',
|
||||||
|
slidePrevClass: 'swiper-slide-prev',
|
||||||
|
slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
|
||||||
|
wrapperClass: 'swiper-wrapper',
|
||||||
|
// Callbacks
|
||||||
|
runCallbacksOnInit: true,
|
||||||
|
// Internals
|
||||||
|
_emitClasses: false
|
||||||
|
};
|
108
resources/web/include/swiper/core/events-emitter.js
Normal file
108
resources/web/include/swiper/core/events-emitter.js
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/* eslint-disable no-underscore-dangle */
|
||||||
|
export default {
|
||||||
|
on(events, handler, priority) {
|
||||||
|
const self = this;
|
||||||
|
if (typeof handler !== 'function') return self;
|
||||||
|
const method = priority ? 'unshift' : 'push';
|
||||||
|
events.split(' ').forEach(event => {
|
||||||
|
if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
|
||||||
|
self.eventsListeners[event][method](handler);
|
||||||
|
});
|
||||||
|
return self;
|
||||||
|
},
|
||||||
|
|
||||||
|
once(events, handler, priority) {
|
||||||
|
const self = this;
|
||||||
|
if (typeof handler !== 'function') return self;
|
||||||
|
|
||||||
|
function onceHandler(...args) {
|
||||||
|
self.off(events, onceHandler);
|
||||||
|
|
||||||
|
if (onceHandler.__emitterProxy) {
|
||||||
|
delete onceHandler.__emitterProxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.apply(self, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
onceHandler.__emitterProxy = handler;
|
||||||
|
return self.on(events, onceHandler, priority);
|
||||||
|
},
|
||||||
|
|
||||||
|
onAny(handler, priority) {
|
||||||
|
const self = this;
|
||||||
|
if (typeof handler !== 'function') return self;
|
||||||
|
const method = priority ? 'unshift' : 'push';
|
||||||
|
|
||||||
|
if (self.eventsAnyListeners.indexOf(handler) < 0) {
|
||||||
|
self.eventsAnyListeners[method](handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
},
|
||||||
|
|
||||||
|
offAny(handler) {
|
||||||
|
const self = this;
|
||||||
|
if (!self.eventsAnyListeners) return self;
|
||||||
|
const index = self.eventsAnyListeners.indexOf(handler);
|
||||||
|
|
||||||
|
if (index >= 0) {
|
||||||
|
self.eventsAnyListeners.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
},
|
||||||
|
|
||||||
|
off(events, handler) {
|
||||||
|
const self = this;
|
||||||
|
if (!self.eventsListeners) return self;
|
||||||
|
events.split(' ').forEach(event => {
|
||||||
|
if (typeof handler === 'undefined') {
|
||||||
|
self.eventsListeners[event] = [];
|
||||||
|
} else if (self.eventsListeners[event]) {
|
||||||
|
self.eventsListeners[event].forEach((eventHandler, index) => {
|
||||||
|
if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
|
||||||
|
self.eventsListeners[event].splice(index, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return self;
|
||||||
|
},
|
||||||
|
|
||||||
|
emit(...args) {
|
||||||
|
const self = this;
|
||||||
|
if (!self.eventsListeners) return self;
|
||||||
|
let events;
|
||||||
|
let data;
|
||||||
|
let context;
|
||||||
|
|
||||||
|
if (typeof args[0] === 'string' || Array.isArray(args[0])) {
|
||||||
|
events = args[0];
|
||||||
|
data = args.slice(1, args.length);
|
||||||
|
context = self;
|
||||||
|
} else {
|
||||||
|
events = args[0].events;
|
||||||
|
data = args[0].data;
|
||||||
|
context = args[0].context || self;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.unshift(context);
|
||||||
|
const eventsArray = Array.isArray(events) ? events : events.split(' ');
|
||||||
|
eventsArray.forEach(event => {
|
||||||
|
if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
|
||||||
|
self.eventsAnyListeners.forEach(eventHandler => {
|
||||||
|
eventHandler.apply(context, [event, ...data]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.eventsListeners && self.eventsListeners[event]) {
|
||||||
|
self.eventsListeners[event].forEach(eventHandler => {
|
||||||
|
eventHandler.apply(context, data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
97
resources/web/include/swiper/core/events/index.js
Normal file
97
resources/web/include/swiper/core/events/index.js
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
import { getDocument } from 'ssr-window';
|
||||||
|
import onTouchStart from './onTouchStart.js';
|
||||||
|
import onTouchMove from './onTouchMove.js';
|
||||||
|
import onTouchEnd from './onTouchEnd.js';
|
||||||
|
import onResize from './onResize.js';
|
||||||
|
import onClick from './onClick.js';
|
||||||
|
import onScroll from './onScroll.js';
|
||||||
|
let dummyEventAttached = false;
|
||||||
|
|
||||||
|
function dummyEventListener() {}
|
||||||
|
|
||||||
|
const events = (swiper, method) => {
|
||||||
|
const document = getDocument();
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
touchEvents,
|
||||||
|
el,
|
||||||
|
wrapperEl,
|
||||||
|
device,
|
||||||
|
support
|
||||||
|
} = swiper;
|
||||||
|
const capture = !!params.nested;
|
||||||
|
const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
|
||||||
|
const swiperMethod = method; // Touch Events
|
||||||
|
|
||||||
|
if (!support.touch) {
|
||||||
|
el[domMethod](touchEvents.start, swiper.onTouchStart, false);
|
||||||
|
document[domMethod](touchEvents.move, swiper.onTouchMove, capture);
|
||||||
|
document[domMethod](touchEvents.end, swiper.onTouchEnd, false);
|
||||||
|
} else {
|
||||||
|
const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
|
||||||
|
passive: true,
|
||||||
|
capture: false
|
||||||
|
} : false;
|
||||||
|
el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener);
|
||||||
|
el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
|
||||||
|
passive: false,
|
||||||
|
capture
|
||||||
|
} : capture);
|
||||||
|
el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener);
|
||||||
|
|
||||||
|
if (touchEvents.cancel) {
|
||||||
|
el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener);
|
||||||
|
}
|
||||||
|
} // Prevent Links Clicks
|
||||||
|
|
||||||
|
|
||||||
|
if (params.preventClicks || params.preventClicksPropagation) {
|
||||||
|
el[domMethod]('click', swiper.onClick, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
wrapperEl[domMethod]('scroll', swiper.onScroll);
|
||||||
|
} // Resize handler
|
||||||
|
|
||||||
|
|
||||||
|
if (params.updateOnWindowResize) {
|
||||||
|
swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
|
||||||
|
} else {
|
||||||
|
swiper[swiperMethod]('observerUpdate', onResize, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function attachEvents() {
|
||||||
|
const swiper = this;
|
||||||
|
const document = getDocument();
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
support
|
||||||
|
} = swiper;
|
||||||
|
swiper.onTouchStart = onTouchStart.bind(swiper);
|
||||||
|
swiper.onTouchMove = onTouchMove.bind(swiper);
|
||||||
|
swiper.onTouchEnd = onTouchEnd.bind(swiper);
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
swiper.onScroll = onScroll.bind(swiper);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.onClick = onClick.bind(swiper);
|
||||||
|
|
||||||
|
if (support.touch && !dummyEventAttached) {
|
||||||
|
document.addEventListener('touchstart', dummyEventListener);
|
||||||
|
dummyEventAttached = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
events(swiper, 'on');
|
||||||
|
}
|
||||||
|
|
||||||
|
function detachEvents() {
|
||||||
|
const swiper = this;
|
||||||
|
events(swiper, 'off');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
attachEvents,
|
||||||
|
detachEvents
|
||||||
|
};
|
13
resources/web/include/swiper/core/events/onClick.js
Normal file
13
resources/web/include/swiper/core/events/onClick.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
export default function onClick(e) {
|
||||||
|
const swiper = this;
|
||||||
|
if (!swiper.enabled) return;
|
||||||
|
|
||||||
|
if (!swiper.allowClick) {
|
||||||
|
if (swiper.params.preventClicks) e.preventDefault();
|
||||||
|
|
||||||
|
if (swiper.params.preventClicksPropagation && swiper.animating) {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
resources/web/include/swiper/core/events/onResize.js
Normal file
43
resources/web/include/swiper/core/events/onResize.js
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
export default function onResize() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
el
|
||||||
|
} = swiper;
|
||||||
|
if (el && el.offsetWidth === 0) return; // Breakpoints
|
||||||
|
|
||||||
|
if (params.breakpoints) {
|
||||||
|
swiper.setBreakpoint();
|
||||||
|
} // Save locks
|
||||||
|
|
||||||
|
|
||||||
|
const {
|
||||||
|
allowSlideNext,
|
||||||
|
allowSlidePrev,
|
||||||
|
snapGrid
|
||||||
|
} = swiper; // Disable locks on resize
|
||||||
|
|
||||||
|
swiper.allowSlideNext = true;
|
||||||
|
swiper.allowSlidePrev = true;
|
||||||
|
swiper.updateSize();
|
||||||
|
swiper.updateSlides();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
|
||||||
|
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
|
||||||
|
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(swiper.activeIndex, 0, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
||||||
|
swiper.autoplay.run();
|
||||||
|
} // Return locks after resize
|
||||||
|
|
||||||
|
|
||||||
|
swiper.allowSlidePrev = allowSlidePrev;
|
||||||
|
swiper.allowSlideNext = allowSlideNext;
|
||||||
|
|
||||||
|
if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
||||||
|
swiper.checkOverflow();
|
||||||
|
}
|
||||||
|
}
|
35
resources/web/include/swiper/core/events/onScroll.js
Normal file
35
resources/web/include/swiper/core/events/onScroll.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
export default function onScroll() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
wrapperEl,
|
||||||
|
rtlTranslate,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return;
|
||||||
|
swiper.previousTranslate = swiper.translate;
|
||||||
|
|
||||||
|
if (swiper.isHorizontal()) {
|
||||||
|
swiper.translate = -wrapperEl.scrollLeft;
|
||||||
|
} else {
|
||||||
|
swiper.translate = -wrapperEl.scrollTop;
|
||||||
|
} // eslint-disable-next-line
|
||||||
|
|
||||||
|
|
||||||
|
if (swiper.translate === -0) swiper.translate = 0;
|
||||||
|
swiper.updateActiveIndex();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
let newProgress;
|
||||||
|
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
||||||
|
|
||||||
|
if (translatesDiff === 0) {
|
||||||
|
newProgress = 0;
|
||||||
|
} else {
|
||||||
|
newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newProgress !== swiper.progress) {
|
||||||
|
swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('setTranslate', swiper.translate, false);
|
||||||
|
}
|
143
resources/web/include/swiper/core/events/onTouchEnd.js
Normal file
143
resources/web/include/swiper/core/events/onTouchEnd.js
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
import { now, nextTick } from '../../shared/utils.js';
|
||||||
|
export default function onTouchEnd(event) {
|
||||||
|
const swiper = this;
|
||||||
|
const data = swiper.touchEventsData;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
touches,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
slidesGrid,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return;
|
||||||
|
let e = event;
|
||||||
|
if (e.originalEvent) e = e.originalEvent;
|
||||||
|
|
||||||
|
if (data.allowTouchCallbacks) {
|
||||||
|
swiper.emit('touchEnd', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.allowTouchCallbacks = false;
|
||||||
|
|
||||||
|
if (!data.isTouched) {
|
||||||
|
if (data.isMoved && params.grabCursor) {
|
||||||
|
swiper.setGrabCursor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.isMoved = false;
|
||||||
|
data.startMoving = false;
|
||||||
|
return;
|
||||||
|
} // Return Grab Cursor
|
||||||
|
|
||||||
|
|
||||||
|
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
||||||
|
swiper.setGrabCursor(false);
|
||||||
|
} // Time diff
|
||||||
|
|
||||||
|
|
||||||
|
const touchEndTime = now();
|
||||||
|
const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
|
||||||
|
|
||||||
|
if (swiper.allowClick) {
|
||||||
|
swiper.updateClickedSlide(e);
|
||||||
|
swiper.emit('tap click', e);
|
||||||
|
|
||||||
|
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
|
||||||
|
swiper.emit('doubleTap doubleClick', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.lastClickTime = now();
|
||||||
|
nextTick(() => {
|
||||||
|
if (!swiper.destroyed) swiper.allowClick = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
|
||||||
|
data.isTouched = false;
|
||||||
|
data.isMoved = false;
|
||||||
|
data.startMoving = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.isTouched = false;
|
||||||
|
data.isMoved = false;
|
||||||
|
data.startMoving = false;
|
||||||
|
let currentPos;
|
||||||
|
|
||||||
|
if (params.followFinger) {
|
||||||
|
currentPos = rtl ? swiper.translate : -swiper.translate;
|
||||||
|
} else {
|
||||||
|
currentPos = -data.currentTranslate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params.freeMode && params.freeMode.enabled) {
|
||||||
|
swiper.freeMode.onTouchEnd({
|
||||||
|
currentPos
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} // Find current slide
|
||||||
|
|
||||||
|
|
||||||
|
let stopIndex = 0;
|
||||||
|
let groupSize = swiper.slidesSizesGrid[0];
|
||||||
|
|
||||||
|
for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
|
||||||
|
const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
||||||
|
|
||||||
|
if (typeof slidesGrid[i + increment] !== 'undefined') {
|
||||||
|
if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
|
||||||
|
stopIndex = i;
|
||||||
|
groupSize = slidesGrid[i + increment] - slidesGrid[i];
|
||||||
|
}
|
||||||
|
} else if (currentPos >= slidesGrid[i]) {
|
||||||
|
stopIndex = i;
|
||||||
|
groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
|
||||||
|
}
|
||||||
|
} // Find current slide size
|
||||||
|
|
||||||
|
|
||||||
|
const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
|
||||||
|
const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
||||||
|
|
||||||
|
if (timeDiff > params.longSwipesMs) {
|
||||||
|
// Long touches
|
||||||
|
if (!params.longSwipes) {
|
||||||
|
swiper.slideTo(swiper.activeIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.swipeDirection === 'next') {
|
||||||
|
if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.swipeDirection === 'prev') {
|
||||||
|
if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Short swipes
|
||||||
|
if (!params.shortSwipes) {
|
||||||
|
swiper.slideTo(swiper.activeIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
|
||||||
|
|
||||||
|
if (!isNavButtonTarget) {
|
||||||
|
if (swiper.swipeDirection === 'next') {
|
||||||
|
swiper.slideTo(stopIndex + increment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.swipeDirection === 'prev') {
|
||||||
|
swiper.slideTo(stopIndex);
|
||||||
|
}
|
||||||
|
} else if (e.target === swiper.navigation.nextEl) {
|
||||||
|
swiper.slideTo(stopIndex + increment);
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(stopIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
222
resources/web/include/swiper/core/events/onTouchMove.js
Normal file
222
resources/web/include/swiper/core/events/onTouchMove.js
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
import { getDocument } from 'ssr-window';
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
import { now } from '../../shared/utils.js';
|
||||||
|
export default function onTouchMove(event) {
|
||||||
|
const document = getDocument();
|
||||||
|
const swiper = this;
|
||||||
|
const data = swiper.touchEventsData;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
touches,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return;
|
||||||
|
let e = event;
|
||||||
|
if (e.originalEvent) e = e.originalEvent;
|
||||||
|
|
||||||
|
if (!data.isTouched) {
|
||||||
|
if (data.startMoving && data.isScrolling) {
|
||||||
|
swiper.emit('touchMoveOpposite', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.isTouchEvent && e.type !== 'touchmove') return;
|
||||||
|
const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
|
||||||
|
const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
|
||||||
|
const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
|
||||||
|
|
||||||
|
if (e.preventedByNestedSwiper) {
|
||||||
|
touches.startX = pageX;
|
||||||
|
touches.startY = pageY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.allowTouchMove) {
|
||||||
|
// isMoved = true;
|
||||||
|
swiper.allowClick = false;
|
||||||
|
|
||||||
|
if (data.isTouched) {
|
||||||
|
Object.assign(touches, {
|
||||||
|
startX: pageX,
|
||||||
|
startY: pageY,
|
||||||
|
currentX: pageX,
|
||||||
|
currentY: pageY
|
||||||
|
});
|
||||||
|
data.touchStartTime = now();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
|
||||||
|
if (swiper.isVertical()) {
|
||||||
|
// Vertical
|
||||||
|
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
|
||||||
|
data.isTouched = false;
|
||||||
|
data.isMoved = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.isTouchEvent && document.activeElement) {
|
||||||
|
if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {
|
||||||
|
data.isMoved = true;
|
||||||
|
swiper.allowClick = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.allowTouchCallbacks) {
|
||||||
|
swiper.emit('touchMove', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.targetTouches && e.targetTouches.length > 1) return;
|
||||||
|
touches.currentX = pageX;
|
||||||
|
touches.currentY = pageY;
|
||||||
|
const diffX = touches.currentX - touches.startX;
|
||||||
|
const diffY = touches.currentY - touches.startY;
|
||||||
|
if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
|
||||||
|
|
||||||
|
if (typeof data.isScrolling === 'undefined') {
|
||||||
|
let touchAngle;
|
||||||
|
|
||||||
|
if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
|
||||||
|
data.isScrolling = false;
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
if (diffX * diffX + diffY * diffY >= 25) {
|
||||||
|
touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
|
||||||
|
data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.isScrolling) {
|
||||||
|
swiper.emit('touchMoveOpposite', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof data.startMoving === 'undefined') {
|
||||||
|
if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
|
||||||
|
data.startMoving = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.isScrolling) {
|
||||||
|
data.isTouched = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data.startMoving) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.allowClick = false;
|
||||||
|
|
||||||
|
if (!params.cssMode && e.cancelable) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.touchMoveStopPropagation && !params.nested) {
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data.isMoved) {
|
||||||
|
if (params.loop && !params.cssMode) {
|
||||||
|
swiper.loopFix();
|
||||||
|
}
|
||||||
|
|
||||||
|
data.startTranslate = swiper.getTranslate();
|
||||||
|
swiper.setTransition(0);
|
||||||
|
|
||||||
|
if (swiper.animating) {
|
||||||
|
swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
|
||||||
|
}
|
||||||
|
|
||||||
|
data.allowMomentumBounce = false; // Grab Cursor
|
||||||
|
|
||||||
|
if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
||||||
|
swiper.setGrabCursor(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('sliderFirstMove', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('sliderMove', e);
|
||||||
|
data.isMoved = true;
|
||||||
|
let diff = swiper.isHorizontal() ? diffX : diffY;
|
||||||
|
touches.diff = diff;
|
||||||
|
diff *= params.touchRatio;
|
||||||
|
if (rtl) diff = -diff;
|
||||||
|
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
|
||||||
|
data.currentTranslate = diff + data.startTranslate;
|
||||||
|
let disableParentSwiper = true;
|
||||||
|
let resistanceRatio = params.resistanceRatio;
|
||||||
|
|
||||||
|
if (params.touchReleaseOnEdges) {
|
||||||
|
resistanceRatio = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
|
||||||
|
disableParentSwiper = false;
|
||||||
|
if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
|
||||||
|
} else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
|
||||||
|
disableParentSwiper = false;
|
||||||
|
if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disableParentSwiper) {
|
||||||
|
e.preventedByNestedSwiper = true;
|
||||||
|
} // Directions locks
|
||||||
|
|
||||||
|
|
||||||
|
if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
|
||||||
|
data.currentTranslate = data.startTranslate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
|
||||||
|
data.currentTranslate = data.startTranslate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
|
||||||
|
data.currentTranslate = data.startTranslate;
|
||||||
|
} // Threshold
|
||||||
|
|
||||||
|
|
||||||
|
if (params.threshold > 0) {
|
||||||
|
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
|
||||||
|
if (!data.allowThresholdMove) {
|
||||||
|
data.allowThresholdMove = true;
|
||||||
|
touches.startX = touches.currentX;
|
||||||
|
touches.startY = touches.currentY;
|
||||||
|
data.currentTranslate = data.startTranslate;
|
||||||
|
touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data.currentTranslate = data.startTranslate;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params.followFinger || params.cssMode) return; // Update active index in free mode
|
||||||
|
|
||||||
|
if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
|
||||||
|
swiper.updateActiveIndex();
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
|
||||||
|
swiper.freeMode.onTouchMove();
|
||||||
|
} // Update progress
|
||||||
|
|
||||||
|
|
||||||
|
swiper.updateProgress(data.currentTranslate); // Update translate
|
||||||
|
|
||||||
|
swiper.setTranslate(data.currentTranslate);
|
||||||
|
}
|
114
resources/web/include/swiper/core/events/onTouchStart.js
Normal file
114
resources/web/include/swiper/core/events/onTouchStart.js
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
import { getWindow, getDocument } from 'ssr-window';
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
import { now } from '../../shared/utils.js'; // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
|
||||||
|
|
||||||
|
function closestElement(selector, base = this) {
|
||||||
|
function __closestFrom(el) {
|
||||||
|
if (!el || el === getDocument() || el === getWindow()) return null;
|
||||||
|
if (el.assignedSlot) el = el.assignedSlot;
|
||||||
|
const found = el.closest(selector);
|
||||||
|
return found || __closestFrom(el.getRootNode().host);
|
||||||
|
}
|
||||||
|
|
||||||
|
return __closestFrom(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function onTouchStart(event) {
|
||||||
|
const swiper = this;
|
||||||
|
const document = getDocument();
|
||||||
|
const window = getWindow();
|
||||||
|
const data = swiper.touchEventsData;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
touches,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return;
|
||||||
|
|
||||||
|
if (swiper.animating && params.preventInteractionOnTransition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.animating && params.cssMode && params.loop) {
|
||||||
|
swiper.loopFix();
|
||||||
|
}
|
||||||
|
|
||||||
|
let e = event;
|
||||||
|
if (e.originalEvent) e = e.originalEvent;
|
||||||
|
let $targetEl = $(e.target);
|
||||||
|
|
||||||
|
if (params.touchEventsTarget === 'wrapper') {
|
||||||
|
if (!$targetEl.closest(swiper.wrapperEl).length) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.isTouchEvent = e.type === 'touchstart';
|
||||||
|
if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
|
||||||
|
if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
|
||||||
|
if (data.isTouched && data.isMoved) return; // change target el for shadow root component
|
||||||
|
|
||||||
|
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
|
||||||
|
|
||||||
|
if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {
|
||||||
|
$targetEl = $(event.path[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
|
||||||
|
const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element
|
||||||
|
|
||||||
|
if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) {
|
||||||
|
swiper.allowClick = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.swipeHandler) {
|
||||||
|
if (!$targetEl.closest(params.swipeHandler)[0]) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
|
||||||
|
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
|
||||||
|
const startX = touches.currentX;
|
||||||
|
const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
||||||
|
|
||||||
|
const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
|
||||||
|
const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
|
||||||
|
|
||||||
|
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
||||||
|
if (edgeSwipeDetection === 'prevent') {
|
||||||
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(data, {
|
||||||
|
isTouched: true,
|
||||||
|
isMoved: false,
|
||||||
|
allowTouchCallbacks: true,
|
||||||
|
isScrolling: undefined,
|
||||||
|
startMoving: undefined
|
||||||
|
});
|
||||||
|
touches.startX = startX;
|
||||||
|
touches.startY = startY;
|
||||||
|
data.touchStartTime = now();
|
||||||
|
swiper.allowClick = true;
|
||||||
|
swiper.updateSize();
|
||||||
|
swiper.swipeDirection = undefined;
|
||||||
|
if (params.threshold > 0) data.allowThresholdMove = false;
|
||||||
|
|
||||||
|
if (e.type !== 'touchstart') {
|
||||||
|
let preventDefault = true;
|
||||||
|
if ($targetEl.is(data.focusableElements)) preventDefault = false;
|
||||||
|
|
||||||
|
if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
|
||||||
|
|
||||||
|
if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('touchStart', e);
|
||||||
|
}
|
6
resources/web/include/swiper/core/grab-cursor/index.js
Normal file
6
resources/web/include/swiper/core/grab-cursor/index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import setGrabCursor from './setGrabCursor.js';
|
||||||
|
import unsetGrabCursor from './unsetGrabCursor.js';
|
||||||
|
export default {
|
||||||
|
setGrabCursor,
|
||||||
|
unsetGrabCursor
|
||||||
|
};
|
|
@ -0,0 +1,9 @@
|
||||||
|
export default function setGrabCursor(moving) {
|
||||||
|
const swiper = this;
|
||||||
|
if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
|
||||||
|
const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
|
||||||
|
el.style.cursor = 'move';
|
||||||
|
el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
|
||||||
|
el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
|
||||||
|
el.style.cursor = moving ? 'grabbing' : 'grab';
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
export default function unsetGrabCursor() {
|
||||||
|
const swiper = this;
|
||||||
|
|
||||||
|
if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
|
||||||
|
}
|
6
resources/web/include/swiper/core/images/index.js
Normal file
6
resources/web/include/swiper/core/images/index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import loadImage from './loadImage.js';
|
||||||
|
import preloadImages from './preloadImages.js';
|
||||||
|
export default {
|
||||||
|
loadImage,
|
||||||
|
preloadImages
|
||||||
|
};
|
37
resources/web/include/swiper/core/images/loadImage.js
Normal file
37
resources/web/include/swiper/core/images/loadImage.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { getWindow } from 'ssr-window';
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
export default function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
|
||||||
|
const window = getWindow();
|
||||||
|
let image;
|
||||||
|
|
||||||
|
function onReady() {
|
||||||
|
if (callback) callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
const isPicture = $(imageEl).parent('picture')[0];
|
||||||
|
|
||||||
|
if (!isPicture && (!imageEl.complete || !checkForComplete)) {
|
||||||
|
if (src) {
|
||||||
|
image = new window.Image();
|
||||||
|
image.onload = onReady;
|
||||||
|
image.onerror = onReady;
|
||||||
|
|
||||||
|
if (sizes) {
|
||||||
|
image.sizes = sizes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcset) {
|
||||||
|
image.srcset = srcset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src) {
|
||||||
|
image.src = src;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onReady();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// image already loaded...
|
||||||
|
onReady();
|
||||||
|
}
|
||||||
|
}
|
19
resources/web/include/swiper/core/images/preloadImages.js
Normal file
19
resources/web/include/swiper/core/images/preloadImages.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
export default function preloadImages() {
|
||||||
|
const swiper = this;
|
||||||
|
swiper.imagesToLoad = swiper.$el.find('img');
|
||||||
|
|
||||||
|
function onReady() {
|
||||||
|
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
|
||||||
|
if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
|
||||||
|
|
||||||
|
if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
|
||||||
|
if (swiper.params.updateOnImagesReady) swiper.update();
|
||||||
|
swiper.emit('imagesReady');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < swiper.imagesToLoad.length; i += 1) {
|
||||||
|
const imageEl = swiper.imagesToLoad[i];
|
||||||
|
swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
|
||||||
|
}
|
||||||
|
}
|
8
resources/web/include/swiper/core/loop/index.js
Normal file
8
resources/web/include/swiper/core/loop/index.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import loopCreate from './loopCreate.js';
|
||||||
|
import loopFix from './loopFix.js';
|
||||||
|
import loopDestroy from './loopDestroy.js';
|
||||||
|
export default {
|
||||||
|
loopCreate,
|
||||||
|
loopFix,
|
||||||
|
loopDestroy
|
||||||
|
};
|
59
resources/web/include/swiper/core/loop/loopCreate.js
Normal file
59
resources/web/include/swiper/core/loop/loopCreate.js
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
import { getDocument } from 'ssr-window';
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
export default function loopCreate() {
|
||||||
|
const swiper = this;
|
||||||
|
const document = getDocument();
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
$wrapperEl
|
||||||
|
} = swiper; // Remove duplicated slides
|
||||||
|
|
||||||
|
const $selector = $($wrapperEl.children()[0].parentNode);
|
||||||
|
$selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove();
|
||||||
|
let slides = $selector.children(`.${params.slideClass}`);
|
||||||
|
|
||||||
|
if (params.loopFillGroupWithBlank) {
|
||||||
|
const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
|
||||||
|
|
||||||
|
if (blankSlidesNum !== params.slidesPerGroup) {
|
||||||
|
for (let i = 0; i < blankSlidesNum; i += 1) {
|
||||||
|
const blankNode = $(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`);
|
||||||
|
$selector.append(blankNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
slides = $selector.children(`.${params.slideClass}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
|
||||||
|
swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
|
||||||
|
swiper.loopedSlides += params.loopAdditionalSlides;
|
||||||
|
|
||||||
|
if (swiper.loopedSlides > slides.length) {
|
||||||
|
swiper.loopedSlides = slides.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
const prependSlides = [];
|
||||||
|
const appendSlides = [];
|
||||||
|
slides.each((el, index) => {
|
||||||
|
const slide = $(el);
|
||||||
|
|
||||||
|
if (index < swiper.loopedSlides) {
|
||||||
|
appendSlides.push(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < slides.length && index >= slides.length - swiper.loopedSlides) {
|
||||||
|
prependSlides.push(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
slide.attr('data-swiper-slide-index', index);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < appendSlides.length; i += 1) {
|
||||||
|
$selector.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = prependSlides.length - 1; i >= 0; i -= 1) {
|
||||||
|
$selector.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
|
||||||
|
}
|
||||||
|
}
|
10
resources/web/include/swiper/core/loop/loopDestroy.js
Normal file
10
resources/web/include/swiper/core/loop/loopDestroy.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export default function loopDestroy() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
$wrapperEl,
|
||||||
|
params,
|
||||||
|
slides
|
||||||
|
} = swiper;
|
||||||
|
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove();
|
||||||
|
slides.removeAttr('data-swiper-slide-index');
|
||||||
|
}
|
41
resources/web/include/swiper/core/loop/loopFix.js
Normal file
41
resources/web/include/swiper/core/loop/loopFix.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
export default function loopFix() {
|
||||||
|
const swiper = this;
|
||||||
|
swiper.emit('beforeLoopFix');
|
||||||
|
const {
|
||||||
|
activeIndex,
|
||||||
|
slides,
|
||||||
|
loopedSlides,
|
||||||
|
allowSlidePrev,
|
||||||
|
allowSlideNext,
|
||||||
|
snapGrid,
|
||||||
|
rtlTranslate: rtl
|
||||||
|
} = swiper;
|
||||||
|
let newIndex;
|
||||||
|
swiper.allowSlidePrev = true;
|
||||||
|
swiper.allowSlideNext = true;
|
||||||
|
const snapTranslate = -snapGrid[activeIndex];
|
||||||
|
const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
|
||||||
|
|
||||||
|
if (activeIndex < loopedSlides) {
|
||||||
|
newIndex = slides.length - loopedSlides * 3 + activeIndex;
|
||||||
|
newIndex += loopedSlides;
|
||||||
|
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
|
||||||
|
|
||||||
|
if (slideChanged && diff !== 0) {
|
||||||
|
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
|
||||||
|
}
|
||||||
|
} else if (activeIndex >= slides.length - loopedSlides) {
|
||||||
|
// Fix For Positive Oversliding
|
||||||
|
newIndex = -slides.length + activeIndex + loopedSlides;
|
||||||
|
newIndex += loopedSlides;
|
||||||
|
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
|
||||||
|
|
||||||
|
if (slideChanged && diff !== 0) {
|
||||||
|
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.allowSlidePrev = allowSlidePrev;
|
||||||
|
swiper.allowSlideNext = allowSlideNext;
|
||||||
|
swiper.emit('loopFix');
|
||||||
|
}
|
38
resources/web/include/swiper/core/moduleExtendParams.js
Normal file
38
resources/web/include/swiper/core/moduleExtendParams.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { extend } from '../shared/utils.js';
|
||||||
|
export default function moduleExtendParams(params, allModulesParams) {
|
||||||
|
return function extendParams(obj = {}) {
|
||||||
|
const moduleParamName = Object.keys(obj)[0];
|
||||||
|
const moduleParams = obj[moduleParamName];
|
||||||
|
|
||||||
|
if (typeof moduleParams !== 'object' || moduleParams === null) {
|
||||||
|
extend(allModulesParams, obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
|
||||||
|
params[moduleParamName] = {
|
||||||
|
auto: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
||||||
|
extend(allModulesParams, obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params[moduleParamName] === true) {
|
||||||
|
params[moduleParamName] = {
|
||||||
|
enabled: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
|
||||||
|
params[moduleParamName].enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params[moduleParamName]) params[moduleParamName] = {
|
||||||
|
enabled: false
|
||||||
|
};
|
||||||
|
extend(allModulesParams, obj);
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
import { getWindow } from 'ssr-window';
|
||||||
|
export default function Observer({
|
||||||
|
swiper,
|
||||||
|
extendParams,
|
||||||
|
on,
|
||||||
|
emit
|
||||||
|
}) {
|
||||||
|
const observers = [];
|
||||||
|
const window = getWindow();
|
||||||
|
|
||||||
|
const attach = (target, options = {}) => {
|
||||||
|
const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
|
||||||
|
const observer = new ObserverFunc(mutations => {
|
||||||
|
// The observerUpdate event should only be triggered
|
||||||
|
// once despite the number of mutations. Additional
|
||||||
|
// triggers are redundant and are very costly
|
||||||
|
if (mutations.length === 1) {
|
||||||
|
emit('observerUpdate', mutations[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const observerUpdate = function observerUpdate() {
|
||||||
|
emit('observerUpdate', mutations[0]);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (window.requestAnimationFrame) {
|
||||||
|
window.requestAnimationFrame(observerUpdate);
|
||||||
|
} else {
|
||||||
|
window.setTimeout(observerUpdate, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
observer.observe(target, {
|
||||||
|
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
|
||||||
|
childList: typeof options.childList === 'undefined' ? true : options.childList,
|
||||||
|
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
|
||||||
|
});
|
||||||
|
observers.push(observer);
|
||||||
|
};
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
if (!swiper.params.observer) return;
|
||||||
|
|
||||||
|
if (swiper.params.observeParents) {
|
||||||
|
const containerParents = swiper.$el.parents();
|
||||||
|
|
||||||
|
for (let i = 0; i < containerParents.length; i += 1) {
|
||||||
|
attach(containerParents[i]);
|
||||||
|
}
|
||||||
|
} // Observe container
|
||||||
|
|
||||||
|
|
||||||
|
attach(swiper.$el[0], {
|
||||||
|
childList: swiper.params.observeSlideChildren
|
||||||
|
}); // Observe wrapper
|
||||||
|
|
||||||
|
attach(swiper.$wrapperEl[0], {
|
||||||
|
attributes: false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const destroy = () => {
|
||||||
|
observers.forEach(observer => {
|
||||||
|
observer.disconnect();
|
||||||
|
});
|
||||||
|
observers.splice(0, observers.length);
|
||||||
|
};
|
||||||
|
|
||||||
|
extendParams({
|
||||||
|
observer: false,
|
||||||
|
observeParents: false,
|
||||||
|
observeSlideChildren: false
|
||||||
|
});
|
||||||
|
on('init', init);
|
||||||
|
on('destroy', destroy);
|
||||||
|
}
|
68
resources/web/include/swiper/core/modules/resize/resize.js
Normal file
68
resources/web/include/swiper/core/modules/resize/resize.js
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
import { getWindow } from 'ssr-window';
|
||||||
|
export default function Resize({
|
||||||
|
swiper,
|
||||||
|
on,
|
||||||
|
emit
|
||||||
|
}) {
|
||||||
|
const window = getWindow();
|
||||||
|
let observer = null;
|
||||||
|
|
||||||
|
const resizeHandler = () => {
|
||||||
|
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
||||||
|
emit('beforeResize');
|
||||||
|
emit('resize');
|
||||||
|
};
|
||||||
|
|
||||||
|
const createObserver = () => {
|
||||||
|
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
||||||
|
observer = new ResizeObserver(entries => {
|
||||||
|
const {
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
} = swiper;
|
||||||
|
let newWidth = width;
|
||||||
|
let newHeight = height;
|
||||||
|
entries.forEach(({
|
||||||
|
contentBoxSize,
|
||||||
|
contentRect,
|
||||||
|
target
|
||||||
|
}) => {
|
||||||
|
if (target && target !== swiper.el) return;
|
||||||
|
newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
|
||||||
|
newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (newWidth !== width || newHeight !== height) {
|
||||||
|
resizeHandler();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
observer.observe(swiper.el);
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeObserver = () => {
|
||||||
|
if (observer && observer.unobserve && swiper.el) {
|
||||||
|
observer.unobserve(swiper.el);
|
||||||
|
observer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const orientationChangeHandler = () => {
|
||||||
|
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
||||||
|
emit('orientationchange');
|
||||||
|
};
|
||||||
|
|
||||||
|
on('init', () => {
|
||||||
|
if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
|
||||||
|
createObserver();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('resize', resizeHandler);
|
||||||
|
window.addEventListener('orientationchange', orientationChangeHandler);
|
||||||
|
});
|
||||||
|
on('destroy', () => {
|
||||||
|
removeObserver();
|
||||||
|
window.removeEventListener('resize', resizeHandler);
|
||||||
|
window.removeEventListener('orientationchange', orientationChangeHandler);
|
||||||
|
});
|
||||||
|
}
|
16
resources/web/include/swiper/core/slide/index.js
Normal file
16
resources/web/include/swiper/core/slide/index.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import slideTo from './slideTo.js';
|
||||||
|
import slideToLoop from './slideToLoop.js';
|
||||||
|
import slideNext from './slideNext.js';
|
||||||
|
import slidePrev from './slidePrev.js';
|
||||||
|
import slideReset from './slideReset.js';
|
||||||
|
import slideToClosest from './slideToClosest.js';
|
||||||
|
import slideToClickedSlide from './slideToClickedSlide.js';
|
||||||
|
export default {
|
||||||
|
slideTo,
|
||||||
|
slideToLoop,
|
||||||
|
slideNext,
|
||||||
|
slidePrev,
|
||||||
|
slideReset,
|
||||||
|
slideToClosest,
|
||||||
|
slideToClickedSlide
|
||||||
|
};
|
26
resources/web/include/swiper/core/slide/slideNext.js
Normal file
26
resources/web/include/swiper/core/slide/slideNext.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* eslint no-unused-vars: "off" */
|
||||||
|
export default function slideNext(speed = this.params.speed, runCallbacks = true, internal) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
animating,
|
||||||
|
enabled,
|
||||||
|
params
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return swiper;
|
||||||
|
let perGroup = params.slidesPerGroup;
|
||||||
|
|
||||||
|
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
||||||
|
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
if (animating && params.loopPreventsSlide) return false;
|
||||||
|
swiper.loopFix(); // eslint-disable-next-line
|
||||||
|
|
||||||
|
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
|
||||||
|
}
|
59
resources/web/include/swiper/core/slide/slidePrev.js
Normal file
59
resources/web/include/swiper/core/slide/slidePrev.js
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/* eslint no-unused-vars: "off" */
|
||||||
|
export default function slidePrev(speed = this.params.speed, runCallbacks = true, internal) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
animating,
|
||||||
|
snapGrid,
|
||||||
|
slidesGrid,
|
||||||
|
rtlTranslate,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
if (!enabled) return swiper;
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
if (animating && params.loopPreventsSlide) return false;
|
||||||
|
swiper.loopFix(); // eslint-disable-next-line
|
||||||
|
|
||||||
|
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
const translate = rtlTranslate ? swiper.translate : -swiper.translate;
|
||||||
|
|
||||||
|
function normalize(val) {
|
||||||
|
if (val < 0) return -Math.floor(Math.abs(val));
|
||||||
|
return Math.floor(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizedTranslate = normalize(translate);
|
||||||
|
const normalizedSnapGrid = snapGrid.map(val => normalize(val));
|
||||||
|
let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
|
||||||
|
|
||||||
|
if (typeof prevSnap === 'undefined' && params.cssMode) {
|
||||||
|
let prevSnapIndex;
|
||||||
|
snapGrid.forEach((snap, snapIndex) => {
|
||||||
|
if (normalizedTranslate >= snap) {
|
||||||
|
// prevSnap = snap;
|
||||||
|
prevSnapIndex = snapIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof prevSnapIndex !== 'undefined') {
|
||||||
|
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let prevIndex = 0;
|
||||||
|
|
||||||
|
if (typeof prevSnap !== 'undefined') {
|
||||||
|
prevIndex = slidesGrid.indexOf(prevSnap);
|
||||||
|
if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
|
||||||
|
|
||||||
|
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
||||||
|
prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
|
||||||
|
prevIndex = Math.max(prevIndex, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
||||||
|
}
|
5
resources/web/include/swiper/core/slide/slideReset.js
Normal file
5
resources/web/include/swiper/core/slide/slideReset.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/* eslint no-unused-vars: "off" */
|
||||||
|
export default function slideReset(speed = this.params.speed, runCallbacks = true, internal) {
|
||||||
|
const swiper = this;
|
||||||
|
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
|
||||||
|
}
|
189
resources/web/include/swiper/core/slide/slideTo.js
Normal file
189
resources/web/include/swiper/core/slide/slideTo.js
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
import { animateCSSModeScroll } from '../../shared/utils.js';
|
||||||
|
export default function slideTo(index = 0, speed = this.params.speed, runCallbacks = true, internal, initial) {
|
||||||
|
if (typeof index !== 'number' && typeof index !== 'string') {
|
||||||
|
throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof index === 'string') {
|
||||||
|
/**
|
||||||
|
* The `index` argument converted from `string` to `number`.
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
const indexAsNumber = parseInt(index, 10);
|
||||||
|
/**
|
||||||
|
* Determines whether the `index` argument is a valid `number`
|
||||||
|
* after being converted from the `string` type.
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const isValidNumber = isFinite(indexAsNumber);
|
||||||
|
|
||||||
|
if (!isValidNumber) {
|
||||||
|
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
|
||||||
|
} // Knowing that the converted `index` is a valid number,
|
||||||
|
// we can update the original argument's value.
|
||||||
|
|
||||||
|
|
||||||
|
index = indexAsNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
const swiper = this;
|
||||||
|
let slideIndex = index;
|
||||||
|
if (slideIndex < 0) slideIndex = 0;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
snapGrid,
|
||||||
|
slidesGrid,
|
||||||
|
previousIndex,
|
||||||
|
activeIndex,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
wrapperEl,
|
||||||
|
enabled
|
||||||
|
} = swiper;
|
||||||
|
|
||||||
|
if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
|
||||||
|
let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
|
||||||
|
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
||||||
|
|
||||||
|
if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
|
||||||
|
swiper.emit('beforeSlideChangeStart');
|
||||||
|
}
|
||||||
|
|
||||||
|
const translate = -snapGrid[snapIndex]; // Update progress
|
||||||
|
|
||||||
|
swiper.updateProgress(translate); // Normalize slideIndex
|
||||||
|
|
||||||
|
if (params.normalizeSlideIndex) {
|
||||||
|
for (let i = 0; i < slidesGrid.length; i += 1) {
|
||||||
|
const normalizedTranslate = -Math.floor(translate * 100);
|
||||||
|
const normalizedGrid = Math.floor(slidesGrid[i] * 100);
|
||||||
|
const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
|
||||||
|
|
||||||
|
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
||||||
|
if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
|
||||||
|
slideIndex = i;
|
||||||
|
} else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
|
||||||
|
slideIndex = i + 1;
|
||||||
|
}
|
||||||
|
} else if (normalizedTranslate >= normalizedGrid) {
|
||||||
|
slideIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // Directions locks
|
||||||
|
|
||||||
|
|
||||||
|
if (swiper.initialized && slideIndex !== activeIndex) {
|
||||||
|
if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
|
||||||
|
if ((activeIndex || 0) !== slideIndex) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let direction;
|
||||||
|
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index
|
||||||
|
|
||||||
|
if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
|
||||||
|
swiper.updateActiveIndex(slideIndex); // Update Height
|
||||||
|
|
||||||
|
if (params.autoHeight) {
|
||||||
|
swiper.updateAutoHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
|
||||||
|
if (params.effect !== 'slide') {
|
||||||
|
swiper.setTranslate(translate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (direction !== 'reset') {
|
||||||
|
swiper.transitionStart(runCallbacks, direction);
|
||||||
|
swiper.transitionEnd(runCallbacks, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
const isH = swiper.isHorizontal();
|
||||||
|
const t = rtl ? translate : -translate;
|
||||||
|
|
||||||
|
if (speed === 0) {
|
||||||
|
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
||||||
|
|
||||||
|
if (isVirtual) {
|
||||||
|
swiper.wrapperEl.style.scrollSnapType = 'none';
|
||||||
|
swiper._immediateVirtual = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
||||||
|
|
||||||
|
if (isVirtual) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
swiper.wrapperEl.style.scrollSnapType = '';
|
||||||
|
swiper._swiperImmediateVirtual = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!swiper.support.smoothScroll) {
|
||||||
|
animateCSSModeScroll({
|
||||||
|
swiper,
|
||||||
|
targetPosition: t,
|
||||||
|
side: isH ? 'left' : 'top'
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapperEl.scrollTo({
|
||||||
|
[isH ? 'left' : 'top']: t,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (speed === 0) {
|
||||||
|
swiper.setTransition(0);
|
||||||
|
swiper.setTranslate(translate);
|
||||||
|
swiper.updateActiveIndex(slideIndex);
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
swiper.emit('beforeTransitionStart', speed, internal);
|
||||||
|
swiper.transitionStart(runCallbacks, direction);
|
||||||
|
swiper.transitionEnd(runCallbacks, direction);
|
||||||
|
} else {
|
||||||
|
swiper.setTransition(speed);
|
||||||
|
swiper.setTranslate(translate);
|
||||||
|
swiper.updateActiveIndex(slideIndex);
|
||||||
|
swiper.updateSlidesClasses();
|
||||||
|
swiper.emit('beforeTransitionStart', speed, internal);
|
||||||
|
swiper.transitionStart(runCallbacks, direction);
|
||||||
|
|
||||||
|
if (!swiper.animating) {
|
||||||
|
swiper.animating = true;
|
||||||
|
|
||||||
|
if (!swiper.onSlideToWrapperTransitionEnd) {
|
||||||
|
swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
|
||||||
|
if (!swiper || swiper.destroyed) return;
|
||||||
|
if (e.target !== this) return;
|
||||||
|
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
||||||
|
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
|
||||||
|
swiper.onSlideToWrapperTransitionEnd = null;
|
||||||
|
delete swiper.onSlideToWrapperTransitionEnd;
|
||||||
|
swiper.transitionEnd(runCallbacks, direction);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
||||||
|
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
import { nextTick } from '../../shared/utils.js';
|
||||||
|
export default function slideToClickedSlide() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
$wrapperEl
|
||||||
|
} = swiper;
|
||||||
|
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
|
||||||
|
let slideToIndex = swiper.clickedIndex;
|
||||||
|
let realIndex;
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
if (swiper.animating) return;
|
||||||
|
realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
|
||||||
|
|
||||||
|
if (params.centeredSlides) {
|
||||||
|
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
|
||||||
|
swiper.loopFix();
|
||||||
|
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
|
||||||
|
nextTick(() => {
|
||||||
|
swiper.slideTo(slideToIndex);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(slideToIndex);
|
||||||
|
}
|
||||||
|
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
|
||||||
|
swiper.loopFix();
|
||||||
|
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
|
||||||
|
nextTick(() => {
|
||||||
|
swiper.slideTo(slideToIndex);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(slideToIndex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
swiper.slideTo(slideToIndex);
|
||||||
|
}
|
||||||
|
}
|
32
resources/web/include/swiper/core/slide/slideToClosest.js
Normal file
32
resources/web/include/swiper/core/slide/slideToClosest.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* eslint no-unused-vars: "off" */
|
||||||
|
export default function slideToClosest(speed = this.params.speed, runCallbacks = true, internal, threshold = 0.5) {
|
||||||
|
const swiper = this;
|
||||||
|
let index = swiper.activeIndex;
|
||||||
|
const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
|
||||||
|
const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
|
||||||
|
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
||||||
|
|
||||||
|
if (translate >= swiper.snapGrid[snapIndex]) {
|
||||||
|
// The current translate is on or after the current snap index, so the choice
|
||||||
|
// is between the current index and the one after it.
|
||||||
|
const currentSnap = swiper.snapGrid[snapIndex];
|
||||||
|
const nextSnap = swiper.snapGrid[snapIndex + 1];
|
||||||
|
|
||||||
|
if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
|
||||||
|
index += swiper.params.slidesPerGroup;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// The current translate is before the current snap index, so the choice
|
||||||
|
// is between the current index and the one before it.
|
||||||
|
const prevSnap = swiper.snapGrid[snapIndex - 1];
|
||||||
|
const currentSnap = swiper.snapGrid[snapIndex];
|
||||||
|
|
||||||
|
if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
|
||||||
|
index -= swiper.params.slidesPerGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
index = Math.max(index, 0);
|
||||||
|
index = Math.min(index, swiper.slidesGrid.length - 1);
|
||||||
|
return swiper.slideTo(index, speed, runCallbacks, internal);
|
||||||
|
}
|
10
resources/web/include/swiper/core/slide/slideToLoop.js
Normal file
10
resources/web/include/swiper/core/slide/slideToLoop.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export default function slideToLoop(index = 0, speed = this.params.speed, runCallbacks = true, internal) {
|
||||||
|
const swiper = this;
|
||||||
|
let newIndex = index;
|
||||||
|
|
||||||
|
if (swiper.params.loop) {
|
||||||
|
newIndex += swiper.loopedSlides;
|
||||||
|
}
|
||||||
|
|
||||||
|
return swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
||||||
|
}
|
8
resources/web/include/swiper/core/transition/index.js
Normal file
8
resources/web/include/swiper/core/transition/index.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import setTransition from './setTransition.js';
|
||||||
|
import transitionStart from './transitionStart.js';
|
||||||
|
import transitionEnd from './transitionEnd.js';
|
||||||
|
export default {
|
||||||
|
setTransition,
|
||||||
|
transitionStart,
|
||||||
|
transitionEnd
|
||||||
|
};
|
|
@ -0,0 +1,9 @@
|
||||||
|
export default function setTransition(duration, byController) {
|
||||||
|
const swiper = this;
|
||||||
|
|
||||||
|
if (!swiper.params.cssMode) {
|
||||||
|
swiper.$wrapperEl.transition(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('setTransition', duration, byController);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
export default function transitionEmit({
|
||||||
|
swiper,
|
||||||
|
runCallbacks,
|
||||||
|
direction,
|
||||||
|
step
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
activeIndex,
|
||||||
|
previousIndex
|
||||||
|
} = swiper;
|
||||||
|
let dir = direction;
|
||||||
|
|
||||||
|
if (!dir) {
|
||||||
|
if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit(`transition${step}`);
|
||||||
|
|
||||||
|
if (runCallbacks && activeIndex !== previousIndex) {
|
||||||
|
if (dir === 'reset') {
|
||||||
|
swiper.emit(`slideResetTransition${step}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit(`slideChangeTransition${step}`);
|
||||||
|
|
||||||
|
if (dir === 'next') {
|
||||||
|
swiper.emit(`slideNextTransition${step}`);
|
||||||
|
} else {
|
||||||
|
swiper.emit(`slidePrevTransition${step}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import transitionEmit from './transitionEmit.js';
|
||||||
|
export default function transitionEnd(runCallbacks = true, direction) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params
|
||||||
|
} = swiper;
|
||||||
|
swiper.animating = false;
|
||||||
|
if (params.cssMode) return;
|
||||||
|
swiper.setTransition(0);
|
||||||
|
transitionEmit({
|
||||||
|
swiper,
|
||||||
|
runCallbacks,
|
||||||
|
direction,
|
||||||
|
step: 'End'
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
import transitionEmit from './transitionEmit.js';
|
||||||
|
export default function transitionStart(runCallbacks = true, direction) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params
|
||||||
|
} = swiper;
|
||||||
|
if (params.cssMode) return;
|
||||||
|
|
||||||
|
if (params.autoHeight) {
|
||||||
|
swiper.updateAutoHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
transitionEmit({
|
||||||
|
swiper,
|
||||||
|
runCallbacks,
|
||||||
|
direction,
|
||||||
|
step: 'Start'
|
||||||
|
});
|
||||||
|
}
|
22
resources/web/include/swiper/core/translate/getTranslate.js
Normal file
22
resources/web/include/swiper/core/translate/getTranslate.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import { getTranslate } from '../../shared/utils.js';
|
||||||
|
export default function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
translate,
|
||||||
|
$wrapperEl
|
||||||
|
} = swiper;
|
||||||
|
|
||||||
|
if (params.virtualTranslate) {
|
||||||
|
return rtl ? -translate : translate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
return translate;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentTranslate = getTranslate($wrapperEl[0], axis);
|
||||||
|
if (rtl) currentTranslate = -currentTranslate;
|
||||||
|
return currentTranslate || 0;
|
||||||
|
}
|
12
resources/web/include/swiper/core/translate/index.js
Normal file
12
resources/web/include/swiper/core/translate/index.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import getTranslate from './getTranslate.js';
|
||||||
|
import setTranslate from './setTranslate.js';
|
||||||
|
import minTranslate from './minTranslate.js';
|
||||||
|
import maxTranslate from './maxTranslate.js';
|
||||||
|
import translateTo from './translateTo.js';
|
||||||
|
export default {
|
||||||
|
getTranslate,
|
||||||
|
setTranslate,
|
||||||
|
minTranslate,
|
||||||
|
maxTranslate,
|
||||||
|
translateTo
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default function maxTranslate() {
|
||||||
|
return -this.snapGrid[this.snapGrid.length - 1];
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default function minTranslate() {
|
||||||
|
return -this.snapGrid[0];
|
||||||
|
}
|
48
resources/web/include/swiper/core/translate/setTranslate.js
Normal file
48
resources/web/include/swiper/core/translate/setTranslate.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
export default function setTranslate(translate, byController) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
params,
|
||||||
|
$wrapperEl,
|
||||||
|
wrapperEl,
|
||||||
|
progress
|
||||||
|
} = swiper;
|
||||||
|
let x = 0;
|
||||||
|
let y = 0;
|
||||||
|
const z = 0;
|
||||||
|
|
||||||
|
if (swiper.isHorizontal()) {
|
||||||
|
x = rtl ? -translate : translate;
|
||||||
|
} else {
|
||||||
|
y = translate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.roundLengths) {
|
||||||
|
x = Math.floor(x);
|
||||||
|
y = Math.floor(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
|
||||||
|
} else if (!params.virtualTranslate) {
|
||||||
|
$wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.previousTranslate = swiper.translate;
|
||||||
|
swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
|
||||||
|
|
||||||
|
let newProgress;
|
||||||
|
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
||||||
|
|
||||||
|
if (translatesDiff === 0) {
|
||||||
|
newProgress = 0;
|
||||||
|
} else {
|
||||||
|
newProgress = (translate - swiper.minTranslate()) / translatesDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newProgress !== progress) {
|
||||||
|
swiper.updateProgress(translate);
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('setTranslate', swiper.translate, byController);
|
||||||
|
}
|
85
resources/web/include/swiper/core/translate/translateTo.js
Normal file
85
resources/web/include/swiper/core/translate/translateTo.js
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
import { animateCSSModeScroll } from '../../shared/utils.js';
|
||||||
|
export default function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
params,
|
||||||
|
wrapperEl
|
||||||
|
} = swiper;
|
||||||
|
|
||||||
|
if (swiper.animating && params.preventInteractionOnTransition) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const minTranslate = swiper.minTranslate();
|
||||||
|
const maxTranslate = swiper.maxTranslate();
|
||||||
|
let newTranslate;
|
||||||
|
if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress
|
||||||
|
|
||||||
|
swiper.updateProgress(newTranslate);
|
||||||
|
|
||||||
|
if (params.cssMode) {
|
||||||
|
const isH = swiper.isHorizontal();
|
||||||
|
|
||||||
|
if (speed === 0) {
|
||||||
|
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
|
||||||
|
} else {
|
||||||
|
if (!swiper.support.smoothScroll) {
|
||||||
|
animateCSSModeScroll({
|
||||||
|
swiper,
|
||||||
|
targetPosition: -newTranslate,
|
||||||
|
side: isH ? 'left' : 'top'
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapperEl.scrollTo({
|
||||||
|
[isH ? 'left' : 'top']: -newTranslate,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (speed === 0) {
|
||||||
|
swiper.setTransition(0);
|
||||||
|
swiper.setTranslate(newTranslate);
|
||||||
|
|
||||||
|
if (runCallbacks) {
|
||||||
|
swiper.emit('beforeTransitionStart', speed, internal);
|
||||||
|
swiper.emit('transitionEnd');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
swiper.setTransition(speed);
|
||||||
|
swiper.setTranslate(newTranslate);
|
||||||
|
|
||||||
|
if (runCallbacks) {
|
||||||
|
swiper.emit('beforeTransitionStart', speed, internal);
|
||||||
|
swiper.emit('transitionStart');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swiper.animating) {
|
||||||
|
swiper.animating = true;
|
||||||
|
|
||||||
|
if (!swiper.onTranslateToWrapperTransitionEnd) {
|
||||||
|
swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
|
||||||
|
if (!swiper || swiper.destroyed) return;
|
||||||
|
if (e.target !== this) return;
|
||||||
|
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
||||||
|
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
|
||||||
|
swiper.onTranslateToWrapperTransitionEnd = null;
|
||||||
|
delete swiper.onTranslateToWrapperTransitionEnd;
|
||||||
|
|
||||||
|
if (runCallbacks) {
|
||||||
|
swiper.emit('transitionEnd');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
||||||
|
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
20
resources/web/include/swiper/core/update/index.js
Normal file
20
resources/web/include/swiper/core/update/index.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import updateSize from './updateSize.js';
|
||||||
|
import updateSlides from './updateSlides.js';
|
||||||
|
import updateAutoHeight from './updateAutoHeight.js';
|
||||||
|
import updateSlidesOffset from './updateSlidesOffset.js';
|
||||||
|
import updateSlidesProgress from './updateSlidesProgress.js';
|
||||||
|
import updateProgress from './updateProgress.js';
|
||||||
|
import updateSlidesClasses from './updateSlidesClasses.js';
|
||||||
|
import updateActiveIndex from './updateActiveIndex.js';
|
||||||
|
import updateClickedSlide from './updateClickedSlide.js';
|
||||||
|
export default {
|
||||||
|
updateSize,
|
||||||
|
updateSlides,
|
||||||
|
updateAutoHeight,
|
||||||
|
updateSlidesOffset,
|
||||||
|
updateSlidesProgress,
|
||||||
|
updateProgress,
|
||||||
|
updateSlidesClasses,
|
||||||
|
updateActiveIndex,
|
||||||
|
updateClickedSlide
|
||||||
|
};
|
|
@ -0,0 +1,70 @@
|
||||||
|
export default function updateActiveIndex(newActiveIndex) {
|
||||||
|
const swiper = this;
|
||||||
|
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
||||||
|
const {
|
||||||
|
slidesGrid,
|
||||||
|
snapGrid,
|
||||||
|
params,
|
||||||
|
activeIndex: previousIndex,
|
||||||
|
realIndex: previousRealIndex,
|
||||||
|
snapIndex: previousSnapIndex
|
||||||
|
} = swiper;
|
||||||
|
let activeIndex = newActiveIndex;
|
||||||
|
let snapIndex;
|
||||||
|
|
||||||
|
if (typeof activeIndex === 'undefined') {
|
||||||
|
for (let i = 0; i < slidesGrid.length; i += 1) {
|
||||||
|
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
||||||
|
if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
|
||||||
|
activeIndex = i;
|
||||||
|
} else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
|
||||||
|
activeIndex = i + 1;
|
||||||
|
}
|
||||||
|
} else if (translate >= slidesGrid[i]) {
|
||||||
|
activeIndex = i;
|
||||||
|
}
|
||||||
|
} // Normalize slideIndex
|
||||||
|
|
||||||
|
|
||||||
|
if (params.normalizeSlideIndex) {
|
||||||
|
if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapGrid.indexOf(translate) >= 0) {
|
||||||
|
snapIndex = snapGrid.indexOf(translate);
|
||||||
|
} else {
|
||||||
|
const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
|
||||||
|
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
||||||
|
|
||||||
|
if (activeIndex === previousIndex) {
|
||||||
|
if (snapIndex !== previousSnapIndex) {
|
||||||
|
swiper.snapIndex = snapIndex;
|
||||||
|
swiper.emit('snapIndexChange');
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} // Get real index
|
||||||
|
|
||||||
|
|
||||||
|
const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
|
||||||
|
Object.assign(swiper, {
|
||||||
|
snapIndex,
|
||||||
|
realIndex,
|
||||||
|
previousIndex,
|
||||||
|
activeIndex
|
||||||
|
});
|
||||||
|
swiper.emit('activeIndexChange');
|
||||||
|
swiper.emit('snapIndexChange');
|
||||||
|
|
||||||
|
if (previousRealIndex !== realIndex) {
|
||||||
|
swiper.emit('realIndexChange');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.initialized || swiper.params.runCallbacksOnInit) {
|
||||||
|
swiper.emit('slideChange');
|
||||||
|
}
|
||||||
|
}
|
49
resources/web/include/swiper/core/update/updateAutoHeight.js
Normal file
49
resources/web/include/swiper/core/update/updateAutoHeight.js
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
export default function updateAutoHeight(speed) {
|
||||||
|
const swiper = this;
|
||||||
|
const activeSlides = [];
|
||||||
|
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
||||||
|
let newHeight = 0;
|
||||||
|
let i;
|
||||||
|
|
||||||
|
if (typeof speed === 'number') {
|
||||||
|
swiper.setTransition(speed);
|
||||||
|
} else if (speed === true) {
|
||||||
|
swiper.setTransition(swiper.params.speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSlideByIndex = index => {
|
||||||
|
if (isVirtual) {
|
||||||
|
return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return swiper.slides.eq(index)[0];
|
||||||
|
}; // Find slides currently in view
|
||||||
|
|
||||||
|
|
||||||
|
if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
|
||||||
|
if (swiper.params.centeredSlides) {
|
||||||
|
swiper.visibleSlides.each(slide => {
|
||||||
|
activeSlides.push(slide);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
|
||||||
|
const index = swiper.activeIndex + i;
|
||||||
|
if (index > swiper.slides.length && !isVirtual) break;
|
||||||
|
activeSlides.push(getSlideByIndex(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activeSlides.push(getSlideByIndex(swiper.activeIndex));
|
||||||
|
} // Find new height from highest slide in view
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < activeSlides.length; i += 1) {
|
||||||
|
if (typeof activeSlides[i] !== 'undefined') {
|
||||||
|
const height = activeSlides[i].offsetHeight;
|
||||||
|
newHeight = height > newHeight ? height : newHeight;
|
||||||
|
}
|
||||||
|
} // Update Height
|
||||||
|
|
||||||
|
|
||||||
|
if (newHeight) swiper.$wrapperEl.css('height', `${newHeight}px`);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
export default function updateClickedSlide(e) {
|
||||||
|
const swiper = this;
|
||||||
|
const params = swiper.params;
|
||||||
|
const slide = $(e.target).closest(`.${params.slideClass}`)[0];
|
||||||
|
let slideFound = false;
|
||||||
|
let slideIndex;
|
||||||
|
|
||||||
|
if (slide) {
|
||||||
|
for (let i = 0; i < swiper.slides.length; i += 1) {
|
||||||
|
if (swiper.slides[i] === slide) {
|
||||||
|
slideFound = true;
|
||||||
|
slideIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slide && slideFound) {
|
||||||
|
swiper.clickedSlide = slide;
|
||||||
|
|
||||||
|
if (swiper.virtual && swiper.params.virtual.enabled) {
|
||||||
|
swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
|
||||||
|
} else {
|
||||||
|
swiper.clickedIndex = slideIndex;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
swiper.clickedSlide = undefined;
|
||||||
|
swiper.clickedIndex = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
|
||||||
|
swiper.slideToClickedSlide();
|
||||||
|
}
|
||||||
|
}
|
50
resources/web/include/swiper/core/update/updateProgress.js
Normal file
50
resources/web/include/swiper/core/update/updateProgress.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
export default function updateProgress(translate) {
|
||||||
|
const swiper = this;
|
||||||
|
|
||||||
|
if (typeof translate === 'undefined') {
|
||||||
|
const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
|
||||||
|
|
||||||
|
translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const params = swiper.params;
|
||||||
|
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
||||||
|
let {
|
||||||
|
progress,
|
||||||
|
isBeginning,
|
||||||
|
isEnd
|
||||||
|
} = swiper;
|
||||||
|
const wasBeginning = isBeginning;
|
||||||
|
const wasEnd = isEnd;
|
||||||
|
|
||||||
|
if (translatesDiff === 0) {
|
||||||
|
progress = 0;
|
||||||
|
isBeginning = true;
|
||||||
|
isEnd = true;
|
||||||
|
} else {
|
||||||
|
progress = (translate - swiper.minTranslate()) / translatesDiff;
|
||||||
|
isBeginning = progress <= 0;
|
||||||
|
isEnd = progress >= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(swiper, {
|
||||||
|
progress,
|
||||||
|
isBeginning,
|
||||||
|
isEnd
|
||||||
|
});
|
||||||
|
if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
|
||||||
|
|
||||||
|
if (isBeginning && !wasBeginning) {
|
||||||
|
swiper.emit('reachBeginning toEdge');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEnd && !wasEnd) {
|
||||||
|
swiper.emit('reachEnd toEdge');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
|
||||||
|
swiper.emit('fromEdge');
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emit('progress', progress);
|
||||||
|
}
|
33
resources/web/include/swiper/core/update/updateSize.js
Normal file
33
resources/web/include/swiper/core/update/updateSize.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
export default function updateSize() {
|
||||||
|
const swiper = this;
|
||||||
|
let width;
|
||||||
|
let height;
|
||||||
|
const $el = swiper.$el;
|
||||||
|
|
||||||
|
if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
|
||||||
|
width = swiper.params.width;
|
||||||
|
} else {
|
||||||
|
width = $el[0].clientWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
|
||||||
|
height = swiper.params.height;
|
||||||
|
} else {
|
||||||
|
height = $el[0].clientHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
|
||||||
|
return;
|
||||||
|
} // Subtract paddings
|
||||||
|
|
||||||
|
|
||||||
|
width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
|
||||||
|
height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
|
||||||
|
if (Number.isNaN(width)) width = 0;
|
||||||
|
if (Number.isNaN(height)) height = 0;
|
||||||
|
Object.assign(swiper, {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
size: swiper.isHorizontal() ? width : height
|
||||||
|
});
|
||||||
|
}
|
309
resources/web/include/swiper/core/update/updateSlides.js
Normal file
309
resources/web/include/swiper/core/update/updateSlides.js
Normal file
|
@ -0,0 +1,309 @@
|
||||||
|
import { setCSSProperty } from '../../shared/utils.js';
|
||||||
|
export default function updateSlides() {
|
||||||
|
const swiper = this;
|
||||||
|
|
||||||
|
function getDirectionLabel(property) {
|
||||||
|
if (swiper.isHorizontal()) {
|
||||||
|
return property;
|
||||||
|
} // prettier-ignore
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
'width': 'height',
|
||||||
|
'margin-top': 'margin-left',
|
||||||
|
'margin-bottom ': 'margin-right',
|
||||||
|
'margin-left': 'margin-top',
|
||||||
|
'margin-right': 'margin-bottom',
|
||||||
|
'padding-left': 'padding-top',
|
||||||
|
'padding-right': 'padding-bottom',
|
||||||
|
'marginRight': 'marginBottom'
|
||||||
|
}[property];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDirectionPropertyValue(node, label) {
|
||||||
|
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const params = swiper.params;
|
||||||
|
const {
|
||||||
|
$wrapperEl,
|
||||||
|
size: swiperSize,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
wrongRTL
|
||||||
|
} = swiper;
|
||||||
|
const isVirtual = swiper.virtual && params.virtual.enabled;
|
||||||
|
const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
|
||||||
|
const slides = $wrapperEl.children(`.${swiper.params.slideClass}`);
|
||||||
|
const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
|
||||||
|
let snapGrid = [];
|
||||||
|
const slidesGrid = [];
|
||||||
|
const slidesSizesGrid = [];
|
||||||
|
let offsetBefore = params.slidesOffsetBefore;
|
||||||
|
|
||||||
|
if (typeof offsetBefore === 'function') {
|
||||||
|
offsetBefore = params.slidesOffsetBefore.call(swiper);
|
||||||
|
}
|
||||||
|
|
||||||
|
let offsetAfter = params.slidesOffsetAfter;
|
||||||
|
|
||||||
|
if (typeof offsetAfter === 'function') {
|
||||||
|
offsetAfter = params.slidesOffsetAfter.call(swiper);
|
||||||
|
}
|
||||||
|
|
||||||
|
const previousSnapGridLength = swiper.snapGrid.length;
|
||||||
|
const previousSlidesGridLength = swiper.slidesGrid.length;
|
||||||
|
let spaceBetween = params.spaceBetween;
|
||||||
|
let slidePosition = -offsetBefore;
|
||||||
|
let prevSlideSize = 0;
|
||||||
|
let index = 0;
|
||||||
|
|
||||||
|
if (typeof swiperSize === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
|
||||||
|
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.virtualSize = -spaceBetween; // reset margins
|
||||||
|
|
||||||
|
if (rtl) slides.css({
|
||||||
|
marginLeft: '',
|
||||||
|
marginBottom: '',
|
||||||
|
marginTop: ''
|
||||||
|
});else slides.css({
|
||||||
|
marginRight: '',
|
||||||
|
marginBottom: '',
|
||||||
|
marginTop: ''
|
||||||
|
}); // reset cssMode offsets
|
||||||
|
|
||||||
|
if (params.centeredSlides && params.cssMode) {
|
||||||
|
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', '');
|
||||||
|
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
||||||
|
|
||||||
|
if (gridEnabled) {
|
||||||
|
swiper.grid.initSlides(slidesLength);
|
||||||
|
} // Calc slides
|
||||||
|
|
||||||
|
|
||||||
|
let slideSize;
|
||||||
|
const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
|
||||||
|
return typeof params.breakpoints[key].slidesPerView !== 'undefined';
|
||||||
|
}).length > 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < slidesLength; i += 1) {
|
||||||
|
slideSize = 0;
|
||||||
|
const slide = slides.eq(i);
|
||||||
|
|
||||||
|
if (gridEnabled) {
|
||||||
|
swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slide.css('display') === 'none') continue; // eslint-disable-line
|
||||||
|
|
||||||
|
if (params.slidesPerView === 'auto') {
|
||||||
|
if (shouldResetSlideSize) {
|
||||||
|
slides[i].style[getDirectionLabel('width')] = ``;
|
||||||
|
}
|
||||||
|
|
||||||
|
const slideStyles = getComputedStyle(slide[0]);
|
||||||
|
const currentTransform = slide[0].style.transform;
|
||||||
|
const currentWebKitTransform = slide[0].style.webkitTransform;
|
||||||
|
|
||||||
|
if (currentTransform) {
|
||||||
|
slide[0].style.transform = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentWebKitTransform) {
|
||||||
|
slide[0].style.webkitTransform = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.roundLengths) {
|
||||||
|
slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
const width = getDirectionPropertyValue(slideStyles, 'width');
|
||||||
|
const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
|
||||||
|
const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
|
||||||
|
const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
|
||||||
|
const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
|
||||||
|
const boxSizing = slideStyles.getPropertyValue('box-sizing');
|
||||||
|
|
||||||
|
if (boxSizing && boxSizing === 'border-box') {
|
||||||
|
slideSize = width + marginLeft + marginRight;
|
||||||
|
} else {
|
||||||
|
const {
|
||||||
|
clientWidth,
|
||||||
|
offsetWidth
|
||||||
|
} = slide[0];
|
||||||
|
slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentTransform) {
|
||||||
|
slide[0].style.transform = currentTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentWebKitTransform) {
|
||||||
|
slide[0].style.webkitTransform = currentWebKitTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
||||||
|
} else {
|
||||||
|
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
||||||
|
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
||||||
|
|
||||||
|
if (slides[i]) {
|
||||||
|
slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slides[i]) {
|
||||||
|
slides[i].swiperSlideSize = slideSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
slidesSizesGrid.push(slideSize);
|
||||||
|
|
||||||
|
if (params.centeredSlides) {
|
||||||
|
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
|
||||||
|
if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
||||||
|
if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
||||||
|
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
|
||||||
|
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
||||||
|
if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
||||||
|
slidesGrid.push(slidePosition);
|
||||||
|
} else {
|
||||||
|
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
||||||
|
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
||||||
|
slidesGrid.push(slidePosition);
|
||||||
|
slidePosition = slidePosition + slideSize + spaceBetween;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.virtualSize += slideSize + spaceBetween;
|
||||||
|
prevSlideSize = slideSize;
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
|
||||||
|
|
||||||
|
if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
|
||||||
|
$wrapperEl.css({
|
||||||
|
width: `${swiper.virtualSize + params.spaceBetween}px`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.setWrapperSize) {
|
||||||
|
$wrapperEl.css({
|
||||||
|
[getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gridEnabled) {
|
||||||
|
swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
|
||||||
|
} // Remove last grid elements depending on width
|
||||||
|
|
||||||
|
|
||||||
|
if (!params.centeredSlides) {
|
||||||
|
const newSlidesGrid = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < snapGrid.length; i += 1) {
|
||||||
|
let slidesGridItem = snapGrid[i];
|
||||||
|
if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
|
||||||
|
|
||||||
|
if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
|
||||||
|
newSlidesGrid.push(slidesGridItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
snapGrid = newSlidesGrid;
|
||||||
|
|
||||||
|
if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
|
||||||
|
snapGrid.push(swiper.virtualSize - swiperSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapGrid.length === 0) snapGrid = [0];
|
||||||
|
|
||||||
|
if (params.spaceBetween !== 0) {
|
||||||
|
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
|
||||||
|
slides.filter((_, slideIndex) => {
|
||||||
|
if (!params.cssMode) return true;
|
||||||
|
|
||||||
|
if (slideIndex === slides.length - 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}).css({
|
||||||
|
[key]: `${spaceBetween}px`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.centeredSlides && params.centeredSlidesBounds) {
|
||||||
|
let allSlidesSize = 0;
|
||||||
|
slidesSizesGrid.forEach(slideSizeValue => {
|
||||||
|
allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
|
||||||
|
});
|
||||||
|
allSlidesSize -= params.spaceBetween;
|
||||||
|
const maxSnap = allSlidesSize - swiperSize;
|
||||||
|
snapGrid = snapGrid.map(snap => {
|
||||||
|
if (snap < 0) return -offsetBefore;
|
||||||
|
if (snap > maxSnap) return maxSnap + offsetAfter;
|
||||||
|
return snap;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.centerInsufficientSlides) {
|
||||||
|
let allSlidesSize = 0;
|
||||||
|
slidesSizesGrid.forEach(slideSizeValue => {
|
||||||
|
allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
|
||||||
|
});
|
||||||
|
allSlidesSize -= params.spaceBetween;
|
||||||
|
|
||||||
|
if (allSlidesSize < swiperSize) {
|
||||||
|
const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
|
||||||
|
snapGrid.forEach((snap, snapIndex) => {
|
||||||
|
snapGrid[snapIndex] = snap - allSlidesOffset;
|
||||||
|
});
|
||||||
|
slidesGrid.forEach((snap, snapIndex) => {
|
||||||
|
slidesGrid[snapIndex] = snap + allSlidesOffset;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(swiper, {
|
||||||
|
slides,
|
||||||
|
snapGrid,
|
||||||
|
slidesGrid,
|
||||||
|
slidesSizesGrid
|
||||||
|
});
|
||||||
|
|
||||||
|
if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
|
||||||
|
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
|
||||||
|
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
|
||||||
|
const addToSnapGrid = -swiper.snapGrid[0];
|
||||||
|
const addToSlidesGrid = -swiper.slidesGrid[0];
|
||||||
|
swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
|
||||||
|
swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slidesLength !== previousSlidesLength) {
|
||||||
|
swiper.emit('slidesLengthChange');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapGrid.length !== previousSnapGridLength) {
|
||||||
|
if (swiper.params.watchOverflow) swiper.checkOverflow();
|
||||||
|
swiper.emit('snapGridLengthChange');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slidesGrid.length !== previousSlidesGridLength) {
|
||||||
|
swiper.emit('slidesGridLengthChange');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.watchSlidesProgress) {
|
||||||
|
swiper.updateSlidesOffset();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
export default function updateSlidesClasses() {
|
||||||
|
const swiper = this;
|
||||||
|
const {
|
||||||
|
slides,
|
||||||
|
params,
|
||||||
|
$wrapperEl,
|
||||||
|
activeIndex,
|
||||||
|
realIndex
|
||||||
|
} = swiper;
|
||||||
|
const isVirtual = swiper.virtual && params.virtual.enabled;
|
||||||
|
slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`);
|
||||||
|
let activeSlide;
|
||||||
|
|
||||||
|
if (isVirtual) {
|
||||||
|
activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`);
|
||||||
|
} else {
|
||||||
|
activeSlide = slides.eq(activeIndex);
|
||||||
|
} // Active classes
|
||||||
|
|
||||||
|
|
||||||
|
activeSlide.addClass(params.slideActiveClass);
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
// Duplicate to all looped slides
|
||||||
|
if (activeSlide.hasClass(params.slideDuplicateClass)) {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
|
||||||
|
} else {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
|
||||||
|
}
|
||||||
|
} // Next Slide
|
||||||
|
|
||||||
|
|
||||||
|
let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass);
|
||||||
|
|
||||||
|
if (params.loop && nextSlide.length === 0) {
|
||||||
|
nextSlide = slides.eq(0);
|
||||||
|
nextSlide.addClass(params.slideNextClass);
|
||||||
|
} // Prev Slide
|
||||||
|
|
||||||
|
|
||||||
|
let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass);
|
||||||
|
|
||||||
|
if (params.loop && prevSlide.length === 0) {
|
||||||
|
prevSlide = slides.eq(-1);
|
||||||
|
prevSlide.addClass(params.slidePrevClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.loop) {
|
||||||
|
// Duplicate to all looped slides
|
||||||
|
if (nextSlide.hasClass(params.slideDuplicateClass)) {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
|
||||||
|
} else {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevSlide.hasClass(params.slideDuplicateClass)) {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
|
||||||
|
} else {
|
||||||
|
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.emitSlidesClasses();
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
export default function updateSlidesOffset() {
|
||||||
|
const swiper = this;
|
||||||
|
const slides = swiper.slides;
|
||||||
|
|
||||||
|
for (let i = 0; i < slides.length; i += 1) {
|
||||||
|
slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
export default function updateSlidesProgress(translate = this && this.translate || 0) {
|
||||||
|
const swiper = this;
|
||||||
|
const params = swiper.params;
|
||||||
|
const {
|
||||||
|
slides,
|
||||||
|
rtlTranslate: rtl,
|
||||||
|
snapGrid
|
||||||
|
} = swiper;
|
||||||
|
if (slides.length === 0) return;
|
||||||
|
if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
|
||||||
|
let offsetCenter = -translate;
|
||||||
|
if (rtl) offsetCenter = translate; // Visible Slides
|
||||||
|
|
||||||
|
slides.removeClass(params.slideVisibleClass);
|
||||||
|
swiper.visibleSlidesIndexes = [];
|
||||||
|
swiper.visibleSlides = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < slides.length; i += 1) {
|
||||||
|
const slide = slides[i];
|
||||||
|
let slideOffset = slide.swiperSlideOffset;
|
||||||
|
|
||||||
|
if (params.cssMode && params.centeredSlides) {
|
||||||
|
slideOffset -= slides[0].swiperSlideOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
|
||||||
|
const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
|
||||||
|
const slideBefore = -(offsetCenter - slideOffset);
|
||||||
|
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
|
||||||
|
const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
|
||||||
|
|
||||||
|
if (isVisible) {
|
||||||
|
swiper.visibleSlides.push(slide);
|
||||||
|
swiper.visibleSlidesIndexes.push(i);
|
||||||
|
slides.eq(i).addClass(params.slideVisibleClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
slide.progress = rtl ? -slideProgress : slideProgress;
|
||||||
|
slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.visibleSlides = $(swiper.visibleSlides);
|
||||||
|
}
|
283
resources/web/include/swiper/modules/a11y/a11y.js
Normal file
283
resources/web/include/swiper/modules/a11y/a11y.js
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
import classesToSelector from '../../shared/classes-to-selector.js';
|
||||||
|
import $ from '../../shared/dom.js';
|
||||||
|
export default function A11y({
|
||||||
|
swiper,
|
||||||
|
extendParams,
|
||||||
|
on
|
||||||
|
}) {
|
||||||
|
extendParams({
|
||||||
|
a11y: {
|
||||||
|
enabled: true,
|
||||||
|
notificationClass: 'swiper-notification',
|
||||||
|
prevSlideMessage: 'Previous slide',
|
||||||
|
nextSlideMessage: 'Next slide',
|
||||||
|
firstSlideMessage: 'This is the first slide',
|
||||||
|
lastSlideMessage: 'This is the last slide',
|
||||||
|
paginationBulletMessage: 'Go to slide {{index}}',
|
||||||
|
slideLabelMessage: '{{index}} / {{slidesLength}}',
|
||||||
|
containerMessage: null,
|
||||||
|
containerRoleDescriptionMessage: null,
|
||||||
|
itemRoleDescriptionMessage: null,
|
||||||
|
slideRole: 'group'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let liveRegion = null;
|
||||||
|
|
||||||
|
function notify(message) {
|
||||||
|
const notification = liveRegion;
|
||||||
|
if (notification.length === 0) return;
|
||||||
|
notification.html('');
|
||||||
|
notification.html(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomNumber(size = 16) {
|
||||||
|
const randomChar = () => Math.round(16 * Math.random()).toString(16);
|
||||||
|
|
||||||
|
return 'x'.repeat(size).replace(/x/g, randomChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeElFocusable($el) {
|
||||||
|
$el.attr('tabIndex', '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeElNotFocusable($el) {
|
||||||
|
$el.attr('tabIndex', '-1');
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElRole($el, role) {
|
||||||
|
$el.attr('role', role);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElRoleDescription($el, description) {
|
||||||
|
$el.attr('aria-roledescription', description);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElControls($el, controls) {
|
||||||
|
$el.attr('aria-controls', controls);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElLabel($el, label) {
|
||||||
|
$el.attr('aria-label', label);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElId($el, id) {
|
||||||
|
$el.attr('id', id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addElLive($el, live) {
|
||||||
|
$el.attr('aria-live', live);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableEl($el) {
|
||||||
|
$el.attr('aria-disabled', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableEl($el) {
|
||||||
|
$el.attr('aria-disabled', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onEnterOrSpaceKey(e) {
|
||||||
|
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
||||||
|
const params = swiper.params.a11y;
|
||||||
|
const $targetEl = $(e.target);
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
|
||||||
|
if (!(swiper.isEnd && !swiper.params.loop)) {
|
||||||
|
swiper.slideNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.isEnd) {
|
||||||
|
notify(params.lastSlideMessage);
|
||||||
|
} else {
|
||||||
|
notify(params.nextSlideMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
|
||||||
|
if (!(swiper.isBeginning && !swiper.params.loop)) {
|
||||||
|
swiper.slidePrev();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.isBeginning) {
|
||||||
|
notify(params.firstSlideMessage);
|
||||||
|
} else {
|
||||||
|
notify(params.prevSlideMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) {
|
||||||
|
$targetEl[0].click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateNavigation() {
|
||||||
|
if (swiper.params.loop || !swiper.navigation) return;
|
||||||
|
const {
|
||||||
|
$nextEl,
|
||||||
|
$prevEl
|
||||||
|
} = swiper.navigation;
|
||||||
|
|
||||||
|
if ($prevEl && $prevEl.length > 0) {
|
||||||
|
if (swiper.isBeginning) {
|
||||||
|
disableEl($prevEl);
|
||||||
|
makeElNotFocusable($prevEl);
|
||||||
|
} else {
|
||||||
|
enableEl($prevEl);
|
||||||
|
makeElFocusable($prevEl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nextEl && $nextEl.length > 0) {
|
||||||
|
if (swiper.isEnd) {
|
||||||
|
disableEl($nextEl);
|
||||||
|
makeElNotFocusable($nextEl);
|
||||||
|
} else {
|
||||||
|
enableEl($nextEl);
|
||||||
|
makeElFocusable($nextEl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasPagination() {
|
||||||
|
return swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePagination() {
|
||||||
|
const params = swiper.params.a11y;
|
||||||
|
|
||||||
|
if (hasPagination()) {
|
||||||
|
swiper.pagination.bullets.each(bulletEl => {
|
||||||
|
const $bulletEl = $(bulletEl);
|
||||||
|
makeElFocusable($bulletEl);
|
||||||
|
|
||||||
|
if (!swiper.params.pagination.renderBullet) {
|
||||||
|
addElRole($bulletEl, 'button');
|
||||||
|
addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const initNavEl = ($el, wrapperId, message) => {
|
||||||
|
makeElFocusable($el);
|
||||||
|
|
||||||
|
if ($el[0].tagName !== 'BUTTON') {
|
||||||
|
addElRole($el, 'button');
|
||||||
|
$el.on('keydown', onEnterOrSpaceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
addElLabel($el, message);
|
||||||
|
addElControls($el, wrapperId);
|
||||||
|
};
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
const params = swiper.params.a11y;
|
||||||
|
swiper.$el.append(liveRegion); // Container
|
||||||
|
|
||||||
|
const $containerEl = swiper.$el;
|
||||||
|
|
||||||
|
if (params.containerRoleDescriptionMessage) {
|
||||||
|
addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.containerMessage) {
|
||||||
|
addElLabel($containerEl, params.containerMessage);
|
||||||
|
} // Wrapper
|
||||||
|
|
||||||
|
|
||||||
|
const $wrapperEl = swiper.$wrapperEl;
|
||||||
|
const wrapperId = $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`;
|
||||||
|
const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
|
||||||
|
addElId($wrapperEl, wrapperId);
|
||||||
|
addElLive($wrapperEl, live); // Slide
|
||||||
|
|
||||||
|
if (params.itemRoleDescriptionMessage) {
|
||||||
|
addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
addElRole($(swiper.slides), params.slideRole);
|
||||||
|
const slidesLength = swiper.params.loop ? swiper.slides.filter(el => !el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length;
|
||||||
|
swiper.slides.each((slideEl, index) => {
|
||||||
|
const $slideEl = $(slideEl);
|
||||||
|
const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index;
|
||||||
|
const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
|
||||||
|
addElLabel($slideEl, ariaLabelMessage);
|
||||||
|
}); // Navigation
|
||||||
|
|
||||||
|
let $nextEl;
|
||||||
|
let $prevEl;
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$nextEl) {
|
||||||
|
$nextEl = swiper.navigation.$nextEl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$prevEl) {
|
||||||
|
$prevEl = swiper.navigation.$prevEl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nextEl && $nextEl.length) {
|
||||||
|
initNavEl($nextEl, wrapperId, params.nextSlideMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prevEl && $prevEl.length) {
|
||||||
|
initNavEl($prevEl, wrapperId, params.prevSlideMessage);
|
||||||
|
} // Pagination
|
||||||
|
|
||||||
|
|
||||||
|
if (hasPagination()) {
|
||||||
|
swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy() {
|
||||||
|
if (liveRegion && liveRegion.length > 0) liveRegion.remove();
|
||||||
|
let $nextEl;
|
||||||
|
let $prevEl;
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$nextEl) {
|
||||||
|
$nextEl = swiper.navigation.$nextEl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.navigation && swiper.navigation.$prevEl) {
|
||||||
|
$prevEl = swiper.navigation.$prevEl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nextEl) {
|
||||||
|
$nextEl.off('keydown', onEnterOrSpaceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prevEl) {
|
||||||
|
$prevEl.off('keydown', onEnterOrSpaceKey);
|
||||||
|
} // Pagination
|
||||||
|
|
||||||
|
|
||||||
|
if (hasPagination()) {
|
||||||
|
swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
on('beforeInit', () => {
|
||||||
|
liveRegion = $(`<span class="${swiper.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`);
|
||||||
|
});
|
||||||
|
on('afterInit', () => {
|
||||||
|
if (!swiper.params.a11y.enabled) return;
|
||||||
|
init();
|
||||||
|
updateNavigation();
|
||||||
|
});
|
||||||
|
on('toEdge', () => {
|
||||||
|
if (!swiper.params.a11y.enabled) return;
|
||||||
|
updateNavigation();
|
||||||
|
});
|
||||||
|
on('fromEdge', () => {
|
||||||
|
if (!swiper.params.a11y.enabled) return;
|
||||||
|
updateNavigation();
|
||||||
|
});
|
||||||
|
on('paginationUpdate', () => {
|
||||||
|
if (!swiper.params.a11y.enabled) return;
|
||||||
|
updatePagination();
|
||||||
|
});
|
||||||
|
on('destroy', () => {
|
||||||
|
if (!swiper.params.a11y.enabled) return;
|
||||||
|
destroy();
|
||||||
|
});
|
||||||
|
}
|
9
resources/web/include/swiper/modules/a11y/a11y.less
Normal file
9
resources/web/include/swiper/modules/a11y/a11y.less
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000;
|
||||||
|
}
|
1
resources/web/include/swiper/modules/a11y/a11y.min.css
vendored
Normal file
1
resources/web/include/swiper/modules/a11y/a11y.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}
|
9
resources/web/include/swiper/modules/a11y/a11y.scss
Normal file
9
resources/web/include/swiper/modules/a11y/a11y.scss
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000;
|
||||||
|
}
|
222
resources/web/include/swiper/modules/autoplay/autoplay.js
Normal file
222
resources/web/include/swiper/modules/autoplay/autoplay.js
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
/* eslint no-underscore-dangle: "off" */
|
||||||
|
|
||||||
|
/* eslint no-use-before-define: "off" */
|
||||||
|
import { getDocument } from 'ssr-window';
|
||||||
|
import { nextTick } from '../../shared/utils.js';
|
||||||
|
export default function Autoplay({
|
||||||
|
swiper,
|
||||||
|
extendParams,
|
||||||
|
on,
|
||||||
|
emit
|
||||||
|
}) {
|
||||||
|
let timeout;
|
||||||
|
swiper.autoplay = {
|
||||||
|
running: false,
|
||||||
|
paused: false
|
||||||
|
};
|
||||||
|
extendParams({
|
||||||
|
autoplay: {
|
||||||
|
enabled: false,
|
||||||
|
delay: 3000,
|
||||||
|
waitForTransition: true,
|
||||||
|
disableOnInteraction: true,
|
||||||
|
stopOnLastSlide: false,
|
||||||
|
reverseDirection: false,
|
||||||
|
pauseOnMouseEnter: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
const $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
|
||||||
|
let delay = swiper.params.autoplay.delay;
|
||||||
|
|
||||||
|
if ($activeSlideEl.attr('data-swiper-autoplay')) {
|
||||||
|
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = nextTick(() => {
|
||||||
|
let autoplayResult;
|
||||||
|
|
||||||
|
if (swiper.params.autoplay.reverseDirection) {
|
||||||
|
if (swiper.params.loop) {
|
||||||
|
swiper.loopFix();
|
||||||
|
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else if (!swiper.isBeginning) {
|
||||||
|
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
||||||
|
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
} else if (swiper.params.loop) {
|
||||||
|
swiper.loopFix();
|
||||||
|
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else if (!swiper.isEnd) {
|
||||||
|
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
||||||
|
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
|
||||||
|
emit('autoplay');
|
||||||
|
} else {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
}, delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
if (typeof timeout !== 'undefined') return false;
|
||||||
|
if (swiper.autoplay.running) return false;
|
||||||
|
swiper.autoplay.running = true;
|
||||||
|
emit('autoplayStart');
|
||||||
|
run();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
if (!swiper.autoplay.running) return false;
|
||||||
|
if (typeof timeout === 'undefined') return false;
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.autoplay.running = false;
|
||||||
|
emit('autoplayStop');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pause(speed) {
|
||||||
|
if (!swiper.autoplay.running) return;
|
||||||
|
if (swiper.autoplay.paused) return;
|
||||||
|
if (timeout) clearTimeout(timeout);
|
||||||
|
swiper.autoplay.paused = true;
|
||||||
|
|
||||||
|
if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
|
||||||
|
swiper.autoplay.paused = false;
|
||||||
|
run();
|
||||||
|
} else {
|
||||||
|
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
||||||
|
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onVisibilityChange() {
|
||||||
|
const document = getDocument();
|
||||||
|
|
||||||
|
if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
|
||||||
|
run();
|
||||||
|
swiper.autoplay.paused = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTransitionEnd(e) {
|
||||||
|
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
|
||||||
|
if (e.target !== swiper.$wrapperEl[0]) return;
|
||||||
|
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
||||||
|
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
||||||
|
});
|
||||||
|
swiper.autoplay.paused = false;
|
||||||
|
|
||||||
|
if (!swiper.autoplay.running) {
|
||||||
|
stop();
|
||||||
|
} else {
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseEnter() {
|
||||||
|
if (swiper.params.autoplay.disableOnInteraction) {
|
||||||
|
stop();
|
||||||
|
} else {
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
||||||
|
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseLeave() {
|
||||||
|
if (swiper.params.autoplay.disableOnInteraction) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
swiper.autoplay.paused = false;
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachMouseEvents() {
|
||||||
|
if (swiper.params.autoplay.pauseOnMouseEnter) {
|
||||||
|
swiper.$el.on('mouseenter', onMouseEnter);
|
||||||
|
swiper.$el.on('mouseleave', onMouseLeave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function detachMouseEvents() {
|
||||||
|
swiper.$el.off('mouseenter', onMouseEnter);
|
||||||
|
swiper.$el.off('mouseleave', onMouseLeave);
|
||||||
|
}
|
||||||
|
|
||||||
|
on('init', () => {
|
||||||
|
if (swiper.params.autoplay.enabled) {
|
||||||
|
start();
|
||||||
|
const document = getDocument();
|
||||||
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
attachMouseEvents();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on('beforeTransitionStart', (_s, speed, internal) => {
|
||||||
|
if (swiper.autoplay.running) {
|
||||||
|
if (internal || !swiper.params.autoplay.disableOnInteraction) {
|
||||||
|
swiper.autoplay.pause(speed);
|
||||||
|
} else {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on('sliderFirstMove', () => {
|
||||||
|
if (swiper.autoplay.running) {
|
||||||
|
if (swiper.params.autoplay.disableOnInteraction) {
|
||||||
|
stop();
|
||||||
|
} else {
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on('touchEnd', () => {
|
||||||
|
if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
on('destroy', () => {
|
||||||
|
detachMouseEvents();
|
||||||
|
|
||||||
|
if (swiper.autoplay.running) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
const document = getDocument();
|
||||||
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
});
|
||||||
|
Object.assign(swiper.autoplay, {
|
||||||
|
pause,
|
||||||
|
run,
|
||||||
|
start,
|
||||||
|
stop
|
||||||
|
});
|
||||||
|
}
|
0
resources/web/include/swiper/modules/autoplay/autoplay.min.css
vendored
Normal file
0
resources/web/include/swiper/modules/autoplay/autoplay.min.css
vendored
Normal file
191
resources/web/include/swiper/modules/controller/controller.js
Normal file
191
resources/web/include/swiper/modules/controller/controller.js
Normal file
|
@ -0,0 +1,191 @@
|
||||||
|
/* eslint no-bitwise: ["error", { "allow": [">>"] }] */
|
||||||
|
import { nextTick } from '../../shared/utils.js';
|
||||||
|
export default function Controller({
|
||||||
|
swiper,
|
||||||
|
extendParams,
|
||||||
|
on
|
||||||
|
}) {
|
||||||
|
extendParams({
|
||||||
|
controller: {
|
||||||
|
control: undefined,
|
||||||
|
inverse: false,
|
||||||
|
by: 'slide' // or 'container'
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
swiper.controller = {
|
||||||
|
control: undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
function LinearSpline(x, y) {
|
||||||
|
const binarySearch = function search() {
|
||||||
|
let maxIndex;
|
||||||
|
let minIndex;
|
||||||
|
let guess;
|
||||||
|
return (array, val) => {
|
||||||
|
minIndex = -1;
|
||||||
|
maxIndex = array.length;
|
||||||
|
|
||||||
|
while (maxIndex - minIndex > 1) {
|
||||||
|
guess = maxIndex + minIndex >> 1;
|
||||||
|
|
||||||
|
if (array[guess] <= val) {
|
||||||
|
minIndex = guess;
|
||||||
|
} else {
|
||||||
|
maxIndex = guess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxIndex;
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value:
|
||||||
|
// (x1,y1) is the known point before given value,
|
||||||
|
// (x3,y3) is the known point after given value.
|
||||||
|
|
||||||
|
let i1;
|
||||||
|
let i3;
|
||||||
|
|
||||||
|
this.interpolate = function interpolate(x2) {
|
||||||
|
if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2):
|
||||||
|
|
||||||
|
i3 = binarySearch(this.x, x2);
|
||||||
|
i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already:
|
||||||
|
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
|
||||||
|
|
||||||
|
return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
} // xxx: for now i will just save one spline function to to
|
||||||
|
|
||||||
|
|
||||||
|
function getInterpolateFunction(c) {
|
||||||
|
if (!swiper.controller.spline) {
|
||||||
|
swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTranslate(_t, byController) {
|
||||||
|
const controlled = swiper.controller.control;
|
||||||
|
let multiplier;
|
||||||
|
let controlledTranslate;
|
||||||
|
const Swiper = swiper.constructor;
|
||||||
|
|
||||||
|
function setControlledTranslate(c) {
|
||||||
|
// this will create an Interpolate function based on the snapGrids
|
||||||
|
// x is the Grid of the scrolled scroller and y will be the controlled scroller
|
||||||
|
// it makes sense to create this only once and recall it for the interpolation
|
||||||
|
// the function does a lot of value caching for performance
|
||||||
|
const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
|
||||||
|
|
||||||
|
if (swiper.params.controller.by === 'slide') {
|
||||||
|
getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
|
||||||
|
// but it did not work out
|
||||||
|
|
||||||
|
controlledTranslate = -swiper.controller.spline.interpolate(-translate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!controlledTranslate || swiper.params.controller.by === 'container') {
|
||||||
|
multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
|
||||||
|
controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swiper.params.controller.inverse) {
|
||||||
|
controlledTranslate = c.maxTranslate() - controlledTranslate;
|
||||||
|
}
|
||||||
|
|
||||||
|
c.updateProgress(controlledTranslate);
|
||||||
|
c.setTranslate(controlledTranslate, swiper);
|
||||||
|
c.updateActiveIndex();
|
||||||
|
c.updateSlidesClasses();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(controlled)) {
|
||||||
|
for (let i = 0; i < controlled.length; i += 1) {
|
||||||
|
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
|
||||||
|
setControlledTranslate(controlled[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (controlled instanceof Swiper && byController !== controlled) {
|
||||||
|
setControlledTranslate(controlled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTransition(duration, byController) {
|
||||||
|
const Swiper = swiper.constructor;
|
||||||
|
const controlled = swiper.controller.control;
|
||||||
|
let i;
|
||||||
|
|
||||||
|
function setControlledTransition(c) {
|
||||||
|
c.setTransition(duration, swiper);
|
||||||
|
|
||||||
|
if (duration !== 0) {
|
||||||
|
c.transitionStart();
|
||||||
|
|
||||||
|
if (c.params.autoHeight) {
|
||||||
|
nextTick(() => {
|
||||||
|
c.updateAutoHeight();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
c.$wrapperEl.transitionEnd(() => {
|
||||||
|
if (!controlled) return;
|
||||||
|
|
||||||
|
if (c.params.loop && swiper.params.controller.by === 'slide') {
|
||||||
|
c.loopFix();
|
||||||
|
}
|
||||||
|
|
||||||
|
c.transitionEnd();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(controlled)) {
|
||||||
|
for (i = 0; i < controlled.length; i += 1) {
|
||||||
|
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
|
||||||
|
setControlledTransition(controlled[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (controlled instanceof Swiper && byController !== controlled) {
|
||||||
|
setControlledTransition(controlled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeSpline() {
|
||||||
|
if (!swiper.controller.control) return;
|
||||||
|
|
||||||
|
if (swiper.controller.spline) {
|
||||||
|
swiper.controller.spline = undefined;
|
||||||
|
delete swiper.controller.spline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
on('beforeInit', () => {
|
||||||
|
swiper.controller.control = swiper.params.controller.control;
|
||||||
|
});
|
||||||
|
on('update', () => {
|
||||||
|
removeSpline();
|
||||||
|
});
|
||||||
|
on('resize', () => {
|
||||||
|
removeSpline();
|
||||||
|
});
|
||||||
|
on('observerUpdate', () => {
|
||||||
|
removeSpline();
|
||||||
|
});
|
||||||
|
on('setTranslate', (_s, translate, byController) => {
|
||||||
|
if (!swiper.controller.control) return;
|
||||||
|
swiper.controller.setTranslate(translate, byController);
|
||||||
|
});
|
||||||
|
on('setTransition', (_s, duration, byController) => {
|
||||||
|
if (!swiper.controller.control) return;
|
||||||
|
swiper.controller.setTransition(duration, byController);
|
||||||
|
});
|
||||||
|
Object.assign(swiper.controller, {
|
||||||
|
setTranslate,
|
||||||
|
setTransition
|
||||||
|
});
|
||||||
|
}
|
0
resources/web/include/swiper/modules/controller/controller.min.css
vendored
Normal file
0
resources/web/include/swiper/modules/controller/controller.min.css
vendored
Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue