text
stringlengths 2
1.05M
|
|---|
(self.webpackChunk_elegantstack_gatsby_starter_flexiblocks=self.webpackChunk_elegantstack_gatsby_starter_flexiblocks||[]).push([[2839],{5541:function(t,e,n){"use strict";n.d(e,{c:function(){return o}});var o=function(t,e){return void 0===e&&(e="identifier"),null==t?void 0:t.reduce((function(t,n){return t[n[e]]=n,t}),{})}},6527:function(t,e,n){"use strict";n.d(e,{Z:function(){return x}});var o=n(8291),i=n(7451),r=n(7378),a=n(3314),l=n(2730),s=n(4886),u=n(4332),c=n(3059),f=n(2577),d=n(1690),Z=n(3253),p=n(6495),m=["container","buttons"],x=(0,Z.Z)((function(t){var e=t.content,n=e.text,Z=void 0===n?[]:n,x=e.collection;e.buttons;return(0,p.tZ)(a.W2,{sx:{textAlign:"left"}},(0,p.tZ)(a.xu,null,(0,p.tZ)(c.Z,{content:Z,sx:{textAlign:"center"}})),x&&(0,p.tZ)(r.Fragment,null,(0,p.tZ)(s.Z,{space:"0"}),(0,p.tZ)(l.Z,{effect:"fadeInDown"},(0,p.tZ)(a.kC,{sx:{justifyContent:"start",flexWrap:"wrap",m:0}},x.map((function(t,e){var n=t.container,l=t.buttons,s=(0,i.Z)(t,m);return(0,p.tZ)(a.xu,{key:"item-"+e,sx:{flexBasis:["1","1/2",null,"1/2"],p:2}},(0,p.tZ)(u.Z,{content:n},(0,p.tZ)(f.Z,(0,o.Z)({},s,{iconProps:{round:!0},vertical:!0,left:!0})),l&&(0,p.tZ)(r.Fragment,null,(0,p.tZ)(d.Z,{content:l}))))}))))))}))},2295:function(t,e,n){"use strict";n.d(e,{Z:function(){return d}});n(7378);var o=n(5414),i=n(3314),r=n(3059),a=n(9606),l=(n(3605),n(1690)),s=n(3253),u=n(6495),c={wrapper:{position:"relative",bg:"footerBg"},footer:{flexDirection:["column-reverse","row"],justifyContent:"space-between",alignItems:["center","flex-start"],py:5},listBlk:{display:"block",overflowX:"hidden"}},f=function(t){var e=t.content,n=e.text,s=e.images,f=e.collection;return(0,u.tZ)(i.xu,{sx:c.wrapper},(0,u.tZ)(i.W2,{px:"4"},(0,u.tZ)(i.kC,{sx:c.footer,xs:c.listBlk,className:"footerJoint"},(0,u.tZ)(i.xu,{sx:{minWidth:200}},(0,u.tZ)(i.xu,{pb:"1",mb:"2",mt:[4,0]},(0,u.tZ)(o.rU,{to:"/"},(0,u.tZ)(a.Z,{content:{images:s},imageEffect:"fadeIn"}))),(0,u.tZ)(i.xu,{pt:"2",mb:2},(0,u.tZ)(r.Z,{sx:{maxWidth:260},content:null==n?void 0:n[0]})),(0,u.tZ)(i.xu,{pt:"2",mb:[2,4]},"© ",(new Date).getFullYear(),", All Rights Reserved.")),null==f?void 0:f.map((function(t,e){var n=t.text,o=t.buttons;return o&&(0,u.tZ)(i.xu,{key:"item-"+e,mb:"3",xs:c.listBlk,className:"footer-links-block"},(0,u.tZ)(r.Z,{content:null==n?void 0:n[0],variant:"h5",sx:{display:["none","block"]}}),(0,u.tZ)(l.Z,{content:o,variant:"vertical",wrapperStyles:{flexDirection:[null,"column"]}}))})))))};f.defaultProps={menuJustify:"flex-end"};var d=(0,s.Z)(f)},2899:function(t,e,n){"use strict";n.d(e,{Z:function(){return x}});var o=n(7378),i=n(5414),r=n(6267),a=n(1025),l=n(3314),s=n(2730),u=n(3924),c=n(9606),f=n(1690),d=n(3253),Z=n(6495),p={wrapper:{position:"relative",zIndex:10,".nav-container":{bg:"headerBg",position:"fixed",transition:"all 250ms ease-in",py:3},".nav-sticky .nav-container":{bg:"headerActiveBg",boxShadow:"0 0 25px rgba(140,152,164,.25)",py:[3,null,2],".button-group-link.level-1, button-group-link.level-1:visited":{color:"headerActiveColor"}},".button-group-button":{minWidth:120,fontSize:1,px:4,py:2}},header:{justifyContent:"space-between",alignItems:"center"},logoContainer:{flexShrink:0,mr:[null,null,3,5]},desktopMenu:{display:["none",null,"block"],minWidth:"auto",flexGrow:1},mobileMenu:{display:["block",null,"none"]}},m=function(t){var e=t.content,n=e.images,d=e.collection,m=t.menuJustify;return(0,Z.tZ)(o.Fragment,null,(0,Z.tZ)(r.ZP,{enabled:"true",stickyClassName:"nav-sticky",css:(0,a.i)(p.wrapper)},(0,Z.tZ)(l.W2,{variant:"full",className:"nav-container"},(0,Z.tZ)(l.W2,{px:"4"},(0,Z.tZ)(l.kC,{sx:p.header},(0,Z.tZ)(l.xu,{sx:p.logoContainer},(0,Z.tZ)(i.rU,{to:"/"},(0,Z.tZ)(c.Z,{content:{images:n},sx:p.image,imageEffect:"fadeIn"}))),d&&(0,Z.tZ)(o.Fragment,null,(0,Z.tZ)(l.xu,{sx:p.desktopMenu},(0,Z.tZ)(s.Z,{effect:"fadeInDown"},(0,Z.tZ)(l.kC,{sx:{alignItems:"center",justifyContent:m}},d.map((function(t,e){var n=t.buttons;return n&&(0,Z.tZ)(l.xu,{key:"item-"+e,sx:{"& + &":{ml:4}}},(0,Z.tZ)(f.Z,{content:n}))}))))),(0,Z.tZ)(l.xu,{sx:p.mobileMenu},(0,Z.tZ)(u.Z,{buttonStyle:{svg:{size:32}}},d.map((function(t,e){var n=t.buttons;return n&&(0,Z.tZ)(l.xu,{key:"item-"+e,sx:{fontSize:3,".button-group-link.level-1, button-group-link.level-1:visited":{color:"headerActiveColor"}}},(0,Z.tZ)(f.Z,{content:n,variant:"vertical"}))}))))))))))};m.defaultProps={menuJustify:"flex-end"};var x=(0,d.Z)(m)},8621:function(t,e,n){"use strict";n.d(e,{Z:function(){return f}});var o=n(7378),i=(n(6267),n(3314)),r=n(2730),a=n(1690),l=n(3253),s=n(6495),u={wrapper:{position:"relative",zIndex:10,".nav-container":{bg:"#403c56",color:"#d3e4ff",position:"relative",transition:"all 250ms ease-in",py:3},".nav-sticky .nav-container":{bg:"headerActiveBg",boxShadow:"0 0 25px rgba(140,152,164,.25)",py:[1,null,1],".button-group-link.level-1, button-group-link.level-1:visited":{color:"headerActiveColor"}},".button-group-button":{minWidth:80,fontSize:"12px",px:"8px",py:"2px"}},header:{justifyContent:"end",alignItems:"right"},desktopMenu:{display:["block",null,"block"],minWidth:"auto",flexGrow:1,color:"#d3e4ff"},mobileMenu:{display:["block",null,"block"],color:"#d3e4ff"}},c=function(t){var e=t.content,n=(e.images,e.collection);t.menuJustify;return(0,s.tZ)("div",{className:"subheader-main"},(0,s.tZ)(i.W2,{variant:"full",className:"nav-container"},(0,s.tZ)(i.W2,{px:"2"},(0,s.tZ)(i.kC,{sx:u.header},n&&(0,s.tZ)(o.Fragment,null,(0,s.tZ)(i.xu,{sx:u.desktopMenu},(0,s.tZ)(r.Z,{effect:"fadeInDown"},(0,s.tZ)(i.kC,{sx:{alignItems:"center",justifyContent:"end"}},n.map((function(t,e){var n=t.buttons;return n&&(0,s.tZ)(i.xu,{key:"item-"+e,sx:{"& + &":{ml:2}}},(0,s.tZ)(a.Z,{content:n}))}))))))))))};c.defaultProps={menuJustify:"end"};var f=(0,l.Z)(c)},2577:function(t,e,n){"use strict";n.d(e,{Z:function(){return u}});var o=n(8291),i=(n(7378),n(3314)),r=n(3059),a=n(6140),l=n(6495),s=function(t){var e,n=t.icon,s=t.iconProps,u=t.text,c=t.description,f=t.compact,d=t.vertical,Z=t.center,p=t.middle;return(0,l.tZ)(i.kC,{sx:{flexDirection:d?"column":"row",alignItems:Z?"center":"flex-start",textAlign:Z&&d?"center":"unset",justifyContent:p?"center":"unset","& + &":{mt:c?f?3:4:2}}},(null==n?void 0:n.src)&&(0,l.tZ)(i.xu,{sx:(e={display:"inline-flex",flexShrink:0},e[d?"mb":"mr"]=f?2:3,e)},(0,l.tZ)(a.Z,(0,o.Z)({content:n,size:"sm",p:f?1:void 0},s))),(0,l.tZ)(i.xu,{sx:{alignSelf:d?"auto":"center"}},(0,l.tZ)(r.Z,{content:u})))};s.defaultProps={iconProps:{}};var u=s},3605:function(t,e,n){"use strict";n(7378),n(6495)},2889:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return g}});var o=n(8291),i=(n(7378),n(3314)),r=n(8110),a=n(8062),l=n(4886),s=n(2899),u=n(2295),c=n(8621),f=n(6527),d=n(5541),Z=n(5414),p={heroContainer:{position:"relative",pt:[6],"::before":{position:"absolute",content:'" "',width:"full",height:"100%",top:0,right:0,zIndex:-1,bg:"white"}},heroContainer2:{position:"relative",pt:[0]}},m={colors:{background:"#fbfbfb",headerBg:"#FFFFFF",footerBg:"#f1f3f8"}},x=n(6495),v=5,b=setInterval((function(){v<=0?(clearInterval(b),document.getElementById("countdown").innerHTML="0",(0,Z.c4)("/campaigns/")):document.getElementById("countdown").innerHTML=v,v-=1}),1e3),g=function(t){var e=t.data.allBlockContent,n=(0,d.c)(null==e?void 0:e.nodes);return(0,x.tZ)(r.Z,(0,o.Z)({theme:m},t),(0,x.tZ)(a.Z,{title:"SMS Packages | Mumara",description:"Select desired slab according to the estimated monthly sending volume and get the most affordable message sending rates across the globe.",keywords:"sms topup,sms package,bulk sms service,bulk sms cost,sms online recharge"}),(0,x.tZ)("div",{className:"subheader-block"},(0,x.tZ)(c.Z,{content:n.subheader_sms,menuJustify:"space-between"})),(0,x.tZ)(s.Z,{content:n.header}),(0,x.tZ)(i.W2,{className:"classic-featuresBlk",variant:"full",sx:p.heroContainer},(0,x.tZ)(l.Z,{space:"2"}),(0,x.tZ)(f.Z,{content:n.cl_features}),(0,x.tZ)("div",{className:"counterblock"},(0,x.tZ)("div",{id:"countdown"}),(0,x.tZ)("div",{className:"counter-loading"})),(0,x.tZ)(l.Z,{space:"5"})),(0,x.tZ)(u.Z,{content:n.footer}))}}}]);
//# sourceMappingURL=component---packages-themes-gatsby-theme-flexiblocks-src-pages-campaigns-features-smart-segments-index-jsx-332f871efd96176cc287.js.map
|
import React from 'react'
import Footer from './footer'
import Header from './header'
import '../styles/index.scss'
import layoutStyles from './layout.module.scss'
const Layout = (props) => {
return (
<div className={layoutStyles.container}>
<div className='layoutStyles.container'>
<Header />
{props.children}
</div>
<Footer />
</div>
)
}
export default Layout
|
"use plain";
"use strict";
var debug = /(^\??|&)debug(=.*?)?(&|$)/.test( location.search );
console.log( new Date() );
var allModules = {};
var Module = function Module( moduleName, bucket, moduleCode ) {
if ( !( this instanceof Module ) ) {
throw new TypeError( 'class constructors must be invoked with |new|.' );
}
( this.allModules = allModules )[ moduleName ] = this;
this.name = moduleName;
this.bucket = bucket;
this.exports = {};
this.modules = {};
this.loaded = false;
this.parent = undefined;
this.children = [];
this.compiledCode = moduleCode;
this._require = Module._require.bind( this );
}
Module._require = function require( moduleName ) {
var module = this.bucket || this;
moduleName.split( '/' ).forEach( function handleEachModuleNameSplit( p, index, array ) {
if ( p === '.' ) {
return;
} else if ( p == '..' ) {
module = module.bucket;
} else if ( module.modules[ p ] instanceof Module ) {
module = module.modules[ p ];
} else {
debugger;
throw new TypeError( '"' + ( index ? array.slice( 0, index ).join( '/' ) + '/' : '' ) + p + '" is not a module' );
}
});
if ( !module.loaded ) {
module.loaded = true;
module.compiledCode.call( module.exports, module.exports, module._require, module );
var exports = module.exports;
if ( exports !== undefined && exports !== null && exports.__module__ === undefined ) {
Object.defineProperties( exports, {
__module__: { value: module, configurable: false, enumerable: false, writable: false },
});
}
module.parent = this;
}
module in this.children || this.children.push( module );
return module.exports;
};
var WebClient = window[ globalWebClientVariableName ] = new Module( '__main__', null );
var require = WebClient._require;
WebClient.define = function define( moduleName, moduleCode ) {
var module, exports;
module = WebClient;
// TODO: Do we need this if-clause?
if ( moduleName !== '__main__' ) {
moduleName.split( '/' ).forEach( function( p, index, array ) {
if ( module.modules[ p ] === undefined ) {
module = module.modules[ p ] = new Module( array.slice( 0, index + 1 ).join( '/' ), module, moduleCode );
} else if ( module.modules[ p ] instanceof Module ) {
module = module.modules[ p ];
} else {
throw new TypeError( '"' + array.slice( 0, index ) + '" is not a module' );
}
});
}
};
( function loadRessources() {
var pendingLoadings = 0;
var failedLoadings = [];
function loadRessourceOnEvent( event ) {
var target = event.target;
target.removeEventListener( 'error', loadRessourceOnEvent );
target.removeEventListener( 'load', loadRessourceOnEvent );
pendingLoadings--;
if ( event.type === 'error' ) {
failedLoadings.push( event );
}
if ( pendingLoadings ) {
return;
}
if ( failedLoadings.length > 0 ) {
debugger;
} else {
console.log( new Date() );
var Application = require( './web/Application' );
setTimeout( Application.run, 0 );
}
}
var createTarget = {
js: function createTarget_js( src ) {
var script = document.createElement( 'script')
script.src = src;
return script;
},
css: function createTarget_css( href ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.href = href;
return link
},
}
if ( !debug ) {
ressources = {
js: [ 'web/client/oneshot/oneshot.js' ],
css: [ 'web/client/oneshot/oneshot.css' ],
}
}
Object.getOwnPropertyNames( ressources ).forEach( function __forEachRessourceType( ressourceType ) {
pendingLoadings += ressources[ ressourceType ].length;
ressources[ ressourceType ].forEach( function __forEachRessource( virtualPath ) {
var target = createTarget[ ressourceType ]( virtualPath );
target.addEventListener( 'error', loadRessourceOnEvent );
target.addEventListener( 'load', loadRessourceOnEvent );
document.head.appendChild( target );
});
});
})();
|
import * as React from 'react';
import * as PropTypes from 'prop-types';
import classNames from 'classnames';
/* eslint-disable @typescript-eslint/no-explicit-any */
const propTypes = {
/**
* This is url to load inside iframe
*/
url: PropTypes.string,
height: PropTypes.number,
};
const defaultProps = {
url: 'https://google.com/',
height: 0,
};
const Framify = ({ url, height: frameHeight }) => {
const deviceList = [
{
label: 'Mobile Small',
width: 320,
}, {
label: 'Mobile Medium',
width: 414,
}, {
label: 'Mobile Large',
width: 578,
}, {
label: 'Full Screen',
width: 1024,
},
];
deviceList.reverse();
const iframe = React.useRef();
const [focus, setFocus] = React.useState(null);
const [active, setActive] = React.useState(null);
const [size, setSize] = React.useState(0);
const [height, setHeight] = React.useState(0);
const setIframeHeight = (e) => {
switch (e.data.message) {
case 'loadHeight': {
setHeight(e.data.value);
break;
}
default: {
return 0;
}
}
};
React.useEffect(() => {
setActive(deviceList[deviceList.length - 2].label);
setSize(deviceList[deviceList.length - 2].width);
window.addEventListener('message', setIframeHeight, false);
}, []);
const buttonAction = {
onMouseOver: (e) => {
if (e.target.firstChild.getAttribute) {
setFocus(e.target.firstChild.getAttribute('data-label'));
}
else {
setFocus(e.target.getAttribute('data-label'));
}
},
onMouseLeave: () => {
setFocus(null);
},
onClick: (e) => {
const obj = document.getElementById('iframe');
obj.contentWindow.postMessage({ message: 'reload', value: 'ok' }, '*');
if (e.target.firstChild.getAttribute) {
const label = e.target.firstChild.getAttribute('data-label');
setActive(label);
setSize(deviceList.filter((o) => o.label === label)[0].width);
}
else {
const label = e.target.getAttribute('data-label');
setActive(label);
setSize(deviceList.filter((o) => o.label === label)[0].width);
}
},
};
const definedSize = {
'mobile-s': size === 320,
'mobile-m': size === 414,
'mobile-l': size === 578,
full: size > 578,
};
return (React.createElement("div", { className: "framify" },
React.createElement("div", { className: "viewports" }, deviceList.map((device, index) => (React.createElement("button", Object.assign({ type: "button", style: { maxWidth: device.width }, key: device.width.toString(), className: classNames({
'trigger-resize': true,
active: !focus && device.label === active,
}) }, buttonAction),
React.createElement("div", { className: "label", "data-label": device.label }, index === deviceList.length - 1 && (focus || active)))))),
React.createElement("div", { className: classNames(Object.assign({ iframe: true }, definedSize)) },
React.createElement("iframe", { id: "iframe", ref: iframe, className: classNames(definedSize), style: { height: frameHeight || height }, src: `${url}?-_=${new Date().getTime()}`, title: "max" })),
React.createElement("a", { href: url, target: "_blank", className: "new-tab", rel: "noreferrer" }, "Full Screen")));
};
Framify.displayName = 'Framify';
Framify.propTypes = propTypes;
Framify.defaultProps = defaultProps;
export { Framify };
|
const protectRoute = (req, res, next) => {
if (req.isAuthenticated()) {
return next()
}
req.flash('error', 'Silahkan Login Terlebih Dahulu')
res.redirect('/auth')
}
const redirectRoute = (req, res, next) => {
if (!req.isAuthenticated()) {
return next()
}
res.redirect('/produk')
}
module.exports = {
protectRoute,
redirectRoute
}
|
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin =require('html-webpack-plugin')
module.exports = {
entry: './src/client.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'main.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: 'babel-loader',
exclude: /node_modules/,
}
]
},
// plugins: [
// new CopyPlugin({
// patterns: [
// { from: 'public/index.html' },
// ],
// }),
// ],
plugins:[
new HtmlWebpackPlugin({
filename: path.resolve(__dirname, 'build/index.html'),
template: path.resolve(__dirname, './public/index.html'),
})
]
};
|
const { expect } = require("chai");
const linthtml = require("../../../index");
const none = require('../../../presets').presets.none;
function createLinter() {
return new linthtml.Linter(linthtml.rules);
}
describe("attr-name-style", function() {
it("Should not report anything for correctly styled attribute names", async function() {
const linter = createLinter();
const html = `<div abc="" fowj0wo3=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "lowercase" });
expect(issues).to.have.lengthOf(0);
});
it("Should ignore ignored attributes", async function() {
const linter = createLinter();
const html = `<xml xlink:href=""></xml>`;
const issues = await linter.lint(html, none, { "attr-name-style": "dash", "attr-name-ignore-regex": "xlink:href" });
expect(issues).to.have.lengthOf(0);
});
it("Should not report anything when disabled", async function() {
const linter = createLinter();
const html = `<div abc="" 2fOwj_0o-3=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": false });
expect(issues).to.have.lengthOf(0);
});
describe("'lowercase' format", function() {
it("Should not report an error for attributes with valid format", async function() {
const linter = createLinter();
const html = `<div foo=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "lowercase" });
expect(issues).to.have.lengthOf(0);
});
it("Should report an error for attributes with invalid format", async function() {
const linter = createLinter();
const html = `<div FooBar="" foo-bar=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "lowercase" });
expect(issues).to.have.lengthOf(2);
});
});
describe("'dash' format", function() {
it("Should not report an error for attributes with valid format", async function() {
const linter = createLinter();
const html = `<div foo-bar=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "dash" });
expect(issues).to.have.lengthOf(0);
});
it("Should report an error for attributes with invalid format", async function() {
const linter = createLinter();
const html = `<div FooBar="" foo_bar=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "dash" });
expect(issues).to.have.lengthOf(2);
});
});
it("Should throw an error when an invalid config is passed", function() {
const linter = createLinter();
const html = `<button style="color: red;"></button>`;
expect(() => linter.lint(html, none, { "attr-name-style": ["camel"]}))
.to
.throw(`Configuration for rule "attr-name-style" is invalid: Expected string or RegExp got object`);
});
describe("'regexp' format", function() {
it("Should not report an error for attributes with valid format", async function() {
const linter = createLinter();
const html = `<div foo=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": /^[0-9a-o]+$/ });
expect(issues).to.have.lengthOf(0);
});
it("Should report an error for attributes with invalid format", async function() {
const linter = createLinter();
const html = `<div bar></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": /^[0-9a-o]+$/ });
expect(issues).to.have.lengthOf(1);
});
});
describe("'camel' format", function() {
it("Should not report an error for attributes with valid format", async function() {
const linter = createLinter();
const html = `<div FooBar=""></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "camel" });
expect(issues).to.have.lengthOf(0);
});
it("Should report an error for attributes with invalid format", async function() {
const linter = createLinter();
const html = `<div foo-bar></div>`;
const issues = await linter.lint(html, none, { "attr-name-style": "camel" });
expect(issues).to.have.lengthOf(1);
});
});
});
// NOPE
// {
// desc: "should accept a string giving a RegExp",
// input: '<div deadbeef1337="" fail="" fails=""></div>',
// opts: { "attr-name-style": "/^[0-9a-f]+$/g" },
// output: 2
// }
// ];
|
const { app, BrowserWindow } = require('electron')
const serve = require('electron-serve')
let mainWindow
const loadURL = serve({
directory: 'build'
})
function createWindow () {
mainWindow = new BrowserWindow({
height: 600,
width: 800
})
loadURL(mainWindow)
// mainWindow.webContents.openDevTools()
mainWindow.on('closed', dereferenceWindowObject)
}
function dereferenceWindowObject () {
mainWindow = null
}
app.on('ready', createWindow)
|
const fs = require('fs');
const lerDiretorio = function() {
fs.readdir(__dirname, function(erro, diretorio) {
if (erro) return erro;
diretorio.forEach(function(arquivo) {
ler(arquivo);
});
});
};
const ler = function(arquivo) {
const path = './' + arquivo;
fs.stat(path, function(erro, stat) {
if (erro) return erro;
if (stat.isFile()) {
console.log('%s %d bytes', arquivo, stat.size);
}
});
};
lerDiretorio();
|
/* -------------------------------------------------------------------------- */
/* Import Dependencies */
/* -------------------------------------------------------------------------- */
const { Model, DataTypes } = require('sequelize');
const sequelize = require('../config/connection');
/* -------------------------------------------------------------------------- */
/* Define Model */
/* -------------------------------------------------------------------------- */
class Family extends Model {}
Family.init (
{
id: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
// Should be single string name, last name ex 'Johnson'
name: {
type: DataTypes.STRING,
allowNull: false,
}
},
{
sequelize,
timestamps: false,
freezeTableName: true,
underscored: true,
modelName: 'family',
}
);
/* -------------------------------------------------------------------------- */
/* Export Module */
/* -------------------------------------------------------------------------- */
module.exports = Family;
|
/* xlsx.js (C) 2013-2014 SheetJS -- http://sheetjs.com */
/* uncomment the next line for encoding support */
//importScripts('dist/cpexcel.js');
importScripts('jszip.js');
importScripts('xlsx.js');
postMessage({t:"ready"});
onmessage = function (oEvent) {
var v;
try {
//v = XLSX.read(oEvent.data, {type: 'base64'});
v = XLSX.read(oEvent.data.d, {type: oEvent.data.b ? 'binary': 'base64'});
} catch(e) { postMessage({t:"e",d:e.stack}); }
postMessage({t:"xlsx", d:JSON.stringify(v)});
};
|
export default {
"angularVersion": null,
"host": 'localhost',
"apps": ["az-ci"],
"modules": [{
"name": "az-ci",
"deps": ["ngAnimate", "ngCookies", "az-ci-config", "ui.router", "angular-data.DSCacheFactory", "duScroll", "ngDropdowns", "ui.bootstrap"],
"components": [{
"name": "apiProcessors",
"deps": [],
"type": "service"
}, {
"name": "apiService",
"deps": ["$http", "$q", "CONFIG", "DSCacheFactory", "env", "apiProcessors"],
"type": "service"
}, {
"name": "newsData",
"deps": ["$q", "$http", "CONFIG", "apiService"],
"type": "service"
}, {
"name": "azClTableKeys",
"deps": ["clView", "CONFIG"],
"type": "directive"
}, {
"name": "clChartModel",
"deps": ["CONFIG", "clColorMapping", "clControlsModel", "dev", "regexp"],
"type": "service"
}, {
"name": "clEventsCharts",
"deps": ["$rootScope", "eventsProcessor", "clChartModel", "clControlsModel", "Event", "clControlsEventsFilter"],
"type": "service"
}, {
"name": "CLCompaniesCtrl",
"deps": ["$scope", "$rootScope", "clChartModel", "clControlsModel", "clView", "dev", "$log"],
"type": "controller"
}, {
"name": "clCompaniesDrug",
"deps": ["$rootScope", "clChartModel", "dev"],
"type": "directive"
}, {
"name": "eventFactory",
"deps": ["Event", "$filter"],
"type": "service"
}, {
"name": "Event",
"deps": ["CONFIG", "util"],
"type": "service"
}, {
"name": "eventsProcessor",
"deps": ["$filter", "Event", "util", "CONFIG", "eventFactory"],
"type": "service"
}, {
"name": "azEventsGroupChart",
"deps": ["$rootScope", "$parse", "clChartModel", "clEventsCharts", "eventsTooltip", "CONFIG", "SVG_EVENTS", "$filter", "util", "eventsDrawData"],
"type": "directive"
}, {
"name": "azEventsTable",
"deps": ["$window", "$rootScope", "$state", "$filter", "clControlsModel", "clEventsCharts", "$timeout"],
"type": "directive"
}, {
"name": "clControlsEventsFilter",
"deps": ["CONFIG", "SVG_EVENTS", "util", "$filter"],
"type": "service"
}, {
"name": "CLEventsCtrl",
"deps": ["clView", "clControlsModel", "$scope", "eventsForDrugs", "clEventsCharts"],
"type": "controller"
}, {
"name": "eventsDrawData",
"deps": ["eventsProcessor", "clChartModel", "clControlsModel", "clEventsCharts"],
"type": "service"
}, {
"name": "eventsTooltip",
"deps": ["$filter", "chartTooltip", "clColorMapping"],
"type": "service"
}, {
"name": "CLPipelineCtrl",
"deps": ["$scope", "clControlsModel", "clView", "tourService"],
"type": "controller"
}, {
"name": "clPipelineDrug",
"deps": ["$rootScope", "clChartModel"],
"type": "directive"
}, {
"name": "trialsSVGPatterns",
"deps": ["CONFIG"],
"type": "service"
}, {
"name": "azLandscapeAxisX",
"deps": ["clEventsCharts"],
"type": "directive"
}, {
"name": "azTrialsDrugChart",
"deps": ["$rootScope", "$parse", "clChartModel", "trialsSVGPatterns", "CONFIG", "$filter", "clTrialsTooltip", "util", "clEventsCharts"],
"type": "directive"
}, {
"name": "azTrialsDrugLabel",
"deps": ["$parse", "$filter", "clColorMapping", "clControlsModel"],
"type": "directive"
}, {
"name": "azTrialsTable",
"deps": ["$window", "$rootScope", "$state", "$filter", "$timeout", "clControlsModel", "clEventsCharts", "trialsSVGPatterns", "clTrialsTooltip"],
"type": "directive"
}, {
"name": "ClTrialsCtrl",
"deps": ["$scope", "clControlsModel", "clView", "eventsForDrugs", "clEventsCharts"],
"type": "controller"
}, {
"name": "clTrialsTooltip",
"deps": ["$filter", "chartTooltip", "clColorMapping"],
"type": "service"
}, {
"name": "CompetitiveLandscapeCtrl",
"deps": ["$scope", "$log", "productName", "clChartModel", "clControlsModel", "clColorMapping"],
"type": "controller"
}, {
"name": "clView",
"deps": ["apiService", "clChartModel", "clControlsModel", "$rootScope", "$timeout"],
"type": "service"
}, {
"name": "clColorMapping",
"deps": ["CONFIG"],
"type": "service"
}, {
"name": "clControlsModel",
"deps": ["$state", "CONFIG", "ORDERING", "clColorMapping", "location"],
"type": "service"
}, {
"name": "clControlsTab",
"deps": ["$state"],
"type": "directive"
}, {
"name": "clControls",
"deps": ["$rootScope", "CONFIG", "clColorMapping", "$state", "util", "location", "clControlsModel", "clControlsEventsFilter", "regexp", "clView", "FEATURES"],
"type": "directive"
}, {
"name": "visSlider",
"deps": ["$stateParams", "$state"],
"type": "directive"
}, {
"name": "ProductContext",
"deps": ["apiService", "$window", "$location"],
"type": "service"
}, {
"name": "ContextCtrl",
"deps": ["$scope", "$state", "$timeout", "$stateParams", "$rootScope", "ProductContext", "apiService", "CONFIG"],
"type": "controller"
}, {
"name": "dev",
"deps": ["$rootScope", "$window", "$q", "currentEnvironment"],
"type": "service"
}, {
"name": "PlaygroundCtrl",
"deps": [],
"type": "controller"
}, {
"name": "dfChartExportAnalystController",
"deps": ["$scope"],
"type": "controller"
}, {
"name": "dfChartExport",
"deps": ["$window", "$state", "$filter", "$compile", "$timeout", "apiService", "dfChartManager"],
"type": "directive"
}, {
"name": "dfChartManager",
"deps": ["$stateParams", "$filter", "chartTooltip"],
"type": "service"
}, {
"name": "dfChart",
"deps": ["$window", "$state", "$filter", "dfChartManager"],
"type": "directive"
}, {
"name": "ColorMapping",
"deps": [],
"type": "service"
}, {
"name": "dfAnalystControls",
"deps": ["ColorMapping", "dfUtils"],
"type": "directive"
}, {
"name": "dfCompetitorControls",
"deps": ["ColorMapping", "dfUtils"],
"type": "directive"
}, {
"name": "dfControls",
"type": "directive"
}, {
"name": "dfExportButton",
"deps": [],
"type": "directive"
}, {
"name": "dfRegionControls",
"deps": ["ColorMapping", "dfUtils"],
"type": "directive"
}, {
"name": "dfResetButton",
"deps": [],
"type": "directive"
}, {
"name": "dfControlsModel",
"type": "service"
}, {
"name": "ForecastsCtrl",
"deps": ["$scope", "$state", "$stateParams", "$filter", "$window", "$timeout", "apiService", "forecasts", "competitors", "dfControlsModel", "dfGraphModel", "product", "isExport", "dfUtils", "tourService", "ProductContext", "dev"],
"type": "controller"
}, {
"name": "dfGraphModel",
"type": "service"
}, {
"name": "dfUtils",
"deps": [],
"type": "service"
}, {
"name": "faceting",
"type": "service"
}, {
"name": "queries",
"deps": ["ColorMapping"],
"type": "service"
}, {
"name": "DFCSVExport",
"deps": ["$filter"],
"type": "service"
}, {
"name": "dfTable",
"deps": ["$state", "$filter", "DFCSVExport"],
"type": "directive"
}, {
"name": "azDrugSummaryTable",
"deps": ["$window", "$rootScope", "$state", "$filter", "$timeout", "clControlsModel", "clEventsCharts", "trialsSVGPatterns", "clControlsEventsFilter"],
"type": "directive"
}, {
"name": "dsChart",
"deps": [],
"type": "directive"
}, {
"name": "DrugSummaryCtrl",
"deps": ["$scope", "$modal", "apiService", "ProductContext", "drugDetails", "$sce", "clEventsCharts", "HtmlHelper", "events", "tourService"],
"type": "controller"
}, {
"name": "ngFocus",
"deps": ["$timeout"],
"type": "directive"
}, {
"name": "checkbox",
"deps": ["$timeout"],
"type": "directive"
}, {
"name": "radio",
"type": "directive"
}, {
"name": "toggle",
"type": "directive"
}, {
"name": "HomeCtrl",
"deps": ["$scope", "$state", "$timeout", "apiService", "ProductContext", "tourService"],
"type": "controller"
}, {
"name": "InfoCtrl",
"deps": ["$scope", "$window", "tourService"],
"type": "controller"
}, {
"name": "newsCategoriesMeta",
"deps": [],
"type": "service"
}, {
"name": "nfCategoriesControls",
"deps": ["$location", "$anchorScroll", "newsCategoriesMeta"],
"type": "directive"
}, {
"name": "nfDateRangeControls",
"deps": ["$location", "nfControlsModel"],
"type": "directive"
}, {
"name": "nfControlsModel",
"deps": [],
"type": "service"
}, {
"name": "nfRefineSearch",
"deps": [],
"type": "directive"
}, {
"name": "newsFlowCategoryReplace",
"deps": [],
"type": "filter"
}, {
"name": "NewsFlowCtrl",
"deps": ["$log", "$scope", "nfControlsModel", "newsData", "ProductContext", "newsCategoriesMeta", "tourService"],
"type": "controller"
}, {
"name": "analystName",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "brokerId",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "chartTooltip",
"deps": ["$window"],
"type": "service"
}, {
"name": "collapsible",
"deps": [],
"type": "directive"
}, {
"name": "companyName",
"deps": [],
"type": "filter"
}, {
"name": "companyOriginator",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "cssClass",
"deps": [],
"type": "filter"
}, {
"name": "azCheckboxContainer",
"deps": ["$parse"],
"type": "directive"
}, {
"name": "azCompanySymbol",
"deps": ["clColorMapping", "$parse"],
"type": "directive"
}, {
"name": "azDrawer",
"deps": [],
"type": "directive"
}, {
"name": "azPositionBelow",
"deps": [],
"type": "directive"
}, {
"name": "azShowHistoricEvents",
"deps": ["clControlsEventsFilter", "clEventsCharts", "$rootScope"],
"type": "directive"
}, {
"name": "azSvgImg",
"deps": ["$parse"],
"type": "directive"
}, {
"name": "azSvgPatterns",
"deps": ["trialsSVGPatterns"],
"type": "directive"
}, {
"name": "azSyncScrollChild",
"deps": [],
"type": "directive"
}, {
"name": "azSyncScroll",
"deps": ["$timeout"],
"type": "directive"
}, {
"name": "selectAll",
"deps": ["$parse"],
"type": "directive"
}, {
"name": "drugName",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "groupTitle",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "HtmlHelper",
"deps": [],
"type": "service"
}, {
"name": "indicationsList",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "location",
"deps": ["$state"],
"type": "service"
}, {
"name": "name",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "orderObjectBy",
"deps": [],
"type": "filter"
}, {
"name": "pluralize",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "rdSearchUrl",
"deps": ["CONFIG"],
"type": "filter"
}, {
"name": "regexp",
"type": "value"
}, {
"name": "regionName",
"deps": ["$filter"],
"type": "filter"
}, {
"name": "toArray",
"deps": [],
"type": "filter"
}, {
"name": "util",
"deps": ["CONFIG", "SVG_EVENTS", "$rootScope"],
"type": "service"
}, {
"name": "azTour",
"type": "directive"
}, {
"name": "tourService",
"deps": ["$cookies", "$cookieStore", "$location", "$state"],
"type": "service"
}]
}, {
"name": "ngAnimate",
"deps": ["ng"],
"components": [{
"name": "ngAnimateChildren",
"deps": [],
"type": "directive"
}, {
"name": "$$animateReflow",
"type": "service"
}]
}, {
"name": "ng",
"deps": ["ngLocale"],
"components": []
}, {
"name": "ngLocale",
"deps": [],
"components": [{
"name": "$locale",
"deps": [],
"type": "service"
}]
}, {
"name": "ngCookies",
"deps": ["ng"],
"components": [{
"name": "$cookies",
"type": "service"
}, {
"name": "$cookieStore",
"type": "service"
}]
}, {
"name": "az-ci-config",
"deps": [],
"components": [{
"name": "SVG_EVENTS",
"type": "constant"
}, {
"name": "ORDERING",
"type": "constant"
}, {
"name": "CONFIG",
"type": "constant"
}, {
"name": "FEATURES",
"type": "constant"
}, {
"name": "ENV_OPTIONS",
"type": "constant"
}, {
"name": "ENV_HOSTNAMES",
"type": "constant"
}, {
"name": "env",
"deps": ["$window", "ENV_OPTIONS", "currentEnvironment"],
"type": "service"
}, {
"name": "currentEnvironment",
"deps": ["ENV_HOSTNAMES"],
"type": "service"
}, {
"name": "DEBUG",
"deps": ["$window"],
"type": "service"
}]
}, {
"name": "ui.router",
"deps": ["ui.router.state"],
"components": []
}, {
"name": "ui.router.state",
"deps": ["ui.router.router", "ui.router.util"],
"components": [{
"name": "$stateParams",
"type": "value"
}, {
"name": "$state",
"deps": ["$urlRouterProvider", "$urlMatcherFactoryProvider", "$locationProvider"],
"type": "service"
}, {
"name": "$view",
"deps": [],
"type": "service"
}, {
"name": "$uiViewScroll",
"deps": [],
"type": "service"
}, {
"name": "uiView",
"deps": ["$state", "$injector", "$uiViewScroll"],
"type": "directive"
}, {
"name": "uiView",
"deps": ["$compile", "$controller", "$state"],
"type": "directive"
}, {
"name": "uiSref",
"deps": ["$state", "$timeout"],
"type": "directive"
}, {
"name": "uiSrefActive",
"deps": ["$state", "$stateParams", "$interpolate"],
"type": "directive"
}, {
"name": "isState",
"deps": ["$state"],
"type": "filter"
}, {
"name": "includedByState",
"deps": ["$state"],
"type": "filter"
}]
}, {
"name": "ui.router.router",
"deps": ["ui.router.util"],
"components": [{
"name": "$urlRouter",
"deps": ["$urlMatcherFactoryProvider"],
"type": "service"
}]
}, {
"name": "ui.router.util",
"deps": ["ng"],
"components": [{
"name": "$resolve",
"deps": ["$q", "$injector"],
"type": "service"
}, {
"name": "$templateFactory",
"deps": ["$http", "$templateCache", "$injector"],
"type": "service"
}, {
"name": "$urlMatcherFactory",
"deps": [],
"type": "service"
}]
}, {
"name": "angular-data.DSCacheFactory",
"deps": ["ng", "angular-data.DSBinaryHeap"],
"components": [{
"name": "DSCacheFactory",
"deps": [],
"type": "service"
}]
}, {
"name": "angular-data.DSBinaryHeap",
"deps": [],
"components": [{
"name": "DSBinaryHeap",
"deps": [],
"type": "service"
}]
}, {
"name": "duScroll",
"deps": ["duScroll.scrollspy", "duScroll.requestAnimation", "duScroll.smoothScroll", "duScroll.scrollContainer", "duScroll.scrollHelpers"],
"components": [{
"name": "duScrollDuration",
"type": "value"
}, {
"name": "duScrollGreedy",
"type": "value"
}, {
"name": "duScrollEasing",
"deps": ["x"],
"type": "value"
}]
}, {
"name": "duScroll.scrollspy",
"deps": ["duScroll.spyAPI"],
"components": [{
"name": "duScrollspy",
"type": "directive"
}]
}, {
"name": "duScroll.spyAPI",
"deps": ["duScroll.scrollContainerAPI"],
"components": [{
"name": "spyAPI",
"type": "service"
}]
}, {
"name": "duScroll.scrollContainerAPI",
"deps": [],
"components": [{
"name": "scrollContainerAPI",
"type": "service"
}]
}, {
"name": "duScroll.requestAnimation",
"deps": ["duScroll.polyfill"],
"components": [{
"name": "requestAnimation",
"type": "service"
}, {
"name": "cancelAnimation",
"type": "service"
}]
}, {
"name": "duScroll.polyfill",
"deps": [],
"components": [{
"name": "polyfill",
"type": "service"
}]
}, {
"name": "duScroll.smoothScroll",
"deps": ["duScroll.scrollHelpers", "duScroll.scrollContainerAPI"],
"components": [{
"name": "duSmoothScroll",
"type": "directive"
}]
}, {
"name": "duScroll.scrollHelpers",
"deps": [],
"components": []
}, {
"name": "duScroll.scrollContainer",
"deps": ["duScroll.scrollContainerAPI"],
"components": [{
"name": "duScrollContainer",
"type": "directive"
}]
}, {
"name": "ngDropdowns",
"deps": [],
"components": [{
"name": "dropdownSelect",
"type": "directive"
}, {
"name": "dropdownSelectItem",
"type": "directive"
}, {
"name": "dropdownMenu",
"type": "directive"
}, {
"name": "dropdownMenuItem",
"type": "directive"
}, {
"name": "DropdownService",
"type": "service"
}]
}, {
"name": "ui.bootstrap",
"deps": ["ui.bootstrap.tpls", "ui.bootstrap.transition", "ui.bootstrap.collapse", "ui.bootstrap.accordion", "ui.bootstrap.alert", "ui.bootstrap.bindHtml", "ui.bootstrap.buttons", "ui.bootstrap.carousel", "ui.bootstrap.dateparser", "ui.bootstrap.position", "ui.bootstrap.datepicker", "ui.bootstrap.dropdown", "ui.bootstrap.modal", "ui.bootstrap.pagination", "ui.bootstrap.tooltip", "ui.bootstrap.popover", "ui.bootstrap.progressbar", "ui.bootstrap.rating", "ui.bootstrap.tabs", "ui.bootstrap.timepicker", "ui.bootstrap.typeahead"],
"components": []
}, {
"name": "ui.bootstrap.tpls",
"deps": ["template/accordion/accordion-group.html", "template/accordion/accordion.html", "template/alert/alert.html", "template/carousel/carousel.html", "template/carousel/slide.html", "template/datepicker/datepicker.html", "template/datepicker/day.html", "template/datepicker/month.html", "template/datepicker/popup.html", "template/datepicker/year.html", "template/modal/backdrop.html", "template/modal/window.html", "template/pagination/pager.html", "template/pagination/pagination.html", "template/tooltip/tooltip-html-unsafe-popup.html", "template/tooltip/tooltip-popup.html", "template/popover/popover.html", "template/progressbar/bar.html", "template/progressbar/progress.html", "template/progressbar/progressbar.html", "template/rating/rating.html", "template/tabs/tab.html", "template/tabs/tabset.html", "template/timepicker/timepicker.html", "template/typeahead/typeahead-match.html", "template/typeahead/typeahead-popup.html"],
"components": []
}, {
"name": "template/accordion/accordion-group.html",
"deps": [],
"components": []
}, {
"name": "template/accordion/accordion.html",
"deps": [],
"components": []
}, {
"name": "template/alert/alert.html",
"deps": [],
"components": []
}, {
"name": "template/carousel/carousel.html",
"deps": [],
"components": []
}, {
"name": "template/carousel/slide.html",
"deps": [],
"components": []
}, {
"name": "template/datepicker/datepicker.html",
"deps": [],
"components": []
}, {
"name": "template/datepicker/day.html",
"deps": [],
"components": []
}, {
"name": "template/datepicker/month.html",
"deps": [],
"components": []
}, {
"name": "template/datepicker/popup.html",
"deps": [],
"components": []
}, {
"name": "template/datepicker/year.html",
"deps": [],
"components": []
}, {
"name": "template/modal/backdrop.html",
"deps": [],
"components": []
}, {
"name": "template/modal/window.html",
"deps": [],
"components": []
}, {
"name": "template/pagination/pager.html",
"deps": [],
"components": []
}, {
"name": "template/pagination/pagination.html",
"deps": [],
"components": []
}, {
"name": "template/tooltip/tooltip-html-unsafe-popup.html",
"deps": [],
"components": []
}, {
"name": "template/tooltip/tooltip-popup.html",
"deps": [],
"components": []
}, {
"name": "template/popover/popover.html",
"deps": [],
"components": []
}, {
"name": "template/progressbar/bar.html",
"deps": [],
"components": []
}, {
"name": "template/progressbar/progress.html",
"deps": [],
"components": []
}, {
"name": "template/progressbar/progressbar.html",
"deps": [],
"components": []
}, {
"name": "template/rating/rating.html",
"deps": [],
"components": []
}, {
"name": "template/tabs/tab.html",
"deps": [],
"components": []
}, {
"name": "template/tabs/tabset.html",
"deps": [],
"components": []
}, {
"name": "template/timepicker/timepicker.html",
"deps": [],
"components": []
}, {
"name": "template/typeahead/typeahead-match.html",
"deps": [],
"components": []
}, {
"name": "template/typeahead/typeahead-popup.html",
"deps": [],
"components": []
}, {
"name": "ui.bootstrap.transition",
"deps": [],
"components": [{
"name": "$transition",
"type": "service"
}]
}, {
"name": "ui.bootstrap.collapse",
"deps": ["ui.bootstrap.transition"],
"components": [{
"name": "collapse",
"type": "directive"
}]
}, {
"name": "ui.bootstrap.accordion",
"deps": ["ui.bootstrap.collapse"],
"components": [{
"name": "accordionConfig",
"type": "constant"
}, {
"name": "AccordionController",
"type": "controller"
}, {
"name": "accordion",
"deps": [],
"type": "directive"
}, {
"name": "accordionGroup",
"deps": [],
"type": "directive"
}, {
"name": "accordionHeading",
"deps": [],
"type": "directive"
}, {
"name": "accordionTransclude",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.alert",
"deps": [],
"components": [{
"name": "AlertController",
"type": "controller"
}, {
"name": "alert",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.bindHtml",
"deps": [],
"components": [{
"name": "bindHtmlUnsafe",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.buttons",
"deps": [],
"components": [{
"name": "buttonConfig",
"type": "constant"
}, {
"name": "ButtonsController",
"type": "controller"
}, {
"name": "btnRadio",
"deps": [],
"type": "directive"
}, {
"name": "btnCheckbox",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.carousel",
"deps": ["ui.bootstrap.transition"],
"components": [{
"name": "CarouselController",
"type": "controller"
}, {
"name": "carousel",
"type": "directive"
}, {
"name": "slide",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.dateparser",
"deps": [],
"components": [{
"name": "dateParser",
"type": "service"
}]
}, {
"name": "ui.bootstrap.position",
"deps": [],
"components": [{
"name": "$position",
"type": "service"
}]
}, {
"name": "ui.bootstrap.datepicker",
"deps": ["ui.bootstrap.dateparser", "ui.bootstrap.position"],
"components": [{
"name": "datepickerPopupConfig",
"type": "constant"
}, {
"name": "datepickerConfig",
"type": "constant"
}, {
"name": "DatepickerController",
"type": "controller"
}, {
"name": "datepicker",
"deps": [],
"type": "directive"
}, {
"name": "daypicker",
"type": "directive"
}, {
"name": "monthpicker",
"type": "directive"
}, {
"name": "yearpicker",
"type": "directive"
}, {
"name": "datepickerPopup",
"type": "directive"
}, {
"name": "datepickerPopupWrap",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.dropdown",
"deps": [],
"components": [{
"name": "dropdownConfig",
"type": "constant"
}, {
"name": "dropdownService",
"type": "service"
}, {
"name": "DropdownController",
"type": "controller"
}, {
"name": "dropdown",
"deps": [],
"type": "directive"
}, {
"name": "dropdownToggle",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.modal",
"deps": ["ui.bootstrap.transition"],
"components": [{
"name": "$$stackedMap",
"deps": [],
"type": "service"
}, {
"name": "modalBackdrop",
"type": "directive"
}, {
"name": "modalWindow",
"type": "directive"
}, {
"name": "$modalStack",
"type": "service"
}, {
"name": "$modal",
"deps": [],
"type": "service"
}]
}, {
"name": "ui.bootstrap.pagination",
"deps": [],
"components": [{
"name": "pagerConfig",
"type": "constant"
}, {
"name": "paginationConfig",
"type": "constant"
}, {
"name": "PaginationController",
"type": "controller"
}, {
"name": "pagination",
"type": "directive"
}, {
"name": "pager",
"type": "directive"
}]
}, {
"name": "ui.bootstrap.tooltip",
"deps": ["ui.bootstrap.position", "ui.bootstrap.bindHtml"],
"components": [{
"name": "$tooltip",
"deps": [],
"type": "service"
}, {
"name": "tooltipPopup",
"deps": [],
"type": "directive"
}, {
"name": "tooltip",
"type": "directive"
}, {
"name": "tooltipHtmlUnsafePopup",
"deps": [],
"type": "directive"
}, {
"name": "tooltipHtmlUnsafe",
"type": "directive"
}]
}, {
"name": "ui.bootstrap.popover",
"deps": ["ui.bootstrap.tooltip"],
"components": [{
"name": "popoverPopup",
"deps": [],
"type": "directive"
}, {
"name": "popover",
"type": "directive"
}]
}, {
"name": "ui.bootstrap.progressbar",
"deps": [],
"components": [{
"name": "progressConfig",
"type": "constant"
}, {
"name": "ProgressController",
"type": "controller"
}, {
"name": "progress",
"deps": [],
"type": "directive"
}, {
"name": "bar",
"deps": [],
"type": "directive"
}, {
"name": "progressbar",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.rating",
"deps": [],
"components": [{
"name": "ratingConfig",
"type": "constant"
}, {
"name": "RatingController",
"type": "controller"
}, {
"name": "rating",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.tabs",
"deps": [],
"components": [{
"name": "TabsetController",
"type": "controller"
}, {
"name": "tabset",
"deps": [],
"type": "directive"
}, {
"name": "tab",
"type": "directive"
}, {
"name": "tabHeadingTransclude",
"type": "directive"
}, {
"name": "tabContentTransclude",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.timepicker",
"deps": [],
"components": [{
"name": "timepickerConfig",
"type": "constant"
}, {
"name": "TimepickerController",
"type": "controller"
}, {
"name": "timepicker",
"deps": [],
"type": "directive"
}]
}, {
"name": "ui.bootstrap.typeahead",
"deps": ["ui.bootstrap.position", "ui.bootstrap.bindHtml"],
"components": [{
"name": "typeaheadParser",
"type": "service"
}, {
"name": "typeahead",
"type": "directive"
}, {
"name": "typeaheadPopup",
"deps": [],
"type": "directive"
}, {
"name": "typeaheadMatch",
"type": "directive"
}, {
"name": "typeaheadHighlight",
"deps": [],
"type": "filter"
}]
}]
};
|
const Button = ({
passwordFocus,
passwordBlur,
togglePassword,
visibility,
}) => (
<button
className="toggle-password__container"
onFocus={passwordFocus}
onBlur={passwordBlur}
onClick={togglePassword}
>
<span className="password--toggler">
{visibility ? (
<i className="far fa-eye"></i>
) : (
<i className="far fa-eye-slash"></i>
)}
</span>
</button>
);
export default Button;
|
import mongoose from 'mongoose';
import supertest from 'supertest-as-promised';
import app from '../bootstrap';
require('should');
const request = supertest(app.server());
mongoose.Promise = Promise;
global.config = app.config;
global.request = request;
global.supertest = supertest;
global._ = require('underscore');
global.Q = require('q');
global.db = require('./utils/db');
|
// @flow
export const CommentType = {
COMMIT: 'commits',
ISSUES: 'issues',
PULL_REQUEST: 'pull',
};
export const NotificationSubjectTypes = {
COMMIT: 'Commit',
ISSUE: 'Issue',
PULL_REQUEST: 'PullRequest',
};
export const NotificationReasonTypes = {
ASSIGN: 'assign',
AUTHOR: 'author',
COMMENT: 'comment',
INVITATION: 'invitation',
MANUAL: 'manual',
MENTION: 'mention',
STATE_CHANGE: 'state_change',
SUBSCRIBED: 'subscribed',
TEAM_MENTION: 'team_mention',
};
export const SubjectTypeDisplayNames = {
[NotificationSubjectTypes.COMMIT]: 'Commit',
[NotificationSubjectTypes.ISSUE]: 'Issue',
[NotificationSubjectTypes.PULL_REQUEST]: 'Pull Request',
};
export const SubjectTypeUrlString = {
[NotificationSubjectTypes.COMMIT]: 'commit',
[NotificationSubjectTypes.ISSUE]: 'issues',
[NotificationSubjectTypes.PULL_REQUEST]: 'pull',
};
export const STORE_TIME_INTERVAL = 5000;
export const MAX_MESSAGE_LENGTH = 1000;
|
'use strict';
const marsGo = require('..');
describe('mars-go', () => {
it('needs tests');
});
|
export { default } from "./NewTaskForm";
|
import React from 'react';
import { Button, Col, Input, Row } from 'antd';
import ImgUpload from './ImgUpload';
import { useHistory, withRouter } from 'react-router-dom';
import CreateForm from './CreateForm';
import CreateFormItem from './CreateFormItem';
import SelectCategory from './SelectCategory';
import { useSelector } from 'react-redux';
import Api from '../../util/Api';
const { TextArea } = Input;
const tailFormItemLayout = {
wrapperCol: {
xs: {
span: 10,
offset: 5,
},
sm: {
span: 20,
offset: 19,
},
},
};
const deleteItemLayout = {
wrapperCol: {
xs: {
span: 10,
offset: 5,
},
sm: {
span: 12,
offset: 8,
},
},
};
const InfoSetting = (props) => {
const user = useSelector((state) => state.user);
const repository = useSelector((state) => state.repository);
const history = useHistory();
const onClick = () => {
// eslint-disable-next-line no-restricted-globals
if (confirm('정말 삭제하시겠습니까?')) {
Api.post(`/repositories/${props.repositoryInfo.id}/delete`)
.then((response) => {
history.push('/main');
})
.catch((error) => {
console.log(error);
});
}
};
const initialValues = {
name: props.repositoryInfo.name,
description: props.repositoryInfo.description,
categories: props.repositoryInfo.categories,
oneWord: props.repositoryInfo.oneWord,
thumbnail: props.repositoryInfo.thumbnail,
};
return (
<Row style={{ textAlign: 'center' }}>
<Col span={5}></Col>
<Col span={14}>
<CreateForm
formName="modify"
repository={repository}
user={user}
repositoryInfo={props.repositoryInfo}
initialValues={initialValues}
>
<Row>
<Col span={14}>
<CreateFormItem label="지도 이름" name="name">
<Input />
</CreateFormItem>
<CreateFormItem label="설명" name="description">
<TextArea rows={10} />
</CreateFormItem>
<CreateFormItem label="카테고리" name="categories">
<SelectCategory categories={repository.categories} />
</CreateFormItem>
<CreateFormItem label="Owner의 한마디" name="oneWord">
<TextArea showCount maxLength={20} />
</CreateFormItem>
<CreateFormItem wrapperCol={tailFormItemLayout}>
<Button type="primary" htmlType="submit" style={{ marginTop: '20px' }}>
정보 수정
</Button>
</CreateFormItem>
</Col>
<Col span={10}>
<CreateFormItem label="썸네일" name="thumbnail">
<div id="create-map-upload">
<ImgUpload />
</div>
</CreateFormItem>
<CreateFormItem wrapperCol={deleteItemLayout}>
<Button
type="primary"
onClick={onClick}
style={{ marginTop: '20px', width: '100%' }}
danger
>
지도 삭제
</Button>
</CreateFormItem>
</Col>
</Row>
</CreateForm>
</Col>
<Col span={5}></Col>
</Row>
);
};
export default withRouter(InfoSetting);
|
require('../styles.css');
|
import React, { Component } from 'react';
import { Alert } from 'react-native';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import Config from 'react-native-config';
import get from 'lodash/get';
//Contstants
import AUTH_TYPE from '../../../constants/authType';
// Actions & Services
import { navigate } from '../../../navigation/service';
import {
setUserDataWithPinCode,
verifyPinCode,
updatePinCode,
migrateToMasterKeyWithAccessToken,
refreshSCToken,
} from '../../../providers/hive/auth';
import {
closePinCodeModal,
isPinCodeOpen,
login,
logout,
logoutDone,
setPinCode as savePinCode,
} from '../../../redux/actions/applicationActions';
import {
getExistUser,
setExistUser,
getUserDataWithUsername,
removeAllUserData,
removePinCode,
setAuthStatus,
setPinCodeOpen,
} from '../../../realm/realm';
import { updateCurrentAccount, removeOtherAccount } from '../../../redux/actions/accountAction';
import { getDigitPinCode, getMutes, getUser } from '../../../providers/hive/dhive';
import { getPointsSummary } from '../../../providers/ecency/ePoint';
// Utils
import { encryptKey, decryptKey } from '../../../utils/crypto';
// Component
import PinCodeScreen from '../screen/pinCodeScreen';
import { getUnreadNotificationCount } from '../../../providers/ecency/ecency';
import { fetchSubscribedCommunities } from '../../../redux/actions/communitiesAction';
class PinCodeContainer extends Component {
constructor(props) {
super(props);
this.state = {
isExistUser: null,
informationText: '',
newPinCode: null,
isOldPinVerified: get(props.pinCodeParams, 'isOldPinVerified', false),
oldPinCode: get(props.pinCodeParams, 'oldPinCode', null),
failedAttempts: 0,
};
}
// TODO: if check for decide to set to pin or verify to pin page
// TODO: these text should move to view!
componentDidMount() {
this._getDataFromStorage().then(() => {
const { intl } = this.props;
const { isOldPinVerified } = this.state;
if (!isOldPinVerified) {
this.setState({
informationText: intl.formatMessage({
id: 'pincode.enter_text',
}),
});
} else {
this.setState({
informationText: intl.formatMessage({
id: 'pincode.set_new',
}),
});
}
});
}
_getDataFromStorage = () =>
new Promise((resolve) => {
getExistUser().then((isExistUser) => {
this.setState(
{
isExistUser,
},
resolve,
);
});
});
//this function updates realm with appropriate master key required for encyrption
//this function is important: must run while chaning pin
//and even logging in with existing pin code
_updatePinCodeRealm = async (pinData) => {
try {
const { currentAccount, dispatch } = this.props;
const response = await updatePinCode(pinData);
if (!response) {
return false;
}
const _currentAccount = currentAccount;
_currentAccount.local = response;
dispatch(updateCurrentAccount({ ..._currentAccount }));
return true;
} catch (err) {
this._onDecryptFail();
return false;
}
};
_resetPinCode = (pin) =>
new Promise((resolve, reject) => {
const {
currentAccount,
dispatch,
pinCodeParams: { navigateTo, navigateParams, accessToken, callback },
intl,
} = this.props;
const { isOldPinVerified, oldPinCode, newPinCode } = this.state;
const pinData = {
pinCode: pin,
password: currentAccount ? currentAccount.password : '',
username: currentAccount ? currentAccount.name : '',
accessToken,
oldPinCode,
};
//if old pin already verified, check new pin setup conditions.
if (isOldPinVerified) {
//if newPin already exist and pin is a valid pin, compare and set new pin
if (pin !== undefined && pin === newPinCode) {
this._updatePinCodeRealm(pinData).then((status) => {
if (!status) {
resolve();
return;
}
this._savePinCode(pin);
if (callback) {
callback(pin, oldPinCode);
}
dispatch(closePinCodeModal());
if (navigateTo) {
navigate({
routeName: navigateTo,
params: navigateParams,
});
}
resolve();
});
}
// if newPin code exists and above case failed, that means pins did not match
// warn user about it and do nothing
else if (newPinCode) {
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'pincode.pin_not_matched',
}),
);
resolve();
}
//if newPinCode do yet exist, save it in state and prompt user to reneter pin.
else {
this.setState({
informationText: intl.formatMessage({
id: 'pincode.write_again',
}),
newPinCode: pin,
});
resolve();
}
}
// if old pin code is not yet verified attempt to verify code
else {
verifyPinCode(pinData)
.then(() => {
this.setState({ isOldPinVerified: true });
this.setState({
informationText: intl.formatMessage({
id: 'pincode.set_new',
}),
newPinCode: null,
oldPinCode: pin,
});
resolve();
})
.catch((err) => {
console.warn('Failed to verify pin code', err);
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: err.message,
}),
);
reject(err);
});
}
});
_setFirstPinCode = (pin) =>
new Promise((resolve) => {
const {
currentAccount,
dispatch,
pinCodeParams: { navigateTo, navigateParams, accessToken, callback },
} = this.props;
const { oldPinCode } = this.state;
const pinData = {
pinCode: pin,
password: currentAccount ? currentAccount.password : '',
username: currentAccount ? currentAccount.name : '',
accessToken,
};
setUserDataWithPinCode(pinData).then((response) => {
getUser(currentAccount.name).then((user) => {
const _currentAccount = user;
_currentAccount.local = response;
dispatch(updateCurrentAccount({ ..._currentAccount }));
setExistUser(true).then(() => {
this._savePinCode(pin);
if (callback) {
callback(pin, oldPinCode);
}
dispatch(closePinCodeModal());
if (navigateTo) {
navigate({
routeName: navigateTo,
params: navigateParams,
});
}
resolve();
});
});
});
});
_onRefreshTokenFailed = (error) => {
setTimeout(() => {
const { dispatch, intl } = this.props;
const _logout = () => dispatch(logout());
Alert.alert(
intl.formatMessage({
id: 'alert.fail',
}),
error.message,
[
{ text: intl.formatMessage({ id: 'side_menu.logout' }), onPress: _logout },
{ text: intl.formatMessage({ id: 'alert.cancel' }), style: 'destructive' },
],
);
}, 300);
};
_verifyPinCode = (pin, { shouldUpdateRealm } = {}) =>
new Promise((resolve, reject) => {
const {
currentAccount,
dispatch,
pinCodeParams: { navigateTo, navigateParams, accessToken, callback },
} = this.props;
const { oldPinCode } = this.state;
// If the user is exist, we are just checking to pin and navigating to feed screen
const pinData = {
pinCode: pin,
password: currentAccount ? currentAccount.password : '',
username: currentAccount ? currentAccount.name : '',
accessToken,
};
verifyPinCode(pinData)
.then(() => {
this._savePinCode(pin);
getUserDataWithUsername(currentAccount.name).then(async (realmData) => {
if (shouldUpdateRealm) {
this._updatePinCodeRealm(pinData).then(() => {
dispatch(closePinCodeModal());
});
} else {
let _currentAccount = currentAccount;
_currentAccount.username = _currentAccount.name;
[_currentAccount.local] = realmData;
try {
const pinHash = encryptKey(pin, Config.PIN_KEY);
//migration script for previously mast key based logged in user not having access token
if (
realmData[0].authType !== AUTH_TYPE.STEEM_CONNECT &&
realmData[0].accessToken === ''
) {
_currentAccount = await migrateToMasterKeyWithAccessToken(
_currentAccount,
realmData[0],
pinHash,
);
}
//refresh access token
const encryptedAccessToken = await refreshSCToken(_currentAccount.local, pin);
_currentAccount.local.accessToken = encryptedAccessToken;
} catch (error) {
this._onRefreshTokenFailed(error);
}
//get unread notifications
try {
_currentAccount.unread_activity_count = await getUnreadNotificationCount();
_currentAccount.pointsSummary = await getPointsSummary(_currentAccount.username);
_currentAccount.mutes = await getMutes(_currentAccount.username);
} catch (err) {
console.warn(
'Optional user data fetch failed, account can still function without them',
err,
);
}
dispatch(updateCurrentAccount({ ..._currentAccount }));
dispatch(fetchSubscribedCommunities(_currentAccount.username));
dispatch(closePinCodeModal());
}
//on successful code verification run requested operation passed as props
if (callback) {
callback(pin, oldPinCode);
}
if (navigateTo) {
navigate({
routeName: navigateTo,
params: navigateParams,
});
}
resolve();
});
})
.catch((err) => {
console.warn('code verification for login failed: ', err);
reject(err);
});
});
_savePinCode = (pin) => {
const { dispatch } = this.props;
const encryptedPin = encryptKey(pin, Config.PIN_KEY);
dispatch(savePinCode(encryptedPin));
};
_forgotPinCode = async () => {
const { otherAccounts, dispatch } = this.props;
await removeAllUserData()
.then(async () => {
dispatch(updateCurrentAccount({}));
dispatch(login(false));
removePinCode();
setAuthStatus({ isLoggedIn: false });
setExistUser(false);
if (otherAccounts.length > 0) {
otherAccounts.map((item) => dispatch(removeOtherAccount(item.username)));
}
dispatch(logoutDone());
dispatch(closePinCodeModal());
dispatch(isPinCodeOpen(false));
setPinCodeOpen(false);
})
.catch((err) => {
console.warn('Failed to remove user data', err);
});
};
_handleFailedAttempt = (error) => {
console.warn('Failed to set pin: ', error);
const { intl } = this.props;
const { failedAttempts } = this.state;
//increment failed attempt
const totalAttempts = failedAttempts + 1;
if (totalAttempts < 3) {
//shwo failure alert box
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: error.message,
}),
);
let infoMessage = intl.formatMessage({
id: 'pincode.enter_text',
});
infoMessage += `, ${totalAttempts} ${intl.formatMessage({ id: 'pincode.attempts_postfix' })}`;
if (totalAttempts > 1) {
infoMessage += `\n${intl.formatMessage({ id: 'pincode.message_reset_warning' })}`;
}
this.setState({
failedAttempts: totalAttempts,
informationText: infoMessage,
});
return false;
} else {
//wipe user data
this._forgotPinCode();
return true;
}
};
_onDecryptFail = () => {
const { intl } = this.props;
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'alert.decrypt_fail_alert',
}),
[
{ text: intl.formatMessage({ id: 'alert.clear' }), onPress: () => this._forgotPinCode() },
{ text: intl.formatMessage({ id: 'alert.cancel' }), style: 'destructive' },
],
);
};
_setPinCode = async (pin, isReset) => {
const { intl, currentAccount, applicationPinCode } = this.props;
const { isExistUser } = this.state;
try {
const realmData = await getUserDataWithUsername(currentAccount.name);
const userData = realmData[0];
// check if reset routine is triggered by user, reroute code to reset hanlder
if (isReset) {
await this._resetPinCode(pin);
return true;
}
//user is logged in and is not reset routine...
if (isExistUser) {
if (!userData.accessToken && !userData.masterKey && applicationPinCode) {
const verifiedPin = decryptKey(applicationPinCode, Config.PIN_KEY, this._onDecryptFail);
if (verifiedPin === undefined) {
return true;
}
if (verifiedPin === pin) {
await this._setFirstPinCode(pin);
} else {
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'alert.invalid_pincode',
}),
);
}
} else {
await this._verifyPinCode(pin);
}
return true;
}
//means this is not reset routine and user do not exist
//only possible option left is user logging int,
//verifyPinCode then and update realm as well.
else {
await this._verifyPinCode(pin, { shouldUpdateRealm: true });
return true;
}
} catch (error) {
return this._handleFailedAttempt(error);
}
};
_handleForgotButton = () => {
const { intl } = this.props;
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'alert.clear_user_alert',
}),
[
{ text: intl.formatMessage({ id: 'alert.clear' }), onPress: () => this._forgotPinCode() },
{ text: intl.formatMessage({ id: 'alert.cancel' }), style: 'destructive' },
],
);
};
render() {
const {
currentAccount,
intl,
pinCodeParams: { isReset },
} = this.props;
const { informationText, isOldPinVerified, isExistUser } = this.state;
return (
<PinCodeScreen
informationText={informationText}
setPinCode={(pin) => this._setPinCode(pin, isReset)}
showForgotButton={!isOldPinVerified}
username={currentAccount.name}
intl={intl}
handleForgotButton={() => this._handleForgotButton()}
{...this.props}
/>
);
}
}
const mapStateToProps = (state) => ({
currentAccount: state.account.currentAccount,
applicationPinCode: state.application.pin,
otherAccounts: state.account.otherAccounts,
pinCodeParams: state.application.pinCodeNavigation,
});
export default injectIntl(connect(mapStateToProps)(PinCodeContainer));
|
import { query, queryAll, update, add, del } from '@/services/psbill';
export default {
namespace: 'psbill',
state: {
data: {
code : '00',
msg : '操作成功',
data : {
totalRow : 0,
pageNumber : 1,
firstPage : true,
lastPage : true,
totalPage : 1,
pageSize : 15,
list : [],
},
token : '',
},
},
effects: {
*fetch({ payload }, { call, put }) {
const response = yield call(query, payload);
yield put({
type: 'queryList',
payload: response,
});
},
*search({ payload }, { call, put }) {
const response = yield call(query, payload);
yield put({
type: 'queryList',
payload: response,
});
},
*queryAll({ payload }, { call, put }) {
const response = yield call(queryAll, payload);
yield put({
type: 'querySelect',
payload: response,
});
},
*add({ payload, callback }, { call, put }) {
const response = yield call(add, payload);
if (callback && typeof callback === 'function') {
callback(response); // 返回结果
}
},
*update({ payload, callback }, { call, put }) {
const response = yield call(update, payload);
if (callback && typeof callback === 'function') {
callback(response); // 返回结果
}
},
*del({ payload, callback }, { call, put }) {
const response = yield call(del, payload);
if (callback && typeof callback === 'function') {
callback(response); // 返回结果
}
},
},
reducers: {
queryList(state, action) {
if(action.payload == undefined) {
return {
...state
}
} else {
return {
...state,
data: action.payload,
};
}
},
querySelect(state, action) {
return {
...state,
selectData: action.payload,
};
}
},
};
|
import React from 'react'
function trial() {
return (
<div>
</div>
)
}
export default trial
|
export const BEFORE_FETCH = '@@breezy/BEFORE_FETCH'
export const SAVE_RESPONSE = '@@breezy/SAVE_RESPONSE'
export const HANDLE_GRAFT = '@@breezy/HANDLE_GRAFT'
export const CLEAR_FLASH = '@@breezy/CLEAR_FLASH'
export const BREEZY_ERROR = '@@breezy/ERROR'
export const GRAFTING_ERROR = '@@breezy/GRAFTING_ERROR'
export const GRAFTING_SUCCESS = '@@breezy/GRAFTING_SUCCESS'
export const HISTORY_CHANGE = '@@breezy/HISTORY_CHANGE'
export const SET_CSRF_TOKEN = '@@breezy/SET_CSRF_TOKEN'
export const REMOVE_PAGE = '@@breezy/REMOVE_PAGE'
export const COPY_PAGE = '@@breezy/COPY_PAGE'
export const UPDATE_FRAGMENTS = '@@breezy/UPDATE_FRAGMENTS'
|
'use strict';
// 文件不存在,分析不了具体做什么
const fs = require('fs');
const path = require('path');
const algoliasearch = require('algoliasearch');
const slugify = require('transliteration').slugify;
// 不存在该文件
const key = require('./algolia-key');
const client = algoliasearch('4C63BTGP6S', key);
const langs = {
'zh-CN': 'element-zh',
'en-US': 'element-en',
'es': 'element-es',
'fr-FR': 'element-fr'
};
['zh-CN', 'en-US', 'es', 'fr-FR'].forEach(lang => {
const indexName = langs[lang];
const index = client.initIndex(indexName);
index.clearIndex(err => {
if (err) return;
fs.readdir(path.resolve(__dirname, `../../examples/docs/${ lang }`), (err, files) => {
if (err) return;
let indices = [];
files.forEach(file => {
const component = file.replace('.md', '');
const content = fs.readFileSync(path.resolve(__dirname, `../../examples/docs/${ lang }/${ file }`), 'utf8');
const matches = content
.replace(/:::[\s\S]*?:::/g, '')
.replace(/```[\s\S]*?```/g, '')
.match(/#{2,4}[^#]*/g)
.map(match => match.replace(/\n+/g, '\n').split('\n').filter(part => !!part))
.map(match => {
const length = match.length;
if (length > 2) {
const desc = match.slice(1, length).join('');
return [match[0], desc];
}
return match;
});
indices = indices.concat(matches.map(match => {
const isComponent = match[0].indexOf('###') < 0;
const title = match[0].replace(/#{2,4}/, '').trim();
const index = { component, title };
index.ranking = isComponent ? 2 : 1;
index.anchor = slugify(title);
index.content = (match[1] || title).replace(/<[^>]+>/g, '');
return index;
}));
});
index.addObjects(indices, (err, res) => {
console.log(err, res);
});
});
});
});
|
// @flow
import React, { Component } from 'react';
import { withTranslation } from 'react-i18next';
import { Button, Header, Icon } from 'semantic-ui-react';
class PromptActionBroadcast extends Component<Props> {
render() {
const {
disabled,
loading,
onClick,
t,
} = this.props;
return (
<Button
content={(
<Header
style={{ color: '#ececec' }}
textAlign="left"
>
<Icon name="redo" />
<Header.Content>
{t('handler_recreate_header')}
<Header.Subheader style={{ color: '#ececec', fontWeight: 'bold' }}>
{t('handler_action_recreate_subheader')}
</Header.Subheader>
</Header.Content>
</Header>
)}
color="orange"
disabled={disabled}
floated="right"
loading={loading}
onClick={onClick}
/>
);
}
}
export default withTranslation('handler')(PromptActionBroadcast);
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT-0
const AWS = require('aws-sdk');
const PATH = require('path');
const CRYPTO = require('crypto');
const {
States,
mxBaseState,
ServiceToken,
} = require('core-lib');
const BuiltInTypes = require('./builtInTaskTypes');
const TASK_LIFETIME_IN_SECONDS = 24 * 3 * 3600;
const TASK_TIMEOUT_IN_SECONDS = 3 * 3600;
class StateStartLabelingJob extends mxBaseState(class {}) {
async process() {
const output = await this.startLabelingJob();
this.setOutput(States.StartLabelingJob, output);
await this.registerToken();
return super.process();
}
async startLabelingJob() {
const src = this.input;
const id = CRYPTO.randomBytes(16).toString('hex');
const prevState = this.output[States.PrepareLabelingJob].output;
const labelingJobName = `${src.projectName}-${id}`;
const params = (src.trainingType === 'concept')
? this.makeImageClassificationParams(labelingJobName, prevState)
: this.makeVideoObjectDetectionParams(labelingJobName, prevState);
const sagemaker = new AWS.SageMaker({
apiVersion: '2017-07-24',
});
const response = await sagemaker.createLabelingJob(params).promise()
.catch((e) => {
console.error(e);
throw e;
});
return {
jobId: response.LabelingJobArn,
};
}
makeVideoObjectDetectionParams(labelingJobName, data) {
const prefix = PATH.join(this.input.projectName, States.StartLabelingJob);
const labelAttributeName = 'bounding-box-ref';
const workteamArn = process.env.ENV_WORKTEAM_ARN;
const labelWorkerRoleArn = process.env.ENV_LABELING_WORKER_ROLE_ARN;
const manifestS3Uri = `s3://${data.bucket}/${data.datasetManifest.key}`;
const s3OutputPath = `s3://${data.bucket}/${prefix}/`;
const labelCategoryConfigS3Uri = `s3://${data.bucket}/${data.labelCategoryConfig.key}`;
const annotationConsolidationLambdaArn =
BuiltInTypes.AnnotationConsolidation.VideoObjectDetection[process.env.AWS_REGION];
const preHumanTaskLambdaArn =
BuiltInTypes.PreHumanTask.VideoObjectDetection[process.env.AWS_REGION];
const humanTaskUiArn =
BuiltInTypes.HumanTaskUi.VideoObjectDetection[process.env.AWS_REGION];
const params = {
HumanTaskConfig: {
AnnotationConsolidationConfig: {
AnnotationConsolidationLambdaArn: annotationConsolidationLambdaArn,
},
UiConfig: {
HumanTaskUiArn: humanTaskUiArn,
},
NumberOfHumanWorkersPerDataObject: 1,
PreHumanTaskLambdaArn: preHumanTaskLambdaArn,
TaskDescription: 'Video frame object detection',
// TODO: make sure the role also set the 'Maximum session duration'
TaskTimeLimitInSeconds: TASK_TIMEOUT_IN_SECONDS,
TaskTitle: 'Detect objects in video frames: Draw bounding box around the objects',
WorkteamArn: workteamArn,
MaxConcurrentTaskCount: 1000,
TaskAvailabilityLifetimeInSeconds: TASK_LIFETIME_IN_SECONDS,
TaskKeywords: [
'video',
'detection',
],
},
InputConfig: {
DataSource: {
S3DataSource: {
ManifestS3Uri: manifestS3Uri,
},
},
DataAttributes: {
ContentClassifiers: [],
},
},
LabelAttributeName: labelAttributeName,
LabelingJobName: labelingJobName,
OutputConfig: {
S3OutputPath: s3OutputPath,
},
RoleArn: labelWorkerRoleArn,
LabelCategoryConfigS3Uri: labelCategoryConfigS3Uri,
StoppingConditions: {
MaxPercentageOfInputDatasetLabeled: 100,
},
Tags: [],
};
return params;
}
makeImageClassificationParams(labelingJobName, data) {
const prefix = PATH.join(this.input.projectName, States.StartLabelingJob);
const labelAttributeName = 'image-classification';
const workteamArn = process.env.ENV_WORKTEAM_ARN;
const labelWorkerRoleArn = process.env.ENV_LABELING_WORKER_ROLE_ARN;
const manifestS3Uri = `s3://${data.bucket}/${data.datasetManifest.key}`;
const s3OutputPath = `s3://${data.bucket}/${prefix}/`;
const labelCategoryConfigS3Uri = `s3://${data.bucket}/${data.labelCategoryConfig.key}`;
const annotationConsolidationLambdaArn =
BuiltInTypes.AnnotationConsolidation.ImageClassification[process.env.AWS_REGION];
const preHumanTaskLambdaArn =
BuiltInTypes.PreHumanTask.ImageClassification[process.env.AWS_REGION];
const uiTemplateS3Uri = `s3://${data.bucket}/${data.uiTemplate.key}`;
const params = {
HumanTaskConfig: {
AnnotationConsolidationConfig: {
AnnotationConsolidationLambdaArn: annotationConsolidationLambdaArn,
},
UiConfig: {
UiTemplateS3Uri: uiTemplateS3Uri,
},
NumberOfHumanWorkersPerDataObject: 1,
PreHumanTaskLambdaArn: preHumanTaskLambdaArn,
TaskDescription: 'Categorize images into specific classes',
// TODO: make sure the role also set the 'Maximum session duration'
TaskTimeLimitInSeconds: TASK_TIMEOUT_IN_SECONDS,
TaskTitle: 'Single Label Image Classification: Select a label best represents the images',
WorkteamArn: workteamArn,
MaxConcurrentTaskCount: 1000,
TaskAvailabilityLifetimeInSeconds: TASK_LIFETIME_IN_SECONDS,
TaskKeywords: [
'images',
'categorization',
'classification',
],
},
InputConfig: {
DataSource: {
S3DataSource: {
ManifestS3Uri: manifestS3Uri,
},
},
DataAttributes: {
ContentClassifiers: [],
},
},
LabelAttributeName: labelAttributeName,
LabelingJobName: labelingJobName,
OutputConfig: {
S3OutputPath: s3OutputPath,
},
RoleArn: labelWorkerRoleArn,
LabelCategoryConfigS3Uri: labelCategoryConfigS3Uri,
StoppingConditions: {
MaxPercentageOfInputDatasetLabeled: 100,
},
Tags: [],
};
return params;
}
async registerToken() {
return ServiceToken.register(
this.output[States.StartLabelingJob].jobId,
this.event.token,
'sagemaker',
States.StartLabelingJob,
this.toJSON(),
4 // 4 days
);
}
}
module.exports = StateStartLabelingJob;
|
/**
* echarts组件: 类目轴
*
* @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。
* @author Kener (@Kener-林峰, linzhifeng@baidu.com)
*
*/
define(function (require) {
var Base = require('./base');
// 图形依赖
var TextShape = require('zrender/shape/Text');
var LineShape = require('zrender/shape/Line');
var RectangleShape = require('zrender/shape/Rectangle');
var ecConfig = require('../config');
var zrUtil = require('zrender/tool/util');
var zrArea = require('zrender/tool/area');
/**
* 构造函数
* @param {Object} messageCenter echart消息中心
* @param {ZRender} zr zrender实例
* @param {Object} option 类目轴参数
* @param {Grid} component 组件
*/
function CategoryAxis(ecTheme, messageCenter, zr, option, myChart, axisBase) {
if (option.data.length < 1) {
console.error('option.data.length < 1.');
return;
}
Base.call(this, ecTheme, messageCenter, zr, option, myChart);
this.grid = this.component.grid;
for (var method in axisBase) {
this[method] = axisBase[method];
}
this.refresh(option);
}
CategoryAxis.prototype = {
type : ecConfig.COMPONENT_TYPE_AXIS_CATEGORY,
_getReformedLabel : function (idx) {
var data = typeof this.option.data[idx].value != 'undefined'
? this.option.data[idx].value
: this.option.data[idx];
var formatter = this.option.data[idx].formatter
|| this.option.axisLabel.formatter;
if (formatter) {
if (typeof formatter == 'function') {
data = formatter.call(this.myChart, data);
}
else if (typeof formatter == 'string') {
data = formatter.replace('{value}', data);
}
}
return data;
},
/**
* 计算标签显示挑选间隔
*/
_getInterval : function () {
var interval = this.option.axisLabel.interval;
if (interval == 'auto') {
// 麻烦的自适应计算
var fontSize = this.option.axisLabel.textStyle.fontSize;
var data = this.option.data;
var dataLength = this.option.data.length;
if (this.isHorizontal()) {
// 横向
if (dataLength > 3) {
var gap = this.getGap();
var isEnough = false;
var labelSpace;
var labelSize;
var step = Math.floor(0.5 / gap);
step = step < 1 ? 1 : step;
interval = Math.floor(15 / gap);
while (!isEnough && interval < dataLength) {
interval += step;
isEnough = true;
labelSpace = Math.floor(gap * interval); // 标签左右至少间隔为3px
for (var i = Math.floor((dataLength - 1)/ interval) * interval;
i >= 0; i -= interval
) {
if (this.option.axisLabel.rotate !== 0) {
// 有旋转
labelSize = fontSize;
}
else if (data[i].textStyle) {
labelSize = zrArea.getTextWidth(
this._getReformedLabel(i),
this.getFont(
zrUtil.merge(
data[i].textStyle,
this.option.axisLabel.textStyle
)
)
);
}
else {
/*
labelSize = zrArea.getTextWidth(
this._getReformedLabel(i),
font
);
*/
// 不定义data级特殊文本样式,用fontSize优化getTextWidth
var label = this._getReformedLabel(i) + '';
var wLen = (label.match(/\w/g) || '').length;
var oLen = label.length - wLen;
labelSize = wLen * fontSize * 2 / 3 + oLen * fontSize;
}
if (labelSpace < labelSize) {
// 放不下,中断循环让interval++
isEnough = false;
break;
}
}
}
}
else {
// 少于3个则全部显示
interval = 1;
}
}
else {
// 纵向
if (dataLength > 3) {
var gap = this.getGap();
interval = Math.floor(11 / gap);
// 标签上下至少间隔为3px
while ((gap * interval - 6) < fontSize
&& interval < dataLength
) {
interval++;
}
}
else {
// 少于3个则全部显示
interval = 1;
}
}
}
else {
// 用户自定义间隔
interval = interval - 0 + 1;
}
return interval;
},
/**
* 绘制图形
*/
_buildShape : function () {
// 标签显示的挑选间隔
this._interval = this._getInterval();
this.option.splitArea.show && this._buildSplitArea();
this.option.splitLine.show && this._buildSplitLine();
this.option.axisLine.show && this._buildAxisLine();
this.option.axisTick.show && this._buildAxisTick();
this.option.axisLabel.show && this._buildAxisLabel();
for (var i = 0, l = this.shapeList.length; i < l; i++) {
this.zr.addShape(this.shapeList[i]);
}
},
// 小标记
_buildAxisTick : function () {
var axShape;
//var data = this.option.data;
var dataLength = this.option.data.length;
var tickOption = this.option.axisTick;
var length = tickOption.length;
var color = tickOption.lineStyle.color;
var lineWidth = tickOption.lineStyle.width;
var interval = tickOption.interval == 'auto'
? this._interval : (tickOption.interval - 0 + 1);
var onGap = tickOption.onGap;
var optGap = onGap
? (this.getGap() / 2)
: typeof onGap == 'undefined'
? (this.option.boundaryGap ? (this.getGap() / 2) : 0)
: 0;
var startIndex = optGap > 0 ? -interval : 0;
if (this.isHorizontal()) {
// 横向
var yPosition = this.option.position == 'bottom'
? (tickOption.inside
? (this.grid.getYend() - length - 1) : (this.grid.getYend() + 1))
: (tickOption.inside
? (this.grid.getY() + 1) : (this.grid.getY() - length - 1));
var x;
for (var i = startIndex; i < dataLength; i += interval) {
// 亚像素优化
x = this.subPixelOptimize(
this.getCoordByIndex(i) + (i >= 0 ? optGap : 0), lineWidth
);
axShape = {
_axisShape : 'axisTick',
zlevel : this._zlevelBase,
hoverable : false,
style : {
xStart : x,
yStart : yPosition,
xEnd : x,
yEnd : yPosition + length,
strokeColor : color,
lineWidth : lineWidth
}
};
this.shapeList.push(new LineShape(axShape));
}
}
else {
// 纵向
var xPosition = this.option.position == 'left'
? (tickOption.inside
? (this.grid.getX() + 1) : (this.grid.getX() - length - 1))
: (tickOption.inside
? (this.grid.getXend() - length - 1) : (this.grid.getXend() + 1));
var y;
for (var i = startIndex; i < dataLength; i += interval) {
// 亚像素优化
y = this.subPixelOptimize(
this.getCoordByIndex(i) - (i >= 0 ? optGap : 0), lineWidth
);
axShape = {
_axisShape : 'axisTick',
zlevel : this._zlevelBase,
hoverable : false,
style : {
xStart : xPosition,
yStart : y,
xEnd : xPosition + length,
yEnd : y,
strokeColor : color,
lineWidth : lineWidth
}
};
this.shapeList.push(new LineShape(axShape));
}
}
},
// 坐标轴文本
_buildAxisLabel : function () {
var axShape;
var data = this.option.data;
var dataLength = this.option.data.length;
var rotate = this.option.axisLabel.rotate;
var margin = this.option.axisLabel.margin;
var clickable = this.option.axisLabel.clickable;
var textStyle = this.option.axisLabel.textStyle;
var dataTextStyle;
if (this.isHorizontal()) {
// 横向
var yPosition;
var baseLine;
if (this.option.position == 'bottom') {
yPosition = this.grid.getYend() + margin;
baseLine = 'top';
}
else {
yPosition = this.grid.getY() - margin;
baseLine = 'bottom';
}
for (var i = 0; i < dataLength; i += this._interval) {
if (this._getReformedLabel(i) === '') {
// 空文本优化
continue;
}
dataTextStyle = zrUtil.merge(
data[i].textStyle || {},
textStyle
);
axShape = {
// shape : 'text',
zlevel : this._zlevelBase,
hoverable : false,
style : {
x : this.getCoordByIndex(i),
y : yPosition,
color : dataTextStyle.color,
text : this._getReformedLabel(i),
textFont : this.getFont(dataTextStyle),
textAlign : dataTextStyle.align || 'center',
textBaseline : dataTextStyle.baseline || baseLine
}
};
if (rotate) {
axShape.style.textAlign = rotate > 0
? (this.option.position == 'bottom'
? 'right' : 'left')
: (this.option.position == 'bottom'
? 'left' : 'right');
axShape.rotation = [
rotate * Math.PI / 180,
axShape.style.x,
axShape.style.y
];
}
this.shapeList.push(new TextShape(
this._axisLabelClickable(clickable, axShape)
));
}
}
else {
// 纵向
var xPosition;
var align;
if (this.option.position == 'left') {
xPosition = this.grid.getX() - margin;
align = 'right';
}
else {
xPosition = this.grid.getXend() + margin;
align = 'left';
}
for (var i = 0; i < dataLength; i += this._interval) {
if (this._getReformedLabel(i) === '') {
// 空文本优化
continue;
}
dataTextStyle = zrUtil.merge(
data[i].textStyle || {},
textStyle
);
axShape = {
// shape : 'text',
zlevel : this._zlevelBase,
hoverable : false,
style : {
x : xPosition,
y : this.getCoordByIndex(i),
color : dataTextStyle.color,
text : this._getReformedLabel(i),
textFont : this.getFont(dataTextStyle),
textAlign : dataTextStyle.align || align,
textBaseline : dataTextStyle.baseline
|| (i === 0 && this.option.name !== '')
? 'bottom'
: (i == (dataLength - 1)
&& this.option.name !== '')
? 'top'
: 'middle'
}
};
if (rotate) {
axShape.rotation = [
rotate * Math.PI / 180,
axShape.style.x,
axShape.style.y
];
}
this.shapeList.push(new TextShape(
this._axisLabelClickable(clickable, axShape)
));
}
}
},
_buildSplitLine : function () {
var axShape;
//var data = this.option.data;
var dataLength = this.option.data.length;
var sLineOption = this.option.splitLine;
var lineType = sLineOption.lineStyle.type;
var lineWidth = sLineOption.lineStyle.width;
var color = sLineOption.lineStyle.color;
color = color instanceof Array ? color : [color];
var colorLength = color.length;
var onGap = sLineOption.onGap;
var optGap = onGap
? (this.getGap() / 2)
: typeof onGap == 'undefined'
? (this.option.boundaryGap ? (this.getGap() / 2) : 0)
: 0;
dataLength -= (onGap || (typeof onGap == 'undefined' && this.option.boundaryGap))
? 1 : 0;
if (this.isHorizontal()) {
// 横向
var sy = this.grid.getY();
var ey = this.grid.getYend();
var x;
for (var i = 0; i < dataLength; i += this._interval) {
// 亚像素优化
x = this.subPixelOptimize(
this.getCoordByIndex(i) + optGap, lineWidth
);
axShape = {
// shape : 'line',
zlevel : this._zlevelBase,
hoverable : false,
style : {
xStart : x,
yStart : sy,
xEnd : x,
yEnd : ey,
strokeColor : color[(i / this._interval) % colorLength],
lineType : lineType,
lineWidth : lineWidth
}
};
this.shapeList.push(new LineShape(axShape));
}
}
else {
// 纵向
var sx = this.grid.getX();
var ex = this.grid.getXend();
var y;
for (var i = 0; i < dataLength; i += this._interval) {
// 亚像素优化
y = this.subPixelOptimize(
this.getCoordByIndex(i) - optGap, lineWidth
);
axShape = {
// shape : 'line',
zlevel : this._zlevelBase,
hoverable : false,
style : {
xStart : sx,
yStart : y,
xEnd : ex,
yEnd : y,
strokeColor : color[(i / this._interval) % colorLength],
linetype : lineType,
lineWidth : lineWidth
}
};
this.shapeList.push(new LineShape(axShape));
}
}
},
_buildSplitArea : function () {
var axShape;
var sAreaOption = this.option.splitArea;
var color = sAreaOption.areaStyle.color;
if (!(color instanceof Array)) {
// 非数组一律认为是单一颜色的字符串,单一颜色则用一个背景,颜色错误不负责啊!!!
axShape = {
// shape : 'rectangle',
zlevel : this._zlevelBase,
hoverable : false,
style : {
x : this.grid.getX(),
y : this.grid.getY(),
width : this.grid.getWidth(),
height : this.grid.getHeight(),
color : color
// type : this.option.splitArea.areaStyle.type,
}
};
this.shapeList.push(new RectangleShape(axShape));
}
else {
// 多颜色
var colorLength = color.length;
var dataLength = this.option.data.length;
var onGap = sAreaOption.onGap;
var optGap = onGap
? (this.getGap() / 2)
: typeof onGap == 'undefined'
? (this.option.boundaryGap ? (this.getGap() / 2) : 0)
: 0;
if (this.isHorizontal()) {
// 横向
var y = this.grid.getY();
var height = this.grid.getHeight();
var lastX = this.grid.getX();
var curX;
for (var i = 0; i <= dataLength; i += this._interval) {
curX = i < dataLength
? (this.getCoordByIndex(i) + optGap)
: this.grid.getXend();
axShape = {
// shape : 'rectangle',
zlevel : this._zlevelBase,
hoverable : false,
style : {
x : lastX,
y : y,
width : curX - lastX,
height : height,
color : color[(i / this._interval) % colorLength]
// type : this.option.splitArea.areaStyle.type,
}
};
this.shapeList.push(new RectangleShape(axShape));
lastX = curX;
}
}
else {
// 纵向
var x = this.grid.getX();
var width = this.grid.getWidth();
var lastYend = this.grid.getYend();
var curY;
for (var i = 0; i <= dataLength; i += this._interval) {
curY = i < dataLength
? (this.getCoordByIndex(i) - optGap)
: this.grid.getY();
axShape = {
// shape : 'rectangle',
zlevel : this._zlevelBase,
hoverable : false,
style : {
x : x,
y : curY,
width : width,
height : lastYend - curY,
color : color[(i / this._interval) % colorLength]
// type : this.option.splitArea.areaStyle.type
}
};
this.shapeList.push(new RectangleShape(axShape));
lastYend = curY;
}
}
}
},
/**
* 刷新
*/
refresh : function (newOption) {
if (newOption) {
this.option = this.reformOption(newOption);
// 通用字体设置
this.option.axisLabel.textStyle = zrUtil.merge(
this.option.axisLabel.textStyle || {},
this.ecTheme.textStyle
);
}
this.clear();
this._buildShape();
},
/**
* 返回间隔
*/
getGap : function () {
var dataLength = this.option.data.length;
var total = this.isHorizontal()
? this.grid.getWidth()
: this.grid.getHeight();
if (this.option.boundaryGap) { // 留空
return total / dataLength;
}
else { // 顶头
return total / (dataLength > 1 ? (dataLength - 1) : 1);
}
},
// 根据值换算位置
getCoord : function (value) {
var data = this.option.data;
var dataLength = data.length;
var gap = this.getGap();
var position = this.option.boundaryGap ? (gap / 2) : 0;
for (var i = 0; i < dataLength; i++) {
if (data[i] == value
|| (typeof data[i].value != 'undefined'
&& data[i].value == value)
) {
if (this.isHorizontal()) {
// 横向
position = this.grid.getX() + position;
}
else {
// 纵向
position = this.grid.getYend() - position;
}
return position;
// Math.floor可能引起一些偏差,但性能会更好
/* 准确更重要
return (i === 0 || i == dataLength - 1)
? position
: Math.floor(position);
*/
}
position += gap;
}
},
// 根据类目轴数据索引换算位置
getCoordByIndex : function (dataIndex) {
if (dataIndex < 0) {
if (this.isHorizontal()) {
return this.grid.getX();
}
else {
return this.grid.getYend();
}
}
else if (dataIndex > this.option.data.length - 1) {
if (this.isHorizontal()) {
return this.grid.getXend();
}
else {
return this.grid.getY();
}
}
else {
var gap = this.getGap();
var position = this.option.boundaryGap ? (gap / 2) : 0;
position += dataIndex * gap;
if (this.isHorizontal()) {
// 横向
position = this.grid.getX() + position;
}
else {
// 纵向
position = this.grid.getYend() - position;
}
return position;
/* 准确更重要
return (dataIndex === 0 || dataIndex == this.option.data.length - 1)
? position
: Math.floor(position);
*/
}
},
// 根据类目轴数据索引换算类目轴名称
getNameByIndex : function (dataIndex) {
var data = this.option.data[dataIndex];
if (typeof data != 'undefined' && typeof data.value != 'undefined')
{
return data.value;
}
else {
return data;
}
},
// 根据类目轴名称换算类目轴数据索引
getIndexByName : function (name) {
var data = this.option.data;
var dataLength = data.length;
for (var i = 0; i < dataLength; i++) {
if (data[i] == name
|| (typeof data[i].value != 'undefined'
&& data[i].value == name)
) {
return i;
}
}
return -1;
},
// 根据位置换算值
getValueFromCoord : function() {
return '';
},
/**
* 根据类目轴数据索引返回是否为主轴线
* @param {number} dataIndex 类目轴数据索引
* @return {boolean} 是否为主轴
*/
isMainAxis : function (dataIndex) {
return dataIndex % this._interval === 0;
}
};
zrUtil.inherits(CategoryAxis, Base);
require('../component').define('categoryAxis', CategoryAxis);
return CategoryAxis;
});
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getCaseItems } from '../../actions';
import CaseItem from './item';
class UnboxWaiting extends Component {
componentDidMount() {
this.props.dispatch(getCaseItems(this.getCase()));
}
getCase() {
return this.props.cases.find(kase => {
return kase.id == this.props.caseId;
});
}
render() {
let items = [];
if (this.getCase() && this.getCase().items) {
items = this.getCase().items;
}
// Initialize the slider items list and indicators
const sliderItems = [];
const sliderIndicators = [];
// For each item add it to the list and add an indicator
items.forEach((item, index) => {
sliderItems.push(
<div
className={index === 0 ? 'carousel-item active' : 'carousel-item'}
key={index}
>
<img src={item.image['600px']} />
<div className="data">
<p className="txt-blue">{item.name}</p>
<p className="txt-white">{item.category}</p>
</div>
</div>
);
sliderIndicators.push(
<li
data-target="#carousel"
data-slide-to={index}
key={index}
className={index === 0 ? 'active' : null}
/>
);
});
return (
<section className="opening">
<div className="container">
<div className="waiting-container">
<p className="waiting">
Generating your items on the blockchain. Please give us two
minutes
</p>
<h5 className="waiting">UNLOCKING YOUR ITEMS</h5>
<img src="/img/spinner.svg" className="loading" />
</div>
<div className="row">
<div className="col-md-12">
<h4 className="txt-white">Items that might be in this case</h4>
</div>
</div>
<div className="row">
{items.map((item, i) => (
<CaseItem
key={i}
name={item.name}
category={item.category}
image={item.image}
color={item.color}
/>
))}
</div>
</div>
</section>
);
}
}
export default connect(state => ({
cases: state.cases,
}))(UnboxWaiting);
|
import React from 'react';
import { View, Text, Button, Image, StyleSheet } from 'react-native';
import MainButton from '../components/MainButton';
import globalStyle from '../utils/styles';
const GameOver = (props) => {
const { rounds, correctNumber, restartGame } = props;
return (
<View style={styles.screen}>
<Text style={globalStyle.titleText}>
Game Over!
</Text>
<View style={styles.imageContainer}>
<Image
source={require('../assets/success.png')}
style={styles.image}
resizeMode="cover"
/>
</View>
<Text style={globalStyle.bodyText}>
Number of rounds:
<Text style={styles.highlight}>{rounds}</Text>
</Text>
<Text style={globalStyle.bodyText}>
Number was:
<Text style={styles.highlight}>{correctNumber}</Text>
</Text>
<MainButton onClick={restartGame} buttonContainer={styles.mainButton}>New Game</MainButton>
</View>
)
}
const styles = StyleSheet.create({
screen: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
image:{
width: '100%',
height: '100%',
},
imageContainer: {
borderRadius: 100,
borderWidth: 2,
borderColor: 'black',
width: 200,
height: 200,
overflow: 'hidden',
marginVertical: 20,
},
highlight: {
color: '#613ef2',
fontWeight: 'bold',
fontSize: 14,
},
mainButton: {
marginTop: 16,
}
})
export default GameOver;
|
let _ = require('lodash');
module.exports = {
meta: {
docs: {
description: 'enforce empty lines before import declarations spanned on multiple lines',
category: 'Stylistic Issues',
recommended: false
},
fixable: 'whitespace',
schema: [{
type: 'object',
additionalProperties: false
}]
},
create(context) {
let sourceCode = context.getSourceCode();
return {
ImportDeclaration(node) {
if (node.loc.start.line === node.loc.end.line) {
return;
}
let prev = sourceCode.getTokenBefore(node);
if (!prev) {
// probably first statement
return;
}
if (_.includes(sourceCode.getText().slice(prev.end, node.start), '\n\n')) {
// contains empty line between prev token and node
return;
}
context.report({
node,
loc: node.loc.start,
message: 'Expected an empty line before multiline import statement.',
fix(fixer) {
if (sourceCode.commentsExistBetween(prev, node)) {
return;
}
return fixer.insertTextBefore(node, '\n');
}
});
}
};
}
};
|
define("ace/mode/io_highlight_rules",
["require", "exports", "module", "ace/lib/oop", "ace/mode/text_highlight_rules"],
function(e, t, n) {
"use strict";
var r = e("../lib/oop"),
i = e("./text_highlight_rules").TextHighlightRules,
s = function() {
this.$rules = {
start: [
{
token: ["text", "meta.empty-parenthesis.io"],
regex: "(\\()(\\))",
comment:
"we match this to overload return inside () --Allan; scoping rules for what gets the scope have changed, so we now group the ) instead of the ( -- Rob"
},
{
token: ["text", "meta.comma-parenthesis.io"],
regex: "(\\,)(\\))",
comment: "We want to do the same for ,) -- Seckar; same as above -- Rob"
},
{
token: "keyword.control.io",
regex:
"\\b(?:if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\\b"
},
{
token: "punctuation.definition.comment.io",
regex: "/\\*",
push: [
{ token: "punctuation.definition.comment.io", regex: "\\*/", next: "pop" },
{ defaultToken: "comment.block.io" }
]
},
{
token: "punctuation.definition.comment.io",
regex: "//",
push: [
{ token: "comment.line.double-slash.io", regex: "$", next: "pop" },
{ defaultToken: "comment.line.double-slash.io" }
]
},
{
token: "punctuation.definition.comment.io",
regex: "#",
push: [
{ token: "comment.line.number-sign.io", regex: "$", next: "pop" },
{ defaultToken: "comment.line.number-sign.io" }
]
},
{
token: "variable.language.io",
regex: "\\b(?:self|sender|target|proto|protos|parent)\\b",
comment:
"I wonder if some of this isn't variable.other.language? --Allan; scoping this as variable.language to match Objective-C's handling of 'self', which is inconsistent with C++'s handling of 'this' but perhaps intentionally so -- Rob"
},
{
token: "keyword.operator.io",
regex: "<=|>=|=|:=|\\*|\\||\\|\\||\\+|-|/|&|&&|>|<|\\?|@|@@|\\b(?:and|or)\\b"
}, { token: "constant.other.io", regex: "\\bGL[\\w_]+\\b" },
{ token: "support.class.io", regex: "\\b[A-Z](?:\\w+)?\\b" },
{
token: "support.function.io",
regex: "\\b(?:clone|call|init|method|list|vector|block|\\w+(?=\\s*\\())\\b"
}, { token: "support.function.open-gl.io", regex: "\\bgl(?:u|ut)?[A-Z]\\w+\\b" },
{
token: "punctuation.definition.string.begin.io",
regex: '"""',
push: [
{ token: "punctuation.definition.string.end.io", regex: '"""', next: "pop" },
{ token: "constant.character.escape.io", regex: "\\\\." },
{ defaultToken: "string.quoted.triple.io" }
]
},
{
token: "punctuation.definition.string.begin.io",
regex: '"',
push: [
{ token: "punctuation.definition.string.end.io", regex: '"', next: "pop" },
{ token: "constant.character.escape.io", regex: "\\\\." },
{ defaultToken: "string.quoted.double.io" }
]
},
{
token: "constant.numeric.io",
regex:
"\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b"
}, { token: "variable.other.global.io", regex: "Lobby\\b" },
{
token: "constant.language.io",
regex: "\\b(?:TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\\b"
}
]
}, this.normalizeRules()
};
s.metaData =
{ fileTypes: ["io"], keyEquivalent: "^~I", name: "Io", scopeName: "source.io" }, r.inherits(s, i), t
.IoHighlightRules = s
}), define("ace/mode/folding/cstyle",
["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"],
function(e, t, n) {
"use strict";
var r = e("../../lib/oop"),
i = e("../../range").Range,
s = e("./fold_mode").FoldMode,
o = t.FoldMode = function(e) {
e &&
(this.foldingStartMarker =
new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + e.start)),
this.foldingStopMarker =
new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + e.end)))
};
r.inherits(o, s), function() {
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/, this.foldingStopMarker =
/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/, this.singleLineBlockCommentRe =
/^\s*(\/\*).*\*\/\s*$/, this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/, this.startRegionRe =
/^\s*(\/\*|\/\/)#?region\b/, this._getFoldWidgetBase = this.getFoldWidget, this.getFoldWidget =
function(e, t, n) {
var r = e.getLine(n);
if (this.singleLineBlockCommentRe.test(r) &&
!this.startRegionRe.test(r) &&
!this.tripleStarBlockCommentRe.test(r)) return"";
var i = this._getFoldWidgetBase(e, t, n);
return!i && this.startRegionRe.test(r) ? "start" : i
}, this.getFoldWidgetRange = function(e, t, n, r) {
var i = e.getLine(n);
if (this.startRegionRe.test(i)) return this.getCommentRegionBlock(e, i, n);
var s = i.match(this.foldingStartMarker);
if (s) {
var o = s.index;
if (s[1]) return this.openingBracketBlock(e, s[1], n, o);
var u = e.getCommentFoldRange(n, o + s[0].length, 1);
return u && !u.isMultiLine() && (r ? u = this.getSectionRange(e, n) : t != "all" && (u = null)), u
}
if (t === "markbegin") return;
var s = i.match(this.foldingStopMarker);
if (s) {
var o = s.index + s[0].length;
return s[1] ? this.closingBracketBlock(e, s[1], n, o) : e.getCommentFoldRange(n, o, -1)
}
}, this.getSectionRange = function(e, t) {
var n = e.getLine(t), r = n.search(/\S/), s = t, o = n.length;
t += 1;
var u = t, a = e.getLength();
while (++t < a) {
n = e.getLine(t);
var f = n.search(/\S/);
if (f === -1) continue;
if (r > f) break;
var l = this.getFoldWidgetRange(e, "all", t);
if (l) {
if (l.start.row <= s) break;
if (l.isMultiLine()) t = l.end.row;
else if (r == f) break
}
u = t
}
return new i(s, o, u, e.getLine(u).length)
}, this.getCommentRegionBlock = function(e, t, n) {
var r = t.search(/\s*$/), s = e.getLength(), o = n, u = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/, a = 1;
while (++n < s) {
t = e.getLine(n);
var f = u.exec(t);
if (!f) continue;
f[1] ? a-- : a++;
if (!a) break
}
var l = n;
if (l > o) return new i(o, r, l, t.length)
}
}.call(o.prototype)
}), define("ace/mode/io",
[
"require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/io_highlight_rules",
"ace/mode/folding/cstyle"
],
function(e, t, n) {
"use strict";
var r = e("../lib/oop"),
i = e("./text").Mode,
s = e("./io_highlight_rules").IoHighlightRules,
o = e("./folding/cstyle").FoldMode,
u = function() {
this.HighlightRules = s, this.foldingRules = new o, this.$behaviour = this.$defaultBehaviour
};
r.inherits(u, i), function() {
this.lineCommentStart = "//", this.blockComment = { start: "/*", end: "*/" }, this.$id = "ace/mode/io"
}.call(u.prototype), t.Mode = u
});
(function() {
window.require(["ace/mode/io"],
function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
|
import axios from "axios";
import handleResponse from "./handleResponse";
import handleError from "./handleError";
import setConfig from "./setConfig";
/**
* intactRequest是只在axios基础上更改了请求配置。
* 而request是基于axios创建的实例,实例只有常见的数据请求方法,没有axios.isCancel/ axios.CancelToken等方法,
* 也就是没有**取消请求**和**批量请求**的方法。
* 所以如果需要在实例中调用取消某个请求的方法(例如取消上传),请用intactRequest。
*/
export let intactRequest = setConfig(axios);
export let request = intactRequest.create();
// 请求中的api
let pendingPool = new Map();
/**
* 请求拦截
*/
const requestInterceptorId = request.interceptors.request.use(
(config) => {
// 对于异常的响应也需要在pendingPool中将其删除,但响应拦截器中的异常响应有些获取不到请求信息,这里将其保存在实例上
request.config = Object.assign({}, config);
// 在发送请求之前做些什么
config.cancelToken = new axios.CancelToken((cancelFn) => {
pendingPool.has(config.url)
? cancelFn(`${config.url}请求重复`)
: pendingPool.set(config.url, { cancelFn, global: config.global });
});
return config;
},
(err) => {
// 对请求错误做些什么
Promise.reject(err);
}
);
/**
* 响应拦截
*/
const responseInterceptorId = request.interceptors.response.use(
(response) => {
const { config } = response;
pendingPool.delete(config.url);
return Promise.resolve(handleResponse(response));
},
// 对异常响应处理
(err) => {
const { config } = request;
if (!axios.isCancel(err)) {
pendingPool.delete(config.url);
}
if (!err) return Promise.reject(err);
if (err.response) {
err = handleError(err);
}
// 没有response(没有状态码)的情况
// eg: 超时;断网;请求重复被取消;主动取消请求;
else {
// 错误信息err传入isCancel方法,可以判断请求是否被取消
if (axios.isCancel(err)) {
throw new axios.Cancel(
err.message || `请求'${request.config.url}'被取消`
);
} else if (err.stack && err.stack.includes("timeout")) {
err.message = "请求超时!";
} else {
err.message = "连接服务器失败!";
}
}
return Promise.reject(err);
}
);
// 移除全局的请求拦截器
function removeRequestInterceptor() {
request.interceptors.request.eject(requestInterceptorId);
}
// 移除全局的响应拦截器
function removeResponseInterceptor() {
request.interceptors.response.eject(responseInterceptorId);
}
/**
* 清除所有pending状态的请求
* @param {Array} whiteList 白名单,里面的请求不会被取消
* 返回值 被取消了的api请求
* 可以在路由变化时取消当前所有非全局的pending状态的请求
*/
function clearPendingPool(whiteList = []) {
if (!pendingPool.size) return;
const pendingUrlList = Array.from(pendingPool.keys()).filter(
(url) => !whiteList.includes(url)
);
if (!pendingUrlList.length) return;
pendingUrlList.forEach((pendingUrl) => {
// 清除掉所有非全局的pending状态下的请求
if (!pendingPool.get(pendingUrl).global) {
pendingPool.get(pendingUrl).cancelFn();
pendingPool.delete(pendingUrl);
}
});
return pendingUrlList;
}
request.removeRequestInterceptor = removeRequestInterceptor;
request.removeResponseInterceptor = removeResponseInterceptor;
request.clearPendingPool = clearPendingPool;
|
var app = angular.module('hlOrgChart', []);
|
var pc = require("../..");
pc.compile = require("../../lib/parsers/default/compiler").compile;
pc.document = require("./document");
var pixi = require("pixi.js");
pc.document.registerElement("text", require("./components/text"));
var tpl = pc.template("<repeat each={{items}} as='item' key='v'><text text='{{i}}' position='{{item.position}}' /></repeat>", {
modifiers: {
ceil: Math.ceil,
floor: Math.floor
}
});
var v = tpl.view({
i: 0,
items: Array.apply(void 0, new Array(100)).map(function(v, i) {
return { index: i, position: { x: (i%15)*50, y: Math.floor((i/15)) * 30 }};
})
});
// console.log(v);
var renderer = PIXI.autoDetectRenderer(800, 600);
document.body.appendChild(renderer.view);
var i = 0;
function animate() {
// console.log(i);
v.context.i = ++i;
v.update();
renderer.render(v.render().target);
requestAnimationFrame(animate);
}
animate();
|
export default class MainVizTDView {
constructor(container, model) {
this.model = model;
this.container = document.getElementById(container);
}
render() {
const renderer = this.model.getRenderer();
this.container.appendChild(renderer.domElement);
}
}
|
import Image from "next/image";
import Cover from "pages/projects/rsvp/ccscover.png";
import ResearchPlan from "pages/projects/rsvp/researchplan.png";
import ResMethods from "pages/projects/rsvp/resmethods.png";
import Attendance from "pages/projects/rsvp/attendance.png";
import NeedsStatements from "pages/projects/rsvp/needsstatements.png";
import CompetitorAnalysis from "pages/projects/rsvp/competitoranalysis.png";
import AtHome from "pages/projects/rsvp/athome.png";
import Promo from "pages/projects/rsvp/promo2.png";
import UsabilityTest from "pages/projects/rsvp/usabilitytest.png";
import Link from "next/link";
export default function IndexPage() {
return (
<main className="max-w-screen-lg mx-auto">
<article className="casestudy">
<section>
<div className="title">
<h1 className="">Fitness Class Reservation System During COVID-19</h1>
<p>
As a <strong>UX Researcher at PYRAMID</strong>, I used <strong>generative methods</strong>, <strong>evaluative methods</strong> and <strong>usability testing</strong> to implement a
new system adopted by 96% of classgoers.
</p>
</div>
<figure>
<Image src={Cover} alt="RSVP's interface on mobile and desktop" layout="intrinsic" objectFit="cover" quality={100}></Image>
<figcaption>Final Product</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>
Context
</h1>
<p>
When fitness classes were capped at 50 percent due to COVID-19, PYRAMID offered reservations by:
</p>
<div className="indent">
<ul>
<li>Phone</li>
<li>Walk-in</li>
<li>Messenger</li>
<li>Chatbot</li>
</ul>
</div>
<p>
<strong>Replacing these options with a unified system</strong> would be important as members became comfortable returning to class.
</p>
</div>
<figure className="lg:col-span-4">
<Image src={Attendance} alt="RSVP's interface on mobile and desktop" layout="intrinsic" objectFit="cover" quality={100}></Image>
<figcaption>Full classes would occur within one standard deviation of mean pre-pandemic class attendance.</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>Research Plan</h1>
<p>
Following a modified version of <em>The UX Research Plan That Stakeholders Love</em> <cite>(Sharon, 2012)</cite>, I structured a research plan to:
</p>
<ol>
<li>
Determine the reservation system most important to members and staff.
</li>
<li>
Ensure that the new system is usable.
</li>
</ol>
</div>
<figure className="lg:col-span-4">
<Image src={ResearchPlan} alt="Class capacities" layout="intrinsic" objectFit="cover" quality={100}></Image>
<figcaption>
Research plan in Notion covering background, methods, participants, and scripts (not displayed).
</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>User Flows</h1>
<p>
Each registration required <strong>synchronized effort between members and staff</strong>.
Front Desk role requires in-person interactionsthat could interfere with responding to reservations.
</p>
<p>
The high interaction cost of this synchronizing increased the likelihood of failure via an unsuccessful registration.
</p>
<aside>
<dfn>Interaction Cost</dfn>
<p>The cognitive and physcial effort required to complete a task <cite>(Budiu, 2013)</cite></p>
</aside>
</div>
<figure className="lg:col-span-4">
<iframe height="400" width="100%" src="https://miro.com/app/live-embed/o9J_lv-7zb4=/?moveToViewport=-2199,-2560,5840,4565" scrolling="no" allowFullScreen className="rounded-3xl border border-gray-300"></iframe>
<figcaption>Interactive member flows created in Miro.</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>
Semi-Structured Member & Stakeholder Interviews
</h1>
<p>
To determine needs and pain points, I interviewed representative samples of each cluster of system users.
</p>
<ul>
<li>Members</li>
<li>Front Desk Staff</li>
<li>Admin Staff</li>
</ul>
<p>
I used these insights to create <strong>needs statements</strong> and an <strong>affinity diagram</strong> for evaluating prospective system.
</p>
</div>
<figure className="lg:col-span-4">
<iframe width="100%" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FrO1Ua0jmimdhtfYjIwSL9W%2FReservation-System-Needs%3Fnode-id%3D0%253A1" allowFullScreen className="rounded-3xl border border-gray-300"></iframe>
<figcaption>Affinity Diagram of member, front desk staff, and admin staff needs, sorted by cluster.</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>
Usability Testing
</h1>
<p>When deciding between <strong>Calendly</strong> and <strong>Acuity</strong>, representative samples of classgoers and staff completed tasks while speaking aloud. Tasks were rotated to avoid order effects.</p>
<p>Members preferred Calendly’s native feel and its showing class descriptions in its date-picker. They found Acuity’s scrolling to be burdensome.</p>
<p>Staff complimented both interfaces.</p>
</div>
<figure className="lg:col-span-4">
<Image src={UsabilityTest} alt="Calendly's Datepicker" layout="intrinsic" objectFit="cover" quality={100}></Image>
<figcaption>Datepicker that was favored in testing</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>Implementation and Adoption</h1>
<p>Noting member preferences, we selected <strong>Calendly</strong>. To build on its native feel, I styled the reservaiton widget to follow <em>Ochre</em>, {"PYRAMID's"} design system.</p>
<p>We named the system RSVP to reflect the inclusive nature of fitness classes. I created marketing materials that emphasized its usability, and that doubled as tutorials.</p>
<p>RSVP was used for 96 percent of class registrations within three weeks launch.</p>
</div>
<figure className="col-span-4">
<Image src={Promo} alt="Class capacities" layout="responsive" quality={100}></Image>
<figcaption>Promotionional posters placed throughout PYRAMID.</figcaption>
</figure>
</section>
<section className="lg:grid lg:grid-cols-7 items-center gap-24">
<div className="lg:col-span-3">
<h1>RSVP & PYRAMID (At Home)</h1>
<p>When fitness clubs closed in December due to rising COVID-19 cases, we launched <strong>PYRAMID (At Home), a month-long premium service</strong> offering fitness classes, personalized training, and challenges from home.</p>
<p>RSVP was crucial to {"(At Home)'s"} success, since members had an existing mental model of how registration worked.</p>
</div>
<figure className="col-span-4">
<Image src={AtHome} alt="Calendly's Datepicker" layout="intrinsic" objectFit="cover" quality={100}></Image>
<figcaption>Promotional graphic for Group Fitness Classes (At Home), where members registered using RSVP.</figcaption>
</figure>
</section>
<section>
<h1>
Reflection
</h1>
<p>
I’m grateful to everyone who helped bring RSVP to life over a short period. Its success shows the importance of asynchronous, automated systems as a means of freeing up people’s time and increasing desired behaviors. Since its launch, RSVP has been adapted for other services at PYRAMID, and its future looks bright.
</p>
</section>
<section>
<h1>
References
</h1>
<ol>
<li>Budiu, R. (2013, August 31). Interaction cost: Definition. Nielsen Norman Group. Retrieved October 8, 2021, from <Link href="https://www.nngroup.com/articles/interaction-cost-definition/"><a className="text-red-800 underline">https://www.nngroup.com/articles/interaction-cost-definition/</a></Link>.</li>
<li>Sharon, T. (2012, January 26). The UX research plan that stakeholders love. Smashing Magazine. Retrieved October 8, 2021, from <Link href="https://www.smashingmagazine.com/2012/01/ux-research-plan-stakeholders-love/"><a className="text-red-800 underline">https://www.smashingmagazine.com/2012/01/ux-research-plan-stakeholders-love/</a></Link>.</li>
</ol>
</section>
</article>
</main>
);
}
|
import sinon from 'sinon';
import { expect } from 'chai';
import {
UPDATE_DISTROS,
fetchDistros,
} from '~/actions/api/distros';
import * as fetch from '~/fetch';
describe('actions/api/distros', async () => {
const auth = { token: 'token' };
const sandbox = sinon.sandbox.create();
afterEach(() => {
sandbox.restore();
});
const getGetState = (state = {}) => sandbox.stub().returns({
authentication: auth,
...state,
});
const getDispatch = () => sandbox.spy();
const getFetchStub = (rsp) => sandbox.stub(fetch, 'fetch').returns({ json() { return rsp; } });
const mockResponse = {
distributions: [
{ id: 'distro_1' },
{ id: 'distro_2' },
],
total_pages: 3,
total_results: 25 * 3 - 4,
page: 1,
};
it('should fetch distros', async () => {
const dispatch = getDispatch();
const fetchStub = getFetchStub(mockResponse);
const getState = getGetState({
api: { distributions: { totalPages: -1 } },
});
const f = fetchDistros();
await f(dispatch, getState);
expect(fetchStub.calledWith(
auth.token, '/distributions?page=1')).to.equal(true);
expect(dispatch.calledWith({
type: UPDATE_DISTROS,
response: mockResponse,
})).to.equal(true);
});
});
|
function solve() {
let button = document.getElementById('send');
let chatInput=document.getElementById('chat_input');
let chatMessages=document.getElementById('chat_messages');
button.addEventListener('click',(e)=>{
let message=document.createElement('div');
message.setAttribute('class','message my-message');
message.innerHTML=chatInput.value;
chatMessages.appendChild(message);
chatInput.value='';
});
}
|
import Sinon from 'sinon';
import { shallowMount } from '@vue/test-utils'
import FileUpload from 'vue-app/src/components/UploadFile'
import vue2Dropzone from "vue2-dropzone";
import { bus } from "vue-app/src/event-bus";
describe('UploadFile Test', () => {
const wrapper = shallowMount(FileUpload);
it('renders', () => {
expect(wrapper.exists()).toBe(true);
});
it('has correct div class names', () => {
const div = wrapper.findAll('div');
expect(div.exists()).toBe(true);
expect(div.length).toBe(1);
expect(div.at(0).classes("col-sm-3")).toBe(true);
expect(div.at(0).classes("col-sm-5")).toBe(true);
});
it('contains vue2Dropzone', () => {
expect(wrapper.contains(vue2Dropzone)).toBe(true);
});
it('setup correctly', () => {
expect(true).toBe(true);
});
it('uploadSuccess method', () => {
const mocks = {
bus: {
$on: jest.fn(),
$off: jest.fn(),
$emit: jest.fn(),
},
};
const wrapperMock = shallowMount(FileUpload, {
mocks
});
wrapperMock.vm.uploadSuccess('testFile', 'testResponse');
console.log("##");
console.log(wrapperMock.vm.bus.$emit);
expect(wrapperMock.vm.bus.$emit).toHaveBeenCalledTimes(0);
});
});
|
export default function round(float, decimalPlaces) {
if (decimalPlaces === undefined) {
throw new Error(
'The second argument is missing. Provide the number of decimal places you want to keep.',
);
}
if (typeof decimalPlaces !== 'number') {
throw new Error(
`The second argument must be a number, but you provided a ${typeof decimalPlaces}`,
);
}
if (decimalPlaces === 0) {
return Math.round(float);
}
const x = Math.pow(10, decimalPlaces);
return Math.round(float * x) / x;
}
|
define(["./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-d1adddcb","./WebGLConstants-76bb35d1","./AttributeCompression-4a67d8a6","./IndexDatatype-53503fee","./createTaskProcessorWorker"],function(a,e,P,L,r,S,_,n){"use strict";var G=32767,W=new L.Cartographic,B=new L.Cartesian3;var z=new L.Rectangle,H=new L.Ellipsoid,O=new L.Cartesian3,Y={min:void 0,max:void 0};var Z=new L.Cartesian3,j=new L.Cartesian3,q=new L.Cartesian3,J=new L.Cartesian3,K=new L.Cartesian3;return n(function(a,e){var r=new Uint16Array(a.positions),n=new Uint16Array(a.widths),t=new Uint32Array(a.counts),i=new Uint16Array(a.batchIds);!function(a){a=new Float64Array(a);var e=0;Y.min=a[e++],Y.max=a[e++],L.Rectangle.unpack(a,2,z),e+=L.Rectangle.packedLength,L.Ellipsoid.unpack(a,e,H),e+=L.Ellipsoid.packedLength,L.Cartesian3.unpack(a,e,O)}(a.packedBuffer);for(var s=O,c=function(a,e,r,n,t){var i=a.length/3,s=a.subarray(0,i),c=a.subarray(i,2*i),u=a.subarray(2*i,3*i);S.AttributeCompression.zigZagDeltaDecode(s,c,u);for(var o=new Float64Array(a.length),f=0;f<i;++f){var p=s[f],C=c[f],d=u[f],p=P.CesiumMath.lerp(e.west,e.east,p/G),C=P.CesiumMath.lerp(e.south,e.north,C/G),d=P.CesiumMath.lerp(r,n,d/G),d=L.Cartographic.fromRadians(p,C,d,W),d=t.cartographicToCartesian(d,B);L.Cartesian3.pack(d,o,3*f)}return o}(r,z,Y.min,Y.max,H),r=4*(a=c.length/3)-4,u=new Float32Array(3*r),o=new Float32Array(3*r),f=new Float32Array(3*r),p=new Float32Array(2*r),C=new Uint16Array(r),d=0,b=0,w=0,h=0,l=t.length,y=0;y<l;++y){for(var k,v=t[y],A=n[y],g=i[y],m=0;m<v;++m){0===m?(E=L.Cartesian3.unpack(c,3*h,Z),x=L.Cartesian3.unpack(c,3*(h+1),j),k=L.Cartesian3.subtract(E,x,q),L.Cartesian3.add(E,k,k)):k=L.Cartesian3.unpack(c,3*(h+m-1),q);var x,E,D,I=L.Cartesian3.unpack(c,3*(h+m),J);m===v-1?(x=L.Cartesian3.unpack(c,3*(h+v-1),Z),E=L.Cartesian3.unpack(c,3*(h+v-2),j),D=L.Cartesian3.subtract(x,E,K),L.Cartesian3.add(x,D,D)):D=L.Cartesian3.unpack(c,3*(h+m+1),K),L.Cartesian3.subtract(k,s,k),L.Cartesian3.subtract(I,s,I),L.Cartesian3.subtract(D,s,D);for(var T=m===v-1?2:4,U=0===m?2:0;U<T;++U){L.Cartesian3.pack(I,u,d),L.Cartesian3.pack(k,o,d),L.Cartesian3.pack(D,f,d),d+=3;var F=U-2<0?-1:1;p[b++]=U%2*2-1,p[b++]=F*A,C[w++]=g}}h+=v}var N=_.IndexDatatype.createTypedArray(r,6*a-6),R=0,M=0,l=a-1;for(y=0;y<l;++y)N[M++]=R,N[M++]=R+2,N[M++]=R+1,N[M++]=R+1,N[M++]=R+2,N[M++]=R+3,R+=4;return e.push(u.buffer,o.buffer,f.buffer),e.push(p.buffer,C.buffer,N.buffer),{indexDatatype:2===N.BYTES_PER_ELEMENT?_.IndexDatatype.UNSIGNED_SHORT:_.IndexDatatype.UNSIGNED_INT,currentPositions:u.buffer,previousPositions:o.buffer,nextPositions:f.buffer,expandAndWidth:p.buffer,batchIds:C.buffer,indices:N.buffer}})});
|
/* http://keith-wood.name/countdown.html
* Ukrainian initialisation for the jQuery countdown extension
* Written by Goloborodko M misha.gm@gmail.com (2009), corrections by Iгор Kоновал */
(function($) {
$.countdown.regional['uk'] = {
labels: ['Років', 'Місяців', 'Тижнів', 'Днів', 'Годин', 'Хвилин', 'Секунд'],
labels1: ['Рік', 'Місяць', 'Тиждень', 'День', 'Година', 'Хвилина', 'Секунда'],
labels2: ['Роки', 'Місяці', 'Тижні', 'Дні', 'Години', 'Хвилини', 'Секунди'],
compactLabels: ['r', 'm', 't', 'd'],
whichLabels: function(amount) {
return (amount == 1 ? 1 : (amount >=2 && amount <= 4 ? 2 : 0));
},
digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
timeSeparator: ':', isRTL: false};
$.countdown.setDefaults($.countdown.regional['uk']);
})(jQuery);
|
'use strict'
const src = '../../../src'
const Test = require('tapes')(require('tape'))
const Sinon = require('sinon')
const BaseResult = require(`${src}/result/base`)
Test('BaseResult', baseResultTest => {
let sandbox
baseResultTest.beforeEach(t => {
sandbox = Sinon.createSandbox()
t.end()
})
baseResultTest.afterEach(t => {
sandbox.restore()
t.end()
})
baseResultTest.test('constructor should', constructorTest => {
constructorTest.test('parse and set fields from SOAP response', test => {
let returnCode = 201
let message1 = 'test'
let message2 = 'test more'
let soapResponse = {
Envelope: {
Body: {
Response: {
ReturnCode: { '_': returnCode.toString() },
TextMessage: [
{ '_': message1 },
{ '_': message2 }
]
}
}
}
}
let baseResult = new BaseResult(soapResponse)
test.equal(baseResult.code, returnCode)
test.equal(baseResult.messages.length, 2)
test.equal(baseResult.messages[0], message1)
test.equal(baseResult.messages[1], message2)
test.deepEqual(baseResult.data, {})
test.end()
})
constructorTest.end()
})
baseResultTest.end()
})
|
(function( window, undefined ) {
kendo.cultures["en-SS"] = {
name: "en-SS",
numberFormat: {
pattern: ["-n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
percent: {
pattern: ["-n%","n%"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "%"
},
currency: {
name: "South Sudanese Pound",
abbr: "SSP",
pattern: ["-$n","$n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "£"
}
},
calendars: {
standard: {
days: {
names: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
namesAbbr: ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
namesShort: ["Su","Mo","Tu","We","Th","Fr","Sa"]
},
months: {
names: ["January","February","March","April","May","June","July","August","September","October","November","December"],
namesAbbr: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
},
AM: ["AM","am","AM"],
PM: ["PM","pm","PM"],
patterns: {
d: "dd/MM/yyyy",
D: "dddd, d MMMM yyyy",
F: "dddd, d MMMM yyyy h:mm:ss tt",
g: "dd/MM/yyyy h:mm tt",
G: "dd/MM/yyyy h:mm:ss tt",
m: "d MMMM",
M: "d MMMM",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "h:mm tt",
T: "h:mm:ss tt",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "MMMM yyyy",
Y: "MMMM yyyy"
},
"/": "/",
":": ":",
firstDay: 1
}
}
}
})(this);
|
/*$(window).resize(function() {
var width = $(document).width();
width = width - 290;
$('.right_body_content').css('width',width);
});
*/
//Displays a form within a page
$(document).ready(function(){
$("body").append("<div id='popup' class='dialog'></div>");
$("#popup").css("width","400px");
$("#popup").css("height","400px");
/* $("#popup").css("z-index","1");
$("#popup").css("margin-left","50%");
$("#popup").css("margin-top","50%");*/
$("ui-icon").click(function(){
});
});
function elipsis(){
var i=1;
$("table").find("tr").each(function(){
if($(this).attr("class")!="rights_header_view_list")
$(this).find("td").each(function(){
if($(this).children().length<1){
var w=$(this).parents("table").find(".rights_header_view_list").children("td:nth-child("+i+")").width();
if(w<60){
w=(w*$(this).parents("#mainFormsDiv").outerWidth())/100;
}
w=Math.ceil(w/6);
if(w>60)
{w=Math.floor(w/2);}
$(this).ellipsis({visible: w, more: '(more)', separator:'', atFront: false});
}
i++;
});
i=1;
});
}
|
/**
* Created by schien on 19/11/13.
*/
define(function (require) {
"use strict";
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone'),
templates = require('js/templates/templates'),
MeasurePopOut = require('app/views/detail/MeasurePopOut'),
measureTemplate = templates['measure'];
return Backbone.View.extend({
// className: 'house-list-item',
initialize: function (options) {
_.bindAll(this, 'render', 'showCostDisclaimer', 'showMeasureDescriptions', 'showDisruptionDisclaimer');
this.data = options.data;
},
events: {
"click a.measure-anchor": 'showMeasureDescriptions',
"click a.cost": 'showCostDisclaimer',
"click a.disruption": 'showDisruptionDisclaimer'
},
render: function () {
// measures is an attribute, i.e. POJO
var m = window.greendoors.measures.findWhere({id: this.data.measure});
var measureTemplate2 = measureTemplate(_.extend(this.data, m.toJSON()));
this.$el.html(measureTemplate2);
return this;
},
showMeasureDescriptions: function () {
var id = this.data.measure;
var measure = window.greendoors.measures.findWhere({'id': id});
var data = measure.toJSON();
this.showPopOut('measurePopout', data);
},
showPopOut: function (templateName, data) {
$('body').append(new MeasurePopOut({templateName: templateName, data: data}).render().el);
},
showDisruptionDisclaimer: function () {
this.showPopOut('disruptionDisclaimer')
},
showCostDisclaimer: function () {
this.showPopOut('costDisclaimer')
},
close: function () {
this.remove();
this.unbind();
}
});
});
|
/*
LibreTaxi, free and open source ride sharing platform.
Copyright (C) 2016-2017 Roman Pushkin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import test from 'ava';
import stateful from '../src/stateful';
class Foo {
test() {
return 1;
}
}
class Bar extends stateful(Foo) {
}
test('should work with base class', t => {
const bar = new Bar();
t.is(bar.test(), 1);
});
|
const axios = require("axios");
const api = axios.create({
baseURL: "https://brasilapi.com.br/api/cep/",
});
const methods = {
async getAddress(cep) {
try {
const response = await api.get(`v2/${cep}`);
if (response.status !== 200) {
throw new Error({
info: "Ops, A requisição falhou",
status: response.status,
message: response.statusText,
});
}
return response.data;
} catch (error) {
console.log(error);
}
},
};
module.exports = methods;
|
/**
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Because AdSense and DoubleClick are both operated by Google and their A4A
// implementations share some behavior in common, part of the logic for this
// implementation is located in the ads/google/a4a directory rather than here.
// Most other ad networks will want to put their A4A code entirely in the
// extensions/amp-ad-network-${NETWORK_NAME}-impl directory.
import {EXPERIMENT_INFO_LIST as AMPDOC_FIE_EXPERIMENT_INFO_LIST} from '../../../src/ampdoc-fie';
import {AdsenseSharedState} from './adsense-shared-state';
import {AmpA4A, NO_SIGNING_EXP} from '../../amp-a4a/0.1/amp-a4a';
import {CONSENT_POLICY_STATE} from '../../../src/consent-state';
import {Navigation} from '../../../src/service/navigation';
import {
QQID_HEADER,
RENDER_ON_IDLE_FIX_EXP,
SANDBOX_HEADER,
STICKY_AD_PADDING_BOTTOM_EXP,
ValidAdContainerTypes,
addCsiSignalsToAmpAnalyticsConfig,
additionalDimensions,
extractAmpAnalyticsConfig,
getCsiAmpAnalyticsConfig,
getCsiAmpAnalyticsVariables,
getEnclosingContainerTypes,
getIdentityToken,
googleAdUrl,
isCdnProxy,
isReportingEnabled,
maybeAppendErrorParameter,
} from '../../../ads/google/a4a/utils';
import {ResponsiveState} from './responsive-state';
import {Services} from '../../../src/services';
import {
addExperimentIdToElement,
isInExperiment,
isInManualExperiment,
} from '../../../ads/google/a4a/traffic-experiments';
import {computedStyle, setStyles} from '../../../src/style';
import {dev, devAssert, user} from '../../../src/log';
import {domFingerprintPlain} from '../../../src/utils/dom-fingerprint';
import {getAmpAdRenderOutsideViewport} from '../../amp-ad/0.1/concurrent-load';
import {getData} from '../../../src/event-helper';
import {getDefaultBootstrapBaseUrl} from '../../../src/3p-frame';
import {getMode} from '../../../src/mode';
import {insertAnalyticsElement} from '../../../src/extension-analytics';
import {randomlySelectUnsetExperiments} from '../../../src/experiments';
import {removeElement} from '../../../src/dom';
import {stringHash32} from '../../../src/string';
import {utf8Decode} from '../../../src/utils/bytes';
/** @const {string} */
const ADSENSE_BASE_URL = 'https://googleads.g.doubleclick.net/pagead/ads';
/** @const {string} */
const TAG = 'amp-ad-network-adsense-impl';
/** @const @enum {string} */
const ROUND_LOCATION_PARAMS_HOLDBACK_EXP = {
ID: 'ad-adsense-gam-round-params',
CONTROL: '21067039',
EXPERIMENT: '21067040',
};
/**
* Shared state for AdSense ad slots. This is used primarily for ad request url
* parameters that depend on previous slots.
* @const {!AdsenseSharedState}
*/
const sharedState = new AdsenseSharedState();
/** @visibleForTesting */
export function resetSharedState() {
sharedState.reset();
}
/** @final */
export class AmpAdNetworkAdsenseImpl extends AmpA4A {
/**
* @param {!Element} element
*/
constructor(element) {
super(element);
/**
* A unique identifier for this slot.
* Not initialized until getAdUrl() is called; updated upon each invocation
* of getAdUrl().
* @private {?string}
*/
this.uniqueSlotId_ = null;
/**
* Config to generate amp-analytics element for active view reporting.
* @type {?JsonObject}
* @private
*/
this.ampAnalyticsConfig_ = null;
/** @private {!../../../src/service/extensions-impl.Extensions} */
this.extensions_ = Services.extensionsFor(this.win);
/** @private {?({width, height}|../../../src/layout-rect.LayoutRectDef)} */
this.size_ = null;
/**
* amp-analytics element generated based on this.ampAnalyticsConfig_
* @private {?Element}
*/
this.ampAnalyticsElement_ = null;
/** @private {?string} */
this.qqid_ = null;
/** @private {?ResponsiveState}. */
this.responsiveState_ = ResponsiveState.createIfResponsive(element);
/** @private {?Promise<!../../../ads/google/a4a/utils.IdentityToken>} */
this.identityTokenPromise_ = null;
/**
* @private {?boolean} whether preferential rendered AMP creative, null
* indicates no creative render.
*/
this.isAmpCreative_ = null;
/** @private {number} slot index specific to google inventory */
this.ifi_ = 0;
/**
* Whether or not the iframe containing the ad should be sandboxed via the
* "sandbox" attribute.
* @private {boolean}
*/
this.shouldSandbox_ = false;
}
/** @override */
isValidElement() {
/**
* isValidElement used to also check that we are in a valid A4A environment,
* however this is not necessary as that is checked by adsenseIsA4AEnabled,
* which is always called as part of the upgrade path from an amp-ad element
* to an amp-ad-adsense element. Thus, if we are an amp-ad, we can be sure
* that it has been verified.
*/
if (
this.responsiveState_ != null &&
!this.responsiveState_.isValidElement()
) {
return false;
}
if (!this.element.getAttribute('data-ad-client')) {
return false;
}
return this.isAmpAdElement();
}
/** @override */
delayAdRequestEnabled() {
return getAmpAdRenderOutsideViewport(this.element) || 3;
}
/** @override
@return {!Promise|undefined}.
*/
buildCallback() {
super.buildCallback();
this.identityTokenPromise_ = this.getAmpDoc()
.whenFirstVisible()
.then(() =>
getIdentityToken(this.win, this.getAmpDoc(), super.getConsentPolicy())
);
// Convert the full-width tag to container width for desktop users.
if (
this.element.hasAttribute('data-auto-format') &&
!ResponsiveState.isLayoutViewportNarrow(this.element)
) {
return ResponsiveState.convertToContainerWidth(this.element).then(
(state) => {
if (state != null) {
this.responsiveState_ = state;
}
this.divertExperiments();
}
);
} else {
return ResponsiveState.maybeUpgradeToResponsive(
this.element,
this.getAdClientId_()
).then((state) => {
if (state != null) {
this.responsiveState_ = state;
}
if (this.responsiveState_ != null) {
return this.responsiveState_.attemptToMatchResponsiveHeight();
}
// This should happen last, as some diversion criteria rely on some of the
// preceding logic (specifically responsive logic).
this.divertExperiments();
});
}
}
/** @override */
getConsentPolicy() {
// Ensure that build is not blocked by need for consent (delay will occur
// prior to ad URL construction).
return null;
}
/**
* Selects into experiments based on url fragment and/or page level diversion.
* @visibleForTesting
*/
divertExperiments() {
const experimentInfoList = /** @type {!Array<!../../../src/experiments.ExperimentInfo>} */ ([
{
experimentId: RENDER_ON_IDLE_FIX_EXP.id,
isTrafficEligible: () => true,
branches: [
RENDER_ON_IDLE_FIX_EXP.control,
RENDER_ON_IDLE_FIX_EXP.experiment,
],
},
{
experimentId: NO_SIGNING_EXP.id,
isTrafficEligible: () => true,
branches: [NO_SIGNING_EXP.control, NO_SIGNING_EXP.experiment],
},
{
experimentId: STICKY_AD_PADDING_BOTTOM_EXP.id,
isTrafficEligible: () => true,
branches: [
STICKY_AD_PADDING_BOTTOM_EXP.control,
STICKY_AD_PADDING_BOTTOM_EXP.experiment,
],
},
{
experimentId: ROUND_LOCATION_PARAMS_HOLDBACK_EXP.ID,
isTrafficEligible: () => true,
branches: [
ROUND_LOCATION_PARAMS_HOLDBACK_EXP.CONTROL,
ROUND_LOCATION_PARAMS_HOLDBACK_EXP.EXPERIMENT,
],
},
]).concat(AMPDOC_FIE_EXPERIMENT_INFO_LIST);
const setExps = randomlySelectUnsetExperiments(
this.win,
experimentInfoList
);
Object.keys(setExps).forEach((expName) =>
addExperimentIdToElement(setExps[expName], this.element)
);
const moduleNomoduleExpId = this.getModuleNomoduleExpIds_();
if (moduleNomoduleExpId) {
addExperimentIdToElement(moduleNomoduleExpId, this.element);
}
}
/**
* @return {string} ad client ID for the current ad unit.
* @private
*/
getAdClientId_() {
const adClientId = (
this.element.getAttribute('data-ad-client') || ''
).toLowerCase();
if (!/^ca-/i.test(adClientId)) {
return `ca-${adClientId}`;
}
return adClientId;
}
/** @override */
getAdUrl(consentTuple) {
let consentState = undefined;
let consentString = undefined;
let gdprApplies = undefined;
if (consentTuple) {
consentState = consentTuple.consentState;
consentString = consentTuple.consentString;
gdprApplies = consentTuple.gdprApplies;
}
if (
consentState == CONSENT_POLICY_STATE.UNKNOWN &&
this.element.getAttribute('data-npa-on-unknown-consent') != 'true'
) {
user().info(TAG, 'Ad request suppressed due to unknown consent');
return Promise.resolve('');
}
// TODO: Check for required and allowed parameters. Probably use
// validateData, from 3p/3p/js, after moving it someplace common.
const startTime = Date.now();
const global = this.win;
const adClientId = this.getAdClientId_();
const adTestOn =
this.element.getAttribute('data-adtest') ||
isInManualExperiment(this.element);
const width = Number(this.element.getAttribute('width'));
const height = Number(this.element.getAttribute('height'));
if (
this.responsiveState_ != null &&
this.responsiveState_.isContainerWidthState()
) {
this.size_ = {width, height};
} else {
this.size_ = this.getIntersectionElementLayoutBox();
}
const sizeToSend = this.isSinglePageStoryAd
? {width: 1, height: 1}
: this.size_;
const format = `${sizeToSend.width}x${sizeToSend.height}`;
const slotId = this.element.getAttribute('data-amp-slot-index');
// data-amp-slot-index is set by the upgradeCallback method of amp-ad.
// TODO(bcassels): Uncomment the assertion, fixing the tests.
// But not all tests arrange to call upgradeCallback.
// devAssert(slotId != undefined);
const adk = this.adKey_(format);
this.uniqueSlotId_ = slotId + adk;
const slotname = this.element.getAttribute('data-ad-slot');
const sharedStateParams = sharedState.addNewSlot(
format,
this.uniqueSlotId_,
adClientId,
slotname
);
const viewportSize = this.getViewport().getSize();
if (!this.ifi_) {
this.win['ampAdGoogleIfiCounter'] =
this.win['ampAdGoogleIfiCounter'] || 1;
this.ifi_ = this.win['ampAdGoogleIfiCounter']++;
}
const enclosingContainers = getEnclosingContainerTypes(this.element);
const pfx =
enclosingContainers.includes(
ValidAdContainerTypes['AMP-FX-FLYING-CARPET']
) || enclosingContainers.includes(ValidAdContainerTypes['AMP-STICKY-AD']);
const parameters = {
'client': adClientId,
'format': format,
'w': sizeToSend.width,
'h': sizeToSend.height,
'iu': slotname,
'npa':
consentState == CONSENT_POLICY_STATE.INSUFFICIENT ||
consentState == CONSENT_POLICY_STATE.UNKNOWN
? 1
: null,
'adtest': adTestOn ? 'on' : null,
'adk': adk,
'output': 'html',
'bc': global.SVGElement && global.document.createElementNS ? '1' : null,
'ctypes': this.getCtypes_(),
'host': this.element.getAttribute('data-ad-host'),
'h_ch': this.element.getAttribute('data-ad-host-channel'),
'hl': this.element.getAttribute('data-language'),
'to': this.element.getAttribute('data-tag-origin'),
'pv': sharedStateParams.pv,
'channel': this.element.getAttribute('data-ad-channel'),
'wgl': global['WebGLRenderingContext'] ? '1' : '0',
'asnt': this.sentinel,
'dff': computedStyle(this.win, this.element)['font-family'],
'prev_fmts': sharedStateParams.prevFmts || null,
'prev_slotnames': sharedStateParams.prevSlotnames || null,
'brdim': additionalDimensions(this.win, viewportSize),
'ifi': this.ifi_,
'rc': this.fromResumeCallback ? 1 : null,
'rafmt':
this.responsiveState_ != null
? this.responsiveState_.getRafmtParam()
: null,
'gdpr': gdprApplies === true ? '1' : gdprApplies === false ? '0' : null,
'gdpr_consent': consentString,
'pfx': pfx ? '1' : '0',
'aanf': /^(true|false)$/i.test(this.element.getAttribute('data-no-fill'))
? this.element.getAttribute('data-no-fill')
: null,
// Matched content specific fields.
'crui': this.element.getAttribute('data-matched-content-ui-type'),
'cr_row': this.element.getAttribute('data-matched-content-rows-num'),
'cr_col': this.element.getAttribute('data-matched-content-columns-num'),
// Package code (also known as URL group) that was used to
// create ad.
'pwprc': this.element.getAttribute('data-package'),
'spsa': this.isSinglePageStoryAd
? `${viewportSize.width}x${viewportSize.height}`
: null,
};
const experimentIds = [];
const identityPromise = Services.timerFor(this.win)
.timeoutPromise(1000, this.identityTokenPromise_)
.catch((unusedErr) => {
// On error/timeout, proceed.
return /**@type {!../../../ads/google/a4a/utils.IdentityToken}*/ ({});
});
return identityPromise.then((identity) => {
return googleAdUrl(
this,
ADSENSE_BASE_URL,
startTime,
{
'adsid': identity.token || null,
'jar': identity.jar || null,
'pucrd': identity.pucrd || null,
...parameters,
},
!isInExperiment(
this.element,
ROUND_LOCATION_PARAMS_HOLDBACK_EXP.EXPERIMENT
),
experimentIds
);
});
}
/** @override */
onNetworkFailure(error, adUrl) {
dev().info(TAG, 'network error, attempt adding of error parameter', error);
return {adUrl: maybeAppendErrorParameter(adUrl, 'n')};
}
/** @override */
maybeValidateAmpCreative(bytes, headers) {
if (headers.get('AMP-Verification-Checksum-Algorithm') !== 'djb2a-32') {
return super.maybeValidateAmpCreative(bytes, headers);
}
const checksum = headers.get('AMP-Verification-Checksum');
return Promise.resolve(
checksum && stringHash32(utf8Decode(bytes)) == checksum ? bytes : null
);
}
/** @override */
extractSize(responseHeaders) {
this.ampAnalyticsConfig_ = extractAmpAnalyticsConfig(this, responseHeaders);
this.qqid_ = responseHeaders.get(QQID_HEADER);
this.shouldSandbox_ = responseHeaders.get(SANDBOX_HEADER) == 'true';
if (this.ampAnalyticsConfig_) {
// Load amp-analytics extensions
this.extensions_./*OK*/ installExtensionForDoc(
this.getAmpDoc(),
'amp-analytics'
);
}
return this.size_;
}
/**
* @param {string} format
* @return {string} The ad unit hash key string.
* @private
*/
adKey_(format) {
const {element} = this;
const slot = element.getAttribute('data-ad-slot') || '';
const string = `${slot}:${format}:${domFingerprintPlain(element)}`;
return stringHash32(string);
}
/**
* @return {?string}
* @private
*/
getCtypes_() {
if (!getMode().localDev) {
return null;
}
const ctypesReMatch = /[?&]force_a4a_ctypes=([^&]+)/.exec(
this.win.location.search
);
// If the RE passes, then length is necessarily > 1.
if (ctypesReMatch) {
return ctypesReMatch[1];
}
return null;
}
/** @override */
isXhrAllowed() {
return isCdnProxy(this.win);
}
/** @override */
sandboxHTMLCreativeFrame() {
return this.shouldSandbox_;
}
/** @override */
onCreativeRender(creativeMetaData) {
super.onCreativeRender(creativeMetaData);
if (this.iframe != null) {
ResponsiveState.maybeAttachSettingsListener(
this.element,
this.iframe,
this.getAdClientId_()
);
}
this.isAmpCreative_ = !!creativeMetaData;
if (
creativeMetaData &&
!creativeMetaData.customElementExtensions.includes('amp-ad-exit')
) {
// Capture phase click handlers on the ad if amp-ad-exit not present
// (assume it will handle capture).
devAssert(this.iframe);
Navigation.installAnchorClickInterceptor(
this.getAmpDoc(),
devAssert(this.iframe.contentWindow)
);
}
if (this.ampAnalyticsConfig_) {
devAssert(!this.ampAnalyticsElement_);
if (isReportingEnabled(this)) {
addCsiSignalsToAmpAnalyticsConfig(
this.win,
this.element,
this.ampAnalyticsConfig_,
this.qqid_,
!!creativeMetaData
);
}
this.ampAnalyticsElement_ = insertAnalyticsElement(
this.element,
this.ampAnalyticsConfig_,
/*loadAnalytics*/ true,
!!this.postAdResponseExperimentFeatures['avr_disable_immediate']
);
}
setStyles(dev().assertElement(this.iframe), {
width: `${this.size_.width}px`,
height: `${this.size_.height}px`,
});
if (this.qqid_) {
this.element.setAttribute('data-google-query-id', this.qqid_);
}
dev().assertElement(this.iframe).id = `google_ads_iframe_${this.ifi_}`;
}
/** @override */
unlayoutCallback() {
if (this.isAmpCreative_) {
// Allow AMP creatives to remain in case SERP viewer swipe back.
return false;
}
const superResult = super.unlayoutCallback();
this.element.setAttribute(
'data-amp-slot-index',
this.win.ampAdSlotIdCounter++
);
if (this.uniqueSlotId_) {
sharedState.removeSlot(this.uniqueSlotId_);
}
if (this.ampAnalyticsElement_) {
removeElement(this.ampAnalyticsElement_);
this.ampAnalyticsElement_ = null;
}
this.ampAnalyticsConfig_ = null;
this.qqid_ = null;
this.isAmpCreative_ = null;
this.shouldSandbox_ = false;
return superResult;
}
/** @override */
onLayoutMeasure() {
super.onLayoutMeasure();
this.responsiveState_ && this.responsiveState_.alignToViewport();
}
/** @override */
getPreconnectUrls() {
Services.preconnectFor(this.win).preload(
this.getAmpDoc(),
getDefaultBootstrapBaseUrl(this.win, 'nameframe')
);
return ['https://googleads.g.doubleclick.net'];
}
/** @override */
getA4aAnalyticsVars(analyticsTrigger) {
return getCsiAmpAnalyticsVariables(analyticsTrigger, this, this.qqid_);
}
/** @override */
getA4aAnalyticsConfig() {
return getCsiAmpAnalyticsConfig();
}
/** @override */
letCreativeTriggerRenderStart() {
if (
this.element &&
this.element.parentElement &&
this.element.parentElement.tagName == 'AMP-STICKY-AD'
) {
const stickyMsgListener = (event) => {
if (
getData(event) == 'fill_sticky' &&
event['source'] == this.iframe.contentWindow
) {
this.renderStarted();
setStyles(this.iframe, {'visibility': ''});
this.win.removeEventListener('message', stickyMsgListener);
}
};
this.win.addEventListener('message', stickyMsgListener);
return true;
}
return false;
}
}
AMP.extension(TAG, '0.1', (AMP) => {
AMP.registerElement(TAG, AmpAdNetworkAdsenseImpl);
});
|
angular.module('colorpicker.module', [])
.factory('Helper', function () {
'use strict';
return {
closestSlider: function (elem) {
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
if (matchesSelector.bind(elem)('I')) {
return elem.parentNode;
}
return elem;
},
getOffset: function (elem, fixedPosition) {
var
scrollX = 0,
scrollY = 0,
rect = elem.getBoundingClientRect();
while (elem && !isNaN(elem.offsetLeft) && !isNaN(elem.offsetTop)) {
if (!fixedPosition && elem.tagName === 'BODY') {
scrollX += document.documentElement.scrollLeft || elem.scrollLeft;
scrollY += document.documentElement.scrollTop || elem.scrollTop;
} else {
scrollX += elem.scrollLeft;
scrollY += elem.scrollTop;
}
elem = elem.offsetParent;
}
return {
top: rect.top + window.pageYOffset,
left: rect.left + window.pageXOffset,
scrollX: scrollX,
scrollY: scrollY
};
},
// a set of RE's that can match strings and generate color tuples. https://github.com/jquery/jquery-color/
stringParsers: [
{
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
parse: function (execResult) {
return [
execResult[1],
execResult[2],
execResult[3],
execResult[4]
];
}
},
{
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
parse: function (execResult) {
return [
2.55 * execResult[1],
2.55 * execResult[2],
2.55 * execResult[3],
execResult[4]
];
}
},
{
re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
parse: function (execResult) {
return [
parseInt(execResult[1], 16),
parseInt(execResult[2], 16),
parseInt(execResult[3], 16)
];
}
},
{
re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,
parse: function (execResult) {
return [
parseInt(execResult[1] + execResult[1], 16),
parseInt(execResult[2] + execResult[2], 16),
parseInt(execResult[3] + execResult[3], 16)
];
}
}
]
};
})
.factory('Color', ['Helper', function (Helper) {
'use strict';
return {
value: {
h: 1,
s: 1,
b: 1,
a: 1
},
// translate a format from Color object to a string
'rgb': function () {
var rgb = this.toRGB();
return 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';
},
'rgba': function () {
var rgb = this.toRGB();
return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + rgb.a + ')';
},
'hex': function () {
return this.toHex();
},
// HSBtoRGB from RaphaelJS
RGBtoHSB: function (r, g, b, a) {
r /= 255;
g /= 255;
b /= 255;
var H, S, V, C;
V = Math.max(r, g, b);
C = V - Math.min(r, g, b);
H = (C === 0 ? null :
V === r ? (g - b) / C :
V === g ? (b - r) / C + 2 :
(r - g) / C + 4
);
H = ((H + 360) % 6) * 60 / 360;
S = C === 0 ? 0 : C / V;
return {h: H || 1, s: S, b: V, a: a || 1};
},
//parse a string to HSB
setColor: function (val) {
val = (val) ? val.toLowerCase() : val;
for (var key in Helper.stringParsers) {
if (Helper.stringParsers.hasOwnProperty(key)) {
var parser = Helper.stringParsers[key];
var match = parser.re.exec(val),
values = match && parser.parse(match);
if (values) {
this.value = this.RGBtoHSB.apply(null, values);
return false;
}
}
}
},
setHue: function (h) {
this.value.h = 1 - h;
},
setSaturation: function (s) {
this.value.s = s;
},
setLightness: function (b) {
this.value.b = 1 - b;
},
setAlpha: function (a) {
this.value.a = parseInt((1 - a) * 100, 10) / 100;
},
// HSBtoRGB from RaphaelJS
// https://github.com/DmitryBaranovskiy/raphael/
toRGB: function (h, s, b, a) {
if (!h) {
h = this.value.h;
s = this.value.s;
b = this.value.b;
}
h *= 360;
var R, G, B, X, C;
h = (h % 360) / 60;
C = b * s;
X = C * (1 - Math.abs(h % 2 - 1));
R = G = B = b - C;
h = ~~h;
R += [C, X, 0, 0, X, C][h];
G += [X, C, C, X, 0, 0][h];
B += [0, 0, X, C, C, X][h];
return {
r: Math.round(R * 255),
g: Math.round(G * 255),
b: Math.round(B * 255),
a: a || this.value.a
};
},
toHex: function (h, s, b, a) {
var rgb = this.toRGB(h, s, b, a);
return '#' + ((1 << 24) | (parseInt(rgb.r, 10) << 16) | (parseInt(rgb.g, 10) << 8) | parseInt(rgb.b, 10)).toString(16).substr(1);
}
};
}])
.factory('Slider', ['Helper', function (Helper) {
'use strict';
var
slider = {
maxLeft: 0,
maxTop: 0,
callLeft: null,
callTop: null,
knob: {
top: 0,
left: 0
}
},
pointer = {};
return {
getSlider: function() {
return slider;
},
getLeftPosition: function(event) {
return Math.max(0, Math.min(slider.maxLeft, slider.left + ((event.pageX || pointer.left) - pointer.left)));
},
getTopPosition: function(event) {
return Math.max(0, Math.min(slider.maxTop, slider.top + ((event.pageY || pointer.top) - pointer.top)));
},
setSlider: function (event, fixedPosition) {
var
target = Helper.closestSlider(event.target),
targetOffset = Helper.getOffset(target, fixedPosition),
rect = target.getBoundingClientRect(),
offsetX = event.clientX - rect.left,
offsetY = event.clientY - rect.top;
slider.knob = target.children[0].style;
slider.left = event.pageX - targetOffset.left - window.pageXOffset + targetOffset.scrollX;
slider.top = event.pageY - targetOffset.top - window.pageYOffset + targetOffset.scrollY;
pointer = {
left: event.pageX - (offsetX - slider.left),
top: event.pageY - (offsetY - slider.top)
};
},
setSaturation: function(event, fixedPosition, componentSize) {
slider = {
maxLeft: componentSize,
maxTop: componentSize,
callLeft: 'setSaturation',
callTop: 'setLightness'
};
this.setSlider(event, fixedPosition);
},
setHue: function(event, fixedPosition, componentSize) {
slider = {
maxLeft: 0,
maxTop: componentSize,
callLeft: false,
callTop: 'setHue'
};
this.setSlider(event, fixedPosition);
},
setAlpha: function(event, fixedPosition, componentSize) {
slider = {
maxLeft: 0,
maxTop: componentSize,
callLeft: false,
callTop: 'setAlpha'
};
this.setSlider(event, fixedPosition);
},
setKnob: function(top, left) {
slider.knob.top = top + 'px';
slider.knob.left = left + 'px';
}
};
}])
.directive('colorpicker', ['$document', '$compile', 'Color', 'Slider', 'Helper', function ($document, $compile, Color, Slider, Helper) {
'use strict';
return {
require: '?ngModel',
restrict: 'A',
link: function ($scope, elem, attrs, ngModel) {
var
thisFormat = attrs.colorpicker ? attrs.colorpicker : 'hex',
position = angular.isDefined(attrs.colorpickerPosition) ? attrs.colorpickerPosition : 'bottom',
inline = angular.isDefined(attrs.colorpickerInline) ? attrs.colorpickerInline : false,
fixedPosition = angular.isDefined(attrs.colorpickerFixedPosition) ? attrs.colorpickerFixedPosition : false,
target = angular.isDefined(attrs.colorpickerParent) ? elem.parent() : angular.element(document.body),
withInput = angular.isDefined(attrs.colorpickerWithInput) ? attrs.colorpickerWithInput : false,
componentSize = angular.isDefined(attrs.colorpickerSize) ? attrs.colorpickerSize : 100,
componentSizePx = componentSize + 'px',
inputTemplate = withInput ? '<input type="text" name="colorpicker-input" spellcheck="false">' : '',
closeButton = !inline ? '<button type="button" class="close close-colorpicker">×</button>' : '',
template =
'<div class="colorpicker dropdown">' +
'<div class="dropdown-menu">' +
'<colorpicker-saturation><i></i></colorpicker-saturation>' +
'<colorpicker-hue><i></i></colorpicker-hue>' +
'<colorpicker-alpha><i></i></colorpicker-alpha>' +
'<colorpicker-preview></colorpicker-preview>' +
inputTemplate +
closeButton +
'</div>' +
'</div>',
colorpickerTemplate = angular.element(template),
pickerColor = Color,
colorpickerValue = {
h: 1,
s: 0,
b: 1,
a: 1
},
sliderAlpha,
sliderHue = colorpickerTemplate.find('colorpicker-hue'),
sliderSaturation = colorpickerTemplate.find('colorpicker-saturation'),
colorpickerPreview = colorpickerTemplate.find('colorpicker-preview'),
pickerColorPointers = colorpickerTemplate.find('i'),
componentWidthWithToolbars = parseInt(componentSize) + 29 + (thisFormat === 'rgba' ? 15 : 0),
componentHeightWithToolbars = parseInt(componentSize) + 55;
$compile(colorpickerTemplate)($scope);
colorpickerTemplate.css('min-width', componentWidthWithToolbars + 'px');
sliderSaturation.css({
'width' : componentSizePx,
'height' : componentSizePx
});
sliderHue.css('height', componentSizePx);
if (withInput) {
var pickerColorInput = colorpickerTemplate.find('input');
pickerColorInput.css('width', componentSizePx);
pickerColorInput
.on('mousedown', function(event) {
event.stopPropagation();
})
.on('keyup', function() {
var newColor = this.value;
elem.val(newColor);
if (ngModel && ngModel.$modelValue !== newColor) {
$scope.$apply(ngModel.$setViewValue(newColor));
update(true);
}
});
}
function bindMouseEvents() {
$document.on('mousemove', mousemove);
$document.on('mouseup', mouseup);
}
if (thisFormat === 'rgba') {
colorpickerTemplate.addClass('alpha');
sliderAlpha = colorpickerTemplate.find('colorpicker-alpha');
sliderAlpha.css('height', componentSizePx);
sliderAlpha
.on('click', function(event) {
Slider.setAlpha(event, fixedPosition, componentSize);
mousemove(event);
})
.on('mousedown', function(event) {
Slider.setAlpha(event, fixedPosition, componentSize);
bindMouseEvents();
})
.on('mouseup', function(event){
emitEvent('colorpicker-selected-alpha');
});
}
sliderHue
.on('click', function(event) {
Slider.setHue(event, fixedPosition, componentSize);
mousemove(event);
})
.on('mousedown', function(event) {
Slider.setHue(event, fixedPosition, componentSize);
bindMouseEvents();
})
.on('mouseup', function(event){
emitEvent('colorpicker-selected-hue');
});
sliderSaturation
.on('click', function(event) {
Slider.setSaturation(event, fixedPosition, componentSize);
mousemove(event);
if (angular.isDefined(attrs.colorpickerCloseOnSelect)) {
hideColorpickerTemplate();
}
})
.on('mousedown', function(event) {
Slider.setSaturation(event, fixedPosition, componentSize);
bindMouseEvents();
})
.on('mouseup', function(event){
emitEvent('colorpicker-selected-saturation');
});
if (fixedPosition) {
colorpickerTemplate.addClass('colorpicker-fixed-position');
}
colorpickerTemplate.addClass('colorpicker-position-' + position);
if (inline === 'true') {
colorpickerTemplate.addClass('colorpicker-inline');
}
target.append(colorpickerTemplate);
if (ngModel) {
ngModel.$render = function () {
elem.val(ngModel.$viewValue);
update();
};
}
elem.on('blur keyup change', function() {
update();
});
elem.on('$destroy', function() {
colorpickerTemplate.remove();
});
$scope.$on('$destroy', function () {
colorpickerTemplate.remove();
});
function previewColor() {
try {
colorpickerPreview.css('backgroundColor', pickerColor[thisFormat]());
} catch (e) {
colorpickerPreview.css('backgroundColor', pickerColor.toHex());
}
sliderSaturation.css('backgroundColor', pickerColor.toHex(pickerColor.value.h, 1, 1, 1));
if (thisFormat === 'rgba') {
sliderAlpha.css.backgroundColor = pickerColor.toHex();
}
}
function mousemove(event) {
var
left = Slider.getLeftPosition(event),
top = Slider.getTopPosition(event),
slider = Slider.getSlider();
Slider.setKnob(top, left);
if (slider.callLeft) {
pickerColor[slider.callLeft].call(pickerColor, left / componentSize);
}
if (slider.callTop) {
pickerColor[slider.callTop].call(pickerColor, top / componentSize);
}
previewColor();
var newColor = pickerColor[thisFormat]();
elem.val(newColor);
if (ngModel) {
$scope.$apply(ngModel.$setViewValue(newColor));
}
if (withInput) {
pickerColorInput.val(newColor);
}
return false;
}
function mouseup() {
emitEvent('colorpicker-selected');
$document.off('mousemove', mousemove);
$document.off('mouseup', mouseup);
}
function update(omitInnerInput) {
pickerColor.value = colorpickerValue;
pickerColor.setColor(elem.val());
if (withInput && !omitInnerInput) {
pickerColorInput.val(elem.val());
}
pickerColorPointers.eq(0).css({
left: pickerColor.value.s * componentSize + 'px',
top: componentSize - pickerColor.value.b * componentSize + 'px'
});
pickerColorPointers.eq(1).css('top', componentSize * (1 - pickerColor.value.h) + 'px');
pickerColorPointers.eq(2).css('top', componentSize * (1 - pickerColor.value.a) + 'px');
colorpickerValue = pickerColor.value;
previewColor();
}
function getColorpickerTemplatePosition() {
var
positionValue,
positionOffset = Helper.getOffset(elem[0]),
additionalSpaceBetweenElements = 2;
if(angular.isDefined(attrs.colorpickerParent)) {
positionOffset.left = 0;
positionOffset.top = 0;
}
if (position === 'top') {
positionValue = {
'top': positionOffset.top - componentHeightWithToolbars - additionalSpaceBetweenElements,
'left': positionOffset.left
};
} else if (position === 'right') {
positionValue = {
'top': positionOffset.top,
'left': positionOffset.left + elem[0].offsetWidth + additionalSpaceBetweenElements
};
} else if (position === 'bottom') {
positionValue = {
'top': positionOffset.top + elem[0].offsetHeight + additionalSpaceBetweenElements,
'left': positionOffset.left
};
} else if (position === 'left') {
positionValue = {
'top': positionOffset.top,
'left': positionOffset.left - componentWidthWithToolbars - additionalSpaceBetweenElements
};
}
return {
'top': positionValue.top + 'px',
'left': positionValue.left + 'px'
};
}
function documentMousedownHandler() {
hideColorpickerTemplate();
}
function showColorpickerTemplate() {
if (!colorpickerTemplate.hasClass('colorpicker-visible')) {
update();
colorpickerTemplate
.addClass('colorpicker-visible')
.css(getColorpickerTemplatePosition());
emitEvent('colorpicker-shown');
if (inline === false) {
// register global mousedown event to hide the colorpicker
$document.on('mousedown', documentMousedownHandler);
}
if (attrs.colorpickerIsOpen) {
$scope[attrs.colorpickerIsOpen] = true;
if (!$scope.$$phase && !$scope.$root.$$phase) {
$scope.$digest(); //trigger the watcher to fire
}
}
}
}
if (inline === false) {
elem.on('click', showColorpickerTemplate);
} else {
showColorpickerTemplate();
}
colorpickerTemplate.on('mousedown', function (event) {
event.stopPropagation();
event.preventDefault();
});
function emitEvent(name) {
if (ngModel) {
$scope.$emit(name, {
name: attrs.ngModel,
value: ngModel.$modelValue
});
}
}
function hideColorpickerTemplate() {
if (colorpickerTemplate.hasClass('colorpicker-visible')) {
colorpickerTemplate.removeClass('colorpicker-visible');
emitEvent('colorpicker-closed');
// unregister the global mousedown event
$document.off('mousedown', documentMousedownHandler);
if (attrs.colorpickerIsOpen) {
$scope[attrs.colorpickerIsOpen] = false;
if (!$scope.$$phase && !$scope.$root.$$phase) {
$scope.$digest(); //trigger the watcher to fire
}
}
}
}
colorpickerTemplate.find('button').on('click', function () {
hideColorpickerTemplate();
});
if (attrs.colorpickerIsOpen) {
$scope.$watch(attrs.colorpickerIsOpen, function(shouldBeOpen) {
if (shouldBeOpen === true) {
showColorpickerTemplate();
} else if (shouldBeOpen === false) {
hideColorpickerTemplate();
}
});
}
}
};
}]);
|
import { render, screen } from '@testing-library/react';
import Dialpad from './';
test('renders component', () => {
render(<Dialpad />);
expect(screen.getByTestId('dial-pad')).toBeInTheDocument()
});
|
module.exports = require("C:\\Users\\Ykss\\Desktop\\gatsby\\ykss-starter-blog\\src\\utils\\typography")
|
var searchData=
[
['waitcompletion',['waitCompletion',['../classfabgl_1_1_canvas_a0b366edca7302c95aa628529545453ea.html#a0b366edca7302c95aa628529545453ea',1,'fabgl::Canvas']]],
['waitfor',['waitFor',['../classfabgl_1_1_terminal_a27dbdfaa93b84ae587d92854e536a419.html#a27dbdfaa93b84ae587d92854e536a419',1,'fabgl::Terminal']]],
['warning',['Warning',['../group___enumerations_gaae85628862e3db5a13e7c21a90589c1d.html#ggaae85628862e3db5a13e7c21a90589c1da0eaadb4fcb48a0a0ed7bc9868be9fbaa',1,'fabgl']]],
['waveformgenerator',['WaveformGenerator',['../classfabgl_1_1_waveform_generator.html',1,'fabgl']]],
['wheelacceleration',['wheelAcceleration',['../classfabgl_1_1_mouse_a00d6c026ba77ca928bb12dbe7f61b13f.html#a00d6c026ba77ca928bb12dbe7f61b13f',1,'fabgl::Mouse']]],
['wheeldelta',['wheelDelta',['../structfabgl_1_1_mouse_status_ac1cf6a18b13ddfb1d9d76322097f3c0f.html#ac1cf6a18b13ddfb1d9d76322097f3c0f',1,'fabgl::MouseStatus']]],
['white',['White',['../group___enumerations_gab87bacfdad76e61b9412d7124be44c1c.html#ggab87bacfdad76e61b9412d7124be44c1cab548046646b36c12aa6ba841de500094',1,'fabgl']]],
['width',['width',['../structfabgl_1_1_glyph_a09a2a45f731b02946ff6d3cd15c1a476.html#a09a2a45f731b02946ff6d3cd15c1a476',1,'fabgl::Glyph::width()'],['../structfabgl_1_1_bitmap_ae0ffb42440f0305b6d22a1c6106b6e6f.html#ae0ffb42440f0305b6d22a1c6106b6e6f',1,'fabgl::Bitmap::width()'],['../structfabgl_1_1_size_ae0ffb42440f0305b6d22a1c6106b6e6f.html#ae0ffb42440f0305b6d22a1c6106b6e6f',1,'fabgl::Size::width()'],['../displaycontroller_8h_a09a2a45f731b02946ff6d3cd15c1a476.html#a09a2a45f731b02946ff6d3cd15c1a476',1,'width(): displaycontroller.h'],['../fabutils_8h_ae0ffb42440f0305b6d22a1c6106b6e6f.html#ae0ffb42440f0305b6d22a1c6106b6e6f',1,'width(): fabutils.h']]],
['window',['Window',['../group___enumerations_gae0a6bb526c02e563aee7e7ccd4df7212.html#ggae0a6bb526c02e563aee7e7ccd4df7212ac89686a387d2b12b3c729ce35a0bcb5b',1,'fabgl']]],
['windowprops',['windowProps',['../classfabgl_1_1ui_window_a9ed949007146977879a4d2a8a21044d4.html#a9ed949007146977879a4d2a8a21044d4',1,'fabgl::uiWindow']]],
['windowstyle',['windowStyle',['../classfabgl_1_1ui_window_a4beec167f802915f8b440aaaac8bbd29.html#a4beec167f802915f8b440aaaac8bbd29',1,'fabgl::uiWindow']]],
['write',['write',['../classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7',1,'fabgl::Terminal::write(const uint8_t *buffer, size_t size)'],['../classfabgl_1_1_terminal_a567dd45033d29f066653e6a26b92cbf4.html#a567dd45033d29f066653e6a26b92cbf4',1,'fabgl::Terminal::write(uint8_t c)'],['../classfabgl_1_1_i2_c_a5683609bed861f2c075c25d935029e3f.html#a5683609bed861f2c075c25d935029e3f',1,'fabgl::I2C::write()']]],
['writegpio',['writeGPIO',['../classfabgl_1_1_m_c_p23_s17_a1762512f6b6a1b4149af5778d048fa26.html#a1762512f6b6a1b4149af5778d048fa26',1,'fabgl::MCP23S17']]],
['writeport',['writePort',['../classfabgl_1_1_m_c_p23_s17_a18cd651a9bdeba442f663bbd4d6e746a.html#a18cd651a9bdeba442f663bbd4d6e746a',1,'fabgl::MCP23S17::writePort(int port, uint8_t value, uint8_t hwAddr=0)'],['../classfabgl_1_1_m_c_p23_s17_af463b8a2faf1c3ced7cce2b8fedc5fa0.html#af463b8a2faf1c3ced7cce2b8fedc5fa0',1,'fabgl::MCP23S17::writePort(int port, void const *buffer, size_t length, uint8_t hwAddr=0)']]],
['writeport16',['writePort16',['../classfabgl_1_1_m_c_p23_s17_a5b074f638d78ad71eb85b4eaa093e002.html#a5b074f638d78ad71eb85b4eaa093e002',1,'fabgl::MCP23S17']]],
['writereg',['writeReg',['../classfabgl_1_1_m_c_p23_s17_a757ff4f7b16a40109207981a8449b68b.html#a757ff4f7b16a40109207981a8449b68b',1,'fabgl::MCP23S17']]],
['writereg16',['writeReg16',['../classfabgl_1_1_m_c_p23_s17_a29921f863c2024cd62bb9596f93f9f0e.html#a29921f863c2024cd62bb9596f93f9f0e',1,'fabgl::MCP23S17']]],
['writescreen',['writeScreen',['../classfabgl_1_1_v_g_a_controller_aab70542bc1007b141bb2d6db3acbce02.html#aab70542bc1007b141bb2d6db3acbce02',1,'fabgl::VGAController']]]
];
|
// pages/column-news/column-news.js
'use strict';
const requests = require('../../libs/requests.js');
const btnFuncs = require('../../components/floating-button/page-funcs.js');
const cardFuncs = require('../../components/news-li/page-funcs.js');
Page({
data: {
column: '',
page: 1,
articlesList: [],
onGetColumnNews: false,
entirelyGet: false,
touch: {start:{X:0, Y:0}, end:{X:0, Y:0}},
moveAction: '',
},
onLoad(options) {
let column = decodeURIComponent(options.column);
wx.setNavigationBarTitle({
title: column,
});
this.setData({
column: column,
page: 1,
onGetColumnNews: false,
entirelyGet: false,
});
this.get_column_news();
},
onReachBottom() {
if (this.data.entirelyGet || this.data.page === 0) { // page = 0 说明 entirelyGet
this.setData({
entirelyGet: true, // 触发提示
});
} else {
this.get_column_news();
}
},
get_column_news(get_all=false) {
if (this.data.entirelyGet || this.data.page === 0 || this.onGetColumnNews) {
return;
};
this.setData({
onGetColumnNews: true,
});
wx.showNavigationBarLoading();
requests.post('/get_column_news',{
column: this.data.column,
page: get_all ? 0 : this.data.page, // get_all 则 page = 0
limit: 8,
}).then((data)=>{
let newArticles = data.news;
if (get_all) {
newArticles = cardFuncs.filterExisted.call(this, newArticles); // 去重
this.setData({
articlesList: this.data.articlesList.concat(newArticles),
page: 0,
onGetColumnNews: false,
});
} else {
this.setData({
articlesList: this.data.articlesList.concat(newArticles),
page: this.data.page + 1,
onGetColumnNews: false,
});
if (!data.news.length) {
this.setData({
entirelyGet: true,
});
};
};
wx.hideNavigationBarLoading();
}).catch((data)=>{
this.setData({
onGetColumnNews: false,
});
wx.hideNavigationBarLoading();
});
},
tapBtn_1() {
btnFuncs.feedback.call(this);
},
tapBtn_2() { // 时间排序
btnFuncs.sortedByTime.call(this);
},
tapBtn_3() { // 热度排序
btnFuncs.sortedByReadNum.call(this);
},
tapBtn_4() {
this.get_column_news(true);
},
tapBtn_5() {
btnFuncs.scrollToUpper.call(this);
},
handleTouchStart(event) {
btnFuncs.handleTouchStart.call(this, event);
},
handleTouchEnd(event) {
btnFuncs.handleTouchEnd.call(this, event);
},
})
|
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=115)}({115:function(e,n,t){"use strict";var r=!1;function o(){r||chrome.devtools.inspectedWindow.eval("!!(\n (window.__REACT_DEVTOOLS_GLOBAL_HOOK__ && Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length) || window.React\n )",function(e,n){e&&!r&&(clearInterval(i),r=!0,chrome.devtools.panels.create("React","","panel.html",function(e){var n=null;e.onShown.addListener(function(e){e.panel.getNewSelection(),(n=e.panel).resumeTransfer()}),e.onHidden.addListener(function(){n&&(n.hideHighlight(),n.pauseTransfer())})}))})}chrome.devtools.network.onNavigated.addListener(function(){o()});var i=setInterval(function(){o()},1e3);o()}});
|
import Phaser from 'phaser';
import CreditsScene from '../scenes/CreditsScene';
import 'jest-expect-subclass';
test('CreditScene should be a subclass of Phaser.Scene', () => {
expect(CreditsScene).toBeSubclassOf(Phaser.Scene);
});
|
/*! jQuery UI - v1.13.1 - 2022-04-07
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
$.ui = $.ui || {};
var version = $.ui.version = "1.13.1";
/*!
* jQuery UI Widget 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Widget
//>>group: Core
//>>description: Provides a factory for creating stateful widgets with a common API.
//>>docs: http://api.jqueryui.com/jQuery.widget/
//>>demos: http://jqueryui.com/widget/
var widgetUuid = 0;
var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
var widgetSlice = Array.prototype.slice;
$.cleanData = ( function( orig ) {
return function( elems ) {
var events, elem, i;
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
}
orig( elems );
};
} )( $.cleanData );
$.widget = function( name, base, prototype ) {
var existingConstructor, constructor, basePrototype;
// ProxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
var proxiedPrototype = {};
var namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
var fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
if ( Array.isArray( prototype ) ) {
prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
}
// Create selector for plugin
$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// Allow instantiation without "new" keyword
if ( !this || !this._createWidget ) {
return new constructor( options, element );
}
// Allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// Extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// Copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// Track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
} );
basePrototype = new base();
// We need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( typeof value !== "function" ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = ( function() {
function _super() {
return base.prototype[ prop ].apply( this, arguments );
}
function _superApply( args ) {
return base.prototype[ prop ].apply( this, args );
}
return function() {
var __super = this._super;
var __superApply = this._superApply;
var returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
} )();
} );
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
} );
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// Redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
child._proto );
} );
// Remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
}
$.widget.bridge( name, constructor );
return constructor;
};
$.widget.extend = function( target ) {
var input = widgetSlice.call( arguments, 1 );
var inputIndex = 0;
var inputLength = input.length;
var key;
var value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
}
}
}
}
return target;
};
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
var returnValue = this;
if ( isMethodCall ) {
// If this is an empty collection, we need to have the instance method
// return undefined instead of the jQuery instance
if ( !this.length && options === "instance" ) {
returnValue = undefined;
} else {
this.each( function() {
var methodValue;
var instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name +
" prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( typeof instance[ options ] !== "function" ||
options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name +
" widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
} );
}
} else {
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat( args ) );
}
this.each( function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} );
if ( instance._init ) {
instance._init();
}
} else {
$.data( this, fullName, new object( options, this ) );
}
} );
}
return returnValue;
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
classes: {},
disabled: false,
// Callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = widgetUuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.bindings = $();
this.hoverable = $();
this.focusable = $();
this.classesElementLookup = {};
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
} );
this.document = $( element.style ?
// Element within the document
element.ownerDocument :
// Element is window or document
element.document || element );
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
}
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
this._create();
if ( this.options.disabled ) {
this._setOptionDisabled( this.options.disabled );
}
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: function() {
return {};
},
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
var that = this;
this._destroy();
$.each( this.classesElementLookup, function( key, value ) {
that._removeClass( value, key );
} );
// We can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.off( this.eventNamespace )
.removeData( this.widgetFullName );
this.widget()
.off( this.eventNamespace )
.removeAttr( "aria-disabled" );
// Clean up events and states
this.bindings.off( this.eventNamespace );
},
_destroy: $.noop,
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key;
var parts;
var curOption;
var i;
if ( arguments.length === 0 ) {
// Don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
}
key = parts.pop();
if ( arguments.length === 1 ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
}
curOption[ key ] = value;
} else {
if ( arguments.length === 1 ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}
options[ key ] = value;
}
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
}
return this;
},
_setOption: function( key, value ) {
if ( key === "classes" ) {
this._setOptionClasses( value );
}
this.options[ key ] = value;
if ( key === "disabled" ) {
this._setOptionDisabled( value );
}
return this;
},
_setOptionClasses: function( value ) {
var classKey, elements, currentElements;
for ( classKey in value ) {
currentElements = this.classesElementLookup[ classKey ];
if ( value[ classKey ] === this.options.classes[ classKey ] ||
!currentElements ||
!currentElements.length ) {
continue;
}
// We are doing this to create a new jQuery object because the _removeClass() call
// on the next line is going to destroy the reference to the current elements being
// tracked. We need to save a copy of this collection so that we can add the new classes
// below.
elements = $( currentElements.get() );
this._removeClass( currentElements, classKey );
// We don't use _addClass() here, because that uses this.options.classes
// for generating the string of classes. We want to use the value passed in from
// _setOption(), this is the new value of the classes option which was passed to
// _setOption(). We pass this value directly to _classes().
elements.addClass( this._classes( {
element: elements,
keys: classKey,
classes: value,
add: true
} ) );
}
},
_setOptionDisabled: function( value ) {
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
// If the widget is becoming disabled, then nothing is interactive
if ( value ) {
this._removeClass( this.hoverable, null, "ui-state-hover" );
this._removeClass( this.focusable, null, "ui-state-focus" );
}
},
enable: function() {
return this._setOptions( { disabled: false } );
},
disable: function() {
return this._setOptions( { disabled: true } );
},
_classes: function( options ) {
var full = [];
var that = this;
options = $.extend( {
element: this.element,
classes: this.options.classes || {}
}, options );
function bindRemoveEvent() {
var nodesToBind = [];
options.element.each( function( _, element ) {
var isTracked = $.map( that.classesElementLookup, function( elements ) {
return elements;
} )
.some( function( elements ) {
return elements.is( element );
} );
if ( !isTracked ) {
nodesToBind.push( element );
}
} );
that._on( $( nodesToBind ), {
remove: "_untrackClassesElement"
} );
}
function processClassString( classes, checkOption ) {
var current, i;
for ( i = 0; i < classes.length; i++ ) {
current = that.classesElementLookup[ classes[ i ] ] || $();
if ( options.add ) {
bindRemoveEvent();
current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
} else {
current = $( current.not( options.element ).get() );
}
that.classesElementLookup[ classes[ i ] ] = current;
full.push( classes[ i ] );
if ( checkOption && options.classes[ classes[ i ] ] ) {
full.push( options.classes[ classes[ i ] ] );
}
}
}
if ( options.keys ) {
processClassString( options.keys.match( /\S+/g ) || [], true );
}
if ( options.extra ) {
processClassString( options.extra.match( /\S+/g ) || [] );
}
return full.join( " " );
},
_untrackClassesElement: function( event ) {
var that = this;
$.each( that.classesElementLookup, function( key, value ) {
if ( $.inArray( event.target, value ) !== -1 ) {
that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
}
} );
this._off( $( event.target ) );
},
_removeClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, false );
},
_addClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, true );
},
_toggleClass: function( element, keys, extra, add ) {
add = ( typeof add === "boolean" ) ? add : extra;
var shift = ( typeof element === "string" || element === null ),
options = {
extra: shift ? keys : extra,
keys: shift ? element : keys,
element: shift ? this.element : element,
add: add
};
options.element.toggleClass( this._classes( options ), add );
return this;
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement;
var instance = this;
// No suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// No element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// Allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// Copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^([\w:-]*)\s*(.*)$/ );
var eventName = match[ 1 ] + instance.eventNamespace;
var selector = match[ 2 ];
if ( selector ) {
delegateElement.on( eventName, selector, handlerProxy );
} else {
element.on( eventName, handlerProxy );
}
} );
},
_off: function( element, eventName ) {
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.off( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
this.focusable = $( this.focusable.not( element ).get() );
this.hoverable = $( this.hoverable.not( element ).get() );
},
_delay: function( handler, delay ) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
},
mouseleave: function( event ) {
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
}
} );
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
},
focusout: function( event ) {
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
}
} );
},
_trigger: function( type, event, data ) {
var prop, orig;
var callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// The original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// Copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
}
}
}
this.element.trigger( event, data );
return !( typeof callback === "function" &&
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions;
var effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
} else if ( options === true ) {
options = {};
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue( function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
} );
}
};
} );
var widget = $.widget;
/*!
* jQuery UI Position 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/position/
*/
//>>label: Position
//>>group: Core
//>>description: Positions elements relative to other elements.
//>>docs: http://api.jqueryui.com/position/
//>>demos: http://jqueryui.com/position/
( function() {
var cachedScrollbarWidth,
max = Math.max,
abs = Math.abs,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
function getOffsets( offsets, width, height ) {
return [
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
];
}
function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
function isWindow( obj ) {
return obj != null && obj === obj.window;
}
function getDimensions( elem ) {
var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: 0, left: 0 }
};
}
if ( isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
};
}
if ( raw.preventDefault ) {
return {
width: 0,
height: 0,
offset: { top: raw.pageY, left: raw.pageX }
};
}
return {
width: elem.outerWidth(),
height: elem.outerHeight(),
offset: elem.offset()
};
}
$.position = {
scrollbarWidth: function() {
if ( cachedScrollbarWidth !== undefined ) {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style=" +
"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
"<div style='height:300px;width:auto;'></div></div>" ),
innerDiv = div.children()[ 0 ];
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
div.css( "overflow", "scroll" );
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
w2 = div[ 0 ].clientWidth;
}
div.remove();
return ( cachedScrollbarWidth = w1 - w2 );
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-x" ),
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
};
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isElemWindow = isWindow( withinElement[ 0 ] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
hasOffset = !isElemWindow && !isDocument;
return {
element: withinElement,
isWindow: isElemWindow,
isDocument: isDocument,
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: withinElement.outerWidth(),
height: withinElement.outerHeight()
};
}
};
$.fn.position = function( options ) {
if ( !options || !options.of ) {
return _position.apply( this, arguments );
}
// Make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
// Make sure string options are treated as CSS selectors
target = typeof options.of === "string" ?
$( document ).find( options.of ) :
$( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
dimensions = getDimensions( target );
if ( target[ 0 ].preventDefault ) {
// Force left top to allow flipping
options.at = "left top";
}
targetWidth = dimensions.width;
targetHeight = dimensions.height;
targetOffset = dimensions.offset;
// Clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
// Force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each( [ "my", "at" ], function() {
var pos = ( options[ this ] || "" ).split( " " ),
horizontalOffset,
verticalOffset;
if ( pos.length === 1 ) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
[ "center" ].concat( pos ) :
[ "center", "center" ];
}
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
// Calculate offsets
horizontalOffset = roffset.exec( pos[ 0 ] );
verticalOffset = roffset.exec( pos[ 1 ] );
offsets[ this ] = [
horizontalOffset ? horizontalOffset[ 0 ] : 0,
verticalOffset ? verticalOffset[ 0 ] : 0
];
// Reduce to just the positions without the offsets
options[ this ] = [
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
} );
// Normalize collision option
if ( collision.length === 1 ) {
collision[ 1 ] = collision[ 0 ];
}
if ( options.at[ 0 ] === "right" ) {
basePosition.left += targetWidth;
} else if ( options.at[ 0 ] === "center" ) {
basePosition.left += targetWidth / 2;
}
if ( options.at[ 1 ] === "bottom" ) {
basePosition.top += targetHeight;
} else if ( options.at[ 1 ] === "center" ) {
basePosition.top += targetHeight / 2;
}
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
return this.each( function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseCss( this, "marginLeft" ),
marginTop = parseCss( this, "marginTop" ),
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
scrollInfo.height,
position = $.extend( {}, basePosition ),
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
if ( options.my[ 0 ] === "right" ) {
position.left -= elemWidth;
} else if ( options.my[ 0 ] === "center" ) {
position.left -= elemWidth / 2;
}
if ( options.my[ 1 ] === "bottom" ) {
position.top -= elemHeight;
} else if ( options.my[ 1 ] === "center" ) {
position.top -= elemHeight / 2;
}
position.left += myOffset[ 0 ];
position.top += myOffset[ 1 ];
collisionPosition = {
marginLeft: marginLeft,
marginTop: marginTop
};
$.each( [ "left", "top" ], function( i, dir ) {
if ( $.ui.position[ collision[ i ] ] ) {
$.ui.position[ collision[ i ] ][ dir ]( position, {
targetWidth: targetWidth,
targetHeight: targetHeight,
elemWidth: elemWidth,
elemHeight: elemHeight,
collisionPosition: collisionPosition,
collisionWidth: collisionWidth,
collisionHeight: collisionHeight,
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
within: within,
elem: elem
} );
}
} );
if ( options.using ) {
// Adds feedback as second argument to using callback, if present
using = function( props ) {
var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth,
top = targetOffset.top - position.top,
bottom = top + targetHeight - elemHeight,
feedback = {
target: {
element: target,
left: targetOffset.left,
top: targetOffset.top,
width: targetWidth,
height: targetHeight
},
element: {
element: elem,
left: position.left,
top: position.top,
width: elemWidth,
height: elemHeight
},
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
};
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
feedback.horizontal = "center";
}
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
feedback.vertical = "middle";
}
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
feedback.important = "horizontal";
} else {
feedback.important = "vertical";
}
options.using.call( this, props, feedback );
};
}
elem.offset( $.extend( position, { using: using } ) );
} );
};
$.ui.position = {
fit: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
outerWidth = within.width,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = withinOffset - collisionPosLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
// Element is wider than within
if ( data.collisionWidth > outerWidth ) {
// Element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
withinOffset;
position.left += overLeft - newOverRight;
// Element is initially over right side of within
} else if ( overRight > 0 && overLeft <= 0 ) {
position.left = withinOffset;
// Element is initially over both left and right sides of within
} else {
if ( overLeft > overRight ) {
position.left = withinOffset + outerWidth - data.collisionWidth;
} else {
position.left = withinOffset;
}
}
// Too far left -> align with left edge
} else if ( overLeft > 0 ) {
position.left += overLeft;
// Too far right -> align with right edge
} else if ( overRight > 0 ) {
position.left -= overRight;
// Adjust based on position and margin
} else {
position.left = max( position.left - collisionPosLeft, position.left );
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
outerHeight = data.within.height,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = withinOffset - collisionPosTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
// Element is taller than within
if ( data.collisionHeight > outerHeight ) {
// Element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
withinOffset;
position.top += overTop - newOverBottom;
// Element is initially over bottom of within
} else if ( overBottom > 0 && overTop <= 0 ) {
position.top = withinOffset;
// Element is initially over both top and bottom of within
} else {
if ( overTop > overBottom ) {
position.top = withinOffset + outerHeight - data.collisionHeight;
} else {
position.top = withinOffset;
}
}
// Too far up -> align with top
} else if ( overTop > 0 ) {
position.top += overTop;
// Too far down -> align with bottom edge
} else if ( overBottom > 0 ) {
position.top -= overBottom;
// Adjust based on position and margin
} else {
position.top = max( position.top - collisionPosTop, position.top );
}
}
},
flip: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = collisionPosLeft - offsetLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
data.my[ 0 ] === "right" ?
data.elemWidth :
0,
atOffset = data.at[ 0 ] === "left" ?
data.targetWidth :
data.at[ 0 ] === "right" ?
-data.targetWidth :
0,
offset = -2 * data.offset[ 0 ],
newOverRight,
newOverLeft;
if ( overLeft < 0 ) {
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
outerWidth - withinOffset;
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset;
}
} else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset;
}
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.offset.top + within.scrollTop,
outerHeight = within.height,
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = collisionPosTop - offsetTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top = data.my[ 1 ] === "top",
myOffset = top ?
-data.elemHeight :
data.my[ 1 ] === "bottom" ?
data.elemHeight :
0,
atOffset = data.at[ 1 ] === "top" ?
data.targetHeight :
data.at[ 1 ] === "bottom" ?
-data.targetHeight :
0,
offset = -2 * data.offset[ 1 ],
newOverTop,
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
outerHeight - withinOffset;
if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
position.top += myOffset + atOffset + offset;
}
} else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
offset - offsetTop;
if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
position.top += myOffset + atOffset + offset;
}
}
}
},
flipfit: {
left: function() {
$.ui.position.flip.left.apply( this, arguments );
$.ui.position.fit.left.apply( this, arguments );
},
top: function() {
$.ui.position.flip.top.apply( this, arguments );
$.ui.position.fit.top.apply( this, arguments );
}
}
};
} )();
var position = $.ui.position;
/*!
* jQuery UI :data 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :data Selector
//>>group: Core
//>>description: Selects elements which have data stored under the specified key.
//>>docs: http://api.jqueryui.com/data-selector/
var data = $.extend( $.expr.pseudos, {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
} ) :
// Support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
}
} );
/*!
* jQuery UI Disable Selection 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: disableSelection
//>>group: Core
//>>description: Disable selection of text content within the set of matched elements.
//>>docs: http://api.jqueryui.com/disableSelection/
// This file is deprecated
var disableSelection = $.fn.extend( {
disableSelection: ( function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.on( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
} );
};
} )(),
enableSelection: function() {
return this.off( ".ui-disableSelection" );
}
} );
/*!
* jQuery UI Focusable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :focusable Selector
//>>group: Core
//>>description: Selects elements which can be focused.
//>>docs: http://api.jqueryui.com/focusable-selector/
// Selectors
$.ui.focusable = function( element, hasTabindex ) {
var map, mapName, img, focusableIfVisible, fieldset,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap='#" + mapName + "']" );
return img.length > 0 && img.is( ":visible" );
}
if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
focusableIfVisible = !element.disabled;
if ( focusableIfVisible ) {
// Form controls within a disabled fieldset are disabled.
// However, controls within the fieldset's legend do not get disabled.
// Since controls generally aren't placed inside legends, we skip
// this portion of the check.
fieldset = $( element ).closest( "fieldset" )[ 0 ];
if ( fieldset ) {
focusableIfVisible = !fieldset.disabled;
}
}
} else if ( "a" === nodeName ) {
focusableIfVisible = element.href || hasTabindex;
} else {
focusableIfVisible = hasTabindex;
}
return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
};
// Support: IE 8 only
// IE 8 doesn't resolve inherit to visible/hidden for computed values
function visible( element ) {
var visibility = element.css( "visibility" );
while ( visibility === "inherit" ) {
element = element.parent();
visibility = element.css( "visibility" );
}
return visibility === "visible";
}
$.extend( $.expr.pseudos, {
focusable: function( element ) {
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
}
} );
var focusable = $.ui.focusable;
// Support: IE8 Only
// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
// with a string, so we need to find the proper form.
var form = $.fn._form = function() {
return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
};
/*!
* jQuery UI Form Reset Mixin 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Form Reset Mixin
//>>group: Core
//>>description: Refresh input widgets when their form is reset
//>>docs: http://api.jqueryui.com/form-reset-mixin/
var formResetMixin = $.ui.formResetMixin = {
_formResetHandler: function() {
var form = $( this );
// Wait for the form reset to actually happen before refreshing
setTimeout( function() {
var instances = form.data( "ui-form-reset-instances" );
$.each( instances, function() {
this.refresh();
} );
} );
},
_bindFormResetHandler: function() {
this.form = this.element._form();
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" ) || [];
if ( !instances.length ) {
// We don't use _on() here because we use a single event handler per form
this.form.on( "reset.ui-form-reset", this._formResetHandler );
}
instances.push( this );
this.form.data( "ui-form-reset-instances", instances );
},
_unbindFormResetHandler: function() {
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" );
instances.splice( $.inArray( this, instances ), 1 );
if ( instances.length ) {
this.form.data( "ui-form-reset-instances", instances );
} else {
this.form
.removeData( "ui-form-reset-instances" )
.off( "reset.ui-form-reset" );
}
}
};
/*!
* jQuery UI Support for jQuery core 1.8.x and newer 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
*/
//>>label: jQuery 1.8+ Support
//>>group: Core
//>>description: Support version 1.8.x and newer of jQuery core
// Support: jQuery 1.9.x or older
// $.expr[ ":" ] is deprecated.
if ( !$.expr.pseudos ) {
$.expr.pseudos = $.expr[ ":" ];
}
// Support: jQuery 1.11.x or older
// $.unique has been renamed to $.uniqueSort
if ( !$.uniqueSort ) {
$.uniqueSort = $.unique;
}
// Support: jQuery 2.2.x or older.
// This method has been defined in jQuery 3.0.0.
// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
if ( !$.escapeSelector ) {
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
var fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
};
$.escapeSelector = function( sel ) {
return ( sel + "" ).replace( rcssescape, fcssescape );
};
}
// Support: jQuery 3.4.x or older
// These methods have been defined in jQuery 3.5.0.
if ( !$.fn.even || !$.fn.odd ) {
$.fn.extend( {
even: function() {
return this.filter( function( i ) {
return i % 2 === 0;
} );
},
odd: function() {
return this.filter( function( i ) {
return i % 2 === 1;
} );
}
} );
}
;
/*!
* jQuery UI Keycode 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Keycode
//>>group: Core
//>>description: Provide keycodes as keynames
//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
var keycode = $.ui.keyCode = {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
};
/*!
* jQuery UI Labels 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: labels
//>>group: Core
//>>description: Find all the labels associated with a given input
//>>docs: http://api.jqueryui.com/labels/
var labels = $.fn.labels = function() {
var ancestor, selector, id, labels, ancestors;
if ( !this.length ) {
return this.pushStack( [] );
}
// Check control.labels first
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
return this.pushStack( this[ 0 ].labels );
}
// Support: IE <= 11, FF <= 37, Android <= 2.3 only
// Above browsers do not support control.labels. Everything below is to support them
// as well as document fragments. control.labels does not work on document fragments
labels = this.eq( 0 ).parents( "label" );
// Look for the label based on the id
id = this.attr( "id" );
if ( id ) {
// We don't search against the document in case the element
// is disconnected from the DOM
ancestor = this.eq( 0 ).parents().last();
// Get a full set of top level ancestors
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
// Create a selector for the label based on the id
selector = "label[for='" + $.escapeSelector( id ) + "']";
labels = labels.add( ancestors.find( selector ).addBack( selector ) );
}
// Return whatever we have found for labels
return this.pushStack( labels );
};
/*!
* jQuery UI Scroll Parent 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: scrollParent
//>>group: Core
//>>description: Get the closest ancestor element that is scrollable.
//>>docs: http://api.jqueryui.com/scrollParent/
var scrollParent = $.fn.scrollParent = function( includeHidden ) {
var position = this.css( "position" ),
excludeStaticParent = position === "absolute",
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
scrollParent = this.parents().filter( function() {
var parent = $( this );
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
return false;
}
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
parent.css( "overflow-x" ) );
} ).eq( 0 );
return position === "fixed" || !scrollParent.length ?
$( this[ 0 ].ownerDocument || document ) :
scrollParent;
};
/*!
* jQuery UI Tabbable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :tabbable Selector
//>>group: Core
//>>description: Selects elements which can be tabbed to.
//>>docs: http://api.jqueryui.com/tabbable-selector/
var tabbable = $.extend( $.expr.pseudos, {
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
hasTabindex = tabIndex != null;
return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
}
} );
/*!
* jQuery UI Unique ID 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: uniqueId
//>>group: Core
//>>description: Functions to generate and remove uniqueId's
//>>docs: http://api.jqueryui.com/uniqueId/
var uniqueId = $.fn.extend( {
uniqueId: ( function() {
var uuid = 0;
return function() {
return this.each( function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
} );
};
} )(),
removeUniqueId: function() {
return this.each( function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
} );
}
} );
// This file is deprecated
var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
/*!
* jQuery UI Mouse 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Mouse
//>>group: Widgets
//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
//>>docs: http://api.jqueryui.com/mouse/
var mouseHandled = false;
$( document ).on( "mouseup", function() {
mouseHandled = false;
} );
var widgetsMouse = $.widget( "ui.mouse", {
version: "1.13.1",
options: {
cancel: "input, textarea, button, select, option",
distance: 1,
delay: 0
},
_mouseInit: function() {
var that = this;
this.element
.on( "mousedown." + this.widgetName, function( event ) {
return that._mouseDown( event );
} )
.on( "click." + this.widgetName, function( event ) {
if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, that.widgetName + ".preventClickEvent" );
event.stopImmediatePropagation();
return false;
}
} );
this.started = false;
},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.off( "." + this.widgetName );
if ( this._mouseMoveDelegate ) {
this.document
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
}
},
_mouseDown: function( event ) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
}
this._mouseMoved = false;
// We may have missed mouseup (out of window)
if ( this._mouseStarted ) {
this._mouseUp( event );
}
this._mouseDownEvent = event;
var that = this,
btnIsLeft = ( event.which === 1 ),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
$( event.target ).closest( this.options.cancel ).length : false );
if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
return true;
}
this.mouseDelayMet = !this.options.delay;
if ( !this.mouseDelayMet ) {
this._mouseDelayTimer = setTimeout( function() {
that.mouseDelayMet = true;
}, this.options.delay );
}
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted = ( this._mouseStart( event ) !== false );
if ( !this._mouseStarted ) {
event.preventDefault();
return true;
}
}
// Click event may never have fired (Gecko & Opera)
if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, this.widgetName + ".preventClickEvent" );
}
// These delegates are required to keep context
this._mouseMoveDelegate = function( event ) {
return that._mouseMove( event );
};
this._mouseUpDelegate = function( event ) {
return that._mouseUp( event );
};
this.document
.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
mouseHandled = true;
return true;
},
_mouseMove: function( event ) {
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if ( this._mouseMoved ) {
// IE mouseup check - mouseup happened when mouse was out of window
if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
!event.button ) {
return this._mouseUp( event );
// Iframe mouseup check - mouseup occurred in another document
} else if ( !event.which ) {
// Support: Safari <=8 - 9
// Safari sets which to 0 if you press any of the following keys
// during a drag (#14461)
if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
this.ignoreMissingWhich = true;
} else if ( !this.ignoreMissingWhich ) {
return this._mouseUp( event );
}
}
}
if ( event.which || event.button ) {
this._mouseMoved = true;
}
if ( this._mouseStarted ) {
this._mouseDrag( event );
return event.preventDefault();
}
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted =
( this._mouseStart( this._mouseDownEvent, event ) !== false );
if ( this._mouseStarted ) {
this._mouseDrag( event );
} else {
this._mouseUp( event );
}
}
return !this._mouseStarted;
},
_mouseUp: function( event ) {
this.document
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
if ( this._mouseStarted ) {
this._mouseStarted = false;
if ( event.target === this._mouseDownEvent.target ) {
$.data( event.target, this.widgetName + ".preventClickEvent", true );
}
this._mouseStop( event );
}
if ( this._mouseDelayTimer ) {
clearTimeout( this._mouseDelayTimer );
delete this._mouseDelayTimer;
}
this.ignoreMissingWhich = false;
mouseHandled = false;
event.preventDefault();
},
_mouseDistanceMet: function( event ) {
return ( Math.max(
Math.abs( this._mouseDownEvent.pageX - event.pageX ),
Math.abs( this._mouseDownEvent.pageY - event.pageY )
) >= this.options.distance
);
},
_mouseDelayMet: function( /* event */ ) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart: function( /* event */ ) {},
_mouseDrag: function( /* event */ ) {},
_mouseStop: function( /* event */ ) {},
_mouseCapture: function( /* event */ ) {
return true;
}
} );
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
var plugin = $.ui.plugin = {
add: function( module, option, set ) {
var i,
proto = $.ui[ module ].prototype;
for ( i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args, allowDisconnected ) {
var i,
set = instance.plugins[ name ];
if ( !set ) {
return;
}
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
return;
}
for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
}
}
};
var safeActiveElement = $.ui.safeActiveElement = function( document ) {
var activeElement;
// Support: IE 9 only
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
activeElement = document.activeElement;
} catch ( error ) {
activeElement = document.body;
}
// Support: IE 9 - 11 only
// IE may return null instead of an element
// Interestingly, this only seems to occur when NOT in an iframe
if ( !activeElement ) {
activeElement = document.body;
}
// Support: IE 11 only
// IE11 returns a seemingly empty object in some cases when accessing
// document.activeElement from an <iframe>
if ( !activeElement.nodeName ) {
activeElement = document.body;
}
return activeElement;
};
var safeBlur = $.ui.safeBlur = function( element ) {
// Support: IE9 - 10 only
// If the <body> is blurred, IE will switch windows, see #9420
if ( element && element.nodeName.toLowerCase() !== "body" ) {
$( element ).trigger( "blur" );
}
};
/*!
* jQuery UI Draggable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Draggable
//>>group: Interactions
//>>description: Enables dragging functionality for any element.
//>>docs: http://api.jqueryui.com/draggable/
//>>demos: http://jqueryui.com/draggable/
//>>css.structure: ../../themes/base/draggable.css
$.widget( "ui.draggable", $.ui.mouse, {
version: "1.13.1",
widgetEventPrefix: "drag",
options: {
addClasses: true,
appendTo: "parent",
axis: false,
connectToSortable: false,
containment: false,
cursor: "auto",
cursorAt: false,
grid: false,
handle: false,
helper: "original",
iframeFix: false,
opacity: false,
refreshPositions: false,
revert: false,
revertDuration: 500,
scope: "default",
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
snap: false,
snapMode: "both",
snapTolerance: 20,
stack: false,
zIndex: false,
// Callbacks
drag: null,
start: null,
stop: null
},
_create: function() {
if ( this.options.helper === "original" ) {
this._setPositionRelative();
}
if ( this.options.addClasses ) {
this._addClass( "ui-draggable" );
}
this._setHandleClassName();
this._mouseInit();
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "handle" ) {
this._removeHandleClassName();
this._setHandleClassName();
}
},
_destroy: function() {
if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
this.destroyOnClear = true;
return;
}
this._removeHandleClassName();
this._mouseDestroy();
},
_mouseCapture: function( event ) {
var o = this.options;
// Among others, prevent a drag on a resizable-handle
if ( this.helper || o.disabled ||
$( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
return false;
}
//Quit if we're not on a valid handle
this.handle = this._getHandle( event );
if ( !this.handle ) {
return false;
}
this._blurActiveElement( event );
this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
return true;
},
_blockFrames: function( selector ) {
this.iframeBlocks = this.document.find( selector ).map( function() {
var iframe = $( this );
return $( "<div>" )
.css( "position", "absolute" )
.appendTo( iframe.parent() )
.outerWidth( iframe.outerWidth() )
.outerHeight( iframe.outerHeight() )
.offset( iframe.offset() )[ 0 ];
} );
},
_unblockFrames: function() {
if ( this.iframeBlocks ) {
this.iframeBlocks.remove();
delete this.iframeBlocks;
}
},
_blurActiveElement: function( event ) {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
target = $( event.target );
// Don't blur if the event occurred on an element that is within
// the currently focused element
// See #10527, #12472
if ( target.closest( activeElement ).length ) {
return;
}
// Blur any element that currently has focus, see #4261
$.ui.safeBlur( activeElement );
},
_mouseStart: function( event ) {
var o = this.options;
//Create and append the visible helper
this.helper = this._createHelper( event );
this._addClass( this.helper, "ui-draggable-dragging" );
//Cache the helper size
this._cacheHelperProportions();
//If ddmanager is used for droppables, set the global draggable
if ( $.ui.ddmanager ) {
$.ui.ddmanager.current = this;
}
/*
* - Position generation -
* This block generates everything position related - it's the core of draggables.
*/
//Cache the margins of the original element
this._cacheMargins();
//Store the helper's css position
this.cssPosition = this.helper.css( "position" );
this.scrollParent = this.helper.scrollParent( true );
this.offsetParent = this.helper.offsetParent();
this.hasFixedAncestor = this.helper.parents().filter( function() {
return $( this ).css( "position" ) === "fixed";
} ).length > 0;
//The element's absolute position on the page minus margins
this.positionAbs = this.element.offset();
this._refreshOffsets( event );
//Generate the original position
this.originalPosition = this.position = this._generatePosition( event, false );
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
if ( o.cursorAt ) {
this._adjustOffsetFromHelper( o.cursorAt );
}
//Set a containment if given in the options
this._setContainment();
//Trigger event + callbacks
if ( this._trigger( "start", event ) === false ) {
this._clear();
return false;
}
//Recache the helper size
this._cacheHelperProportions();
//Prepare the droppable offsets
if ( $.ui.ddmanager && !o.dropBehaviour ) {
$.ui.ddmanager.prepareOffsets( this, event );
}
// Execute the drag once - this causes the helper not to be visible before getting its
// correct position
this._mouseDrag( event, true );
// If the ddmanager is used for droppables, inform the manager that dragging has started
// (see #5003)
if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStart( this, event );
}
return true;
},
_refreshOffsets: function( event ) {
this.offset = {
top: this.positionAbs.top - this.margins.top,
left: this.positionAbs.left - this.margins.left,
scroll: false,
parent: this._getParentOffset(),
relative: this._getRelativeOffset()
};
this.offset.click = {
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
};
},
_mouseDrag: function( event, noPropagation ) {
// reset any necessary cached properties (see #5009)
if ( this.hasFixedAncestor ) {
this.offset.parent = this._getParentOffset();
}
//Compute the helpers position
this.position = this._generatePosition( event, true );
this.positionAbs = this._convertPositionTo( "absolute" );
//Call plugins and callbacks and use the resulting position if something is returned
if ( !noPropagation ) {
var ui = this._uiHash();
if ( this._trigger( "drag", event, ui ) === false ) {
this._mouseUp( new $.Event( "mouseup", event ) );
return false;
}
this.position = ui.position;
}
this.helper[ 0 ].style.left = this.position.left + "px";
this.helper[ 0 ].style.top = this.position.top + "px";
if ( $.ui.ddmanager ) {
$.ui.ddmanager.drag( this, event );
}
return false;
},
_mouseStop: function( event ) {
//If we are using droppables, inform the manager about the drop
var that = this,
dropped = false;
if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
dropped = $.ui.ddmanager.drop( this, event );
}
//if a drop comes from outside (a sortable)
if ( this.dropped ) {
dropped = this.dropped;
this.dropped = false;
}
if ( ( this.options.revert === "invalid" && !dropped ) ||
( this.options.revert === "valid" && dropped ) ||
this.options.revert === true || ( typeof this.options.revert === "function" &&
this.options.revert.call( this.element, dropped ) )
) {
$( this.helper ).animate(
this.originalPosition,
parseInt( this.options.revertDuration, 10 ),
function() {
if ( that._trigger( "stop", event ) !== false ) {
that._clear();
}
}
);
} else {
if ( this._trigger( "stop", event ) !== false ) {
this._clear();
}
}
return false;
},
_mouseUp: function( event ) {
this._unblockFrames();
// If the ddmanager is used for droppables, inform the manager that dragging has stopped
// (see #5003)
if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStop( this, event );
}
// Only need to focus if the event occurred on the draggable itself, see #10527
if ( this.handleElement.is( event.target ) ) {
// The interaction is over; whether or not the click resulted in a drag,
// focus the element
this.element.trigger( "focus" );
}
return $.ui.mouse.prototype._mouseUp.call( this, event );
},
cancel: function() {
if ( this.helper.is( ".ui-draggable-dragging" ) ) {
this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
} else {
this._clear();
}
return this;
},
_getHandle: function( event ) {
return this.options.handle ?
!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
true;
},
_setHandleClassName: function() {
this.handleElement = this.options.handle ?
this.element.find( this.options.handle ) : this.element;
this._addClass( this.handleElement, "ui-draggable-handle" );
},
_removeHandleClassName: function() {
this._removeClass( this.handleElement, "ui-draggable-handle" );
},
_createHelper: function( event ) {
var o = this.options,
helperIsFunction = typeof o.helper === "function",
helper = helperIsFunction ?
$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
( o.helper === "clone" ?
this.element.clone().removeAttr( "id" ) :
this.element );
if ( !helper.parents( "body" ).length ) {
helper.appendTo( ( o.appendTo === "parent" ?
this.element[ 0 ].parentNode :
o.appendTo ) );
}
// Http://bugs.jqueryui.com/ticket/9446
// a helper function can return the original element
// which wouldn't have been set to relative in _create
if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
this._setPositionRelative();
}
if ( helper[ 0 ] !== this.element[ 0 ] &&
!( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
helper.css( "position", "absolute" );
}
return helper;
},
_setPositionRelative: function() {
if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
this.element[ 0 ].style.position = "relative";
}
},
_adjustOffsetFromHelper: function( obj ) {
if ( typeof obj === "string" ) {
obj = obj.split( " " );
}
if ( Array.isArray( obj ) ) {
obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
}
if ( "left" in obj ) {
this.offset.click.left = obj.left + this.margins.left;
}
if ( "right" in obj ) {
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
}
if ( "top" in obj ) {
this.offset.click.top = obj.top + this.margins.top;
}
if ( "bottom" in obj ) {
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
}
},
_isRootNode: function( element ) {
return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
},
_getParentOffset: function() {
//Get the offsetParent and cache its position
var po = this.offsetParent.offset(),
document = this.document[ 0 ];
// This is a special case where we need to modify a offset calculated on start, since the
// following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the
// next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
// the document, which means that the scroll is included in the initial calculation of the
// offset of the parent, and never recalculated upon drag
if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
po = { top: 0, left: 0 };
}
return {
top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
};
},
_getRelativeOffset: function() {
if ( this.cssPosition !== "relative" ) {
return { top: 0, left: 0 };
}
var p = this.element.position(),
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
return {
top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
};
},
_cacheMargins: function() {
this.margins = {
left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var isUserScrollable, c, ce,
o = this.options,
document = this.document[ 0 ];
this.relativeContainer = null;
if ( !o.containment ) {
this.containment = null;
return;
}
if ( o.containment === "window" ) {
this.containment = [
$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
$( window ).scrollLeft() + $( window ).width() -
this.helperProportions.width - this.margins.left,
$( window ).scrollTop() +
( $( window ).height() || document.body.parentNode.scrollHeight ) -
this.helperProportions.height - this.margins.top
];
return;
}
if ( o.containment === "document" ) {
this.containment = [
0,
0,
$( document ).width() - this.helperProportions.width - this.margins.left,
( $( document ).height() || document.body.parentNode.scrollHeight ) -
this.helperProportions.height - this.margins.top
];
return;
}
if ( o.containment.constructor === Array ) {
this.containment = o.containment;
return;
}
if ( o.containment === "parent" ) {
o.containment = this.helper[ 0 ].parentNode;
}
c = $( o.containment );
ce = c[ 0 ];
if ( !ce ) {
return;
}
isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
this.containment = [
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
this.helperProportions.width -
this.margins.left -
this.margins.right,
( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
this.helperProportions.height -
this.margins.top -
this.margins.bottom
];
this.relativeContainer = c;
},
_convertPositionTo: function( d, pos ) {
if ( !pos ) {
pos = this.position;
}
var mod = d === "absolute" ? 1 : -1,
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
return {
top: (
// The absolute mouse position
pos.top +
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.top * mod +
// The offsetParent's offset without borders (offset + border)
this.offset.parent.top * mod -
( ( this.cssPosition === "fixed" ?
-this.offset.scroll.top :
( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
),
left: (
// The absolute mouse position
pos.left +
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.left * mod +
// The offsetParent's offset without borders (offset + border)
this.offset.parent.left * mod -
( ( this.cssPosition === "fixed" ?
-this.offset.scroll.left :
( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
)
};
},
_generatePosition: function( event, constrainPosition ) {
var containment, co, top, left,
o = this.options,
scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
pageX = event.pageX,
pageY = event.pageY;
// Cache the scroll
if ( !scrollIsRootNode || !this.offset.scroll ) {
this.offset.scroll = {
top: this.scrollParent.scrollTop(),
left: this.scrollParent.scrollLeft()
};
}
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
// If we are not dragging yet, we won't check for options
if ( constrainPosition ) {
if ( this.containment ) {
if ( this.relativeContainer ) {
co = this.relativeContainer.offset();
containment = [
this.containment[ 0 ] + co.left,
this.containment[ 1 ] + co.top,
this.containment[ 2 ] + co.left,
this.containment[ 3 ] + co.top
];
} else {
containment = this.containment;
}
if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
pageX = containment[ 0 ] + this.offset.click.left;
}
if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
pageY = containment[ 1 ] + this.offset.click.top;
}
if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
pageX = containment[ 2 ] + this.offset.click.left;
}
if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
pageY = containment[ 3 ] + this.offset.click.top;
}
}
if ( o.grid ) {
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid
// argument errors in IE (see ticket #6950)
top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
top - this.offset.click.top > containment[ 3 ] ) ?
top :
( ( top - this.offset.click.top >= containment[ 1 ] ) ?
top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
left = o.grid[ 0 ] ? this.originalPageX +
Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
this.originalPageX;
pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
left - this.offset.click.left > containment[ 2 ] ) ?
left :
( ( left - this.offset.click.left >= containment[ 0 ] ) ?
left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
}
if ( o.axis === "y" ) {
pageX = this.originalPageX;
}
if ( o.axis === "x" ) {
pageY = this.originalPageY;
}
}
return {
top: (
// The absolute mouse position
pageY -
// Click offset (relative to the element)
this.offset.click.top -
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.top -
// The offsetParent's offset without borders (offset + border)
this.offset.parent.top +
( this.cssPosition === "fixed" ?
-this.offset.scroll.top :
( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
),
left: (
// The absolute mouse position
pageX -
// Click offset (relative to the element)
this.offset.click.left -
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.left -
// The offsetParent's offset without borders (offset + border)
this.offset.parent.left +
( this.cssPosition === "fixed" ?
-this.offset.scroll.left :
( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
)
};
},
_clear: function() {
this._removeClass( this.helper, "ui-draggable-dragging" );
if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
this.helper.remove();
}
this.helper = null;
this.cancelHelperRemoval = false;
if ( this.destroyOnClear ) {
this.destroy();
}
},
// From now on bulk stuff - mainly helpers
_trigger: function( type, event, ui ) {
ui = ui || this._uiHash();
$.ui.plugin.call( this, type, [ event, ui, this ], true );
// Absolute position and offset (see #6884 ) have to be recalculated after plugins
if ( /^(drag|start|stop)/.test( type ) ) {
this.positionAbs = this._convertPositionTo( "absolute" );
ui.offset = this.positionAbs;
}
return $.Widget.prototype._trigger.call( this, type, event, ui );
},
plugins: {},
_uiHash: function() {
return {
helper: this.helper,
position: this.position,
originalPosition: this.originalPosition,
offset: this.positionAbs
};
}
} );
$.ui.plugin.add( "draggable", "connectToSortable", {
start: function( event, ui, draggable ) {
var uiSortable = $.extend( {}, ui, {
item: draggable.element
} );
draggable.sortables = [];
$( draggable.options.connectToSortable ).each( function() {
var sortable = $( this ).sortable( "instance" );
if ( sortable && !sortable.options.disabled ) {
draggable.sortables.push( sortable );
// RefreshPositions is called at drag start to refresh the containerCache
// which is used in drag. This ensures it's initialized and synchronized
// with any changes that might have happened on the page since initialization.
sortable.refreshPositions();
sortable._trigger( "activate", event, uiSortable );
}
} );
},
stop: function( event, ui, draggable ) {
var uiSortable = $.extend( {}, ui, {
item: draggable.element
} );
draggable.cancelHelperRemoval = false;
$.each( draggable.sortables, function() {
var sortable = this;
if ( sortable.isOver ) {
sortable.isOver = 0;
// Allow this sortable to handle removing the helper
draggable.cancelHelperRemoval = true;
sortable.cancelHelperRemoval = false;
// Use _storedCSS To restore properties in the sortable,
// as this also handles revert (#9675) since the draggable
// may have modified them in unexpected ways (#8809)
sortable._storedCSS = {
position: sortable.placeholder.css( "position" ),
top: sortable.placeholder.css( "top" ),
left: sortable.placeholder.css( "left" )
};
sortable._mouseStop( event );
// Once drag has ended, the sortable should return to using
// its original helper, not the shared helper from draggable
sortable.options.helper = sortable.options._helper;
} else {
// Prevent this Sortable from removing the helper.
// However, don't set the draggable to remove the helper
// either as another connected Sortable may yet handle the removal.
sortable.cancelHelperRemoval = true;
sortable._trigger( "deactivate", event, uiSortable );
}
} );
},
drag: function( event, ui, draggable ) {
$.each( draggable.sortables, function() {
var innermostIntersecting = false,
sortable = this;
// Copy over variables that sortable's _intersectsWith uses
sortable.positionAbs = draggable.positionAbs;
sortable.helperProportions = draggable.helperProportions;
sortable.offset.click = draggable.offset.click;
if ( sortable._intersectsWith( sortable.containerCache ) ) {
innermostIntersecting = true;
$.each( draggable.sortables, function() {
// Copy over variables that sortable's _intersectsWith uses
this.positionAbs = draggable.positionAbs;
this.helperProportions = draggable.helperProportions;
this.offset.click = draggable.offset.click;
if ( this !== sortable &&
this._intersectsWith( this.containerCache ) &&
$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
innermostIntersecting = false;
}
return innermostIntersecting;
} );
}
if ( innermostIntersecting ) {
// If it intersects, we use a little isOver variable and set it once,
// so that the move-in stuff gets fired only once.
if ( !sortable.isOver ) {
sortable.isOver = 1;
// Store draggable's parent in case we need to reappend to it later.
draggable._parent = ui.helper.parent();
sortable.currentItem = ui.helper
.appendTo( sortable.element )
.data( "ui-sortable-item", true );
// Store helper option to later restore it
sortable.options._helper = sortable.options.helper;
sortable.options.helper = function() {
return ui.helper[ 0 ];
};
// Fire the start events of the sortable with our passed browser event,
// and our own helper (so it doesn't create a new one)
event.target = sortable.currentItem[ 0 ];
sortable._mouseCapture( event, true );
sortable._mouseStart( event, true, true );
// Because the browser event is way off the new appended portlet,
// modify necessary variables to reflect the changes
sortable.offset.click.top = draggable.offset.click.top;
sortable.offset.click.left = draggable.offset.click.left;
sortable.offset.parent.left -= draggable.offset.parent.left -
sortable.offset.parent.left;
sortable.offset.parent.top -= draggable.offset.parent.top -
sortable.offset.parent.top;
draggable._trigger( "toSortable", event );
// Inform draggable that the helper is in a valid drop zone,
// used solely in the revert option to handle "valid/invalid".
draggable.dropped = sortable.element;
// Need to refreshPositions of all sortables in the case that
// adding to one sortable changes the location of the other sortables (#9675)
$.each( draggable.sortables, function() {
this.refreshPositions();
} );
// Hack so receive/update callbacks work (mostly)
draggable.currentItem = draggable.element;
sortable.fromOutside = draggable;
}
if ( sortable.currentItem ) {
sortable._mouseDrag( event );
// Copy the sortable's position because the draggable's can potentially reflect
// a relative position, while sortable is always absolute, which the dragged
// element has now become. (#8809)
ui.position = sortable.position;
}
} else {
// If it doesn't intersect with the sortable, and it intersected before,
// we fake the drag stop of the sortable, but make sure it doesn't remove
// the helper by using cancelHelperRemoval.
if ( sortable.isOver ) {
sortable.isOver = 0;
sortable.cancelHelperRemoval = true;
// Calling sortable's mouseStop would trigger a revert,
// so revert must be temporarily false until after mouseStop is called.
sortable.options._revert = sortable.options.revert;
sortable.options.revert = false;
sortable._trigger( "out", event, sortable._uiHash( sortable ) );
sortable._mouseStop( event, true );
// Restore sortable behaviors that were modfied
// when the draggable entered the sortable area (#9481)
sortable.options.revert = sortable.options._revert;
sortable.options.helper = sortable.options._helper;
if ( sortable.placeholder ) {
sortable.placeholder.remove();
}
// Restore and recalculate the draggable's offset considering the sortable
// may have modified them in unexpected ways. (#8809, #10669)
ui.helper.appendTo( draggable._parent );
draggable._refreshOffsets( event );
ui.position = draggable._generatePosition( event, true );
draggable._trigger( "fromSortable", event );
// Inform draggable that the helper is no longer in a valid drop zone
draggable.dropped = false;
// Need to refreshPositions of all sortables just in case removing
// from one sortable changes the location of other sortables (#9675)
$.each( draggable.sortables, function() {
this.refreshPositions();
} );
}
}
} );
}
} );
$.ui.plugin.add( "draggable", "cursor", {
start: function( event, ui, instance ) {
var t = $( "body" ),
o = instance.options;
if ( t.css( "cursor" ) ) {
o._cursor = t.css( "cursor" );
}
t.css( "cursor", o.cursor );
},
stop: function( event, ui, instance ) {
var o = instance.options;
if ( o._cursor ) {
$( "body" ).css( "cursor", o._cursor );
}
}
} );
$.ui.plugin.add( "draggable", "opacity", {
start: function( event, ui, instance ) {
var t = $( ui.helper ),
o = instance.options;
if ( t.css( "opacity" ) ) {
o._opacity = t.css( "opacity" );
}
t.css( "opacity", o.opacity );
},
stop: function( event, ui, instance ) {
var o = instance.options;
if ( o._opacity ) {
$( ui.helper ).css( "opacity", o._opacity );
}
}
} );
$.ui.plugin.add( "draggable", "scroll", {
start: function( event, ui, i ) {
if ( !i.scrollParentNotHidden ) {
i.scrollParentNotHidden = i.helper.scrollParent( false );
}
if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
i.overflowOffset = i.scrollParentNotHidden.offset();
}
},
drag: function( event, ui, i ) {
var o = i.options,
scrolled = false,
scrollParent = i.scrollParentNotHidden[ 0 ],
document = i.document[ 0 ];
if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
if ( !o.axis || o.axis !== "x" ) {
if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
o.scrollSensitivity ) {
scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
}
}
if ( !o.axis || o.axis !== "y" ) {
if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
o.scrollSensitivity ) {
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
}
}
} else {
if ( !o.axis || o.axis !== "x" ) {
if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
} else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
o.scrollSensitivity ) {
scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
}
}
if ( !o.axis || o.axis !== "y" ) {
if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
scrolled = $( document ).scrollLeft(
$( document ).scrollLeft() - o.scrollSpeed
);
} else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
o.scrollSensitivity ) {
scrolled = $( document ).scrollLeft(
$( document ).scrollLeft() + o.scrollSpeed
);
}
}
}
if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
$.ui.ddmanager.prepareOffsets( i, event );
}
}
} );
$.ui.plugin.add( "draggable", "snap", {
start: function( event, ui, i ) {
var o = i.options;
i.snapElements = [];
$( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
.each( function() {
var $t = $( this ),
$o = $t.offset();
if ( this !== i.element[ 0 ] ) {
i.snapElements.push( {
item: this,
width: $t.outerWidth(), height: $t.outerHeight(),
top: $o.top, left: $o.left
} );
}
} );
},
drag: function( event, ui, inst ) {
var ts, bs, ls, rs, l, r, t, b, i, first,
o = inst.options,
d = o.snapTolerance,
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
l = inst.snapElements[ i ].left - inst.margins.left;
r = l + inst.snapElements[ i ].width;
t = inst.snapElements[ i ].top - inst.margins.top;
b = t + inst.snapElements[ i ].height;
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
!$.contains( inst.snapElements[ i ].item.ownerDocument,
inst.snapElements[ i ].item ) ) {
if ( inst.snapElements[ i ].snapping ) {
if ( inst.options.snap.release ) {
inst.options.snap.release.call(
inst.element,
event,
$.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
);
}
}
inst.snapElements[ i ].snapping = false;
continue;
}
if ( o.snapMode !== "inner" ) {
ts = Math.abs( t - y2 ) <= d;
bs = Math.abs( b - y1 ) <= d;
ls = Math.abs( l - x2 ) <= d;
rs = Math.abs( r - x1 ) <= d;
if ( ts ) {
ui.position.top = inst._convertPositionTo( "relative", {
top: t - inst.helperProportions.height,
left: 0
} ).top;
}
if ( bs ) {
ui.position.top = inst._convertPositionTo( "relative", {
top: b,
left: 0
} ).top;
}
if ( ls ) {
ui.position.left = inst._convertPositionTo( "relative", {
top: 0,
left: l - inst.helperProportions.width
} ).left;
}
if ( rs ) {
ui.position.left = inst._convertPositionTo( "relative", {
top: 0,
left: r
} ).left;
}
}
first = ( ts || bs || ls || rs );
if ( o.snapMode !== "outer" ) {
ts = Math.abs( t - y1 ) <= d;
bs = Math.abs( b - y2 ) <= d;
ls = Math.abs( l - x1 ) <= d;
rs = Math.abs( r - x2 ) <= d;
if ( ts ) {
ui.position.top = inst._convertPositionTo( "relative", {
top: t,
left: 0
} ).top;
}
if ( bs ) {
ui.position.top = inst._convertPositionTo( "relative", {
top: b - inst.helperProportions.height,
left: 0
} ).top;
}
if ( ls ) {
ui.position.left = inst._convertPositionTo( "relative", {
top: 0,
left: l
} ).left;
}
if ( rs ) {
ui.position.left = inst._convertPositionTo( "relative", {
top: 0,
left: r - inst.helperProportions.width
} ).left;
}
}
if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
if ( inst.options.snap.snap ) {
inst.options.snap.snap.call(
inst.element,
event,
$.extend( inst._uiHash(), {
snapItem: inst.snapElements[ i ].item
} ) );
}
}
inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
}
}
} );
$.ui.plugin.add( "draggable", "stack", {
start: function( event, ui, instance ) {
var min,
o = instance.options,
group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
} );
if ( !group.length ) {
return;
}
min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
$( group ).each( function( i ) {
$( this ).css( "zIndex", min + i );
} );
this.css( "zIndex", ( min + group.length ) );
}
} );
$.ui.plugin.add( "draggable", "zIndex", {
start: function( event, ui, instance ) {
var t = $( ui.helper ),
o = instance.options;
if ( t.css( "zIndex" ) ) {
o._zIndex = t.css( "zIndex" );
}
t.css( "zIndex", o.zIndex );
},
stop: function( event, ui, instance ) {
var o = instance.options;
if ( o._zIndex ) {
$( ui.helper ).css( "zIndex", o._zIndex );
}
}
} );
var widgetsDraggable = $.ui.draggable;
/*!
* jQuery UI Droppable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Droppable
//>>group: Interactions
//>>description: Enables drop targets for draggable elements.
//>>docs: http://api.jqueryui.com/droppable/
//>>demos: http://jqueryui.com/droppable/
$.widget( "ui.droppable", {
version: "1.13.1",
widgetEventPrefix: "drop",
options: {
accept: "*",
addClasses: true,
greedy: false,
scope: "default",
tolerance: "intersect",
// Callbacks
activate: null,
deactivate: null,
drop: null,
out: null,
over: null
},
_create: function() {
var proportions,
o = this.options,
accept = o.accept;
this.isover = false;
this.isout = true;
this.accept = typeof accept === "function" ? accept : function( d ) {
return d.is( accept );
};
this.proportions = function( /* valueToWrite */ ) {
if ( arguments.length ) {
// Store the droppable's proportions
proportions = arguments[ 0 ];
} else {
// Retrieve or derive the droppable's proportions
return proportions ?
proportions :
proportions = {
width: this.element[ 0 ].offsetWidth,
height: this.element[ 0 ].offsetHeight
};
}
};
this._addToManager( o.scope );
if ( o.addClasses ) {
this._addClass( "ui-droppable" );
}
},
_addToManager: function( scope ) {
// Add the reference and positions to the manager
$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
$.ui.ddmanager.droppables[ scope ].push( this );
},
_splice: function( drop ) {
var i = 0;
for ( ; i < drop.length; i++ ) {
if ( drop[ i ] === this ) {
drop.splice( i, 1 );
}
}
},
_destroy: function() {
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
this._splice( drop );
},
_setOption: function( key, value ) {
if ( key === "accept" ) {
this.accept = typeof value === "function" ? value : function( d ) {
return d.is( value );
};
} else if ( key === "scope" ) {
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
this._splice( drop );
this._addToManager( value );
}
this._super( key, value );
},
_activate: function( event ) {
var draggable = $.ui.ddmanager.current;
this._addActiveClass();
if ( draggable ) {
this._trigger( "activate", event, this.ui( draggable ) );
}
},
_deactivate: function( event ) {
var draggable = $.ui.ddmanager.current;
this._removeActiveClass();
if ( draggable ) {
this._trigger( "deactivate", event, this.ui( draggable ) );
}
},
_over: function( event ) {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._addHoverClass();
this._trigger( "over", event, this.ui( draggable ) );
}
},
_out: function( event ) {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._removeHoverClass();
this._trigger( "out", event, this.ui( draggable ) );
}
},
_drop: function( event, custom ) {
var draggable = custom || $.ui.ddmanager.current,
childrenIntersection = false;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return false;
}
this.element
.find( ":data(ui-droppable)" )
.not( ".ui-draggable-dragging" )
.each( function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call(
inst.element[ 0 ], ( draggable.currentItem || draggable.element )
) &&
$.ui.intersect(
draggable,
$.extend( inst, { offset: inst.element.offset() } ),
inst.options.tolerance, event
)
) {
childrenIntersection = true;
return false;
}
} );
if ( childrenIntersection ) {
return false;
}
if ( this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this._removeActiveClass();
this._removeHoverClass();
this._trigger( "drop", event, this.ui( draggable ) );
return this.element;
}
return false;
},
ui: function( c ) {
return {
draggable: ( c.currentItem || c.element ),
helper: c.helper,
position: c.position,
offset: c.positionAbs
};
},
// Extension points just to make backcompat sane and avoid duplicating logic
// TODO: Remove in 1.14 along with call to it below
_addHoverClass: function() {
this._addClass( "ui-droppable-hover" );
},
_removeHoverClass: function() {
this._removeClass( "ui-droppable-hover" );
},
_addActiveClass: function() {
this._addClass( "ui-droppable-active" );
},
_removeActiveClass: function() {
this._removeClass( "ui-droppable-active" );
}
} );
$.ui.intersect = ( function() {
function isOverAxis( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
}
return function( draggable, droppable, toleranceMode, event ) {
if ( !droppable.offset ) {
return false;
}
var x1 = ( draggable.positionAbs ||
draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs ||
draggable.position.absolute ).top + draggable.margins.top,
x2 = x1 + draggable.helperProportions.width,
y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left,
t = droppable.offset.top,
r = l + droppable.proportions().width,
b = t + droppable.proportions().height;
switch ( toleranceMode ) {
case "fit":
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
case "intersect":
return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
( y2 >= t && y2 <= b ) || // Bottom edge touching
( y1 < t && y2 > b ) // Surrounded vertically
) && (
( x1 >= l && x1 <= r ) || // Left edge touching
( x2 >= l && x2 <= r ) || // Right edge touching
( x1 < l && x2 > r ) // Surrounded horizontally
);
default:
return false;
}
};
} )();
/*
This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
current: null,
droppables: { "default": [] },
prepareOffsets: function( t, event ) {
var i, j,
m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
type = event ? event.type : null, // workaround for #2317
list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
droppablesLoop: for ( i = 0; i < m.length; i++ ) {
// No disabled and non-accepted
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
( t.currentItem || t.element ) ) ) ) {
continue;
}
// Filter out elements in the current dragged item
for ( j = 0; j < list.length; j++ ) {
if ( list[ j ] === m[ i ].element[ 0 ] ) {
m[ i ].proportions().height = 0;
continue droppablesLoop;
}
}
m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
if ( !m[ i ].visible ) {
continue;
}
// Activate the droppable if used directly from draggables
if ( type === "mousedown" ) {
m[ i ]._activate.call( m[ i ], event );
}
m[ i ].offset = m[ i ].element.offset();
m[ i ].proportions( {
width: m[ i ].element[ 0 ].offsetWidth,
height: m[ i ].element[ 0 ].offsetHeight
} );
}
},
drop: function( draggable, event ) {
var dropped = false;
// Create a copy of the droppables in case the list changes during the drop (#9116)
$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
if ( !this.options ) {
return;
}
if ( !this.options.disabled && this.visible &&
$.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
dropped = this._drop.call( this, event ) || dropped;
}
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this.isout = true;
this.isover = false;
this._deactivate.call( this, event );
}
} );
return dropped;
},
dragStart: function( draggable, event ) {
// Listen for scrolling so that if the dragging causes scrolling the position of the
// droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
} );
},
drag: function( draggable, event ) {
// If you have a highly dynamic page, you might try this option. It renders positions
// every time you move the mouse.
if ( draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
// Run through all droppables and check their positions based on specific tolerance options
$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
if ( this.options.disabled || this.greedyChild || !this.visible ) {
return;
}
var parentInstance, scope, parent,
intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
c = !intersects && this.isover ?
"isout" :
( intersects && !this.isover ? "isover" : null );
if ( !c ) {
return;
}
if ( this.options.greedy ) {
// find droppable parents with same scope
scope = this.options.scope;
parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
return $( this ).droppable( "instance" ).options.scope === scope;
} );
if ( parent.length ) {
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
parentInstance.greedyChild = ( c === "isover" );
}
}
// We just moved into a greedy child
if ( parentInstance && c === "isover" ) {
parentInstance.isover = false;
parentInstance.isout = true;
parentInstance._out.call( parentInstance, event );
}
this[ c ] = true;
this[ c === "isout" ? "isover" : "isout" ] = false;
this[ c === "isover" ? "_over" : "_out" ].call( this, event );
// We just moved out of a greedy child
if ( parentInstance && c === "isout" ) {
parentInstance.isout = false;
parentInstance.isover = true;
parentInstance._over.call( parentInstance, event );
}
} );
},
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
// Call prepareOffsets one final time since IE does not fire return scroll events when
// overflow was caused by drag (see #5003)
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
}
};
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for activeClass and hoverClass options
$.widget( "ui.droppable", $.ui.droppable, {
options: {
hoverClass: false,
activeClass: false
},
_addActiveClass: function() {
this._super();
if ( this.options.activeClass ) {
this.element.addClass( this.options.activeClass );
}
},
_removeActiveClass: function() {
this._super();
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
},
_addHoverClass: function() {
this._super();
if ( this.options.hoverClass ) {
this.element.addClass( this.options.hoverClass );
}
},
_removeHoverClass: function() {
this._super();
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
}
} );
}
var widgetsDroppable = $.ui.droppable;
/*!
* jQuery UI Resizable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Resizable
//>>group: Interactions
//>>description: Enables resize functionality for any element.
//>>docs: http://api.jqueryui.com/resizable/
//>>demos: http://jqueryui.com/resizable/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/resizable.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.resizable", $.ui.mouse, {
version: "1.13.1",
widgetEventPrefix: "resize",
options: {
alsoResize: false,
animate: false,
animateDuration: "slow",
animateEasing: "swing",
aspectRatio: false,
autoHide: false,
classes: {
"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
},
containment: false,
ghost: false,
grid: false,
handles: "e,s,se",
helper: false,
maxHeight: null,
maxWidth: null,
minHeight: 10,
minWidth: 10,
// See #7960
zIndex: 90,
// Callbacks
resize: null,
start: null,
stop: null
},
_num: function( value ) {
return parseFloat( value ) || 0;
},
_isNumber: function( value ) {
return !isNaN( parseFloat( value ) );
},
_hasScroll: function( el, a ) {
if ( $( el ).css( "overflow" ) === "hidden" ) {
return false;
}
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
has = false;
if ( el[ scroll ] > 0 ) {
return true;
}
// TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to
// set the scroll
try {
el[ scroll ] = 1;
has = ( el[ scroll ] > 0 );
el[ scroll ] = 0;
} catch ( e ) {
// `el` might be a string, then setting `scroll` will throw
// an error in strict mode; ignore it.
}
return has;
},
_create: function() {
var margins,
o = this.options,
that = this;
this._addClass( "ui-resizable" );
$.extend( this, {
_aspectRatio: !!( o.aspectRatio ),
aspectRatio: o.aspectRatio,
originalElement: this.element,
_proportionallyResizeElements: [],
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
} );
// Wrap the element if it cannot hold child nodes
if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
this.element.wrap(
$( "<div class='ui-wrapper'></div>" ).css( {
overflow: "hidden",
position: this.element.css( "position" ),
width: this.element.outerWidth(),
height: this.element.outerHeight(),
top: this.element.css( "top" ),
left: this.element.css( "left" )
} )
);
this.element = this.element.parent().data(
"ui-resizable", this.element.resizable( "instance" )
);
this.elementIsWrapper = true;
margins = {
marginTop: this.originalElement.css( "marginTop" ),
marginRight: this.originalElement.css( "marginRight" ),
marginBottom: this.originalElement.css( "marginBottom" ),
marginLeft: this.originalElement.css( "marginLeft" )
};
this.element.css( margins );
this.originalElement.css( "margin", 0 );
// support: Safari
// Prevent Safari textarea resize
this.originalResizeStyle = this.originalElement.css( "resize" );
this.originalElement.css( "resize", "none" );
this._proportionallyResizeElements.push( this.originalElement.css( {
position: "static",
zoom: 1,
display: "block"
} ) );
// Support: IE9
// avoid IE jump (hard set the margin)
this.originalElement.css( margins );
this._proportionallyResize();
}
this._setupHandles();
if ( o.autoHide ) {
$( this.element )
.on( "mouseenter", function() {
if ( o.disabled ) {
return;
}
that._removeClass( "ui-resizable-autohide" );
that._handles.show();
} )
.on( "mouseleave", function() {
if ( o.disabled ) {
return;
}
if ( !that.resizing ) {
that._addClass( "ui-resizable-autohide" );
that._handles.hide();
}
} );
}
this._mouseInit();
},
_destroy: function() {
this._mouseDestroy();
this._addedHandles.remove();
var wrapper,
_destroy = function( exp ) {
$( exp )
.removeData( "resizable" )
.removeData( "ui-resizable" )
.off( ".resizable" );
};
// TODO: Unwrap at same DOM position
if ( this.elementIsWrapper ) {
_destroy( this.element );
wrapper = this.element;
this.originalElement.css( {
position: wrapper.css( "position" ),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
top: wrapper.css( "top" ),
left: wrapper.css( "left" )
} ).insertAfter( wrapper );
wrapper.remove();
}
this.originalElement.css( "resize", this.originalResizeStyle );
_destroy( this.originalElement );
return this;
},
_setOption: function( key, value ) {
this._super( key, value );
switch ( key ) {
case "handles":
this._removeHandles();
this._setupHandles();
break;
case "aspectRatio":
this._aspectRatio = !!value;
break;
default:
break;
}
},
_setupHandles: function() {
var o = this.options, handle, i, n, hname, axis, that = this;
this.handles = o.handles ||
( !$( ".ui-resizable-handle", this.element ).length ?
"e,s,se" : {
n: ".ui-resizable-n",
e: ".ui-resizable-e",
s: ".ui-resizable-s",
w: ".ui-resizable-w",
se: ".ui-resizable-se",
sw: ".ui-resizable-sw",
ne: ".ui-resizable-ne",
nw: ".ui-resizable-nw"
} );
this._handles = $();
this._addedHandles = $();
if ( this.handles.constructor === String ) {
if ( this.handles === "all" ) {
this.handles = "n,e,s,w,se,sw,ne,nw";
}
n = this.handles.split( "," );
this.handles = {};
for ( i = 0; i < n.length; i++ ) {
handle = String.prototype.trim.call( n[ i ] );
hname = "ui-resizable-" + handle;
axis = $( "<div>" );
this._addClass( axis, "ui-resizable-handle " + hname );
axis.css( { zIndex: o.zIndex } );
this.handles[ handle ] = ".ui-resizable-" + handle;
if ( !this.element.children( this.handles[ handle ] ).length ) {
this.element.append( axis );
this._addedHandles = this._addedHandles.add( axis );
}
}
}
this._renderAxis = function( target ) {
var i, axis, padPos, padWrapper;
target = target || this.element;
for ( i in this.handles ) {
if ( this.handles[ i ].constructor === String ) {
this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
this.handles[ i ] = $( this.handles[ i ] );
this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
}
if ( this.elementIsWrapper &&
this.originalElement[ 0 ]
.nodeName
.match( /^(textarea|input|select|button)$/i ) ) {
axis = $( this.handles[ i ], this.element );
padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
axis.outerHeight() :
axis.outerWidth();
padPos = [ "padding",
/ne|nw|n/.test( i ) ? "Top" :
/se|sw|s/.test( i ) ? "Bottom" :
/^e$/.test( i ) ? "Right" : "Left" ].join( "" );
target.css( padPos, padWrapper );
this._proportionallyResize();
}
this._handles = this._handles.add( this.handles[ i ] );
}
};
// TODO: make renderAxis a prototype function
this._renderAxis( this.element );
this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
this._handles.disableSelection();
this._handles.on( "mouseover", function() {
if ( !that.resizing ) {
if ( this.className ) {
axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
}
that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
}
} );
if ( o.autoHide ) {
this._handles.hide();
this._addClass( "ui-resizable-autohide" );
}
},
_removeHandles: function() {
this._addedHandles.remove();
},
_mouseCapture: function( event ) {
var i, handle,
capture = false;
for ( i in this.handles ) {
handle = $( this.handles[ i ] )[ 0 ];
if ( handle === event.target || $.contains( handle, event.target ) ) {
capture = true;
}
}
return !this.options.disabled && capture;
},
_mouseStart: function( event ) {
var curleft, curtop, cursor,
o = this.options,
el = this.element;
this.resizing = true;
this._renderProxy();
curleft = this._num( this.helper.css( "left" ) );
curtop = this._num( this.helper.css( "top" ) );
if ( o.containment ) {
curleft += $( o.containment ).scrollLeft() || 0;
curtop += $( o.containment ).scrollTop() || 0;
}
this.offset = this.helper.offset();
this.position = { left: curleft, top: curtop };
this.size = this._helper ? {
width: this.helper.width(),
height: this.helper.height()
} : {
width: el.width(),
height: el.height()
};
this.originalSize = this._helper ? {
width: el.outerWidth(),
height: el.outerHeight()
} : {
width: el.width(),
height: el.height()
};
this.sizeDiff = {
width: el.outerWidth() - el.width(),
height: el.outerHeight() - el.height()
};
this.originalPosition = { left: curleft, top: curtop };
this.originalMousePosition = { left: event.pageX, top: event.pageY };
this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
o.aspectRatio :
( ( this.originalSize.width / this.originalSize.height ) || 1 );
cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
$( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
this._addClass( "ui-resizable-resizing" );
this._propagate( "start", event );
return true;
},
_mouseDrag: function( event ) {
var data, props,
smp = this.originalMousePosition,
a = this.axis,
dx = ( event.pageX - smp.left ) || 0,
dy = ( event.pageY - smp.top ) || 0,
trigger = this._change[ a ];
this._updatePrevProperties();
if ( !trigger ) {
return false;
}
data = trigger.apply( this, [ event, dx, dy ] );
this._updateVirtualBoundaries( event.shiftKey );
if ( this._aspectRatio || event.shiftKey ) {
data = this._updateRatio( data, event );
}
data = this._respectSize( data, event );
this._updateCache( data );
this._propagate( "resize", event );
props = this._applyChanges();
if ( !this._helper && this._proportionallyResizeElements.length ) {
this._proportionallyResize();
}
if ( !$.isEmptyObject( props ) ) {
this._updatePrevProperties();
this._trigger( "resize", event, this.ui() );
this._applyChanges();
}
return false;
},
_mouseStop: function( event ) {
this.resizing = false;
var pr, ista, soffseth, soffsetw, s, left, top,
o = this.options, that = this;
if ( this._helper ) {
pr = this._proportionallyResizeElements;
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
soffsetw = ista ? 0 : that.sizeDiff.width;
s = {
width: ( that.helper.width() - soffsetw ),
height: ( that.helper.height() - soffseth )
};
left = ( parseFloat( that.element.css( "left" ) ) +
( that.position.left - that.originalPosition.left ) ) || null;
top = ( parseFloat( that.element.css( "top" ) ) +
( that.position.top - that.originalPosition.top ) ) || null;
if ( !o.animate ) {
this.element.css( $.extend( s, { top: top, left: left } ) );
}
that.helper.height( that.size.height );
that.helper.width( that.size.width );
if ( this._helper && !o.animate ) {
this._proportionallyResize();
}
}
$( "body" ).css( "cursor", "auto" );
this._removeClass( "ui-resizable-resizing" );
this._propagate( "stop", event );
if ( this._helper ) {
this.helper.remove();
}
return false;
},
_updatePrevProperties: function() {
this.prevPosition = {
top: this.position.top,
left: this.position.left
};
this.prevSize = {
width: this.size.width,
height: this.size.height
};
},
_applyChanges: function() {
var props = {};
if ( this.position.top !== this.prevPosition.top ) {
props.top = this.position.top + "px";
}
if ( this.position.left !== this.prevPosition.left ) {
props.left = this.position.left + "px";
}
if ( this.size.width !== this.prevSize.width ) {
props.width = this.size.width + "px";
}
if ( this.size.height !== this.prevSize.height ) {
props.height = this.size.height + "px";
}
this.helper.css( props );
return props;
},
_updateVirtualBoundaries: function( forceAspectRatio ) {
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
o = this.options;
b = {
minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
};
if ( this._aspectRatio || forceAspectRatio ) {
pMinWidth = b.minHeight * this.aspectRatio;
pMinHeight = b.minWidth / this.aspectRatio;
pMaxWidth = b.maxHeight * this.aspectRatio;
pMaxHeight = b.maxWidth / this.aspectRatio;
if ( pMinWidth > b.minWidth ) {
b.minWidth = pMinWidth;
}
if ( pMinHeight > b.minHeight ) {
b.minHeight = pMinHeight;
}
if ( pMaxWidth < b.maxWidth ) {
b.maxWidth = pMaxWidth;
}
if ( pMaxHeight < b.maxHeight ) {
b.maxHeight = pMaxHeight;
}
}
this._vBoundaries = b;
},
_updateCache: function( data ) {
this.offset = this.helper.offset();
if ( this._isNumber( data.left ) ) {
this.position.left = data.left;
}
if ( this._isNumber( data.top ) ) {
this.position.top = data.top;
}
if ( this._isNumber( data.height ) ) {
this.size.height = data.height;
}
if ( this._isNumber( data.width ) ) {
this.size.width = data.width;
}
},
_updateRatio: function( data ) {
var cpos = this.position,
csize = this.size,
a = this.axis;
if ( this._isNumber( data.height ) ) {
data.width = ( data.height * this.aspectRatio );
} else if ( this._isNumber( data.width ) ) {
data.height = ( data.width / this.aspectRatio );
}
if ( a === "sw" ) {
data.left = cpos.left + ( csize.width - data.width );
data.top = null;
}
if ( a === "nw" ) {
data.top = cpos.top + ( csize.height - data.height );
data.left = cpos.left + ( csize.width - data.width );
}
return data;
},
_respectSize: function( data ) {
var o = this._vBoundaries,
a = this.axis,
ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
dw = this.originalPosition.left + this.originalSize.width,
dh = this.originalPosition.top + this.originalSize.height,
cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
if ( isminw ) {
data.width = o.minWidth;
}
if ( isminh ) {
data.height = o.minHeight;
}
if ( ismaxw ) {
data.width = o.maxWidth;
}
if ( ismaxh ) {
data.height = o.maxHeight;
}
if ( isminw && cw ) {
data.left = dw - o.minWidth;
}
if ( ismaxw && cw ) {
data.left = dw - o.maxWidth;
}
if ( isminh && ch ) {
data.top = dh - o.minHeight;
}
if ( ismaxh && ch ) {
data.top = dh - o.maxHeight;
}
// Fixing jump error on top/left - bug #2330
if ( !data.width && !data.height && !data.left && data.top ) {
data.top = null;
} else if ( !data.width && !data.height && !data.top && data.left ) {
data.left = null;
}
return data;
},
_getPaddingPlusBorderDimensions: function( element ) {
var i = 0,
widths = [],
borders = [
element.css( "borderTopWidth" ),
element.css( "borderRightWidth" ),
element.css( "borderBottomWidth" ),
element.css( "borderLeftWidth" )
],
paddings = [
element.css( "paddingTop" ),
element.css( "paddingRight" ),
element.css( "paddingBottom" ),
element.css( "paddingLeft" )
];
for ( ; i < 4; i++ ) {
widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
}
return {
height: widths[ 0 ] + widths[ 2 ],
width: widths[ 1 ] + widths[ 3 ]
};
},
_proportionallyResize: function() {
if ( !this._proportionallyResizeElements.length ) {
return;
}
var prel,
i = 0,
element = this.helper || this.element;
for ( ; i < this._proportionallyResizeElements.length; i++ ) {
prel = this._proportionallyResizeElements[ i ];
// TODO: Seems like a bug to cache this.outerDimensions
// considering that we are in a loop.
if ( !this.outerDimensions ) {
this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
}
prel.css( {
height: ( element.height() - this.outerDimensions.height ) || 0,
width: ( element.width() - this.outerDimensions.width ) || 0
} );
}
},
_renderProxy: function() {
var el = this.element, o = this.options;
this.elementOffset = el.offset();
if ( this._helper ) {
this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
this._addClass( this.helper, this._helper );
this.helper.css( {
width: this.element.outerWidth(),
height: this.element.outerHeight(),
position: "absolute",
left: this.elementOffset.left + "px",
top: this.elementOffset.top + "px",
zIndex: ++o.zIndex //TODO: Don't modify option
} );
this.helper
.appendTo( "body" )
.disableSelection();
} else {
this.helper = this.element;
}
},
_change: {
e: function( event, dx ) {
return { width: this.originalSize.width + dx };
},
w: function( event, dx ) {
var cs = this.originalSize, sp = this.originalPosition;
return { left: sp.left + dx, width: cs.width - dx };
},
n: function( event, dx, dy ) {
var cs = this.originalSize, sp = this.originalPosition;
return { top: sp.top + dy, height: cs.height - dy };
},
s: function( event, dx, dy ) {
return { height: this.originalSize.height + dy };
},
se: function( event, dx, dy ) {
return $.extend( this._change.s.apply( this, arguments ),
this._change.e.apply( this, [ event, dx, dy ] ) );
},
sw: function( event, dx, dy ) {
return $.extend( this._change.s.apply( this, arguments ),
this._change.w.apply( this, [ event, dx, dy ] ) );
},
ne: function( event, dx, dy ) {
return $.extend( this._change.n.apply( this, arguments ),
this._change.e.apply( this, [ event, dx, dy ] ) );
},
nw: function( event, dx, dy ) {
return $.extend( this._change.n.apply( this, arguments ),
this._change.w.apply( this, [ event, dx, dy ] ) );
}
},
_propagate: function( n, event ) {
$.ui.plugin.call( this, n, [ event, this.ui() ] );
if ( n !== "resize" ) {
this._trigger( n, event, this.ui() );
}
},
plugins: {},
ui: function() {
return {
originalElement: this.originalElement,
element: this.element,
helper: this.helper,
position: this.position,
size: this.size,
originalSize: this.originalSize,
originalPosition: this.originalPosition
};
}
} );
/*
* Resizable Extensions
*/
$.ui.plugin.add( "resizable", "animate", {
stop: function( event ) {
var that = $( this ).resizable( "instance" ),
o = that.options,
pr = that._proportionallyResizeElements,
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
soffsetw = ista ? 0 : that.sizeDiff.width,
style = {
width: ( that.size.width - soffsetw ),
height: ( that.size.height - soffseth )
},
left = ( parseFloat( that.element.css( "left" ) ) +
( that.position.left - that.originalPosition.left ) ) || null,
top = ( parseFloat( that.element.css( "top" ) ) +
( that.position.top - that.originalPosition.top ) ) || null;
that.element.animate(
$.extend( style, top && left ? { top: top, left: left } : {} ), {
duration: o.animateDuration,
easing: o.animateEasing,
step: function() {
var data = {
width: parseFloat( that.element.css( "width" ) ),
height: parseFloat( that.element.css( "height" ) ),
top: parseFloat( that.element.css( "top" ) ),
left: parseFloat( that.element.css( "left" ) )
};
if ( pr && pr.length ) {
$( pr[ 0 ] ).css( { width: data.width, height: data.height } );
}
// Propagating resize, and updating values for each animation step
that._updateCache( data );
that._propagate( "resize", event );
}
}
);
}
} );
$.ui.plugin.add( "resizable", "containment", {
start: function() {
var element, p, co, ch, cw, width, height,
that = $( this ).resizable( "instance" ),
o = that.options,
el = that.element,
oc = o.containment,
ce = ( oc instanceof $ ) ?
oc.get( 0 ) :
( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
if ( !ce ) {
return;
}
that.containerElement = $( ce );
if ( /document/.test( oc ) || oc === document ) {
that.containerOffset = {
left: 0,
top: 0
};
that.containerPosition = {
left: 0,
top: 0
};
that.parentData = {
element: $( document ),
left: 0,
top: 0,
width: $( document ).width(),
height: $( document ).height() || document.body.parentNode.scrollHeight
};
} else {
element = $( ce );
p = [];
$( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
p[ i ] = that._num( element.css( "padding" + name ) );
} );
that.containerOffset = element.offset();
that.containerPosition = element.position();
that.containerSize = {
height: ( element.innerHeight() - p[ 3 ] ),
width: ( element.innerWidth() - p[ 1 ] )
};
co = that.containerOffset;
ch = that.containerSize.height;
cw = that.containerSize.width;
width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
that.parentData = {
element: ce,
left: co.left,
top: co.top,
width: width,
height: height
};
}
},
resize: function( event ) {
var woset, hoset, isParent, isOffsetRelative,
that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset,
cp = that.position,
pRatio = that._aspectRatio || event.shiftKey,
cop = {
top: 0,
left: 0
},
ce = that.containerElement,
continueResize = true;
if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
cop = co;
}
if ( cp.left < ( that._helper ? co.left : 0 ) ) {
that.size.width = that.size.width +
( that._helper ?
( that.position.left - co.left ) :
( that.position.left - cop.left ) );
if ( pRatio ) {
that.size.height = that.size.width / that.aspectRatio;
continueResize = false;
}
that.position.left = o.helper ? co.left : 0;
}
if ( cp.top < ( that._helper ? co.top : 0 ) ) {
that.size.height = that.size.height +
( that._helper ?
( that.position.top - co.top ) :
that.position.top );
if ( pRatio ) {
that.size.width = that.size.height * that.aspectRatio;
continueResize = false;
}
that.position.top = that._helper ? co.top : 0;
}
isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
if ( isParent && isOffsetRelative ) {
that.offset.left = that.parentData.left + that.position.left;
that.offset.top = that.parentData.top + that.position.top;
} else {
that.offset.left = that.element.offset().left;
that.offset.top = that.element.offset().top;
}
woset = Math.abs( that.sizeDiff.width +
( that._helper ?
that.offset.left - cop.left :
( that.offset.left - co.left ) ) );
hoset = Math.abs( that.sizeDiff.height +
( that._helper ?
that.offset.top - cop.top :
( that.offset.top - co.top ) ) );
if ( woset + that.size.width >= that.parentData.width ) {
that.size.width = that.parentData.width - woset;
if ( pRatio ) {
that.size.height = that.size.width / that.aspectRatio;
continueResize = false;
}
}
if ( hoset + that.size.height >= that.parentData.height ) {
that.size.height = that.parentData.height - hoset;
if ( pRatio ) {
that.size.width = that.size.height * that.aspectRatio;
continueResize = false;
}
}
if ( !continueResize ) {
that.position.left = that.prevPosition.left;
that.position.top = that.prevPosition.top;
that.size.width = that.prevSize.width;
that.size.height = that.prevSize.height;
}
},
stop: function() {
var that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset,
cop = that.containerPosition,
ce = that.containerElement,
helper = $( that.helper ),
ho = helper.offset(),
w = helper.outerWidth() - that.sizeDiff.width,
h = helper.outerHeight() - that.sizeDiff.height;
if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
$( this ).css( {
left: ho.left - cop.left - co.left,
width: w,
height: h
} );
}
if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
$( this ).css( {
left: ho.left - cop.left - co.left,
width: w,
height: h
} );
}
}
} );
$.ui.plugin.add( "resizable", "alsoResize", {
start: function() {
var that = $( this ).resizable( "instance" ),
o = that.options;
$( o.alsoResize ).each( function() {
var el = $( this );
el.data( "ui-resizable-alsoresize", {
width: parseFloat( el.width() ), height: parseFloat( el.height() ),
left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
} );
} );
},
resize: function( event, ui ) {
var that = $( this ).resizable( "instance" ),
o = that.options,
os = that.originalSize,
op = that.originalPosition,
delta = {
height: ( that.size.height - os.height ) || 0,
width: ( that.size.width - os.width ) || 0,
top: ( that.position.top - op.top ) || 0,
left: ( that.position.left - op.left ) || 0
};
$( o.alsoResize ).each( function() {
var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
css = el.parents( ui.originalElement[ 0 ] ).length ?
[ "width", "height" ] :
[ "width", "height", "top", "left" ];
$.each( css, function( i, prop ) {
var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
if ( sum && sum >= 0 ) {
style[ prop ] = sum || null;
}
} );
el.css( style );
} );
},
stop: function() {
$( this ).removeData( "ui-resizable-alsoresize" );
}
} );
$.ui.plugin.add( "resizable", "ghost", {
start: function() {
var that = $( this ).resizable( "instance" ), cs = that.size;
that.ghost = that.originalElement.clone();
that.ghost.css( {
opacity: 0.25,
display: "block",
position: "relative",
height: cs.height,
width: cs.width,
margin: 0,
left: 0,
top: 0
} );
that._addClass( that.ghost, "ui-resizable-ghost" );
// DEPRECATED
// TODO: remove after 1.12
if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
// Ghost option
that.ghost.addClass( this.options.ghost );
}
that.ghost.appendTo( that.helper );
},
resize: function() {
var that = $( this ).resizable( "instance" );
if ( that.ghost ) {
that.ghost.css( {
position: "relative",
height: that.size.height,
width: that.size.width
} );
}
},
stop: function() {
var that = $( this ).resizable( "instance" );
if ( that.ghost && that.helper ) {
that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
}
}
} );
$.ui.plugin.add( "resizable", "grid", {
resize: function() {
var outerDimensions,
that = $( this ).resizable( "instance" ),
o = that.options,
cs = that.size,
os = that.originalSize,
op = that.originalPosition,
a = that.axis,
grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
gridX = ( grid[ 0 ] || 1 ),
gridY = ( grid[ 1 ] || 1 ),
ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
newWidth = os.width + ox,
newHeight = os.height + oy,
isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
isMinHeight = o.minHeight && ( o.minHeight > newHeight );
o.grid = grid;
if ( isMinWidth ) {
newWidth += gridX;
}
if ( isMinHeight ) {
newHeight += gridY;
}
if ( isMaxWidth ) {
newWidth -= gridX;
}
if ( isMaxHeight ) {
newHeight -= gridY;
}
if ( /^(se|s|e)$/.test( a ) ) {
that.size.width = newWidth;
that.size.height = newHeight;
} else if ( /^(ne)$/.test( a ) ) {
that.size.width = newWidth;
that.size.height = newHeight;
that.position.top = op.top - oy;
} else if ( /^(sw)$/.test( a ) ) {
that.size.width = newWidth;
that.size.height = newHeight;
that.position.left = op.left - ox;
} else {
if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
outerDimensions = that._getPaddingPlusBorderDimensions( this );
}
if ( newHeight - gridY > 0 ) {
that.size.height = newHeight;
that.position.top = op.top - oy;
} else {
newHeight = gridY - outerDimensions.height;
that.size.height = newHeight;
that.position.top = op.top + os.height - newHeight;
}
if ( newWidth - gridX > 0 ) {
that.size.width = newWidth;
that.position.left = op.left - ox;
} else {
newWidth = gridX - outerDimensions.width;
that.size.width = newWidth;
that.position.left = op.left + os.width - newWidth;
}
}
}
} );
var widgetsResizable = $.ui.resizable;
/*!
* jQuery UI Selectable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Selectable
//>>group: Interactions
//>>description: Allows groups of elements to be selected with the mouse.
//>>docs: http://api.jqueryui.com/selectable/
//>>demos: http://jqueryui.com/selectable/
//>>css.structure: ../../themes/base/selectable.css
var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {
version: "1.13.1",
options: {
appendTo: "body",
autoRefresh: true,
distance: 0,
filter: "*",
tolerance: "touch",
// Callbacks
selected: null,
selecting: null,
start: null,
stop: null,
unselected: null,
unselecting: null
},
_create: function() {
var that = this;
this._addClass( "ui-selectable" );
this.dragged = false;
// Cache selectee children based on filter
this.refresh = function() {
that.elementPos = $( that.element[ 0 ] ).offset();
that.selectees = $( that.options.filter, that.element[ 0 ] );
that._addClass( that.selectees, "ui-selectee" );
that.selectees.each( function() {
var $this = $( this ),
selecteeOffset = $this.offset(),
pos = {
left: selecteeOffset.left - that.elementPos.left,
top: selecteeOffset.top - that.elementPos.top
};
$.data( this, "selectable-item", {
element: this,
$element: $this,
left: pos.left,
top: pos.top,
right: pos.left + $this.outerWidth(),
bottom: pos.top + $this.outerHeight(),
startselected: false,
selected: $this.hasClass( "ui-selected" ),
selecting: $this.hasClass( "ui-selecting" ),
unselecting: $this.hasClass( "ui-unselecting" )
} );
} );
};
this.refresh();
this._mouseInit();
this.helper = $( "<div>" );
this._addClass( this.helper, "ui-selectable-helper" );
},
_destroy: function() {
this.selectees.removeData( "selectable-item" );
this._mouseDestroy();
},
_mouseStart: function( event ) {
var that = this,
options = this.options;
this.opos = [ event.pageX, event.pageY ];
this.elementPos = $( this.element[ 0 ] ).offset();
if ( this.options.disabled ) {
return;
}
this.selectees = $( options.filter, this.element[ 0 ] );
this._trigger( "start", event );
$( options.appendTo ).append( this.helper );
// position helper (lasso)
this.helper.css( {
"left": event.pageX,
"top": event.pageY,
"width": 0,
"height": 0
} );
if ( options.autoRefresh ) {
this.refresh();
}
this.selectees.filter( ".ui-selected" ).each( function() {
var selectee = $.data( this, "selectable-item" );
selectee.startselected = true;
if ( !event.metaKey && !event.ctrlKey ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger( "unselecting", event, {
unselecting: selectee.element
} );
}
} );
$( event.target ).parents().addBack().each( function() {
var doSelect,
selectee = $.data( this, "selectable-item" );
if ( selectee ) {
doSelect = ( !event.metaKey && !event.ctrlKey ) ||
!selectee.$element.hasClass( "ui-selected" );
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
selectee.unselecting = !doSelect;
selectee.selecting = doSelect;
selectee.selected = doSelect;
// selectable (UN)SELECTING callback
if ( doSelect ) {
that._trigger( "selecting", event, {
selecting: selectee.element
} );
} else {
that._trigger( "unselecting", event, {
unselecting: selectee.element
} );
}
return false;
}
} );
},
_mouseDrag: function( event ) {
this.dragged = true;
if ( this.options.disabled ) {
return;
}
var tmp,
that = this,
options = this.options,
x1 = this.opos[ 0 ],
y1 = this.opos[ 1 ],
x2 = event.pageX,
y2 = event.pageY;
if ( x1 > x2 ) {
tmp = x2; x2 = x1; x1 = tmp;
}
if ( y1 > y2 ) {
tmp = y2; y2 = y1; y1 = tmp;
}
this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
this.selectees.each( function() {
var selectee = $.data( this, "selectable-item" ),
hit = false,
offset = {};
//prevent helper from being selected if appendTo: selectable
if ( !selectee || selectee.element === that.element[ 0 ] ) {
return;
}
offset.left = selectee.left + that.elementPos.left;
offset.right = selectee.right + that.elementPos.left;
offset.top = selectee.top + that.elementPos.top;
offset.bottom = selectee.bottom + that.elementPos.top;
if ( options.tolerance === "touch" ) {
hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
offset.bottom < y1 ) );
} else if ( options.tolerance === "fit" ) {
hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
offset.bottom < y2 );
}
if ( hit ) {
// SELECT
if ( selectee.selected ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
}
if ( selectee.unselecting ) {
that._removeClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = false;
}
if ( !selectee.selecting ) {
that._addClass( selectee.$element, "ui-selecting" );
selectee.selecting = true;
// selectable SELECTING callback
that._trigger( "selecting", event, {
selecting: selectee.element
} );
}
} else {
// UNSELECT
if ( selectee.selecting ) {
if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
that._removeClass( selectee.$element, "ui-selecting" );
selectee.selecting = false;
that._addClass( selectee.$element, "ui-selected" );
selectee.selected = true;
} else {
that._removeClass( selectee.$element, "ui-selecting" );
selectee.selecting = false;
if ( selectee.startselected ) {
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
}
// selectable UNSELECTING callback
that._trigger( "unselecting", event, {
unselecting: selectee.element
} );
}
}
if ( selectee.selected ) {
if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger( "unselecting", event, {
unselecting: selectee.element
} );
}
}
}
} );
return false;
},
_mouseStop: function( event ) {
var that = this;
this.dragged = false;
$( ".ui-unselecting", this.element[ 0 ] ).each( function() {
var selectee = $.data( this, "selectable-item" );
that._removeClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = false;
selectee.startselected = false;
that._trigger( "unselected", event, {
unselected: selectee.element
} );
} );
$( ".ui-selecting", this.element[ 0 ] ).each( function() {
var selectee = $.data( this, "selectable-item" );
that._removeClass( selectee.$element, "ui-selecting" )
._addClass( selectee.$element, "ui-selected" );
selectee.selecting = false;
selectee.selected = true;
selectee.startselected = true;
that._trigger( "selected", event, {
selected: selectee.element
} );
} );
this._trigger( "stop", event );
this.helper.remove();
return false;
}
} );
/*!
* jQuery UI Sortable 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Sortable
//>>group: Interactions
//>>description: Enables items in a list to be sorted using the mouse.
//>>docs: http://api.jqueryui.com/sortable/
//>>demos: http://jqueryui.com/sortable/
//>>css.structure: ../../themes/base/sortable.css
var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
version: "1.13.1",
widgetEventPrefix: "sort",
ready: false,
options: {
appendTo: "parent",
axis: false,
connectWith: false,
containment: false,
cursor: "auto",
cursorAt: false,
dropOnEmpty: true,
forcePlaceholderSize: false,
forceHelperSize: false,
grid: false,
handle: false,
helper: "original",
items: "> *",
opacity: false,
placeholder: false,
revert: false,
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
scope: "default",
tolerance: "intersect",
zIndex: 1000,
// Callbacks
activate: null,
beforeStop: null,
change: null,
deactivate: null,
out: null,
over: null,
receive: null,
remove: null,
sort: null,
start: null,
stop: null,
update: null
},
_isOverAxis: function( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
},
_isFloating: function( item ) {
return ( /left|right/ ).test( item.css( "float" ) ) ||
( /inline|table-cell/ ).test( item.css( "display" ) );
},
_create: function() {
this.containerCache = {};
this._addClass( "ui-sortable" );
//Get the items
this.refresh();
//Let's determine the parent's offset
this.offset = this.element.offset();
//Initialize mouse events for interaction
this._mouseInit();
this._setHandleClassName();
//We're ready to go
this.ready = true;
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "handle" ) {
this._setHandleClassName();
}
},
_setHandleClassName: function() {
var that = this;
this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
$.each( this.items, function() {
that._addClass(
this.instance.options.handle ?
this.item.find( this.instance.options.handle ) :
this.item,
"ui-sortable-handle"
);
} );
},
_destroy: function() {
this._mouseDestroy();
for ( var i = this.items.length - 1; i >= 0; i-- ) {
this.items[ i ].item.removeData( this.widgetName + "-item" );
}
return this;
},
_mouseCapture: function( event, overrideHandle ) {
var currentItem = null,
validHandle = false,
that = this;
if ( this.reverting ) {
return false;
}
if ( this.options.disabled || this.options.type === "static" ) {
return false;
}
//We have to refresh the items data once first
this._refreshItems( event );
//Find out if the clicked node (or one of its parents) is a actual item in this.items
$( event.target ).parents().each( function() {
if ( $.data( this, that.widgetName + "-item" ) === that ) {
currentItem = $( this );
return false;
}
} );
if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
currentItem = $( event.target );
}
if ( !currentItem ) {
return false;
}
if ( this.options.handle && !overrideHandle ) {
$( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
if ( this === event.target ) {
validHandle = true;
}
} );
if ( !validHandle ) {
return false;
}
}
this.currentItem = currentItem;
this._removeCurrentsFromItems();
return true;
},
_mouseStart: function( event, overrideHandle, noActivation ) {
var i, body,
o = this.options;
this.currentContainer = this;
//We only need to call refreshPositions, because the refreshItems call has been moved to
// mouseCapture
this.refreshPositions();
//Prepare the dragged items parent
this.appendTo = $( o.appendTo !== "parent" ?
o.appendTo :
this.currentItem.parent() );
//Create and append the visible helper
this.helper = this._createHelper( event );
//Cache the helper size
this._cacheHelperProportions();
/*
* - Position generation -
* This block generates everything position related - it's the core of draggables.
*/
//Cache the margins of the original element
this._cacheMargins();
//The element's absolute position on the page minus margins
this.offset = this.currentItem.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
};
$.extend( this.offset, {
click: { //Where the click happened, relative to the element
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
// This is a relative to absolute position minus the actual position calculation -
// only used for relative positioned helper
relative: this._getRelativeOffset()
} );
// After we get the helper offset, but before we get the parent offset we can
// change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css( "position", "absolute" );
this.cssPosition = this.helper.css( "position" );
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
if ( o.cursorAt ) {
this._adjustOffsetFromHelper( o.cursorAt );
}
//Cache the former DOM position
this.domPosition = {
prev: this.currentItem.prev()[ 0 ],
parent: this.currentItem.parent()[ 0 ]
};
// If the helper is not the original, hide the original so it's not playing any role during
// the drag, won't cause anything bad this way
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
this.currentItem.hide();
}
//Create the placeholder
this._createPlaceholder();
//Get the next scrolling parent
this.scrollParent = this.placeholder.scrollParent();
$.extend( this.offset, {
parent: this._getParentOffset()
} );
//Set a containment if given in the options
if ( o.containment ) {
this._setContainment();
}
if ( o.cursor && o.cursor !== "auto" ) { // cursor option
body = this.document.find( "body" );
// Support: IE
this.storedCursor = body.css( "cursor" );
body.css( "cursor", o.cursor );
this.storedStylesheet =
$( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
}
// We need to make sure to grab the zIndex before setting the
// opacity, because setting the opacity to anything lower than 1
// causes the zIndex to change from "auto" to 0.
if ( o.zIndex ) { // zIndex option
if ( this.helper.css( "zIndex" ) ) {
this._storedZIndex = this.helper.css( "zIndex" );
}
this.helper.css( "zIndex", o.zIndex );
}
if ( o.opacity ) { // opacity option
if ( this.helper.css( "opacity" ) ) {
this._storedOpacity = this.helper.css( "opacity" );
}
this.helper.css( "opacity", o.opacity );
}
//Prepare scrolling
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
this.scrollParent[ 0 ].tagName !== "HTML" ) {
this.overflowOffset = this.scrollParent.offset();
}
//Call callbacks
this._trigger( "start", event, this._uiHash() );
//Recache the helper size
if ( !this._preserveHelperProportions ) {
this._cacheHelperProportions();
}
//Post "activate" events to possible containers
if ( !noActivation ) {
for ( i = this.containers.length - 1; i >= 0; i-- ) {
this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
}
}
//Prepare possible droppables
if ( $.ui.ddmanager ) {
$.ui.ddmanager.current = this;
}
if ( $.ui.ddmanager && !o.dropBehaviour ) {
$.ui.ddmanager.prepareOffsets( this, event );
}
this.dragging = true;
this._addClass( this.helper, "ui-sortable-helper" );
//Move the helper, if needed
if ( !this.helper.parent().is( this.appendTo ) ) {
this.helper.detach().appendTo( this.appendTo );
//Update position
this.offset.parent = this._getParentOffset();
}
//Generate the original position
this.position = this.originalPosition = this._generatePosition( event );
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;
this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
this._mouseDrag( event );
return true;
},
_scroll: function( event ) {
var o = this.options,
scrolled = false;
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
this.scrollParent[ 0 ].tagName !== "HTML" ) {
if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
event.pageY < o.scrollSensitivity ) {
this.scrollParent[ 0 ].scrollTop =
scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
} else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
this.scrollParent[ 0 ].scrollTop =
scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
}
if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
event.pageX < o.scrollSensitivity ) {
this.scrollParent[ 0 ].scrollLeft = scrolled =
this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
} else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
this.scrollParent[ 0 ].scrollLeft = scrolled =
this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
}
} else {
if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
} else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
o.scrollSensitivity ) {
scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
}
if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
scrolled = this.document.scrollLeft(
this.document.scrollLeft() - o.scrollSpeed
);
} else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
o.scrollSensitivity ) {
scrolled = this.document.scrollLeft(
this.document.scrollLeft() + o.scrollSpeed
);
}
}
return scrolled;
},
_mouseDrag: function( event ) {
var i, item, itemElement, intersection,
o = this.options;
//Compute the helpers position
this.position = this._generatePosition( event );
this.positionAbs = this._convertPositionTo( "absolute" );
//Set the helper position
if ( !this.options.axis || this.options.axis !== "y" ) {
this.helper[ 0 ].style.left = this.position.left + "px";
}
if ( !this.options.axis || this.options.axis !== "x" ) {
this.helper[ 0 ].style.top = this.position.top + "px";
}
//Do scrolling
if ( o.scroll ) {
if ( this._scroll( event ) !== false ) {
//Update item positions used in position checks
this._refreshItemPositions( true );
if ( $.ui.ddmanager && !o.dropBehaviour ) {
$.ui.ddmanager.prepareOffsets( this, event );
}
}
}
this.dragDirection = {
vertical: this._getDragVerticalDirection(),
horizontal: this._getDragHorizontalDirection()
};
//Rearrange
for ( i = this.items.length - 1; i >= 0; i-- ) {
//Cache variables and intersection, continue if no intersection
item = this.items[ i ];
itemElement = item.item[ 0 ];
intersection = this._intersectsWithPointer( item );
if ( !intersection ) {
continue;
}
// Only put the placeholder inside the current Container, skip all
// items from other containers. This works because when moving
// an item from one container to another the
// currentContainer is switched before the placeholder is moved.
//
// Without this, moving items in "sub-sortables" can cause
// the placeholder to jitter between the outer and inner container.
if ( item.instance !== this.currentContainer ) {
continue;
}
// Cannot intersect with itself
// no useless actions that have been done before
// no action if the item moved is the parent of the item checked
if ( itemElement !== this.currentItem[ 0 ] &&
this.placeholder[ intersection === 1 ?
"next" : "prev" ]()[ 0 ] !== itemElement &&
!$.contains( this.placeholder[ 0 ], itemElement ) &&
( this.options.type === "semi-dynamic" ?
!$.contains( this.element[ 0 ], itemElement ) :
true
)
) {
this.direction = intersection === 1 ? "down" : "up";
if ( this.options.tolerance === "pointer" ||
this._intersectsWithSides( item ) ) {
this._rearrange( event, item );
} else {
break;
}
this._trigger( "change", event, this._uiHash() );
break;
}
}
//Post events to containers
this._contactContainers( event );
//Interconnect with droppables
if ( $.ui.ddmanager ) {
$.ui.ddmanager.drag( this, event );
}
//Call callbacks
this._trigger( "sort", event, this._uiHash() );
this.lastPositionAbs = this.positionAbs;
return false;
},
_mouseStop: function( event, noPropagation ) {
if ( !event ) {
return;
}
//If we are using droppables, inform the manager about the drop
if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
$.ui.ddmanager.drop( this, event );
}
if ( this.options.revert ) {
var that = this,
cur = this.placeholder.offset(),
axis = this.options.axis,
animation = {};
if ( !axis || axis === "x" ) {
animation.left = cur.left - this.offset.parent.left - this.margins.left +
( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
0 :
this.offsetParent[ 0 ].scrollLeft
);
}
if ( !axis || axis === "y" ) {
animation.top = cur.top - this.offset.parent.top - this.margins.top +
( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
0 :
this.offsetParent[ 0 ].scrollTop
);
}
this.reverting = true;
$( this.helper ).animate(
animation,
parseInt( this.options.revert, 10 ) || 500,
function() {
that._clear( event );
}
);
} else {
this._clear( event, noPropagation );
}
return false;
},
cancel: function() {
if ( this.dragging ) {
this._mouseUp( new $.Event( "mouseup", { target: null } ) );
if ( this.options.helper === "original" ) {
this.currentItem.css( this._storedCSS );
this._removeClass( this.currentItem, "ui-sortable-helper" );
} else {
this.currentItem.show();
}
//Post deactivating events to containers
for ( var i = this.containers.length - 1; i >= 0; i-- ) {
this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
if ( this.containers[ i ].containerCache.over ) {
this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
this.containers[ i ].containerCache.over = 0;
}
}
}
if ( this.placeholder ) {
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
// it unbinds ALL events from the original node!
if ( this.placeholder[ 0 ].parentNode ) {
this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
}
if ( this.options.helper !== "original" && this.helper &&
this.helper[ 0 ].parentNode ) {
this.helper.remove();
}
$.extend( this, {
helper: null,
dragging: false,
reverting: false,
_noFinalSort: null
} );
if ( this.domPosition.prev ) {
$( this.domPosition.prev ).after( this.currentItem );
} else {
$( this.domPosition.parent ).prepend( this.currentItem );
}
}
return this;
},
serialize: function( o ) {
var items = this._getItemsAsjQuery( o && o.connected ),
str = [];
o = o || {};
$( items ).each( function() {
var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
.match( o.expression || ( /(.+)[\-=_](.+)/ ) );
if ( res ) {
str.push(
( o.key || res[ 1 ] + "[]" ) +
"=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
}
} );
if ( !str.length && o.key ) {
str.push( o.key + "=" );
}
return str.join( "&" );
},
toArray: function( o ) {
var items = this._getItemsAsjQuery( o && o.connected ),
ret = [];
o = o || {};
items.each( function() {
ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
} );
return ret;
},
/* Be careful with the following core functions */
_intersectsWith: function( item ) {
var x1 = this.positionAbs.left,
x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top,
y2 = y1 + this.helperProportions.height,
l = item.left,
r = l + item.width,
t = item.top,
b = t + item.height,
dyClick = this.offset.click.top,
dxClick = this.offset.click.left,
isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
( y1 + dyClick ) < b ),
isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
( x1 + dxClick ) < r ),
isOverElement = isOverElementHeight && isOverElementWidth;
if ( this.options.tolerance === "pointer" ||
this.options.forcePointerForContainers ||
( this.options.tolerance !== "pointer" &&
this.helperProportions[ this.floating ? "width" : "height" ] >
item[ this.floating ? "width" : "height" ] )
) {
return isOverElement;
} else {
return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
}
},
_intersectsWithPointer: function( item ) {
var verticalDirection, horizontalDirection,
isOverElementHeight = ( this.options.axis === "x" ) ||
this._isOverAxis(
this.positionAbs.top + this.offset.click.top, item.top, item.height ),
isOverElementWidth = ( this.options.axis === "y" ) ||
this._isOverAxis(
this.positionAbs.left + this.offset.click.left, item.left, item.width ),
isOverElement = isOverElementHeight && isOverElementWidth;
if ( !isOverElement ) {
return false;
}
verticalDirection = this.dragDirection.vertical;
horizontalDirection = this.dragDirection.horizontal;
return this.floating ?
( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
},
_intersectsWithSides: function( item ) {
var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
isOverRightHalf = this._isOverAxis( this.positionAbs.left +
this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
verticalDirection = this.dragDirection.vertical,
horizontalDirection = this.dragDirection.horizontal;
if ( this.floating && horizontalDirection ) {
return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
( horizontalDirection === "left" && !isOverRightHalf ) );
} else {
return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
( verticalDirection === "up" && !isOverBottomHalf ) );
}
},
_getDragVerticalDirection: function() {
var delta = this.positionAbs.top - this.lastPositionAbs.top;
return delta !== 0 && ( delta > 0 ? "down" : "up" );
},
_getDragHorizontalDirection: function() {
var delta = this.positionAbs.left - this.lastPositionAbs.left;
return delta !== 0 && ( delta > 0 ? "right" : "left" );
},
refresh: function( event ) {
this._refreshItems( event );
this._setHandleClassName();
this.refreshPositions();
return this;
},
_connectWith: function() {
var options = this.options;
return options.connectWith.constructor === String ?
[ options.connectWith ] :
options.connectWith;
},
_getItemsAsjQuery: function( connected ) {
var i, j, cur, inst,
items = [],
queries = [],
connectWith = this._connectWith();
if ( connectWith && connected ) {
for ( i = connectWith.length - 1; i >= 0; i-- ) {
cur = $( connectWith[ i ], this.document[ 0 ] );
for ( j = cur.length - 1; j >= 0; j-- ) {
inst = $.data( cur[ j ], this.widgetFullName );
if ( inst && inst !== this && !inst.options.disabled ) {
queries.push( [ typeof inst.options.items === "function" ?
inst.options.items.call( inst.element ) :
$( inst.options.items, inst.element )
.not( ".ui-sortable-helper" )
.not( ".ui-sortable-placeholder" ), inst ] );
}
}
}
}
queries.push( [ typeof this.options.items === "function" ?
this.options.items
.call( this.element, null, { options: this.options, item: this.currentItem } ) :
$( this.options.items, this.element )
.not( ".ui-sortable-helper" )
.not( ".ui-sortable-placeholder" ), this ] );
function addItems() {
items.push( this );
}
for ( i = queries.length - 1; i >= 0; i-- ) {
queries[ i ][ 0 ].each( addItems );
}
return $( items );
},
_removeCurrentsFromItems: function() {
var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
this.items = $.grep( this.items, function( item ) {
for ( var j = 0; j < list.length; j++ ) {
if ( list[ j ] === item.item[ 0 ] ) {
return false;
}
}
return true;
} );
},
_refreshItems: function( event ) {
this.items = [];
this.containers = [ this ];
var i, j, cur, inst, targetData, _queries, item, queriesLength,
items = this.items,
queries = [ [ typeof this.options.items === "function" ?
this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
$( this.options.items, this.element ), this ] ],
connectWith = this._connectWith();
//Shouldn't be run the first time through due to massive slow-down
if ( connectWith && this.ready ) {
for ( i = connectWith.length - 1; i >= 0; i-- ) {
cur = $( connectWith[ i ], this.document[ 0 ] );
for ( j = cur.length - 1; j >= 0; j-- ) {
inst = $.data( cur[ j ], this.widgetFullName );
if ( inst && inst !== this && !inst.options.disabled ) {
queries.push( [ typeof inst.options.items === "function" ?
inst.options.items
.call( inst.element[ 0 ], event, { item: this.currentItem } ) :
$( inst.options.items, inst.element ), inst ] );
this.containers.push( inst );
}
}
}
}
for ( i = queries.length - 1; i >= 0; i-- ) {
targetData = queries[ i ][ 1 ];
_queries = queries[ i ][ 0 ];
for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
item = $( _queries[ j ] );
// Data for target checking (mouse manager)
item.data( this.widgetName + "-item", targetData );
items.push( {
item: item,
instance: targetData,
width: 0, height: 0,
left: 0, top: 0
} );
}
}
},
_refreshItemPositions: function( fast ) {
var i, item, t, p;
for ( i = this.items.length - 1; i >= 0; i-- ) {
item = this.items[ i ];
//We ignore calculating positions of all connected containers when we're not over them
if ( this.currentContainer && item.instance !== this.currentContainer &&
item.item[ 0 ] !== this.currentItem[ 0 ] ) {
continue;
}
t = this.options.toleranceElement ?
$( this.options.toleranceElement, item.item ) :
item.item;
if ( !fast ) {
item.width = t.outerWidth();
item.height = t.outerHeight();
}
p = t.offset();
item.left = p.left;
item.top = p.top;
}
},
refreshPositions: function( fast ) {
// Determine whether items are being displayed horizontally
this.floating = this.items.length ?
this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
false;
// This has to be redone because due to the item being moved out/into the offsetParent,
// the offsetParent's position will change
if ( this.offsetParent && this.helper ) {
this.offset.parent = this._getParentOffset();
}
this._refreshItemPositions( fast );
var i, p;
if ( this.options.custom && this.options.custom.refreshContainers ) {
this.options.custom.refreshContainers.call( this );
} else {
for ( i = this.containers.length - 1; i >= 0; i-- ) {
p = this.containers[ i ].element.offset();
this.containers[ i ].containerCache.left = p.left;
this.containers[ i ].containerCache.top = p.top;
this.containers[ i ].containerCache.width =
this.containers[ i ].element.outerWidth();
this.containers[ i ].containerCache.height =
this.containers[ i ].element.outerHeight();
}
}
return this;
},
_createPlaceholder: function( that ) {
that = that || this;
var className, nodeName,
o = that.options;
if ( !o.placeholder || o.placeholder.constructor === String ) {
className = o.placeholder;
nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
o.placeholder = {
element: function() {
var element = $( "<" + nodeName + ">", that.document[ 0 ] );
that._addClass( element, "ui-sortable-placeholder",
className || that.currentItem[ 0 ].className )
._removeClass( element, "ui-sortable-helper" );
if ( nodeName === "tbody" ) {
that._createTrPlaceholder(
that.currentItem.find( "tr" ).eq( 0 ),
$( "<tr>", that.document[ 0 ] ).appendTo( element )
);
} else if ( nodeName === "tr" ) {
that._createTrPlaceholder( that.currentItem, element );
} else if ( nodeName === "img" ) {
element.attr( "src", that.currentItem.attr( "src" ) );
}
if ( !className ) {
element.css( "visibility", "hidden" );
}
return element;
},
update: function( container, p ) {
// 1. If a className is set as 'placeholder option, we don't force sizes -
// the class is responsible for that
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a
// class name is specified
if ( className && !o.forcePlaceholderSize ) {
return;
}
// If the element doesn't have a actual height or width by itself (without
// styles coming from a stylesheet), it receives the inline height and width
// from the dragged item. Or, if it's a tbody or tr, it's going to have a height
// anyway since we're populating them with <td>s above, but they're unlikely to
// be the correct height on their own if the row heights are dynamic, so we'll
// always assign the height of the dragged item given forcePlaceholderSize
// is true.
if ( !p.height() || ( o.forcePlaceholderSize &&
( nodeName === "tbody" || nodeName === "tr" ) ) ) {
p.height(
that.currentItem.innerHeight() -
parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
}
if ( !p.width() ) {
p.width(
that.currentItem.innerWidth() -
parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
}
}
};
}
//Create the placeholder
that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
//Append it after the actual current item
that.currentItem.after( that.placeholder );
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
o.placeholder.update( that, that.placeholder );
},
_createTrPlaceholder: function( sourceTr, targetTr ) {
var that = this;
sourceTr.children().each( function() {
$( "<td> </td>", that.document[ 0 ] )
.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
.appendTo( targetTr );
} );
},
_contactContainers: function( event ) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
floating, axis,
innermostContainer = null,
innermostIndex = null;
// Get innermost container that intersects with item
for ( i = this.containers.length - 1; i >= 0; i-- ) {
// Never consider a container that's located within the item itself
if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
continue;
}
if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
// If we've already found a container and it's more "inner" than this, then continue
if ( innermostContainer &&
$.contains(
this.containers[ i ].element[ 0 ],
innermostContainer.element[ 0 ] ) ) {
continue;
}
innermostContainer = this.containers[ i ];
innermostIndex = i;
} else {
// container doesn't intersect. trigger "out" event if necessary
if ( this.containers[ i ].containerCache.over ) {
this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
this.containers[ i ].containerCache.over = 0;
}
}
}
// If no intersecting containers found, return
if ( !innermostContainer ) {
return;
}
// Move the item into the container if it's not there already
if ( this.containers.length === 1 ) {
if ( !this.containers[ innermostIndex ].containerCache.over ) {
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
this.containers[ innermostIndex ].containerCache.over = 1;
}
} else {
// When entering a new container, we will find the item with the least distance and
// append our item near it
dist = 10000;
itemWithLeastDistance = null;
floating = innermostContainer.floating || this._isFloating( this.currentItem );
posProperty = floating ? "left" : "top";
sizeProperty = floating ? "width" : "height";
axis = floating ? "pageX" : "pageY";
for ( j = this.items.length - 1; j >= 0; j-- ) {
if ( !$.contains(
this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
) {
continue;
}
if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
continue;
}
cur = this.items[ j ].item.offset()[ posProperty ];
nearBottom = false;
if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
nearBottom = true;
}
if ( Math.abs( event[ axis ] - cur ) < dist ) {
dist = Math.abs( event[ axis ] - cur );
itemWithLeastDistance = this.items[ j ];
this.direction = nearBottom ? "up" : "down";
}
}
//Check if dropOnEmpty is enabled
if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
return;
}
if ( this.currentContainer === this.containers[ innermostIndex ] ) {
if ( !this.currentContainer.containerCache.over ) {
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
this.currentContainer.containerCache.over = 1;
}
return;
}
if ( itemWithLeastDistance ) {
this._rearrange( event, itemWithLeastDistance, null, true );
} else {
this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
}
this._trigger( "change", event, this._uiHash() );
this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
this.currentContainer = this.containers[ innermostIndex ];
//Update the placeholder
this.options.placeholder.update( this.currentContainer, this.placeholder );
//Update scrollParent
this.scrollParent = this.placeholder.scrollParent();
//Update overflowOffset
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
this.scrollParent[ 0 ].tagName !== "HTML" ) {
this.overflowOffset = this.scrollParent.offset();
}
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
this.containers[ innermostIndex ].containerCache.over = 1;
}
},
_createHelper: function( event ) {
var o = this.options,
helper = typeof o.helper === "function" ?
$( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
//Add the helper to the DOM if that didn't happen already
if ( !helper.parents( "body" ).length ) {
this.appendTo[ 0 ].appendChild( helper[ 0 ] );
}
if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
this._storedCSS = {
width: this.currentItem[ 0 ].style.width,
height: this.currentItem[ 0 ].style.height,
position: this.currentItem.css( "position" ),
top: this.currentItem.css( "top" ),
left: this.currentItem.css( "left" )
};
}
if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
helper.width( this.currentItem.width() );
}
if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
helper.height( this.currentItem.height() );
}
return helper;
},
_adjustOffsetFromHelper: function( obj ) {
if ( typeof obj === "string" ) {
obj = obj.split( " " );
}
if ( Array.isArray( obj ) ) {
obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
}
if ( "left" in obj ) {
this.offset.click.left = obj.left + this.margins.left;
}
if ( "right" in obj ) {
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
}
if ( "top" in obj ) {
this.offset.click.top = obj.top + this.margins.top;
}
if ( "bottom" in obj ) {
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
}
},
_getParentOffset: function() {
//Get the offsetParent and cache its position
this.offsetParent = this.helper.offsetParent();
var po = this.offsetParent.offset();
// This is a special case where we need to modify a offset calculated on start, since the
// following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the
// next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
// the document, which means that the scroll is included in the initial calculation of the
// offset of the parent, and never recalculated upon drag
if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
// This needs to be actually done for all browsers, since pageX/pageY includes this
// information with an ugly IE fix
if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
( this.offsetParent[ 0 ].tagName &&
this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
po = { top: 0, left: 0 };
}
return {
top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
};
},
_getRelativeOffset: function() {
if ( this.cssPosition === "relative" ) {
var p = this.currentItem.position();
return {
top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
this.scrollParent.scrollTop(),
left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
this.scrollParent.scrollLeft()
};
} else {
return { top: 0, left: 0 };
}
},
_cacheMargins: function() {
this.margins = {
left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
};
},
_cacheHelperProportions: function() {
this.helperProportions = {
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};
},
_setContainment: function() {
var ce, co, over,
o = this.options;
if ( o.containment === "parent" ) {
o.containment = this.helper[ 0 ].parentNode;
}
if ( o.containment === "document" || o.containment === "window" ) {
this.containment = [
0 - this.offset.relative.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top,
o.containment === "document" ?
this.document.width() :
this.window.width() - this.helperProportions.width - this.margins.left,
( o.containment === "document" ?
( this.document.height() || document.body.parentNode.scrollHeight ) :
this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
) - this.helperProportions.height - this.margins.top
];
}
if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
ce = $( o.containment )[ 0 ];
co = $( o.containment ).offset();
over = ( $( ce ).css( "overflow" ) !== "hidden" );
this.containment = [
co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
this.helperProportions.width - this.margins.left,
co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
this.helperProportions.height - this.margins.top
];
}
},
_convertPositionTo: function( d, pos ) {
if ( !pos ) {
pos = this.position;
}
var mod = d === "absolute" ? 1 : -1,
scroll = this.cssPosition === "absolute" &&
!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
this.offsetParent :
this.scrollParent,
scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
return {
top: (
// The absolute mouse position
pos.top +
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.top * mod +
// The offsetParent's offset without borders (offset + border)
this.offset.parent.top * mod -
( ( this.cssPosition === "fixed" ?
-this.scrollParent.scrollTop() :
( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
),
left: (
// The absolute mouse position
pos.left +
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.left * mod +
// The offsetParent's offset without borders (offset + border)
this.offset.parent.left * mod -
( ( this.cssPosition === "fixed" ?
-this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
scroll.scrollLeft() ) * mod )
)
};
},
_generatePosition: function( event ) {
var top, left,
o = this.options,
pageX = event.pageX,
pageY = event.pageY,
scroll = this.cssPosition === "absolute" &&
!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
this.offsetParent :
this.scrollParent,
scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
// This is another very weird special case that only happens for relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset parent
// we have to refresh the relative offset during the scroll so there are no jumps
if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
this.offset.relative = this._getRelativeOffset();
}
/*
* - Position constraining -
* Constrain the position to a mix of grid, containment.
*/
if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
if ( this.containment ) {
if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
pageX = this.containment[ 0 ] + this.offset.click.left;
}
if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
pageY = this.containment[ 1 ] + this.offset.click.top;
}
if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
pageX = this.containment[ 2 ] + this.offset.click.left;
}
if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
pageY = this.containment[ 3 ] + this.offset.click.top;
}
}
if ( o.grid ) {
top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
o.grid[ 1 ] ) * o.grid[ 1 ];
pageY = this.containment ?
( ( top - this.offset.click.top >= this.containment[ 1 ] &&
top - this.offset.click.top <= this.containment[ 3 ] ) ?
top :
( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
top;
left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
o.grid[ 0 ] ) * o.grid[ 0 ];
pageX = this.containment ?
( ( left - this.offset.click.left >= this.containment[ 0 ] &&
left - this.offset.click.left <= this.containment[ 2 ] ) ?
left :
( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
left;
}
}
return {
top: (
// The absolute mouse position
pageY -
// Click offset (relative to the element)
this.offset.click.top -
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.top -
// The offsetParent's offset without borders (offset + border)
this.offset.parent.top +
( ( this.cssPosition === "fixed" ?
-this.scrollParent.scrollTop() :
( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
),
left: (
// The absolute mouse position
pageX -
// Click offset (relative to the element)
this.offset.click.left -
// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.relative.left -
// The offsetParent's offset without borders (offset + border)
this.offset.parent.left +
( ( this.cssPosition === "fixed" ?
-this.scrollParent.scrollLeft() :
scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
)
};
},
_rearrange: function( event, i, a, hardRefresh ) {
if ( a ) {
a[ 0 ].appendChild( this.placeholder[ 0 ] );
} else {
i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
}
//Various things done here to improve the performance:
// 1. we create a setTimeout, that calls refreshPositions
// 2. on the instance, we have a counter variable, that get's higher after every append
// 3. on the local scope, we copy the counter variable, and check in the timeout,
// if it's still the same
// 4. this lets only the last addition to the timeout stack through
this.counter = this.counter ? ++this.counter : 1;
var counter = this.counter;
this._delay( function() {
if ( counter === this.counter ) {
//Precompute after each DOM insertion, NOT on mousemove
this.refreshPositions( !hardRefresh );
}
} );
},
_clear: function( event, noPropagation ) {
this.reverting = false;
// We delay all events that have to be triggered to after the point where the placeholder
// has been removed and everything else normalized again
var i,
delayedTriggers = [];
// We first have to update the dom position of the actual currentItem
// Note: don't do it if the current item is already removed (by a user), or it gets
// reappended (see #4088)
if ( !this._noFinalSort && this.currentItem.parent().length ) {
this.placeholder.before( this.currentItem );
}
this._noFinalSort = null;
if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
for ( i in this._storedCSS ) {
if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
this._storedCSS[ i ] = "";
}
}
this.currentItem.css( this._storedCSS );
this._removeClass( this.currentItem, "ui-sortable-helper" );
} else {
this.currentItem.show();
}
if ( this.fromOutside && !noPropagation ) {
delayedTriggers.push( function( event ) {
this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
} );
}
if ( ( this.fromOutside ||
this.domPosition.prev !==
this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
// Trigger update callback if the DOM position has changed
delayedTriggers.push( function( event ) {
this._trigger( "update", event, this._uiHash() );
} );
}
// Check if the items Container has Changed and trigger appropriate
// events.
if ( this !== this.currentContainer ) {
if ( !noPropagation ) {
delayedTriggers.push( function( event ) {
this._trigger( "remove", event, this._uiHash() );
} );
delayedTriggers.push( ( function( c ) {
return function( event ) {
c._trigger( "receive", event, this._uiHash( this ) );
};
} ).call( this, this.currentContainer ) );
delayedTriggers.push( ( function( c ) {
return function( event ) {
c._trigger( "update", event, this._uiHash( this ) );
};
} ).call( this, this.currentContainer ) );
}
}
//Post events to containers
function delayEvent( type, instance, container ) {
return function( event ) {
container._trigger( type, event, instance._uiHash( instance ) );
};
}
for ( i = this.containers.length - 1; i >= 0; i-- ) {
if ( !noPropagation ) {
delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
}
if ( this.containers[ i ].containerCache.over ) {
delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
this.containers[ i ].containerCache.over = 0;
}
}
//Do what was originally in plugins
if ( this.storedCursor ) {
this.document.find( "body" ).css( "cursor", this.storedCursor );
this.storedStylesheet.remove();
}
if ( this._storedOpacity ) {
this.helper.css( "opacity", this._storedOpacity );
}
if ( this._storedZIndex ) {
this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
}
this.dragging = false;
if ( !noPropagation ) {
this._trigger( "beforeStop", event, this._uiHash() );
}
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
// it unbinds ALL events from the original node!
this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
if ( !this.cancelHelperRemoval ) {
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
this.helper.remove();
}
this.helper = null;
}
if ( !noPropagation ) {
for ( i = 0; i < delayedTriggers.length; i++ ) {
// Trigger all delayed events
delayedTriggers[ i ].call( this, event );
}
this._trigger( "stop", event, this._uiHash() );
}
this.fromOutside = false;
return !this.cancelHelperRemoval;
},
_trigger: function() {
if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
this.cancel();
}
},
_uiHash: function( _inst ) {
var inst = _inst || this;
return {
helper: inst.helper,
placeholder: inst.placeholder || $( [] ),
position: inst.position,
originalPosition: inst.originalPosition,
offset: inst.positionAbs,
item: inst.currentItem,
sender: _inst ? _inst.element : null
};
}
} );
/*!
* jQuery UI Accordion 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Accordion
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/accordion/
//>>demos: http://jqueryui.com/accordion/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/accordion.css
//>>css.theme: ../../themes/base/theme.css
var widgetsAccordion = $.widget( "ui.accordion", {
version: "1.13.1",
options: {
active: 0,
animate: {},
classes: {
"ui-accordion-header": "ui-corner-top",
"ui-accordion-header-collapsed": "ui-corner-all",
"ui-accordion-content": "ui-corner-bottom"
},
collapsible: false,
event: "click",
header: function( elem ) {
return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
},
heightStyle: "auto",
icons: {
activeHeader: "ui-icon-triangle-1-s",
header: "ui-icon-triangle-1-e"
},
// Callbacks
activate: null,
beforeActivate: null
},
hideProps: {
borderTopWidth: "hide",
borderBottomWidth: "hide",
paddingTop: "hide",
paddingBottom: "hide",
height: "hide"
},
showProps: {
borderTopWidth: "show",
borderBottomWidth: "show",
paddingTop: "show",
paddingBottom: "show",
height: "show"
},
_create: function() {
var options = this.options;
this.prevShow = this.prevHide = $();
this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
this.element.attr( "role", "tablist" );
// Don't allow collapsible: false and active: false / null
if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
options.active = 0;
}
this._processPanels();
// handle negative values
if ( options.active < 0 ) {
options.active += this.headers.length;
}
this._refresh();
},
_getCreateEventData: function() {
return {
header: this.active,
panel: !this.active.length ? $() : this.active.next()
};
},
_createIcons: function() {
var icon, children,
icons = this.options.icons;
if ( icons ) {
icon = $( "<span>" );
this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
icon.prependTo( this.headers );
children = this.active.children( ".ui-accordion-header-icon" );
this._removeClass( children, icons.header )
._addClass( children, null, icons.activeHeader )
._addClass( this.headers, "ui-accordion-icons" );
}
},
_destroyIcons: function() {
this._removeClass( this.headers, "ui-accordion-icons" );
this.headers.children( ".ui-accordion-header-icon" ).remove();
},
_destroy: function() {
var contents;
// Clean up main element
this.element.removeAttr( "role" );
// Clean up headers
this.headers
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
.removeUniqueId();
this._destroyIcons();
// Clean up content panels
contents = this.headers.next()
.css( "display", "" )
.removeAttr( "role aria-hidden aria-labelledby" )
.removeUniqueId();
if ( this.options.heightStyle !== "content" ) {
contents.css( "height", "" );
}
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
if ( key === "event" ) {
if ( this.options.event ) {
this._off( this.headers, this.options.event );
}
this._setupEvents( value );
}
this._super( key, value );
// Setting collapsible: false while collapsed; open first panel
if ( key === "collapsible" && !value && this.options.active === false ) {
this._activate( 0 );
}
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
this._createIcons();
}
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", value );
// Support: IE8 Only
// #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
// so we need to add the disabled class to the headers and panels
this._toggleClass( null, "ui-state-disabled", !!value );
this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
!!value );
},
_keydown: function( event ) {
if ( event.altKey || event.ctrlKey ) {
return;
}
var keyCode = $.ui.keyCode,
length = this.headers.length,
currentIndex = this.headers.index( event.target ),
toFocus = false;
switch ( event.keyCode ) {
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
break;
case keyCode.HOME:
toFocus = this.headers[ 0 ];
break;
case keyCode.END:
toFocus = this.headers[ length - 1 ];
break;
}
if ( toFocus ) {
$( event.target ).attr( "tabIndex", -1 );
$( toFocus ).attr( "tabIndex", 0 );
$( toFocus ).trigger( "focus" );
event.preventDefault();
}
},
_panelKeyDown: function( event ) {
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
$( event.currentTarget ).prev().trigger( "focus" );
}
},
refresh: function() {
var options = this.options;
this._processPanels();
// Was collapsed or no panel
if ( ( options.active === false && options.collapsible === true ) ||
!this.headers.length ) {
options.active = false;
this.active = $();
// active false only when collapsible is true
} else if ( options.active === false ) {
this._activate( 0 );
// was active, but active panel is gone
} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
// all remaining panel are disabled
if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
options.active = false;
this.active = $();
// activate previous panel
} else {
this._activate( Math.max( 0, options.active - 1 ) );
}
// was active, active panel still exists
} else {
// make sure active index is correct
options.active = this.headers.index( this.active );
}
this._destroyIcons();
this._refresh();
},
_processPanels: function() {
var prevHeaders = this.headers,
prevPanels = this.panels;
if ( typeof this.options.header === "function" ) {
this.headers = this.options.header( this.element );
} else {
this.headers = this.element.find( this.options.header );
}
this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
"ui-state-default" );
this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
// Avoid memory leaks (#10056)
if ( prevPanels ) {
this._off( prevHeaders.not( this.headers ) );
this._off( prevPanels.not( this.panels ) );
}
},
_refresh: function() {
var maxHeight,
options = this.options,
heightStyle = options.heightStyle,
parent = this.element.parent();
this.active = this._findActive( options.active );
this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
._removeClass( this.active, "ui-accordion-header-collapsed" );
this._addClass( this.active.next(), "ui-accordion-content-active" );
this.active.next().show();
this.headers
.attr( "role", "tab" )
.each( function() {
var header = $( this ),
headerId = header.uniqueId().attr( "id" ),
panel = header.next(),
panelId = panel.uniqueId().attr( "id" );
header.attr( "aria-controls", panelId );
panel.attr( "aria-labelledby", headerId );
} )
.next()
.attr( "role", "tabpanel" );
this.headers
.not( this.active )
.attr( {
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
} )
.next()
.attr( {
"aria-hidden": "true"
} )
.hide();
// Make sure at least one header is in the tab order
if ( !this.active.length ) {
this.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
} )
.next()
.attr( {
"aria-hidden": "false"
} );
}
this._createIcons();
this._setupEvents( options.event );
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
this.element.siblings( ":visible" ).each( function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
return;
}
maxHeight -= elem.outerHeight( true );
} );
this.headers.each( function() {
maxHeight -= $( this ).outerHeight( true );
} );
this.headers.next()
.each( function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
} )
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.headers.next()
.each( function() {
var isVisible = $( this ).is( ":visible" );
if ( !isVisible ) {
$( this ).show();
}
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
if ( !isVisible ) {
$( this ).hide();
}
} )
.height( maxHeight );
}
},
_activate: function( index ) {
var active = this._findActive( index )[ 0 ];
// Trying to activate the already active panel
if ( active === this.active[ 0 ] ) {
return;
}
// Trying to collapse, simulate a click on the currently active header
active = active || this.active[ 0 ];
this._eventHandler( {
target: active,
currentTarget: active,
preventDefault: $.noop
} );
},
_findActive: function( selector ) {
return typeof selector === "number" ? this.headers.eq( selector ) : $();
},
_setupEvents: function( event ) {
var events = {
keydown: "_keydown"
};
if ( event ) {
$.each( event.split( " " ), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
} );
}
this._off( this.headers.add( this.headers.next() ) );
this._on( this.headers, events );
this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
this._hoverable( this.headers );
this._focusable( this.headers );
},
_eventHandler: function( event ) {
var activeChildren, clickedChildren,
options = this.options,
active = this.active,
clicked = $( event.currentTarget ),
clickedIsActive = clicked[ 0 ] === active[ 0 ],
collapsing = clickedIsActive && options.collapsible,
toShow = collapsing ? $() : clicked.next(),
toHide = active.next(),
eventData = {
oldHeader: active,
oldPanel: toHide,
newHeader: collapsing ? $() : clicked,
newPanel: toShow
};
event.preventDefault();
if (
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
}
options.active = collapsing ? false : this.headers.index( clicked );
// When the call to ._toggle() comes after the class changes
// it causes a very odd bug in IE 8 (see #6720)
this.active = clickedIsActive ? $() : clicked;
this._toggle( eventData );
// Switch classes
// corner classes on the previously active header stay after the animation
this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
if ( options.icons ) {
activeChildren = active.children( ".ui-accordion-header-icon" );
this._removeClass( activeChildren, null, options.icons.activeHeader )
._addClass( activeChildren, null, options.icons.header );
}
if ( !clickedIsActive ) {
this._removeClass( clicked, "ui-accordion-header-collapsed" )
._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
if ( options.icons ) {
clickedChildren = clicked.children( ".ui-accordion-header-icon" );
this._removeClass( clickedChildren, null, options.icons.header )
._addClass( clickedChildren, null, options.icons.activeHeader );
}
this._addClass( clicked.next(), "ui-accordion-content-active" );
}
},
_toggle: function( data ) {
var toShow = data.newPanel,
toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
// Handle activating a panel during the animation for another activation
this.prevShow.add( this.prevHide ).stop( true, true );
this.prevShow = toShow;
this.prevHide = toHide;
if ( this.options.animate ) {
this._animate( toShow, toHide, data );
} else {
toHide.hide();
toShow.show();
this._toggleComplete( data );
}
toHide.attr( {
"aria-hidden": "true"
} );
toHide.prev().attr( {
"aria-selected": "false",
"aria-expanded": "false"
} );
// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
if ( toShow.length && toHide.length ) {
toHide.prev().attr( {
"tabIndex": -1,
"aria-expanded": "false"
} );
} else if ( toShow.length ) {
this.headers.filter( function() {
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
} )
.attr( "tabIndex", -1 );
}
toShow
.attr( "aria-hidden", "false" )
.prev()
.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
} );
},
_animate: function( toShow, toHide, data ) {
var total, easing, duration,
that = this,
adjust = 0,
boxSizing = toShow.css( "box-sizing" ),
down = toShow.length &&
( !toHide.length || ( toShow.index() < toHide.index() ) ),
animate = this.options.animate || {},
options = down && animate.down || animate,
complete = function() {
that._toggleComplete( data );
};
if ( typeof options === "number" ) {
duration = options;
}
if ( typeof options === "string" ) {
easing = options;
}
// fall back from options to animation in case of partial down settings
easing = easing || options.easing || animate.easing;
duration = duration || options.duration || animate.duration;
if ( !toHide.length ) {
return toShow.animate( this.showProps, duration, easing, complete );
}
if ( !toShow.length ) {
return toHide.animate( this.hideProps, duration, easing, complete );
}
total = toShow.show().outerHeight();
toHide.animate( this.hideProps, {
duration: duration,
easing: easing,
step: function( now, fx ) {
fx.now = Math.round( now );
}
} );
toShow
.hide()
.animate( this.showProps, {
duration: duration,
easing: easing,
complete: complete,
step: function( now, fx ) {
fx.now = Math.round( now );
if ( fx.prop !== "height" ) {
if ( boxSizing === "content-box" ) {
adjust += fx.now;
}
} else if ( that.options.heightStyle !== "content" ) {
fx.now = Math.round( total - toHide.outerHeight() - adjust );
adjust = 0;
}
}
} );
},
_toggleComplete: function( data ) {
var toHide = data.oldPanel,
prev = toHide.prev();
this._removeClass( toHide, "ui-accordion-content-active" );
this._removeClass( prev, "ui-accordion-header-active" )
._addClass( prev, "ui-accordion-header-collapsed" );
// Work around for rendering bug in IE (#5421)
if ( toHide.length ) {
toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
}
this._trigger( "activate", null, data );
}
} );
/*!
* jQuery UI Menu 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Menu
//>>group: Widgets
//>>description: Creates nestable menus.
//>>docs: http://api.jqueryui.com/menu/
//>>demos: http://jqueryui.com/menu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/menu.css
//>>css.theme: ../../themes/base/theme.css
var widgetsMenu = $.widget( "ui.menu", {
version: "1.13.1",
defaultElement: "<ul>",
delay: 300,
options: {
icons: {
submenu: "ui-icon-caret-1-e"
},
items: "> *",
menus: "ul",
position: {
my: "left top",
at: "right top"
},
role: "menu",
// Callbacks
blur: null,
focus: null,
select: null
},
_create: function() {
this.activeMenu = this.element;
// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
this.lastMousePosition = { x: null, y: null };
this.element
.uniqueId()
.attr( {
role: this.options.role,
tabIndex: 0
} );
this._addClass( "ui-menu", "ui-widget ui-widget-content" );
this._on( {
// Prevent focus from sticking to links inside menu after clicking
// them (focus should always stay on UL during navigation).
"mousedown .ui-menu-item": function( event ) {
event.preventDefault();
this._activateItem( event );
},
"click .ui-menu-item": function( event ) {
var target = $( event.target );
var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
this.select( event );
// Only set the mouseHandled flag if the event will bubble, see #9469.
if ( !event.isPropagationStopped() ) {
this.mouseHandled = true;
}
// Open submenu on click
if ( target.has( ".ui-menu" ).length ) {
this.expand( event );
} else if ( !this.element.is( ":focus" ) &&
active.closest( ".ui-menu" ).length ) {
// Redirect focus to the menu
this.element.trigger( "focus", [ true ] );
// If the active item is on the top level, let it stay active.
// Otherwise, blur the active item since it is no longer visible.
if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
clearTimeout( this.timer );
}
}
}
},
"mouseenter .ui-menu-item": "_activateItem",
"mousemove .ui-menu-item": "_activateItem",
mouseleave: "collapseAll",
"mouseleave .ui-menu": "collapseAll",
focus: function( event, keepActiveItem ) {
// If there's already an active item, keep it active
// If not, activate the first item
var item = this.active || this._menuItems().first();
if ( !keepActiveItem ) {
this.focus( event, item );
}
},
blur: function( event ) {
this._delay( function() {
var notContained = !$.contains(
this.element[ 0 ],
$.ui.safeActiveElement( this.document[ 0 ] )
);
if ( notContained ) {
this.collapseAll( event );
}
} );
},
keydown: "_keydown"
} );
this.refresh();
// Clicks outside of a menu collapse any open menus
this._on( this.document, {
click: function( event ) {
if ( this._closeOnDocumentClick( event ) ) {
this.collapseAll( event, true );
}
// Reset the mouseHandled flag
this.mouseHandled = false;
}
} );
},
_activateItem: function( event ) {
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if ( this.previousFilter ) {
return;
}
// If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
if ( event.clientX === this.lastMousePosition.x &&
event.clientY === this.lastMousePosition.y ) {
return;
}
this.lastMousePosition = {
x: event.clientX,
y: event.clientY
};
var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
target = $( event.currentTarget );
// Ignore bubbled events on parent items, see #11641
if ( actualTarget[ 0 ] !== target[ 0 ] ) {
return;
}
// If the item is already active, there's nothing to do
if ( target.is( ".ui-state-active" ) ) {
return;
}
// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
this._removeClass( target.siblings().children( ".ui-state-active" ),
null, "ui-state-active" );
this.focus( event, target );
},
_destroy: function() {
var items = this.element.find( ".ui-menu-item" )
.removeAttr( "role aria-disabled" ),
submenus = items.children( ".ui-menu-item-wrapper" )
.removeUniqueId()
.removeAttr( "tabIndex role aria-haspopup" );
// Destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
.find( ".ui-menu" ).addBack()
.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
"tabIndex" )
.removeUniqueId()
.show();
submenus.children().each( function() {
var elem = $( this );
if ( elem.data( "ui-menu-submenu-caret" ) ) {
elem.remove();
}
} );
},
_keydown: function( event ) {
var match, prev, character, skip,
preventDefault = true;
switch ( event.keyCode ) {
case $.ui.keyCode.PAGE_UP:
this.previousPage( event );
break;
case $.ui.keyCode.PAGE_DOWN:
this.nextPage( event );
break;
case $.ui.keyCode.HOME:
this._move( "first", "first", event );
break;
case $.ui.keyCode.END:
this._move( "last", "last", event );
break;
case $.ui.keyCode.UP:
this.previous( event );
break;
case $.ui.keyCode.DOWN:
this.next( event );
break;
case $.ui.keyCode.LEFT:
this.collapse( event );
break;
case $.ui.keyCode.RIGHT:
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
this.expand( event );
}
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
this._activate( event );
break;
case $.ui.keyCode.ESCAPE:
this.collapse( event );
break;
default:
preventDefault = false;
prev = this.previousFilter || "";
skip = false;
// Support number pad values
character = event.keyCode >= 96 && event.keyCode <= 105 ?
( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
clearTimeout( this.filterTimer );
if ( character === prev ) {
skip = true;
} else {
character = prev + character;
}
match = this._filterMenuItems( character );
match = skip && match.index( this.active.next() ) !== -1 ?
this.active.nextAll( ".ui-menu-item" ) :
match;
// If no matches on the current filter, reset to the last character pressed
// to move down the menu to the first item that starts with that character
if ( !match.length ) {
character = String.fromCharCode( event.keyCode );
match = this._filterMenuItems( character );
}
if ( match.length ) {
this.focus( event, match );
this.previousFilter = character;
this.filterTimer = this._delay( function() {
delete this.previousFilter;
}, 1000 );
} else {
delete this.previousFilter;
}
}
if ( preventDefault ) {
event.preventDefault();
}
},
_activate: function( event ) {
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
if ( this.active.children( "[aria-haspopup='true']" ).length ) {
this.expand( event );
} else {
this.select( event );
}
}
},
refresh: function() {
var menus, items, newSubmenus, newItems, newWrappers,
that = this,
icon = this.options.icons.submenu,
submenus = this.element.find( this.options.menus );
this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
// Initialize nested menus
newSubmenus = submenus.filter( ":not(.ui-menu)" )
.hide()
.attr( {
role: this.options.role,
"aria-hidden": "true",
"aria-expanded": "false"
} )
.each( function() {
var menu = $( this ),
item = menu.prev(),
submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
item
.attr( "aria-haspopup", "true" )
.prepend( submenuCaret );
menu.attr( "aria-labelledby", item.attr( "id" ) );
} );
this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
menus = submenus.add( this.element );
items = menus.find( this.options.items );
// Initialize menu-items containing spaces and/or dashes only as dividers
items.not( ".ui-menu-item" ).each( function() {
var item = $( this );
if ( that._isDivider( item ) ) {
that._addClass( item, "ui-menu-divider", "ui-widget-content" );
}
} );
// Don't refresh list items that are already adapted
newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
newWrappers = newItems.children()
.not( ".ui-menu" )
.uniqueId()
.attr( {
tabIndex: -1,
role: this._itemRole()
} );
this._addClass( newItems, "ui-menu-item" )
._addClass( newWrappers, "ui-menu-item-wrapper" );
// Add aria-disabled attribute to any disabled menu item
items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
// If the active item has been removed, blur the menu
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
this.blur();
}
},
_itemRole: function() {
return {
menu: "menuitem",
listbox: "option"
}[ this.options.role ];
},
_setOption: function( key, value ) {
if ( key === "icons" ) {
var icons = this.element.find( ".ui-menu-icon" );
this._removeClass( icons, null, this.options.icons.submenu )
._addClass( icons, null, value.submenu );
}
this._super( key, value );
},
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", String( value ) );
this._toggleClass( null, "ui-state-disabled", !!value );
},
focus: function( event, item ) {
var nested, focused, activeParent;
this.blur( event, event && event.type === "focus" );
this._scrollIntoView( item );
this.active = item.first();
focused = this.active.children( ".ui-menu-item-wrapper" );
this._addClass( focused, null, "ui-state-active" );
// Only update aria-activedescendant if there's a role
// otherwise we assume focus is managed elsewhere
if ( this.options.role ) {
this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
}
// Highlight active parent menu item, if any
activeParent = this.active
.parent()
.closest( ".ui-menu-item" )
.children( ".ui-menu-item-wrapper" );
this._addClass( activeParent, null, "ui-state-active" );
if ( event && event.type === "keydown" ) {
this._close();
} else {
this.timer = this._delay( function() {
this._close();
}, this.delay );
}
nested = item.children( ".ui-menu" );
if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
this._startOpening( nested );
}
this.activeMenu = item.parent();
this._trigger( "focus", event, { item: item } );
},
_scrollIntoView: function( item ) {
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
if ( this._hasScroll() ) {
borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
scroll = this.activeMenu.scrollTop();
elementHeight = this.activeMenu.height();
itemHeight = item.outerHeight();
if ( offset < 0 ) {
this.activeMenu.scrollTop( scroll + offset );
} else if ( offset + itemHeight > elementHeight ) {
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
}
}
},
blur: function( event, fromFocus ) {
if ( !fromFocus ) {
clearTimeout( this.timer );
}
if ( !this.active ) {
return;
}
this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
null, "ui-state-active" );
this._trigger( "blur", event, { item: this.active } );
this.active = null;
},
_startOpening: function( submenu ) {
clearTimeout( this.timer );
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
// shift in the submenu position when mousing over the caret icon
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
return;
}
this.timer = this._delay( function() {
this._close();
this._open( submenu );
}, this.delay );
},
_open: function( submenu ) {
var position = $.extend( {
of: this.active
}, this.options.position );
clearTimeout( this.timer );
this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
.hide()
.attr( "aria-hidden", "true" );
submenu
.show()
.removeAttr( "aria-hidden" )
.attr( "aria-expanded", "true" )
.position( position );
},
collapseAll: function( event, all ) {
clearTimeout( this.timer );
this.timer = this._delay( function() {
// If we were passed an event, look for the submenu that contains the event
var currentMenu = all ? this.element :
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
// If we found no valid submenu ancestor, use the main menu to close all
// sub menus anyway
if ( !currentMenu.length ) {
currentMenu = this.element;
}
this._close( currentMenu );
this.blur( event );
// Work around active item staying active after menu is blurred
this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
this.activeMenu = currentMenu;
}, all ? 0 : this.delay );
},
// With no arguments, closes the currently active menu - if nothing is active
// it closes all menus. If passed an argument, it will search for menus BELOW
_close: function( startMenu ) {
if ( !startMenu ) {
startMenu = this.active ? this.active.parent() : this.element;
}
startMenu.find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" );
},
_closeOnDocumentClick: function( event ) {
return !$( event.target ).closest( ".ui-menu" ).length;
},
_isDivider: function( item ) {
// Match hyphen, em dash, en dash
return !/[^\-\u2014\u2013\s]/.test( item.text() );
},
collapse: function( event ) {
var newItem = this.active &&
this.active.parent().closest( ".ui-menu-item", this.element );
if ( newItem && newItem.length ) {
this._close();
this.focus( event, newItem );
}
},
expand: function( event ) {
var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first();
if ( newItem && newItem.length ) {
this._open( newItem.parent() );
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
this._delay( function() {
this.focus( event, newItem );
} );
}
},
next: function( event ) {
this._move( "next", "first", event );
},
previous: function( event ) {
this._move( "prev", "last", event );
},
isFirstItem: function() {
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
},
isLastItem: function() {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},
_menuItems: function( menu ) {
return ( menu || this.element )
.find( this.options.items )
.filter( ".ui-menu-item" );
},
_move: function( direction, filter, event ) {
var next;
if ( this.active ) {
if ( direction === "first" || direction === "last" ) {
next = this.active
[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
.last();
} else {
next = this.active
[ direction + "All" ]( ".ui-menu-item" )
.first();
}
}
if ( !next || !next.length || !this.active ) {
next = this._menuItems( this.activeMenu )[ filter ]();
}
this.focus( event, next );
},
nextPage: function( event ) {
var item, base, height;
if ( !this.active ) {
this.next( event );
return;
}
if ( this.isLastItem() ) {
return;
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.innerHeight();
// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
}
this.active.nextAll( ".ui-menu-item" ).each( function() {
item = $( this );
return item.offset().top - base - height < 0;
} );
this.focus( event, item );
} else {
this.focus( event, this._menuItems( this.activeMenu )
[ !this.active ? "first" : "last" ]() );
}
},
previousPage: function( event ) {
var item, base, height;
if ( !this.active ) {
this.next( event );
return;
}
if ( this.isFirstItem() ) {
return;
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.innerHeight();
// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
}
this.active.prevAll( ".ui-menu-item" ).each( function() {
item = $( this );
return item.offset().top - base + height > 0;
} );
this.focus( event, item );
} else {
this.focus( event, this._menuItems( this.activeMenu ).first() );
}
},
_hasScroll: function() {
return this.element.outerHeight() < this.element.prop( "scrollHeight" );
},
select: function( event ) {
// TODO: It should never be possible to not have an active item at this
// point, but the tests don't trigger mouseenter before click.
this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
var ui = { item: this.active };
if ( !this.active.has( ".ui-menu" ).length ) {
this.collapseAll( event, true );
}
this._trigger( "select", event, ui );
},
_filterMenuItems: function( character ) {
var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
regex = new RegExp( "^" + escapedCharacter, "i" );
return this.activeMenu
.find( this.options.items )
// Only match on items, not dividers or other content (#10571)
.filter( ".ui-menu-item" )
.filter( function() {
return regex.test(
String.prototype.trim.call(
$( this ).children( ".ui-menu-item-wrapper" ).text() ) );
} );
}
} );
/*!
* jQuery UI Autocomplete 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Autocomplete
//>>group: Widgets
//>>description: Lists suggested words as the user is typing.
//>>docs: http://api.jqueryui.com/autocomplete/
//>>demos: http://jqueryui.com/autocomplete/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/autocomplete.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.autocomplete", {
version: "1.13.1",
defaultElement: "<input>",
options: {
appendTo: null,
autoFocus: false,
delay: 300,
minLength: 1,
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
source: null,
// Callbacks
change: null,
close: null,
focus: null,
open: null,
response: null,
search: null,
select: null
},
requestIndex: 0,
pending: 0,
liveRegionTimer: null,
_create: function() {
// Some browsers only repeat keydown events, not keypress events,
// so we use the suppressKeyPress flag to determine if we've already
// handled the keydown event. #7269
// Unfortunately the code for & in keypress is the same as the up arrow,
// so we use the suppressKeyPressRepeat flag to avoid handling keypress
// events when we know the keydown event was used to modify the
// search term. #7799
var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
nodeName = this.element[ 0 ].nodeName.toLowerCase(),
isTextarea = nodeName === "textarea",
isInput = nodeName === "input";
// Textareas are always multi-line
// Inputs are always single-line, even if inside a contentEditable element
// IE also treats inputs as contentEditable
// All other element types are determined by whether or not they're contentEditable
this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true;
this._addClass( "ui-autocomplete-input" );
this.element.attr( "autocomplete", "off" );
this._on( this.element, {
keydown: function( event ) {
if ( this.element.prop( "readOnly" ) ) {
suppressKeyPress = true;
suppressInput = true;
suppressKeyPressRepeat = true;
return;
}
suppressKeyPress = false;
suppressInput = false;
suppressKeyPressRepeat = false;
var keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.PAGE_UP:
suppressKeyPress = true;
this._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
suppressKeyPress = true;
this._move( "nextPage", event );
break;
case keyCode.UP:
suppressKeyPress = true;
this._keyEvent( "previous", event );
break;
case keyCode.DOWN:
suppressKeyPress = true;
this._keyEvent( "next", event );
break;
case keyCode.ENTER:
// when menu is open and has focus
if ( this.menu.active ) {
// #6055 - Opera still allows the keypress to occur
// which causes forms to submit
suppressKeyPress = true;
event.preventDefault();
this.menu.select( event );
}
break;
case keyCode.TAB:
if ( this.menu.active ) {
this.menu.select( event );
}
break;
case keyCode.ESCAPE:
if ( this.menu.element.is( ":visible" ) ) {
if ( !this.isMultiLine ) {
this._value( this.term );
}
this.close( event );
// Different browsers have different default behavior for escape
// Single press can mean undo or clear
// Double press in IE means clear the whole form
event.preventDefault();
}
break;
default:
suppressKeyPressRepeat = true;
// search timeout should be triggered before the input value is changed
this._searchTimeout( event );
break;
}
},
keypress: function( event ) {
if ( suppressKeyPress ) {
suppressKeyPress = false;
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
event.preventDefault();
}
return;
}
if ( suppressKeyPressRepeat ) {
return;
}
// Replicate some key handlers to allow them to repeat in Firefox and Opera
var keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.PAGE_UP:
this._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
this._move( "nextPage", event );
break;
case keyCode.UP:
this._keyEvent( "previous", event );
break;
case keyCode.DOWN:
this._keyEvent( "next", event );
break;
}
},
input: function( event ) {
if ( suppressInput ) {
suppressInput = false;
event.preventDefault();
return;
}
this._searchTimeout( event );
},
focus: function() {
this.selectedItem = null;
this.previous = this._value();
},
blur: function( event ) {
clearTimeout( this.searching );
this.close( event );
this._change( event );
}
} );
this._initSource();
this.menu = $( "<ul>" )
.appendTo( this._appendTo() )
.menu( {
// disable ARIA support, the live region takes care of that
role: null
} )
.hide()
// Support: IE 11 only, Edge <= 14
// For other browsers, we preventDefault() on the mousedown event
// to keep the dropdown from taking focus from the input. This doesn't
// work for IE/Edge, causing problems with selection and scrolling (#9638)
// Happily, IE and Edge support an "unselectable" attribute that
// prevents an element from receiving focus, exactly what we want here.
.attr( {
"unselectable": "on"
} )
.menu( "instance" );
this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
this._on( this.menu.element, {
mousedown: function( event ) {
// Prevent moving focus out of the text field
event.preventDefault();
},
menufocus: function( event, ui ) {
var label, item;
// support: Firefox
// Prevent accidental activation of menu items in Firefox (#7024 #9118)
if ( this.isNewMenu ) {
this.isNewMenu = false;
if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
this.menu.blur();
this.document.one( "mousemove", function() {
$( event.target ).trigger( event.originalEvent );
} );
return;
}
}
item = ui.item.data( "ui-autocomplete-item" );
if ( false !== this._trigger( "focus", event, { item: item } ) ) {
// use value to match what will end up in the input, if it was a key event
if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
this._value( item.value );
}
}
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && String.prototype.trim.call( label ).length ) {
clearTimeout( this.liveRegionTimer );
this.liveRegionTimer = this._delay( function() {
this.liveRegion.html( $( "<div>" ).text( label ) );
}, 100 );
}
},
menuselect: function( event, ui ) {
var item = ui.item.data( "ui-autocomplete-item" ),
previous = this.previous;
// Only trigger when focus was lost (click on menu)
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
this.element.trigger( "focus" );
this.previous = previous;
// #6109 - IE triggers two focus events and the second
// is asynchronous, so we need to reset the previous
// term synchronously and asynchronously :-(
this._delay( function() {
this.previous = previous;
this.selectedItem = item;
} );
}
if ( false !== this._trigger( "select", event, { item: item } ) ) {
this._value( item.value );
}
// reset the term after the select event
// this allows custom select handling to work properly
this.term = this._value();
this.close( event );
this.selectedItem = item;
}
} );
this.liveRegion = $( "<div>", {
role: "status",
"aria-live": "assertive",
"aria-relevant": "additions"
} )
.appendTo( this.document[ 0 ].body );
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
// Turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on( this.window, {
beforeunload: function() {
this.element.removeAttr( "autocomplete" );
}
} );
},
_destroy: function() {
clearTimeout( this.searching );
this.element.removeAttr( "autocomplete" );
this.menu.element.remove();
this.liveRegion.remove();
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "source" ) {
this._initSource();
}
if ( key === "appendTo" ) {
this.menu.element.appendTo( this._appendTo() );
}
if ( key === "disabled" && value && this.xhr ) {
this.xhr.abort();
}
},
_isEventTargetInWidget: function( event ) {
var menuElement = this.menu.element[ 0 ];
return event.target === this.element[ 0 ] ||
event.target === menuElement ||
$.contains( menuElement, event.target );
},
_closeOnClickOutside: function( event ) {
if ( !this._isEventTargetInWidget( event ) ) {
this.close();
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element ) {
element = element.jquery || element.nodeType ?
$( element ) :
this.document.find( element ).eq( 0 );
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front, dialog" );
}
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_initSource: function() {
var array, url,
that = this;
if ( Array.isArray( this.options.source ) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
};
} else if ( typeof this.options.source === "string" ) {
url = this.options.source;
this.source = function( request, response ) {
if ( that.xhr ) {
that.xhr.abort();
}
that.xhr = $.ajax( {
url: url,
data: request,
dataType: "json",
success: function( data ) {
response( data );
},
error: function() {
response( [] );
}
} );
};
} else {
this.source = this.options.source;
}
},
_searchTimeout: function( event ) {
clearTimeout( this.searching );
this.searching = this._delay( function() {
// Search if the value has changed, or if the user retypes the same value (see #7434)
var equalValues = this.term === this._value(),
menuVisible = this.menu.element.is( ":visible" ),
modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
this.selectedItem = null;
this.search( null, event );
}
}, this.options.delay );
},
search: function( value, event ) {
value = value != null ? value : this._value();
// Always save the actual value, not the one passed as an argument
this.term = this._value();
if ( value.length < this.options.minLength ) {
return this.close( event );
}
if ( this._trigger( "search", event ) === false ) {
return;
}
return this._search( value );
},
_search: function( value ) {
this.pending++;
this._addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;
this.source( { term: value }, this._response() );
},
_response: function() {
var index = ++this.requestIndex;
return function( content ) {
if ( index === this.requestIndex ) {
this.__response( content );
}
this.pending--;
if ( !this.pending ) {
this._removeClass( "ui-autocomplete-loading" );
}
}.bind( this );
},
__response: function( content ) {
if ( content ) {
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
this._suggest( content );
this._trigger( "open" );
} else {
// use ._close() instead of .close() so we don't cancel future searches
this._close();
}
},
close: function( event ) {
this.cancelSearch = true;
this._close( event );
},
_close: function( event ) {
// Remove the handler that closes the menu on outside clicks
this._off( this.document, "mousedown" );
if ( this.menu.element.is( ":visible" ) ) {
this.menu.element.hide();
this.menu.blur();
this.isNewMenu = true;
this._trigger( "close", event );
}
},
_change: function( event ) {
if ( this.previous !== this._value() ) {
this._trigger( "change", event, { item: this.selectedItem } );
}
},
_normalize: function( items ) {
// assume all items have the right format when the first item is complete
if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
return items;
}
return $.map( items, function( item ) {
if ( typeof item === "string" ) {
return {
label: item,
value: item
};
}
return $.extend( {}, item, {
label: item.label || item.value,
value: item.value || item.label
} );
} );
},
_suggest: function( items ) {
var ul = this.menu.element.empty();
this._renderMenu( ul, items );
this.isNewMenu = true;
this.menu.refresh();
// Size and position menu
ul.show();
this._resizeMenu();
ul.position( $.extend( {
of: this.element
}, this.options.position ) );
if ( this.options.autoFocus ) {
this.menu.next();
}
// Listen for interactions outside of the widget (#6642)
this._on( this.document, {
mousedown: "_closeOnClickOutside"
} );
},
_resizeMenu: function() {
var ul = this.menu.element;
ul.outerWidth( Math.max(
// Firefox wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping (#7513)
ul.width( "" ).outerWidth() + 1,
this.element.outerWidth()
) );
},
_renderMenu: function( ul, items ) {
var that = this;
$.each( items, function( index, item ) {
that._renderItemData( ul, item );
} );
},
_renderItemData: function( ul, item ) {
return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
},
_renderItem: function( ul, item ) {
return $( "<li>" )
.append( $( "<div>" ).text( item.label ) )
.appendTo( ul );
},
_move: function( direction, event ) {
if ( !this.menu.element.is( ":visible" ) ) {
this.search( null, event );
return;
}
if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
this.menu.isLastItem() && /^next/.test( direction ) ) {
if ( !this.isMultiLine ) {
this._value( this.term );
}
this.menu.blur();
return;
}
this.menu[ direction ]( event );
},
widget: function() {
return this.menu.element;
},
_value: function() {
return this.valueMethod.apply( this.element, arguments );
},
_keyEvent: function( keyEvent, event ) {
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
this._move( keyEvent, event );
// Prevents moving cursor to beginning/end of the text field in some browsers
event.preventDefault();
}
},
// Support: Chrome <=50
// We should be able to just use this.element.prop( "isContentEditable" )
// but hidden elements always report false in Chrome.
// https://code.google.com/p/chromium/issues/detail?id=313082
_isContentEditable: function( element ) {
if ( !element.length ) {
return false;
}
var editable = element.prop( "contentEditable" );
if ( editable === "inherit" ) {
return this._isContentEditable( element.parent() );
}
return editable === "true";
}
} );
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
},
filter: function( array, term ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
return $.grep( array, function( value ) {
return matcher.test( value.label || value.value || value );
} );
}
} );
// Live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget( "ui.autocomplete", $.ui.autocomplete, {
options: {
messages: {
noResults: "No search results.",
results: function( amount ) {
return amount + ( amount > 1 ? " results are" : " result is" ) +
" available, use up and down arrow keys to navigate.";
}
}
},
__response: function( content ) {
var message;
this._superApply( arguments );
if ( this.options.disabled || this.cancelSearch ) {
return;
}
if ( content && content.length ) {
message = this.options.messages.results( content.length );
} else {
message = this.options.messages.noResults;
}
clearTimeout( this.liveRegionTimer );
this.liveRegionTimer = this._delay( function() {
this.liveRegion.html( $( "<div>" ).text( message ) );
}, 100 );
}
} );
var widgetsAutocomplete = $.ui.autocomplete;
/*!
* jQuery UI Controlgroup 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Controlgroup
//>>group: Widgets
//>>description: Visually groups form control widgets
//>>docs: http://api.jqueryui.com/controlgroup/
//>>demos: http://jqueryui.com/controlgroup/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/controlgroup.css
//>>css.theme: ../../themes/base/theme.css
var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
var widgetsControlgroup = $.widget( "ui.controlgroup", {
version: "1.13.1",
defaultElement: "<div>",
options: {
direction: "horizontal",
disabled: null,
onlyVisible: true,
items: {
"button": "input[type=button], input[type=submit], input[type=reset], button, a",
"controlgroupLabel": ".ui-controlgroup-label",
"checkboxradio": "input[type='checkbox'], input[type='radio']",
"selectmenu": "select",
"spinner": ".ui-spinner-input"
}
},
_create: function() {
this._enhance();
},
// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
_enhance: function() {
this.element.attr( "role", "toolbar" );
this.refresh();
},
_destroy: function() {
this._callChildMethod( "destroy" );
this.childWidgets.removeData( "ui-controlgroup-data" );
this.element.removeAttr( "role" );
if ( this.options.items.controlgroupLabel ) {
this.element
.find( this.options.items.controlgroupLabel )
.find( ".ui-controlgroup-label-contents" )
.contents().unwrap();
}
},
_initWidgets: function() {
var that = this,
childWidgets = [];
// First we iterate over each of the items options
$.each( this.options.items, function( widget, selector ) {
var labels;
var options = {};
// Make sure the widget has a selector set
if ( !selector ) {
return;
}
if ( widget === "controlgroupLabel" ) {
labels = that.element.find( selector );
labels.each( function() {
var element = $( this );
if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
return;
}
element.contents()
.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
} );
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
childWidgets = childWidgets.concat( labels.get() );
return;
}
// Make sure the widget actually exists
if ( !$.fn[ widget ] ) {
return;
}
// We assume everything is in the middle to start because we can't determine
// first / last elements until all enhancments are done.
if ( that[ "_" + widget + "Options" ] ) {
options = that[ "_" + widget + "Options" ]( "middle" );
} else {
options = { classes: {} };
}
// Find instances of this widget inside controlgroup and init them
that.element
.find( selector )
.each( function() {
var element = $( this );
var instance = element[ widget ]( "instance" );
// We need to clone the default options for this type of widget to avoid
// polluting the variable options which has a wider scope than a single widget.
var instanceOptions = $.widget.extend( {}, options );
// If the button is the child of a spinner ignore it
// TODO: Find a more generic solution
if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
return;
}
// Create the widget if it doesn't exist
if ( !instance ) {
instance = element[ widget ]()[ widget ]( "instance" );
}
if ( instance ) {
instanceOptions.classes =
that._resolveClassesValues( instanceOptions.classes, instance );
}
element[ widget ]( instanceOptions );
// Store an instance of the controlgroup to be able to reference
// from the outermost element for changing options and refresh
var widgetElement = element[ widget ]( "widget" );
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
instance ? instance : element[ widget ]( "instance" ) );
childWidgets.push( widgetElement[ 0 ] );
} );
} );
this.childWidgets = $( $.uniqueSort( childWidgets ) );
this._addClass( this.childWidgets, "ui-controlgroup-item" );
},
_callChildMethod: function( method ) {
this.childWidgets.each( function() {
var element = $( this ),
data = element.data( "ui-controlgroup-data" );
if ( data && data[ method ] ) {
data[ method ]();
}
} );
},
_updateCornerClass: function( element, position ) {
var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
var add = this._buildSimpleOptions( position, "label" ).classes.label;
this._removeClass( element, null, remove );
this._addClass( element, null, add );
},
_buildSimpleOptions: function( position, key ) {
var direction = this.options.direction === "vertical";
var result = {
classes: {}
};
result.classes[ key ] = {
"middle": "",
"first": "ui-corner-" + ( direction ? "top" : "left" ),
"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
"only": "ui-corner-all"
}[ position ];
return result;
},
_spinnerOptions: function( position ) {
var options = this._buildSimpleOptions( position, "ui-spinner" );
options.classes[ "ui-spinner-up" ] = "";
options.classes[ "ui-spinner-down" ] = "";
return options;
},
_buttonOptions: function( position ) {
return this._buildSimpleOptions( position, "ui-button" );
},
_checkboxradioOptions: function( position ) {
return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
},
_selectmenuOptions: function( position ) {
var direction = this.options.direction === "vertical";
return {
width: direction ? "auto" : false,
classes: {
middle: {
"ui-selectmenu-button-open": "",
"ui-selectmenu-button-closed": ""
},
first: {
"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
},
last: {
"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
},
only: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
}
}[ position ]
};
},
_resolveClassesValues: function( classes, instance ) {
var result = {};
$.each( classes, function( key ) {
var current = instance.options.classes[ key ] || "";
current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
} );
return result;
},
_setOption: function( key, value ) {
if ( key === "direction" ) {
this._removeClass( "ui-controlgroup-" + this.options.direction );
}
this._super( key, value );
if ( key === "disabled" ) {
this._callChildMethod( value ? "disable" : "enable" );
return;
}
this.refresh();
},
refresh: function() {
var children,
that = this;
this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
if ( this.options.direction === "horizontal" ) {
this._addClass( null, "ui-helper-clearfix" );
}
this._initWidgets();
children = this.childWidgets;
// We filter here because we need to track all childWidgets not just the visible ones
if ( this.options.onlyVisible ) {
children = children.filter( ":visible" );
}
if ( children.length ) {
// We do this last because we need to make sure all enhancment is done
// before determining first and last
$.each( [ "first", "last" ], function( index, value ) {
var instance = children[ value ]().data( "ui-controlgroup-data" );
if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
var options = that[ "_" + instance.widgetName + "Options" ](
children.length === 1 ? "only" : value
);
options.classes = that._resolveClassesValues( options.classes, instance );
instance.element[ instance.widgetName ]( options );
} else {
that._updateCornerClass( children[ value ](), value );
}
} );
// Finally call the refresh method on each of the child widgets.
this._callChildMethod( "refresh" );
}
}
} );
/*!
* jQuery UI Checkboxradio 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Checkboxradio
//>>group: Widgets
//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
//>>docs: http://api.jqueryui.com/checkboxradio/
//>>demos: http://jqueryui.com/checkboxradio/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.structure: ../../themes/base/checkboxradio.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
version: "1.13.1",
options: {
disabled: null,
label: null,
icon: true,
classes: {
"ui-checkboxradio-label": "ui-corner-all",
"ui-checkboxradio-icon": "ui-corner-all"
}
},
_getCreateOptions: function() {
var disabled, labels;
var that = this;
var options = this._super() || {};
// We read the type here, because it makes more sense to throw a element type error first,
// rather then the error for lack of a label. Often if its the wrong type, it
// won't have a label (e.g. calling on a div, btn, etc)
this._readType();
labels = this.element.labels();
// If there are multiple labels, use the last one
this.label = $( labels[ labels.length - 1 ] );
if ( !this.label.length ) {
$.error( "No label found for checkboxradio widget" );
}
this.originalLabel = "";
// We need to get the label text but this may also need to make sure it does not contain the
// input itself.
this.label.contents().not( this.element[ 0 ] ).each( function() {
// The label contents could be text, html, or a mix. We concat each element to get a
// string representation of the label, without the input as part of it.
that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
} );
// Set the label option if we found label text
if ( this.originalLabel ) {
options.label = this.originalLabel;
}
disabled = this.element[ 0 ].disabled;
if ( disabled != null ) {
options.disabled = disabled;
}
return options;
},
_create: function() {
var checked = this.element[ 0 ].checked;
this._bindFormResetHandler();
if ( this.options.disabled == null ) {
this.options.disabled = this.element[ 0 ].disabled;
}
this._setOption( "disabled", this.options.disabled );
this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
if ( this.type === "radio" ) {
this._addClass( this.label, "ui-checkboxradio-radio-label" );
}
if ( this.options.label && this.options.label !== this.originalLabel ) {
this._updateLabel();
} else if ( this.originalLabel ) {
this.options.label = this.originalLabel;
}
this._enhance();
if ( checked ) {
this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
}
this._on( {
change: "_toggleClasses",
focus: function() {
this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
},
blur: function() {
this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
}
} );
},
_readType: function() {
var nodeName = this.element[ 0 ].nodeName.toLowerCase();
this.type = this.element[ 0 ].type;
if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
" and element.type=" + this.type );
}
},
// Support jQuery Mobile enhanced option
_enhance: function() {
this._updateIcon( this.element[ 0 ].checked );
},
widget: function() {
return this.label;
},
_getRadioGroup: function() {
var group;
var name = this.element[ 0 ].name;
var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
if ( !name ) {
return $( [] );
}
if ( this.form.length ) {
group = $( this.form[ 0 ].elements ).filter( nameSelector );
} else {
// Not inside a form, check all inputs that also are not inside a form
group = $( nameSelector ).filter( function() {
return $( this )._form().length === 0;
} );
}
return group.not( this.element );
},
_toggleClasses: function() {
var checked = this.element[ 0 ].checked;
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
if ( this.options.icon && this.type === "checkbox" ) {
this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
}
if ( this.type === "radio" ) {
this._getRadioGroup()
.each( function() {
var instance = $( this ).checkboxradio( "instance" );
if ( instance ) {
instance._removeClass( instance.label,
"ui-checkboxradio-checked", "ui-state-active" );
}
} );
}
},
_destroy: function() {
this._unbindFormResetHandler();
if ( this.icon ) {
this.icon.remove();
this.iconSpace.remove();
}
},
_setOption: function( key, value ) {
// We don't allow the value to be set to nothing
if ( key === "label" && !value ) {
return;
}
this._super( key, value );
if ( key === "disabled" ) {
this._toggleClass( this.label, null, "ui-state-disabled", value );
this.element[ 0 ].disabled = value;
// Don't refresh when setting disabled
return;
}
this.refresh();
},
_updateIcon: function( checked ) {
var toAdd = "ui-icon ui-icon-background ";
if ( this.options.icon ) {
if ( !this.icon ) {
this.icon = $( "<span>" );
this.iconSpace = $( "<span> </span>" );
this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
}
if ( this.type === "checkbox" ) {
toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
} else {
toAdd += "ui-icon-blank";
}
this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
if ( !checked ) {
this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
}
this.icon.prependTo( this.label ).after( this.iconSpace );
} else if ( this.icon !== undefined ) {
this.icon.remove();
this.iconSpace.remove();
delete this.icon;
}
},
_updateLabel: function() {
// Remove the contents of the label ( minus the icon, icon space, and input )
var contents = this.label.contents().not( this.element[ 0 ] );
if ( this.icon ) {
contents = contents.not( this.icon[ 0 ] );
}
if ( this.iconSpace ) {
contents = contents.not( this.iconSpace[ 0 ] );
}
contents.remove();
this.label.append( this.options.label );
},
refresh: function() {
var checked = this.element[ 0 ].checked,
isDisabled = this.element[ 0 ].disabled;
this._updateIcon( checked );
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
if ( this.options.label !== null ) {
this._updateLabel();
}
if ( isDisabled !== this.options.disabled ) {
this._setOptions( { "disabled": isDisabled } );
}
}
} ] );
var widgetsCheckboxradio = $.ui.checkboxradio;
/*!
* jQuery UI Button 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Button
//>>group: Widgets
//>>description: Enhances a form with themeable buttons.
//>>docs: http://api.jqueryui.com/button/
//>>demos: http://jqueryui.com/button/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.button", {
version: "1.13.1",
defaultElement: "<button>",
options: {
classes: {
"ui-button": "ui-corner-all"
},
disabled: null,
icon: null,
iconPosition: "beginning",
label: null,
showLabel: true
},
_getCreateOptions: function() {
var disabled,
// This is to support cases like in jQuery Mobile where the base widget does have
// an implementation of _getCreateOptions
options = this._super() || {};
this.isInput = this.element.is( "input" );
disabled = this.element[ 0 ].disabled;
if ( disabled != null ) {
options.disabled = disabled;
}
this.originalLabel = this.isInput ? this.element.val() : this.element.html();
if ( this.originalLabel ) {
options.label = this.originalLabel;
}
return options;
},
_create: function() {
if ( !this.option.showLabel & !this.options.icon ) {
this.options.showLabel = true;
}
// We have to check the option again here even though we did in _getCreateOptions,
// because null may have been passed on init which would override what was set in
// _getCreateOptions
if ( this.options.disabled == null ) {
this.options.disabled = this.element[ 0 ].disabled || false;
}
this.hasTitle = !!this.element.attr( "title" );
// Check to see if the label needs to be set or if its already correct
if ( this.options.label && this.options.label !== this.originalLabel ) {
if ( this.isInput ) {
this.element.val( this.options.label );
} else {
this.element.html( this.options.label );
}
}
this._addClass( "ui-button", "ui-widget" );
this._setOption( "disabled", this.options.disabled );
this._enhance();
if ( this.element.is( "a" ) ) {
this._on( {
"keyup": function( event ) {
if ( event.keyCode === $.ui.keyCode.SPACE ) {
event.preventDefault();
// Support: PhantomJS <= 1.9, IE 8 Only
// If a native click is available use it so we actually cause navigation
// otherwise just trigger a click event
if ( this.element[ 0 ].click ) {
this.element[ 0 ].click();
} else {
this.element.trigger( "click" );
}
}
}
} );
}
},
_enhance: function() {
if ( !this.element.is( "button" ) ) {
this.element.attr( "role", "button" );
}
if ( this.options.icon ) {
this._updateIcon( "icon", this.options.icon );
this._updateTooltip();
}
},
_updateTooltip: function() {
this.title = this.element.attr( "title" );
if ( !this.options.showLabel && !this.title ) {
this.element.attr( "title", this.options.label );
}
},
_updateIcon: function( option, value ) {
var icon = option !== "iconPosition",
position = icon ? this.options.iconPosition : value,
displayBlock = position === "top" || position === "bottom";
// Create icon
if ( !this.icon ) {
this.icon = $( "<span>" );
this._addClass( this.icon, "ui-button-icon", "ui-icon" );
if ( !this.options.showLabel ) {
this._addClass( "ui-button-icon-only" );
}
} else if ( icon ) {
// If we are updating the icon remove the old icon class
this._removeClass( this.icon, null, this.options.icon );
}
// If we are updating the icon add the new icon class
if ( icon ) {
this._addClass( this.icon, null, value );
}
this._attachIcon( position );
// If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
// the iconSpace if there is one.
if ( displayBlock ) {
this._addClass( this.icon, null, "ui-widget-icon-block" );
if ( this.iconSpace ) {
this.iconSpace.remove();
}
} else {
// Position is beginning or end so remove the ui-widget-icon-block class and add the
// space if it does not exist
if ( !this.iconSpace ) {
this.iconSpace = $( "<span> </span>" );
this._addClass( this.iconSpace, "ui-button-icon-space" );
}
this._removeClass( this.icon, null, "ui-wiget-icon-block" );
this._attachIconSpace( position );
}
},
_destroy: function() {
this.element.removeAttr( "role" );
if ( this.icon ) {
this.icon.remove();
}
if ( this.iconSpace ) {
this.iconSpace.remove();
}
if ( !this.hasTitle ) {
this.element.removeAttr( "title" );
}
},
_attachIconSpace: function( iconPosition ) {
this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
},
_attachIcon: function( iconPosition ) {
this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
},
_setOptions: function( options ) {
var newShowLabel = options.showLabel === undefined ?
this.options.showLabel :
options.showLabel,
newIcon = options.icon === undefined ? this.options.icon : options.icon;
if ( !newShowLabel && !newIcon ) {
options.showLabel = true;
}
this._super( options );
},
_setOption: function( key, value ) {
if ( key === "icon" ) {
if ( value ) {
this._updateIcon( key, value );
} else if ( this.icon ) {
this.icon.remove();
if ( this.iconSpace ) {
this.iconSpace.remove();
}
}
}
if ( key === "iconPosition" ) {
this._updateIcon( key, value );
}
// Make sure we can't end up with a button that has neither text nor icon
if ( key === "showLabel" ) {
this._toggleClass( "ui-button-icon-only", null, !value );
this._updateTooltip();
}
if ( key === "label" ) {
if ( this.isInput ) {
this.element.val( value );
} else {
// If there is an icon, append it, else nothing then append the value
// this avoids removal of the icon when setting label text
this.element.html( value );
if ( this.icon ) {
this._attachIcon( this.options.iconPosition );
this._attachIconSpace( this.options.iconPosition );
}
}
}
this._super( key, value );
if ( key === "disabled" ) {
this._toggleClass( null, "ui-state-disabled", value );
this.element[ 0 ].disabled = value;
if ( value ) {
this.element.trigger( "blur" );
}
}
},
refresh: function() {
// Make sure to only check disabled if its an element that supports this otherwise
// check for the disabled class to determine state
var isDisabled = this.element.is( "input, button" ) ?
this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) {
this._setOptions( { disabled: isDisabled } );
}
this._updateTooltip();
}
} );
// DEPRECATED
if ( $.uiBackCompat !== false ) {
// Text and Icons options
$.widget( "ui.button", $.ui.button, {
options: {
text: true,
icons: {
primary: null,
secondary: null
}
},
_create: function() {
if ( this.options.showLabel && !this.options.text ) {
this.options.showLabel = this.options.text;
}
if ( !this.options.showLabel && this.options.text ) {
this.options.text = this.options.showLabel;
}
if ( !this.options.icon && ( this.options.icons.primary ||
this.options.icons.secondary ) ) {
if ( this.options.icons.primary ) {
this.options.icon = this.options.icons.primary;
} else {
this.options.icon = this.options.icons.secondary;
this.options.iconPosition = "end";
}
} else if ( this.options.icon ) {
this.options.icons.primary = this.options.icon;
}
this._super();
},
_setOption: function( key, value ) {
if ( key === "text" ) {
this._super( "showLabel", value );
return;
}
if ( key === "showLabel" ) {
this.options.text = value;
}
if ( key === "icon" ) {
this.options.icons.primary = value;
}
if ( key === "icons" ) {
if ( value.primary ) {
this._super( "icon", value.primary );
this._super( "iconPosition", "beginning" );
} else if ( value.secondary ) {
this._super( "icon", value.secondary );
this._super( "iconPosition", "end" );
}
}
this._superApply( arguments );
}
} );
$.fn.button = ( function( orig ) {
return function( options ) {
var isMethodCall = typeof options === "string";
var args = Array.prototype.slice.call( arguments, 1 );
var returnValue = this;
if ( isMethodCall ) {
// If this is an empty collection, we need to have the instance method
// return undefined instead of the jQuery instance
if ( !this.length && options === "instance" ) {
returnValue = undefined;
} else {
this.each( function() {
var methodValue;
var type = $( this ).attr( "type" );
var name = type !== "checkbox" && type !== "radio" ?
"button" :
"checkboxradio";
var instance = $.data( this, "ui-" + name );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on button" +
" prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( typeof instance[ options ] !== "function" ||
options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for button" +
" widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
} );
}
} else {
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat( args ) );
}
this.each( function() {
var type = $( this ).attr( "type" );
var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
var instance = $.data( this, "ui-" + name );
if ( instance ) {
instance.option( options || {} );
if ( instance._init ) {
instance._init();
}
} else {
if ( name === "button" ) {
orig.call( $( this ), options );
return;
}
$( this ).checkboxradio( $.extend( { icon: false }, options ) );
}
} );
}
return returnValue;
};
} )( $.fn.button );
$.fn.buttonset = function() {
if ( !$.ui.controlgroup ) {
$.error( "Controlgroup widget missing" );
}
if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
return this.controlgroup.apply( this,
[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
}
if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
}
if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
arguments[ 0 ].items = {
button: arguments[ 0 ].items
};
}
return this.controlgroup.apply( this, arguments );
};
}
var widgetsButton = $.ui.button;
/* eslint-disable max-len, camelcase */
/*!
* jQuery UI Datepicker 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Datepicker
//>>group: Widgets
//>>description: Displays a calendar from an input or inline for selecting dates.
//>>docs: http://api.jqueryui.com/datepicker/
//>>demos: http://jqueryui.com/datepicker/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/datepicker.css
//>>css.theme: ../../themes/base/theme.css
$.extend( $.ui, { datepicker: { version: "1.13.1" } } );
var datepicker_instActive;
function datepicker_getZindex( elem ) {
var position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
return 0;
}
/* Date picker manager.
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
Settings for (groups of) date pickers are maintained in an instance object,
allowing multiple different settings on the same page. */
function Datepicker() {
this._curInst = null; // The current instance in use
this._keyEvent = false; // If the last event was a key event
this._disabledInputs = []; // List of date picker inputs that have been disabled
this._datepickerShowing = false; // True if the popup picker is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
this._appendClass = "ui-datepicker-append"; // The name of the append marker class
this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
this.regional = []; // Available regional settings, indexed by language code
this.regional[ "" ] = { // Default regional settings
closeText: "Done", // Display text for close link
prevText: "Prev", // Display text for previous month link
nextText: "Next", // Display text for next month link
currentText: "Today", // Display text for current month link
monthNames: [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday
weekHeader: "Wk", // Column header for week of the year
dateFormat: "mm/dd/yy", // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false, // True if right-to-left language, false if left-to-right
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
yearSuffix: "", // Additional text to append to the year in the month headers,
selectMonthLabel: "Select month", // Invisible label for month selector
selectYearLabel: "Select year" // Invisible label for year selector
};
this._defaults = { // Global defaults for all the date picker instances
showOn: "focus", // "focus" for popup on focus,
// "button" for trigger button, or "both" for either
showAnim: "fadeIn", // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText: "", // Display text following the input box, e.g. showing the format
buttonText: "...", // Text for trigger button
buttonImage: "", // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: false, // True if month can be selected directly, false if only prev/next
changeYear: false, // True if year can be selected directly, false if only prev/next
yearRange: "c-10:c+10", // Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to leave blank
selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
showWeek: false, // True to show week of the year, false to not show it
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff: "+10", // Short year values < this are in the current century,
// > this are in the previous century,
// string value starting with "+" for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
duration: "fast", // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow: null, // Function that takes an input field and
// returns a set of custom settings for the date picker
onSelect: null, // Define a callback function when a date is selected
onChangeMonthYear: null, // Define a callback function when the month or year is changed
onClose: null, // Define a callback function when the datepicker is closed
onUpdateDatepicker: null, // Define a callback function when the datepicker is updated
numberOfMonths: 1, // Number of months to show at a time
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big links
altField: "", // Selector for an alternate field to store selected dates into
altFormat: "", // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
showButtonPanel: false, // True to show button panel, false to not show it
autoSize: false, // True to size the input for the date format, false to leave as is
disabled: false // The initial disabled state
};
$.extend( this._defaults, this.regional[ "" ] );
this.regional.en = $.extend( true, {}, this.regional[ "" ] );
this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
}
$.extend( Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */
markerClassName: "hasDatepicker",
//Keep track of the maximum number of rows displayed (see #7043)
maxRows: 4,
// TODO rename to "widget" when switching to widget factory
_widgetDatepicker: function() {
return this.dpDiv;
},
/* Override the default settings for all instances of the date picker.
* @param settings object - the new settings to use as defaults (anonymous object)
* @return the manager object
*/
setDefaults: function( settings ) {
datepicker_extendRemove( this._defaults, settings || {} );
return this;
},
/* Attach the date picker to a jQuery selection.
* @param target element - the target input field or division or span
* @param settings object - the new settings to use for this date picker instance (anonymous)
*/
_attachDatepicker: function( target, settings ) {
var nodeName, inline, inst;
nodeName = target.nodeName.toLowerCase();
inline = ( nodeName === "div" || nodeName === "span" );
if ( !target.id ) {
this.uuid += 1;
target.id = "dp" + this.uuid;
}
inst = this._newInst( $( target ), inline );
inst.settings = $.extend( {}, settings || {} );
if ( nodeName === "input" ) {
this._connectDatepicker( target, inst );
} else if ( inline ) {
this._inlineDatepicker( target, inst );
}
},
/* Create a new instance object. */
_newInst: function( target, inline ) {
var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
return { id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
inline: inline, // is datepicker inline or not
dpDiv: ( !inline ? this.dpDiv : // presentation div
datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
},
/* Attach the date picker to an input field. */
_connectDatepicker: function( target, inst ) {
var input = $( target );
inst.append = $( [] );
inst.trigger = $( [] );
if ( input.hasClass( this.markerClassName ) ) {
return;
}
this._attachments( input, inst );
input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
this._autoSize( inst );
$.data( target, "datepicker", inst );
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
if ( inst.settings.disabled ) {
this._disableDatepicker( target );
}
},
/* Make attachments based on settings. */
_attachments: function( input, inst ) {
var showOn, buttonText, buttonImage,
appendText = this._get( inst, "appendText" ),
isRTL = this._get( inst, "isRTL" );
if ( inst.append ) {
inst.append.remove();
}
if ( appendText ) {
inst.append = $( "<span>" )
.addClass( this._appendClass )
.text( appendText );
input[ isRTL ? "before" : "after" ]( inst.append );
}
input.off( "focus", this._showDatepicker );
if ( inst.trigger ) {
inst.trigger.remove();
}
showOn = this._get( inst, "showOn" );
if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
input.on( "focus", this._showDatepicker );
}
if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
buttonText = this._get( inst, "buttonText" );
buttonImage = this._get( inst, "buttonImage" );
if ( this._get( inst, "buttonImageOnly" ) ) {
inst.trigger = $( "<img>" )
.addClass( this._triggerClass )
.attr( {
src: buttonImage,
alt: buttonText,
title: buttonText
} );
} else {
inst.trigger = $( "<button type='button'>" )
.addClass( this._triggerClass );
if ( buttonImage ) {
inst.trigger.html(
$( "<img>" )
.attr( {
src: buttonImage,
alt: buttonText,
title: buttonText
} )
);
} else {
inst.trigger.text( buttonText );
}
}
input[ isRTL ? "before" : "after" ]( inst.trigger );
inst.trigger.on( "click", function() {
if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
$.datepicker._hideDatepicker();
} else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
$.datepicker._hideDatepicker();
$.datepicker._showDatepicker( input[ 0 ] );
} else {
$.datepicker._showDatepicker( input[ 0 ] );
}
return false;
} );
}
},
/* Apply the maximum length for the date format. */
_autoSize: function( inst ) {
if ( this._get( inst, "autoSize" ) && !inst.inline ) {
var findMax, max, maxI, i,
date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
dateFormat = this._get( inst, "dateFormat" );
if ( dateFormat.match( /[DM]/ ) ) {
findMax = function( names ) {
max = 0;
maxI = 0;
for ( i = 0; i < names.length; i++ ) {
if ( names[ i ].length > max ) {
max = names[ i ].length;
maxI = i;
}
}
return maxI;
};
date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
"monthNames" : "monthNamesShort" ) ) ) );
date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
"dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
}
inst.input.attr( "size", this._formatDate( inst, date ).length );
}
},
/* Attach an inline date picker to a div. */
_inlineDatepicker: function( target, inst ) {
var divSpan = $( target );
if ( divSpan.hasClass( this.markerClassName ) ) {
return;
}
divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
$.data( target, "datepicker", inst );
this._setDate( inst, this._getDefaultDate( inst ), true );
this._updateDatepicker( inst );
this._updateAlternate( inst );
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
if ( inst.settings.disabled ) {
this._disableDatepicker( target );
}
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
inst.dpDiv.css( "display", "block" );
},
/* Pop-up the date picker in a "dialog" box.
* @param input element - ignored
* @param date string or Date - the initial date to display
* @param onSelect function - the function to call when a date is selected
* @param settings object - update the dialog date picker instance's settings (anonymous object)
* @param pos int[2] - coordinates for the dialog's position within the screen or
* event - with x/y coordinates or
* leave empty for default (screen centre)
* @return the manager object
*/
_dialogDatepicker: function( input, date, onSelect, settings, pos ) {
var id, browserWidth, browserHeight, scrollX, scrollY,
inst = this._dialogInst; // internal instance
if ( !inst ) {
this.uuid += 1;
id = "dp" + this.uuid;
this._dialogInput = $( "<input type='text' id='" + id +
"' style='position: absolute; top: -100px; width: 0px;'/>" );
this._dialogInput.on( "keydown", this._doKeyDown );
$( "body" ).append( this._dialogInput );
inst = this._dialogInst = this._newInst( this._dialogInput, false );
inst.settings = {};
$.data( this._dialogInput[ 0 ], "datepicker", inst );
}
datepicker_extendRemove( inst.settings, settings || {} );
date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
this._dialogInput.val( date );
this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
if ( !this._pos ) {
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
scrollY = document.documentElement.scrollTop || document.body.scrollTop;
this._pos = // should use actual width/height below
[ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
}
// Move input on screen for focus, but hidden behind dialog
this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass( this._dialogClass );
this._showDatepicker( this._dialogInput[ 0 ] );
if ( $.blockUI ) {
$.blockUI( this.dpDiv );
}
$.data( this._dialogInput[ 0 ], "datepicker", inst );
return this;
},
/* Detach a datepicker from its control.
* @param target element - the target input field or division or span
*/
_destroyDatepicker: function( target ) {
var nodeName,
$target = $( target ),
inst = $.data( target, "datepicker" );
if ( !$target.hasClass( this.markerClassName ) ) {
return;
}
nodeName = target.nodeName.toLowerCase();
$.removeData( target, "datepicker" );
if ( nodeName === "input" ) {
inst.append.remove();
inst.trigger.remove();
$target.removeClass( this.markerClassName ).
off( "focus", this._showDatepicker ).
off( "keydown", this._doKeyDown ).
off( "keypress", this._doKeyPress ).
off( "keyup", this._doKeyUp );
} else if ( nodeName === "div" || nodeName === "span" ) {
$target.removeClass( this.markerClassName ).empty();
}
if ( datepicker_instActive === inst ) {
datepicker_instActive = null;
this._curInst = null;
}
},
/* Enable the date picker to a jQuery selection.
* @param target element - the target input field or division or span
*/
_enableDatepicker: function( target ) {
var nodeName, inline,
$target = $( target ),
inst = $.data( target, "datepicker" );
if ( !$target.hasClass( this.markerClassName ) ) {
return;
}
nodeName = target.nodeName.toLowerCase();
if ( nodeName === "input" ) {
target.disabled = false;
inst.trigger.filter( "button" ).
each( function() {
this.disabled = false;
} ).end().
filter( "img" ).css( { opacity: "1.0", cursor: "" } );
} else if ( nodeName === "div" || nodeName === "span" ) {
inline = $target.children( "." + this._inlineClass );
inline.children().removeClass( "ui-state-disabled" );
inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
prop( "disabled", false );
}
this._disabledInputs = $.map( this._disabledInputs,
// Delete entry
function( value ) {
return ( value === target ? null : value );
} );
},
/* Disable the date picker to a jQuery selection.
* @param target element - the target input field or division or span
*/
_disableDatepicker: function( target ) {
var nodeName, inline,
$target = $( target ),
inst = $.data( target, "datepicker" );
if ( !$target.hasClass( this.markerClassName ) ) {
return;
}
nodeName = target.nodeName.toLowerCase();
if ( nodeName === "input" ) {
target.disabled = true;
inst.trigger.filter( "button" ).
each( function() {
this.disabled = true;
} ).end().
filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
} else if ( nodeName === "div" || nodeName === "span" ) {
inline = $target.children( "." + this._inlineClass );
inline.children().addClass( "ui-state-disabled" );
inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
prop( "disabled", true );
}
this._disabledInputs = $.map( this._disabledInputs,
// Delete entry
function( value ) {
return ( value === target ? null : value );
} );
this._disabledInputs[ this._disabledInputs.length ] = target;
},
/* Is the first field in a jQuery collection disabled as a datepicker?
* @param target element - the target input field or division or span
* @return boolean - true if disabled, false if enabled
*/
_isDisabledDatepicker: function( target ) {
if ( !target ) {
return false;
}
for ( var i = 0; i < this._disabledInputs.length; i++ ) {
if ( this._disabledInputs[ i ] === target ) {
return true;
}
}
return false;
},
/* Retrieve the instance data for the target control.
* @param target element - the target input field or division or span
* @return object - the associated instance data
* @throws error if a jQuery problem getting data
*/
_getInst: function( target ) {
try {
return $.data( target, "datepicker" );
} catch ( err ) {
throw "Missing instance data for this datepicker";
}
},
/* Update or retrieve the settings for a date picker attached to an input field or division.
* @param target element - the target input field or division or span
* @param name object - the new settings to update or
* string - the name of the setting to change or retrieve,
* when retrieving also "all" for all instance settings or
* "defaults" for all global defaults
* @param value any - the new value for the setting
* (omit if above is an object or to retrieve a value)
*/
_optionDatepicker: function( target, name, value ) {
var settings, date, minDate, maxDate,
inst = this._getInst( target );
if ( arguments.length === 2 && typeof name === "string" ) {
return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
this._get( inst, name ) ) : null ) );
}
settings = name || {};
if ( typeof name === "string" ) {
settings = {};
settings[ name ] = value;
}
if ( inst ) {
if ( this._curInst === inst ) {
this._hideDatepicker();
}
date = this._getDateDatepicker( target, true );
minDate = this._getMinMaxDate( inst, "min" );
maxDate = this._getMinMaxDate( inst, "max" );
datepicker_extendRemove( inst.settings, settings );
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
inst.settings.minDate = this._formatDate( inst, minDate );
}
if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
inst.settings.maxDate = this._formatDate( inst, maxDate );
}
if ( "disabled" in settings ) {
if ( settings.disabled ) {
this._disableDatepicker( target );
} else {
this._enableDatepicker( target );
}
}
this._attachments( $( target ), inst );
this._autoSize( inst );
this._setDate( inst, date );
this._updateAlternate( inst );
this._updateDatepicker( inst );
}
},
// Change method deprecated
_changeDatepicker: function( target, name, value ) {
this._optionDatepicker( target, name, value );
},
/* Redraw the date picker attached to an input field or division.
* @param target element - the target input field or division or span
*/
_refreshDatepicker: function( target ) {
var inst = this._getInst( target );
if ( inst ) {
this._updateDatepicker( inst );
}
},
/* Set the dates for a jQuery selection.
* @param target element - the target input field or division or span
* @param date Date - the new date
*/
_setDateDatepicker: function( target, date ) {
var inst = this._getInst( target );
if ( inst ) {
this._setDate( inst, date );
this._updateDatepicker( inst );
this._updateAlternate( inst );
}
},
/* Get the date(s) for the first entry in a jQuery selection.
* @param target element - the target input field or division or span
* @param noDefault boolean - true if no default date is to be used
* @return Date - the current date
*/
_getDateDatepicker: function( target, noDefault ) {
var inst = this._getInst( target );
if ( inst && !inst.inline ) {
this._setDateFromField( inst, noDefault );
}
return ( inst ? this._getDate( inst ) : null );
},
/* Handle keystrokes. */
_doKeyDown: function( event ) {
var onSelect, dateStr, sel,
inst = $.datepicker._getInst( event.target ),
handled = true,
isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
inst._keyEvent = true;
if ( $.datepicker._datepickerShowing ) {
switch ( event.keyCode ) {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
$.datepicker._currentClass + ")", inst.dpDiv );
if ( sel[ 0 ] ) {
$.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
}
onSelect = $.datepicker._get( inst, "onSelect" );
if ( onSelect ) {
dateStr = $.datepicker._formatDate( inst );
// Trigger custom callback
onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
} else {
$.datepicker._hideDatepicker();
}
return false; // don't submit the form
case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
-$.datepicker._get( inst, "stepBigMonths" ) :
-$.datepicker._get( inst, "stepMonths" ) ), "M" );
break; // previous month/year on page up/+ ctrl
case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
+$.datepicker._get( inst, "stepBigMonths" ) :
+$.datepicker._get( inst, "stepMonths" ) ), "M" );
break; // next month/year on page down/+ ctrl
case 35: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._clearDate( event.target );
}
handled = event.ctrlKey || event.metaKey;
break; // clear on ctrl or command +end
case 36: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._gotoToday( event.target );
}
handled = event.ctrlKey || event.metaKey;
break; // current on ctrl or command +home
case 37: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
}
handled = event.ctrlKey || event.metaKey;
// -1 day on ctrl or command +left
if ( event.originalEvent.altKey ) {
$.datepicker._adjustDate( event.target, ( event.ctrlKey ?
-$.datepicker._get( inst, "stepBigMonths" ) :
-$.datepicker._get( inst, "stepMonths" ) ), "M" );
}
// next month/year on alt +left on Mac
break;
case 38: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._adjustDate( event.target, -7, "D" );
}
handled = event.ctrlKey || event.metaKey;
break; // -1 week on ctrl or command +up
case 39: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
}
handled = event.ctrlKey || event.metaKey;
// +1 day on ctrl or command +right
if ( event.originalEvent.altKey ) {
$.datepicker._adjustDate( event.target, ( event.ctrlKey ?
+$.datepicker._get( inst, "stepBigMonths" ) :
+$.datepicker._get( inst, "stepMonths" ) ), "M" );
}
// next month/year on alt +right
break;
case 40: if ( event.ctrlKey || event.metaKey ) {
$.datepicker._adjustDate( event.target, +7, "D" );
}
handled = event.ctrlKey || event.metaKey;
break; // +1 week on ctrl or command +down
default: handled = false;
}
} else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
$.datepicker._showDatepicker( this );
} else {
handled = false;
}
if ( handled ) {
event.preventDefault();
event.stopPropagation();
}
},
/* Filter entered characters - based on date format. */
_doKeyPress: function( event ) {
var chars, chr,
inst = $.datepicker._getInst( event.target );
if ( $.datepicker._get( inst, "constrainInput" ) ) {
chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
}
},
/* Synchronise manual entry and field/alternate field. */
_doKeyUp: function( event ) {
var date,
inst = $.datepicker._getInst( event.target );
if ( inst.input.val() !== inst.lastVal ) {
try {
date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
( inst.input ? inst.input.val() : null ),
$.datepicker._getFormatConfig( inst ) );
if ( date ) { // only if valid
$.datepicker._setDateFromField( inst );
$.datepicker._updateAlternate( inst );
$.datepicker._updateDatepicker( inst );
}
} catch ( err ) {
}
}
return true;
},
/* Pop-up the date picker for a given input field.
* If false returned from beforeShow event handler do not show.
* @param input element - the input field attached to the date picker or
* event - if triggered by focus
*/
_showDatepicker: function( input ) {
input = input.target || input;
if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
input = $( "input", input.parentNode )[ 0 ];
}
if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
return;
}
var inst, beforeShow, beforeShowSettings, isFixed,
offset, showAnim, duration;
inst = $.datepicker._getInst( input );
if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
$.datepicker._curInst.dpDiv.stop( true, true );
if ( inst && $.datepicker._datepickerShowing ) {
$.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
}
}
beforeShow = $.datepicker._get( inst, "beforeShow" );
beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
if ( beforeShowSettings === false ) {
return;
}
datepicker_extendRemove( inst.settings, beforeShowSettings );
inst.lastVal = null;
$.datepicker._lastInput = input;
$.datepicker._setDateFromField( inst );
if ( $.datepicker._inDialog ) { // hide cursor
input.value = "";
}
if ( !$.datepicker._pos ) { // position below input
$.datepicker._pos = $.datepicker._findPos( input );
$.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
}
isFixed = false;
$( input ).parents().each( function() {
isFixed |= $( this ).css( "position" ) === "fixed";
return !isFixed;
} );
offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
$.datepicker._pos = null;
//to avoid flashes on Firefox
inst.dpDiv.empty();
// determine sizing offscreen
inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
$.datepicker._updateDatepicker( inst );
// fix width for dynamic number of date pickers
// and adjust position before showing
offset = $.datepicker._checkOffset( inst, offset, isFixed );
inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
"static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
left: offset.left + "px", top: offset.top + "px" } );
if ( !inst.inline ) {
showAnim = $.datepicker._get( inst, "showAnim" );
duration = $.datepicker._get( inst, "duration" );
inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
$.datepicker._datepickerShowing = true;
if ( $.effects && $.effects.effect[ showAnim ] ) {
inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
} else {
inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
}
if ( $.datepicker._shouldFocusInput( inst ) ) {
inst.input.trigger( "focus" );
}
$.datepicker._curInst = inst;
}
},
/* Generate the date picker content. */
_updateDatepicker: function( inst ) {
this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
datepicker_instActive = inst; // for delegate hover events
inst.dpDiv.empty().append( this._generateHTML( inst ) );
this._attachHandlers( inst );
var origyearshtml,
numMonths = this._getNumberOfMonths( inst ),
cols = numMonths[ 1 ],
width = 17,
activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),
onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" );
if ( activeCell.length > 0 ) {
datepicker_handleMouseover.apply( activeCell.get( 0 ) );
}
inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
if ( cols > 1 ) {
inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
}
inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
"Class" ]( "ui-datepicker-multi" );
inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
"Class" ]( "ui-datepicker-rtl" );
if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
inst.input.trigger( "focus" );
}
// Deffered render of the years select (to avoid flashes on Firefox)
if ( inst.yearshtml ) {
origyearshtml = inst.yearshtml;
setTimeout( function() {
//assure that inst.yearshtml didn't change.
if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml );
}
origyearshtml = inst.yearshtml = null;
}, 0 );
}
if ( onUpdateDatepicker ) {
onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );
}
},
// #6694 - don't focus the input if it's already focused
// this breaks the change event in IE
// Support: IE and jQuery <1.9
_shouldFocusInput: function( inst ) {
return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
},
/* Check positioning to remain on screen. */
_checkOffset: function( inst, offset, isFixed ) {
var dpWidth = inst.dpDiv.outerWidth(),
dpHeight = inst.dpDiv.outerHeight(),
inputWidth = inst.input ? inst.input.outerWidth() : 0,
inputHeight = inst.input ? inst.input.outerHeight() : 0,
viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
// Now check if datepicker is showing outside window viewport - move to a better place if so.
offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
Math.abs( dpHeight + inputHeight ) : 0 );
return offset;
},
/* Find an object's position on the screen. */
_findPos: function( obj ) {
var position,
inst = this._getInst( obj ),
isRTL = this._get( inst, "isRTL" );
while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) {
obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
}
position = $( obj ).offset();
return [ position.left, position.top ];
},
/* Hide the date picker from view.
* @param input element - the input field attached to the date picker
*/
_hideDatepicker: function( input ) {
var showAnim, duration, postProcess, onClose,
inst = this._curInst;
if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
return;
}
if ( this._datepickerShowing ) {
showAnim = this._get( inst, "showAnim" );
duration = this._get( inst, "duration" );
postProcess = function() {
$.datepicker._tidyDialog( inst );
};
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
} else {
inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
}
if ( !showAnim ) {
postProcess();
}
this._datepickerShowing = false;
onClose = this._get( inst, "onClose" );
if ( onClose ) {
onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
}
this._lastInput = null;
if ( this._inDialog ) {
this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
if ( $.blockUI ) {
$.unblockUI();
$( "body" ).append( this.dpDiv );
}
}
this._inDialog = false;
}
},
/* Tidy up after a dialog display. */
_tidyDialog: function( inst ) {
inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
},
/* Close date picker if clicked elsewhere. */
_checkExternalClick: function( event ) {
if ( !$.datepicker._curInst ) {
return;
}
var $target = $( event.target ),
inst = $.datepicker._getInst( $target[ 0 ] );
if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
$target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
!$target.hasClass( $.datepicker.markerClassName ) &&
!$target.closest( "." + $.datepicker._triggerClass ).length &&
$.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
$.datepicker._hideDatepicker();
}
},
/* Adjust one of the date sub-fields. */
_adjustDate: function( id, offset, period ) {
var target = $( id ),
inst = this._getInst( target[ 0 ] );
if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
return;
}
this._adjustInstDate( inst, offset, period );
this._updateDatepicker( inst );
},
/* Action for current link. */
_gotoToday: function( id ) {
var date,
target = $( id ),
inst = this._getInst( target[ 0 ] );
if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
} else {
date = new Date();
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
}
this._notifyChange( inst );
this._adjustDate( target );
},
/* Action for selecting a new month/year. */
_selectMonthYear: function( id, select, period ) {
var target = $( id ),
inst = this._getInst( target[ 0 ] );
inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
parseInt( select.options[ select.selectedIndex ].value, 10 );
this._notifyChange( inst );
this._adjustDate( target );
},
/* Action for selecting a day. */
_selectDay: function( id, month, year, td ) {
var inst,
target = $( id );
if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
return;
}
inst = this._getInst( target[ 0 ] );
inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
this._selectDate( id, this._formatDate( inst,
inst.currentDay, inst.currentMonth, inst.currentYear ) );
},
/* Erase the input field and hide the date picker. */
_clearDate: function( id ) {
var target = $( id );
this._selectDate( target, "" );
},
/* Update the input field with the selected date. */
_selectDate: function( id, dateStr ) {
var onSelect,
target = $( id ),
inst = this._getInst( target[ 0 ] );
dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
if ( inst.input ) {
inst.input.val( dateStr );
}
this._updateAlternate( inst );
onSelect = this._get( inst, "onSelect" );
if ( onSelect ) {
onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
} else if ( inst.input ) {
inst.input.trigger( "change" ); // fire the change event
}
if ( inst.inline ) {
this._updateDatepicker( inst );
} else {
this._hideDatepicker();
this._lastInput = inst.input[ 0 ];
if ( typeof( inst.input[ 0 ] ) !== "object" ) {
inst.input.trigger( "focus" ); // restore focus
}
this._lastInput = null;
}
},
/* Update any alternate field to synchronise with the main field. */
_updateAlternate: function( inst ) {
var altFormat, date, dateStr,
altField = this._get( inst, "altField" );
if ( altField ) { // update alternate field too
altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
date = this._getDate( inst );
dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
$( document ).find( altField ).val( dateStr );
}
},
/* Set as beforeShowDay function to prevent selection of weekends.
* @param date Date - the date to customise
* @return [boolean, string] - is this date selectable?, what is its CSS class?
*/
noWeekends: function( date ) {
var day = date.getDay();
return [ ( day > 0 && day < 6 ), "" ];
},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
* @param date Date - the date to get the week for
* @return number - the number of the week within the year that contains this date
*/
iso8601Week: function( date ) {
var time,
checkDate = new Date( date.getTime() );
// Find Thursday of this week starting on Monday
checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
time = checkDate.getTime();
checkDate.setMonth( 0 ); // Compare with Jan 1
checkDate.setDate( 1 );
return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
},
/* Parse a string value into a date object.
* See formatDate below for the possible formats.
*
* @param format string - the expected format of the date
* @param value string - the date in the above format
* @param settings Object - attributes include:
* shortYearCutoff number - the cutoff year for determining the century (optional)
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return Date - the extracted date value or null if value is blank
*/
parseDate: function( format, value, settings ) {
if ( format == null || value == null ) {
throw "Invalid arguments";
}
value = ( typeof value === "object" ? value.toString() : value + "" );
if ( value === "" ) {
return null;
}
var iFormat, dim, extra,
iValue = 0,
shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
year = -1,
month = -1,
day = -1,
doy = -1,
literal = false,
date,
// Check whether a format character is doubled
lookAhead = function( match ) {
var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
if ( matches ) {
iFormat++;
}
return matches;
},
// Extract a number from the string value
getNumber = function( match ) {
var isDoubled = lookAhead( match ),
size = ( match === "@" ? 14 : ( match === "!" ? 20 :
( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
minSize = ( match === "y" ? size : 1 ),
digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
num = value.substring( iValue ).match( digits );
if ( !num ) {
throw "Missing number at position " + iValue;
}
iValue += num[ 0 ].length;
return parseInt( num[ 0 ], 10 );
},
// Extract a name from the string value and convert to an index
getName = function( match, shortNames, longNames ) {
var index = -1,
names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
return [ [ k, v ] ];
} ).sort( function( a, b ) {
return -( a[ 1 ].length - b[ 1 ].length );
} );
$.each( names, function( i, pair ) {
var name = pair[ 1 ];
if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
index = pair[ 0 ];
iValue += name.length;
return false;
}
} );
if ( index !== -1 ) {
return index + 1;
} else {
throw "Unknown name at position " + iValue;
}
},
// Confirm that a literal character matches the string value
checkLiteral = function() {
if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
throw "Unexpected literal at position " + iValue;
}
iValue++;
};
for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
if ( literal ) {
if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
literal = false;
} else {
checkLiteral();
}
} else {
switch ( format.charAt( iFormat ) ) {
case "d":
day = getNumber( "d" );
break;
case "D":
getName( "D", dayNamesShort, dayNames );
break;
case "o":
doy = getNumber( "o" );
break;
case "m":
month = getNumber( "m" );
break;
case "M":
month = getName( "M", monthNamesShort, monthNames );
break;
case "y":
year = getNumber( "y" );
break;
case "@":
date = new Date( getNumber( "@" ) );
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "!":
date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "'":
if ( lookAhead( "'" ) ) {
checkLiteral();
} else {
literal = true;
}
break;
default:
checkLiteral();
}
}
}
if ( iValue < value.length ) {
extra = value.substr( iValue );
if ( !/^\s+/.test( extra ) ) {
throw "Extra/unparsed characters found in date: " + extra;
}
}
if ( year === -1 ) {
year = new Date().getFullYear();
} else if ( year < 100 ) {
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
( year <= shortYearCutoff ? 0 : -100 );
}
if ( doy > -1 ) {
month = 1;
day = doy;
do {
dim = this._getDaysInMonth( year, month - 1 );
if ( day <= dim ) {
break;
}
month++;
day -= dim;
} while ( true );
}
date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
throw "Invalid date"; // E.g. 31/02/00
}
return date;
},
/* Standard date formats. */
ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
COOKIE: "D, dd M yy",
ISO_8601: "yy-mm-dd",
RFC_822: "D, d M y",
RFC_850: "DD, dd-M-y",
RFC_1036: "D, d M y",
RFC_1123: "D, d M yy",
RFC_2822: "D, d M yy",
RSS: "D, d M y", // RFC 822
TICKS: "!",
TIMESTAMP: "@",
W3C: "yy-mm-dd", // ISO 8601
_ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
/* Format a date object into a string value.
* The format can be combinations of the following:
* d - day of month (no leading zero)
* dd - day of month (two digit)
* o - day of year (no leading zeros)
* oo - day of year (three digit)
* D - day name short
* DD - day name long
* m - month of year (no leading zero)
* mm - month of year (two digit)
* M - month name short
* MM - month name long
* y - year (two digit)
* yy - year (four digit)
* @ - Unix timestamp (ms since 01/01/1970)
* ! - Windows ticks (100ns since 01/01/0001)
* "..." - literal text
* '' - single quote
*
* @param format string - the desired format of the date
* @param date Date - the date value to format
* @param settings Object - attributes include:
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return string - the date in the above format
*/
formatDate: function( format, date, settings ) {
if ( !date ) {
return "";
}
var iFormat,
dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
// Check whether a format character is doubled
lookAhead = function( match ) {
var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
if ( matches ) {
iFormat++;
}
return matches;
},
// Format a number, with leading zero if necessary
formatNumber = function( match, value, len ) {
var num = "" + value;
if ( lookAhead( match ) ) {
while ( num.length < len ) {
num = "0" + num;
}
}
return num;
},
// Format a name, short or long as requested
formatName = function( match, value, shortNames, longNames ) {
return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
},
output = "",
literal = false;
if ( date ) {
for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
if ( literal ) {
if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
literal = false;
} else {
output += format.charAt( iFormat );
}
} else {
switch ( format.charAt( iFormat ) ) {
case "d":
output += formatNumber( "d", date.getDate(), 2 );
break;
case "D":
output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
break;
case "o":
output += formatNumber( "o",
Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
break;
case "m":
output += formatNumber( "m", date.getMonth() + 1, 2 );
break;
case "M":
output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
break;
case "y":
output += ( lookAhead( "y" ) ? date.getFullYear() :
( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
break;
case "@":
output += date.getTime();
break;
case "!":
output += date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
if ( lookAhead( "'" ) ) {
output += "'";
} else {
literal = true;
}
break;
default:
output += format.charAt( iFormat );
}
}
}
}
return output;
},
/* Extract all possible characters from the date format. */
_possibleChars: function( format ) {
var iFormat,
chars = "",
literal = false,
// Check whether a format character is doubled
lookAhead = function( match ) {
var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
if ( matches ) {
iFormat++;
}
return matches;
};
for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
if ( literal ) {
if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
literal = false;
} else {
chars += format.charAt( iFormat );
}
} else {
switch ( format.charAt( iFormat ) ) {
case "d": case "m": case "y": case "@":
chars += "0123456789";
break;
case "D": case "M":
return null; // Accept anything
case "'":
if ( lookAhead( "'" ) ) {
chars += "'";
} else {
literal = true;
}
break;
default:
chars += format.charAt( iFormat );
}
}
}
return chars;
},
/* Get a setting value, defaulting if necessary. */
_get: function( inst, name ) {
return inst.settings[ name ] !== undefined ?
inst.settings[ name ] : this._defaults[ name ];
},
/* Parse existing date and initialise date picker. */
_setDateFromField: function( inst, noDefault ) {
if ( inst.input.val() === inst.lastVal ) {
return;
}
var dateFormat = this._get( inst, "dateFormat" ),
dates = inst.lastVal = inst.input ? inst.input.val() : null,
defaultDate = this._getDefaultDate( inst ),
date = defaultDate,
settings = this._getFormatConfig( inst );
try {
date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
} catch ( event ) {
dates = ( noDefault ? "" : dates );
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
inst.currentDay = ( dates ? date.getDate() : 0 );
inst.currentMonth = ( dates ? date.getMonth() : 0 );
inst.currentYear = ( dates ? date.getFullYear() : 0 );
this._adjustInstDate( inst );
},
/* Retrieve the default date shown on opening. */
_getDefaultDate: function( inst ) {
return this._restrictMinMax( inst,
this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
},
/* A date may be specified as an exact value or a relative one. */
_determineDate: function( inst, date, defaultDate ) {
var offsetNumeric = function( offset ) {
var date = new Date();
date.setDate( date.getDate() + offset );
return date;
},
offsetString = function( offset ) {
try {
return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
offset, $.datepicker._getFormatConfig( inst ) );
} catch ( e ) {
// Ignore
}
var date = ( offset.toLowerCase().match( /^c/ ) ?
$.datepicker._getDate( inst ) : null ) || new Date(),
year = date.getFullYear(),
month = date.getMonth(),
day = date.getDate(),
pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
matches = pattern.exec( offset );
while ( matches ) {
switch ( matches[ 2 ] || "d" ) {
case "d" : case "D" :
day += parseInt( matches[ 1 ], 10 ); break;
case "w" : case "W" :
day += parseInt( matches[ 1 ], 10 ) * 7; break;
case "m" : case "M" :
month += parseInt( matches[ 1 ], 10 );
day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
break;
case "y": case "Y" :
year += parseInt( matches[ 1 ], 10 );
day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
break;
}
matches = pattern.exec( offset );
}
return new Date( year, month, day );
},
newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
if ( newDate ) {
newDate.setHours( 0 );
newDate.setMinutes( 0 );
newDate.setSeconds( 0 );
newDate.setMilliseconds( 0 );
}
return this._daylightSavingAdjust( newDate );
},
/* Handle switch to/from daylight saving.
* Hours may be non-zero on daylight saving cut-over:
* > 12 when midnight changeover, but then cannot generate
* midnight datetime, so jump to 1AM, otherwise reset.
* @param date (Date) the date to check
* @return (Date) the corrected date
*/
_daylightSavingAdjust: function( date ) {
if ( !date ) {
return null;
}
date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
return date;
},
/* Set the date(s) directly. */
_setDate: function( inst, date, noChange ) {
var clear = !date,
origMonth = inst.selectedMonth,
origYear = inst.selectedYear,
newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
inst.selectedDay = inst.currentDay = newDate.getDate();
inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
this._notifyChange( inst );
}
this._adjustInstDate( inst );
if ( inst.input ) {
inst.input.val( clear ? "" : this._formatDate( inst ) );
}
},
/* Retrieve the date(s) directly. */
_getDate: function( inst ) {
var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
this._daylightSavingAdjust( new Date(
inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
return startDate;
},
/* Attach the onxxx handlers. These are declared statically so
* they work with static code transformers like Caja.
*/
_attachHandlers: function( inst ) {
var stepMonths = this._get( inst, "stepMonths" ),
id = "#" + inst.id.replace( /\\\\/g, "\\" );
inst.dpDiv.find( "[data-handler]" ).map( function() {
var handler = {
prev: function() {
$.datepicker._adjustDate( id, -stepMonths, "M" );
},
next: function() {
$.datepicker._adjustDate( id, +stepMonths, "M" );
},
hide: function() {
$.datepicker._hideDatepicker();
},
today: function() {
$.datepicker._gotoToday( id );
},
selectDay: function() {
$.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
return false;
},
selectMonth: function() {
$.datepicker._selectMonthYear( id, this, "M" );
return false;
},
selectYear: function() {
$.datepicker._selectMonthYear( id, this, "Y" );
return false;
}
};
$( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
} );
},
/* Generate the HTML for the current state of the date picker. */
_generateHTML: function( inst ) {
var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
printDate, dRow, tbody, daySettings, otherMonth, unselectable,
tempDate = new Date(),
today = this._daylightSavingAdjust(
new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
isRTL = this._get( inst, "isRTL" ),
showButtonPanel = this._get( inst, "showButtonPanel" ),
hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
numMonths = this._getNumberOfMonths( inst ),
showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
stepMonths = this._get( inst, "stepMonths" ),
isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
minDate = this._getMinMaxDate( inst, "min" ),
maxDate = this._getMinMaxDate( inst, "max" ),
drawMonth = inst.drawMonth - showCurrentAtPos,
drawYear = inst.drawYear;
if ( drawMonth < 0 ) {
drawMonth += 12;
drawYear--;
}
if ( maxDate ) {
maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
drawMonth--;
if ( drawMonth < 0 ) {
drawMonth = 11;
drawYear--;
}
}
}
inst.drawMonth = drawMonth;
inst.drawYear = drawYear;
prevText = this._get( inst, "prevText" );
prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
this._getFormatConfig( inst ) ) );
if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
prev = $( "<a>" )
.attr( {
"class": "ui-datepicker-prev ui-corner-all",
"data-handler": "prev",
"data-event": "click",
title: prevText
} )
.append(
$( "<span>" )
.addClass( "ui-icon ui-icon-circle-triangle-" +
( isRTL ? "e" : "w" ) )
.text( prevText )
)[ 0 ].outerHTML;
} else if ( hideIfNoPrevNext ) {
prev = "";
} else {
prev = $( "<a>" )
.attr( {
"class": "ui-datepicker-prev ui-corner-all ui-state-disabled",
title: prevText
} )
.append(
$( "<span>" )
.addClass( "ui-icon ui-icon-circle-triangle-" +
( isRTL ? "e" : "w" ) )
.text( prevText )
)[ 0 ].outerHTML;
}
nextText = this._get( inst, "nextText" );
nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
this._getFormatConfig( inst ) ) );
if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
next = $( "<a>" )
.attr( {
"class": "ui-datepicker-next ui-corner-all",
"data-handler": "next",
"data-event": "click",
title: nextText
} )
.append(
$( "<span>" )
.addClass( "ui-icon ui-icon-circle-triangle-" +
( isRTL ? "w" : "e" ) )
.text( nextText )
)[ 0 ].outerHTML;
} else if ( hideIfNoPrevNext ) {
next = "";
} else {
next = $( "<a>" )
.attr( {
"class": "ui-datepicker-next ui-corner-all ui-state-disabled",
title: nextText
} )
.append(
$( "<span>" )
.attr( "class", "ui-icon ui-icon-circle-triangle-" +
( isRTL ? "w" : "e" ) )
.text( nextText )
)[ 0 ].outerHTML;
}
currentText = this._get( inst, "currentText" );
gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
currentText = ( !navigationAsDateFormat ? currentText :
this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
controls = "";
if ( !inst.inline ) {
controls = $( "<button>" )
.attr( {
type: "button",
"class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",
"data-handler": "hide",
"data-event": "click"
} )
.text( this._get( inst, "closeText" ) )[ 0 ].outerHTML;
}
buttonPanel = "";
if ( showButtonPanel ) {
buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )
.append( isRTL ? controls : "" )
.append( this._isInRange( inst, gotoDate ) ?
$( "<button>" )
.attr( {
type: "button",
"class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",
"data-handler": "today",
"data-event": "click"
} )
.text( currentText ) :
"" )
.append( isRTL ? "" : controls )[ 0 ].outerHTML;
}
firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
showWeek = this._get( inst, "showWeek" );
dayNames = this._get( inst, "dayNames" );
dayNamesMin = this._get( inst, "dayNamesMin" );
monthNames = this._get( inst, "monthNames" );
monthNamesShort = this._get( inst, "monthNamesShort" );
beforeShowDay = this._get( inst, "beforeShowDay" );
showOtherMonths = this._get( inst, "showOtherMonths" );
selectOtherMonths = this._get( inst, "selectOtherMonths" );
defaultDate = this._getDefaultDate( inst );
html = "";
for ( row = 0; row < numMonths[ 0 ]; row++ ) {
group = "";
this.maxRows = 4;
for ( col = 0; col < numMonths[ 1 ]; col++ ) {
selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
cornerClass = " ui-corner-all";
calender = "";
if ( isMultiMonth ) {
calender += "<div class='ui-datepicker-group";
if ( numMonths[ 1 ] > 1 ) {
switch ( col ) {
case 0: calender += " ui-datepicker-group-first";
cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
}
}
calender += "'>";
}
calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
"</div><table class='ui-datepicker-calendar'><thead>" +
"<tr>";
thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
for ( dow = 0; dow < 7; dow++ ) { // days of the week
day = ( dow + firstDay ) % 7;
thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
"<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
}
calender += thead + "</tr></thead><tbody>";
daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
}
leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
this.maxRows = numRows;
printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
calender += "<tr>";
tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
for ( dow = 0; dow < 7; dow++ ) { // create date picker days
daySettings = ( beforeShowDay ?
beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
otherMonth = ( printDate.getMonth() !== drawMonth );
unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
tbody += "<td class='" +
( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
// or defaultDate is current printedDate and defaultDate is selectedDate
" " + this._dayOverClass : "" ) + // highlight selected day
( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days
( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title
( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
( otherMonth && !showOtherMonths ? " " : // display for other months
( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
"' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
"' data-date='" + printDate.getDate() + // store date as data
"'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
printDate.setDate( printDate.getDate() + 1 );
printDate = this._daylightSavingAdjust( printDate );
}
calender += tbody + "</tr>";
}
drawMonth++;
if ( drawMonth > 11 ) {
drawMonth = 0;
drawYear++;
}
calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
group += calender;
}
html += group;
}
html += buttonPanel;
inst._keyEvent = false;
return html;
},
/* Generate the month and year header. */
_generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort ) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth = this._get( inst, "changeMonth" ),
changeYear = this._get( inst, "changeYear" ),
showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
selectMonthLabel = this._get( inst, "selectMonthLabel" ),
selectYearLabel = this._get( inst, "selectYearLabel" ),
html = "<div class='ui-datepicker-title'>",
monthHtml = "";
// Month selection
if ( secondary || !changeMonth ) {
monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
} else {
inMinYear = ( minDate && minDate.getFullYear() === drawYear );
inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
for ( month = 0; month < 12; month++ ) {
if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
monthHtml += "<option value='" + month + "'" +
( month === drawMonth ? " selected='selected'" : "" ) +
">" + monthNamesShort[ month ] + "</option>";
}
}
monthHtml += "</select>";
}
if ( !showMonthAfterYear ) {
html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" );
}
// Year selection
if ( !inst.yearshtml ) {
inst.yearshtml = "";
if ( secondary || !changeYear ) {
html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
} else {
// determine range of years to display
years = this._get( inst, "yearRange" ).split( ":" );
thisYear = new Date().getFullYear();
determineYear = function( value ) {
var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
parseInt( value, 10 ) ) );
return ( isNaN( year ) ? thisYear : year );
};
year = determineYear( years[ 0 ] );
endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
for ( ; year <= endYear; year++ ) {
inst.yearshtml += "<option value='" + year + "'" +
( year === drawYear ? " selected='selected'" : "" ) +
">" + year + "</option>";
}
inst.yearshtml += "</select>";
html += inst.yearshtml;
inst.yearshtml = null;
}
}
html += this._get( inst, "yearSuffix" );
if ( showMonthAfterYear ) {
html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml;
}
html += "</div>"; // Close datepicker_header
return html;
},
/* Adjust one of the date sub-fields. */
_adjustInstDate: function( inst, offset, period ) {
var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
if ( period === "M" || period === "Y" ) {
this._notifyChange( inst );
}
},
/* Ensure a date is within any min/max bounds. */
_restrictMinMax: function( inst, date ) {
var minDate = this._getMinMaxDate( inst, "min" ),
maxDate = this._getMinMaxDate( inst, "max" ),
newDate = ( minDate && date < minDate ? minDate : date );
return ( maxDate && newDate > maxDate ? maxDate : newDate );
},
/* Notify change of month/year. */
_notifyChange: function( inst ) {
var onChange = this._get( inst, "onChangeMonthYear" );
if ( onChange ) {
onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
[ inst.selectedYear, inst.selectedMonth + 1, inst ] );
}
},
/* Determine the number of months to show. */
_getNumberOfMonths: function( inst ) {
var numMonths = this._get( inst, "numberOfMonths" );
return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate: function( inst, minMax ) {
return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
},
/* Find the number of days in a given month. */
_getDaysInMonth: function( year, month ) {
return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
},
/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth: function( year, month ) {
return new Date( year, month, 1 ).getDay();
},
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth: function( inst, offset, curYear, curMonth ) {
var numMonths = this._getNumberOfMonths( inst ),
date = this._daylightSavingAdjust( new Date( curYear,
curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
if ( offset < 0 ) {
date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
}
return this._isInRange( inst, date );
},
/* Is the given date in the accepted range? */
_isInRange: function( inst, date ) {
var yearSplit, currentYear,
minDate = this._getMinMaxDate( inst, "min" ),
maxDate = this._getMinMaxDate( inst, "max" ),
minYear = null,
maxYear = null,
years = this._get( inst, "yearRange" );
if ( years ) {
yearSplit = years.split( ":" );
currentYear = new Date().getFullYear();
minYear = parseInt( yearSplit[ 0 ], 10 );
maxYear = parseInt( yearSplit[ 1 ], 10 );
if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
minYear += currentYear;
}
if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
maxYear += currentYear;
}
}
return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
( !maxDate || date.getTime() <= maxDate.getTime() ) &&
( !minYear || date.getFullYear() >= minYear ) &&
( !maxYear || date.getFullYear() <= maxYear ) );
},
/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig: function( inst ) {
var shortYearCutoff = this._get( inst, "shortYearCutoff" );
shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
return { shortYearCutoff: shortYearCutoff,
dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
},
/* Format the given date for display. */
_formatDate: function( inst, day, month, year ) {
if ( !day ) {
inst.currentDay = inst.selectedDay;
inst.currentMonth = inst.selectedMonth;
inst.currentYear = inst.selectedYear;
}
var date = ( day ? ( typeof day === "object" ? day :
this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
}
} );
/*
* Bind hover events for datepicker elements.
* Done via delegate so the binding only occurs once in the lifetime of the parent div.
* Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
*/
function datepicker_bindHover( dpDiv ) {
var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
return dpDiv.on( "mouseout", selector, function() {
$( this ).removeClass( "ui-state-hover" );
if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
$( this ).removeClass( "ui-datepicker-prev-hover" );
}
if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
$( this ).removeClass( "ui-datepicker-next-hover" );
}
} )
.on( "mouseover", selector, datepicker_handleMouseover );
}
function datepicker_handleMouseover() {
if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
$( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
$( this ).addClass( "ui-state-hover" );
if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
$( this ).addClass( "ui-datepicker-prev-hover" );
}
if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
$( this ).addClass( "ui-datepicker-next-hover" );
}
}
}
/* jQuery extend now ignores nulls! */
function datepicker_extendRemove( target, props ) {
$.extend( target, props );
for ( var name in props ) {
if ( props[ name ] == null ) {
target[ name ] = props[ name ];
}
}
return target;
}
/* Invoke the datepicker functionality.
@param options string - a command, optionally followed by additional parameters or
Object - settings for attaching new datepicker functionality
@return jQuery object */
$.fn.datepicker = function( options ) {
/* Verify an empty collection wasn't passed - Fixes #6976 */
if ( !this.length ) {
return this;
}
/* Initialise the date picker. */
if ( !$.datepicker.initialized ) {
$( document ).on( "mousedown", $.datepicker._checkExternalClick );
$.datepicker.initialized = true;
}
/* Append datepicker main container to body if not exist. */
if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
$( "body" ).append( $.datepicker.dpDiv );
}
var otherArgs = Array.prototype.slice.call( arguments, 1 );
if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
return $.datepicker[ "_" + options + "Datepicker" ].
apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
}
if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
return $.datepicker[ "_" + options + "Datepicker" ].
apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
}
return this.each( function() {
if ( typeof options === "string" ) {
$.datepicker[ "_" + options + "Datepicker" ]
.apply( $.datepicker, [ this ].concat( otherArgs ) );
} else {
$.datepicker._attachDatepicker( this, options );
}
} );
};
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.13.1";
var widgetsDatepicker = $.datepicker;
/*!
* jQuery UI Dialog 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Dialog
//>>group: Widgets
//>>description: Displays customizable dialog windows.
//>>docs: http://api.jqueryui.com/dialog/
//>>demos: http://jqueryui.com/dialog/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/dialog.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.dialog", {
version: "1.13.1",
options: {
appendTo: "body",
autoOpen: true,
buttons: [],
classes: {
"ui-dialog": "ui-corner-all",
"ui-dialog-titlebar": "ui-corner-all"
},
closeOnEscape: true,
closeText: "Close",
draggable: true,
hide: null,
height: "auto",
maxHeight: null,
maxWidth: null,
minHeight: 150,
minWidth: 150,
modal: false,
position: {
my: "center",
at: "center",
of: window,
collision: "fit",
// Ensure the titlebar is always visible
using: function( pos ) {
var topOffset = $( this ).css( pos ).offset().top;
if ( topOffset < 0 ) {
$( this ).css( "top", pos.top - topOffset );
}
}
},
resizable: true,
show: null,
title: null,
width: 300,
// Callbacks
beforeClose: null,
close: null,
drag: null,
dragStart: null,
dragStop: null,
focus: null,
open: null,
resize: null,
resizeStart: null,
resizeStop: null
},
sizeRelatedOptions: {
buttons: true,
height: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
width: true
},
resizableRelatedOptions: {
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true
},
_create: function() {
this.originalCss = {
display: this.element[ 0 ].style.display,
width: this.element[ 0 ].style.width,
minHeight: this.element[ 0 ].style.minHeight,
maxHeight: this.element[ 0 ].style.maxHeight,
height: this.element[ 0 ].style.height
};
this.originalPosition = {
parent: this.element.parent(),
index: this.element.parent().children().index( this.element )
};
this.originalTitle = this.element.attr( "title" );
if ( this.options.title == null && this.originalTitle != null ) {
this.options.title = this.originalTitle;
}
// Dialogs can't be disabled
if ( this.options.disabled ) {
this.options.disabled = false;
}
this._createWrapper();
this.element
.show()
.removeAttr( "title" )
.appendTo( this.uiDialog );
this._addClass( "ui-dialog-content", "ui-widget-content" );
this._createTitlebar();
this._createButtonPane();
if ( this.options.draggable && $.fn.draggable ) {
this._makeDraggable();
}
if ( this.options.resizable && $.fn.resizable ) {
this._makeResizable();
}
this._isOpen = false;
this._trackFocus();
},
_init: function() {
if ( this.options.autoOpen ) {
this.open();
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element && ( element.jquery || element.nodeType ) ) {
return $( element );
}
return this.document.find( element || "body" ).eq( 0 );
},
_destroy: function() {
var next,
originalPosition = this.originalPosition;
this._untrackInstance();
this._destroyOverlay();
this.element
.removeUniqueId()
.css( this.originalCss )
// Without detaching first, the following becomes really slow
.detach();
this.uiDialog.remove();
if ( this.originalTitle ) {
this.element.attr( "title", this.originalTitle );
}
next = originalPosition.parent.children().eq( originalPosition.index );
// Don't try to place the dialog next to itself (#8613)
if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
next.before( this.element );
} else {
originalPosition.parent.append( this.element );
}
},
widget: function() {
return this.uiDialog;
},
disable: $.noop,
enable: $.noop,
close: function( event ) {
var that = this;
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
return;
}
this._isOpen = false;
this._focusedElement = null;
this._destroyOverlay();
this._untrackInstance();
if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
// Hiding a focused element doesn't trigger blur in WebKit
// so in case we have nothing to focus on, explicitly blur the active element
// https://bugs.webkit.org/show_bug.cgi?id=47182
$.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
}
this._hide( this.uiDialog, this.options.hide, function() {
that._trigger( "close", event );
} );
},
isOpen: function() {
return this._isOpen;
},
moveToTop: function() {
this._moveToTop();
},
_moveToTop: function( event, silent ) {
var moved = false,
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
return +$( this ).css( "z-index" );
} ).get(),
zIndexMax = Math.max.apply( null, zIndices );
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
this.uiDialog.css( "z-index", zIndexMax + 1 );
moved = true;
}
if ( moved && !silent ) {
this._trigger( "focus", event );
}
return moved;
},
open: function() {
var that = this;
if ( this._isOpen ) {
if ( this._moveToTop() ) {
this._focusTabbable();
}
return;
}
this._isOpen = true;
this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
this._size();
this._position();
this._createOverlay();
this._moveToTop( null, true );
// Ensure the overlay is moved to the top with the dialog, but only when
// opening. The overlay shouldn't move after the dialog is open so that
// modeless dialogs opened after the modal dialog stack properly.
if ( this.overlay ) {
this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
}
this._show( this.uiDialog, this.options.show, function() {
that._focusTabbable();
that._trigger( "focus" );
} );
// Track the dialog immediately upon opening in case a focus event
// somehow occurs outside of the dialog before an element inside the
// dialog is focused (#10152)
this._makeFocusTarget();
this._trigger( "open" );
},
_focusTabbable: function() {
// Set focus to the first match:
// 1. An element that was focused previously
// 2. First element inside the dialog matching [autofocus]
// 3. Tabbable element inside the content element
// 4. Tabbable element inside the buttonpane
// 5. The close button
// 6. The dialog itself
var hasFocus = this._focusedElement;
if ( !hasFocus ) {
hasFocus = this.element.find( "[autofocus]" );
}
if ( !hasFocus.length ) {
hasFocus = this.element.find( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
}
if ( !hasFocus.length ) {
hasFocus = this.uiDialog;
}
hasFocus.eq( 0 ).trigger( "focus" );
},
_restoreTabbableFocus: function() {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
isActive = this.uiDialog[ 0 ] === activeElement ||
$.contains( this.uiDialog[ 0 ], activeElement );
if ( !isActive ) {
this._focusTabbable();
}
},
_keepFocus: function( event ) {
event.preventDefault();
this._restoreTabbableFocus();
// support: IE
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
// so we check again later
this._delay( this._restoreTabbableFocus );
},
_createWrapper: function() {
this.uiDialog = $( "<div>" )
.hide()
.attr( {
// Setting tabIndex makes the div focusable
tabIndex: -1,
role: "dialog"
} )
.appendTo( this._appendTo() );
this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
this._on( this.uiDialog, {
keydown: function( event ) {
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
event.keyCode === $.ui.keyCode.ESCAPE ) {
event.preventDefault();
this.close( event );
return;
}
// Prevent tabbing out of dialogs
if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
return;
}
var tabbables = this.uiDialog.find( ":tabbable" ),
first = tabbables.first(),
last = tabbables.last();
if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
!event.shiftKey ) {
this._delay( function() {
first.trigger( "focus" );
} );
event.preventDefault();
} else if ( ( event.target === first[ 0 ] ||
event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
this._delay( function() {
last.trigger( "focus" );
} );
event.preventDefault();
}
},
mousedown: function( event ) {
if ( this._moveToTop( event ) ) {
this._focusTabbable();
}
}
} );
// We assume that any existing aria-describedby attribute means
// that the dialog content is marked up properly
// otherwise we brute force the content as the description
if ( !this.element.find( "[aria-describedby]" ).length ) {
this.uiDialog.attr( {
"aria-describedby": this.element.uniqueId().attr( "id" )
} );
}
},
_createTitlebar: function() {
var uiDialogTitle;
this.uiDialogTitlebar = $( "<div>" );
this._addClass( this.uiDialogTitlebar,
"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
this._on( this.uiDialogTitlebar, {
mousedown: function( event ) {
// Don't prevent click on close button (#8838)
// Focusing a dialog that is partially scrolled out of view
// causes the browser to scroll it into view, preventing the click event
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
// Dialog isn't getting focus when dragging (#8063)
this.uiDialog.trigger( "focus" );
}
}
} );
// Support: IE
// Use type="button" to prevent enter keypresses in textboxes from closing the
// dialog in IE (#9312)
this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
.button( {
label: $( "<a>" ).text( this.options.closeText ).html(),
icon: "ui-icon-closethick",
showLabel: false
} )
.appendTo( this.uiDialogTitlebar );
this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
this._on( this.uiDialogTitlebarClose, {
click: function( event ) {
event.preventDefault();
this.close( event );
}
} );
uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
this._addClass( uiDialogTitle, "ui-dialog-title" );
this._title( uiDialogTitle );
this.uiDialogTitlebar.prependTo( this.uiDialog );
this.uiDialog.attr( {
"aria-labelledby": uiDialogTitle.attr( "id" )
} );
},
_title: function( title ) {
if ( this.options.title ) {
title.text( this.options.title );
} else {
title.html( " " );
}
},
_createButtonPane: function() {
this.uiDialogButtonPane = $( "<div>" );
this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
"ui-widget-content ui-helper-clearfix" );
this.uiButtonSet = $( "<div>" )
.appendTo( this.uiDialogButtonPane );
this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
this._createButtons();
},
_createButtons: function() {
var that = this,
buttons = this.options.buttons;
// If we already have a button pane, remove it
this.uiDialogButtonPane.remove();
this.uiButtonSet.empty();
if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) {
this._removeClass( this.uiDialog, "ui-dialog-buttons" );
return;
}
$.each( buttons, function( name, props ) {
var click, buttonOptions;
props = typeof props === "function" ?
{ click: props, text: name } :
props;
// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
// Change the context for the click callback to be the main element
click = props.click;
buttonOptions = {
icon: props.icon,
iconPosition: props.iconPosition,
showLabel: props.showLabel,
// Deprecated options
icons: props.icons,
text: props.text
};
delete props.click;
delete props.icon;
delete props.iconPosition;
delete props.showLabel;
// Deprecated options
delete props.icons;
if ( typeof props.text === "boolean" ) {
delete props.text;
}
$( "<button></button>", props )
.button( buttonOptions )
.appendTo( that.uiButtonSet )
.on( "click", function() {
click.apply( that.element[ 0 ], arguments );
} );
} );
this._addClass( this.uiDialog, "ui-dialog-buttons" );
this.uiDialogButtonPane.appendTo( this.uiDialog );
},
_makeDraggable: function() {
var that = this,
options = this.options;
function filteredUi( ui ) {
return {
position: ui.position,
offset: ui.offset
};
}
this.uiDialog.draggable( {
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
handle: ".ui-dialog-titlebar",
containment: "document",
start: function( event, ui ) {
that._addClass( $( this ), "ui-dialog-dragging" );
that._blockFrames();
that._trigger( "dragStart", event, filteredUi( ui ) );
},
drag: function( event, ui ) {
that._trigger( "drag", event, filteredUi( ui ) );
},
stop: function( event, ui ) {
var left = ui.offset.left - that.document.scrollLeft(),
top = ui.offset.top - that.document.scrollTop();
options.position = {
my: "left top",
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
of: that.window
};
that._removeClass( $( this ), "ui-dialog-dragging" );
that._unblockFrames();
that._trigger( "dragStop", event, filteredUi( ui ) );
}
} );
},
_makeResizable: function() {
var that = this,
options = this.options,
handles = options.resizable,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css( "position" ),
resizeHandles = typeof handles === "string" ?
handles :
"n,e,s,w,se,sw,ne,nw";
function filteredUi( ui ) {
return {
originalPosition: ui.originalPosition,
originalSize: ui.originalSize,
position: ui.position,
size: ui.size
};
}
this.uiDialog.resizable( {
cancel: ".ui-dialog-content",
containment: "document",
alsoResize: this.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
minHeight: this._minHeight(),
handles: resizeHandles,
start: function( event, ui ) {
that._addClass( $( this ), "ui-dialog-resizing" );
that._blockFrames();
that._trigger( "resizeStart", event, filteredUi( ui ) );
},
resize: function( event, ui ) {
that._trigger( "resize", event, filteredUi( ui ) );
},
stop: function( event, ui ) {
var offset = that.uiDialog.offset(),
left = offset.left - that.document.scrollLeft(),
top = offset.top - that.document.scrollTop();
options.height = that.uiDialog.height();
options.width = that.uiDialog.width();
options.position = {
my: "left top",
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
of: that.window
};
that._removeClass( $( this ), "ui-dialog-resizing" );
that._unblockFrames();
that._trigger( "resizeStop", event, filteredUi( ui ) );
}
} )
.css( "position", position );
},
_trackFocus: function() {
this._on( this.widget(), {
focusin: function( event ) {
this._makeFocusTarget();
this._focusedElement = $( event.target );
}
} );
},
_makeFocusTarget: function() {
this._untrackInstance();
this._trackingInstances().unshift( this );
},
_untrackInstance: function() {
var instances = this._trackingInstances(),
exists = $.inArray( this, instances );
if ( exists !== -1 ) {
instances.splice( exists, 1 );
}
},
_trackingInstances: function() {
var instances = this.document.data( "ui-dialog-instances" );
if ( !instances ) {
instances = [];
this.document.data( "ui-dialog-instances", instances );
}
return instances;
},
_minHeight: function() {
var options = this.options;
return options.height === "auto" ?
options.minHeight :
Math.min( options.minHeight, options.height );
},
_position: function() {
// Need to show the dialog to get the actual offset in the position plugin
var isVisible = this.uiDialog.is( ":visible" );
if ( !isVisible ) {
this.uiDialog.show();
}
this.uiDialog.position( this.options.position );
if ( !isVisible ) {
this.uiDialog.hide();
}
},
_setOptions: function( options ) {
var that = this,
resize = false,
resizableOptions = {};
$.each( options, function( key, value ) {
that._setOption( key, value );
if ( key in that.sizeRelatedOptions ) {
resize = true;
}
if ( key in that.resizableRelatedOptions ) {
resizableOptions[ key ] = value;
}
} );
if ( resize ) {
this._size();
this._position();
}
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
}
},
_setOption: function( key, value ) {
var isDraggable, isResizable,
uiDialog = this.uiDialog;
if ( key === "disabled" ) {
return;
}
this._super( key, value );
if ( key === "appendTo" ) {
this.uiDialog.appendTo( this._appendTo() );
}
if ( key === "buttons" ) {
this._createButtons();
}
if ( key === "closeText" ) {
this.uiDialogTitlebarClose.button( {
// Ensure that we always pass a string
label: $( "<a>" ).text( "" + this.options.closeText ).html()
} );
}
if ( key === "draggable" ) {
isDraggable = uiDialog.is( ":data(ui-draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
if ( !isDraggable && value ) {
this._makeDraggable();
}
}
if ( key === "position" ) {
this._position();
}
if ( key === "resizable" ) {
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
// Currently resizable, changing handles
if ( isResizable && typeof value === "string" ) {
uiDialog.resizable( "option", "handles", value );
}
// Currently non-resizable, becoming resizable
if ( !isResizable && value !== false ) {
this._makeResizable();
}
}
if ( key === "title" ) {
this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
}
},
_size: function() {
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,
options = this.options;
// Reset content sizing
this.element.show().css( {
width: "auto",
minHeight: 0,
maxHeight: "none",
height: 0
} );
if ( options.minWidth > options.width ) {
options.width = options.minWidth;
}
// Reset wrapper sizing
// determine the height of all the non-content elements
nonContentHeight = this.uiDialog.css( {
height: "auto",
width: options.width
} )
.outerHeight();
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
maxContentHeight = typeof options.maxHeight === "number" ?
Math.max( 0, options.maxHeight - nonContentHeight ) :
"none";
if ( options.height === "auto" ) {
this.element.css( {
minHeight: minContentHeight,
maxHeight: maxContentHeight,
height: "auto"
} );
} else {
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
}
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
}
},
_blockFrames: function() {
this.iframeBlocks = this.document.find( "iframe" ).map( function() {
var iframe = $( this );
return $( "<div>" )
.css( {
position: "absolute",
width: iframe.outerWidth(),
height: iframe.outerHeight()
} )
.appendTo( iframe.parent() )
.offset( iframe.offset() )[ 0 ];
} );
},
_unblockFrames: function() {
if ( this.iframeBlocks ) {
this.iframeBlocks.remove();
delete this.iframeBlocks;
}
},
_allowInteraction: function( event ) {
if ( $( event.target ).closest( ".ui-dialog" ).length ) {
return true;
}
// TODO: Remove hack when datepicker implements
// the .ui-front logic (#8989)
return !!$( event.target ).closest( ".ui-datepicker" ).length;
},
_createOverlay: function() {
if ( !this.options.modal ) {
return;
}
var jqMinor = $.fn.jquery.substring( 0, 4 );
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling (#2804)
var isOpening = true;
this._delay( function() {
isOpening = false;
} );
if ( !this.document.data( "ui-dialog-overlays" ) ) {
// Prevent use of anchors and inputs
// This doesn't use `_on()` because it is a shared event handler
// across all open modal dialogs.
this.document.on( "focusin.ui-dialog", function( event ) {
if ( isOpening ) {
return;
}
var instance = this._trackingInstances()[ 0 ];
if ( !instance._allowInteraction( event ) ) {
event.preventDefault();
instance._focusTabbable();
// Support: jQuery >=3.4 <3.6 only
// Focus re-triggering in jQuery 3.4/3.5 makes the original element
// have its focus event propagated last, breaking the re-targeting.
// Trigger focus in a delay in addition if needed to avoid the issue
// See https://github.com/jquery/jquery/issues/4382
if ( jqMinor === "3.4." || jqMinor === "3.5." ) {
instance._delay( instance._restoreTabbableFocus );
}
}
}.bind( this ) );
}
this.overlay = $( "<div>" )
.appendTo( this._appendTo() );
this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
this._on( this.overlay, {
mousedown: "_keepFocus"
} );
this.document.data( "ui-dialog-overlays",
( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
},
_destroyOverlay: function() {
if ( !this.options.modal ) {
return;
}
if ( this.overlay ) {
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
if ( !overlays ) {
this.document.off( "focusin.ui-dialog" );
this.document.removeData( "ui-dialog-overlays" );
} else {
this.document.data( "ui-dialog-overlays", overlays );
}
this.overlay.remove();
this.overlay = null;
}
}
} );
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for dialogClass option
$.widget( "ui.dialog", $.ui.dialog, {
options: {
dialogClass: ""
},
_createWrapper: function() {
this._super();
this.uiDialog.addClass( this.options.dialogClass );
},
_setOption: function( key, value ) {
if ( key === "dialogClass" ) {
this.uiDialog
.removeClass( this.options.dialogClass )
.addClass( value );
}
this._superApply( arguments );
}
} );
}
var widgetsDialog = $.ui.dialog;
/*!
* jQuery UI Progressbar 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Progressbar
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/progressbar/
//>>demos: http://jqueryui.com/progressbar/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/progressbar.css
//>>css.theme: ../../themes/base/theme.css
var widgetsProgressbar = $.widget( "ui.progressbar", {
version: "1.13.1",
options: {
classes: {
"ui-progressbar": "ui-corner-all",
"ui-progressbar-value": "ui-corner-left",
"ui-progressbar-complete": "ui-corner-right"
},
max: 100,
value: 0,
change: null,
complete: null
},
min: 0,
_create: function() {
// Constrain initial value
this.oldValue = this.options.value = this._constrainedValue();
this.element.attr( {
// Only set static values; aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role: "progressbar",
"aria-valuemin": this.min
} );
this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
this.valueDiv = $( "<div>" ).appendTo( this.element );
this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
this._refreshValue();
},
_destroy: function() {
this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
this.valueDiv.remove();
},
value: function( newValue ) {
if ( newValue === undefined ) {
return this.options.value;
}
this.options.value = this._constrainedValue( newValue );
this._refreshValue();
},
_constrainedValue: function( newValue ) {
if ( newValue === undefined ) {
newValue = this.options.value;
}
this.indeterminate = newValue === false;
// Sanitize value
if ( typeof newValue !== "number" ) {
newValue = 0;
}
return this.indeterminate ? false :
Math.min( this.options.max, Math.max( this.min, newValue ) );
},
_setOptions: function( options ) {
// Ensure "value" option is set after other values (like max)
var value = options.value;
delete options.value;
this._super( options );
this.options.value = this._constrainedValue( value );
this._refreshValue();
},
_setOption: function( key, value ) {
if ( key === "max" ) {
// Don't allow a max less than min
value = Math.max( this.min, value );
}
this._super( key, value );
},
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", value );
this._toggleClass( null, "ui-state-disabled", !!value );
},
_percentage: function() {
return this.indeterminate ?
100 :
100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
},
_refreshValue: function() {
var value = this.options.value,
percentage = this._percentage();
this.valueDiv
.toggle( this.indeterminate || value > this.min )
.width( percentage.toFixed( 0 ) + "%" );
this
._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
value === this.options.max )
._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuenow" );
if ( !this.overlayDiv ) {
this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
}
} else {
this.element.attr( {
"aria-valuemax": this.options.max,
"aria-valuenow": value
} );
if ( this.overlayDiv ) {
this.overlayDiv.remove();
this.overlayDiv = null;
}
}
if ( this.oldValue !== value ) {
this.oldValue = value;
this._trigger( "change" );
}
if ( value === this.options.max ) {
this._trigger( "complete" );
}
}
} );
/*!
* jQuery UI Selectmenu 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Selectmenu
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/selectmenu/
//>>demos: http://jqueryui.com/selectmenu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css
var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
version: "1.13.1",
defaultElement: "<select>",
options: {
appendTo: null,
classes: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
},
disabled: null,
icons: {
button: "ui-icon-triangle-1-s"
},
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
width: false,
// Callbacks
change: null,
close: null,
focus: null,
open: null,
select: null
},
_create: function() {
var selectmenuId = this.element.uniqueId().attr( "id" );
this.ids = {
element: selectmenuId,
button: selectmenuId + "-button",
menu: selectmenuId + "-menu"
};
this._drawButton();
this._drawMenu();
this._bindFormResetHandler();
this._rendered = false;
this.menuItems = $();
},
_drawButton: function() {
var icon,
that = this,
item = this._parseOption(
this.element.find( "option:selected" ),
this.element[ 0 ].selectedIndex
);
// Associate existing label with the new button
this.labels = this.element.labels().attr( "for", this.ids.button );
this._on( this.labels, {
click: function( event ) {
this.button.trigger( "focus" );
event.preventDefault();
}
} );
// Hide original select element
this.element.hide();
// Create button
this.button = $( "<span>", {
tabindex: this.options.disabled ? -1 : 0,
id: this.ids.button,
role: "combobox",
"aria-expanded": "false",
"aria-autocomplete": "list",
"aria-owns": this.ids.menu,
"aria-haspopup": "true",
title: this.element.attr( "title" )
} )
.insertAfter( this.element );
this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
"ui-button ui-widget" );
icon = $( "<span>" ).appendTo( this.button );
this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
this.buttonItem = this._renderButtonItem( item )
.appendTo( this.button );
if ( this.options.width !== false ) {
this._resizeButton();
}
this._on( this.button, this._buttonEvents );
this.button.one( "focusin", function() {
// Delay rendering the menu items until the button receives focus.
// The menu may have already been rendered via a programmatic open.
if ( !that._rendered ) {
that._refreshMenu();
}
} );
},
_drawMenu: function() {
var that = this;
// Create menu
this.menu = $( "<ul>", {
"aria-hidden": "true",
"aria-labelledby": this.ids.button,
id: this.ids.menu
} );
// Wrap menu
this.menuWrap = $( "<div>" ).append( this.menu );
this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
this.menuWrap.appendTo( this._appendTo() );
// Initialize menu widget
this.menuInstance = this.menu
.menu( {
classes: {
"ui-menu": "ui-corner-bottom"
},
role: "listbox",
select: function( event, ui ) {
event.preventDefault();
// Support: IE8
// If the item was selected via a click, the text selection
// will be destroyed in IE
that._setSelection();
that._select( ui.item.data( "ui-selectmenu-item" ), event );
},
focus: function( event, ui ) {
var item = ui.item.data( "ui-selectmenu-item" );
// Prevent inital focus from firing and check if its a newly focused item
if ( that.focusIndex != null && item.index !== that.focusIndex ) {
that._trigger( "focus", event, { item: item } );
if ( !that.isOpen ) {
that._select( item, event );
}
}
that.focusIndex = item.index;
that.button.attr( "aria-activedescendant",
that.menuItems.eq( item.index ).attr( "id" ) );
}
} )
.menu( "instance" );
// Don't close the menu on mouseleave
this.menuInstance._off( this.menu, "mouseleave" );
// Cancel the menu's collapseAll on document click
this.menuInstance._closeOnDocumentClick = function() {
return false;
};
// Selects often contain empty items, but never contain dividers
this.menuInstance._isDivider = function() {
return false;
};
},
refresh: function() {
this._refreshMenu();
this.buttonItem.replaceWith(
this.buttonItem = this._renderButtonItem(
// Fall back to an empty object in case there are no options
this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
)
);
if ( this.options.width === null ) {
this._resizeButton();
}
},
_refreshMenu: function() {
var item,
options = this.element.find( "option" );
this.menu.empty();
this._parseOptions( options );
this._renderMenu( this.menu, this.items );
this.menuInstance.refresh();
this.menuItems = this.menu.find( "li" )
.not( ".ui-selectmenu-optgroup" )
.find( ".ui-menu-item-wrapper" );
this._rendered = true;
if ( !options.length ) {
return;
}
item = this._getSelectedItem();
// Update the menu to have the correct item focused
this.menuInstance.focus( null, item );
this._setAria( item.data( "ui-selectmenu-item" ) );
// Set disabled state
this._setOption( "disabled", this.element.prop( "disabled" ) );
},
open: function( event ) {
if ( this.options.disabled ) {
return;
}
// If this is the first time the menu is being opened, render the items
if ( !this._rendered ) {
this._refreshMenu();
} else {
// Menu clears focus on close, reset focus to selected item
this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
this.menuInstance.focus( null, this._getSelectedItem() );
}
// If there are no options, don't open the menu
if ( !this.menuItems.length ) {
return;
}
this.isOpen = true;
this._toggleAttr();
this._resizeMenu();
this._position();
this._on( this.document, this._documentClick );
this._trigger( "open", event );
},
_position: function() {
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
},
close: function( event ) {
if ( !this.isOpen ) {
return;
}
this.isOpen = false;
this._toggleAttr();
this.range = null;
this._off( this.document );
this._trigger( "close", event );
},
widget: function() {
return this.button;
},
menuWidget: function() {
return this.menu;
},
_renderButtonItem: function( item ) {
var buttonItem = $( "<span>" );
this._setText( buttonItem, item.label );
this._addClass( buttonItem, "ui-selectmenu-text" );
return buttonItem;
},
_renderMenu: function( ul, items ) {
var that = this,
currentOptgroup = "";
$.each( items, function( index, item ) {
var li;
if ( item.optgroup !== currentOptgroup ) {
li = $( "<li>", {
text: item.optgroup
} );
that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
( item.element.parent( "optgroup" ).prop( "disabled" ) ?
" ui-state-disabled" :
"" ) );
li.appendTo( ul );
currentOptgroup = item.optgroup;
}
that._renderItemData( ul, item );
} );
},
_renderItemData: function( ul, item ) {
return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
},
_renderItem: function( ul, item ) {
var li = $( "<li>" ),
wrapper = $( "<div>", {
title: item.element.attr( "title" )
} );
if ( item.disabled ) {
this._addClass( li, null, "ui-state-disabled" );
}
this._setText( wrapper, item.label );
return li.append( wrapper ).appendTo( ul );
},
_setText: function( element, value ) {
if ( value ) {
element.text( value );
} else {
element.html( " " );
}
},
_move: function( direction, event ) {
var item, next,
filter = ".ui-menu-item";
if ( this.isOpen ) {
item = this.menuItems.eq( this.focusIndex ).parent( "li" );
} else {
item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
filter += ":not(.ui-state-disabled)";
}
if ( direction === "first" || direction === "last" ) {
next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
} else {
next = item[ direction + "All" ]( filter ).eq( 0 );
}
if ( next.length ) {
this.menuInstance.focus( event, next );
}
},
_getSelectedItem: function() {
return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
},
_toggle: function( event ) {
this[ this.isOpen ? "close" : "open" ]( event );
},
_setSelection: function() {
var selection;
if ( !this.range ) {
return;
}
if ( window.getSelection ) {
selection = window.getSelection();
selection.removeAllRanges();
selection.addRange( this.range );
// Support: IE8
} else {
this.range.select();
}
// Support: IE
// Setting the text selection kills the button focus in IE, but
// restoring the focus doesn't kill the selection.
this.button.focus();
},
_documentClick: {
mousedown: function( event ) {
if ( !this.isOpen ) {
return;
}
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
$.escapeSelector( this.ids.button ) ).length ) {
this.close( event );
}
}
},
_buttonEvents: {
// Prevent text selection from being reset when interacting with the selectmenu (#10144)
mousedown: function() {
var selection;
if ( window.getSelection ) {
selection = window.getSelection();
if ( selection.rangeCount ) {
this.range = selection.getRangeAt( 0 );
}
// Support: IE8
} else {
this.range = document.selection.createRange();
}
},
click: function( event ) {
this._setSelection();
this._toggle( event );
},
keydown: function( event ) {
var preventDefault = true;
switch ( event.keyCode ) {
case $.ui.keyCode.TAB:
case $.ui.keyCode.ESCAPE:
this.close( event );
preventDefault = false;
break;
case $.ui.keyCode.ENTER:
if ( this.isOpen ) {
this._selectFocusedItem( event );
}
break;
case $.ui.keyCode.UP:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "prev", event );
}
break;
case $.ui.keyCode.DOWN:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "next", event );
}
break;
case $.ui.keyCode.SPACE:
if ( this.isOpen ) {
this._selectFocusedItem( event );
} else {
this._toggle( event );
}
break;
case $.ui.keyCode.LEFT:
this._move( "prev", event );
break;
case $.ui.keyCode.RIGHT:
this._move( "next", event );
break;
case $.ui.keyCode.HOME:
case $.ui.keyCode.PAGE_UP:
this._move( "first", event );
break;
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_DOWN:
this._move( "last", event );
break;
default:
this.menu.trigger( event );
preventDefault = false;
}
if ( preventDefault ) {
event.preventDefault();
}
}
},
_selectFocusedItem: function( event ) {
var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
if ( !item.hasClass( "ui-state-disabled" ) ) {
this._select( item.data( "ui-selectmenu-item" ), event );
}
},
_select: function( item, event ) {
var oldIndex = this.element[ 0 ].selectedIndex;
// Change native select element
this.element[ 0 ].selectedIndex = item.index;
this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
this._setAria( item );
this._trigger( "select", event, { item: item } );
if ( item.index !== oldIndex ) {
this._trigger( "change", event, { item: item } );
}
this.close( event );
},
_setAria: function( item ) {
var id = this.menuItems.eq( item.index ).attr( "id" );
this.button.attr( {
"aria-labelledby": id,
"aria-activedescendant": id
} );
this.menu.attr( "aria-activedescendant", id );
},
_setOption: function( key, value ) {
if ( key === "icons" ) {
var icon = this.button.find( "span.ui-icon" );
this._removeClass( icon, null, this.options.icons.button )
._addClass( icon, null, value.button );
}
this._super( key, value );
if ( key === "appendTo" ) {
this.menuWrap.appendTo( this._appendTo() );
}
if ( key === "width" ) {
this._resizeButton();
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this.menuInstance.option( "disabled", value );
this.button.attr( "aria-disabled", value );
this._toggleClass( this.button, null, "ui-state-disabled", value );
this.element.prop( "disabled", value );
if ( value ) {
this.button.attr( "tabindex", -1 );
this.close();
} else {
this.button.attr( "tabindex", 0 );
}
},
_appendTo: function() {
var element = this.options.appendTo;
if ( element ) {
element = element.jquery || element.nodeType ?
$( element ) :
this.document.find( element ).eq( 0 );
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front, dialog" );
}
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_toggleAttr: function() {
this.button.attr( "aria-expanded", this.isOpen );
// We can't use two _toggleClass() calls here, because we need to make sure
// we always remove classes first and add them second, otherwise if both classes have the
// same theme class, it will be removed after we add it.
this._removeClass( this.button, "ui-selectmenu-button-" +
( this.isOpen ? "closed" : "open" ) )
._addClass( this.button, "ui-selectmenu-button-" +
( this.isOpen ? "open" : "closed" ) )
._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
this.menu.attr( "aria-hidden", !this.isOpen );
},
_resizeButton: function() {
var width = this.options.width;
// For `width: false`, just remove inline style and stop
if ( width === false ) {
this.button.css( "width", "" );
return;
}
// For `width: null`, match the width of the original element
if ( width === null ) {
width = this.element.show().outerWidth();
this.element.hide();
}
this.button.outerWidth( width );
},
_resizeMenu: function() {
this.menu.outerWidth( Math.max(
this.button.outerWidth(),
// Support: IE10
// IE10 wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping
this.menu.width( "" ).outerWidth() + 1
) );
},
_getCreateOptions: function() {
var options = this._super();
options.disabled = this.element.prop( "disabled" );
return options;
},
_parseOptions: function( options ) {
var that = this,
data = [];
options.each( function( index, item ) {
if ( item.hidden ) {
return;
}
data.push( that._parseOption( $( item ), index ) );
} );
this.items = data;
},
_parseOption: function( option, index ) {
var optgroup = option.parent( "optgroup" );
return {
element: option,
index: index,
value: option.val(),
label: option.text(),
optgroup: optgroup.attr( "label" ) || "",
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
};
},
_destroy: function() {
this._unbindFormResetHandler();
this.menuWrap.remove();
this.button.remove();
this.element.show();
this.element.removeUniqueId();
this.labels.attr( "for", this.ids.element );
}
} ] );
/*!
* jQuery UI Slider 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Slider
//>>group: Widgets
//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
//>>docs: http://api.jqueryui.com/slider/
//>>demos: http://jqueryui.com/slider/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/slider.css
//>>css.theme: ../../themes/base/theme.css
var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
version: "1.13.1",
widgetEventPrefix: "slide",
options: {
animate: false,
classes: {
"ui-slider": "ui-corner-all",
"ui-slider-handle": "ui-corner-all",
// Note: ui-widget-header isn't the most fittingly semantic framework class for this
// element, but worked best visually with a variety of themes
"ui-slider-range": "ui-corner-all ui-widget-header"
},
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: false,
step: 1,
value: 0,
values: null,
// Callbacks
change: null,
slide: null,
start: null,
stop: null
},
// Number of pages in a slider
// (how many times can you page up/down to go through the whole range)
numPages: 5,
_create: function() {
this._keySliding = false;
this._mouseSliding = false;
this._animateOff = true;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this._calculateNewMax();
this._addClass( "ui-slider ui-slider-" + this.orientation,
"ui-widget ui-widget-content" );
this._refresh();
this._animateOff = false;
},
_refresh: function() {
this._createRange();
this._createHandles();
this._setupEvents();
this._refreshValue();
},
_createHandles: function() {
var i, handleCount,
options = this.options,
existingHandles = this.element.find( ".ui-slider-handle" ),
handle = "<span tabindex='0'></span>",
handles = [];
handleCount = ( options.values && options.values.length ) || 1;
if ( existingHandles.length > handleCount ) {
existingHandles.slice( handleCount ).remove();
existingHandles = existingHandles.slice( 0, handleCount );
}
for ( i = existingHandles.length; i < handleCount; i++ ) {
handles.push( handle );
}
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
this.handle = this.handles.eq( 0 );
this.handles.each( function( i ) {
$( this )
.data( "ui-slider-handle-index", i )
.attr( "tabIndex", 0 );
} );
},
_createRange: function() {
var options = this.options;
if ( options.range ) {
if ( options.range === true ) {
if ( !options.values ) {
options.values = [ this._valueMin(), this._valueMin() ];
} else if ( options.values.length && options.values.length !== 2 ) {
options.values = [ options.values[ 0 ], options.values[ 0 ] ];
} else if ( Array.isArray( options.values ) ) {
options.values = options.values.slice( 0 );
}
}
if ( !this.range || !this.range.length ) {
this.range = $( "<div>" )
.appendTo( this.element );
this._addClass( this.range, "ui-slider-range" );
} else {
this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
// Handle range switching from true to min/max
this.range.css( {
"left": "",
"bottom": ""
} );
}
if ( options.range === "min" || options.range === "max" ) {
this._addClass( this.range, "ui-slider-range-" + options.range );
}
} else {
if ( this.range ) {
this.range.remove();
}
this.range = null;
}
},
_setupEvents: function() {
this._off( this.handles );
this._on( this.handles, this._handleEvents );
this._hoverable( this.handles );
this._focusable( this.handles );
},
_destroy: function() {
this.handles.remove();
if ( this.range ) {
this.range.remove();
}
this._mouseDestroy();
},
_mouseCapture: function( event ) {
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
that = this,
o = this.options;
if ( o.disabled ) {
return false;
}
this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset = this.element.offset();
position = { x: event.pageX, y: event.pageY };
normValue = this._normValueFromMouse( position );
distance = this._valueMax() - this._valueMin() + 1;
this.handles.each( function( i ) {
var thisDistance = Math.abs( normValue - that.values( i ) );
if ( ( distance > thisDistance ) ||
( distance === thisDistance &&
( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
distance = thisDistance;
closestHandle = $( this );
index = i;
}
} );
allowed = this._start( event, index );
if ( allowed === false ) {
return false;
}
this._mouseSliding = true;
this._handleIndex = index;
this._addClass( closestHandle, null, "ui-state-active" );
closestHandle.trigger( "focus" );
offset = closestHandle.offset();
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
top: event.pageY - offset.top -
( closestHandle.height() / 2 ) -
( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
};
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
this._slide( event, index, normValue );
}
this._animateOff = true;
return true;
},
_mouseStart: function() {
return true;
},
_mouseDrag: function( event ) {
var position = { x: event.pageX, y: event.pageY },
normValue = this._normValueFromMouse( position );
this._slide( event, this._handleIndex, normValue );
return false;
},
_mouseStop: function( event ) {
this._removeClass( this.handles, null, "ui-state-active" );
this._mouseSliding = false;
this._stop( event, this._handleIndex );
this._change( event, this._handleIndex );
this._handleIndex = null;
this._clickOffset = null;
this._animateOff = false;
return false;
},
_detectOrientation: function() {
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
},
_normValueFromMouse: function( position ) {
var pixelTotal,
pixelMouse,
percentMouse,
valueTotal,
valueMouse;
if ( this.orientation === "horizontal" ) {
pixelTotal = this.elementSize.width;
pixelMouse = position.x - this.elementOffset.left -
( this._clickOffset ? this._clickOffset.left : 0 );
} else {
pixelTotal = this.elementSize.height;
pixelMouse = position.y - this.elementOffset.top -
( this._clickOffset ? this._clickOffset.top : 0 );
}
percentMouse = ( pixelMouse / pixelTotal );
if ( percentMouse > 1 ) {
percentMouse = 1;
}
if ( percentMouse < 0 ) {
percentMouse = 0;
}
if ( this.orientation === "vertical" ) {
percentMouse = 1 - percentMouse;
}
valueTotal = this._valueMax() - this._valueMin();
valueMouse = this._valueMin() + percentMouse * valueTotal;
return this._trimAlignValue( valueMouse );
},
_uiHash: function( index, value, values ) {
var uiHash = {
handle: this.handles[ index ],
handleIndex: index,
value: value !== undefined ? value : this.value()
};
if ( this._hasMultipleValues() ) {
uiHash.value = value !== undefined ? value : this.values( index );
uiHash.values = values || this.values();
}
return uiHash;
},
_hasMultipleValues: function() {
return this.options.values && this.options.values.length;
},
_start: function( event, index ) {
return this._trigger( "start", event, this._uiHash( index ) );
},
_slide: function( event, index, newVal ) {
var allowed, otherVal,
currentValue = this.value(),
newValues = this.values();
if ( this._hasMultipleValues() ) {
otherVal = this.values( index ? 0 : 1 );
currentValue = this.values( index );
if ( this.options.values.length === 2 && this.options.range === true ) {
newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
}
newValues[ index ] = newVal;
}
if ( newVal === currentValue ) {
return;
}
allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
// A slide can be canceled by returning false from the slide callback
if ( allowed === false ) {
return;
}
if ( this._hasMultipleValues() ) {
this.values( index, newVal );
} else {
this.value( newVal );
}
},
_stop: function( event, index ) {
this._trigger( "stop", event, this._uiHash( index ) );
},
_change: function( event, index ) {
if ( !this._keySliding && !this._mouseSliding ) {
//store the last changed value index for reference when handles overlap
this._lastChangedValue = index;
this._trigger( "change", event, this._uiHash( index ) );
}
},
value: function( newValue ) {
if ( arguments.length ) {
this.options.value = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, 0 );
return;
}
return this._value();
},
values: function( index, newValue ) {
var vals,
newValues,
i;
if ( arguments.length > 1 ) {
this.options.values[ index ] = this._trimAlignValue( newValue );
this._refreshValue();
this._change( null, index );
return;
}
if ( arguments.length ) {
if ( Array.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( newValues[ i ] );
this._change( null, i );
}
this._refreshValue();
} else {
if ( this._hasMultipleValues() ) {
return this._values( index );
} else {
return this.value();
}
}
} else {
return this._values();
}
},
_setOption: function( key, value ) {
var i,
valsLength = 0;
if ( key === "range" && this.options.range === true ) {
if ( value === "min" ) {
this.options.value = this._values( 0 );
this.options.values = null;
} else if ( value === "max" ) {
this.options.value = this._values( this.options.values.length - 1 );
this.options.values = null;
}
}
if ( Array.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
this._super( key, value );
switch ( key ) {
case "orientation":
this._detectOrientation();
this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
._addClass( "ui-slider-" + this.orientation );
this._refreshValue();
if ( this.options.range ) {
this._refreshRange( value );
}
// Reset positioning from previous orientation
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
break;
case "value":
this._animateOff = true;
this._refreshValue();
this._change( null, 0 );
this._animateOff = false;
break;
case "values":
this._animateOff = true;
this._refreshValue();
// Start from the last handle to prevent unreachable handles (#9046)
for ( i = valsLength - 1; i >= 0; i-- ) {
this._change( null, i );
}
this._animateOff = false;
break;
case "step":
case "min":
case "max":
this._animateOff = true;
this._calculateNewMax();
this._refreshValue();
this._animateOff = false;
break;
case "range":
this._animateOff = true;
this._refresh();
this._animateOff = false;
break;
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this._toggleClass( null, "ui-state-disabled", !!value );
},
//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value: function() {
var val = this.options.value;
val = this._trimAlignValue( val );
return val;
},
//internal values getter
// _values() returns array of values trimmed by min and max, aligned by step
// _values( index ) returns single value trimmed by min and max, aligned by step
_values: function( index ) {
var val,
vals,
i;
if ( arguments.length ) {
val = this.options.values[ index ];
val = this._trimAlignValue( val );
return val;
} else if ( this._hasMultipleValues() ) {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
return vals;
} else {
return [];
}
},
// Returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue: function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
}
if ( val >= this._valueMax() ) {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = ( val - this._valueMin() ) % step,
alignValue = val - valModStep;
if ( Math.abs( valModStep ) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed( 5 ) );
},
_calculateNewMax: function() {
var max = this.options.max,
min = this._valueMin(),
step = this.options.step,
aboveMin = Math.round( ( max - min ) / step ) * step;
max = aboveMin + min;
if ( max > this.options.max ) {
//If max is not divisible by step, rounding off may increase its value
max -= step;
}
this.max = parseFloat( max.toFixed( this._precision() ) );
},
_precision: function() {
var precision = this._precisionOf( this.options.step );
if ( this.options.min !== null ) {
precision = Math.max( precision, this._precisionOf( this.options.min ) );
}
return precision;
},
_precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
_valueMin: function() {
return this.options.min;
},
_valueMax: function() {
return this.max;
},
_refreshRange: function( orientation ) {
if ( orientation === "vertical" ) {
this.range.css( { "width": "", "left": "" } );
}
if ( orientation === "horizontal" ) {
this.range.css( { "height": "", "bottom": "" } );
}
},
_refreshValue: function() {
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange = this.options.range,
o = this.options,
that = this,
animate = ( !this._animateOff ) ? o.animate : false,
_set = {};
if ( this._hasMultipleValues() ) {
this.handles.each( function( i ) {
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( that.options.range === true ) {
if ( that.orientation === "horizontal" ) {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
left: valPercent + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( {
width: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
} else {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
bottom: ( valPercent ) + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( {
height: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
}
}
lastValPercent = valPercent;
} );
} else {
value = this.value();
valueMin = this._valueMin();
valueMax = this._valueMax();
valPercent = ( valueMax !== valueMin ) ?
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
0;
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( oRange === "min" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: ( 100 - valPercent ) + "%"
}, o.animate );
}
if ( oRange === "min" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: ( 100 - valPercent ) + "%"
}, o.animate );
}
}
},
_handleEvents: {
keydown: function( event ) {
var allowed, curVal, newVal, step,
index = $( event.target ).data( "ui-slider-handle-index" );
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_UP:
case $.ui.keyCode.PAGE_DOWN:
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
event.preventDefault();
if ( !this._keySliding ) {
this._keySliding = true;
this._addClass( $( event.target ), null, "ui-state-active" );
allowed = this._start( event, index );
if ( allowed === false ) {
return;
}
}
break;
}
step = this.options.step;
if ( this._hasMultipleValues() ) {
curVal = newVal = this.values( index );
} else {
curVal = newVal = this.value();
}
switch ( event.keyCode ) {
case $.ui.keyCode.HOME:
newVal = this._valueMin();
break;
case $.ui.keyCode.END:
newVal = this._valueMax();
break;
case $.ui.keyCode.PAGE_UP:
newVal = this._trimAlignValue(
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
);
break;
case $.ui.keyCode.PAGE_DOWN:
newVal = this._trimAlignValue(
curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
if ( curVal === this._valueMax() ) {
return;
}
newVal = this._trimAlignValue( curVal + step );
break;
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
if ( curVal === this._valueMin() ) {
return;
}
newVal = this._trimAlignValue( curVal - step );
break;
}
this._slide( event, index, newVal );
},
keyup: function( event ) {
var index = $( event.target ).data( "ui-slider-handle-index" );
if ( this._keySliding ) {
this._keySliding = false;
this._stop( event, index );
this._change( event, index );
this._removeClass( $( event.target ), null, "ui-state-active" );
}
}
}
} );
/*!
* jQuery UI Spinner 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Spinner
//>>group: Widgets
//>>description: Displays buttons to easily input numbers via the keyboard or mouse.
//>>docs: http://api.jqueryui.com/spinner/
//>>demos: http://jqueryui.com/spinner/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/spinner.css
//>>css.theme: ../../themes/base/theme.css
function spinnerModifier( fn ) {
return function() {
var previous = this.element.val();
fn.apply( this, arguments );
this._refresh();
if ( previous !== this.element.val() ) {
this._trigger( "change" );
}
};
}
$.widget( "ui.spinner", {
version: "1.13.1",
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
classes: {
"ui-spinner": "ui-corner-all",
"ui-spinner-down": "ui-corner-br",
"ui-spinner-up": "ui-corner-tr"
},
culture: null,
icons: {
down: "ui-icon-triangle-1-s",
up: "ui-icon-triangle-1-n"
},
incremental: true,
max: null,
min: null,
numberFormat: null,
page: 10,
step: 1,
change: null,
spin: null,
start: null,
stop: null
},
_create: function() {
// handle string values that need to be parsed
this._setOption( "max", this.options.max );
this._setOption( "min", this.options.min );
this._setOption( "step", this.options.step );
// Only format if there is a value, prevents the field from being marked
// as invalid in Firefox, see #9573.
if ( this.value() !== "" ) {
// Format the value, but don't constrain.
this._value( this.element.val(), true );
}
this._draw();
this._on( this._events );
this._refresh();
// Turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on( this.window, {
beforeunload: function() {
this.element.removeAttr( "autocomplete" );
}
} );
},
_getCreateOptions: function() {
var options = this._super();
var element = this.element;
$.each( [ "min", "max", "step" ], function( i, option ) {
var value = element.attr( option );
if ( value != null && value.length ) {
options[ option ] = value;
}
} );
return options;
},
_events: {
keydown: function( event ) {
if ( this._start( event ) && this._keydown( event ) ) {
event.preventDefault();
}
},
keyup: "_stop",
focus: function() {
this.previous = this.element.val();
},
blur: function( event ) {
if ( this.cancelBlur ) {
delete this.cancelBlur;
return;
}
this._stop();
this._refresh();
if ( this.previous !== this.element.val() ) {
this._trigger( "change", event );
}
},
mousewheel: function( event, delta ) {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );
var isActive = this.element[ 0 ] === activeElement;
if ( !isActive || !delta ) {
return;
}
if ( !this.spinning && !this._start( event ) ) {
return false;
}
this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
clearTimeout( this.mousewheelTimer );
this.mousewheelTimer = this._delay( function() {
if ( this.spinning ) {
this._stop( event );
}
}, 100 );
event.preventDefault();
},
"mousedown .ui-spinner-button": function( event ) {
var previous;
// We never want the buttons to have focus; whenever the user is
// interacting with the spinner, the focus should be on the input.
// If the input is focused then this.previous is properly set from
// when the input first received focus. If the input is not focused
// then we need to set this.previous based on the value before spinning.
previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
this.previous : this.element.val();
function checkFocus() {
var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
if ( !isActive ) {
this.element.trigger( "focus" );
this.previous = previous;
// support: IE
// IE sets focus asynchronously, so we need to check if focus
// moved off of the input because the user clicked on the button.
this._delay( function() {
this.previous = previous;
} );
}
}
// Ensure focus is on (or stays on) the text field
event.preventDefault();
checkFocus.call( this );
// Support: IE
// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
// and check (again) if focus moved off of the input.
this.cancelBlur = true;
this._delay( function() {
delete this.cancelBlur;
checkFocus.call( this );
} );
if ( this._start( event ) === false ) {
return;
}
this._repeat( null, $( event.currentTarget )
.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
"mouseup .ui-spinner-button": "_stop",
"mouseenter .ui-spinner-button": function( event ) {
// button will add ui-state-active if mouse was down while mouseleave and kept down
if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
return;
}
if ( this._start( event ) === false ) {
return false;
}
this._repeat( null, $( event.currentTarget )
.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
// TODO: do we really want to consider this a stop?
// shouldn't we just stop the repeater and wait until mouseup before
// we trigger the stop event?
"mouseleave .ui-spinner-button": "_stop"
},
// Support mobile enhanced option and make backcompat more sane
_enhance: function() {
this.uiSpinner = this.element
.attr( "autocomplete", "off" )
.wrap( "<span>" )
.parent()
// Add buttons
.append(
"<a></a><a></a>"
);
},
_draw: function() {
this._enhance();
this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
this._addClass( "ui-spinner-input" );
this.element.attr( "role", "spinbutton" );
// Button bindings
this.buttons = this.uiSpinner.children( "a" )
.attr( "tabIndex", -1 )
.attr( "aria-hidden", true )
.button( {
classes: {
"ui-button": ""
}
} );
// TODO: Right now button does not support classes this is already updated in button PR
this._removeClass( this.buttons, "ui-corner-all" );
this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
this.buttons.first().button( {
"icon": this.options.icons.up,
"showLabel": false
} );
this.buttons.last().button( {
"icon": this.options.icons.down,
"showLabel": false
} );
// IE 6 doesn't understand height: 50% for the buttons
// unless the wrapper has an explicit height
if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
this.uiSpinner.height() > 0 ) {
this.uiSpinner.height( this.uiSpinner.height() );
}
},
_keydown: function( event ) {
var options = this.options,
keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.UP:
this._repeat( null, 1, event );
return true;
case keyCode.DOWN:
this._repeat( null, -1, event );
return true;
case keyCode.PAGE_UP:
this._repeat( null, options.page, event );
return true;
case keyCode.PAGE_DOWN:
this._repeat( null, -options.page, event );
return true;
}
return false;
},
_start: function( event ) {
if ( !this.spinning && this._trigger( "start", event ) === false ) {
return false;
}
if ( !this.counter ) {
this.counter = 1;
}
this.spinning = true;
return true;
},
_repeat: function( i, steps, event ) {
i = i || 500;
clearTimeout( this.timer );
this.timer = this._delay( function() {
this._repeat( 40, steps, event );
}, i );
this._spin( steps * this.options.step, event );
},
_spin: function( step, event ) {
var value = this.value() || 0;
if ( !this.counter ) {
this.counter = 1;
}
value = this._adjustValue( value + step * this._increment( this.counter ) );
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
this._value( value );
this.counter++;
}
},
_increment: function( i ) {
var incremental = this.options.incremental;
if ( incremental ) {
return typeof incremental === "function" ?
incremental( i ) :
Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
}
return 1;
},
_precision: function() {
var precision = this._precisionOf( this.options.step );
if ( this.options.min !== null ) {
precision = Math.max( precision, this._precisionOf( this.options.min ) );
}
return precision;
},
_precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
_adjustValue: function( value ) {
var base, aboveMin,
options = this.options;
// Make sure we're at a valid step
// - find out where we are relative to the base (min or 0)
base = options.min !== null ? options.min : 0;
aboveMin = value - base;
// - round to the nearest step
aboveMin = Math.round( aboveMin / options.step ) * options.step;
// - rounding is based on 0, so adjust back to our base
value = base + aboveMin;
// Fix precision from bad JS floating point math
value = parseFloat( value.toFixed( this._precision() ) );
// Clamp the value
if ( options.max !== null && value > options.max ) {
return options.max;
}
if ( options.min !== null && value < options.min ) {
return options.min;
}
return value;
},
_stop: function( event ) {
if ( !this.spinning ) {
return;
}
clearTimeout( this.timer );
clearTimeout( this.mousewheelTimer );
this.counter = 0;
this.spinning = false;
this._trigger( "stop", event );
},
_setOption: function( key, value ) {
var prevValue, first, last;
if ( key === "culture" || key === "numberFormat" ) {
prevValue = this._parse( this.element.val() );
this.options[ key ] = value;
this.element.val( this._format( prevValue ) );
return;
}
if ( key === "max" || key === "min" || key === "step" ) {
if ( typeof value === "string" ) {
value = this._parse( value );
}
}
if ( key === "icons" ) {
first = this.buttons.first().find( ".ui-icon" );
this._removeClass( first, null, this.options.icons.up );
this._addClass( first, null, value.up );
last = this.buttons.last().find( ".ui-icon" );
this._removeClass( last, null, this.options.icons.down );
this._addClass( last, null, value.down );
}
this._super( key, value );
},
_setOptionDisabled: function( value ) {
this._super( value );
this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
this.buttons.button( value ? "disable" : "enable" );
},
_setOptions: spinnerModifier( function( options ) {
this._super( options );
} ),
_parse: function( val ) {
if ( typeof val === "string" && val !== "" ) {
val = window.Globalize && this.options.numberFormat ?
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
}
return val === "" || isNaN( val ) ? null : val;
},
_format: function( value ) {
if ( value === "" ) {
return "";
}
return window.Globalize && this.options.numberFormat ?
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
value;
},
_refresh: function() {
this.element.attr( {
"aria-valuemin": this.options.min,
"aria-valuemax": this.options.max,
// TODO: what should we do with values that can't be parsed?
"aria-valuenow": this._parse( this.element.val() )
} );
},
isValid: function() {
var value = this.value();
// Null is invalid
if ( value === null ) {
return false;
}
// If value gets adjusted, it's invalid
return value === this._adjustValue( value );
},
// Update the value without triggering change
_value: function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
parsed = this._parse( value );
if ( parsed !== null ) {
if ( !allowAny ) {
parsed = this._adjustValue( parsed );
}
value = this._format( parsed );
}
}
this.element.val( value );
this._refresh();
},
_destroy: function() {
this.element
.prop( "disabled", false )
.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
this.uiSpinner.replaceWith( this.element );
},
stepUp: spinnerModifier( function( steps ) {
this._stepUp( steps );
} ),
_stepUp: function( steps ) {
if ( this._start() ) {
this._spin( ( steps || 1 ) * this.options.step );
this._stop();
}
},
stepDown: spinnerModifier( function( steps ) {
this._stepDown( steps );
} ),
_stepDown: function( steps ) {
if ( this._start() ) {
this._spin( ( steps || 1 ) * -this.options.step );
this._stop();
}
},
pageUp: spinnerModifier( function( pages ) {
this._stepUp( ( pages || 1 ) * this.options.page );
} ),
pageDown: spinnerModifier( function( pages ) {
this._stepDown( ( pages || 1 ) * this.options.page );
} ),
value: function( newVal ) {
if ( !arguments.length ) {
return this._parse( this.element.val() );
}
spinnerModifier( this._value ).call( this, newVal );
},
widget: function() {
return this.uiSpinner;
}
} );
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for spinner html extension points
$.widget( "ui.spinner", $.ui.spinner, {
_enhance: function() {
this.uiSpinner = this.element
.attr( "autocomplete", "off" )
.wrap( this._uiSpinnerHtml() )
.parent()
// Add buttons
.append( this._buttonHtml() );
},
_uiSpinnerHtml: function() {
return "<span>";
},
_buttonHtml: function() {
return "<a></a><a></a>";
}
} );
}
var widgetsSpinner = $.ui.spinner;
/*!
* jQuery UI Tabs 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Tabs
//>>group: Widgets
//>>description: Transforms a set of container elements into a tab structure.
//>>docs: http://api.jqueryui.com/tabs/
//>>demos: http://jqueryui.com/tabs/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tabs.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.tabs", {
version: "1.13.1",
delay: 300,
options: {
active: null,
classes: {
"ui-tabs": "ui-corner-all",
"ui-tabs-nav": "ui-corner-all",
"ui-tabs-panel": "ui-corner-bottom",
"ui-tabs-tab": "ui-corner-top"
},
collapsible: false,
event: "click",
heightStyle: "content",
hide: null,
show: null,
// Callbacks
activate: null,
beforeActivate: null,
beforeLoad: null,
load: null
},
_isLocal: ( function() {
var rhash = /#.*$/;
return function( anchor ) {
var anchorUrl, locationUrl;
anchorUrl = anchor.href.replace( rhash, "" );
locationUrl = location.href.replace( rhash, "" );
// Decoding may throw an error if the URL isn't UTF-8 (#9518)
try {
anchorUrl = decodeURIComponent( anchorUrl );
} catch ( error ) {}
try {
locationUrl = decodeURIComponent( locationUrl );
} catch ( error ) {}
return anchor.hash.length > 1 && anchorUrl === locationUrl;
};
} )(),
_create: function() {
var that = this,
options = this.options;
this.running = false;
this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
this._processTabs();
options.active = this._initialActive();
// Take disabling tabs via class attribute from HTML
// into account and update option properly.
if ( Array.isArray( options.disabled ) ) {
options.disabled = $.uniqueSort( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
} )
) ).sort();
}
// Check for length avoids error when initializing empty list
if ( this.options.active !== false && this.anchors.length ) {
this.active = this._findActive( options.active );
} else {
this.active = $();
}
this._refresh();
if ( this.active.length ) {
this.load( options.active );
}
},
_initialActive: function() {
var active = this.options.active,
collapsible = this.options.collapsible,
locationHash = location.hash.substring( 1 );
if ( active === null ) {
// check the fragment identifier in the URL
if ( locationHash ) {
this.tabs.each( function( i, tab ) {
if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
active = i;
return false;
}
} );
}
// Check for a tab marked active via a class
if ( active === null ) {
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
}
// No active tab, set to false
if ( active === null || active === -1 ) {
active = this.tabs.length ? 0 : false;
}
}
// Handle numbers: negative, out of range
if ( active !== false ) {
active = this.tabs.index( this.tabs.eq( active ) );
if ( active === -1 ) {
active = collapsible ? false : 0;
}
}
// Don't allow collapsible: false and active: false
if ( !collapsible && active === false && this.anchors.length ) {
active = 0;
}
return active;
},
_getCreateEventData: function() {
return {
tab: this.active,
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
};
},
_tabKeydown: function( event ) {
var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
selectedIndex = this.tabs.index( focusedTab ),
goingForward = true;
if ( this._handlePageNav( event ) ) {
return;
}
switch ( event.keyCode ) {
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward = false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex = this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex = 0;
break;
case $.ui.keyCode.SPACE:
// Activate only, no collapsing
event.preventDefault();
clearTimeout( this.activating );
this._activate( selectedIndex );
return;
case $.ui.keyCode.ENTER:
// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();
clearTimeout( this.activating );
// Determine if we should collapse or activate
this._activate( selectedIndex === this.options.active ? false : selectedIndex );
return;
default:
return;
}
// Focus the appropriate tab, based on which key was pressed
event.preventDefault();
clearTimeout( this.activating );
selectedIndex = this._focusNextTab( selectedIndex, goingForward );
// Navigating with control/command key will prevent automatic activation
if ( !event.ctrlKey && !event.metaKey ) {
// Update aria-selected immediately so that AT think the tab is already selected.
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
focusedTab.attr( "aria-selected", "false" );
this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
this.activating = this._delay( function() {
this.option( "active", selectedIndex );
}, this.delay );
}
},
_panelKeydown: function( event ) {
if ( this._handlePageNav( event ) ) {
return;
}
// Ctrl+up moves focus to the current tab
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
event.preventDefault();
this.active.trigger( "focus" );
}
},
// Alt+page up/down moves focus to the previous/next tab (and activates)
_handlePageNav: function( event ) {
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
this._activate( this._focusNextTab( this.options.active - 1, false ) );
return true;
}
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
this._activate( this._focusNextTab( this.options.active + 1, true ) );
return true;
}
},
_findNextTab: function( index, goingForward ) {
var lastTabIndex = this.tabs.length - 1;
function constrain() {
if ( index > lastTabIndex ) {
index = 0;
}
if ( index < 0 ) {
index = lastTabIndex;
}
return index;
}
while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
index = goingForward ? index + 1 : index - 1;
}
return index;
},
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).trigger( "focus" );
return index;
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
this._super( key, value );
if ( key === "collapsible" ) {
this._toggleClass( "ui-tabs-collapsible", null, value );
// Setting collapsible: false while collapsed; open first panel
if ( !value && this.options.active === false ) {
this._activate( 0 );
}
}
if ( key === "event" ) {
this._setupEvents( value );
}
if ( key === "heightStyle" ) {
this._setupHeightStyle( value );
}
},
_sanitizeSelector: function( hash ) {
return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
},
refresh: function() {
var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// Get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
return lis.index( tab );
} );
this._processTabs();
// Was collapsed or no tabs
if ( options.active === false || !this.anchors.length ) {
options.active = false;
this.active = $();
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
// all remaining tabs are disabled
if ( this.tabs.length === options.disabled.length ) {
options.active = false;
this.active = $();
// activate previous tab
} else {
this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
}
// was active, active tab still exists
} else {
// make sure active index is correct
options.active = this.tabs.index( this.active );
}
this._refresh();
},
_refresh: function() {
this._setOptionDisabled( this.options.disabled );
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );
this.tabs.not( this.active ).attr( {
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
} );
this.panels.not( this._getPanelForTab( this.active ) )
.hide()
.attr( {
"aria-hidden": "true"
} );
// Make sure one tab is in the tab order
if ( !this.active.length ) {
this.tabs.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active
.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
} );
this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
this._getPanelForTab( this.active )
.show()
.attr( {
"aria-hidden": "false"
} );
}
},
_processTabs: function() {
var that = this,
prevTabs = this.tabs,
prevAnchors = this.anchors,
prevPanels = this.panels;
this.tablist = this._getList().attr( "role", "tablist" );
this._addClass( this.tablist, "ui-tabs-nav",
"ui-helper-reset ui-helper-clearfix ui-widget-header" );
// Prevent users from focusing disabled tabs via click
this.tablist
.on( "mousedown" + this.eventNamespace, "> li", function( event ) {
if ( $( this ).is( ".ui-state-disabled" ) ) {
event.preventDefault();
}
} )
// Support: IE <9
// Preventing the default action in mousedown doesn't prevent IE
// from focusing the element, so if the anchor gets focused, blur.
// We don't have to worry about focusing the previously focused
// element since clicking on a non-focusable element should focus
// the body anyway.
.on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
}
} );
this.tabs = this.tablist.find( "> li:has(a[href])" )
.attr( {
role: "tab",
tabIndex: -1
} );
this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
this.anchors = this.tabs.map( function() {
return $( "a", this )[ 0 ];
} )
.attr( {
tabIndex: -1
} );
this._addClass( this.anchors, "ui-tabs-anchor" );
this.panels = $();
this.anchors.each( function( i, anchor ) {
var selector, panel, panelId,
anchorId = $( anchor ).uniqueId().attr( "id" ),
tab = $( anchor ).closest( "li" ),
originalAriaControls = tab.attr( "aria-controls" );
// Inline tab
if ( that._isLocal( anchor ) ) {
selector = anchor.hash;
panelId = selector.substring( 1 );
panel = that.element.find( that._sanitizeSelector( selector ) );
// remote tab
} else {
// If the tab doesn't already have aria-controls,
// generate an id by using a throw-away element
panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
selector = "#" + panelId;
panel = that.element.find( selector );
if ( !panel.length ) {
panel = that._createPanel( panelId );
panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
}
panel.attr( "aria-live", "polite" );
}
if ( panel.length ) {
that.panels = that.panels.add( panel );
}
if ( originalAriaControls ) {
tab.data( "ui-tabs-aria-controls", originalAriaControls );
}
tab.attr( {
"aria-controls": panelId,
"aria-labelledby": anchorId
} );
panel.attr( "aria-labelledby", anchorId );
} );
this.panels.attr( "role", "tabpanel" );
this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
// Avoid memory leaks (#10056)
if ( prevTabs ) {
this._off( prevTabs.not( this.tabs ) );
this._off( prevAnchors.not( this.anchors ) );
this._off( prevPanels.not( this.panels ) );
}
},
// Allow overriding how to find the list for rare usage scenarios (#7715)
_getList: function() {
return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
},
_createPanel: function( id ) {
return $( "<div>" )
.attr( "id", id )
.data( "ui-tabs-destroy", true );
},
_setOptionDisabled: function( disabled ) {
var currentItem, li, i;
if ( Array.isArray( disabled ) ) {
if ( !disabled.length ) {
disabled = false;
} else if ( disabled.length === this.anchors.length ) {
disabled = true;
}
}
// Disable tabs
for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
currentItem = $( li );
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
currentItem.attr( "aria-disabled", "true" );
this._addClass( currentItem, null, "ui-state-disabled" );
} else {
currentItem.removeAttr( "aria-disabled" );
this._removeClass( currentItem, null, "ui-state-disabled" );
}
}
this.options.disabled = disabled;
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
disabled === true );
},
_setupEvents: function( event ) {
var events = {};
if ( event ) {
$.each( event.split( " " ), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
} );
}
this._off( this.anchors.add( this.tabs ).add( this.panels ) );
// Always prevent the default action, even when disabled
this._on( true, this.anchors, {
click: function( event ) {
event.preventDefault();
}
} );
this._on( this.anchors, events );
this._on( this.tabs, { keydown: "_tabKeydown" } );
this._on( this.panels, { keydown: "_panelKeydown" } );
this._focusable( this.tabs );
this._hoverable( this.tabs );
},
_setupHeightStyle: function( heightStyle ) {
var maxHeight,
parent = this.element.parent();
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
maxHeight -= this.element.outerHeight() - this.element.height();
this.element.siblings( ":visible" ).each( function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
return;
}
maxHeight -= elem.outerHeight( true );
} );
this.element.children().not( this.panels ).each( function() {
maxHeight -= $( this ).outerHeight( true );
} );
this.panels.each( function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
} )
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.panels.each( function() {
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
} ).height( maxHeight );
}
},
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
anchor = $( event.currentTarget ),
tab = anchor.closest( "li" ),
clickedIsActive = tab[ 0 ] === active[ 0 ],
collapsing = clickedIsActive && options.collapsible,
toShow = collapsing ? $() : this._getPanelForTab( tab ),
toHide = !active.length ? $() : this._getPanelForTab( active ),
eventData = {
oldTab: active,
oldPanel: toHide,
newTab: collapsing ? $() : tab,
newPanel: toShow
};
event.preventDefault();
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
}
options.active = collapsing ? false : this.tabs.index( tab );
this.active = clickedIsActive ? $() : tab;
if ( this.xhr ) {
this.xhr.abort();
}
if ( !toHide.length && !toShow.length ) {
$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
}
if ( toShow.length ) {
this.load( this.tabs.index( tab ), event );
}
this._toggle( event, eventData );
},
// Handles show/hide for selecting tabs
_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
toHide = eventData.oldPanel;
this.running = true;
function complete() {
that.running = false;
that._trigger( "activate", event, eventData );
}
function show() {
that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
if ( toShow.length && that.options.show ) {
that._show( toShow, that.options.show, complete );
} else {
toShow.show();
complete();
}
}
// Start out by hiding, then showing, then completing
if ( toHide.length && this.options.hide ) {
this._hide( toHide, this.options.hide, function() {
that._removeClass( eventData.oldTab.closest( "li" ),
"ui-tabs-active", "ui-state-active" );
show();
} );
} else {
this._removeClass( eventData.oldTab.closest( "li" ),
"ui-tabs-active", "ui-state-active" );
toHide.hide();
show();
}
toHide.attr( "aria-hidden", "true" );
eventData.oldTab.attr( {
"aria-selected": "false",
"aria-expanded": "false"
} );
// If we're switching tabs, remove the old tab from the tab order.
// If we're opening from collapsed state, remove the previous tab from the tab order.
// If we're collapsing, then keep the collapsing tab in the tab order.
if ( toShow.length && toHide.length ) {
eventData.oldTab.attr( "tabIndex", -1 );
} else if ( toShow.length ) {
this.tabs.filter( function() {
return $( this ).attr( "tabIndex" ) === 0;
} )
.attr( "tabIndex", -1 );
}
toShow.attr( "aria-hidden", "false" );
eventData.newTab.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
} );
},
_activate: function( index ) {
var anchor,
active = this._findActive( index );
// Trying to activate the already active panel
if ( active[ 0 ] === this.active[ 0 ] ) {
return;
}
// Trying to collapse, simulate a click on the current active header
if ( !active.length ) {
active = this.active;
}
anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
this._eventHandler( {
target: anchor,
currentTarget: anchor,
preventDefault: $.noop
} );
},
_findActive: function( index ) {
return index === false ? $() : this.tabs.eq( index );
},
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" +
$.escapeSelector( index ) + "']" ) );
}
return index;
},
_destroy: function() {
if ( this.xhr ) {
this.xhr.abort();
}
this.tablist
.removeAttr( "role" )
.off( this.eventNamespace );
this.anchors
.removeAttr( "role tabIndex" )
.removeUniqueId();
this.tabs.add( this.panels ).each( function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
$( this ).removeAttr( "role tabIndex " +
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
}
} );
this.tabs.each( function() {
var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) {
li
.attr( "aria-controls", prev )
.removeData( "ui-tabs-aria-controls" );
} else {
li.removeAttr( "aria-controls" );
}
} );
this.panels.show();
if ( this.options.heightStyle !== "content" ) {
this.panels.css( "height", "" );
}
},
enable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === false ) {
return;
}
if ( index === undefined ) {
disabled = false;
} else {
index = this._getIndex( index );
if ( Array.isArray( disabled ) ) {
disabled = $.map( disabled, function( num ) {
return num !== index ? num : null;
} );
} else {
disabled = $.map( this.tabs, function( li, num ) {
return num !== index ? num : null;
} );
}
}
this._setOptionDisabled( disabled );
},
disable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === true ) {
return;
}
if ( index === undefined ) {
disabled = true;
} else {
index = this._getIndex( index );
if ( $.inArray( index, disabled ) !== -1 ) {
return;
}
if ( Array.isArray( disabled ) ) {
disabled = $.merge( [ index ], disabled ).sort();
} else {
disabled = [ index ];
}
}
this._setOptionDisabled( disabled );
},
load: function( index, event ) {
index = this._getIndex( index );
var that = this,
tab = this.tabs.eq( index ),
anchor = tab.find( ".ui-tabs-anchor" ),
panel = this._getPanelForTab( tab ),
eventData = {
tab: tab,
panel: panel
},
complete = function( jqXHR, status ) {
if ( status === "abort" ) {
that.panels.stop( false, true );
}
that._removeClass( tab, "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
delete that.xhr;
}
};
// Not remote
if ( this._isLocal( anchor[ 0 ] ) ) {
return;
}
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
// Support: jQuery <1.8
// jQuery <1.8 returns false if the request is canceled in beforeSend,
// but as of 1.8, $.ajax() always returns a jqXHR object.
if ( this.xhr && this.xhr.statusText !== "canceled" ) {
this._addClass( tab, "ui-tabs-loading" );
panel.attr( "aria-busy", "true" );
this.xhr
.done( function( response, status, jqXHR ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout( function() {
panel.html( response );
that._trigger( "load", event, eventData );
complete( jqXHR, status );
}, 1 );
} )
.fail( function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout( function() {
complete( jqXHR, status );
}, 1 );
} );
}
},
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
// Support: IE <11 only
// Strip any hash that exists to prevent errors with the Ajax request
url: anchor.attr( "href" ).replace( /#.*$/, "" ),
beforeSend: function( jqXHR, settings ) {
return that._trigger( "beforeLoad", event,
$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
}
};
},
_getPanelForTab: function( tab ) {
var id = $( tab ).attr( "aria-controls" );
return this.element.find( this._sanitizeSelector( "#" + id ) );
}
} );
// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for ui-tab class (now ui-tabs-tab)
$.widget( "ui.tabs", $.ui.tabs, {
_processTabs: function() {
this._superApply( arguments );
this._addClass( this.tabs, "ui-tab" );
}
} );
}
var widgetsTabs = $.ui.tabs;
/*!
* jQuery UI Tooltip 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Tooltip
//>>group: Widgets
//>>description: Shows additional information for any element on hover or focus.
//>>docs: http://api.jqueryui.com/tooltip/
//>>demos: http://jqueryui.com/tooltip/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tooltip.css
//>>css.theme: ../../themes/base/theme.css
$.widget( "ui.tooltip", {
version: "1.13.1",
options: {
classes: {
"ui-tooltip": "ui-corner-all ui-widget-shadow"
},
content: function() {
var title = $( this ).attr( "title" );
// Escape title, since we're going from an attribute to raw HTML
return $( "<a>" ).text( title ).html();
},
hide: true,
// Disabled elements have inconsistent behavior across browsers (#8661)
items: "[title]:not([disabled])",
position: {
my: "left top+15",
at: "left bottom",
collision: "flipfit flip"
},
show: true,
track: false,
// Callbacks
close: null,
open: null
},
_addDescribedBy: function( elem, id ) {
var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
describedby.push( id );
elem
.data( "ui-tooltip-id", id )
.attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) );
},
_removeDescribedBy: function( elem ) {
var id = elem.data( "ui-tooltip-id" ),
describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
index = $.inArray( id, describedby );
if ( index !== -1 ) {
describedby.splice( index, 1 );
}
elem.removeData( "ui-tooltip-id" );
describedby = String.prototype.trim.call( describedby.join( " " ) );
if ( describedby ) {
elem.attr( "aria-describedby", describedby );
} else {
elem.removeAttr( "aria-describedby" );
}
},
_create: function() {
this._on( {
mouseover: "open",
focusin: "open"
} );
// IDs of generated tooltips, needed for destroy
this.tooltips = {};
// IDs of parent tooltips where we removed the title attribute
this.parents = {};
// Append the aria-live region so tooltips announce correctly
this.liveRegion = $( "<div>" )
.attr( {
role: "log",
"aria-live": "assertive",
"aria-relevant": "additions"
} )
.appendTo( this.document[ 0 ].body );
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
this.disabledTitles = $( [] );
},
_setOption: function( key, value ) {
var that = this;
this._super( key, value );
if ( key === "content" ) {
$.each( this.tooltips, function( id, tooltipData ) {
that._updateContent( tooltipData.element );
} );
}
},
_setOptionDisabled: function( value ) {
this[ value ? "_disable" : "_enable" ]();
},
_disable: function() {
var that = this;
// Close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
var event = $.Event( "blur" );
event.target = event.currentTarget = tooltipData.element[ 0 ];
that.close( event, true );
} );
// Remove title attributes to prevent native tooltips
this.disabledTitles = this.disabledTitles.add(
this.element.find( this.options.items ).addBack()
.filter( function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
return element
.data( "ui-tooltip-title", element.attr( "title" ) )
.removeAttr( "title" );
}
} )
);
},
_enable: function() {
// restore title attributes
this.disabledTitles.each( function() {
var element = $( this );
if ( element.data( "ui-tooltip-title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
} );
this.disabledTitles = $( [] );
},
open: function( event ) {
var that = this,
target = $( event ? event.target : this.element )
// we need closest here due to mouseover bubbling,
// but always pointing at the same event target
.closest( this.options.items );
// No element to show a tooltip for or the tooltip is already open
if ( !target.length || target.data( "ui-tooltip-id" ) ) {
return;
}
if ( target.attr( "title" ) ) {
target.data( "ui-tooltip-title", target.attr( "title" ) );
}
target.data( "ui-tooltip-open", true );
// Kill parent tooltips, custom or native, for hover
if ( event && event.type === "mouseover" ) {
target.parents().each( function() {
var parent = $( this ),
blurEvent;
if ( parent.data( "ui-tooltip-open" ) ) {
blurEvent = $.Event( "blur" );
blurEvent.target = blurEvent.currentTarget = this;
that.close( blurEvent, true );
}
if ( parent.attr( "title" ) ) {
parent.uniqueId();
that.parents[ this.id ] = {
element: this,
title: parent.attr( "title" )
};
parent.attr( "title", "" );
}
} );
}
this._registerCloseHandlers( event, target );
this._updateContent( target, event );
},
_updateContent: function( target, event ) {
var content,
contentOption = this.options.content,
that = this,
eventType = event ? event.type : null;
if ( typeof contentOption === "string" || contentOption.nodeType ||
contentOption.jquery ) {
return this._open( event, target, contentOption );
}
content = contentOption.call( target[ 0 ], function( response ) {
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay( function() {
// Ignore async response if tooltip was closed already
if ( !target.data( "ui-tooltip-open" ) ) {
return;
}
// JQuery creates a special event for focusin when it doesn't
// exist natively. To improve performance, the native event
// object is reused and the type is changed. Therefore, we can't
// rely on the type being correct after the event finished
// bubbling, so we set it back to the previous value. (#8740)
if ( event ) {
event.type = eventType;
}
this._open( event, target, response );
} );
} );
if ( content ) {
this._open( event, target, content );
}
},
_open: function( event, target, content ) {
var tooltipData, tooltip, delayedShow, a11yContent,
positionOption = $.extend( {}, this.options.position );
if ( !content ) {
return;
}
// Content can be updated multiple times. If the tooltip already
// exists, then just update the content and bail.
tooltipData = this._find( target );
if ( tooltipData ) {
tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
return;
}
// If we have a title, clear it to prevent the native tooltip
// we have to check first to avoid defining a title if none exists
// (we don't want to cause an element to start matching [title])
//
// We use removeAttr only for key events, to allow IE to export the correct
// accessible attributes. For mouse events, set to empty string to avoid
// native tooltip showing up (happens only when removing inside mouseover).
if ( target.is( "[title]" ) ) {
if ( event && event.type === "mouseover" ) {
target.attr( "title", "" );
} else {
target.removeAttr( "title" );
}
}
tooltipData = this._tooltip( target );
tooltip = tooltipData.tooltip;
this._addDescribedBy( target, tooltip.attr( "id" ) );
tooltip.find( ".ui-tooltip-content" ).html( content );
// Support: Voiceover on OS X, JAWS on IE <= 9
// JAWS announces deletions even when aria-relevant="additions"
// Voiceover will sometimes re-read the entire log region's contents from the beginning
this.liveRegion.children().hide();
a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
a11yContent.appendTo( this.liveRegion );
function position( event ) {
positionOption.of = event;
if ( tooltip.is( ":hidden" ) ) {
return;
}
tooltip.position( positionOption );
}
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
this._on( this.document, {
mousemove: position
} );
// trigger once to override element-relative positioning
position( event );
} else {
tooltip.position( $.extend( {
of: target
}, this.options.position ) );
}
tooltip.hide();
this._show( tooltip, this.options.show );
// Handle tracking tooltips that are shown with a delay (#8644). As soon
// as the tooltip is visible, position the tooltip using the most recent
// event.
// Adds the check to add the timers only when both delay and track options are set (#14682)
if ( this.options.track && this.options.show && this.options.show.delay ) {
delayedShow = this.delayedShow = setInterval( function() {
if ( tooltip.is( ":visible" ) ) {
position( positionOption.of );
clearInterval( delayedShow );
}
}, 13 );
}
this._trigger( "open", event, { tooltip: tooltip } );
},
_registerCloseHandlers: function( event, target ) {
var events = {
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event( event );
fakeEvent.currentTarget = target[ 0 ];
this.close( fakeEvent, true );
}
}
};
// Only bind remove handler for delegated targets. Non-delegated
// tooltips will handle this in destroy.
if ( target[ 0 ] !== this.element[ 0 ] ) {
events.remove = function() {
var targetElement = this._find( target );
if ( targetElement ) {
this._removeTooltip( targetElement.tooltip );
}
};
}
if ( !event || event.type === "mouseover" ) {
events.mouseleave = "close";
}
if ( !event || event.type === "focusin" ) {
events.focusout = "close";
}
this._on( true, target, events );
},
close: function( event ) {
var tooltip,
that = this,
target = $( event ? event.currentTarget : this.element ),
tooltipData = this._find( target );
// The tooltip may already be closed
if ( !tooltipData ) {
// We set ui-tooltip-open immediately upon open (in open()), but only set the
// additional data once there's actually content to show (in _open()). So even if the
// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
// the period between open() and _open().
target.removeData( "ui-tooltip-open" );
return;
}
tooltip = tooltipData.tooltip;
// Disabling closes the tooltip, so we need to track when we're closing
// to avoid an infinite loop in case the tooltip becomes disabled on close
if ( tooltipData.closing ) {
return;
}
// Clear the interval for delayed tracking tooltips
clearInterval( this.delayedShow );
// Only set title if we had one before (see comment in _open())
// If the title attribute has changed since open(), don't restore
if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
}
this._removeDescribedBy( target );
tooltipData.hiding = true;
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
that._removeTooltip( $( this ) );
} );
target.removeData( "ui-tooltip-open" );
this._off( target, "mouseleave focusout keyup" );
// Remove 'remove' binding only on delegated targets
if ( target[ 0 ] !== this.element[ 0 ] ) {
this._off( target, "remove" );
}
this._off( this.document, "mousemove" );
if ( event && event.type === "mouseleave" ) {
$.each( this.parents, function( id, parent ) {
$( parent.element ).attr( "title", parent.title );
delete that.parents[ id ];
} );
}
tooltipData.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );
if ( !tooltipData.hiding ) {
tooltipData.closing = false;
}
},
_tooltip: function( element ) {
var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
content = $( "<div>" ).appendTo( tooltip ),
id = tooltip.uniqueId().attr( "id" );
this._addClass( content, "ui-tooltip-content" );
this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
tooltip.appendTo( this._appendTo( element ) );
return this.tooltips[ id ] = {
element: element,
tooltip: tooltip
};
},
_find: function( target ) {
var id = target.data( "ui-tooltip-id" );
return id ? this.tooltips[ id ] : null;
},
_removeTooltip: function( tooltip ) {
// Clear the interval for delayed tracking tooltips
clearInterval( this.delayedShow );
tooltip.remove();
delete this.tooltips[ tooltip.attr( "id" ) ];
},
_appendTo: function( target ) {
var element = target.closest( ".ui-front, dialog" );
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_destroy: function() {
var that = this;
// Close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
// Delegate to close method to handle common cleanup
var event = $.Event( "blur" ),
element = tooltipData.element;
event.target = event.currentTarget = element[ 0 ];
that.close( event, true );
// Remove immediately; destroying an open tooltip doesn't use the
// hide animation
$( "#" + id ).remove();
// Restore the title
if ( element.data( "ui-tooltip-title" ) ) {
// If the title attribute has changed since open(), don't restore
if ( !element.attr( "title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
element.removeData( "ui-tooltip-title" );
}
} );
this.liveRegion.remove();
}
} );
// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for tooltipClass option
$.widget( "ui.tooltip", $.ui.tooltip, {
options: {
tooltipClass: null
},
_tooltip: function() {
var tooltipData = this._superApply( arguments );
if ( this.options.tooltipClass ) {
tooltipData.tooltip.addClass( this.options.tooltipClass );
}
return tooltipData;
}
} );
}
var widgetsTooltip = $.ui.tooltip;
// Create a local jQuery because jQuery Color relies on it and the
// global may not exist with AMD and a custom build (#10199).
// This module is a noop if used as a regular AMD module.
// eslint-disable-next-line no-unused-vars
var jQuery = $;
/*!
* jQuery Color Animations v2.2.0
* https://github.com/jquery/jquery-color
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* Date: Sun May 10 09:02:36 2020 +0200
*/
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
class2type = {},
toString = class2type.toString,
// plusequals test for += 100 -= 100
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
// a set of RE's that can match strings and generate color tuples.
stringParsers = [ {
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ],
execResult[ 3 ],
execResult[ 4 ]
];
}
}, {
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ] * 2.55,
execResult[ 2 ] * 2.55,
execResult[ 3 ] * 2.55,
execResult[ 4 ]
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ], 16 ),
execResult[ 4 ] ?
( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :
1
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),
execResult[ 4 ] ?
( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )
.toFixed( 2 ) :
1
];
}
}, {
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
space: "hsla",
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ] / 100,
execResult[ 3 ] / 100,
execResult[ 4 ]
];
}
} ],
// jQuery.Color( )
color = jQuery.Color = function( color, green, blue, alpha ) {
return new jQuery.Color.fn.parse( color, green, blue, alpha );
},
spaces = {
rgba: {
props: {
red: {
idx: 0,
type: "byte"
},
green: {
idx: 1,
type: "byte"
},
blue: {
idx: 2,
type: "byte"
}
}
},
hsla: {
props: {
hue: {
idx: 0,
type: "degrees"
},
saturation: {
idx: 1,
type: "percent"
},
lightness: {
idx: 2,
type: "percent"
}
}
}
},
propTypes = {
"byte": {
floor: true,
max: 255
},
"percent": {
max: 1
},
"degrees": {
mod: 360,
floor: true
}
},
support = color.support = {},
// element for support tests
supportElem = jQuery( "<p>" )[ 0 ],
// colors = jQuery.Color.names
colors,
// local aliases of functions called often
each = jQuery.each;
// determine rgba support immediately
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
// define cache name and alpha properties
// for rgba and hsla spaces
each( spaces, function( spaceName, space ) {
space.cache = "_" + spaceName;
space.props.alpha = {
idx: 3,
type: "percent",
def: 1
};
} );
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( _i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function getType( obj ) {
if ( obj == null ) {
return obj + "";
}
return typeof obj === "object" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
}
function clamp( value, prop, allowEmpty ) {
var type = propTypes[ prop.type ] || {};
if ( value == null ) {
return ( allowEmpty || !prop.def ) ? null : prop.def;
}
// ~~ is an short way of doing floor for positive numbers
value = type.floor ? ~~value : parseFloat( value );
// IE will pass in empty strings as value for alpha,
// which will hit this case
if ( isNaN( value ) ) {
return prop.def;
}
if ( type.mod ) {
// we add mod before modding to make sure that negatives values
// get converted properly: -10 -> 350
return ( value + type.mod ) % type.mod;
}
// for now all property types without mod have min and max
return Math.min( type.max, Math.max( 0, value ) );
}
function stringParse( string ) {
var inst = color(),
rgba = inst._rgba = [];
string = string.toLowerCase();
each( stringParsers, function( _i, parser ) {
var parsed,
match = parser.re.exec( string ),
values = match && parser.parse( match ),
spaceName = parser.space || "rgba";
if ( values ) {
parsed = inst[ spaceName ]( values );
// if this was an rgba parse the assignment might happen twice
// oh well....
inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
rgba = inst._rgba = parsed._rgba;
// exit each( stringParsers ) here because we matched
return false;
}
} );
// Found a stringParser that handled it
if ( rgba.length ) {
// if this came from a parsed string, force "transparent" when alpha is 0
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
if ( rgba.join() === "0,0,0,0" ) {
jQuery.extend( rgba, colors.transparent );
}
return inst;
}
// named colors
return colors[ string ];
}
color.fn = jQuery.extend( color.prototype, {
parse: function( red, green, blue, alpha ) {
if ( red === undefined ) {
this._rgba = [ null, null, null, null ];
return this;
}
if ( red.jquery || red.nodeType ) {
red = jQuery( red ).css( green );
green = undefined;
}
var inst = this,
type = getType( red ),
rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
red = [ red, green, blue, alpha ];
type = "array";
}
if ( type === "string" ) {
return this.parse( stringParse( red ) || colors._default );
}
if ( type === "array" ) {
each( spaces.rgba.props, function( _key, prop ) {
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
} );
return this;
}
if ( type === "object" ) {
if ( red instanceof color ) {
each( spaces, function( _spaceName, space ) {
if ( red[ space.cache ] ) {
inst[ space.cache ] = red[ space.cache ].slice();
}
} );
} else {
each( spaces, function( _spaceName, space ) {
var cache = space.cache;
each( space.props, function( key, prop ) {
// if the cache doesn't exist, and we know how to convert
if ( !inst[ cache ] && space.to ) {
// if the value was null, we don't need to copy it
// if the key was alpha, we don't need to copy it either
if ( key === "alpha" || red[ key ] == null ) {
return;
}
inst[ cache ] = space.to( inst._rgba );
}
// this is the only case where we allow nulls for ALL properties.
// call clamp with alwaysAllowEmpty
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
} );
// everything defined but alpha?
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
// use the default of 1
if ( inst[ cache ][ 3 ] == null ) {
inst[ cache ][ 3 ] = 1;
}
if ( space.from ) {
inst._rgba = space.from( inst[ cache ] );
}
}
} );
}
return this;
}
},
is: function( compare ) {
var is = color( compare ),
same = true,
inst = this;
each( spaces, function( _, space ) {
var localCache,
isCache = is[ space.cache ];
if ( isCache ) {
localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
each( space.props, function( _, prop ) {
if ( isCache[ prop.idx ] != null ) {
same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
return same;
}
} );
}
return same;
} );
return same;
},
_space: function() {
var used = [],
inst = this;
each( spaces, function( spaceName, space ) {
if ( inst[ space.cache ] ) {
used.push( spaceName );
}
} );
return used.pop();
},
transition: function( other, distance ) {
var end = color( other ),
spaceName = end._space(),
space = spaces[ spaceName ],
startColor = this.alpha() === 0 ? color( "transparent" ) : this,
start = startColor[ space.cache ] || space.to( startColor._rgba ),
result = start.slice();
end = end[ space.cache ];
each( space.props, function( _key, prop ) {
var index = prop.idx,
startValue = start[ index ],
endValue = end[ index ],
type = propTypes[ prop.type ] || {};
// if null, don't override start value
if ( endValue === null ) {
return;
}
// if null - use end
if ( startValue === null ) {
result[ index ] = endValue;
} else {
if ( type.mod ) {
if ( endValue - startValue > type.mod / 2 ) {
startValue += type.mod;
} else if ( startValue - endValue > type.mod / 2 ) {
startValue -= type.mod;
}
}
result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
}
} );
return this[ spaceName ]( result );
},
blend: function( opaque ) {
// if we are already opaque - return ourself
if ( this._rgba[ 3 ] === 1 ) {
return this;
}
var rgb = this._rgba.slice(),
a = rgb.pop(),
blend = color( opaque )._rgba;
return color( jQuery.map( rgb, function( v, i ) {
return ( 1 - a ) * blend[ i ] + a * v;
} ) );
},
toRgbaString: function() {
var prefix = "rgba(",
rgba = jQuery.map( this._rgba, function( v, i ) {
if ( v != null ) {
return v;
}
return i > 2 ? 1 : 0;
} );
if ( rgba[ 3 ] === 1 ) {
rgba.pop();
prefix = "rgb(";
}
return prefix + rgba.join() + ")";
},
toHslaString: function() {
var prefix = "hsla(",
hsla = jQuery.map( this.hsla(), function( v, i ) {
if ( v == null ) {
v = i > 2 ? 1 : 0;
}
// catch 1 and 2
if ( i && i < 3 ) {
v = Math.round( v * 100 ) + "%";
}
return v;
} );
if ( hsla[ 3 ] === 1 ) {
hsla.pop();
prefix = "hsl(";
}
return prefix + hsla.join() + ")";
},
toHexString: function( includeAlpha ) {
var rgba = this._rgba.slice(),
alpha = rgba.pop();
if ( includeAlpha ) {
rgba.push( ~~( alpha * 255 ) );
}
return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
return v.length === 1 ? "0" + v : v;
} ).join( "" );
},
toString: function() {
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
}
} );
color.fn.parse.prototype = color.fn;
// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
function hue2rgb( p, q, h ) {
h = ( h + 1 ) % 1;
if ( h * 6 < 1 ) {
return p + ( q - p ) * h * 6;
}
if ( h * 2 < 1 ) {
return q;
}
if ( h * 3 < 2 ) {
return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
}
return p;
}
spaces.hsla.to = function( rgba ) {
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
return [ null, null, null, rgba[ 3 ] ];
}
var r = rgba[ 0 ] / 255,
g = rgba[ 1 ] / 255,
b = rgba[ 2 ] / 255,
a = rgba[ 3 ],
max = Math.max( r, g, b ),
min = Math.min( r, g, b ),
diff = max - min,
add = max + min,
l = add * 0.5,
h, s;
if ( min === max ) {
h = 0;
} else if ( r === max ) {
h = ( 60 * ( g - b ) / diff ) + 360;
} else if ( g === max ) {
h = ( 60 * ( b - r ) / diff ) + 120;
} else {
h = ( 60 * ( r - g ) / diff ) + 240;
}
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
if ( diff === 0 ) {
s = 0;
} else if ( l <= 0.5 ) {
s = diff / add;
} else {
s = diff / ( 2 - add );
}
return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
};
spaces.hsla.from = function( hsla ) {
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
return [ null, null, null, hsla[ 3 ] ];
}
var h = hsla[ 0 ] / 360,
s = hsla[ 1 ],
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
Math.round( hue2rgb( p, q, h ) * 255 ),
Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
a
];
};
each( spaces, function( spaceName, space ) {
var props = space.props,
cache = space.cache,
to = space.to,
from = space.from;
// makes rgba() and hsla()
color.fn[ spaceName ] = function( value ) {
// generate a cache for this space if it doesn't exist
if ( to && !this[ cache ] ) {
this[ cache ] = to( this._rgba );
}
if ( value === undefined ) {
return this[ cache ].slice();
}
var ret,
type = getType( value ),
arr = ( type === "array" || type === "object" ) ? value : arguments,
local = this[ cache ].slice();
each( props, function( key, prop ) {
var val = arr[ type === "object" ? key : prop.idx ];
if ( val == null ) {
val = local[ prop.idx ];
}
local[ prop.idx ] = clamp( val, prop );
} );
if ( from ) {
ret = color( from( local ) );
ret[ cache ] = local;
return ret;
} else {
return color( local );
}
};
// makes red() green() blue() alpha() hue() saturation() lightness()
each( props, function( key, prop ) {
// alpha is included in more than one space
if ( color.fn[ key ] ) {
return;
}
color.fn[ key ] = function( value ) {
var local, cur, match, fn,
vtype = getType( value );
if ( key === "alpha" ) {
fn = this._hsla ? "hsla" : "rgba";
} else {
fn = spaceName;
}
local = this[ fn ]();
cur = local[ prop.idx ];
if ( vtype === "undefined" ) {
return cur;
}
if ( vtype === "function" ) {
value = value.call( this, cur );
vtype = getType( value );
}
if ( value == null && prop.empty ) {
return this;
}
if ( vtype === "string" ) {
match = rplusequals.exec( value );
if ( match ) {
value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
}
}
local[ prop.idx ] = value;
return this[ fn ]( local );
};
} );
} );
// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
var hooks = hook.split( " " );
each( hooks, function( _i, hook ) {
jQuery.cssHooks[ hook ] = {
set: function( elem, value ) {
var parsed, curElem,
backgroundColor = "";
if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
value = color( parsed || value );
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
while (
( backgroundColor === "" || backgroundColor === "transparent" ) &&
curElem && curElem.style
) {
try {
backgroundColor = jQuery.css( curElem, "backgroundColor" );
curElem = curElem.parentNode;
} catch ( e ) {
}
}
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
backgroundColor :
"_default" );
}
value = value.toRgbaString();
}
try {
elem.style[ hook ] = value;
} catch ( e ) {
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
}
}
};
jQuery.fx.step[ hook ] = function( fx ) {
if ( !fx.colorInit ) {
fx.start = color( fx.elem, hook );
fx.end = color( fx.end );
fx.colorInit = true;
}
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
};
} );
};
color.hook( stepHooks );
jQuery.cssHooks.borderColor = {
expand: function( value ) {
var expanded = {};
each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {
expanded[ "border" + part + "Color" ] = value;
} );
return expanded;
}
};
// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors = jQuery.Color.names = {
// 4.1. Basic color keywords
aqua: "#00ffff",
black: "#000000",
blue: "#0000ff",
fuchsia: "#ff00ff",
gray: "#808080",
green: "#008000",
lime: "#00ff00",
maroon: "#800000",
navy: "#000080",
olive: "#808000",
purple: "#800080",
red: "#ff0000",
silver: "#c0c0c0",
teal: "#008080",
white: "#ffffff",
yellow: "#ffff00",
// 4.2.3. "transparent" color keyword
transparent: [ null, null, null, 0 ],
_default: "#ffffff"
};
/*!
* jQuery UI Effects 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Effects Core
//>>group: Effects
/* eslint-disable max-len */
//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/category/effects-core/
//>>demos: http://jqueryui.com/effect/
var dataSpace = "ui-effects-",
dataSpaceStyle = "ui-effects-style",
dataSpaceAnimated = "ui-effects-animated";
$.effects = {
effect: {}
};
/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
( function() {
var classAnimationActions = [ "add", "remove", "toggle" ],
shorthandStyles = {
border: 1,
borderBottom: 1,
borderColor: 1,
borderLeft: 1,
borderRight: 1,
borderTop: 1,
borderWidth: 1,
margin: 1,
padding: 1
};
$.each(
[ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
function( _, prop ) {
$.fx.step[ prop ] = function( fx ) {
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
jQuery.style( fx.elem, prop, fx.end );
fx.setAttr = true;
}
};
}
);
function camelCase( string ) {
return string.replace( /-([\da-z])/gi, function( all, letter ) {
return letter.toUpperCase();
} );
}
function getElementStyles( elem ) {
var key, len,
style = elem.ownerDocument.defaultView ?
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
elem.currentStyle,
styles = {};
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
len = style.length;
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
styles[ camelCase( key ) ] = style[ key ];
}
}
// Support: Opera, IE <9
} else {
for ( key in style ) {
if ( typeof style[ key ] === "string" ) {
styles[ key ] = style[ key ];
}
}
}
return styles;
}
function styleDifference( oldStyle, newStyle ) {
var diff = {},
name, value;
for ( name in newStyle ) {
value = newStyle[ name ];
if ( oldStyle[ name ] !== value ) {
if ( !shorthandStyles[ name ] ) {
if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
diff[ name ] = value;
}
}
}
}
return diff;
}
// Support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
$.effects.animateClass = function( value, duration, easing, callback ) {
var o = $.speed( duration, easing, callback );
return this.queue( function() {
var animated = $( this ),
baseClass = animated.attr( "class" ) || "",
applyClassChange,
allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
// Map the animated objects to store the original styles.
allAnimations = allAnimations.map( function() {
var el = $( this );
return {
el: el,
start: getElementStyles( this )
};
} );
// Apply class change
applyClassChange = function() {
$.each( classAnimationActions, function( i, action ) {
if ( value[ action ] ) {
animated[ action + "Class" ]( value[ action ] );
}
} );
};
applyClassChange();
// Map all animated objects again - calculate new styles and diff
allAnimations = allAnimations.map( function() {
this.end = getElementStyles( this.el[ 0 ] );
this.diff = styleDifference( this.start, this.end );
return this;
} );
// Apply original class
animated.attr( "class", baseClass );
// Map all animated objects again - this time collecting a promise
allAnimations = allAnimations.map( function() {
var styleInfo = this,
dfd = $.Deferred(),
opts = $.extend( {}, o, {
queue: false,
complete: function() {
dfd.resolve( styleInfo );
}
} );
this.el.animate( this.diff, opts );
return dfd.promise();
} );
// Once all animations have completed:
$.when.apply( $, allAnimations.get() ).done( function() {
// Set the final class
applyClassChange();
// For each animated element,
// clear all css properties that were animated
$.each( arguments, function() {
var el = this.el;
$.each( this.diff, function( key ) {
el.css( key, "" );
} );
} );
// This is guarnteed to be there if you use jQuery.speed()
// it also handles dequeuing the next anim...
o.complete.call( animated[ 0 ] );
} );
} );
};
$.fn.extend( {
addClass: ( function( orig ) {
return function( classNames, speed, easing, callback ) {
return speed ?
$.effects.animateClass.call( this,
{ add: classNames }, speed, easing, callback ) :
orig.apply( this, arguments );
};
} )( $.fn.addClass ),
removeClass: ( function( orig ) {
return function( classNames, speed, easing, callback ) {
return arguments.length > 1 ?
$.effects.animateClass.call( this,
{ remove: classNames }, speed, easing, callback ) :
orig.apply( this, arguments );
};
} )( $.fn.removeClass ),
toggleClass: ( function( orig ) {
return function( classNames, force, speed, easing, callback ) {
if ( typeof force === "boolean" || force === undefined ) {
if ( !speed ) {
// Without speed parameter
return orig.apply( this, arguments );
} else {
return $.effects.animateClass.call( this,
( force ? { add: classNames } : { remove: classNames } ),
speed, easing, callback );
}
} else {
// Without force parameter
return $.effects.animateClass.call( this,
{ toggle: classNames }, force, speed, easing );
}
};
} )( $.fn.toggleClass ),
switchClass: function( remove, add, speed, easing, callback ) {
return $.effects.animateClass.call( this, {
add: add,
remove: remove
}, speed, easing, callback );
}
} );
} )();
/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
( function() {
if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
$.expr.pseudos.animated = ( function( orig ) {
return function( elem ) {
return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
};
} )( $.expr.pseudos.animated );
}
if ( $.uiBackCompat !== false ) {
$.extend( $.effects, {
// Saves a set of properties in a data storage
save: function( element, set ) {
var i = 0, length = set.length;
for ( ; i < length; i++ ) {
if ( set[ i ] !== null ) {
element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
}
}
},
// Restores a set of previously saved properties from a data storage
restore: function( element, set ) {
var val, i = 0, length = set.length;
for ( ; i < length; i++ ) {
if ( set[ i ] !== null ) {
val = element.data( dataSpace + set[ i ] );
element.css( set[ i ], val );
}
}
},
setMode: function( el, mode ) {
if ( mode === "toggle" ) {
mode = el.is( ":hidden" ) ? "show" : "hide";
}
return mode;
},
// Wraps the element around a wrapper that copies position properties
createWrapper: function( element ) {
// If the element is already wrapped, return it
if ( element.parent().is( ".ui-effects-wrapper" ) ) {
return element.parent();
}
// Wrap the element
var props = {
width: element.outerWidth( true ),
height: element.outerHeight( true ),
"float": element.css( "float" )
},
wrapper = $( "<div></div>" )
.addClass( "ui-effects-wrapper" )
.css( {
fontSize: "100%",
background: "transparent",
border: "none",
margin: 0,
padding: 0
} ),
// Store the size in case width/height are defined in % - Fixes #5245
size = {
width: element.width(),
height: element.height()
},
active = document.activeElement;
// Support: Firefox
// Firefox incorrectly exposes anonymous content
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try {
// eslint-disable-next-line no-unused-expressions
active.id;
} catch ( e ) {
active = document.body;
}
element.wrap( wrapper );
// Fixes #7595 - Elements lose focus when wrapped.
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
$( active ).trigger( "focus" );
}
// Hotfix for jQuery 1.4 since some change in wrap() seems to actually
// lose the reference to the wrapped element
wrapper = element.parent();
// Transfer positioning properties to the wrapper
if ( element.css( "position" ) === "static" ) {
wrapper.css( { position: "relative" } );
element.css( { position: "relative" } );
} else {
$.extend( props, {
position: element.css( "position" ),
zIndex: element.css( "z-index" )
} );
$.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
props[ pos ] = element.css( pos );
if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
props[ pos ] = "auto";
}
} );
element.css( {
position: "relative",
top: 0,
left: 0,
right: "auto",
bottom: "auto"
} );
}
element.css( size );
return wrapper.css( props ).show();
},
removeWrapper: function( element ) {
var active = document.activeElement;
if ( element.parent().is( ".ui-effects-wrapper" ) ) {
element.parent().replaceWith( element );
// Fixes #7595 - Elements lose focus when wrapped.
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
$( active ).trigger( "focus" );
}
}
return element;
}
} );
}
$.extend( $.effects, {
version: "1.13.1",
define: function( name, mode, effect ) {
if ( !effect ) {
effect = mode;
mode = "effect";
}
$.effects.effect[ name ] = effect;
$.effects.effect[ name ].mode = mode;
return effect;
},
scaledDimensions: function( element, percent, direction ) {
if ( percent === 0 ) {
return {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
};
}
var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
return {
height: element.height() * y,
width: element.width() * x,
outerHeight: element.outerHeight() * y,
outerWidth: element.outerWidth() * x
};
},
clipToBox: function( animation ) {
return {
width: animation.clip.right - animation.clip.left,
height: animation.clip.bottom - animation.clip.top,
left: animation.clip.left,
top: animation.clip.top
};
},
// Injects recently queued functions to be first in line (after "inprogress")
unshift: function( element, queueLength, count ) {
var queue = element.queue();
if ( queueLength > 1 ) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
}
element.dequeue();
},
saveStyle: function( element ) {
element.data( dataSpaceStyle, element[ 0 ].style.cssText );
},
restoreStyle: function( element ) {
element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
element.removeData( dataSpaceStyle );
},
mode: function( element, mode ) {
var hidden = element.is( ":hidden" );
if ( mode === "toggle" ) {
mode = hidden ? "show" : "hide";
}
if ( hidden ? mode === "hide" : mode === "show" ) {
mode = "none";
}
return mode;
},
// Translates a [top,left] array into a baseline value
getBaseline: function( origin, original ) {
var y, x;
switch ( origin[ 0 ] ) {
case "top":
y = 0;
break;
case "middle":
y = 0.5;
break;
case "bottom":
y = 1;
break;
default:
y = origin[ 0 ] / original.height;
}
switch ( origin[ 1 ] ) {
case "left":
x = 0;
break;
case "center":
x = 0.5;
break;
case "right":
x = 1;
break;
default:
x = origin[ 1 ] / original.width;
}
return {
x: x,
y: y
};
},
// Creates a placeholder element so that the original element can be made absolute
createPlaceholder: function( element ) {
var placeholder,
cssPosition = element.css( "position" ),
position = element.position();
// Lock in margins first to account for form elements, which
// will change margin if you explicitly set height
// see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
// Support: Safari
element.css( {
marginTop: element.css( "marginTop" ),
marginBottom: element.css( "marginBottom" ),
marginLeft: element.css( "marginLeft" ),
marginRight: element.css( "marginRight" )
} )
.outerWidth( element.outerWidth() )
.outerHeight( element.outerHeight() );
if ( /^(static|relative)/.test( cssPosition ) ) {
cssPosition = "absolute";
placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
// Convert inline to inline block to account for inline elements
// that turn to inline block based on content (like img)
display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
"inline-block" :
"block",
visibility: "hidden",
// Margins need to be set to account for margin collapse
marginTop: element.css( "marginTop" ),
marginBottom: element.css( "marginBottom" ),
marginLeft: element.css( "marginLeft" ),
marginRight: element.css( "marginRight" ),
"float": element.css( "float" )
} )
.outerWidth( element.outerWidth() )
.outerHeight( element.outerHeight() )
.addClass( "ui-effects-placeholder" );
element.data( dataSpace + "placeholder", placeholder );
}
element.css( {
position: cssPosition,
left: position.left,
top: position.top
} );
return placeholder;
},
removePlaceholder: function( element ) {
var dataKey = dataSpace + "placeholder",
placeholder = element.data( dataKey );
if ( placeholder ) {
placeholder.remove();
element.removeData( dataKey );
}
},
// Removes a placeholder if it exists and restores
// properties that were modified during placeholder creation
cleanUp: function( element ) {
$.effects.restoreStyle( element );
$.effects.removePlaceholder( element );
},
setTransition: function( element, list, factor, value ) {
value = value || {};
$.each( list, function( i, x ) {
var unit = element.cssUnit( x );
if ( unit[ 0 ] > 0 ) {
value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
}
} );
return value;
}
} );
// Return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {
// Allow passing all options as the first parameter
if ( $.isPlainObject( effect ) ) {
options = effect;
effect = effect.effect;
}
// Convert to an object
effect = { effect: effect };
// Catch (effect, null, ...)
if ( options == null ) {
options = {};
}
// Catch (effect, callback)
if ( typeof options === "function" ) {
callback = options;
speed = null;
options = {};
}
// Catch (effect, speed, ?)
if ( typeof options === "number" || $.fx.speeds[ options ] ) {
callback = speed;
speed = options;
options = {};
}
// Catch (effect, options, callback)
if ( typeof speed === "function" ) {
callback = speed;
speed = null;
}
// Add options to effect
if ( options ) {
$.extend( effect, options );
}
speed = speed || options.duration;
effect.duration = $.fx.off ? 0 :
typeof speed === "number" ? speed :
speed in $.fx.speeds ? $.fx.speeds[ speed ] :
$.fx.speeds._default;
effect.complete = callback || options.complete;
return effect;
}
function standardAnimationOption( option ) {
// Valid standard speeds (nothing, number, named speed)
if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
return true;
}
// Invalid strings - treat as "normal" speed
if ( typeof option === "string" && !$.effects.effect[ option ] ) {
return true;
}
// Complete callback
if ( typeof option === "function" ) {
return true;
}
// Options hash (but not naming an effect)
if ( typeof option === "object" && !option.effect ) {
return true;
}
// Didn't match any standard API
return false;
}
$.fn.extend( {
effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ),
effectMethod = $.effects.effect[ args.effect ],
defaultMode = effectMethod.mode,
queue = args.queue,
queueName = queue || "fx",
complete = args.complete,
mode = args.mode,
modes = [],
prefilter = function( next ) {
var el = $( this ),
normalizedMode = $.effects.mode( el, mode ) || defaultMode;
// Sentinel for duck-punching the :animated pseudo-selector
el.data( dataSpaceAnimated, true );
// Save effect mode for later use,
// we can't just call $.effects.mode again later,
// as the .show() below destroys the initial state
modes.push( normalizedMode );
// See $.uiBackCompat inside of run() for removal of defaultMode in 1.14
if ( defaultMode && ( normalizedMode === "show" ||
( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
el.show();
}
if ( !defaultMode || normalizedMode !== "none" ) {
$.effects.saveStyle( el );
}
if ( typeof next === "function" ) {
next();
}
};
if ( $.fx.off || !effectMethod ) {
// Delegate to the original method (e.g., .show()) if possible
if ( mode ) {
return this[ mode ]( args.duration, complete );
} else {
return this.each( function() {
if ( complete ) {
complete.call( this );
}
} );
}
}
function run( next ) {
var elem = $( this );
function cleanup() {
elem.removeData( dataSpaceAnimated );
$.effects.cleanUp( elem );
if ( args.mode === "hide" ) {
elem.hide();
}
done();
}
function done() {
if ( typeof complete === "function" ) {
complete.call( elem[ 0 ] );
}
if ( typeof next === "function" ) {
next();
}
}
// Override mode option on a per element basis,
// as toggle can be either show or hide depending on element state
args.mode = modes.shift();
if ( $.uiBackCompat !== false && !defaultMode ) {
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
// Call the core method to track "olddisplay" properly
elem[ mode ]();
done();
} else {
effectMethod.call( elem[ 0 ], args, done );
}
} else {
if ( args.mode === "none" ) {
// Call the core method to track "olddisplay" properly
elem[ mode ]();
done();
} else {
effectMethod.call( elem[ 0 ], args, cleanup );
}
}
}
// Run prefilter on all elements first to ensure that
// any showing or hiding happens before placeholder creation,
// which ensures that any layout changes are correctly captured.
return queue === false ?
this.each( prefilter ).each( run ) :
this.queue( queueName, prefilter ).queue( queueName, run );
},
show: ( function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "show";
return this.effect.call( this, args );
}
};
} )( $.fn.show ),
hide: ( function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "hide";
return this.effect.call( this, args );
}
};
} )( $.fn.hide ),
toggle: ( function( orig ) {
return function( option ) {
if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
return orig.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = "toggle";
return this.effect.call( this, args );
}
};
} )( $.fn.toggle ),
cssUnit: function( key ) {
var style = this.css( key ),
val = [];
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
if ( style.indexOf( unit ) > 0 ) {
val = [ parseFloat( style ), unit ];
}
} );
return val;
},
cssClip: function( clipObj ) {
if ( clipObj ) {
return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
clipObj.bottom + "px " + clipObj.left + "px)" );
}
return parseClip( this.css( "clip" ), this );
},
transfer: function( options, done ) {
var element = $( this ),
target = $( options.to ),
targetFixed = target.css( "position" ) === "fixed",
body = $( "body" ),
fixTop = targetFixed ? body.scrollTop() : 0,
fixLeft = targetFixed ? body.scrollLeft() : 0,
endPosition = target.offset(),
animation = {
top: endPosition.top - fixTop,
left: endPosition.left - fixLeft,
height: target.innerHeight(),
width: target.innerWidth()
},
startPosition = element.offset(),
transfer = $( "<div class='ui-effects-transfer'></div>" );
transfer
.appendTo( "body" )
.addClass( options.className )
.css( {
top: startPosition.top - fixTop,
left: startPosition.left - fixLeft,
height: element.innerHeight(),
width: element.innerWidth(),
position: targetFixed ? "fixed" : "absolute"
} )
.animate( animation, options.duration, options.easing, function() {
transfer.remove();
if ( typeof done === "function" ) {
done();
}
} );
}
} );
function parseClip( str, element ) {
var outerWidth = element.outerWidth(),
outerHeight = element.outerHeight(),
clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
return {
top: parseFloat( values[ 1 ] ) || 0,
right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
left: parseFloat( values[ 4 ] ) || 0
};
}
$.fx.step.clip = function( fx ) {
if ( !fx.clipInit ) {
fx.start = $( fx.elem ).cssClip();
if ( typeof fx.end === "string" ) {
fx.end = parseClip( fx.end, fx.elem );
}
fx.clipInit = true;
}
$( fx.elem ).cssClip( {
top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
} );
};
} )();
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
( function() {
// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings = {};
$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
baseEasings[ name ] = function( p ) {
return Math.pow( p, i + 2 );
};
} );
$.extend( baseEasings, {
Sine: function( p ) {
return 1 - Math.cos( p * Math.PI / 2 );
},
Circ: function( p ) {
return 1 - Math.sqrt( 1 - p * p );
},
Elastic: function( p ) {
return p === 0 || p === 1 ? p :
-Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
},
Back: function( p ) {
return p * p * ( 3 * p - 2 );
},
Bounce: function( p ) {
var pow2,
bounce = 4;
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
}
} );
$.each( baseEasings, function( name, easeIn ) {
$.easing[ "easeIn" + name ] = easeIn;
$.easing[ "easeOut" + name ] = function( p ) {
return 1 - easeIn( 1 - p );
};
$.easing[ "easeInOut" + name ] = function( p ) {
return p < 0.5 ?
easeIn( p * 2 ) / 2 :
1 - easeIn( p * -2 + 2 ) / 2;
};
} );
} )();
var effect = $.effects;
/*!
* jQuery UI Effects Blind 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Blind Effect
//>>group: Effects
//>>description: Blinds the element.
//>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
var map = {
up: [ "bottom", "top" ],
vertical: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
horizontal: [ "right", "left" ],
right: [ "left", "right" ]
},
element = $( this ),
direction = options.direction || "up",
start = element.cssClip(),
animate = { clip: $.extend( {}, start ) },
placeholder = $.effects.createPlaceholder( element );
animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
if ( options.mode === "show" ) {
element.cssClip( animate.clip );
if ( placeholder ) {
placeholder.css( $.effects.clipToBox( animate ) );
}
animate.clip = start;
}
if ( placeholder ) {
placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
}
element.animate( animate, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Bounce 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Bounce Effect
//>>group: Effects
//>>description: Bounces an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/bounce-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
var upAnim, downAnim, refValue,
element = $( this ),
// Defaults:
mode = options.mode,
hide = mode === "hide",
show = mode === "show",
direction = options.direction || "up",
distance = options.distance,
times = options.times || 5,
// Number of internal animations
anims = times * 2 + ( show || hide ? 1 : 0 ),
speed = options.duration / anims,
easing = options.easing,
// Utility:
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ),
i = 0,
queuelen = element.queue().length;
$.effects.createPlaceholder( element );
refValue = element.css( ref );
// Default distance for the BIGGEST bounce is the outer Distance / 3
if ( !distance ) {
distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
}
if ( show ) {
downAnim = { opacity: 1 };
downAnim[ ref ] = refValue;
// If we are showing, force opacity 0 and set the initial position
// then do the "first" animation
element
.css( "opacity", 0 )
.css( ref, motion ? -distance * 2 : distance * 2 )
.animate( downAnim, speed, easing );
}
// Start at the smallest distance if we are hiding
if ( hide ) {
distance = distance / Math.pow( 2, times - 1 );
}
downAnim = {};
downAnim[ ref ] = refValue;
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
for ( ; i < times; i++ ) {
upAnim = {};
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
element
.animate( upAnim, speed, easing )
.animate( downAnim, speed, easing );
distance = hide ? distance * 2 : distance / 2;
}
// Last Bounce when Hiding
if ( hide ) {
upAnim = { opacity: 0 };
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
element.animate( upAnim, speed, easing );
}
element.queue( done );
$.effects.unshift( element, queuelen, anims + 1 );
} );
/*!
* jQuery UI Effects Clip 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Clip Effect
//>>group: Effects
//>>description: Clips the element on and off like an old TV.
//>>docs: http://api.jqueryui.com/clip-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
var start,
animate = {},
element = $( this ),
direction = options.direction || "vertical",
both = direction === "both",
horizontal = both || direction === "horizontal",
vertical = both || direction === "vertical";
start = element.cssClip();
animate.clip = {
top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
right: horizontal ? ( start.right - start.left ) / 2 : start.right,
bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
left: horizontal ? ( start.right - start.left ) / 2 : start.left
};
$.effects.createPlaceholder( element );
if ( options.mode === "show" ) {
element.cssClip( animate.clip );
animate.clip = start;
}
element.animate( animate, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Drop 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Drop Effect
//>>group: Effects
//>>description: Moves an element in one direction and hides it at the same time.
//>>docs: http://api.jqueryui.com/drop-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {
var distance,
element = $( this ),
mode = options.mode,
show = mode === "show",
direction = options.direction || "left",
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
animation = {
opacity: 0
};
$.effects.createPlaceholder( element );
distance = options.distance ||
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
animation[ ref ] = motion + distance;
if ( show ) {
element.css( animation );
animation[ ref ] = oppositeMotion + distance;
animation.opacity = 1;
}
// Animate
element.animate( animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Explode 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Explode Effect
//>>group: Effects
/* eslint-disable max-len */
//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/explode-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {
var i, j, left, top, mx, my,
rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
cells = rows,
element = $( this ),
mode = options.mode,
show = mode === "show",
// Show and then visibility:hidden the element before calculating offset
offset = element.show().css( "visibility", "hidden" ).offset(),
// Width and height of a piece
width = Math.ceil( element.outerWidth() / cells ),
height = Math.ceil( element.outerHeight() / rows ),
pieces = [];
// Children animate complete:
function childComplete() {
pieces.push( this );
if ( pieces.length === rows * cells ) {
animComplete();
}
}
// Clone the element for each row and cell.
for ( i = 0; i < rows; i++ ) { // ===>
top = offset.top + i * height;
my = i - ( rows - 1 ) / 2;
for ( j = 0; j < cells; j++ ) { // |||
left = offset.left + j * width;
mx = j - ( cells - 1 ) / 2;
// Create a clone of the now hidden main element that will be absolute positioned
// within a wrapper div off the -left and -top equal to size of our pieces
element
.clone()
.appendTo( "body" )
.wrap( "<div></div>" )
.css( {
position: "absolute",
visibility: "visible",
left: -j * width,
top: -i * height
} )
// Select the wrapper - make it overflow: hidden and absolute positioned based on
// where the original was located +left and +top equal to the size of pieces
.parent()
.addClass( "ui-effects-explode" )
.css( {
position: "absolute",
overflow: "hidden",
width: width,
height: height,
left: left + ( show ? mx * width : 0 ),
top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1
} )
.animate( {
left: left + ( show ? 0 : mx * width ),
top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0
}, options.duration || 500, options.easing, childComplete );
}
}
function animComplete() {
element.css( {
visibility: "visible"
} );
$( pieces ).remove();
done();
}
} );
/*!
* jQuery UI Effects Fade 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Fade Effect
//>>group: Effects
//>>description: Fades the element.
//>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
var show = options.mode === "show";
$( this )
.css( "opacity", show ? 0 : 1 )
.animate( {
opacity: show ? 1 : 0
}, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Fold 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Fold Effect
//>>group: Effects
//>>description: Folds an element first horizontally and then vertically.
//>>docs: http://api.jqueryui.com/fold-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {
// Create element
var element = $( this ),
mode = options.mode,
show = mode === "show",
hide = mode === "hide",
size = options.size || 15,
percent = /([0-9]+)%/.exec( size ),
horizFirst = !!options.horizFirst,
ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
duration = options.duration / 2,
placeholder = $.effects.createPlaceholder( element ),
start = element.cssClip(),
animation1 = { clip: $.extend( {}, start ) },
animation2 = { clip: $.extend( {}, start ) },
distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
queuelen = element.queue().length;
if ( percent ) {
size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
}
animation1.clip[ ref[ 0 ] ] = size;
animation2.clip[ ref[ 0 ] ] = size;
animation2.clip[ ref[ 1 ] ] = 0;
if ( show ) {
element.cssClip( animation2.clip );
if ( placeholder ) {
placeholder.css( $.effects.clipToBox( animation2 ) );
}
animation2.clip = start;
}
// Animate
element
.queue( function( next ) {
if ( placeholder ) {
placeholder
.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
}
next();
} )
.animate( animation1, duration, options.easing )
.animate( animation2, duration, options.easing )
.queue( done );
$.effects.unshift( element, queuelen, 4 );
} );
/*!
* jQuery UI Effects Highlight 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Highlight Effect
//>>group: Effects
//>>description: Highlights the background of an element in a defined color for a custom duration.
//>>docs: http://api.jqueryui.com/highlight-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
var element = $( this ),
animation = {
backgroundColor: element.css( "backgroundColor" )
};
if ( options.mode === "hide" ) {
animation.opacity = 0;
}
$.effects.saveStyle( element );
element
.css( {
backgroundImage: "none",
backgroundColor: options.color || "#ffff99"
} )
.animate( animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Size 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Size Effect
//>>group: Effects
//>>description: Resize an element to a specified width and height.
//>>docs: http://api.jqueryui.com/size-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectSize = $.effects.define( "size", function( options, done ) {
// Create element
var baseline, factor, temp,
element = $( this ),
// Copy for children
cProps = [ "fontSize" ],
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
// Set options
mode = options.mode,
restore = mode !== "effect",
scale = options.scale || "both",
origin = options.origin || [ "middle", "center" ],
position = element.css( "position" ),
pos = element.position(),
original = $.effects.scaledDimensions( element ),
from = options.from || original,
to = options.to || $.effects.scaledDimensions( element, 0 );
$.effects.createPlaceholder( element );
if ( mode === "show" ) {
temp = from;
from = to;
to = temp;
}
// Set scaling factor
factor = {
from: {
y: from.height / original.height,
x: from.width / original.width
},
to: {
y: to.height / original.height,
x: to.width / original.width
}
};
// Scale the css box
if ( scale === "box" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
from = $.effects.setTransition( element, vProps, factor.from.y, from );
to = $.effects.setTransition( element, vProps, factor.to.y, to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
from = $.effects.setTransition( element, hProps, factor.from.x, from );
to = $.effects.setTransition( element, hProps, factor.to.x, to );
}
}
// Scale the content
if ( scale === "content" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
from = $.effects.setTransition( element, cProps, factor.from.y, from );
to = $.effects.setTransition( element, cProps, factor.to.y, to );
}
}
// Adjust the position properties based on the provided origin points
if ( origin ) {
baseline = $.effects.getBaseline( origin, original );
from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
}
delete from.outerHeight;
delete from.outerWidth;
element.css( from );
// Animate the children if desired
if ( scale === "content" || scale === "both" ) {
vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
// Only animate children with width attributes specified
// TODO: is this right? should we include anything with css width specified as well
element.find( "*[width]" ).each( function() {
var child = $( this ),
childOriginal = $.effects.scaledDimensions( child ),
childFrom = {
height: childOriginal.height * factor.from.y,
width: childOriginal.width * factor.from.x,
outerHeight: childOriginal.outerHeight * factor.from.y,
outerWidth: childOriginal.outerWidth * factor.from.x
},
childTo = {
height: childOriginal.height * factor.to.y,
width: childOriginal.width * factor.to.x,
outerHeight: childOriginal.height * factor.to.y,
outerWidth: childOriginal.width * factor.to.x
};
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
}
if ( restore ) {
$.effects.saveStyle( child );
}
// Animate children
child.css( childFrom );
child.animate( childTo, options.duration, options.easing, function() {
// Restore children
if ( restore ) {
$.effects.restoreStyle( child );
}
} );
} );
}
// Animate
element.animate( to, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: function() {
var offset = element.offset();
if ( to.opacity === 0 ) {
element.css( "opacity", from.opacity );
}
if ( !restore ) {
element
.css( "position", position === "static" ? "relative" : position )
.offset( offset );
// Need to save style here so that automatic style restoration
// doesn't restore to the original styles from before the animation.
$.effects.saveStyle( element );
}
done();
}
} );
} );
/*!
* jQuery UI Effects Scale 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Scale Effect
//>>group: Effects
//>>description: Grows or shrinks an element and its content.
//>>docs: http://api.jqueryui.com/scale-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
// Create element
var el = $( this ),
mode = options.mode,
percent = parseInt( options.percent, 10 ) ||
( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
newOptions = $.extend( true, {
from: $.effects.scaledDimensions( el ),
to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
origin: options.origin || [ "middle", "center" ]
}, options );
// Fade option to support puff
if ( options.fade ) {
newOptions.from.opacity = 1;
newOptions.to.opacity = 0;
}
$.effects.effect.size.call( this, newOptions, done );
} );
/*!
* jQuery UI Effects Puff 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Puff Effect
//>>group: Effects
//>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
//>>docs: http://api.jqueryui.com/puff-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
var newOptions = $.extend( true, {}, options, {
fade: true,
percent: parseInt( options.percent, 10 ) || 150
} );
$.effects.effect.scale.call( this, newOptions, done );
} );
/*!
* jQuery UI Effects Pulsate 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Pulsate Effect
//>>group: Effects
//>>description: Pulsates an element n times by changing the opacity to zero and back.
//>>docs: http://api.jqueryui.com/pulsate-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
var element = $( this ),
mode = options.mode,
show = mode === "show",
hide = mode === "hide",
showhide = show || hide,
// Showing or hiding leaves off the "last" animation
anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = options.duration / anims,
animateTo = 0,
i = 1,
queuelen = element.queue().length;
if ( show || !element.is( ":visible" ) ) {
element.css( "opacity", 0 ).show();
animateTo = 1;
}
// Anims - 1 opacity "toggles"
for ( ; i < anims; i++ ) {
element.animate( { opacity: animateTo }, duration, options.easing );
animateTo = 1 - animateTo;
}
element.animate( { opacity: animateTo }, duration, options.easing );
element.queue( done );
$.effects.unshift( element, queuelen, anims + 1 );
} );
/*!
* jQuery UI Effects Shake 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Shake Effect
//>>group: Effects
//>>description: Shakes an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/shake-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
var i = 1,
element = $( this ),
direction = options.direction || "left",
distance = options.distance || 20,
times = options.times || 3,
anims = times * 2 + 1,
speed = Math.round( options.duration / anims ),
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
positiveMotion = ( direction === "up" || direction === "left" ),
animation = {},
animation1 = {},
animation2 = {},
queuelen = element.queue().length;
$.effects.createPlaceholder( element );
// Animation
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
// Animate
element.animate( animation, speed, options.easing );
// Shakes
for ( ; i < times; i++ ) {
element
.animate( animation1, speed, options.easing )
.animate( animation2, speed, options.easing );
}
element
.animate( animation1, speed, options.easing )
.animate( animation, speed / 2, options.easing )
.queue( done );
$.effects.unshift( element, queuelen, anims + 1 );
} );
/*!
* jQuery UI Effects Slide 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Slide Effect
//>>group: Effects
//>>description: Slides an element in and out of the viewport.
//>>docs: http://api.jqueryui.com/slide-effect/
//>>demos: http://jqueryui.com/effect/
var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
var startClip, startRef,
element = $( this ),
map = {
up: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
right: [ "left", "right" ]
},
mode = options.mode,
direction = options.direction || "left",
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
positiveMotion = ( direction === "up" || direction === "left" ),
distance = options.distance ||
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
animation = {};
$.effects.createPlaceholder( element );
startClip = element.cssClip();
startRef = element.position()[ ref ];
// Define hide animation
animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
animation.clip = element.cssClip();
animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
// Reverse the animation if we're showing
if ( mode === "show" ) {
element.cssClip( animation.clip );
element.css( ref, animation[ ref ] );
animation.clip = startClip;
animation[ ref ] = startRef;
}
// Actually animate
element.animate( animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
/*!
* jQuery UI Effects Transfer 1.13.1
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Transfer Effect
//>>group: Effects
//>>description: Displays a transfer effect from one element to another.
//>>docs: http://api.jqueryui.com/transfer-effect/
//>>demos: http://jqueryui.com/effect/
var effect;
if ( $.uiBackCompat !== false ) {
effect = $.effects.define( "transfer", function( options, done ) {
$( this ).transfer( options, done );
} );
}
var effectsEffectTransfer = effect;
} );
|
//This is the "Offline page" service worker
//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
if (navigator.serviceWorker.controller) {
console.log('[PWA Builder] active service worker found, no need to register')
} else {
//Register the ServiceWorker
navigator.serviceWorker.register('pwabuider-sw.js', {
scope: './'
}).then(function(reg) {
console.log('Service worker has been registered for scope:'+ reg.scope);
});
}
|
/**
* 获取推荐商品信息
* Created by fuhuixiang on 16/5/31.
*/
'use strict';
let Mock = require('mockjs');
let Random = Mock.Random;
module.exports = (req, res)=> {
let gids = req.query.gids;
let resArray = {};
let goodArray = [];
if (!!gids) {
gids = gids.split('_');
gids.forEach((v, index)=> {
let resTemp = {};
resTemp.gid = v;
resTemp.sid = Mock.mock({"number|1-10000000": 100}).number;
resTemp.title = Mock.mock('@csentence(20)');
resTemp.description = Mock.mock('@csentence(30)');
resTemp.period = Mock.mock({"number|1-10000000": 100}).number;
resTemp.icon = Random.image('200x200');
resTemp.total = Mock.mock({"number|1-1000": 100}).number;
resTemp.remain = Mock.mock({"number|1-1000": 100}).number;
goodArray.push(resTemp);
});
resArray.c = 0;
resArray.d = goodArray;
} else {
for (let i=0;i<10;i++){
goodArray.push({
'gid': Mock.mock({"number|1-1000": 100}).number,
'sid': Mock.mock({"number|1-10000000": 100}).number,
'title': Mock.mock('@csentence(20)'),
'description': Mock.mock('@csentence(30)'),
'period': Mock.mock({"number|1-10000000": 100}).number,
'icon': Random.image('200x200', '#4A7BF7'),
'total': Mock.mock({"number|1-1000": 100}).number,
'remain': Mock.mock({"number|1-1000": 100}).number
});
}
resArray.c = 0;
resArray.d = goodArray;
}
res.jsonp(resArray);
};
|
'use strict'
const { nop, wrap } = require('./setup')
describe('Arguments and result checking', function () {
it('should throw if object to be wrapped is not a function', function () {
(() => wrap.the('shit')).should.throw(TypeError)
})
it('should throw if pre-hook is not a function', function () {
(() => wrap(nop).withPreHook('hey')).should.throw(TypeError)
})
it('should throw if post-hook is not a function', function () {
(() => wrap(nop).withPostHook('ho')).should.throw(TypeError)
})
it('should throw if custom hook is not a function', function () {
(() => wrap(nop).withCustomHook("let's go")).should.throw(TypeError)
})
it('should return a function', function () {
wrap.the(nop).should.be.a('function')
})
it('should return a different function', function () {
wrap.the(nop).should.not.equal(nop)
})
})
|
import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import { useParams } from 'react-router-dom';
import SiteTitle from '../../components/SiteTitle';
import UsernameForm from '../../components/UsernameForm';
import PullRequests from './components/PullRequests';
import UserShare from './components/PullRequests/UserShare';
const User = () => {
let { username } = useParams();
return (
<>
<Helmet>
<title>{username}</title>
</Helmet>
<SiteTitle />
<UsernameForm username={username} />
<PullRequests username={username} />
<UserShare />
</>
);
};
User.propTypes = {
username: PropTypes.string,
};
export default User;
|
import { mount } from '@vue/test-utils';
import Tab from '@/components/base/Tab.vue';
describe('Tab', () => {
it('renders', () => {
const wrapper = mount(Tab, {
propsData: {
},
});
expect(wrapper.element).toMatchSnapshot();
});
});
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchPosts } from '../actions/index';
// necessary when we use a link anchor inside code
import { Link } from 'react-router';
class PostsIndex extends Component {
// method that is call whenever component is rendered by react
componentWillMount() {
this.props.fetchPosts();
}
renderPosts() {
return this.props.posts.map((post) => {
return (
<li className="list-group-item" key={post.id}>
<Link to={"posts/" + post.id}>
<span className="float-xs-right">
{post.categories}
</span>
<strong>{post.title}</strong>
</Link>
</li>
);
});
}
render() {
return (
<div>
<div className="text-xs-right">
<Link to="/posts/new" className="btn btn-primary">
Add a post
</Link>
</div>
<h3>Posts</h3>
<ul className="list-group">
{this.renderPosts()}
</ul>
</div>
);
}
}
function mapStateToProps(state) {
return { posts: state.posts.all };
}
// function mapDispatchToProps(dispatch) {
// return bindActionCreators({ fetchPosts }, dispatch);
// }
// export default connect(null, mapDispatchToProps)(PostsIndex);
/* REFACTORING */
//export default connect(null, { fetchPosts: fetchPosts})(PostsIndex);
/* IE6 refactoring variable (condensed) */
export default connect(mapStateToProps, { fetchPosts })(PostsIndex);
|
const { MessageEmbed } = require('discord.js');
const { embedMessage } = require('../../utils');
module.exports = {
name: 'report',
aliases: ['r', 'report'],
cooldown: 3,
usage: 'report [bug or issue]',
examples: ["report when I use the mute command it doesn't work"],
description: 'Send a report to the developer.',
async execute(message, prefix, args) {
const messageEmbed = embedMessage(message);
if (args.length === 0) {
messageEmbed.setDescription(
`> Please write the bug or the issue e.g. \`${prefix}report [bug or issue]\`.\n⠀`,
);
} else {
const channel = message.client.guilds.cache
.get(process.env.SUPPORT_GUILD_ID)
.channels.cache.get(process.env.BUGS_ISSUES_CHANNEL_ID);
const suggestionEmbed = new MessageEmbed()
.setColor('#d32f2f')
.setAuthor(
`${message.member.nickname} reports : `,
message.author.avatarURL(),
)
.setDescription(`> ${args.join` `}\n⠀`)
.addField('👤 User', `\`${message.author.username}\``, true)
.addField('🆔 User ID', `\`${message.author.id}\``, true)
.addField('🏠 Guild', `\`${message.guild.name}\``, true)
.addField('🆔 Guild ID', `\`${message.guild.id}\`\n⠀`, true)
.setTimestamp();
channel.send(suggestionEmbed);
messageEmbed.setDescription('> Thanks for the report.\n⠀');
}
return message.channel.send(messageEmbed);
},
};
|
(() => {
// resources/js/app.js
window.addEventListener("load", function() {
let main_navigation = document.querySelector("#mobile-menu");
document.querySelector(".mobile-menu-toggle").addEventListener("click", function(e) {
e.preventDefault();
main_navigation.classList.toggle("hidden");
});
});
})();
|
/**
* Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* @file src/doc_client.js
* @author guofan
*/
/* eslint-env node */
/* eslint max-params:[0,10] */
/* eslint fecs-camelcase:[2,{"ignore":["/opt_/"]}] */
var fs = require('fs');
var path = require('path');
var util = require('util');
var builtinUrl = require('url');
var Q = require('q');
var u = require('underscore');
var debug = require('debug')('bce-sdk:Document');
var BosClient = require('./bos_client');
var BceBaseClient = require('./bce_base_client');
var UploadHelper = require('./helper');
var crypto = require('./crypto');
var DATA_TYPE_FILE = 1;
var DATA_TYPE_BUFFER = 2;
var DATA_TYPE_BLOB = 4;
/**
* 文档转码任务接口(Job/Transcoding API)
* http://bce.baidu.com/doc/DOC/API.html#.1D.1E.B0.1E.6C.74.0C.6D.C1.68.D2.57.6F.70.EA.F1
*
* @constructor
* @param {Object} config The doc client configuration.
* @extends {BceBaseClient}
*/
function Document(config) {
BceBaseClient.call(this, config, 'doc', false);
this._documentId = null;
}
util.inherits(Document, BceBaseClient);
// --- B E G I N ---
Document.prototype._buildUrl = function () {
var baseUrl = '/v2/document';
var extraPaths = u.toArray(arguments);
if (extraPaths.length) {
baseUrl += '/' + extraPaths.join('/');
}
return baseUrl;
};
Document.prototype.getId = function () {
return this._documentId;
};
Document.prototype.setId = function (documentId) {
this._documentId = documentId;
return this;
};
/**
* Create a document transfer job from local file, buffer, readable stream or blob.
*
* @param {Blob|Buffer|string} data The document data. If the data type
* is string, which means the file path.
* @param {Object=} opt_options The extra options.
* @return {Promise}
*/
Document.prototype.create = function (data, opt_options) {
var options = u.extend({}, opt_options);
var dataType = -1;
var pattern = /^bos:\/\//;
if (u.isString(data)) {
if (pattern.test(data)) {
// createFromBos
try {
var parsed = builtinUrl.parse(data);
var bucket = parsed.host;
var object = parsed.pathname.substr(1);
options = u.extend(options, parsed.query);
var title = options.title || path.basename(object);
var format = options.format || path.extname(object).substr(1);
var notification = options.notification;
return this.createFromBos(bucket, object,
title, format, notification);
}
catch (error) {
return Q.reject(error);
}
}
dataType = DATA_TYPE_FILE;
options.format = options.format || path.extname(data).substr(1);
options.title = options.title || path.basename(data, path.extname(data));
}
else if (Buffer.isBuffer(data)) {
if (options.format == null || options.title == null) {
return Q.reject(new Error('buffer type required options.format and options.title'));
}
dataType = DATA_TYPE_BUFFER;
}
else if (typeof Blob !== 'undefined' && data instanceof Blob) {
dataType = DATA_TYPE_BLOB;
options.format = options.format || path.extname(data.name).substr(1);
options.title = options.title || path.basename(data.name, path.extname(data.name));
}
else {
return Q.reject(new Error('Unsupported dataType.'));
}
if (!options.title || !options.format) {
return Q.reject(new Error('`title` and `format` are required.'));
}
if (options.meta.md5) {
return this._doCreate(data, options);
}
var self = this;
if (dataType === DATA_TYPE_FILE) {
return crypto.md5stream(fs.createReadStream(data), 'hex')
.then(function (md5) {
options.meta.md5 = md5;
return self._doCreate(data, options);
});
}
else if (dataType === DATA_TYPE_BLOB) {
return crypto.md5blob(data, 'hex')
.then(function (md5) {
options.meta.md5 = md5;
return self._doCreate(data, options);
});
}
return this._doCreate(data, options);
};
Document.prototype._doCreate = function (data, options) {
var documentId = null;
var bucket = null;
var object = null;
var bosEndpoint = null;
var self = this;
return self.register(options)
.then(function (response) {
debug('register[response = %j]', response);
documentId = response.body.documentId;
bucket = response.body.bucket;
object = response.body.object;
bosEndpoint = response.body.bosEndpoint;
var bosConfig = u.extend({}, self.config, {endpoint: bosEndpoint});
var bosClient = new BosClient(bosConfig);
return UploadHelper.upload(bosClient, bucket, object, data);
})
.then(function (response) {
debug('upload[response = %j]', response);
return self.publish();
})
.then(function (response) {
debug('publish[response = %j]', response);
response.body = {
documentId: documentId,
bucket: bucket,
object: object,
bosEndpoint: bosEndpoint
};
return response;
});
};
Document.prototype.register = function (options) {
debug('register[options = %j]', options);
var self = this;
var url = this._buildUrl();
return this.sendRequest('POST', url, {
params: {register: ''},
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(options)
}).then(function (response) {
self.setId(response.body.documentId);
return response;
});
};
Document.prototype.publish = function (documentId) {
var url = this._buildUrl(documentId || this._documentId);
return this.sendRequest('PUT', url, {
params: {publish: ''}
});
};
Document.prototype.get = function (documentId) {
var url = this._buildUrl(documentId || this._documentId);
return this.sendRequest('GET', url);
};
/**
* Get docId and token to render the document in the browser.
*
* ```html
* <div id="reader"></div>
* <script src="http://bce.bdstatic.com/doc/doc_reader.js"></script>
* <script>
* var host = location.host;
* var option = {
* docId: <docId>,
* token: <token>,
* host: <host>
* };
* new Document('reader', option);
* </script>
* ```
*
* @param {string} documentId The document Id.
* @return {Promise}
*/
Document.prototype.read = function (documentId) {
var url = this._buildUrl(documentId || this._documentId);
return this.sendRequest('GET', url, {
params: {read: ''}
});
};
/**
* 通过文档的唯一标识 documentId 获取指定文档的下载链接。仅对状态为PUBLISHED/FAILED的文档有效。
*
* @param {string=} documentId 需要下载的文档id
* @return {Promise.<{documentId: string, downloadUrl: string}, any>}
*/
Document.prototype.download = function (documentId) {
var url = this._buildUrl(documentId || this._documentId);
return this.sendRequest('GET', url, {
params: {download: ''}
});
};
/**
* Create document from bos object.
*
* 1. The BOS bucket must in bj-region.
* 2. The BOS bucket permission must be public-read.
*
* 用户需要将源文档所在BOS bucket权限设置为公共读,或者在自定义权限设置中为开放云文档转码服务账号
*(沙盒:798c20fa770840438a29efd66cdccf7f,线上:183db8cd3d5a4bf9a94459f89a7a3a91)添加READ权限。
*
* 文档转码服务依赖文档的md5,为提高转码性能,文档转码服务需要用户为源文档指定md5;
* 因此用户需要在上传文档至BOS时设置自定义meta header x-bce-meta-md5来记录源文档md5。
* 补充说明:实际上当用户没有为源文档设置x-bce-meta-md5 header时,文档转码服务还会
* 尝试根据BOS object ETag解析源文档md5,如果解析失败(ETag以'-'开头),才会真正报错。
*
* @param {string} bucket The bucket name in bj region.
* @param {string} object The object name.
* @param {string} title The document title.
* @param {string=} opt_format The document extension is possible.
* @param {string=} opt_notification The notification name.
* @return {Promise}
*/
Document.prototype.createFromBos = function (
bucket, object, title, opt_format, opt_notification) {
var url = this._buildUrl();
var body = {
bucket: bucket,
object: object,
title: title
};
var format = opt_format || path.extname(object).substr(1);
if (!format) {
throw new Error('Document format parameter required');
}
// doc, docx, ppt, pptx, xls, xlsx, vsd, pot, pps, rtf, wps, et, dps, pdf, txt, epub
// 默认值:BOS Object后缀名(当BOS Object有后缀时)
body.format = format;
if (opt_notification) {
body.notification = opt_notification;
}
debug('createFromBos:arguments = [%j], body = [%j]', arguments, body);
var self = this;
return this.sendRequest('POST', url, {
params: {source: 'bos'},
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(body)
}).then(function (response) {
self.setId(response.body.documentId);
return response;
});
};
Document.prototype.removeAll = function () {
var self = this;
return self.list().then(function (response) {
var asyncTasks = (response.body.documents || []).map(function (item) {
return self.remove(item.documentId);
});
return Q.all(asyncTasks);
});
};
Document.prototype.remove = function (documentId) {
var url = this._buildUrl(documentId || this._documentId);
return this.sendRequest('DELETE', url);
};
Document.prototype.list = function (opt_status) {
var status = opt_status || '';
var url = this._buildUrl();
return this.sendRequest('GET', url, {
params: {status: status}
});
};
/**
* 文档转码通知接口(Notification API)
* http://gollum.baidu.com/MEDIA-DOC-API#通知接口(Notification-API)
*
* @constructor
* @param {Object} config The doc client configuration.
* @extends {BceBaseClient}
*/
function Notification(config) {
BceBaseClient.call(this, config, 'doc', false);
this._name = null;
this._endpoint = null;
}
util.inherits(Notification, BceBaseClient);
Notification.prototype._buildUrl = function () {
var baseUrl = '/v1/notification';
var extraPaths = u.toArray(arguments);
if (extraPaths.length) {
baseUrl += '/' + extraPaths.join('/');
}
return baseUrl;
};
Notification.prototype.create = function (name, endpoint) {
var self = this;
var url = this._buildUrl();
return self.sendRequest('POST', url, {
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: name,
endpoint: endpoint
})
}).then(function (response) {
self._name = name;
self._endpoint = endpoint;
return response;
});
};
Notification.prototype.get = function (name) {
var url = this._buildUrl(name || this._name);
return this.sendRequest('GET', url);
};
Notification.prototype.list = function () {
return this.sendRequest('GET', this._buildUrl());
};
Notification.prototype.remove = function (name) {
var url = this._buildUrl(name || this._name);
return this.sendRequest('DELETE', url);
};
Notification.prototype.removeAll = function () {
var self = this;
return self.list().then(function (response) {
var asyncTasks = (response.body.notifications || []).map(function (item) {
return self.remove(item.name);
});
return Q.all(asyncTasks);
});
};
// --- E N D ---
exports.Document = Document;
exports.Notification = Notification;
|
(function () {
var networkContainer = document.getElementById('networkContainer')
var contractsVersionContainer = document.getElementById('contractsVersionContainer')
var xhr = new XMLHttpRequest()
xhr.open('GET', '/api/about')
xhr.onload = function () {
if (xhr.status === 200) {
var response = JSON.parse(xhr.response)
var network
console.log(response)
switch (response.ethereum.network) {
case '1':
network = 'Mainnet'
break
case '4':
network = 'Rinkeby'
}
if (network) {
networkContainer.innerHTML = ' - ' + network
}
contractsVersionContainer.innerHTML = 'Dx Contract v' + response.contractVersions.dxContracts
} else {
console.error('ERROR getting the version: ' + xhr.status)
}
}
xhr.send()
})()
|
import React from 'react';
import Layout from '../components/layout';
import BannerSection from '../containers/Saas/BannerSection';
import FeatureSection from '../containers/Saas/FeatureSection';
import VisitorSection from '../containers/Saas/VisitorSection';
import ServiceSection from '../containers/Saas/ServiceSection';
import FaqSection from '../containers/Saas/FaqSection';
import PricingSection from '../containers/Saas/PricingSection';
import TrialSection from '../containers/Saas/TrialSection';
import TimelineSection from '../containers/Saas/TimelineSection';
import TestimonialSection from '../containers/Saas/TestimonialSection';
import PartnerSection from '../containers/Saas/PartnerSection';
import FormSection from '../components/Form';
import SEO from '../components/seo';
export default () => {
return (
<>
<SEO title="Saas | A react next landing page" />
<Layout>
<BannerSection />
<FormSection />
<FeatureSection />
<VisitorSection />
<ServiceSection />
<PricingSection />
<TestimonialSection />
<PartnerSection />
<TimelineSection />
<FaqSection />
<TrialSection />
</Layout>
</>
);
};
|
import { createGlobalStyle } from 'styled-components';
export default createGlobalStyle`
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*, *::after, *::before{
box-sizing: border-box;
}
html{
font-size: 62.5%;
}
body{
font-size: 16px;
font-family: 'Roboto Mono', sans-serif;
margin: 0;
padding: 0;
background-color:#030303;
overflow:hidden;
}
body::-webkit-scrollbar{
background: transparent;
width: 6px;
}
body::-webkit-scrollbar-thumb {
background-color: white;
border-radius: 1000px;
}
.whitespace{
display: inline-block;
width:15px;
}
`;
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Set;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _set = require('lodash/set');
var _set2 = _interopRequireDefault(_set);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function Set(props) {
return props.children((0, _set2.default)(props.object, props.path, props.value));
}
Set.defaultProps = {
children: function children(value) {
return value;
}
};
|
require('dotenv').config();
module.exports = {
development: {
client: 'pg',
connection: {
connectionString: process.env.PG_CONNECTION_STRING,
},
},
// staging: {
// client: "postgresql",
// connection: {
// database: "my_db",
// user: "username",
// password: "password"
// },
// pool: {
// min: 2,
// max: 10
// },
// migrations: {
// tableName: "knex_migrations"
// }
// },
// production: {
// client: "postgresql",
// connection: {
// database: "my_db",
// user: "username",
// password: "password"
// },
// pool: {
// min: 2,
// max: 10
// },
// migrations: {
// tableName: "knex_migrations"
// }
// }
};
|
/*
* Copyright 2019 is-land
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react';
import { get, isEmpty } from 'lodash';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import Card from '@material-ui/core/Card';
import CardHeader from '@material-ui/core/CardHeader';
import CardContent from '@material-ui/core/CardContent';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableRow from '@material-ui/core/TableRow';
import TableCell from '@material-ui/core/TableCell';
import Divider from '@material-ui/core/Divider';
import Link from '@material-ui/core/Link';
import NumberFormat from 'react-number-format';
import TopicChip from './TopicChip';
import { FullScreenDialog, DeleteDialog } from 'components/common/Dialog';
import { useEventLog } from 'context/eventLog/eventLogHooks';
import { Wrapper } from './ViewTopicDialogStyles';
import * as context from 'context';
const ViewTopicDialog = () => {
const {
isOpen: isDialogOpen,
close: closeDialog,
data: topic,
} = context.useViewTopicDialog();
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
const { isFetching: isDeleting } = context.useTopicState();
const { deleteTopic } = context.useTopicActions();
const { data: pipelines } = context.usePipelineState();
const eventLog = useEventLog();
if (!topic) return null;
const handleDelete = async () => {
const name = get(topic, 'name');
const group = get(topic, 'group');
const res = await deleteTopic(name, group);
if (!res.error) {
eventLog.info(`Successfully deleted topic ${name}.`);
setIsConfirmOpen(false);
closeDialog();
}
};
const displayName = get(topic, 'displayName');
const isShared = get(topic, 'isShared');
const usedByPipelines = pipelines.filter(pipeline =>
pipeline.objects.find(object => object.name === topic.name),
);
return (
<FullScreenDialog
title="View topic detail"
open={isDialogOpen}
handleClose={closeDialog}
loading={isDeleting}
testId="view-topic-detail-dialog"
>
<Wrapper>
<Grid container justify="space-between" alignItems="flex-end">
<Grid item>
<Typography component="h2" variant="overline" gutterBottom>
Topics
</Typography>
<Typography component="div" variant="h3">
{displayName}
</Typography>
</Grid>
<Grid item>
<Button
variant="outlined"
color="secondary"
disabled={!isEmpty(usedByPipelines)}
onClick={() => setIsConfirmOpen(true)}
>
Delete
</Button>
<DeleteDialog
title="Delete topic?"
content={`Are you sure you want to delete the topic: ${displayName} ? This action cannot be undone!`}
open={isConfirmOpen}
handleClose={() => setIsConfirmOpen(false)}
handleConfirm={handleDelete}
isWorking={isDeleting}
testId="view-topic-detail-delete-dialog"
/>
</Grid>
</Grid>
<Grid container spacing={3} className="details">
<Grid item xs={4}>
<Card>
<CardHeader title="Information" />
<Divider />
<CardContent>
<Table>
<TableBody>
<TableRow>
<TableCell>Name</TableCell>
<TableCell>{displayName}</TableCell>
</TableRow>
<TableRow>
<TableCell>Partitions</TableCell>
<TableCell>
{get(topic, 'numberOfPartitions', 0)}
</TableCell>
</TableRow>
<TableRow>
<TableCell>Replications</TableCell>
<TableCell>
{get(topic, 'numberOfReplications', 0)}
</TableCell>
</TableRow>
<TableRow>
<TableCell>Type</TableCell>
<TableCell>
<TopicChip isShared={isShared} />
</TableCell>
</TableRow>
<TableRow>
<TableCell>State</TableCell>
<TableCell>{get(topic, 'state', 'Unknown')}</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
</Card>
</Grid>
<Grid item xs={4}>
<Card>
<CardHeader title="Metrics" />
<Divider />
<CardContent>
<Table>
<TableBody>
{get(topic, 'metrics.meters', []).map(metric => {
const document = get(metric, 'document');
const value = get(metric, 'value');
const unit = get(metric, 'unit');
return (
<TableRow>
<TableCell>{document}</TableCell>
<TableCell align="right">
<NumberFormat
value={value}
displayType="text"
thousandSeparator
renderText={value => (
<div>
{value} {unit}
</div>
)}
/>
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
</CardContent>
</Card>
</Grid>
<Grid item xs={4}>
<Card>
<CardHeader title="Used by pipelines" />
<Divider />
<CardContent>
<Table>
<TableBody>
{usedByPipelines.map(pipeline => {
const pipelineName = get(pipeline, 'name');
return (
<TableRow key={pipelineName}>
<TableCell>{pipelineName}</TableCell>
{/* Disabled in 0.9 as the feature is not yet done */}
{false && (
<TableCell align="right">
<Link>Open</Link>
</TableCell>
)}
</TableRow>
);
})}
</TableBody>
</Table>
</CardContent>
</Card>
</Grid>
</Grid>
</Wrapper>
</FullScreenDialog>
);
};
export default ViewTopicDialog;
|
// // import childProcess from 'child_process';
// import path from 'path';
// import config from 'config';
// import ncu from 'npm-check-updates';
// import simpleGit from 'simple-git';
// import { Octokit } from '@octokit/core';
// import spawn from 'await-spawn';
// import Constants from './constants'
// import LibraryCommonConstants from '@thzero/library_common/constants';
// import Utility from '@thzero/library_common/utility';
// import Service from '@thzero/library_common/service';
// import { updateVersion } from '@thzero/library_cli/api';
// require('@thzero/library_common/utility/string');
// import injector from '@thzero/library_common/utility/injector';
// // import appMetricsMonitoringService from '@thzero/library_server_monitoring_appmetrics';
// import loggerService from '@thzero/library_common/service/logger';
// import pinoLoggerService from '@thzero/library_server_logger_pino';
// import winstonLoggerService from '@thzero/library_server_logger_winston';
// class BuildService extends Service {
// constructor() {
// super();
// }
// }
// // async function processLibrary(library, octokit) {
// // try {
// // console.log('-----------');
// // console.log('processing library', library);
// // let libraryCwdPath = path.normalize(`${process.cwd()}\\..\\${library}`);
// // const packagePath = `${libraryCwdPath}\\package.json`;
// // console.log('\tpackagePath', packagePath);
// // let results = await processUpdatePackage(packagePath);
// // if (!results.success)
// // throw Error(results);
// // if (!results.upgraded)
// // return;
// // await processUpdateNpm(libraryCwdPath);
// // results = await processUpdateVersion(packagePath);
// // if (!results.success)
// // throw Error(results);
// // results = await processGitCommit(libraryCwdPath);
// // if (!results.success)
// // throw Error(results);
// // results = await processGitHubPullRequest(octokit, library);
// // if (!results.success)
// // throw Error(results);
// // results = await processCheckWorkflow(octokit, library);
// // if (!results.success)
// // throw Error(results);
// // }
// // catch (err) {
// // console.error(err);
// // }
// // finally {
// // console.log('...processed library', library);
// // console.log('-----------\n');
// // }
// // }
// // async function processGitCommit(cwdPath) {
// // try {
// // console.log('\tcommitting...');
// // const git = simpleGit({
// // baseDir: cwdPath
// // });
// // const results = [];
// // let result = await git.init();
// // results.push(result);
// // result = await git.add('.');
// // results.push(result);
// // result = await git.commit('npm updates');
// // results.push(result);
// // result = await git.push();
// // results.push(result);
// // // console.log(results);
// // return { success: true };
// // }
// // finally {
// // console.log('\t...committing completed.');
// // }
// // }
// // async function processGitHubCheckWorkflow(octokit, library) {
// // try {
// // console.log('\tchecking github workflow for completion...');
// // let response = await octokit.request('GET /repos/{owner}/{repo}/actions/runs', {
// // owner: config.owner,
// // repo: library,
// // status: 'completed'
// // });
// // if (!response || (response.status !== 200))
// // throw Error('Error trying to get workflow.');
// // const workflow = response.data.workflow_runs.pop();
// // if (!workflow) {
// // console.log('\t\tNo active workflow found.');
// // return { success: true };
// // }
// // let run_id = workflow.id;
// // console.log('\t\tworkflow.id', run_id);
// // const interval = 1000 * 45;
// // const timeout = (prom, time) => Promise.race([prom, new Promise((_r, rej) => setTimeout(() => { rej({ success: false }); }, time))]);
// // return await timeout(new Promise((resolve, reject) => {
// // const timer = setInterval((async function () {
// // try {
// // response = await octokit.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}', {
// // owner: config.owner,
// // repo: library,
// // run_id
// // });
// // if (!response || (response.status !== 200))
// // throw Error(`Error trying to check workflow '${run_id}'.`);
// // if (response.data.status === 'completed') {
// // clearInterval(timer);
// // resolve({ success: true });
// // return;
// // }
// // }
// // catch(err) {
// // reject(err);
// // }
// // }).bind(this), 1000 * 15);
// // }), interval);
// // }
// // finally {
// // console.log('\t...checking github workflow completed.');
// // }
// // }
// // async function processGitHubPullRequest(octokit, library) {
// // try {
// // console.log('\tcreating github pull request...');
// // const owner = config.owner,
// // repo = library,
// // title = 'npm updates',
// // body = 'npm updates',
// // head = 'dev',
// // base = 'master';
// // let response = await octokit.request(
// // `POST /repos/{owner}/{repo}/pulls`, { owner, repo, title, body, head, base }
// // );
// // if (!response || (response.status !== 201))
// // throw Error('Error trying to create pull request.');
// // // console.log(response);
// // let pull_number = response.number;
// // console.log('\t\tpull number', pull_number);
// // response = await octokit.request(
// // `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge`, { owner, repo, pull_number }
// // );
// // if (!response || (response.status !== 200))
// // throw Error(`Error trying to merge pull request '${pull_number}.`);
// // }
// // finally {
// // console.log('\t...creating github pull request completed.');
// // }
// // }
// // async function processUpdateNpm(cwdPath) {
// // try {
// // console.log('\tupdating packages...');
// // await spawn(path.normalize('npm.cmd'),
// // ['i'],
// // {
// // cwd: cwdPath,
// // stdio: 'inherit'
// // });
// // return { success: true };
// // }
// // finally {
// // console.log('\t...updating packages completed.');
// // }
// // }
// // async function processUpdatePackage(packagePath) {
// // try {
// // console.log('\tchecking for package upgrades...');
// // let upgrades = await ncu.run({
// // upgrade: true,
// // jsonUpgraded: true,
// // silent: false,
// // packageFile: packagePath
// // });
// // console.log('\t\tupgrades...', upgrades);
// // const upgraded = (upgrades ? (Object.entries(upgrades).length > 0) : false);
// // console.log('\t\tupgraded...', upgraded);
// // return { success: true, upgraded: upgraded };
// // }
// // finally {
// // console.log('\t...checking for package upgrades completed.');
// // }
// // }
// // async function processUpdateVersion(packagePath) {
// // try {
// // console.log('\tupdating version...');
// // const results = await updateVersion({
// // packagePath: packagePath,
// // pi: true
// // });
// // console.log('\t\t' + (results.message || results.error) ? results.message ? results.message : '' : results.error ? results.error : 'failed');
// // return { success: results };
// // }
// // finally {
// // console.log('\t...updating version completed.');
// // }
// // }
// (async () => {
// try {
// Utility.initDateTime();
// // https://github.com/lorenwest/node-config/wiki
// const appConfig = config.get('app');
// function inject(injector, services, key, service) {
// console.log(`services.inject - ${key}`);
// services.set(key, service);
// injector.addSingleton(key, service);
// }
// function injectR(injector, repositories, key, repository) {
// console.log(`repositories.inject - ${key}`);
// repositories.set(key, repository);
// injector.addSingleton(key, repository);
// }
// injector.addSingleton(LibraryCommonConstants.InjectorKeys.SERVICE_CONFIG, config);
// const services = new Map();
// const loggerServiceI = new loggerService();
// // inject(injector, services, LibraryCommonConstants.InjectorKeys.SERVICE_MONITORING, new appMetricsMonitoringService());
// inject(injector, services, Constants.InjectorKeys.SERVICE_LOGGER_PINO, new pinoLoggerService());
// inject(injector, services, Constants.InjectorKeys.SERVICE_LOGGER_WISTON, new winstonLoggerService());
// inject(injector, services, LibraryCommonConstants.InjectorKeys.SERVICE_LOGGER, loggerServiceI);
// loggerServiceI.register(Constants.InjectorKeys.SERVICE_LOGGER_PINO);
// loggerServiceI.register(Constants.InjectorKeys.SERVICE_LOGGER_WISTON);
// for (const [key, value] of services) {
// console.log(`services.init - ${key}`);
// await value.init(injector);
// }
// try {
// // Create a personal access token at https://github.com/settings/tokens/new?scopes=repo
// // const octokit = new Octokit({ auth: config.token });
// // let library = 'library_cli';
// // await processLibrary(library, octokit);
// }
// catch (err) {
// loggerServiceI.exception('Build', 'init', err);
// }
// }
// catch (err) {
// console.error(err);
// }
// })();
|
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import { GatsbyImage } from "gatsby-plugin-image"
const Header = ({ siteTitle, isFrontPage }) => {
const data = useStaticQuery(graphql`
query {
bg: file(relativePath: { eq: "headbg.png" }) {
childImageSharp {
gatsbyImageData(layout: CONSTRAINED, width: 998)
}
}
}
`)
const imageData = data.bg.childImageSharp.gatsbyImageData
return (
<header
className={`header${isFrontPage ? " header--home-page" : ""}`}
style={{ display: "grid" }}
>
<GatsbyImage
style={{
gridArea: "1/1",
}}
image={imageData}
loading="eager"
alt=""
/>
<div
className="header__content"
style={{
gridArea: "1/1",
position: "relative",
}}
>
<h1
dangerouslySetInnerHTML={{ __html: siteTitle.replace("|", "<br/>") }}
/>
{isFrontPage && (
<p>
Jesteśmy polską firmą rodzinną, działamy nieprzerwanie od 1988 roku.
<br />
Zajmujemy się kompleksowo hydrauliką siłową i pneumatyką.
</p>
)}
</div>
</header>
)
}
export default Header
|
import * as utils from '../src/utils';
import { parse as parseUrl } from '../src/url';
import { config } from '../src/config';
import { registerBidder } from '../src/adapters/bidderFactory';
import { Renderer } from '../src/Renderer';
import { VIDEO, BANNER } from '../src/mediaTypes';
import find from 'core-js/library/fn/array/find';
import includes from 'core-js/library/fn/array/includes';
const ADAPTER_VERSION = '1.4';
const ADAPTER_NAME = 'BFIO_PREBID';
const OUTSTREAM = 'outstream';
export const VIDEO_ENDPOINT = '//reachms.bfmio.com/bid.json?exchange_id=';
export const BANNER_ENDPOINT = '//display.bfmio.com/prebid_display';
export const OUTSTREAM_SRC = '//player-cdn.beachfrontmedia.com/playerapi/loader/outstream.js';
export const VIDEO_TARGETING = ['mimes', 'playbackmethod', 'maxduration'];
export const DEFAULT_MIMES = ['video/mp4', 'application/javascript'];
let appId = '';
export const spec = {
code: 'beachfront',
supportedMediaTypes: [ VIDEO, BANNER ],
isBidRequestValid(bid) {
return !!(isVideoBidValid(bid) || isBannerBidValid(bid));
},
buildRequests(bids, bidderRequest) {
let requests = [];
let videoBids = bids.filter(bid => isVideoBidValid(bid));
let bannerBids = bids.filter(bid => isBannerBidValid(bid));
videoBids.forEach(bid => {
appId = getVideoBidParam(bid, 'appId');
requests.push({
method: 'POST',
url: VIDEO_ENDPOINT + appId,
data: createVideoRequestData(bid, bidderRequest),
bidRequest: bid
});
});
if (bannerBids.length) {
appId = getBannerBidParam(bannerBids[0], 'appId');
requests.push({
method: 'POST',
url: BANNER_ENDPOINT,
data: createBannerRequestData(bannerBids, bidderRequest),
bidRequest: bannerBids
});
}
return requests;
},
interpretResponse(response, { bidRequest }) {
response = response.body;
if (isVideoBid(bidRequest)) {
if (!response || !response.url || !response.bidPrice) {
utils.logWarn(`No valid video bids from ${spec.code} bidder`);
return [];
}
let sizes = getVideoSizes(bidRequest);
let firstSize = getFirstSize(sizes);
let context = utils.deepAccess(bidRequest, 'mediaTypes.video.context');
return {
requestId: bidRequest.bidId,
bidderCode: spec.code,
vastUrl: response.url,
cpm: response.bidPrice,
width: firstSize.w,
height: firstSize.h,
creativeId: response.cmpId,
renderer: context === OUTSTREAM ? createRenderer(bidRequest) : null,
mediaType: VIDEO,
currency: 'USD',
netRevenue: true,
ttl: 300
};
} else {
if (!response || !response.length) {
utils.logWarn(`No valid banner bids from ${spec.code} bidder`);
return [];
}
return response
.filter(bid => bid.adm)
.map((bid) => {
let request = find(bidRequest, req => req.adUnitCode === bid.slot);
return {
requestId: request.bidId,
bidderCode: spec.code,
ad: bid.adm,
creativeId: bid.crid,
cpm: bid.price,
width: bid.w,
height: bid.h,
mediaType: BANNER,
currency: 'USD',
netRevenue: true,
ttl: 300
};
});
}
},
getUserSyncs(syncOptions, serverResponses = [], gdprConsent = {}) {
let syncs = [];
let { gdprApplies, consentString } = gdprConsent;
let bannerResponse = find(serverResponses, (res) => utils.isArray(res.body));
if (bannerResponse) {
if (syncOptions.iframeEnabled) {
bannerResponse.body
.filter(bid => bid.sync)
.forEach(bid => {
syncs.push({
type: 'iframe',
url: bid.sync
});
});
}
} else if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: `//sync.bfmio.com/sync_iframe?ifg=1&id=${appId}&gdpr=${gdprApplies ? 1 : 0}&gc=${consentString || ''}&gce=1`
});
} else if (syncOptions.pixelEnabled) {
syncs.push({
type: 'image',
url: `//sync.bfmio.com/syncb?pid=144&id=${appId}&gdpr=${gdprApplies ? 1 : 0}&gc=${consentString || ''}&gce=1`
});
}
return syncs;
}
};
function createRenderer(bidRequest) {
const renderer = Renderer.install({
id: bidRequest.bidId,
url: OUTSTREAM_SRC,
loaded: false
});
renderer.setRender(outstreamRender);
return renderer;
}
function outstreamRender(bid) {
bid.renderer.push(() => {
window.Beachfront.Player(bid.adUnitCode, {
ad_tag_url: bid.vastUrl,
width: bid.width,
height: bid.height,
expand_in_view: false,
collapse_on_complete: true
});
});
}
function getFirstSize(sizes) {
return (sizes && sizes.length) ? sizes[0] : { w: undefined, h: undefined };
}
function parseSizes(sizes) {
return utils.parseSizesInput(sizes).map(size => {
let [ width, height ] = size.split('x');
return {
w: parseInt(width, 10) || undefined,
h: parseInt(height, 10) || undefined
};
});
}
function getVideoSizes(bid) {
return parseSizes(utils.deepAccess(bid, 'mediaTypes.video.playerSize') || bid.sizes);
}
function getBannerSizes(bid) {
return parseSizes(utils.deepAccess(bid, 'mediaTypes.banner.sizes') || bid.sizes);
}
function getOsVersion() {
let clientStrings = [
{ s: 'Android', r: /Android/ },
{ s: 'iOS', r: /(iPhone|iPad|iPod)/ },
{ s: 'Mac OS X', r: /Mac OS X/ },
{ s: 'Mac OS', r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ },
{ s: 'Linux', r: /(Linux|X11)/ },
{ s: 'Windows 10', r: /(Windows 10.0|Windows NT 10.0)/ },
{ s: 'Windows 8.1', r: /(Windows 8.1|Windows NT 6.3)/ },
{ s: 'Windows 8', r: /(Windows 8|Windows NT 6.2)/ },
{ s: 'Windows 7', r: /(Windows 7|Windows NT 6.1)/ },
{ s: 'Windows Vista', r: /Windows NT 6.0/ },
{ s: 'Windows Server 2003', r: /Windows NT 5.2/ },
{ s: 'Windows XP', r: /(Windows NT 5.1|Windows XP)/ },
{ s: 'UNIX', r: /UNIX/ },
{ s: 'Search Bot', r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/ }
];
let cs = find(clientStrings, cs => cs.r.test(navigator.userAgent));
return cs ? cs.s : 'unknown';
}
function isMobile() {
return (/(ios|ipod|ipad|iphone|android)/i).test(navigator.userAgent);
}
function isConnectedTV() {
return (/(smart[-]?tv|hbbtv|appletv|googletv|hdmi|netcast\.tv|viera|nettv|roku|\bdtv\b|sonydtv|inettvbrowser|\btv\b)/i).test(navigator.userAgent);
}
function getDoNotTrack() {
return navigator.doNotTrack === '1' || window.doNotTrack === '1' || navigator.msDoNoTrack === '1' || navigator.doNotTrack === 'yes';
}
function isVideoBid(bid) {
return utils.deepAccess(bid, 'mediaTypes.video');
}
function isBannerBid(bid) {
return utils.deepAccess(bid, 'mediaTypes.banner') || !isVideoBid(bid);
}
function getVideoBidParam(bid, key) {
return utils.deepAccess(bid, 'params.video.' + key) || utils.deepAccess(bid, 'params.' + key);
}
function getBannerBidParam(bid, key) {
return utils.deepAccess(bid, 'params.banner.' + key) || utils.deepAccess(bid, 'params.' + key);
}
function isVideoBidValid(bid) {
return isVideoBid(bid) && getVideoBidParam(bid, 'appId') && getVideoBidParam(bid, 'bidfloor');
}
function isBannerBidValid(bid) {
return isBannerBid(bid) && getBannerBidParam(bid, 'appId') && getBannerBidParam(bid, 'bidfloor');
}
function getTopWindowLocation(bidderRequest) {
let url = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer;
return parseUrl(config.getConfig('pageUrl') || url, { decodeSearchAsString: true });
}
function getTopWindowReferrer() {
try {
return window.top.document.referrer;
} catch (e) {
return '';
}
}
function getVideoTargetingParams(bid) {
return Object.keys(Object(bid.params.video))
.filter(param => includes(VIDEO_TARGETING, param))
.reduce((obj, param) => {
obj[ param ] = bid.params.video[ param ];
return obj;
}, {});
}
function createVideoRequestData(bid, bidderRequest) {
let sizes = getVideoSizes(bid);
let firstSize = getFirstSize(sizes);
let video = getVideoTargetingParams(bid);
let appId = getVideoBidParam(bid, 'appId');
let bidfloor = getVideoBidParam(bid, 'bidfloor');
let topLocation = getTopWindowLocation(bidderRequest);
let payload = {
isPrebid: true,
appId: appId,
domain: document.location.hostname,
id: utils.getUniqueIdentifierStr(),
imp: [{
video: Object.assign({
w: firstSize.w,
h: firstSize.h,
mimes: DEFAULT_MIMES
}, video),
bidfloor: bidfloor,
secure: topLocation.protocol === 'https:' ? 1 : 0
}],
site: {
page: topLocation.href,
domain: topLocation.hostname
},
device: {
ua: navigator.userAgent,
language: navigator.language,
devicetype: isMobile() ? 1 : isConnectedTV() ? 3 : 2,
dnt: getDoNotTrack() ? 1 : 0,
js: 1,
geo: {}
},
regs: {},
user: {},
cur: ['USD']
};
if (bidderRequest && bidderRequest.gdprConsent) {
let { gdprApplies, consentString } = bidderRequest.gdprConsent;
payload.regs.ext = { gdpr: gdprApplies ? 1 : 0 };
payload.user.ext = { consent: consentString };
}
return payload;
}
function createBannerRequestData(bids, bidderRequest) {
let topLocation = getTopWindowLocation(bidderRequest);
let topReferrer = getTopWindowReferrer();
let slots = bids.map(bid => {
return {
slot: bid.adUnitCode,
id: getBannerBidParam(bid, 'appId'),
bidfloor: getBannerBidParam(bid, 'bidfloor'),
sizes: getBannerSizes(bid)
};
});
let payload = {
slots: slots,
page: topLocation.href,
domain: topLocation.hostname,
search: topLocation.search,
secure: topLocation.protocol.indexOf('https') === 0 ? 1 : 0,
referrer: topReferrer,
ua: navigator.userAgent,
deviceOs: getOsVersion(),
isMobile: isMobile() ? 1 : 0,
dnt: getDoNotTrack() ? 1 : 0,
adapterVersion: ADAPTER_VERSION,
adapterName: ADAPTER_NAME
};
if (bidderRequest && bidderRequest.gdprConsent) {
let { gdprApplies, consentString } = bidderRequest.gdprConsent;
payload.gdpr = gdprApplies ? 1 : 0;
payload.gdprConsent = consentString;
}
return payload;
}
registerBidder(spec);
|
import { Observable } from "l3p-frontend"
import appModel from "siaRoot/appModel"
import { toHslaString } from "shared/color"
import DEFAULTS from "./point.defaults"
import DrawableModel from "../DrawableModel"
import imageInterface from "components/image/imageInterface"
export default class PointModel extends DrawableModel {
constructor(annotationData: any) {
super(annotationData)
const { imgW, imgH } = imageInterface.getDimensions()
// validate point coordinate.
const { x, y } = this.validate(annotationData.data, {
min: {
x: 0,
y: 0,
},
max: {
x: 1,
y: 1,
},
})
// init relative bounds.
this.relBounds = { x, y }
// init actual bounds.
this.actBounds = new Observable({
x: x * imgW,
y: y * imgH,
})
}
validate(coord: any, limits: any){
const { min, max } = limits
let { x, y } = coord
// fill in unchanged values.
x = (x === undefined) ? this.actBounds.value.x : x
y = (y === undefined) ? this.actBounds.value.y : y
// correct errors.
x = x < min.x ? min.x : x
y = y < min.y ? min.y : y
x = x > max.x ? max.x : x
y = y > max.y ? max.y : y
return { x, y }
}
// @coord: actual bounds
updateBounds(coord: any){
const { imgW, imgH } = imageInterface.getDimensions()
const { x, y } = coord
this.relBounds = {
x: (x / imgW),
y: (y / imgH),
}
// actBounds needs to be updated at last, cause it could have listeners equipped that
// use relBounds aswell. should propably refactor this and only allow access via methods.
this.actBounds.update(coord)
}
// @override: use point opacity defaults
updateColor(label: any){
const baseColor = label !== undefined
? appModel.getLabelColor(label)
: appModel.getLabelColor(this.label)
this.color = {
raw: baseColor,
fill: {
selected: toHslaString(baseColor, DEFAULTS.opacity.selected.fill),
unselected: toHslaString(baseColor, DEFAULTS.opacity.notSelected.fill),
},
stroke: {
selected: toHslaString(baseColor, DEFAULTS.opacity.selected.stroke),
unselected: toHslaString(baseColor, DEFAULTS.opacity.notSelected.stroke),
},
}
}
// @required-extensible
getResponseData(){
return super.getResponseData(this.relBounds)
}
getDataForJSON(){
return super.getDataForJSON(this.relBounds)
}
}
|
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { message } from 'antd';
import './index.scss';
import * as CONSTANTS from '../../data/config/constants';
import * as pageActions from '../../data/redux/page_details/actions';
import * as eventsActions from '../../data/redux/events_details/actions';
import * as testimonialsActions from '../../data/redux/testimonials_details/actions';
import { createTestimonials } from '../../data/config/api';
import { icons } from '../../data/assets/assetsurl';
import PageHeader from '../../components/pageheader';
import TestimonialList from './components/testimoniallist';
import WriteTestimonial from './components/writetestimonial';
function mapStateToProps(state) {
return {
testimonials_details: state.testimonials_details,
events_details: state.events_details,
page_details: state.page_details,
user_details: state.user_details
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(Object.assign({}, pageActions, testimonialsActions, eventsActions), dispatch)
};
}
class Testimonials extends Component {
constructor(props) {
super(props);
this.state = {
mode: 'list',
animation_class: 'zoomIn',
posting_testimonial: false
};
}
componentWillMount() {
this.props.actions.pageChanged(CONSTANTS.appPages.STUDENT_SPEAK, CONSTANTS.appPages.STUDENT_SPEAK);
this.props.actions.getTestimonialsDetails();
this.props.actions.getEvents();
}
componentDidMount() {
window.scrollTo(0, 0);
}
changeView = (mode) => {
let user_exist = this.props.user_details.user && this.props.user_details.user.id;
if (mode === 'write' && !user_exist) {
this.props.actions.openLoginModal();
} else {
this.setState({
animation_class: mode === 'write' ? 'zoomIn' : 'fadeOut'
}, () => {
window.scrollTo(0, 0);
setTimeout(() => {
this.setState({
mode
});
}, 1000);
});
}
}
submitTestimonials = (payload) => {
const hide = message.loading('Posting your testimonial..', 0);
this.setState({
posting_testimonial: true
});
createTestimonials(payload, (err) => {
setTimeout(hide, 0);
if (err) {
message.error("Posting failed. Please retry!");
} else {
message.success("Thanks for posting your testimonial.");
this.changeView('list');
}
this.setState({
posting_testimonial: false
});
});
}
render() {
const { testimonials_details, events_details } = this.props;
const { mode, animation_class, posting_testimonial } = this.state;
const testimonialActions = {
changeView: this.changeView,
submitTestimonials: this.submitTestimonials
};
const events = events_details ? events_details.events : [];
return (
<div className="flex-column testimonialsContainer t-pad-50">
<div className="t-mrgn-50">
<PageHeader title="Testimonials" image={icons.testimonial_header_bg} />
</div>
{mode === 'list' && testimonials_details && testimonials_details.testimonials.length > 0 &&
<TestimonialList testimonials={testimonials_details.testimonials} actions={testimonialActions} />
}
{mode === 'write' &&
<WriteTestimonial actions={testimonialActions} events={events} animation={animation_class} loading={posting_testimonial} />
}
</div>
);
}
}
Testimonials.propTypes = {
page_details: PropTypes.object,
user_details: PropTypes.object,
events_details: PropTypes.object,
testimonials_details: PropTypes.object,
actions: PropTypes.object
};
export default connect(mapStateToProps, mapDispatchToProps)(Testimonials);
|
// @flow
import * as BufferLayout from 'buffer-layout';
/**
* Layout for a public key
*/
export const publicKey = (property: string = 'publicKey'): Object => {
return BufferLayout.blob(32, property);
};
/**
* Layout for a 64bit unsigned value
*/
export const uint64 = (property: string = 'uint64'): Object => {
return BufferLayout.blob(8, property);
};
|
// Importa os pacotes
const Database = require('./db');
const saveOrphanage = require('./saveOrphanage');
Database.then(async db => {
// Inserir dados na tabela
await saveOrphanage(db, {
lat: "-27.222633",
lng: "-49.6455874",
name: "Orfanato Esperança",
about: "Presta assistência a crianças de 06 a 15 anos que se encontre em situação de risco e/ou vulnerabilidade social.",
whatsapp: "1234-5678",
images: [
"https://source.unsplash.com/tvc5imO5pXk",
"https://source.unsplash.com/iDCtsz-INHI",
"https://source.unsplash.com/-Ux5mdMJNEA",
"https://source.unsplash.com/AEaTUnvneik",
"https://source.unsplash.com/cRRDzGxqVe8",
"https://source.unsplash.com/xtd3zYWxEs4",
].toString(),
instructions: "Venha como se sentir a vontade e traga muito amor e paciência para dar.",
opening_hours: "Horário de visitas das 8h até 18h",
open_on_weekends: "1"
});
// Consultar dados da tabela
// const selectedOrphanages = await db.all('SELECT * FROM orphanages');
// console.log(selectedOrphanages);
// Consultar somente um orfanato pelo id
// const orphanage = await db.all('SELECT * FROM orphanages WHERE id = "1"');
// console.log(orphanage);
// Deletar dados da tabela
// console.log(await db.run('DELETE FROM orphanages WHERE id = "1"'));
});
|
(function ($) {
// register namespace
$.extend(true, window, {
"Slick": {
"CellRangeSelector": CellRangeSelector
}
});
function CellRangeSelector(options) {
var _grid;
var _canvas;
var _dragging;
var _decorator;
var _self = this;
var _defaults = {
selectionCss: {
"border": "2px dashed blue"
}
};
function init(grid) {
options = $.extend(true, {}, _defaults, options);
_decorator = new Slick.CellRangeDecorator(grid, options);
_grid = grid;
_canvas = _grid.getCanvasNode();
_grid.onDragInit.subscribe(handleDragInit);
_grid.onDragStart.subscribe(handleDragStart);
_grid.onDrag.subscribe(handleDrag);
_grid.onDragEnd.subscribe(handleDragEnd);
}
function destroy() {
_grid.onDragInit.unsubscribe(handleDragInit);
_grid.onDragStart.unsubscribe(handleDragStart);
_grid.onDrag.unsubscribe(handleDrag);
_grid.onDragEnd.unsubscribe(handleDragEnd);
}
function handleDragInit(e, dd) {
// prevent the grid from cancelling drag'n'drop by default
e.stopImmediatePropagation();
}
function handleDragStart(e, dd) {
var cell = _grid.getCellFromEvent(e);
if (_self.onBeforeCellRangeSelected.notify(cell) !== false) {
if (_grid.canCellBeSelected(cell.row, cell.cell)) {
_dragging = true;
e.stopImmediatePropagation();
}
}
if (!_dragging) {
return;
}
var start = _grid.getCellFromPoint(
dd.startX - $(_canvas).offset().left,
dd.startY - $(_canvas).offset().top);
dd.range = {start: start, end: {}};
return _decorator.show(new Slick.Range(start.row, start.cell));
}
function handleDrag(e, dd) {
if (!_dragging) {
return;
}
e.stopImmediatePropagation();
var end = _grid.getCellFromPoint(
e.pageX - $(_canvas).offset().left,
e.pageY - $(_canvas).offset().top);
if (!_grid.canCellBeSelected(end.row, end.cell)) {
return;
}
dd.range.end = end;
_decorator.show(new Slick.Range(dd.range.start.row, dd.range.start.cell, end.row, end.cell));
}
function handleDragEnd(e, dd) {
if (!_dragging) {
return;
}
_dragging = false;
e.stopImmediatePropagation();
_decorator.hide();
_self.onCellRangeSelected.notify({
range: new Slick.Range(
dd.range.start.row,
dd.range.start.cell,
dd.range.end.row,
dd.range.end.cell
)
});
}
$.extend(this, {
"init": init,
"destroy": destroy,
"onBeforeCellRangeSelected": new Slick.Event(),
"onCellRangeSelected": new Slick.Event()
});
}
})(jQuery);
|
const locations = require("./plz_ort_state_lat_lon_rank.csv");
export default locations;
|
/*! firebase-admin v10.0.1 */
"use strict";
/*!
* @license
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var firebase_namespace_1 = require("./app/firebase-namespace");
// Inject a circular default export to allow users to use both:
//
// import firebaseAdmin from 'firebase-admin';
// which becomes: var firebaseAdmin = require('firebase-admin').default;
//
// as well as the more correct:
//
// import * as firebaseAdmin from 'firebase-admin';
// which becomes: var firebaseAdmin = require('firebase-admin');
firebase_namespace_1.defaultNamespace.default = firebase_namespace_1.defaultNamespace;
module.exports = firebase_namespace_1.defaultNamespace;
|
const money = require('money-math');
const dateFns = require('date-fns');
const calcPrice = (rent, status, update = true) => {
let currentPrice = rent.originalPrice;
// Calculate Date
if (dateFns.differenceInMinutes(new Date(), new Date(rent.rentDate)) >= 1) {
let extraSeconds = dateFns.differenceInSeconds(new Date(), new Date(rent.rentDate));
// Get extra money
let percent = extraSeconds / 10;
const extraMoney = money.percent(percent.toString() + "0.00", rent.originalPrice);
currentPrice = money.add(rent.originalPrice, extraMoney);
// Return info to update
if (update) {
return {
"currentPrice": currentPrice,
"returnDate": status === "closed" ? new Date() : "-",
"rentStatus": status,
"rentDeadline": dateFns.addMinutes(new Date(rent.rentDate), 1)
};
} else {
rent.currentPrice = currentPrice,
rent.returnDate = status === "closed" ? new Date() : "-",
rent.rentStatus = status,
rent.rentDeadline = dateFns.addMinutes(new Date(rent.rentDate), 1)
return rent;
}
}
}
module.exports = {
calcPrice
}
|
var stage = {}; // store ngl stages
var pdb_data = {}; // store returned pdb data
var reps = {} // store structure components
var gpcr_rep = {} // store molecule representations
var int_labels = []
var color_schemes = {};
var blue_colors = ['#f0fcfa', '#D3E4EA', '#B6CDDB', '#99B5CC', '#7C9EBD', '#5F86AE', '#426F9F', '#255790', '#084081']
var red_colors = ['#fbf0fc', '#f3dbec', '#ebc5df', '#dda8bc', '#cc7b7f', '#d3574e', '#be372b', '#ac1808', '#811808']
var rb_colors = ['#736DA7', '#5EB7B7', '#CE9AC6', '#DD7D7E', '#E6AF7C', '#DEDB75', '#80B96F', '#000000'] // #C897B8
function createNGLview(mode, pdb, pdbs = false, pdbs_set2 = false, pdb2 = false) {
// console.log(mode, pdb, pdbs, pdbs_set2, pdb2);
$("#ngl-" + mode).html("");
stage[mode] = new NGL.Stage("ngl-" + mode, {
backgroundColor: "white"
});
color_schemes[mode] = [
[],
[]
];
reps[mode] = [{}, {}]
gpcr_rep[mode] = [];
pdb_data[mode] = [];
int_labels[mode] = []
var first_structure;
var num_set1;
var gn_num_set1;
var two_structures = false;
$.getJSON("pdb/" + pdb,
function(data) {
var highlight = ['TM1', 'TM2', 'TM3', 'TM4', 'TM5', 'TM6', 'TM7', 'H8'];
var segments_sets = {}
int_labels[mode][0] = {}
highlight.forEach(function(e) {
segments_sets[e] = ((e in data['segments']) ? data['segments'][e].join(", ") : "")
});
pdb_data[mode][0] = data;
color_schemes[mode][0]['blue'] = NGL.ColormakerRegistry.addSelectionScheme([
[blue_colors[1], segments_sets[highlight[0]]],
[blue_colors[2], segments_sets[highlight[1]]],
[blue_colors[3], segments_sets[highlight[2]]],
[blue_colors[4], segments_sets[highlight[3]]],
[blue_colors[5], segments_sets[highlight[4]]],
[blue_colors[6], segments_sets[highlight[5]]],
[blue_colors[7], segments_sets[highlight[6]]],
[blue_colors[8], segments_sets[highlight[7]]],
["white", "*"]
])
color_schemes[mode][0]['grey'] = NGL.ColormakerRegistry.addSelectionScheme([
["#ccc", segments_sets[highlight[0]]],
["#bbb", segments_sets[highlight[1]]],
["#aaa", segments_sets[highlight[2]]],
["#888", segments_sets[highlight[3]]],
["#666", segments_sets[highlight[4]]],
["#444", segments_sets[highlight[5]]],
["#333", segments_sets[highlight[6]]],
["#111", segments_sets[highlight[7]]],
["white", "*"]
])
color_schemes[mode][0]['rainbow'] = NGL.ColormakerRegistry.addSelectionScheme([
[rb_colors[0], segments_sets[highlight[0]]],
[rb_colors[1], segments_sets[highlight[1]]],
[rb_colors[2], segments_sets[highlight[2]]],
[rb_colors[3], segments_sets[highlight[3]]],
[rb_colors[4], segments_sets[highlight[4]]],
[rb_colors[5], segments_sets[highlight[5]]],
[rb_colors[6], segments_sets[highlight[6]]],
[rb_colors[7], segments_sets[highlight[7]]],
["white", "*"]
])
chain_set1 = pdb_data[mode][0]['chain'];
num_set1 = pdb_data[mode][0]['only_gn'];
gn_num_set1 = pdb_data[mode][0]['gn_map'];
var stringBlob = new Blob([pdb_data[mode][0]['pdb']], {
type: 'text/plain'
});
stage[mode].loadFile(stringBlob, {
ext: "pdb"
}).then(function(o) {
first_structure = o
// Cleanup
pdb_data[mode][0]['pdb'] = null;
// TODO: cartoon for ECL2 is currently not shown (only 3 res, but 4 needed for cartoon) - show ribbon for ICL/ECLs?
gpcr_rep[mode][0] = o.addRepresentation("cartoon", {
sele: ":" + pdb_data[mode][0]['chain'] + " and (" + pdb_data[mode][0]['only_gn'].join(", ") + ")",
radiusSize: 1,
radiusScale: 0.6,
color: color_schemes[mode][0]['blue'],
metalness: 0,
colorMode: "hcl",
roughness: 1,
opacity: 0.4,
side: "front",
depthWrite: true
});
// REMOVE default hoverPick mouse action
stage[mode].mouseControls.remove("hoverPick")
// Add residue labels for GN residues
pdb_data[mode][0]['only_gn'].forEach(function(resNo, index) {
var genNo = pdb_data[mode][0]['gn_map'][index]
int_labels[mode][0][o.structure.id + "|" + resNo] = genNo
})
// listen to `hovered` signal to move tooltip around and change its text
stage[mode].signals.hovered.add(function(pickingProxy) {
var label_index = false
var hide = true
if (pickingProxy && (pickingProxy.distance || pickingProxy.atom)) {
var mp = pickingProxy.mouse.position
if (pickingProxy.distance) {
label_index = pickingProxy.distance.atom1.structure.id + "|" + pickingProxy.distance.atom1.resno + "-" + pickingProxy.distance.atom2.resno;
ngl_tooltip.innerText = "INTERACTION:"
} else {
label_index = pickingProxy.atom.structure.id + "|" + pickingProxy.atom.resno;
ngl_tooltip.innerText = "RESIDUE:"
}
if (label_index) {
if (label_index in int_labels[mode][0]) {
ngl_tooltip.innerText += " " + int_labels[mode][0][label_index]
hide = false
} else if (mode == "two-groups" && (label_index in int_labels[mode][1])) {
ngl_tooltip.innerText += " " + int_labels[mode][1][label_index]
hide = false
}
ngl_tooltip.style.bottom = window.innerHeight - mp.y + 3 + "px"
ngl_tooltip.style.left = mp.x + 3 + "px"
ngl_tooltip.style.display = "block"
}
}
if (hide) {
ngl_tooltip.style.display = "none"
}
})
reps[mode][0].structureComponent = o
createNGLRepresentations(mode, 0, false)
// Automatic GPCR positioning
if ("translation" in pdb_data[mode][0]) {
var translation = JSON.parse(pdb_data[mode][0]["translation"])
var center_axis = JSON.parse(pdb_data[mode][0]["center_axis"])
// calculate rotation and apply
v1 = new NGL.Vector3(0, 1, 0)
v2 = new NGL.Vector3(center_axis[0], center_axis[1], center_axis[2])
var quaternion = new NGL.Quaternion(); // create one and reuse it
quaternion.setFromUnitVectors(v2, v1)
o.setRotation(quaternion)
// calculate translation and apply
var v = new NGL.Vector3(-1 * translation[0], -1 * translation[1], -1 * translation[2])
v.applyMatrix4(o.matrix)
o.setPosition([-1 * v.x, -1 * v.y, -1 * v.z])
// calculate H8 position (based on TM1)
var tm1_vector
var ref_tm1 = pdb_data[mode][0]["only_gn"][pdb_data[mode][0]["gn_map"].indexOf("1x46")]
o.structure.eachAtom(function(ap) {
tm1_vector = new NGL.Vector3(ap.x, ap.y, ap.z)
tm1_vector.applyMatrix4(o.matrix)
}, new NGL.Selection(":" + pdb_data[mode][0]['chain'] + " and " + ref_tm1 + " and .CA"))
tm1_vector.y = 0 // height position doesn't matter
tm1_vector.normalize()
// calculate rotation angle around Y-axis (as the GPCR is now upright)
v3 = new NGL.Vector3(-1, 0, 0)
var m = new NGL.Matrix4()
if (tm1_vector.z < 0)
m.makeRotationY(v3.angleTo(tm1_vector))
else if (tm1_vector.z > 0)
m.makeRotationY(-1 * v3.angleTo(tm1_vector))
o.setTransform(m)
}
o.autoView(":" + pdb_data[mode][0]['chain'] + " and (" + pdb_data[mode][0]['only_gn'].join(", ") + ") and (.CA)")
// DEBUG: color by values
// colorByData(mode, 5, 2)
});
}).then(function() {
// TODO: cleanup and reduce redundancy
if (pdbs_set2) {
$.getJSON("pdb/" + pdb2,
function(data) {
var highlight = ['TM1', 'TM2', 'TM3', 'TM4', 'TM5', 'TM6', 'TM7', 'H8'];
var segments_sets = {}
int_labels[mode][1] = {}
highlight.forEach(function(e) {
segments_sets[e] = ((e in data['segments']) ? data['segments'][e].join(", ") : "")
});
pdb_data[mode][1] = data;
num_set2 = pdb_data[mode][1]['only_gn'];
gn_num_set2 = pdb_data[mode][1]['gn_map'];
// intersect GN-numbering
var matching_TM_residues = [];
gn_num_set1.forEach(function(gn, gn_index) {
// Filter GN residues, only within 7TM + present in other protein
if (gn.charAt(1) == 'x' && gn.charAt(0) <= 7) {
var match = gn_num_set2.indexOf(gn);
if (match > -1) {
return matching_TM_residues.push([num_set1[gn_index], num_set2[match]]);
}
}
});
color_schemes[mode][1]['red'] = NGL.ColormakerRegistry.addSelectionScheme([
[red_colors[1], segments_sets[highlight[0]]],
[red_colors[2], segments_sets[highlight[1]]],
[red_colors[3], segments_sets[highlight[2]]],
[red_colors[4], segments_sets[highlight[3]]],
[red_colors[5], segments_sets[highlight[4]]],
[red_colors[6], segments_sets[highlight[5]]],
[red_colors[7], segments_sets[highlight[6]]],
[red_colors[8], segments_sets[highlight[7]]],
["white", "*"]
])
color_schemes[mode][1]['rainbow'] = NGL.ColormakerRegistry.addSelectionScheme([
[rb_colors[0], segments_sets[highlight[0]]],
[rb_colors[1], segments_sets[highlight[1]]],
[rb_colors[2], segments_sets[highlight[2]]],
[rb_colors[3], segments_sets[highlight[3]]],
[rb_colors[4], segments_sets[highlight[4]]],
[rb_colors[5], segments_sets[highlight[5]]],
[rb_colors[6], segments_sets[highlight[6]]],
[rb_colors[7], segments_sets[highlight[7]]],
["white", "*"]
])
color_schemes[mode][1]['grey'] = color_schemes[mode][0]['grey']
var stringBlob = new Blob([pdb_data[mode][1]['pdb']], {
type: 'text/plain'
});
stage[mode].loadFile(stringBlob, {
ext: "pdb"
}).then(function(o) {
// Cleanup
pdb_data[mode][1]['pdb'] = null;
//// SUPERPOSE structures using 7TM bundle ////
// Intersect GN-numbering of proteins and create Selection
var selectionOne = "(";
var selectionTwo = "(";
gn_num_set1.forEach(function(gn, gn_index) {
// Filter GN residues, only within 7TM + present in other protein
if (gn.charAt(1) == 'x' && gn.charAt(0) <= 7) {
var match = gn_num_set2.indexOf(gn);
if (match > -1) {
if (selectionOne.length > 1) {
selectionOne += " or ";
selectionTwo += " or ";
}
selectionOne += num_set1[gn_index];
selectionTwo += num_set2[match];
}
}
});
selectionOne += ") and .CA and :" + pdb_data[mode][0]['chain'];
selectionTwo += ") and .CA and :" + pdb_data[mode][1]['chain'];
var atoms1 = first_structure.structure.getView(new NGL.Selection(selectionOne))
var atoms2 = o.structure.getView(new NGL.Selection(selectionTwo))
// Due to superposing apply transformation to second struture
var superpose = new NGL.Superposition(atoms2, atoms1)
superpose.transform(o.structure)
o.structure.refreshPosition()
o.updateRepresentations({
'position': true
})
o.setTransform(first_structure.matrix)
//// END SUPERPOSE ////
gpcr_rep[mode][1] = o.addRepresentation("cartoon", {
sele: ":" + pdb_data[mode][1]['chain'] + " and (" + pdb_data[mode][1]['only_gn'].join(", ") + ")",
radiusSize: 1,
radiusScale: 0.6,
color: color_schemes[mode][1]['red'],
metalness: 0,
colorMode: "hcl",
roughness: 1,
opacity: 0.4,
side: "front",
depthWrite: true
});
// Add residue labels for GN residues
pdb_data[mode][1]['only_gn'].forEach(function(resNo, index) {
var genNo = pdb_data[mode][1]['gn_map'][index]
int_labels[mode][1][o.structure.id + "|" + resNo] = genNo
})
reps[mode][1].structureComponent = o
createNGLRepresentations(mode, 1, false)
o.autoView(selectionTwo);
});
});
}
});
var newDiv = document.createElement("div");
newDiv.setAttribute("style", "position: absolute; top: 45px; left: 20px; background-color: #DDD; opacity: .8; padding: 10px;")
var controls = '<div class="controls"><span class="pull-right ngl_controls_toggle"><span class="glyphicon glyphicon-option-horizontal btn-download png"></span></span>' +
'<span class="ngl_control"><h4>Controls</h4>';
// Toggle for showing two structures simultaneously
if (mode.startsWith("two_sets") && pdbs_set2)
two_structures = true;
else
two_structures = false;
if (pdbs) {
if (two_structures)
controls += '<p>Structure set 1: <select id="ngl_pdb_' + mode + '_ref">';
else
controls += '<p>Structure: <select id="ngl_pdb_' + mode + '_ref">';
for (var i = 0; i < pdbs.length; i++) {
if (pdbs[i] == pdb)
controls += '<option value="' + pdbs[i] + '" SELECTED>' + pdbs[i] + '</option>';
else
controls += '<option value="' + pdbs[i] + '">' + pdbs[i] + '</option>';
}
controls += '</select></p>';
if (two_structures)
controls += '<p>Hide: <input type=checkbox id="hide_pdb1"></p>';
}
controls += '<p>Colors: <select id="ngl_color"><option value="blue">blue</option><option value="rainbow">rainbow</option><option value="grey">greys</option></select></p><br/>';
if (two_structures) {
if (!pdb2)
pdb2 = pdbs_set2[0]
controls += '<p>Structure set 2: <select id="ngl_pdb_' + mode + '_ref2">';
for (var i = 0; i < pdbs_set2.length; i++) {
if (pdbs_set2[i] == pdb2)
controls += '<option value="' + pdbs_set2[i] + '" SELECTED>' + pdbs_set2[i] + '</option>';
else
controls += '<option value="' + pdbs_set2[i] + '">' + pdbs_set2[i] + '</option>';
}
controls += '</select></p>';
if (two_structures)
controls += '<p>Hide: <input type=checkbox id="hide_pdb2"></p>';
controls += '<p>Colors: <select id="ngl_color2"><option value="red">red</option><option value="rainbow">rainbow</option><option value="grey">greys</option></select></p><br/>';
}
controls += '<p>Only GNs: <input type=checkbox id="ngl_only_gns" checked></p>' +
'<p>Highlight interacting res: <input type=checkbox id="highlight_res" checked></p>' +
'<p>Hide interaction lines: <input type=checkbox id="toggle_interactions"></p>'
// +'<p>Show all side-chains: <input type=checkbox id="toggle_sidechains"></p>'
+
'<p>Show interacting side-chains: <input type=checkbox id="toggle_sidechains_int"></p>'
// +'<p>Show NGL derived contacts: <input type=checkbox id="ngl_contacts"></p>'
+
'</div>';
controls += '</span>';
newDiv.innerHTML = controls;
$("#ngl-" + mode).append(newDiv);
$("#ngl-" + mode + " .ngl_control").hide();
$('.ngl_controls_toggle').css('cursor', 'pointer');
$("#ngl-" + mode + " .ngl_controls_toggle").click(function() {
$("#ngl-" + mode + " .ngl_control").toggle();
});
if (two_structures) {
// structure selection
$("#ngl_pdb_" + mode + "_ref").change(function(e) {
createNGLview(mode, $(this).val(), pdbs, pdbs_set2, $("#ngl_pdb_" + mode + "_ref2").val());
});
$("#ngl_pdb_" + mode + "_ref2").change(function(e) {
createNGLview(mode, $("#ngl_pdb_" + mode + "_ref").val(), pdbs, pdbs_set2, $(this).val(), );
});
// coloring structure 2
$("#ngl-" + mode + " #ngl_color2").change(function(e) {
gpcr_rep[mode][1].setParameters({
color: color_schemes[mode][1][$(this).val()]
});
});
} else {
// structure selection
$("#ngl_pdb_" + mode + "_ref").change(function(e) {
createNGLview(mode, $(this).val(), pdbs, pdbs_set2);
});
}
$("#ngl-" + mode + " #ngl_color").change(function(e) {
gpcr_rep[mode][0].setParameters({
color: color_schemes[mode][0][$(this).val()]
});
});
$("#" + mode + "-NGL-tab-link").click(function(e) {
$(function() {
stage[mode].handleResize();
});
});
$("#ngl-" + mode + " #ngl_only_gns").change(function(e) {
updateStructureRepresentations(mode);
});
$("#ngl-" + mode + " #highlight_res").change(function(e) {
updateStructureRepresentations(mode);
});
$("#ngl-" + mode + " #toggle_interactions").change(function(e) {
updateStructureRepresentations(mode);
});
$("#ngl-" + mode + " #hide_pdb1").change(function(e) {
updateStructureRepresentations(mode);
});
$("#ngl-" + mode + " #hide_pdb2").change(function(e) {
updateStructureRepresentations(mode);
});
/*$("#ngl-"+mode+" #toggle_sidechains").change(function(e){
updateStructureRepresentations(mode);
});*/
$("#ngl-" + mode + " #toggle_sidechains_int").change(function(e) {
updateStructureRepresentations(mode);
});
/*$("#ngl-"+mode+" #ngl_contacts").change(function(e){
updateStructureRepresentations(mode);
});*/
// Link the 3D viewers together
stage[mode].mouseObserver.signals.dragged.add(function() {
linkNGLMouseControls(mode)
});
stage[mode].mouseObserver.signals.scrolled.add(function() {
linkNGLMouseControls(mode)
});
// Click signals not fully functional because of animation -> disabled for now
//stage[mode].mouseObserver.signals.clicked.add(function (){linkNGLMouseControls(mode)});
//stage[mode].mouseObserver.signals.doubleClicked.add(function (){linkNGLMouseControls(mode)});
// Reset 3D view - after short delay
// OPTIONAL TODO: adjust the 3D view to the view of another viewer (if present)
setTimeout(function() {
linkNGLMouseControls(mode)
}, 100);
// Prevent scrolling of document
document.getElementById(mode).onwheel = function(event) {
event.preventDefault();
};
document.getElementById(mode).onmousewheel = function(event) {
event.preventDefault();
};
}
function linkNGLMouseControls(origin) {
var mode = origin.substring(0, origin.length - 1)
for (var graph in stage) {
if (graph != origin && graph.startsWith(mode)) {
stage[graph].viewerControls.orient(stage[origin].viewerControls.getOrientation());
}
}
}
var linkMap = {}
var linkColourScheme = {}
function createNGLRepresentations(mode, structureNumber, update = false) {
interactions_data = ''
if (mode.startsWith("single_group")) {
mode_short = 'single-group';
interactions_data = single_set_data;
} else if (mode.startsWith("single")) {
mode_short = 'single';
interactions_data = single_crystal_data;
} else if (mode.startsWith("two_sets")) {
mode_short = 'two-groups';
interactions_data = two_sets_data;
}
var links = []
var res_int = []
if (mode in reps && structureNumber in reps[mode] && reps[mode][structureNumber].structureComponent)
var o = reps[mode][structureNumber].structureComponent;
else
return // NGL not initialized
// initialize linkMap + colorScheme
if (!(mode in linkMap)) linkMap[mode] = {}
if (!(structureNumber in linkMap[mode])) linkMap[mode][structureNumber] = {}
if (!(mode in linkColourScheme)) linkColourScheme[mode] = {}
// remove existing representations
var enabledInteractions = []
if (update) {
// create new links overview
reps[mode][structureNumber].structureComponent.removeRepresentation(reps[mode][structureNumber].links)
}
var gnOnly = !update || $("#ngl-" + mode + " #ngl_only_gns").prop('checked');
// Get interactions from raw_data
// console.log('i data',interactions_data);
if (mode_short == 'single') {
var addedLinks = []
// populate enabled interactions
$('#' + currentTab + " .controls-panel input:checked").each(function(toggle) {
enabledInteractions.push($(this).data('interaction-type'))
});
// Go through interaction table in inverse order (only show strongest color)
// $($('#single-crystal-tab .heatmap-interaction').get().reverse()).each(function(e) {
$.each(interactions_data.interactions, function(index, value) {
var rect = $(this);
var resNo1 = value['seq_pos'][0];
var resNo2 = value['seq_pos'][1];
var genNo1 = index.split(",")[0];
var genNo2 = index.split(",")[1];
var iType = value['types'][0]; //get strongest, which is first element.
var pair = resNo1 + "," + resNo2;
var pair = genNo1 + "," + genNo2;
if (!(filtered_gn_pairs.includes(pair)) && filtered_gn_pairs.length) {
return
}
// Interaction type filtering
// if (update && !enabledInteractions.includes(iType)) return
// GN interacting residue filtering
if (gnOnly && ((genNo1 == '-') || (genNo2 == '-'))) return
// Only show one line - max strength
if (!addedLinks.includes(resNo1 + "-" + resNo2)) {
addedLinks.push(resNo1 + "-" + resNo2)
// add residues to the list when not already there
if (!res_int.includes(resNo1)) res_int.push(resNo1)
if (!res_int.includes(resNo2)) res_int.push(resNo2)
// create link for "distance" representation
links.push({
"atoms": [resNo1 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA", resNo2 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA"],
"data": {
"color": getInteractionColor(iType)
},
"resID": resNo1 + "-" + resNo2
})
int_labels[mode][structureNumber][o.structure.id + "|" + resNo1 + "-" + resNo2] = genNo1 + " - " + genNo2
}
});
} else if (mode_short == 'single-group') {
// $('#single-crystal-group-tab .heatmap-container .heatmap-interaction').each(function(e) {
$.each(interactions_data.interactions, function(index, value) {
var genNo1 = index.split(",")[0];
var genNo2 = index.split(",")[1];
var frequency = value['pdbs'].length / interactions_data['pdbs'].length;
if ((genNo1 == '-') || (genNo2 == '-')) return
var pair = genNo1 + "," + genNo2;
if (!(filtered_gn_pairs.includes(pair)) && filtered_gn_pairs.length) {
return
}
// Adjust GN numbering to the shown structure
var resNo1 = pdb_data[mode][structureNumber]['only_gn'][pdb_data[mode][structureNumber]['gn_map'].indexOf(genNo1)];
var resNo2 = pdb_data[mode][structureNumber]['only_gn'][pdb_data[mode][structureNumber]['gn_map'].indexOf(genNo2)];
if ((typeof resNo1 == 'undefined') || (typeof resNo2 == 'undefined')) return
// Push interactions
if (!res_int.includes(resNo1)) res_int.push(resNo1)
if (!res_int.includes(resNo2)) res_int.push(resNo2)
links.push({
"atoms": [resNo1 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA", resNo2 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA"],
"data": {
"color": getFrequencyColor(frequency)
},
"resID": resNo1 + "-" + resNo2
})
int_labels[mode][structureNumber][o.structure.id + "|" + resNo1 + "-" + resNo2] = genNo1 + " - " + genNo2
});
} else {
// $('#two-crystal-groups-tab .heatmap-container .heatmap-interaction').each(function(e) {
var pdbs_1 = interactions_data['pdbs1'].length
var pdbs_2 = interactions_data['pdbs2'].length
$.each(interactions_data.interactions, function(index, v) {
// Generic numbering
var genNo1 = index.split(",")[0];
var genNo2 = index.split(",")[1];
if ((genNo1 == '-') || (genNo2 == '-')) return
// Link GN numbering to the shown structure
var resNo1 = pdb_data[mode][structureNumber]['only_gn'][pdb_data[mode][structureNumber]['gn_map'].indexOf(genNo1)];
var resNo2 = pdb_data[mode][structureNumber]['only_gn'][pdb_data[mode][structureNumber]['gn_map'].indexOf(genNo2)];
if ((typeof resNo1 == 'undefined') || (typeof resNo2 == 'undefined')) return
var f1 = Math.round(100 * v['pdbs1'].length / pdbs_1);
var f2 = Math.round(100 * v['pdbs2'].length / pdbs_2);
var frequency = f1 - f2;
var pair = genNo1 + "," + genNo2;
if (!(filtered_gn_pairs.includes(pair)) && filtered_gn_pairs.length) {
return
}
// Push interacting residues
if (!res_int.includes(resNo1)) res_int.push(resNo1)
if (!res_int.includes(resNo2)) res_int.push(resNo2)
// Only show the links for the most prevalent structure group
if ((structureNumber == 0 && frequency < 0) || (structureNumber == 1 && frequency >= 0)) return
// Fix atom IDs for GN loop interactions
if (resNo1 > resNo2) {
tmp = resNo1;
resNo1 = resNo2;
resNo2 = tmp;
tmp = genNo1;
genNo1 = genNo2;
genNo2 = tmp;
}
links.push({
"atoms": [resNo1 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA", resNo2 + ":" + pdb_data[mode][structureNumber]['chain'] + ".CA"],
"data": {
"color": getFrequencyColor(-1 * frequency)
},
"resID": resNo1 + "-" + resNo2
})
int_labels[mode][structureNumber][o.structure.id + "|" + resNo1 + "-" + resNo2] = genNo1 + " - " + genNo2
});
}
links.forEach(function(link) {
linkMap[mode][structureNumber][link.resID] = link
})
// create coloring scale for the links
linkColourScheme[mode][structureNumber] = function() {
this.bondColor = function(b) {
var origLink = linkMap[mode][structureNumber][b.atom1.resno + "-" + b.atom2.resno]
if (origLink) {
r = origLink.data.color
return (r["r"] << 16) + (r["g"] << 8) + r["b"]
}
return (8 << 16) + (8 << 8) + 8 // (128 << 16) + (128 << 8) + 128 // grey default
}
}
reps[mode][structureNumber].linkColourScheme = NGL.ColormakerRegistry.addScheme(linkColourScheme[mode][structureNumber], "xlink")
reps[mode][structureNumber].links = o.addRepresentation("distance", {
atomPair: links.map(function(l) {
return l.atoms
}),
colorScheme: reps[mode][structureNumber].linkColourScheme,
useCylinder: true,
radiusSize: 0.04,
labelVisible: false,
linewidth: 2,
visible: true
})
// Empty? Update selection with a fake residue -> hide everything
if (res_int.length == 0) res_int.push("9999999")
if (update) {
reps[mode][structureNumber].int_res.setSelection(":" + pdb_data[mode][structureNumber]['chain'] + " and (" + res_int.join(", ") + ") and (.CA)")
reps[mode][structureNumber].ball_int.setSelection(":" + pdb_data[mode][structureNumber]['chain'] + " and (" + res_int.join(", ") + ") and sidechainAttached")
} else {
reps[mode][structureNumber].int_res = o.addRepresentation("spacefill", {
sele: ":" + pdb_data[mode][structureNumber]['chain'] + " and (" + res_int.join(", ") + ") and (.CA)",
color: (structureNumber == 0 ? "#084081" : "#811808"),
radiusScale: .2,
name: "res",
visible: true
});
reps[mode][structureNumber].ball_int = o.addRepresentation("ball+stick", {
sele: ":" + pdb_data[mode][structureNumber]['chain'] + " and (" + res_int.join(", ") + ") and sidechainAttached",
color: "element",
colorValue: (structureNumber == 0 ? "#99B5CC" : "#DDA8BC"),
visible: false
})
}
// update show/hide when updating representations
if (update) updateStructureRepresentations(mode)
}
function colorNGLByData(mode, residue_positions, residue_colors, defaultColor){
var structureKey = 0; // structure number now limited to structure 1
// Create coloring scheme
color_scheme = []
// Create gradient scaled by data type
for (var i = 0; i < residue_positions.length; i++) {
// Find X-ray residue number
gn = pdb_data[mode][structureKey]["gn_map"].indexOf(residue_positions[i])
if (gn >= 0) {
// create residue selector
var ngl_selection = ":" + pdb_data[mode][structureKey]['chain'] + " and " + pdb_data[mode][structureKey]["only_gn"][gn]
// get color
var newColor = residue_colors[i]
// add color + residue to scheme
color_scheme.push([newColor, ngl_selection])
}
}
// gray for residues not present
color_scheme.push([ defaultColor, "*" ]);
color_schemes[mode]['feature'] = NGL.ColormakerRegistry.addSelectionScheme(color_scheme)
// Assign the coloring to the 3D viewer
gpcr_rep[mode][structureKey].setParameters({
color: color_schemes[mode]['feature']
});
}
|
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import { shallow } from 'enzyme';
import 'jest-styled-components';
import { PureSubscriptionManagement as SubscriptionManagement } from './SubscriptionManagement';
import {
ManageButtonWrapStyled,
SubscriptionActionsStyled
} from './SubscriptionManagementStyled';
describe('<MessageBox/>', () => {
afterEach(() => {
jest.clearAllMocks();
});
describe('@renders', () => {
it('should render initial state', () => {
const wrapper = shallow(<SubscriptionManagement />);
expect(wrapper.find(ManageButtonWrapStyled)).toHaveLength(1);
expect(wrapper.find(SubscriptionActionsStyled)).toHaveLength(1);
});
it('should render children when isOpened prop is true', () => {
// eslint-disable-next-line react/jsx-boolean-value
const wrapper = shallow(<SubscriptionManagement isOpened={true} />);
expect(wrapper.find(SubscriptionActionsStyled)).toHaveLength(1);
});
});
});
|
const COMPANIES = {
GET_COMPANIES_SUCCESS: "GET_COMPANIES_SUCCESS",
GET_COMPANIES_ERROR: "GET_COMPANIES_ERROR",
ADD_COMPANY_SUCCESS: "ADD_COMPANY_SUCCESS",
ADD_COMPANY_ERROR: "ADD_COMPANY_ERROR",
DELETE_COMPANY_SUCCESS: "DELETE_COMPANY_SUCCESS",
DELETE_COMPANY_ERROR: "DELETE_COMPANY_ERROR",
EDIT_COMPANY_SUCCESS: "EDIT_COMPANY_SUCCESS",
EDIT_COMPANY_ERROR: "EDIT_COMPANY_ERROR",
ADD_EXISTING_COMPANY_SUCCESS: "ADD_EXISTING_COMPANY_SUCCESS",
ADD_EXISTING_COMPANY_ERROR: "ADD_EXISTING_COMPANY_ERROR",
DELETE_EXISTING_COMPANY_SUCCESS: "DELETE_EXISTING_COMPANY_SUCCESS",
DELETE_EXISTING_COMPANY_ERROR: "DELETE_EXISTING_COMPANY_ERROR",
};
export default COMPANIES;
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var styled_icon_1 = require("@styled-icons/styled-icon");
exports.Buromobelexperte = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
"xmlns": "http://www.w3.org/2000/svg",
};
return (React.createElement(styled_icon_1.StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "-.125em", iconViewBox: "0 0 448 512" }, props, { ref: ref }),
React.createElement("path", { fill: "currentColor", d: "M0 32v128h128V32H0zm120 120H8V40h112v112zm40-120v128h128V32H160zm120 120H168V40h112v112zm40-120v128h128V32H320zm120 120H328V40h112v112zM0 192v128h128V192H0zm120 120H8V200h112v112zm40-120v128h128V192H160zm120 120H168V200h112v112zm40-120v128h128V192H320zm120 120H328V200h112v112zM0 352v128h128V352H0zm120 120H8V360h112v112zm40-120v128h128V352H160zm120 120H168V360h112v112zm40-120v128h128V352H320z", key: "k0" })));
});
exports.Buromobelexperte.displayName = 'Buromobelexperte';
exports.BuromobelexperteDimensions = { height: undefined, width: undefined };
|
exports.createPages = async ({ actions, graphql, reporter }) => {
const resultado = await graphql(`
query{
allDatoCmsHabitacion {
nodes {
slug
}
}
}
`);
//console.log(resultado.data.allDatoCmsHabitacion.nodes);
if(resultado.errors){
reporter.panic('No hubo resultados', resultado.errors);
}
//Si hay paginas crear los archivos
const habitaciones = resultado.data.allDatoCmsHabitacion.nodes;
habitaciones.forEach(habitacion => {
actions.createPage({
path: habitacion.slug,
component: require.resolve("./src/components/habitaciones.js"),
context: {
slug: habitacion.slug
},
defer: true,
})
});
}
|
import request from '@/utils/request'
export function queryMenuList(param) {
return request({
url: `/auth/menu/list`,
method: 'get',
params: param
})
}
export function queryRootMenu() {
return request({
url: `/auth/menu/query-root-menu`,
method: 'get'
})
}
export function saveMenu(data) {
return request({
url: `/auth/menu/save`,
method: 'post',
data
})
}
export function updateMenu(data) {
return request({
url: `/auth/menu/update`,
method: 'post',
data
})
}
export function queryAdminMenu() {
return request({
url: `/auth/menu/query-admin-menu-list`,
method: 'get'
})
}
export function removeMenu(id) {
return request({
url: `/auth/menu/remove`,
method: 'post',
params: {
id
}
})
}
|
/**
* [中等]402. 移掉K位数字
* https://leetcode-cn.com/problems/remove-k-digits/
*
*
给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小。
注意:
num 的长度小于 10002 且 ≥ k。
num 不会包含任何前导零。
示例 1 :
输入: num = "1432219", k = 3
输出: "1219"
解释: 移除掉三个数字 4, 3, 和 2 形成一个新的最小的数字 1219。
示例 2 :
输入: num = "10200", k = 1
输出: "200"
解释: 移掉首位的 1 剩下的数字为 200. 注意输出不能有任何前导零。
示例 3 :
输入: num = "10", k = 2
输出: "0"
解释: 从原数字移除所有的数字,剩余为空就是0。
1245512466 5
1234512346 5
前6个数中会有1个边成首个数字
123412345 4
112345 1
*/
/**
* @param {string} num
* @param {number} k
* @return {string}
*/
var removeKdigits = function (num, k) {
// 处理特殊
if (num.length === 0 || num.length === k) {
return '0'
} else if (k === 0) {
return num
}
for (let i = 0; i < num.length - 1; i++) {
if (num[i] > num[i + 1]) {
const pre = num.substring(0, i)
if (i === 0) {
while (i < num.length - 1 && num[i + 1] === '0') {
i++
}
}
const end = num.slice(i + 1)
return removeKdigits(pre + end, k - 1)
}
}
return removeKdigits(num.slice(0, num.length - 1), k - 1)
}
write('algorithms: 402. 移掉K位数字', 'title')
write(removeKdigits('1234567890', 9)) // 0
write(removeKdigits('112', 1)) // 11
write(removeKdigits('1107', 1)) // 107
write(removeKdigits('10', 1)) // 0
write(removeKdigits('1432219', 3)) // 1219
write(removeKdigits('123456', 3)) // 123
write(removeKdigits('10200', 1)) // 200
write(removeKdigits('10200', 2)) // 0
write(removeKdigits('10', 2)) // 0
// tag: 递归;单调栈
|
/**
* Sea.js 2.1.1 | seajs.org/LICENSE.md
*/(function(e,t){function i(e){return function(t){return Object.prototype.toString.call(t)==="[object "+e+"]"}}function l(){return f++}function m(e){return e.match(p)[0]}function g(e){e=e.replace(d,"/");while(e.match(v))e=e.replace(v,"/");return e}function y(e){var t=e.length-1,n=e.charAt(t);return n==="#"?e.substring(0,t):e.substring(t-2)===".js"||e.indexOf("?")>0||e.substring(t-3)===".css"||n==="/"?e:e+".js"}function E(e){var t=r.alias;return t&&o(t[e])?t[e]:e}function S(e){var t=r.paths,n;return t&&(n=e.match(b))&&o(t[n[1]])&&(e=t[n[1]]+n[2]),e}function x(e){var t=r.vars;return t&&e.indexOf("{")>-1&&(e=e.replace(w,function(e,n){return o(t[n])?t[n]:e})),e}function T(e){var t=r.map,n=e;if(t)for(var i=0,s=t.length;i<s;i++){var o=t[i];n=a(o)?o(e)||e:e.replace(o[0],o[1]);if(n!==e)break}return n}function k(e,t){var n,i=e.charAt(0);if(N.test(e))n=e;else if(i===".")n=g((t?m(t):r.cwd)+e);else if(i==="/"){var s=r.cwd.match(C);n=s?s[0]+e.substring(1):e}else n=r.base+e;return n}function L(e,t){if(!e)return"";e=E(e),e=S(e),e=x(e),e=y(e);var n=k(e,t);return n=T(n),n}function H(e){return e.hasAttribute?e.src:e.getAttribute("src",4)}function z(e,t,n){var r=F.test(e),i=A.createElement(r?"link":"script");if(n){var s=a(n)?n(e):n;s&&(i.charset=s)}W(i,t,r),r?(i.rel="stylesheet",i.href=e):(i.async=!0,i.src=e),q=i,j?B.insertBefore(i,j):B.appendChild(i),q=null}function W(e,t,n){var i=n&&(U||!("onload"in e));if(i){setTimeout(function(){X(e,t)},1);return}e.onload=e.onerror=e.onreadystatechange=function(){I.test(e.readyState)&&(e.onload=e.onerror=e.onreadystatechange=null,!n&&!r.debug&&B.removeChild(e),e=null,t())}}function X(e,t){var n=e.sheet,r;if(U)n&&(r=!0);else if(n)try{n.cssRules&&(r=!0)}catch(i){i.name==="NS_ERROR_DOM_SECURITY_ERR"&&(r=!0)}setTimeout(function(){r?t():X(e,t)},20)}function V(){if(q)return q;if(R&&R.readyState==="interactive")return R;var e=B.getElementsByTagName("script");for(var t=e.length-1;t>=0;t--){var n=e[t];if(n.readyState==="interactive")return R=n,R}}function K(e){var t=[];return e.replace(J,"").replace($,function(e,n,r){r&&t.push(r)}),t}function nt(e,t){this.uri=e,this.dependencies=t||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(e.seajs)return;var n=e.seajs={version:"2.1.1"},r=n.data={},s=i("Object"),o=i("String"),u=Array.isArray||i("Array"),a=i("Function"),f=0,c=r.events={};n.on=function(e,t){var r=c[e]||(c[e]=[]);return r.push(t),n},n.off=function(e,t){if(!e&&!t)return c=r.events={},n;var i=c[e];if(i)if(t)for(var s=i.length-1;s>=0;s--)i[s]===t&&i.splice(s,1);else delete c[e];return n};var h=n.emit=function(e,t){var r=c[e],i;if(r){r=r.slice();while(i=r.shift())i(t)}return n},p=/[^?#]*\//,d=/\/\.\//g,v=/\/[^/]+\/\.\.\//,b=/^([^/:]+)(\/.+)$/,w=/{([^{]+)}/g,N=/^\/\/.|:\//,C=/^.*?\/\/.*?\//,A=document,O=location,M=m(O.href),_=A.getElementsByTagName("script"),D=A.getElementById("seajsnode")||_[_.length-1],P=m(H(D)||M),B=A.getElementsByTagName("head")[0]||A.documentElement,j=B.getElementsByTagName("base")[0],F=/\.css(?:\?|$)/i,I=/^(?:loaded|complete|undefined)$/,q,R,U=navigator.userAgent.replace(/.*AppleWebKit\/(\d+)\..*/,"$1")*1<536,$=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,J=/\\\\/g,Q=n.cache={},G,Y={},Z={},et={},tt=nt.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};nt.prototype.resolve=function(){var e=this,t=e.dependencies,n=[];for(var r=0,i=t.length;r<i;r++)n[r]=nt.resolve(t[r],e.uri);return n},nt.prototype.load=function(){var e=this;if(e.status>=tt.LOADING)return;e.status=tt.LOADING;var t=e.resolve();h("load",t);var n=e._remain=t.length,r;for(var i=0;i<n;i++)r=nt.get(t[i]),r.status<tt.LOADED?r._waitings[e.uri]=(r._waitings[e.uri]||0)+1:e._remain--;if(e._remain===0){e.onload();return}var s={};for(i=0;i<n;i++)r=Q[t[i]],r.status<tt.FETCHING?r.fetch(s):r.status===tt.SAVED&&r.load();for(var o in s)s.hasOwnProperty(o)&&s[o]()},nt.prototype.onload=function(){var e=this;e.status=tt.LOADED,e.callback&&e.callback();var t=e._waitings,n,r;for(n in t)t.hasOwnProperty(n)&&(r=Q[n],r._remain-=t[n],r._remain===0&&r.onload());delete e._waitings,delete e._remain},nt.prototype.fetch=function(e){function o(){z(i.requestUri,i.onRequest,i.charset)}function u(){delete Y[s],Z[s]=!0,G&&(nt.save(n,G),G=null);var e,t=et[s];delete et[s];while(e=t.shift())e.load()}var t=this,n=t.uri;t.status=tt.FETCHING;var i={uri:n};h("fetch",i);var s=i.requestUri||n;if(!s||Z[s]){t.load();return}if(Y[s]){et[s].push(t);return}Y[s]=!0,et[s]=[t],h("request",i={uri:n,requestUri:s,onRequest:u,charset:r.charset}),i.requested||(e?e[i.requestUri]=o:o())},nt.prototype.exec=function(){function r(e){return nt.get(r.resolve(e)).exec()}var e=this;if(e.status>=tt.EXECUTING)return e.exports;e.status=tt.EXECUTING;var n=e.uri;r.resolve=function(e){return nt.resolve(e,n)},r.async=function(e,t){return nt.use(e,t,n+"_async_"+l()),r};var i=e.factory,s=a(i)?i(r,e.exports={},e):i;return s===t&&(s=e.exports),s===null&&!F.test(n)&&h("error",e),delete e.factory,e.exports=s,e.status=tt.EXECUTED,h("exec",e),s},nt.resolve=function(e,t){var n={id:e,refUri:t};return h("resolve",n),n.uri||L(n.id,t)},nt.define=function(e,n,r){var i=arguments.length;i===1?(r=e,e=t):i===2&&(r=n,u(e)?(n=e,e=t):n=t),!u(n)&&a(r)&&(n=K(r.toString()));var s={id:e,uri:nt.resolve(e),deps:n,factory:r};if(!s.uri&&A.attachEvent){var o=V();o&&(s.uri=o.src)}h("define",s),s.uri?nt.save(s.uri,s):G=s},nt.save=function(e,t){var n=nt.get(e);n.status<tt.SAVED&&(n.id=t.id||e,n.dependencies=t.deps||[],n.factory=t.factory,n.status=tt.SAVED)},nt.get=function(e,t){return Q[e]||(Q[e]=new nt(e,t))},nt.use=function(t,n,r){var i=nt.get(r,u(t)?t:[t]);i.callback=function(){var t=[],r=i.resolve();for(var s=0,o=r.length;s<o;s++)t[s]=Q[r[s]].exec();n&&n.apply(e,t),delete i.callback},i.load()},nt.preload=function(e){var t=r.preload,n=t.length;n?nt.use(t,function(){t.splice(0,n),nt.preload(e)},r.cwd+"_preload_"+l()):e()},n.use=function(e,t){return nt.preload(function(){nt.use(e,t,r.cwd+"_use_"+l())}),n},nt.define.cmd={},e.define=nt.define,n.Module=nt,r.fetchedList=Z,r.cid=l,n.resolve=L,n.require=function(e){return(Q[nt.resolve(e)]||{}).exports};var rt=/^(.+?\/)(\?\?)?(seajs\/)+/;r.base=(P.match(rt)||["",P])[1],r.dir=P,r.cwd=M,r.charset="utf-8",r.preload=function(){var e=[],t=O.search.replace(/(seajs-\w+)(&|$)/g,"$1=1$2");return t+=" "+A.cookie,t.replace(/(seajs-\w+)=1/g,function(t,n){e.push(n)}),e}(),n.config=function(e){for(var t in e){var i=e[t],o=r[t];if(o&&s(o))for(var a in i)o[a]=i[a];else u(o)?i=o.concat(i):t==="base"&&(i.slice(-1)==="/"||(i+="/"),i=k(i)),r[t]=i}return h("config",e),n}})(this),function(){var e=seajs.pluginSDK?seajs.pluginSDK.util.loaderDir:seajs.data.base,t=e.lastIndexOf("/");t==e.length-1&&(e=e.substr(0,t)),seajs.config({charset:"utf-8"}),seajs.config({paths:{bui:e}});var n=window.BUI=window.BUI||{},r=document.getElementsByTagName("script"),i=r[r.length-1];n.loaderScript=i,i.getAttribute("data-debug")=="true"?n.debug=!0:n.debug=!1,n.use=seajs.use,n.config=function(e){e.alias&&(e.paths=e.alias,delete e.alias),seajs.config(e)},n.setDebug=function(e){n.debug=e;if(e){var t=seajs.data.map,r=-1;if(t){for(var i=0;i<t.length;i++){var s=t[i];if(s[0].toString()==/.js$/.toString()&&s[1]=="-min.js"){r=i;break}}r!=-1&&t.splice(r,1)}}else seajs.config({map:[[/.js$/,"-min.js"]]})},n.setDebug(n.debug)}(),function(){var e=["bui/util","bui/ua","bui/json","bui/date","bui/array","bui/keycode","bui/observable","bui/base","bui/component"];window.KISSY&&(!window.KISSY.Node||!window.jQuery)&&e.unshift("bui/adapter"),define("bui/common",e,function(e){window.KISSY&&(!window.KISSY.Node||!window.jQuery)&&e("bui/adapter");var t=e("bui/util");return t.mix(t,{UA:e("bui/ua"),JSON:e("bui/json"),Date:e("bui/date"),Array:e("bui/array"),KeyCode:e("bui/keycode"),Observable:e("bui/observable"),Base:e("bui/base"),Component:e("bui/component")}),t})}(),window.BUI=window.BUI||{},!BUI.use&&window.seajs&&(BUI.use=seajs.use,BUI.config=seajs.config),define("bui/util",function(e){function t(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=e[r]||{},n(e[r],t[r]))}function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(n=="value"?BUI.isObject(t[n])?(e[n]=e[n]||{},BUI.mix(e[n],t[n])):BUI.isArray(t[n])?(e[n]=e[n]||[],e[n]=e[n].concat(t[n])):e[n]=t[n]:e[n]=t[n])}(function(e){e.fn&&(e.fn.on=e.fn.on||e.fn.bind,e.fn.off=e.fn.off||e.fn.unbind)})(jQuery);var r=window,i=document,s=Object.prototype,o=s.toString,u="body",a="documentElement",f="scroll",l=f+"Width",c=f+"Height",h="ATTRS",p="PARSER",d="guid";$.extend(BUI,{version:1,subVersion:96,isFunction:function(e){return typeof e=="function"},isArray:"isArray"in Array?Array.isArray:function(e){return o.call(e)==="[object Array]"},isDate:function(e){return o.call(e)==="[object Date]"},isObject:o.call(null)==="[object Object]"?function(e){return e!==null&&e!==undefined&&o.call(e)==="[object Object]"&&e.ownerDocument===undefined}:function(e){return o.call(e)==="[object Object]"},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},augment:function(e,t){if(!BUI.isFunction(e))return e;for(var n=1;n<arguments.length;n++)BUI.mix(e.prototype,arguments[n].prototype||arguments[n]);return e},cloneObject:function(e){var t=BUI.isArray(e)?[]:{};return BUI.mix(!0,t,e)},error:function(e){if(BUI.debug)throw e},extend:function(e,t,n,r){BUI.isFunction(t)||(n=t,t=e,e=function(){});var i=Object.create?function(e,t){return Object.create(e,{constructor:{value:t}})}:function(e,t){function n(){}n.prototype=e;var r=new n;return r.constructor=t,r},s=i(t.prototype,e);return e.prototype=BUI.mix(s,e.prototype),e.superclass=i(t.prototype,t),BUI.mix(s,n),BUI.mix(e,r),e},guid:function(){var e={};return function(t){return t=t||BUI.prefix+d,e[t]?e[t]+=1:e[t]=1,t+e[t]}}(),isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isBoolean:function(e){return typeof e=="boolean"},log:function(e){BUI.debug&&r.console&&r.console.log&&r.console.log(e)},merge:function(){var e=$.makeArray(arguments),t=e[0];return BUI.isBoolean(t)?(e.shift(),e.unshift({}),e.unshift(t)):e.unshift({}),BUI.mix.apply(null,e)},mix:function(){return $.extend.apply(null,arguments)},app:function(e){return window[e]||(window[e]={namespace:function(t){return BUI.namespace(t,window[e])}}),window[e]},mixAttrs:t,mixAttr:n,mixin:function(e,n,r){r=r||[h,p];var i=n;if(i){e.mixins=i;var s={},o=i.concat(e);BUI.each(o,function(e){e&&BUI.each(r,function(n){e[n]&&(s[n]=s[n]||{},n=="ATTRS"?t(s[n],e[n]):BUI.mix(s[n],e[n]))})}),BUI.each(s,function(t,n){e[n]=t});var u={};BUI.each(o,function(e){if(e){var t=e.prototype;for(var n in t)t.hasOwnProperty(n)&&(u[n]=t[n])}}),BUI.each(u,function(t,n){e.prototype[n]=t})}return e},namespace:function(e,t){t=t||BUI;if(!e)return t;var n=e.split("."),r=t;for(var i=0;i<n.length;i++){var s=n[i];r[s]||(r[s]={}),r=r[s]}return r},prefix:"bui-",substitute:function(e,t,n){return!BUI.isString(e)||!BUI.isObject(t)&&!BUI.isArray(t)?e:e.replace(n||/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===undefined?"":t[n]})},ucfirst:function(e){return e+="",e.charAt(0).toUpperCase()+e.substring(1)},isInView:function(e){var t=e.left,n=e.top,r=BUI.viewportWidth(),i=BUI.viewportHeight(),s=BUI.scrollTop(),o=BUI.scrollLeft();return t<o||t>o+r?!1:n<s||n>s+i?!1:!0},isInVerticalView:function(e){var t=BUI.viewportHeight(),n=BUI.scrollTop();return e<n||e>n+t?!1:!0},isInHorizontalView:function(e){var t=BUI.viewportWidth(),n=BUI.scrollLeft();return e<n||e>n+t?!1:!0},viewportWidth:function(){return $(window).width()},viewportHeight:function(){return $(window).height()},scrollLeft:function(){return $(window).scrollLeft()},scrollTop:function(){return $(window).scrollTop()},docWidth:function(){return Math.max(this.viewportWidth(),i[a][l],i[u][l])},docHeight:function(){return Math.max(this.viewportHeight(),i[a][c],i[u][c])},each:function(e,t){if(!e)return;$.each(e,function(e,n){return t(n,e)})},wrapBehavior:function(e,t){return e["__bui_wrap_"+t]=function(n){e.get("disabled")||e[t](n)}},getWrapBehavior:function(e,t){return e["__bui_wrap_"+t]},getControl:function(e){return BUI.Component.Manager.getComponent(e)}});var v=BUI.FormHelper={serializeToObject:function(e){var t=$(e).serializeArray(),n={};return BUI.each(t,function(e){var t=e.name;n[t]?(BUI.isArray(n[t])||(n[t]=[n[t]]),n[t].push(e.value)):n[t]=e.value}),n},setFields:function(e,t){for(var n in t)t.hasOwnProperty(n)&&BUI.FormHelper.setField(e,n,t[n])},clear:function(e){var t=$.makeArray(e.elements);BUI.each(t,function(e){e.type==="checkbox"||e.type==="radio"?$(e).attr("checked",!1):$(e).val(""),$(e).change()})},setField:function(e,t,n){var r=e.elements[t];r&&r.type?v._setFieldValue(r,n):(BUI.isArray(r)||r&&r.length)&&BUI.each(r,function(e){v._setFieldValue(e,n)})},_setFieldValue:function(e,t){e.type==="checkbox"?e.value==""+t||BUI.isArray(t)&&BUI.Array.indexOf(e.value,t)!==-1?$(e).attr("checked",!0):$(e).attr("checked",!1):e.type==="radio"?e.value==""+t?$(e).attr("checked",!0):$(e).attr("checked",!1):$(e).val(t)},getField:function(e,t){return BUI.FormHelper.serializeToObject(e)[t]}};return BUI}),define("bui/array",["bui/util"],function(e){var t=e("bui/util");return t.Array={peek:function(e){return e[e.length-1]},indexOf:function(e,t,n){var r=n==null?0:n<0?Math.max(0,t.length+n):n;for(var i=r;i<t.length;i++)if(i in t&&t[i]===e)return i;return-1},contains:function(e,n){return t.Array.indexOf(e,n)>=0},each:t.each,equals:function(e,t){if(e==t)return!0;if(!e||!t)return!1;if(e.length!=t.length)return!1;var n=!0;for(var r=0;r<e.length;r++)if(e[r]!==t[r]){n=!1;break}return n},filter:function(e,n){var r=[];return t.Array.each(e,function(e,t){n(e,t)&&r.push(e)}),r},map:function(e,n){var r=[];return t.Array.each(e,function(e,t){r.push(n(e,t))}),r},find:function(e,n){var r=t.Array.findIndex(e,n);return r<0?null:e[r]},findIndex:function(e,n){var r=-1;return t.Array.each(e,function(e,t){if(n(e,t))return r=t,!1}),r},isEmpty:function(e){return e.length==0},add:function(e,t){e.push(t)},addAt:function(e,n,r){t.Array.splice(e,r,0,n)},empty:function(e){if(!(e instanceof Array))for(var t=e.length-1;t>=0;t--)delete e[t];e.length=0},remove:function(e,n){var r=t.Array.indexOf(n,e),i;return(i=r>=0)&&t.Array.removeAt(e,r),i},removeAt:function(e,n){return t.Array.splice(e,n,1).length==1},slice:function(e,t,n){return arguments.length<=2?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,n)},splice:function(e,n,r,i){return Array.prototype.splice.apply(e,t.Array.slice(arguments,1))}},t.Array}),define("bui/observable",["bui/util"],function(e){function r(){return new n}var t=e("bui/util"),n=function(){this._init()};t.augment(n,{_functions:null,_init:function(){var e=this;e._functions=[]},add:function(e){this._functions.push(e)},remove:function(e){var n=this._functions;index=t.Array.indexOf(e,n),index>=0&&n.splice(index,1)},empty:function(){var e=this._functions.length;this._functions.splice(0,e)},pause:function(){this._paused=!0},resume:function(){this._paused=!1},fireWith:function(e,n){var r=this,i;if(this._paused)return;return t.each(r._functions,function(t){i=t.apply(e,n);if(i===!1)return!1}),i}});var i=function(e){this._events=[],this._eventMap={},this._bubblesEvents=[],this._initEvents(e)};return t.augment(i,{_events:[],_eventMap:{},_bubblesEvents:[],_bubbleTarget:null,_getCallbacks:function(e){var t=this,n=t._eventMap;return n[e]},_initEvents:function(e){var t=this,n=null;if(!e)return;n=e.listeners||{},e.handler&&(n.click=e.handler);if(n)for(var r in n)n.hasOwnProperty(r)&&t.on(r,n[r])},_isBubbles:function(e){return t.Array.indexOf(e,this._bubblesEvents)>=0},addTarget:function(e){this._bubbleTarget=e},addEvents:function(e){function o(e){t.Array.indexOf(e,i)===-1&&(s[e]=r(),i.push(e))}var n=this,i=n._events,s=n._eventMap;t.isArray(e)?$.each(e,function(e,t){o(t)}):o(e)},clearListeners:function(){var e=this,t=e._eventMap;for(var n in t)t.hasOwnProperty(n)&&t[n].empty()},fire:function(e,t){var n=this,r=n._getCallbacks(e),i=$.makeArray(arguments),s;t||(t={},i.push(t)),t.target||(t.target=n),r&&(s=r.fireWith(n,Array.prototype.slice.call(i,1)));if(n._isBubbles(e)){var o=n._bubbleTarget;o&&o.fire&&o.fire(e,t)}return s},pauseEvent:function(e){var t=this,n=t._getCallbacks(e);n&&n.pause()},resumeEvent:function(e){var t=this,n=t._getCallbacks(e);n&&n.resume()},on:function(e,n){var r=e.split(" "),i=this,s=null;return r.length>1?t.each(r,function(e){i.on(e,n)}):(s=i._getCallbacks(e),s?s.add(n):(i.addEvents(e),i.on(e,n))),i},off:function(e,t){if(!e&&!t)return this.clearListeners(),this;var n=this,r=n._getCallbacks(e);return r&&(t?r.remove(t):r.empty()),n},publish:function(e,n){var r=this,i=r._bubblesEvents;if(n.bubbles)t.Array.indexOf(e,i)===-1&&i.push(e);else{var s=t.Array.indexOf(e,i);s!==-1&&i.splice(s,1)}}}),i}),define("bui/ua",function(){function e(e){var t=0;return parseFloat(e.replace(/\./g,function(){return t++===0?".":""}))}function t(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],n={browser:t[1]||"",version:t[2]||"0"},r={};return n.browser&&(r[n.browser]=!0,r.version=n.version),r.chrome?r.webkit=!0:r.webkit&&(r.safari=!0),r}var n=$.UA||function(){var n=$.browser||t(navigator.userAgent),r=e(n.version),i={ie:n.msie&&r,webkit:n.webkit&&r,opera:n.opera&&r,mozilla:n.mozilla&&r};return i}();return n}),define("bui/json",["bui/ua"],function(e){function i(e){return e<10?"0"+e:e}function c(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,function(e){var t=f[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function h(e,t){var n,r,i,s,o=u,f,p=t[e];p&&typeof p=="object"&&typeof p.toJSON=="function"&&(p=p.toJSON(e)),typeof l=="function"&&(p=l.call(t,e,p));switch(typeof p){case"string":return c(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";u+=a,f=[];if(Object.prototype.toString.apply(p)==="[object Array]"){s=p.length;for(n=0;n<s;n+=1)f[n]=h(n,p)||"null";return i=f.length===0?"[]":u?"[\n"+u+f.join(",\n"+u)+"\n"+o+"]":"["+f.join(",")+"]",u=o,i}if(l&&typeof l=="object"){s=l.length;for(n=0;n<s;n+=1)r=l[n],typeof r=="string"&&(i=h(r,p),i&&f.push(c(r)+(u?": ":":")+i))}else for(r in p)Object.hasOwnProperty.call(p,r)&&(i=h(r,p),i&&f.push(c(r)+(u?": ":":")+i));return i=f.length===0?"{}":u?"{\n"+u+f.join(",\n"+u)+"\n"+o+"}":"{"+f.join(",")+"}",u=o,i}}function p(e){try{return(new Function("return "+e+";"))()}catch(t){throw"Json parse error!"}}var t=window,n=e("bui/ua"),r=t.JSON;if(!r||n.ie<9)r=t.JSON={};typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+i(this.getUTCMonth()+1)+"-"+i(this.getUTCDate())+"T"+i(this.getUTCHours())+":"+i(this.getUTCMinutes())+":"+i(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var s=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,u,a,f={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;typeof r.stringify!="function"&&(r.stringify=function(e,t,n){var r;u="",a="";if(typeof n=="number")for(r=0;r<n;r+=1)a+=" ";else typeof n=="string"&&(a=n);l=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return h("",{"":e});throw new Error("JSON.stringify")});var r={parse:$.parseJSON,looseParse:p,stringify:r.stringify};return r}),define("bui/keycode",function(){var e={BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123};return e}),define("bui/date",function(){function t(e,n){if(e instanceof Date)return e;if(typeof n=="undefined"||n==null||n==""){var r=new Array("y-m-d","yyyy-mm-dd","yyyy-mm-dd HH:MM:ss","H:M:s");for(var i=0;i<r.length;i++){var s=t(e,r[i]);if(s!=null)return s}return null}e+="";var o=0,u=0,a="",f="",l,c,h=new Date,p=h.getYear(),d=h.getMonth()+1,v=1,m=0,g=0,y=0;this.isInteger=function(e){return/^\d*$/.test(e)},this.getInt=function(e,t,n,r){for(var i=r;i>=n;i--){var s=e.substring(t,t+i);if(s.length<n)return null;if(this.isInteger(s))return s}return null};while(u<n.length){a=n.charAt(u),f="";while(n.charAt(u)==a&&u<n.length)f+=n.charAt(u++);if(f=="yyyy"||f=="yy"||f=="y"){f=="yyyy"&&(l=4,c=4),f=="yy"&&(l=2,c=2),f=="y"&&(l=2,c=4),p=this.getInt(e,o,l,c);if(p==null)return null;o+=p.length,p.length==2&&(p=p>70?1900+(p-0):2e3+(p-0))}else if(f=="mm"||f=="m"){d=this.getInt(e,o,f.length,2);if(d==null||d<1||d>12)return null;o+=d.length}else if(f=="dd"||f=="d"){v=this.getInt(e,o,f.length,2);if(v==null||v<1||v>31)return null;o+=v.length}else if(f=="hh"||f=="h"){m=this.getInt(e,o,f.length,2);if(m==null||m<1||m>12)return null;o+=m.length}else if(f=="HH"||f=="H"){m=this.getInt(e,o,f.length,2);if(m==null||m<0||m>23)return null;o+=m.length}else if(f=="MM"||f=="M"){g=this.getInt(e,o,f.length,2);if(g==null||g<0||g>59)return null;o+=g.length}else if(f=="ss"||f=="s"){y=this.getInt(e,o,f.length,2);if(y==null||y<0||y>59)return null;o+=y.length}else{if(e.substring(o,o+f.length)!=f)return null;o+=f.length}}if(o!=e.length)return null;if(d==2)if(p%4==0&&p%100!=0||p%400==0){if(v>29)return null}else if(v>28)return null;if(d==4||d==6||d==9||d==11)if(v>30)return null;return new Date(p,d-1,v,m,g,y)}function n(e,t,n){var r=new Date(n);isNaN(r)&&(r=new Date),t=parseInt(t,10);switch(e){case"s":r=new Date(r.getTime()+1e3*t);break;case"n":r=new Date(r.getTime()+6e4*t);break;case"h":r=new Date(r.getTime()+36e5*t);break;case"d":r=new Date(r.getTime()+864e5*t);break;case"w":r=new Date(r.getTime()+6048e5*t);break;case"m":r=new Date(r.getFullYear(),r.getMonth()+t,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds());break;case"y":r=new Date(r.getFullYear()+t,r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds())}return r}var e=/^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/,r=function(){var e=/w{1}|d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g,r=function(e,t){e=String(e),t=t||2;while(e.length<t)e="0"+e;return e},i={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUTCDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",localShortDate:"yy\u5e74mm\u6708dd\u65e5",localShortDateTime:"yy\u5e74mm\u6708dd\u65e5 hh:MM:ss TT",localLongDate:"yyyy\u5e74mm\u6708dd\u65e5",localLongDateTime:"yyyy\u5e74mm\u6708dd\u65e5 hh:MM:ss TT",localFullDate:"yyyy\u5e74mm\u6708dd\u65e5 w",localFullDateTime:"yyyy\u5e74mm\u6708dd\u65e5 w hh:MM:ss TT"},s={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};return function(o,u,a){arguments.length===1&&Object.prototype.toString.call(o)==="[object String]"&&!/\d/.test(o)&&(u=o,o=undefined),o=o?new Date(o):new Date;if(isNaN(o))throw SyntaxError("invalid date");u=String(i[u]||u||i["default"]),u.slice(0,4)==="UTC:"&&(u=u.slice(4),a=!0);var f=a?"getUTC":"get",l=o[f+"Date"](),c=o[f+"Day"](),h=o[f+"Month"](),p=o[f+"FullYear"](),d=o[f+"Hours"](),v=o[f+"Minutes"](),m=o[f+"Seconds"](),g=o[f+"Milliseconds"](),y=a?0:o.getTimezoneOffset(),b={d:l,dd:r(l,undefined),ddd:s.dayNames[c],dddd:s.dayNames[c+7],w:s.dayNames[c+14],m:h+1,mm:r(h+1,undefined),mmm:s.monthNames[h],mmmm:s.monthNames[h+12],yy:String(p).slice(2),yyyy:p,h:d%12||12,hh:r(d%12||12,undefined),H:d,HH:r(d,undefined),M:v,MM:r(v,undefined),s:m,ss:r(m,undefined),l:r(g,3),L:r(g>99?Math.round(g/10):g,undefined),t:d<12?"a":"p",tt:d<12?"am":"pm",T:d<12?"A":"P",TT:d<12?"AM":"PM",Z:a?"UTC":(String(o).match(t)||[""]).pop().replace(n,""),o:(y>0?"-":"+")+r(Math.floor(Math.abs(y)/60)*100+Math.abs(y)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!==10)*l%10]};return u.replace(e,function(e){return e in b?b[e]:e.slice(1,e.length-1)})}}(),i={add:function(e,t,r){return n(e,t,r)},addHour:function(e,t){return n("h",e,t)},addMinute:function(e,t){return n("n",e,t)},addSecond:function(e,t){return n("s",e,t)},addDay:function(e,t){return n("d",e,t)},addWeek:function(e,t){return n("w",e,t)},addMonths:function(e,t){return n("m",e,t)},addYear:function(e,t){return n("y",e,t)},isDateEquals:function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()},isEquals:function(e,t){return e==t?!0:!e||!t?!1:!e.getTime||!t.getTime?!1:e.getTime()==t.getTime()},isDateString:function(t){return e.test(t)},format:function(e,t,n){return r(e,t,n)},parse:function(e,n){return BUI.isString(e)&&(e=e.replace("/","-")),t(e,n)},today:function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},getDate:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}};return i}),define("bui/base",["bui/observable"],function(e){function r(e,t,n){var r=e[t]||{};return n&&(e[t]=r),r}function i(e,t){return BUI.isString(t)?e[t]:t}function s(e,t,n,r,i){var s=n;return e.fire(t+BUI.ucfirst(n)+"Change",{attrName:s,prevVal:r,newVal:i})}function o(e,t,n,r,i){r=r||{};var o,u,a;return a=e.get(t),!$.isPlainObject(n)&&!BUI.isArray(n)&&a===n?undefined:!r.silent&&!1===s(e,"before",t,a,n)?!1:(o=e._set(t,n,r),o===!1?o:(r.silent||(n=e.__attrVals[t],s(e,"after",t,a,n)),e))}function u(e){if(e._attrs||e==a)return;var t=e.superclass.constructor;t&&!t._attrs&&u(t),e._attrs={},BUI.mixAttrs(e._attrs,t._attrs),BUI.mixAttrs(e._attrs,e.ATTRS)}var t={},n=e("bui/observable"),a=function(e){var t=this,r=t.constructor,i=[];this.__attrs={},this.__attrVals={},n.apply(this,arguments);while(r)i.push(r),r.extensions&&(BUI.mixin(r,r.extensions),delete r.extensions),r=r.superclass?r.superclass.constructor:null;var s=t.constructor;u(s),t._initStaticAttrs(s._attrs),t._initAttrs(e)};return a.INVALID=t,BUI.extend(a,n),BUI.augment(a,{_initStaticAttrs:function(e){var t=this,n;n=t.__attrs={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];i.shared===!1||i.valueFn?(n[r]={},BUI.mixAttr(n[r],e[r])):n[r]=e[r]}},addAttr:function(e,t,n){var r=this,i=r.__attrs,s=i[e];s||(s=i[e]={});for(var o in t)t.hasOwnProperty(o)&&(o=="value"?BUI.isObject(t[o])?(s[o]=s[o]||{},BUI.mix(s[o],t[o])):BUI.isArray(t[o])?(s[o]=s[o]||[],BUI.mix(s[o],t[o])):s[o]=t[o]:s[o]=t[o]);return r},addAttrs:function(e,t,n){var r=this;return e?(typeof t=="boolean"&&(n=t,t=null),BUI.each(e,function(e,t){r.addAttr(t,e,n)}),t&&r.set(t),r):r},hasAttr:function(e){return e&&this.__attrs.hasOwnProperty(e)},getAttrs:function(){return this.__attrs},getAttrVals:function(){return this.__attrVals},get:function(e){var t=this,n=t.__attrVals,s,o,u;return s=r(t.__attrs,e),o=s.getter,u=e in n?n[e]:t._getDefAttrVal(e),o&&(o=i(t,o))&&(u=o.call(t,u,e)),u},clearAttrVals:function(){this.__attrVals={}},removeAttr:function(e){var t=this;return t.hasAttr(e)&&(delete t.__attrs[e],delete t.__attrVals[e]),t},set:function(e,t,n){var r=this;if($.isPlainObject(e)){n=t;var i=Object(e),s=[];for(e in i)i.hasOwnProperty(e)&&o(r,e,i[e],n);return r}return o(r,e,t,n)},setInternal:function(e,t,n){return this._set(e,t,n)},_getDefAttrVal:function(e){var t=this,n=t.__attrs,s=r(n,e),o=s.valueFn,u;return o&&(o=i(t,o))&&(u=o.call(t),u!==undefined&&(s.value=u),delete s.valueFn,n[e]=s),s.value},_set:function(e,n,s){var o=this,u,a=r(o.__attrs,e,!0),f=a.setter;return f&&(f=i(o,f))&&(u=f.call(o,n,e)),u===t?!1:(u!==undefined&&(n=u),o.__attrVals[e]=n,o)},_initAttrs:function(e){var t=this;if(e)for(var n in e)e.hasOwnProperty(n)&&t._set(n,e[n])}}),a}),define("bui/component",["bui/component/manage","bui/component/uibase","bui/component/view","bui/component/controller"],function(e){function n(e,n){var r,i;return e&&(i=e.xclass)&&(n&&!e.prefixCls&&(e.prefixCls=n.get("prefixCls")),r=t.Manager.getConstructorByXClass(i),r||BUI.error("can not find class by xclass desc : "+i),e=new r(e)),e}var t={};return BUI.mix(t,{Manager:e("bui/component/manage"),UIBase:e("bui/component/uibase"),View:e("bui/component/view"),Controller:e("bui/component/controller")}),t.create=n,t}),define("bui/component/manage",function(e){function n(e){var n=e.split(/\s+/),r=-1,i,s=null;for(var o=0;o<n.length;o++){var u=t[n[o]];u&&(i=u.priority)>r&&(r=i,s=u.constructor)}return s}function r(e){for(var n in t){var r=t[n];if(r.constructor==e)return n}return 0}function i(e,n){BUI.isFunction(n)?t[e]={constructor:n,priority:0}:(n.priority=n.priority||0,t[e]=n)}function s(e){var t=$.trim(e).split(/\s+/);for(var n=0;n<t.length;n++)t[n]&&(t[n]=this.get("prefixCls")+t[n]);return t.join(" ")}var t={},o={},u={__instances:o,addComponent:function(e,t){o[e]=t},removeComponent:function(e){delete o[e]},eachComponent:function(e){BUI.each(o,e)},getComponent:function(e){return o[e]},getCssClassWithPrefix:s,getXClassByConstructor:r,getConstructorByXClass:n,setConstructorByXClass:i};return u}),function(){var e="bui/component/uibase/";define("bui/component/uibase",[e+"base",e+"align",e+"autoshow",e+"autohide",e+"close",e+"collapsable",e+"drag",e+"keynav",e+"list",e+"listitem",e+"mask",e+"position",e+"selection",e+"stdmod",e+"decorate",e+"tpl",e+"childcfg",e+"bindable",e+"depends"],function(t){var n=t(e+"base");return BUI.mix(n,{Align:t(e+"align"),AutoShow:t(e+"autoshow"),AutoHide:t(e+"autohide"),Close:t(e+"close"),Collapsable:t(e+"collapsable"),Drag:t(e+"drag"),KeyNav:t(e+"keynav"),List:t(e+"list"),ListItem:t(e+"listitem"),Mask:t(e+"mask"),Position:t(e+"position"),Selection:t(e+"selection"),StdMod:t(e+"stdmod"),Decorate:t(e+"decorate"),Tpl:t(e+"tpl"),ChildCfg:t(e+"childcfg"),Bindable:t(e+"bindable"),Depends:t(e+"depends")}),BUI.mix(n,{CloseView:n.Close.View,CollapsableView:n.Collapsable.View,ChildList:n.List.ChildList,ListItemView:n.ListItem.View,MaskView:n.Mask.View,PositionView:n.Position.View,StdModView:n.StdMod.View,TplView:n.Tpl.View}),n})}(),define("bui/component/uibase/base",["bui/component/manage"],function(e){function u(e,t){a(e,"initializer","constructor")}function a(e,t,n){var r=e.constructor,i=[],s,o,u,a;while(r){a=[];if(u=r.mixins)for(var f=0;f<u.length;f++)s=u[f],s&&(n!="constructor"&&(s.prototype.hasOwnProperty(n)?s=s.prototype[n]:s=null),s&&a.push(s));r.prototype.hasOwnProperty(t)&&(o=r.prototype[t])&&a.push(o),a.length&&i.push.apply(i,a.reverse()),r=r.superclass&&r.superclass.constructor}for(f=i.length-1;f>=0;f--)i[f]&&i[f].call(e)}function f(e){var t=e.constructor,n,r,i;while(t){t.prototype.hasOwnProperty("destructor")&&t.prototype.destructor.apply(e);if(n=t.mixins)for(i=n.length-1;i>=0;i--)r=n[i]&&n[i].prototype.__destructor,r&&r.apply(e);t=t.superclass&&t.superclass.constructor}}function l(e){if(!e)return;BUI.each(e,function(t,n){BUI.isFunction(t)&&(e[n]=new t)})}function c(e,t,n){if(!t)return;BUI.each(t,function(t,r){t[n]&&t[n](e)})}function h(e){}function p(e){var t,r,s=e.getAttrs();for(var o in s)if(s.hasOwnProperty(o)){var u=n+i(o);(r=e[u])&&s[o].sync!==!1&&(t=e.get(o))!==undefined&&r.call(e,t)}}function v(e){var t=[];while(e.base)t.push(e),e=e.base;for(var n=t.length-1;n>=0;n--){var r=t[n];BUI.mix(r.prototype,r.px),BUI.mix(r,r.sx),r.base=null,r.px=null,r.sx=null}}var t=e("bui/component/manage"),n="_uiSet",r="ATTRS",i=BUI.ucfirst,s=$.noop,o=e("bui/base"),d=function(e){var t=this,n;o.apply(t,arguments),t.setInternal("userConfig",e)
,u(t,e);var r,i,s=t.get("plugins");l(s);var a=t.get("xclass");a&&(t.__xclass=a),c(t,s,"initializer"),e&&e.autoRender&&t.render()};return d.ATTRS={userConfig:{},autoRender:{value:!1},listeners:{value:{}},plugins:{},rendered:{value:!1},xclass:{valueFn:function(){return t.getXClassByConstructor(this.constructor)}}},BUI.extend(d,o),BUI.augment(d,{create:function(){var e=this;return e.get("created")||(e.fire("beforeCreateDom"),a(e,"createDom","__createDom"),e._set("created",!0),e.fire("afterCreateDom"),c(e,e.get("plugins"),"createDom")),e},render:function(){var e=this;if(!e.get("rendered")){var t=e.get("plugins");e.create(undefined),e.set("created",!0),e.fire("beforeRenderUI"),a(e,"renderUI","__renderUI"),e.fire("afterRenderUI"),c(e,t,"renderUI"),e.fire("beforeBindUI"),h(e),a(e,"bindUI","__bindUI"),e.set("binded",!0),e.fire("afterBindUI"),c(e,t,"bindUI"),e.fire("beforeSyncUI"),p(e),a(e,"syncUI","__syncUI"),e.fire("afterSyncUI"),c(e,t,"syncUI"),e._set("rendered",!0)}return e},createDom:s,renderUI:s,bindUI:s,syncUI:s,destroy:function(){var e=this;return e.destroyed?e:(e.fire("beforeDestroy"),c(e,e.get("plugins"),"destructor"),f(e),e.fire("afterDestroy"),e.off(),e.clearAttrVals(),e.destroyed=!0,e)}}),BUI.mix(d,{define:function(e,t,n,r){function i(){var e=this.constructor;e.base&&v(e),d.apply(this,arguments)}return $.isPlainObject(t)&&(r=n,n=t,t=[]),BUI.extend(i,e),i.base=e,i.px=n,i.sx=r,t.length&&(i.extensions=t),i},extend:function m(e,n,r){var i=$.makeArray(arguments),s,o=i[i.length-1];i.unshift(this),o.xclass&&(i.pop(),i.push(o.xclass)),s=d.define.apply(d,i);if(o.xclass){var u=o.priority||(this.priority?this.priority+1:1);t.setConstructorByXClass(o.xclass,{constructor:s,priority:u}),s.__xclass=o.xclass,s.priority=u,s.toString=function(){return o.xclass}}return s.extend=m,s}}),d}),define("bui/component/uibase/align",["bui/ua"],function(e){function i(e){var t=e.ownerDocument,n=t.body,r,i=$(e).css("position"),s=i=="fixed"||i=="absolute";if(!s)return e.nodeName.toLowerCase()=="html"?null:e.parentNode;for(r=e.parentNode;r&&r!=n;r=r.parentNode){i=$(r).css("position");if(i!="static")return r}return null}function s(e){var n={left:0,right:Infinity,top:0,bottom:Infinity},s,o,u,a,f=e.ownerDocument,l=f.body,c=f.documentElement;for(s=e;s=i(s);)if((!t.ie||s.clientWidth!=0)&&s!=l&&s!=c&&$(s).css("overflow")!="visible"){var h=$(s).offset();h.left+=s.clientLeft,h.top+=s.clientTop,n.top=Math.max(n.top,h.top),n.right=Math.min(n.right,h.left+s.clientWidth),n.bottom=Math.min(n.bottom,h.top+s.clientHeight),n.left=Math.max(n.left,h.left)}return o=$(r).scrollLeft(),u=$(r).scrollTop(),n.left=Math.max(n.left,o),n.top=Math.max(n.top,u),a={width:BUI.viewportWidth(),height:BUI.viewportHeight()},n.right=Math.min(n.right,o+a.width),n.bottom=Math.min(n.bottom,u+a.height),n.top>=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function o(e,t,n,r){var i,s,o,u;return i={left:e.left,top:e.top},o=d(t,n[0]),u=d(e,n[1]),s=[u.left-o.left,u.top-o.top],{left:i.left-s[0]+ +r[0],top:i.top-s[1]+ +r[1]}}function u(e,t,n){return e.left<n.left||e.left+t.width>n.right}function a(e,t,n){return e.top<n.top||e.top+t.height>n.bottom}function f(e,t,n,r){var i=BUI.cloneObject(e),s={width:t.width,height:t.height};return r.adjustX&&i.left<n.left&&(i.left=n.left),r.resizeWidth&&i.left>=n.left&&i.left+s.width>n.right&&(s.width-=i.left+s.width-n.right),r.adjustX&&i.left+s.width>n.right&&(i.left=Math.max(n.right-s.width,n.left)),r.adjustY&&i.top<n.top&&(i.top=n.top),r.resizeHeight&&i.top>=n.top&&i.top+s.height>n.bottom&&(s.height-=i.top+s.height-n.bottom),r.adjustY&&i.top+s.height>n.bottom&&(i.top=Math.max(n.bottom-s.height,n.top)),BUI.mix(i,s)}function l(e,t,n){var r=[];return $.each(e,function(e,i){r.push(i.replace(t,function(e){return n[e]}))}),r}function c(e,t){return e[t]=-e[t],e}function h(){}function p(e){var t,n,r;return e.length&&!$.isWindow(e[0])?(t=e.offset(),n=e.outerWidth(),r=e.outerHeight()):(t={left:BUI.scrollLeft(),top:BUI.scrollTop()},n=BUI.viewportWidth(),r=BUI.viewportHeight()),t.width=n,t.height=r,t}function d(e,t){var n=t.charAt(0),r=t.charAt(1),i=e.width,s=e.height,o,u;return o=e.left,u=e.top,n==="c"?u+=s/2:n==="b"&&(u+=s),r==="c"?o+=i/2:r==="r"&&(o+=i),{left:o,top:u}}function v(e){var t=e.attr("class"),r=new RegExp("s?"+n+"[a-z]{2}-[a-z]{2}","ig"),i=r.exec(t);i&&e.removeClass(i.join(" "))}var t=e("bui/ua"),n="x-align-",r=window;return h.__getOffsetParent=i,h.__getVisibleRectForElement=s,h.ATTRS={align:{shared:!1,value:{}}},h.prototype={_uiSetAlign:function(e,t){var r="",i,s;e&&e.points&&(this.align(e.node,e.points,e.offset,e.overflow),this.set("cachePosition",null),i=this.get("el"),v(i),s=e.points.join("-"),r=n+s,i.addClass(r))},__bindUI:function(){var e=this,t=BUI.wrapBehavior(e,"handleWindowResize");e.on("show",function(){$(window).on("resize",t)}),e.on("hide",function(){$(window).off("resize",t)})},handleWindowResize:function(){var e=this,t=e.get("align");e.set("align",t)},align:function(e,t,n,i){e=$(e||r),n=n&&[].concat(n)||[0,0],i=i||{};var h=this,d=h.get("el"),v=0,m=s(d[0]),g=p(d),y=p(e),b=o(g,y,t,n),w=BUI.merge(g,b);if(m&&(i.adjustX||i.adjustY)){u(b,g,m)&&(v=1,t=l(t,/[lr]/ig,{l:"r",r:"l"}),n=c(n,0)),a(b,g,m)&&(v=1,t=l(t,/[tb]/ig,{t:"b",b:"t"}),n=c(n,1)),v&&(b=o(g,y,t,n),BUI.mix(w,b));var E={};E.adjustX=i.adjustX&&u(b,g,m),E.adjustY=i.adjustY&&a(b,g,m);if(E.adjustX||E.adjustY)w=f(b,g,m,E)}return w.left!=g.left&&(h.setInternal("x",null),h.get("view").setInternal("x",null),h.set("x",w.left)),w.top!=g.top&&(h.setInternal("y",null),h.get("view").setInternal("y",null),h.set("y",w.top)),w.width!=g.width&&d.width(d.width()+w.width-g.width),w.height!=g.height&&d.height(d.height()+w.height-g.height),h},center:function(e){var t=this;return t.set("align",{node:e,points:["cc","cc"],offset:[0,0]}),t}},h}),define("bui/component/uibase/autoshow",function(){function e(){}return e.ATTRS={trigger:{},delegateTigger:{getter:function(){this.get("delegateTrigger")},setter:function(e){this.set("delegateTrigger",e)}},delegateTrigger:{value:!1},autoAlign:{value:!0},autoFocused:{value:!0},triggerActiveCls:{},curTrigger:{},triggerCallback:{},triggerEvent:{value:"click"},triggerHideEvent:{},events:{value:{triggerchange:!1}}},e.prototype={__createDom:function(){this._setTrigger()},__bindUI:function(){var e=this,t=e.get("triggerActiveCls");t&&e.on("hide",function(){var n=e.get("curTrigger");n&&n.removeClass(t)})},_setTrigger:function(){function a(t){if(e.get("disabled"))return;var n=e.get("curTrigger"),s=o?$(t.currentTarget):$(this),u=e.get("align");if(!n||n[0]!=s[0])n&&n.removeClass(i),e.set("curTrigger",s),e.fire("triggerchange",{prevTrigger:n,curTrigger:s});s.addClass(i),e.get("autoAlign")&&(u.node=s),e.set("align",u),e.show(),r&&r(t)}function f(t){var n=t.toElement||t.relatedTarget;(!n||!e.containsElement(n))&&e.hide()}var e=this,t=e.get("triggerEvent"),n=e.get("triggerHideEvent"),r=e.get("triggerCallback"),i=e.get("triggerActiveCls")||"",s=e.get("trigger"),o=e.get("delegateTrigger"),u=$(s);t&&(o&&BUI.isString(s)?$(document).delegate(s,t,a):u.on(t,a)),n&&(o&&BUI.isString(s)?$(document).delegate(s,n,f):u.on(n,f))},__renderUI:function(){var e=this,t=e.get("align");t&&!t.node&&(t.node=e.get("render")||e.get("trigger"))}},e}),define("bui/component/uibase/autohide",function(){function n(e,t){var n=e.get("hideExceptNode");return n&&n.length?$.contains(n[0],t):!1}function r(){}var e=BUI.wrapBehavior,t=BUI.getWrapBehavior;return r.ATTRS={autoHideType:{value:"click"},autoHide:{value:!1},hideExceptNode:{},events:{value:{autohide:!1}}},r.prototype={__bindUI:function(){var e=this;e.on("afterVisibleChange",function(t){var n=t.newVal;e.get("autoHide")&&(n?e._bindHideEvent():e._clearHideEvent())})},handleMoveOuter:function(e){var t=this,r=e.toElement||e.relatedTarget;!t.containsElement(r)&&!n(t,r)&&t.fire("autohide")!==!1&&t.hide()},handleDocumentClick:function(e){var t=this,r=e.target;!t.containsElement(r)&&!n(t,r)&&t.fire("autohide")!==!1&&t.hide()},_bindHideEvent:function(){var t=this,n=t.get("curTrigger"),r=t.get("autoHideType");r==="click"?$(document).on("mousedown",e(t,"handleDocumentClick")):(t.get("el").on("mouseleave",e(t,"handleMoveOuter")),n&&$(n).on("mouseleave",e(t,"handleMoveOuter")))},_clearHideEvent:function(){var e=this,n=e.get("curTrigger"),r=e.get("autoHideType");r==="click"?$(document).off("mousedown",t(e,"handleDocumentClick")):(e.get("el").off("mouseleave",t(e,"handleMoveOuter")),n&&$(n).off("mouseleave",t(e,"handleMoveOuter")))}},r}),define("bui/component/uibase/close",function(){function t(e){return $(e.get("closeTpl"))}function n(){}function r(){}var e=BUI.prefix+"ext-";n.ATTRS={closeTpl:{value:'<a tabindex="0" href=\'javascript:void("\u5173\u95ed")\' role="button" class="'+e+"close"+'">'+'<span class="'+e+"close-x"+'">\u5173\u95ed<'+"/span>"+"<"+"/a>"},closeable:{value:!0},closeBtn:{}},n.prototype={_uiSetCloseable:function(e){var n=this,r=n.get("closeBtn");e?(r||n.setInternal("closeBtn",r=t(n)),r.appendTo(n.get("el"),undefined)):r&&r.remove()}};var i="hide";r.ATTRS={closeTpl:{view:!0},closeable:{view:1},closeBtn:{view:1},closeAction:{value:i}};var s={hide:i,destroy:"destroy",remove:"remove"};return r.prototype={_uiSetCloseable:function(e){var t=this;e&&!t.__bindCloseEvent&&(t.__bindCloseEvent=1,t.get("closeBtn").on("click",function(e){t.fire("closeclick",{domTarget:e.target})!==!1&&t.close(),e.preventDefault()}))},__destructor:function(){var e=this.get("closeBtn");e&&e.detach()},close:function(){var e=this,t=s[e.get("closeAction")||i];e.fire("closing",{action:t})!==!1&&(e.fire("beforeclosed",{action:t}),t=="remove"?e[t](!0):e[t](),e.fire("closed",{action:t}))}},r.View=n,r}),define("bui/component/uibase/drag",function(){function r(){var e=$(n).css("opacity",0).prependTo("body");return e}var e=BUI.guid("drag"),t=function(){};t.ATTRS={dragNode:{},draging:{setter:function(e){if(e===!0)return{}},value:null},constraint:{},dragBackEl:{getter:function(){return $("#"+e)}}};var n='<div id="'+e+'" style="background-color: red; position: fixed; left: 0px; width: 100%; height: 100%; top: 0px; cursor: move; z-index: 999999; display: none; "></div>';return t.prototype={__bindUI:function(){function r(n){var r=e.get("draging");r&&(n.preventDefault(),e._dragMoveTo(n.pageX,n.pageY,r,t))}function i(t){if(t.which==1){e.set("draging",!1);var n=e.get("dragBackEl");n&&n.hide(),o()}}function s(){$(document).on("mousemove",r),$(document).on("mouseup",i)}function o(){$(document).off("mousemove",r),$(document).off("mouseup",i)}var e=this,t=e.get("constraint"),n=e.get("dragNode");if(!n)return;n.on("mousedown",function(t){t.which==1&&(t.preventDefault(),e.set("draging",{elX:e.get("x"),elY:e.get("y"),startX:t.pageX,startY:t.pageY}),s())})},_dragMoveTo:function(e,t,n,i){var s=this,o=s.get("dragBackEl"),n=n||s.get("draging"),u=n.startX-e,a=n.startY-t;o.length||(o=r()),o.css({cursor:"move",display:"block"}),s.set("xy",[s._getConstrainX(n.elX-u,i),s._getConstrainY(n.elY-a,i)])},_getConstrainX:function(e,t){var n=this,r=n.get("el").outerWidth(),i=e+r,s=n.get("x");if(t){var o=t.offset();return o.left>=e?o.left:o.left+t.width()<i?o.left+t.width()-r:e}return BUI.isInHorizontalView(e)&&BUI.isInHorizontalView(i)?e:s},_getConstrainY:function(e,t){var n=this,r=n.get("el").outerHeight(),i=e+r,s=n.get("y");if(t){var o=t.offset();return o.top>e?o.top:o.top+t.height()<i?o.top+t.height()-r:e}return BUI.isInVerticalView(e)&&BUI.isInVerticalView(i)?e:s}},t}),define("bui/component/uibase/keynav",["bui/keycode"],function(e){var t=e("bui/keycode"),n=BUI.wrapBehavior,r=BUI.getWrapBehavior,i=function(){};return i.ATTRS={allowKeyNav:{value:!0},navEvent:{value:"keydown"},ignoreInputFields:{value:!0}},i.prototype={__bindUI:function(){},_uiSetAllowKeyNav:function(e){var t=this,i=t.get("navEvent"),s=t.get("el");e?s.on(i,n(t,"_handleKeyDown")):s.off(i,r(t,"_handleKeyDown"))},_handleKeyDown:function(e){var n=this,r=n.get("ignoreInputFields"),i=e.which;if(r&&$(e.target).is("input,select,textarea"))return;switch(i){case t.UP:e.preventDefault(),n.handleNavUp(e);break;case t.DOWN:e.preventDefault(),n.handleNavDown(e);break;case t.RIGHT:e.preventDefault(),n.handleNavRight(e);break;case t.LEFT:e.preventDefault(),n.handleNavLeft(e);break;case t.ENTER:n.handleNavEnter(e);break;case t.ESC:n.handleNavEsc(e);break;case t.TAB:n.handleNavTab(e);break;default:}},handleNavUp:function(e){},handleNavDown:function(e){},handleNavLeft:function(e){},handleNavRight:function(e){},handleNavEnter:function(e){},handleNavEsc:function(e){},handleNavTab:function(e){}},i}),define("bui/component/uibase/mask",function(e){function i(e){return e.get("prefixCls")+"ext-mask"}function s(){return r?BUI.docWidth()+"px":"100%"}function o(){return r?BUI.docHeight()+"px":"100%"}function u(e){var t=$('<div style="width:'+s()+";"+"left:0;"+"top:0;"+"height:"+o()+";"+"position:"+(r?"absolute":"fixed")+';"'+' class="'+e+'">'+(r?'<iframe style="position:absolute;left:0;top:0;background:white;width: expression(this.parentNode.offsetWidth);height: expression(this.parentNode.offsetHeight);filter:alpha(opacity=0);z-index:-1;"></iframe>':"")+"</div>").prependTo("body");return t.on("mousedown",function(e){e.preventDefault()}),t}function a(){}function f(){}var t=e("bui/ua"),n={},r=t.ie==6;return a.ATTRS={maskShared:{value:!0}},a.prototype={_maskExtShow:function(){var e=this,t,r=i(e),s=n[r],o=e.get("maskShared"),a=e.get("maskNode");a||(o?s?a=s.node:(a=u(r),s=n[r]={num:0,node:a}):a=u(r),e.setInternal("maskNode",a)),(t=e.get("zIndex"))&&a.css("z-index",t-1),o&&s.num++,(!o||s.num==1)&&a.show(),$("body").addClass("x-masked-relative")},_maskExtHide:function(){var e=this,t=i(e),r=n[t],s=e.get("maskShared"),o=e.get("maskNode");s&&r?(r.num=Math.max(r.num-1,0),r.num==0&&o.hide()):o&&o.hide(),$("body").removeClass("x-masked-relative")},__destructor:function(){var e=this,t=e.get("maskShared"),n=e.get("maskNode");e.get("maskNode")&&(t?e.get("visible")&&e._maskExtHide():n.remove())}},f.ATTRS={mask:{value:!1},maskNode:{view:1},maskShared:{view:1}},f.prototype={__bindUI:function(){var e=this,t=e.get("view"),n=t._maskExtShow,r=t._maskExtHide;e.get("mask")&&(e.on("show",function(){t._maskExtShow()}),e.on("hide",function(){t._maskExtHide()}))}},f=f,f.View=a,f}),define("bui/component/uibase/position",function(){function e(){}function t(){}return e.ATTRS={x:{valueFn:function(){var e=this;return e.get("el")&&e.get("el").offset().left}},y:{valueFn:function(){var e=this;return e.get("el")&&e.get("el").offset().top}},zIndex:{},visibleMode:{value:"visibility"}},e.prototype={__createDom:function(){this.get("el").addClass(BUI.prefix+"ext-position")},_uiSetZIndex:function(e){this.get("el").css("z-index",e)},_uiSetX:function(e){e!=null&&this.get("el").offset({left:e})},_uiSetY:function(e){e!=null&&this.get("el").offset({top:e})},_uiSetLeft:function(e){e!=null&&this.get("el").css({left:e})},_uiSetTop:function(e){e!=null&&this.get("el").css({top:e})}},t.ATTRS={x:{view:1},y:{view:1},left:{view:1},top:{view:1},xy:{setter:function(e){var t=this,n=$.makeArray(e);return n.length&&(n[0]&&t.set("x",n[0]),n[1]&&t.set("y",n[1])),e},getter:function(){return[this.get("x"),this.get("y")]}},zIndex:{view:1},visible:{view:!0,value:!0}},t.prototype={move:function(e,t){var n=this;return BUI.isArray(e)&&(t=e[1],e=e[0]),n.set("xy",[e,t]),n},_uiSetX:function(e){if(e!=null){var t=this,n=t.get("el");t.setInternal("left",n.position().left),e!=-999&&this.set("cachePosition",null)}},_uiSetY:function(e){if(e!=null){var t=this,n=t.get("el");t.setInternal("top",n.position().top),e!=-999&&this.set("cachePosition",null)}},_uiSetLeft:function(e){var t=this,n=t.get("el");e!=null&&t.setInternal("x",n.offset().left)},_uiSetTop:function(e){var t=this,n=t.get("el");e!=null&&t.setInternal("y",n.offset().top)}},t.View=e,t}),define("bui/component/uibase/listitem",function(){function e(){}function t(){}return e.ATTRS={selected:{}},e.prototype={_uiSetSelected:function(e){var t=this,n=t.getStatusCls("selected"),r=t.get("el");e?r.addClass(n):r.removeClass(n)}},t.ATTRS={selectable:{value:!0},selected:{view:!0,sync:!1,value:!1}},t.prototype={},t.View=e,t}),define("bui/component/uibase/stdmod",function(){function t(){}function n(t,n){var r=t.get("contentEl"),i=t.get(n);i||(i=$('<div class="'+e+n+'"'+" "+" >"+"</div>"),i.appendTo(r),t.setInternal(n,i))}function r(e,t,n){t=e.get(t),BUI.isString(n)?t.html(n):t.html("").append(n)}function i(){}var e=BUI.prefix+"stdmod-";return t.ATTRS={header:{},body:{},footer:{},bodyStyle:{},footerStyle:{},headerStyle:{},headerContent:{},bodyContent:{},footerContent:{}},t.PARSER={header:function(t){return t.one("."+e+"header")},body:function(t){return t.one("."+e+"body")},footer:function(t){return t.one("."+e+"footer")}},t.prototype={__renderUI:function(){n(this,"header"),n(this,"body"),n(this,"footer")},_uiSetBodyStyle:function(e){this.get("body").css(e)},_uiSetHeaderStyle:function(e){this.get("header").css(e)},_uiSetFooterStyle:function(e){this.get("footer").css(e)},_uiSetBodyContent:function(e){r(this,"body",e)},_uiSetHeaderContent:function(e){r(this,"header",e)},_uiSetFooterContent:function(e){r(this,"footer",e)}},i.ATTRS={header:{view:1},body:{view:1},footer:{view:1},bodyStyle:{view:1},footerStyle:{view:1},headerStyle:{view:1},headerContent:{view:1},bodyContent:{view:1},footerContent:{view:1}},i.View=t,i}),define("bui/component/uibase/decorate",["bui/array","bui/json","bui/component/manage"],function(e){function l(e,t){if(t[e])return!0;var n=new RegExp("^"+i);return e!==s&&n.test(e)?!0:!1}function c(e){var t=[],n=e.constructor;while(n)t.push(n),n=n.superclass&&n.superclass.constructor;return t}function h(e){return e.toLowerCase().replace(a,function(e,t){return(t+"").toUpperCase()})}function p(e){e=$.trim(e);if(e.toLowerCase()==="false")e=!1;else if(e.toLowerCase()==="true")e=!0;else if(f.test(e))e=n.looseParse(e);else if(/\d/.test(e)&&/[^a-z]/i.test(e)){var t=parseFloat(e);t+""===e&&(e=t)}return e}function d(e,t){var n=e.userConfig||{};for(var r in t)r in n||e.setInternal(r,t[r])}function v(e,t){var n=this,r,i,s=n.userConfig||{};for(r in t)r in s||(i=t[r],BUI.isFunction(i)?n.setInternal(r,i.call(n,e)):typeof i=="string"?n.setInternal(r,e.find(i)):BUI.isArray(i)&&i[0]&&n.setInternal(r,e.find(i[0])))}function m(e,t){var n=e.constructor,r,i,s;s=c(e);for(r=s.length-1;r>=0;r--)n=s[r],(i=n[o])&&v.call(e,t,i)}function g(e){var t=e,n=t.get("srcNode"),r,i;n&&(n=$(n),t.setInternal("el",n),t.setInternal("srcNode",n),r=t.get("userConfig"),i=t.getDecorateConfig(n),d(e,i),t.get("isDecorateChild")&&t.decorateInternal&&t.decorateInternal(n),m(e,n))}function y(){g(this)}var t=e("bui/array"),n=e("bui/json"),r=BUI.prefix,i="data-",s=i+"cfg",o="PARSER",u=e("bui/component/manage"),a=/-([a-z])/g,f=/^[\{\[]/;return y.ATTRS={srcNode:{view:!0},isDecorateChild:{value:!1},decorateCfgFields:{value:{id:!0,name:!0,value:!0,title:!0}}},y.prototype={getDecorateConfig:function(e){if(!e.length)return null;var t=this,n=e[0],r=n.attributes,o=t.get("decorateCfgFields"),u={},a=t._getStautsCfg(e);return BUI.each(r,function(e){var t=e.nodeName;try{if(t===s){var n=p(e.nodeValue);BUI.mix(u,n)}else if(l(t,o)){var r=e.nodeValue;t.indexOf(i)!==-1&&(t=t.replace(i,""),t=h(t),r=p(r)),u[t]&&BUI.isObject(r)?BUI.mix(u[t],r):u[t]=r}}catch(a){BUI.log("parse field error,the attribute is:"+t)}}),BUI.mix(u,a)},_getStautsCfg:function(e){var t=this,n={},r=t.get("statusCls");return BUI.each(r,function(t,r){e.hasClass(t)&&(n[r]=!0)}),n},getDecorateElments:function(){var e=this,t=e.get("el"),n=e.get("childContainer");return n?t.find(n).children():t.children()},decorateInternal:function(e){var t=this;t.decorateChildren(e)},findXClassByNode:function(e,t){var n=this,i=e.attr("class")||"",s=n.get("defaultChildClass");i=i.replace(new RegExp("\\b"+r,"ig"),"");var o=u.getConstructorByXClass(i)||u.getConstructorByXClass(s);return!o&&!t&&(BUI.log(e),BUI.error("can not find ui "+i+" from this markup")),u.getXClassByConstructor(o)},decorateChildrenInternal:function(e,t){var n=this,r=n.get("children");r.push({xclass:e,srcNode:t})},decorateChildren:function(e){var t=this,n=t.getDecorateElments();BUI.each(n,function(e){var n=t.findXClassByNode($(e));t.decorateChildrenInternal(n,$(e))})}},y}),define("bui/component/uibase/tpl",function(){function e(){}function t(){}return e.ATTRS={tpl:{},tplEl:{}},e.prototype={__renderUI:function(){var e=this,t=e.get("childContainer"),n;t&&(n=e.get("el").find(t),n.length&&e.set("contentEl",n))},getTpl:function(e){var t=this,n=t.get("tpl"),r=t.get("tplRender");return e=e||t.getAttrVals(),r?r(e):n?BUI.substitute(n,e):""},setTplContent:function(e){var t=this,n=t.get("el"),r=t.get("content"),i=t.get("tplEl"),s=t.getTpl(e);!r&&s&&(n.empty(),n.html(s))}},t.ATTRS={tpl:{view:!0,sync:!1},tplRender:{view:!0,value:null},childContainer:{view:!0}},t.prototype={__renderUI:function(){this.get("srcNode")||this.setTplContent()},updateContent:function(){this.setTplContent()},setTplContent:function(){var e=this,t=e.getAttrVals();e.get("view").setTplContent(t)},_uiSetTpl:function(){this.setTplContent()}},t.View=e,t}),define("bui/component/uibase/collapsable",function(){var e=function(){};e.ATTRS={collapsed:{}},e.prototype={_uiSetCollapsed:function(e){var t=this,n=t.getStatusCls("collapsed"),r=t.get("el");e?r.addClass(n):r.removeClass(n)}};var t=function(){};return t.ATTRS={collapsable:{value:!1},collapsed:{view:!0,value:!1},events:{value:{expanded:!0,collapsed:!0}}},t.prototype={_uiSetCollapsed:function(e){var t=this;e?t.fire("collapsed"):t.fire("expanded")}},t.View=e,t}),define("bui/component/uibase/selection",function(){var e="single",t=function(){};return t.ATTRS={selectedEvent:{value:"click"},events:{value:{selectedchange:!1,beforeselectedchange:!1,itemselected:!1,itemunselected:!1}},idField:{value:"id"},multipleSelect:{value:!1}},t.prototype={clearSelection:function(){var e=this,t=e.getSelection();BUI.each(t,function(t){e.clearSelected(t)})},getSelection:function(){},getSelected:function(){return this.getSelection()[0]},getSelectedValue:function(){var e=this,t=e.get("idField"),n=e.getSelected();return e.getValueByField(n,t)},getSelectionValues:function(){var e=this,t=e.get("idField"),n=e.getSelection();return $.map(n,function(n){return e.getValueByField(n,t)})},getSelectionText:function(){var e=this,t=e.getSelection();return $.map(t,function(t){return e.getItemText(t)})},clearSelected:function(e){var t=this;e=e||t.getSelected(),e&&t.setItemSelected(e,!1)},getSelectedText:function(){var e=this,t=e.getSelected();return e.getItemText(t)},setSelection:function(e){var t=this;e=BUI.isArray(e)?e:[e],BUI.each(e,function(e){t.setSelected(e)})},setSelected:function(e){var t=this,n=t.get("multipleSelect");if(!t.isItemSelectable(e))return;if(!n){var r=t.getSelected();e!=r&&t.clearSelected(r)}t.setItemSelected(e,!0)},isItemSelected:function(e){},isItemSelectable:function(e){return!0},setItemSelected:function(e,t){var n=this,r;if(e){r=n.isItemSelected(e);if(r==t)return}n.fire("beforeselectedchange",{item:e,selected:t})!==!1&&n.setItemSelectedStatus(e,t)},setItemSelectedStatus:function(e,t){},setAllSelection:function(){},setSelectedByField:function(e,t){t||(t=e,e=this.get("idField"));var n=this,r=n.findItemByField(e,t);n.setSelected(r)},setSelectionByField:function(e,t){t||(t=e,e=this.get("idField"));var n=this;BUI.each(t,function(t){n.setSelectedByField(e,t)})},afterSelected:function(e,t,n){var r=this;t?(r.fire("itemselected",{item:e,domTarget:n}),r.fire("selectedchange",{item:e,domTarget:n,selected:t})):(r.fire("itemunselected",{item:e,domTarget:n}),r.get("multipleSelect")&&r.fire("selectedchange",{item:e,domTarget:n,selected:t}))}},t}),define("bui/component/uibase/list",["bui/component/uibase/selection"],function(e){function r(e){e.selected&&(e.selected=!1),e.set&&e.set("selected",!1)}function i(e,t){var n=t.isController?t.getAttrVals():t,r=e.get("itemTpl"),i=e.get("itemStatusCls"),o=e.get("itemTplRender");r&&!n.tpl&&s(t,"tpl",r),o&&!n.tplRender&&s(t,"tplRender",o);if(i){var u=n.statusCls||t.isController?t.get("statusCls"):{};BUI.each(i,function(e,t){e&&!u[t]&&(u[t]=e)}),s(t,"statusCls",u)}}function s(e,t,n){e.isController?e.set(t,n):e[t]=n}var t=e("bui/component/uibase/selection"),n=function(){};n.ATTRS={items:{shared:!1,view:!0},idField:{value:"id"},itemTpl:{view:!0},itemTplRender:{view:!0},itemStatusCls:{view:!0,value:{}},events:{value:{itemclick:!0}}},n.prototype={getItemCount:function(){return this.getItems().length},getValueByField:function(e,t){},getItems:function(){},getFirstItem:function(){return this.getItemAt(0)},getLastItem:function(){return this.getItemAt(this.getItemCount()-1)},getItemAt:function(e){return this.getItems()[e]||null},getItem:function(e){var t=this.get("idField");return this.findItemByField(t,e)},indexOfItem:function(e){return BUI.Array.indexOf(e,this.getItems())},addItems:function(e){var t=this;BUI.each(e,function(e){t.addItem(e)})},addItemsAt:function(e,t){var n=this;BUI.each(e,function(e,r){n.addItemAt(e,t+r)})},updateItem:function(e){},addItem:function(e){return this.addItemAt(e,this.getItemCount())},addItemAt:function(e,t){},findItemByField:function(e,t){},getItemText:function(e){},clearItems:function(){var e=this,t=e.getItems();t.splice(0),e.clearControl()},removeItem:function(e){},removeItems:function(e){var t=this;BUI.each(e,function(e){t.removeItem(e)})},removeItemAt:function(e){this.removeItem(this.getItemAt(e))},clearControl:function(){}};var o=function(){this.__init()};return o.ATTRS=BUI.merge(!0,n.ATTRS,t.ATTRS,{items:{sync:!1},autoInitItems:{value:!0},isDecorateChild:{value:!0},defaultLoaderCfg:{value:{property:"children",dataType:"json"}}}),BUI.augment(o,n,t,{__init:function(){var e=this,t=e.get("items");t&&e.get("autoInitItems")&&e.addItems(t),e.on("beforeRenderUI",function(){e._beforeRenderUI()})},_uiSetItems:function(e){var t=this;t.clearControl(),t.addItems(e)},_beforeRenderUI:function(){var e=this,t=e.get("children"),n=e.get("items");BUI.each(t,function(t){i(e,t)})},__bindUI:function(){var e=this,t=e.get("selectedEvent");e.on(t,function(t){var n=t.target;n.get("selectable")&&(n.get("selected")?e.get("multipleSelect")&&e.clearSelected(n):e.setSelected(n))}),e.on("click",function(t){t.target!==e&&e.fire("itemclick",{item:t.target,domTarget:t.domTarget,domEvent:t})}),e.on("beforeAddChild",function(t){i(e,t.child)}),e.on("beforeRemoveChild",function(t){var n=t.child,r=n.get("selected");r&&(e.get("multipleSelect")?e.clearSelected(n):e.setSelected(null)),n.set("selected",!1)})},clearControl:function(){this.removeChildren(!0)},getItems:function(){return this.get("children")},updateItem:function(e){var t=this,n=t.get("idField"),r=t.findItemByField(n,e[n]);return r&&r.setTplContent(),r},removeItem:function(e){var t=this,n=t.get("idField");e instanceof BUI.Component.Controller||(e=t.findItemByField(n,e[n])),this.removeChild(e,!0)},addItemAt:function(e,t){return this.addChild(e,t)},findItemByField:function(e,t,n){n=n||this;var r=this,i=n.get("children"),s=null;return $(i).each(function(n,i){i.get(e)==t?s=i:i.get("children").length&&(s=r.findItemByField(e,t,i));if(s)return!1}),s},getItemText:function(e){return e.get("el").text()},getValueByField:function(e,t){return e&&e.get(t)},setItemSelectedStatus:function(e,t){var n=this,r=t?"addClass":"removeClass",i=null;e&&(e.set("selected",t),i=e.get("el")),n.afterSelected(e,t,i)},isItemSelected:function(e){return e?e.get("selected"):!1},setAllSelection:function(){var e=this,t=e.getItems();e.setSelection(t)},getSelection:function(){var e=this,t=e.getItems(),n=[];return BUI.each(t,function(t){e.isItemSelected(t)&&n.push(t)}),n}}),n.ChildList=o,n}),define("bui/component/uibase/childcfg",function(e){var t=function(e){this._init()};return t.ATTRS={defaultChildCfg:{}},t.prototype={_init:function(){var e=this,t=e.get("defaultChildCfg");t&&e.on("beforeAddChild",function(e){var n=e.child;$.isPlainObject(n)&&BUI.each(t,function(e,t){n[t]==null&&(n[t]=e)})})}},t}),define("bui/component/uibase/depends",["bui/component/manage"],function(e){function r(e){var n=t.exec(e),r=n[1],i=n[2],s=o(r);return{source:s,eventType:i}}function i(e,t,n){var i=r(t),s=i.source,o=i.eventType,u;return s&&n&&o&&(BUI.isFunction(n)?u=n:BUI.isArray(n)&&(u=function(){BUI.each(n,function(t){e[t]&&e[t]()})})),u?(i.callbak=u,s.on(o,u),i):null}function s(e){var t=e.source,n=e.eventType,r=e.callbak;t.off(n,r)}function o(e){var t=n.getComponent(e);return t||(t=$("#"+e),t.length||(t=null)),t}function u(){}var t=/^#(.*):(.*)$/,n=e("bui/component/manage");return u.ATTRS={depends:{},dependencesMap:{shared:!1,value:{}}},u.prototype={__syncUI:function(){this.initDependences()},initDependences:function(){var e=this,t=e.get("depends");BUI.each(t,function(t,n){e.addDependence(n,t)})},addDependence:function(e,t){var n=this,r=n.get("dependencesMap"),s;n.removeDependence(e),s=i(n,e,t),s&&(r[e]=s)},removeDependence:function(e){var t=this,n=t.get("dependencesMap"),r=n[e];r&&(s(r),delete n[e])},clearDependences:function(){var e=this,t=e.get("dependencesMap");BUI.each(t,function(e,t){s(e)}),e.set("dependencesMap",{})},__destructor:function(){this.clearDependences()}},u}),define("bui/component/uibase/bindable",function(){function e(){}return e.ATTRS={store:{},loadMask:{value:!1}},BUI.augment(e,{__bindUI:function(){var e=this,t=e.get("store"),n=e.get("loadMask");if(!t)return;t.on("beforeload",function(t){e.onBeforeLoad(t),n&&n.show&&n.show()}),t.on("load",function(t){e.onLoad(t),n&&n.hide&&n.hide()}),t.on("exception",function(t){e.onException(t),n&&n.hide&&n.hide()}),t.on("add",function(t){e.onAdd(t)}),t.on("remove",function(t){e.onRemove(t)}),t.on("update",function(t){e.onUpdate(t)}),t.on("localsort",function(t){e.onLocalSort(t)}),t.on("filtered",function(t){e.onFiltered(t)})},__syncUI:function(){var e=this,t=e.get("store");if(!t)return;t.hasData()&&e.onLoad()},onBeforeLoad:function(e){},onLoad:function(e){},onException:function(e){},onAdd:function(e){},onRemove:function(e){},onUpdate:function(e){},onLocalSort:function(e){},onFiltered:function(e){}}),e}),define("bui/component/view",["bui/component/manage","bui/component/uibase"],function(e){var t=window,n=e("bui/component/manage"),r=e("bui/component/uibase"),i=document,s=r.extend([r.TplView],{getComponentCssClassWithState:function(e){var t=this,n=t.get("ksComponentCss");return e=e||"",t.getCssClassWithPrefix(n.split(/\s+/).join(e+" ")+e)},getCssClassWithPrefix:n.getCssClassWithPrefix,getKeyEventTarget:function(){return this.get("el")},getContentElement:function(){return this.get("contentEl")||this.get("el")},getStatusCls:function(e){var t=this,n=t.get("statusCls"),r=n[e];return r||(r=t.getComponentCssClassWithState("-"+e)),r},renderUI:function(){var e=this;if(!e.get("srcNode")){var t=e.get("render"),n=e.get("el"),r=e.get("elBefore");r?n.insertBefore(r,undefined):t?n.appendTo(t,undefined):n.appendTo(i.body,undefined)}},createDom:function(){var e=this,t=e.get("contentEl"),n=e.get("el");e.get("srcNode")||(n=$("<"+e.get("elTagName")+">"),t&&n.append(t),e.setInternal("el",n)),n.addClass(e.getComponentCssClassWithState()),t||e.setInternal("contentEl",n)},_uiSetHighlighted:function(e){var t=this,n=t.getStatusCls("hover"),r=t.get("el");r[e?"addClass":"removeClass"](n)},_uiSetDisabled:function(e){var t=this,n=t.getStatusCls("disabled"),r=t.get("el");r[e?"addClass":"removeClass"](n).attr("aria-disabled",e),e&&t.get("highlighted")&&t.set("highlighted",!1),t.get("focusable")&&t.getKeyEventTarget().attr("tabIndex",e?-1:0)},_uiSetActive:function(e){var t=this,n=t.getStatusCls("active");t.get("el")[e?"addClass":"removeClass"](n).attr("aria-pressed",!!e)},_uiSetFocused:function(e){var t=this,n=t.get("el"),r=t.getStatusCls("focused");n[e?"addClass":"removeClass"](r)},_uiSetElAttrs:function(e){this.get("el").attr(e)},_uiSetElCls:function(e){this.get("el").addClass(e)},_uiSetElStyle:function(e){this.get("el").css(e)},_uiSetRole:function(e){e&&this.get("el").attr("role",e)},_uiSetWidth:function(e){this.get("el").width(e)},_uiSetHeight:function(e){var t=this;t.get("el").height(e)},_uiSetContent:function(e){var t=this,n;if(!t.get("srcNode")||!!t.get("rendered"))n=t.get("contentEl"),typeof e=="string"?n.html(e):e&&n.empty().append(e)},_uiSetVisible:function(e){var t=this,n=t.get("el"),r=t.get("visibleMode");r==="visibility"?n.css("visibility",e?"visible":"hidden"):n.css("display",e?"":"none")},set:function(e,t){var n=this,r=n.__attrs[e],i,o,u;if(!r||!n.get("binded"))return s.superclass.set.call(this,e,t),n;var a=s.superclass.get.call(this,e);return!$.isPlainObject(t)&&!BUI.isArray(t)&&a===t?n:(s.superclass.set.call(this,e,t),t=n.__attrVals[e],i={attrName:e,prevVal:a,newVal:t},o=BUI.ucfirst(e),u="_uiSet"+o,n[u]&&n[u](t,i),n)},destructor:function(){var e=this.get("el");e&&e.remove()}},{xclass:"view",priority:0});return s.ATTRS={el:{setter:function(e){return $(e)}},elCls:{},elStyle:{},role:{},width:{},height:{},statusCls:{value:{}},elTagName:{value:"div"},elAttrs:{},content:{},elBefore
:{},render:{},visible:{value:!0},visibleMode:{value:"display"},cachePosition:{},contentEl:{valueFn:function(){return this.get("el")}},prefixCls:{value:BUI.prefix},focusable:{value:!0},focused:{},active:{},disabled:{},highlighted:{}},s}),define("bui/component/loader",["bui/util"],function(e){"use strict";var t=e("bui/util"),n=e("bui/base"),r=function(e){r.superclass.constructor.call(this,e),this._init()};return r.ATTRS={url:{},target:{},hasLoad:{value:!1},autoLoad:{},lazyLoad:{},property:{},renderer:{value:function(e){return e}},loadMask:{value:!1},dataType:{value:"text"},ajaxOptions:{value:{type:"get",cache:!1}},params:{},appendParams:{},lastParams:{shared:!1,value:{}},callback:{},failure:{}},t.extend(r,n),t.augment(r,{isLoader:!0,_init:function(){var e=this,t=e.get("autoLoad"),n=e.get("params");e._initMask(),t?e.load(n):(e._initParams(),e._initLazyLoad())},_initLazyLoad:function(){var e=this,t=e.get("target"),n=e.get("lazyLoad");t&&n&&n.event&&t.on(n.event,function(){(!e.get("hasLoad")||n.repeat)&&e.load()})},_initMask:function(){var e=this,n=e.get("target"),r=e.get("loadMask");n&&r&&t.use("bui/mask",function(i){var s=$.isPlainObject(r)?r:{};r=new i.LoadMask(t.mix({el:n.get("el")},s)),e.set("loadMask",r)})},_initParams:function(){var e=this,n=e.get("lastParams"),r=e.get("params");t.mix(n,r)},load:function(e){var n=this,r=n.get("url"),i=n.get("ajaxOptions"),s=n.get("lastParams"),o=n.get("appendParams");e=e||s,e=t.merge(o,e),n.set("lastParams",e);if(!r)return;n.onBeforeLoad(),n.set("hasLoad",!0),$.ajax(t.mix({dataType:n.get("dataType"),data:e,url:r,success:function(t){n.onload(t,e)},error:function(t,r,i){n.onException({jqXHR:t,textStatus:r,errorThrown:i},e)}},i))},onBeforeLoad:function(){var e=this,t=e.get("loadMask");t&&t.show&&t.show()},onload:function(e,n){var r=this,i=r.get("loadMask"),s=r.get("property"),o=r.get("callback"),u=r.get("renderer"),a=r.get("target");t.isString(e)&&a.set(s,""),a.set(s,u.call(r,e)),i&&i.hide&&i.hide(),o&&o.call(this,e,n)},onException:function(e,t){var n=this,r=n.get("failure");r&&r.call(this,e,t)}}),r}),define("bui/component/controller",["bui/component/uibase","bui/component/manage","bui/component/view","bui/component/loader"],function(e){"use strict";function u(e){return function(t){var n=this;if(n===t.target){var r=t.newVal,i=n.get("view");i&&i.set(e,r)}}}function a(e){return function(t){var n=this,r=n.get("view");return t===undefined?r.get(e):t}}function f(e,t,n){e.create();var r=e.getContentElement(),i=e.get("defaultChildClass");return!t.xclass&&!(t instanceof p)&&(t.xtype?t.xclass=i+"-"+t.xtype:t.xclass=i),t=BUI.Component.create(t,e),t.setInternal("parent",e),t.set("render",r),t.set("elBefore",n),t.create(undefined),t}function l(e){var t,n,r,i={},s,o=e.get("xview");t=e.getAttrs();for(r in t)t.hasOwnProperty(r)&&(n=t[r],n.view&&(s=e.get(r))!==undefined&&(i[r]=s));return delete i.autoRender,i.ksComponentCss=c(e),new o(i)}function c(e){var t=e.constructor,r,i=[];while(t&&t!==p)r=n.getXClassByConstructor(t),r&&i.push(r),t=t.superclass&&t.superclass.constructor;return i.join(" ")}function h(e,t){var n=e.relatedTarget;return n&&(n===t[0]||$.contains(t,n))}var t=e("bui/component/uibase"),n=e("bui/component/manage"),r=e("bui/component/view"),i=e("bui/component/loader"),s=BUI.wrapBehavior,o=BUI.getWrapBehavior,p=t.extend([t.Decorate,t.Tpl,t.ChildCfg,t.KeyNav,t.Depends],{isController:!0,getCssClassWithPrefix:n.getCssClassWithPrefix,initializer:function(){var e=this;e.get("id")||e.set("id",e.getNextUniqueId()),n.addComponent(e.get("id"),e);var t=l(e);e.setInternal("view",t),e.__view=t},getNextUniqueId:function(){var e=this,t=n.getXClassByConstructor(e.constructor);return BUI.guid(t)},createDom:function(){var e=this,t=e.get("view");t.create(undefined)},renderUI:function(){var e=this,t=e.get("loader");e.get("view").render(),e._initChildren(),t&&e.setInternal("loader",t)},_initChildren:function(e){var t=this,n,e,r;e=e||t.get("children").concat(),t.get("children").length=0;for(n=0;n<e.length;n++)r=t.addChild(e[n]),r.render()},bindUI:function(){var e=this,t=e.get("events");this.on("afterVisibleChange",function(e){this.fire(e.newVal?"show":"hide")}),BUI.each(t,function(t,n){e.publish(n,{bubbles:t})})},containsElement:function(e){var t=this,n=t.get("el"),r=t.get("children"),i=!1;return t.get("rendered")?($.contains(n[0],e)||n[0]===e?i=!0:BUI.each(r,function(t){if(t.containsElement(e))return i=!0,!1}),i):!1},isChildrenElement:function(e){var t=this,n=t.get("children"),r=!1;return BUI.each(n,function(t){if(t.containsElement(e))return r=!0,!1}),r},show:function(){var e=this;return e.render(),e.set("visible",!0),e},hide:function(){var e=this;return e.set("visible",!1),e},toggle:function(){return this.set("visible",!this.get("visible")),this},_uiSetFocusable:function(e){var t=this,n,r=t.getKeyEventTarget();e?r.attr("tabIndex",0).attr("hideFocus",!0).on("focus",s(t,"handleFocus")).on("blur",s(t,"handleBlur")).on("keydown",s(t,"handleKeydown")).on("keyup",s(t,"handleKeyUp")):(r.removeAttr("tabIndex"),(n=o(t,"handleFocus"))&&r.off("focus",n),(n=o(t,"handleBlur"))&&r.off("blur",n),(n=o(t,"handleKeydown"))&&r.off("keydown",n),(n=o(t,"handleKeyUp"))&&r.off("keyup",n))},_uiSetHandleMouseEvents:function(e){var t=this,n=t.get("el"),r;e?n.on("mouseenter",s(t,"handleMouseEnter")).on("mouseleave",s(t,"handleMouseLeave")).on("contextmenu",s(t,"handleContextMenu")).on("mousedown",s(t,"handleMouseDown")).on("mouseup",s(t,"handleMouseUp")).on("dblclick",s(t,"handleDblClick")):(r=o(t,"handleMouseEnter")&&n.off("mouseenter",r),r=o(t,"handleMouseLeave")&&n.off("mouseleave",r),r=o(t,"handleContextMenu")&&n.off("contextmenu",r),r=o(t,"handleMouseDown")&&n.off("mousedown",r),r=o(t,"handleMouseUp")&&n.off("mouseup",r),r=o(t,"handleDblClick")&&n.off("dblclick",r))},_uiSetFocused:function(e){e&&this.getKeyEventTarget()[0].focus()},_uiSetVisible:function(e){var t=this,n=t.get("el"),r=t.get("visibleMode");if(r==="visibility"){if(e){var i=t.get("cachePosition");i&&t.set("xy",i)}if(!e){var i=[t.get("x"),t.get("y")];t.set("cachePosition",i),t.set("xy",[-999,-999])}}},_uiSetChildren:function(e){var t=this,n=BUI.cloneObject(e);t._initChildren(n)},enable:function(){return this.set("disabled",!1),this},disable:function(){return this.set("disabled",!0),this},focus:function(){this.get("focusable")&&this.set("focused",!0)},getContentElement:function(){return this.get("view").getContentElement()},getKeyEventTarget:function(){return this.get("view").getKeyEventTarget()},addChild:function(e,t){var n=this,r=n.get("children"),i;return t===undefined&&(t=r.length),n.fire("beforeAddChild",{child:e,index:t}),i=r[t]&&r[t].get("el")||null,e=f(n,e,i),r.splice(t,0,e),n.get("rendered")&&e.render(),n.fire("afterAddChild",{child:e,index:t}),e},remove:function(e){var t=this,n=t.get("parent");return n?n.removeChild(t,e):e&&t.destroy(),t},removeChild:function(e,t){var n=this,r=n.get("children"),i=BUI.Array.indexOf(e,r);if(i===-1)return;return n.fire("beforeRemoveChild",{child:e,destroy:t}),i!==-1&&r.splice(i,1),t&&e.destroy&&e.destroy(),n.fire("afterRemoveChild",{child:e,destroy:t}),e},removeChildren:function(e){var t=this,n,r=[].concat(t.get("children"));for(n=0;n<r.length;n++)t.removeChild(r[n],e)},getChildAt:function(e){var t=this.get("children");return t[e]||null},getChild:function(e,t){return this.getChildBy(function(t){return t.get("id")===e},t)},getChildBy:function(e,t){return this.getChildrenBy(e,t)[0]||null},getAppendHeight:function(){var e=this.get("el");return e.outerHeight()-e.height()},getAppendWidth:function(){var e=this.get("el");return e.outerWidth()-e.width()},getChildrenBy:function(e,t){var n=this,r=[];return e?(n.eachChild(function(n){e(n)?r.push(n):t&&(r=r.concat(n.getChildrenBy(e,t)))}),r):r},eachChild:function(e){BUI.each(this.get("children"),e)},handleDblClick:function(e){this.performActionInternal(e),this.isChildrenElement(e.target)||this.fire("dblclick",{domTarget:e.target,domEvent:e})},handleMouseOver:function(e){var t=this,n=t.get("el");h(e,n)||t.handleMouseEnter(e)},handleMouseOut:function(e){var t=this,n=t.get("el");h(e,n)||t.handleMouseLeave(e)},handleMouseEnter:function(e){var t=this;this.set("highlighted",!!e),t.fire("mouseenter",{domTarget:e.target,domEvent:e})},handleMouseLeave:function(e){var t=this;t.set("active",!1),t.set("highlighted",!e),t.fire("mouseleave",{domTarget:e.target,domEvent:e})},handleMouseDown:function(e){var t=this,n,r=$(e.target),i=e.which===1,s;i&&(s=t.getKeyEventTarget(),t.get("activeable")&&t.set("active",!0),t.get("focusable")&&t.setInternal("focused",!0),t.get("allowTextSelection")||(n=e.target.nodeName,n=n&&n.toLowerCase(),n!=="input"&&n!=="textarea"&&e.preventDefault()),t.isChildrenElement(e.target)||t.fire("mousedown",{domTarget:e.target,domEvent:e}))},handleMouseUp:function(e){var t=this,n=t.isChildrenElement(e.target);t.get("active")&&e.which===1&&(t.performActionInternal(e),t.set("active",!1),n||t.fire("click",{domTarget:e.target,domEvent:e})),n||t.fire("mouseup",{domTarget:e.target,domEvent:e})},handleContextMenu:function(e){},handleFocus:function(e){this.set("focused",!!e),this.fire("focus",{domEvent:e,domTarget:e.target})},handleBlur:function(e){this.set("focused",!e),this.fire("blur",{domEvent:e,domTarget:e.target})},handleKeyEventInternal:function(e){var t=this,n=t.isChildrenElement(e.target);if(e.which===13)return n||t.fire("click",{domTarget:e.target,domEvent:e}),this.performActionInternal(e);n||t.fire("keydown",{domTarget:e.target,domEvent:e})},handleKeydown:function(e){var t=this;if(t.handleKeyEventInternal(e))return e.halt(),!0},handleKeyUp:function(e){var t=this;t.isChildrenElement(e.target)||t.fire("keyup",{domTarget:e.target,domEvent:e})},performActionInternal:function(e){},destructor:function(){var e=this,t,r,i,s=e.get("children");t=e.get("id");for(r=0;r<s.length;r++)s[r].destroy&&s[r].destroy();e.get("view").destroy(),n.removeComponent(t)},set:function(e,t,n){var r=this,i=r.__view,s=r.__attrs[e],o,u,a;BUI.isObject(e)&&(n=t,BUI.each(e,function(e,t){r.set(t,e,n)}));if(!i||!s||n&&n.silent)return p.superclass.set.call(this,e,t,n),r;var f=p.superclass.get.call(this,e);return!$.isPlainObject(t)&&!BUI.isArray(t)&&f===t?r:(o=BUI.ucfirst(e),a="_uiSet"+o,r.fire("before"+o+"Change",{attrName:e,prevVal:f,newVal:t}),r.setInternal(e,t),t=r.__attrVals[e],i&&s.view&&i.set(e,t),u={attrName:e,prevVal:f,newVal:t},r.fire("after"+o+"Change",u),r.get("binded")&&r[a]&&r[a](t,u),r)},get:function(e){var t=this,n=t.__view,r=t.__attrs[e],i=p.superclass.get.call(this,e);return i!==undefined?i:n&&r&&r.view?n.get(e):i}},{ATTRS:{content:{view:1},elTagName:{view:!0,value:"div"},defaultChildClass:{},xtype:{},id:{view:!0},width:{view:1},height:{view:1},elCls:{view:1},elStyle:{view:1},elAttrs:{view:1},elBefore:{view:1},el:{view:1},events:{value:{click:!0,dblclick:!0,mouseenter:!0,mouseleave:!0,keydown:!0,keyup:!0,focus:!1,blur:!1,mousedown:!0,mouseup:!0,show:!1,hide:!1}},render:{view:1},role:{view:1},statusCls:{view:!0,value:{}},visibleMode:{view:1,value:"display"},visible:{value:!0,view:1},handleMouseEvents:{value:!0},focusable:{value:!1,view:1},defaultLoaderCfg:{value:{property:"content",autoLoad:!0}},loader:{getter:function(e){var t=this,n;return e&&!e.isLoader&&(e.target=t,n=t.get("defaultLoaderCfg"),e=new i(BUI.merge(n,e)),t.setInternal("loader",e)),e}},allowTextSelection:{value:!0},activeable:{value:!0},focused:{view:1},active:{view:1},highlighted:{view:1},children:{sync:!1,shared:!1,value:[]},prefixCls:{value:BUI.prefix,view:1},parent:{setter:function(e){this.addTarget(e)}},disabled:{view:1,value:!1},xview:{value:r}},PARSER:{visible:function(e){var t=this,n=e.css("display"),r=e.css("visibility"),i=t.get("visibleMode");return n=="none"&&i=="display"||r=="hidden"&&i=="visibility"?!1:!0}}},{xclass:"controller",priority:0});return p}),define("bui/cookie",function(){function i(e){return typeof e=="string"&&e!==""}var e=document,t=864e5,n=encodeURIComponent,r=decodeURIComponent,s={get:function(t){var n,s;return i(t)&&(s=String(e.cookie).match(new RegExp("(?:^| )"+t+"(?:(?:=([^;]*))|;|$)")))&&(n=s[1]?r(s[1]):""),n},set:function(r,s,o,u,a,f){var l=String(n(s)),c=o;typeof c=="number"&&(c=new Date,c.setTime(c.getTime()+o*t)),c instanceof Date&&(l+="; expires="+c.toUTCString()),i(u)&&(l+="; domain="+u),i(a)&&(l+="; path="+a),f&&(l+="; secure"),e.cookie=r+"="+l},remove:function(e,t,n,r){this.set(e,"",-1,t,n,r)}};return BUI.Cookie=s,s}),function(){var e="bui/data/";define("bui/data",["bui/common",e+"sortable",e+"proxy",e+"abstractstore",e+"store",e+"node",e+"treestore"],function(t){var n=t("bui/common"),r=n.namespace("Data");return n.mix(r,{Sortable:t(e+"sortable"),Proxy:t(e+"proxy"),AbstractStore:t(e+"abstractstore"),Store:t(e+"store"),Node:t(e+"node"),TreeStore:t(e+"treestore")}),r})}(),define("bui/data/sortable",function(){var e="ASC",t="DESC",n=function(){};return n.ATTRS={compareFunction:{value:function(e,t){return e===undefined&&(e=""),t===undefined&&(t=""),BUI.isString(e)?e.localeCompare(t):e>t?1:e===t?0:-1}},sortField:{},sortDirection:{value:"ASC"},sortInfo:{getter:function(){var e=this,t=e.get("sortField");return{field:t,direction:e.get("sortDirection")}},setter:function(e){var t=this;t.set("sortField",e.field),t.set("sortDirection",e.direction)}}},BUI.augment(n,{compare:function(t,n,r,i){var s=this,o;return r=r||s.get("sortField"),i=i||s.get("sortDirection"),!r||!i?1:(o=i===e?1:-1,s.get("compareFunction")(t[r],n[r])*o)},getSortData:function(){},sortData:function(e,t,n){var r=this,n=n||r.getSortData();return BUI.isArray(e)&&(n=e,e=null),e=e||r.get("sortField"),t=t||r.get("sortDirection"),r.set("sortField",e),r.set("sortDirection",t),!e||!t?n:(n.sort(function(n,i){return r.compare(n,i,e,t)}),n)}}),n}),define("bui/data/proxy",["bui/data/sortable"],function(e){var t=e("bui/data/sortable"),n=function(e){n.superclass.constructor.call(this,e)};n.ATTRS={},BUI.extend(n,BUI.Base),BUI.augment(n,{_read:function(e,t){},read:function(e,t,n){var r=this;n=n||r,r._read(e,function(e){t.call(n,e)})},_save:function(e,t,n){},save:function(e,t,n,r){var i=this;r=r||i,i._save(e,t,function(e){n.call(r,e)})}});var r={READ:"read",ADD:"add",UPDATE:"update",REMOVE:"remove",SAVE_ALL:"all"},i=function(e){i.superclass.constructor.call(this,e)};i.ATTRS=BUI.mix(!0,n.ATTRS,{limitParam:{value:"limit"},startParam:{value:"start"},pageIndexParam:{value:"pageIndex"},saveTypeParam:{value:"saveType"},saveDataParam:{},pageStart:{value:0},dataType:{value:"json"},method:{value:"GET"},ajaxOptions:{value:{}},cache:{value:!1},save:{},url:{}}),BUI.extend(i,n),BUI.augment(i,{_processParams:function(e){var t=this,n=t.get("pageStart"),r=["start","limit","pageIndex"];e.pageIndex!=null&&(e.pageIndex=e.pageIndex+n),BUI.each(r,function(n){var r=t.get(n+"Param");r!==n&&(e[r]=e[n],delete e[n])})},_getUrl:function(e){var t=this,n=t.get("save"),i;return e===r.READ?t.get("url"):n?BUI.isString(n)?n:(i=n[e+"Url"],i||(i=t.get("url")),i):t.get("url")},_getAppendParams:function(e){var t=this,n,i,s=null;return e==r.READ?s:(n=t.get("save"),i=t.get("saveTypeParam"),n&&!n[e+"Url"]&&(s={},s[i]=e),s)},_read:function(e,t){var n=this,i;e=BUI.cloneObject(e),n._processParams(e),i=n._getAjaxOptions(r.READ,e),n._ajax(i,t)},_getAjaxOptions:function(e,t){var n=this,r=n.get("ajaxOptions"),i=n._getUrl(e),s;return BUI.mix(t,n._getAppendParams(e)),s=BUI.merge({url:i,type:n.get("method"),dataType:n.get("dataType"),data:t,cache:n.get("cache")},r),s},_ajax:function(e,t){var n=this,r=e.success,i=e.error;e.success=function(e){r&&r(e),t(e)},e.error=function(e,n,r){i&&i(e,n,r);var s={exception:{status:n,errorThrown:r,jqXHR:e}};t(s)},$.ajax(e)},_save:function(e,t,n){var r=this,i;i=r._getAjaxOptions(e,t),r._ajax(i,n)}});var s=function(e){s.superclass.constructor.call(this,e)};return s.ATTRS={matchFields:{value:[]}},BUI.extend(s,n),BUI.mixin(s,[t]),BUI.augment(s,{_read:function(e,t){var n=this,r=e.pageable,i=e.start,s=e.sortField,o=e.sortDirection,u=e.limit,a=n.get("data"),f=[];a=n._getMatches(e),n.sortData(s,o),u?(f=a.slice(i,i+u),t({rows:f,results:a.length})):(f=a.slice(i),t(f))},_getMatchFn:function(e,t){var n=this;return function(n){var r=!0;return BUI.each(t,function(t){if(e[t]!=null&&e[t]!==n[t])return r=!1,!1}),r}},_getMatches:function(e){var t=this,n=t.get("matchFields"),r,i=t.get("data")||[];return e&&n.length&&(r=t._getMatchFn(e,n),i=BUI.Array.filter(i,r)),i},_save:function(e,t,n){var i=this,s=i.get("data");e==r.ADD?s.push(t):e==r.REMOVE?BUI.Array.remove(s,t):e==r.SAVE_ALL&&(BUI.each(t.add,function(e){s.push(e)}),BUI.each(t.remove,function(e){BUI.Array.remove(s,e)}))}}),n.Ajax=i,n.Memery=s,n}),define("bui/data/abstractstore",["bui/common","bui/data/proxy"],function(e){function r(e){r.superclass.constructor.call(this,e),this._init()}var t=e("bui/common"),n=e("bui/data/proxy");return r.ATTRS={autoLoad:{value:!1},remoteFilter:{value:!1},lastParams:{shared:!1,value:{}},params:{},proxy:{shared:!1,value:{}},url:{},events:{value:["acceptchanges","load","beforeload","beforeprocessload","add","exception","remove","update","localsort","filtered"]},data:{setter:function(e){var t=this,n=t.get("proxy");n.set?n.set("data",e):n.data=e,t.set("autoLoad",!0)}}},t.extend(r,t.Base),t.augment(r,{isStore:!0,_init:function(){var e=this;e.beforeInit(),e._initParams(),e._initProxy(),e._initData()},beforeInit:function(){},_initData:function(){var e=this,t=e.get("autoLoad");t&&e.load()},_initParams:function(){var e=this,n=e.get("lastParams"),r=e.get("params");t.mix(n,r)},_initProxy:function(){var e=this,t=e.get("url"),r=e.get("proxy");r instanceof n||(t&&(r.url=t),r.type==="ajax"||r.url?r=new n.Ajax(r):r=new n.Memery(r),e.set("proxy",r))},load:function(e,n){var r=this,i=r.get("proxy"),s=r.get("lastParams");t.mix(s,r.getAppendParams(),e),r.fire("beforeload",{params:s}),e=t.cloneObject(s),i.read(s,function(t){r.onLoad(t,e),n&&n(t,e)},r)},onFiltered:function(e,t){var n=this;n.fire("filtered",{data:e,filter:t})},onLoad:function(e,t){var n=this,r=n.processLoad(e,t);r&&n.afterProcessLoad(e,t)},getResult:function(){},filter:function(e){var t=this,n=t.get("remoteFilter"),r;e=e||t.get("filter"),n?t.load({filter:e}):e&&(t.set("filter",e),t.getResult().length>0&&(r=t._filterLocal(e),t.onFiltered(r,e)))},_filterLocal:function(e){},getFilterResult:function(){var e=this.get("filter");return e?this._filterLocal(e):this.getResult()},_clearLocalFilter:function(){this.set("filter",null)},clearFilter:function(){var e=this,t=e.get("remoteFilter"),n;t?e.load({filter:""}):(e._clearLocalFilter(),n=e.getFilterResult(),e.onFiltered(n,null))},processLoad:function(e,t){var n=this,r=n.get("hasErrorProperty");return n.fire("beforeprocessload",{data:e}),n.fire("beforeProcessLoad",e),e[r]||e.exception?(n.onException(e),!1):!0},afterProcessLoad:function(e,t){},onException:function(e){var t=this,n=t.get("errorProperty"),r={};e.exception?(r.type="exception",r[n]=e.exception):(r.type="error",r[n]=e[n]),t.fire("exception",r)},hasData:function(){},getAppendParams:function(){return{}}}),r}),define("bui/data/node",["bui/common"],function(e){function n(e,n){var r={};return n?(t.each(e,function(e,t){var i=n[t]||t;r[i]=e}),r.record=e):r=e,r}function r(e,r){var i=this;e=n(e,r),t.mix(this,e)}var t=e("bui/common");return t.augment(r,{root:!1,leaf:null,text:"",id:null,loaded:!1,path:null,parent:null,level:0,record:null,children:null,isNode:!0}),r}),define("bui/data/treestore",["bui/common","bui/data/node","bui/data/abstractstore","bui/data/proxy"],function(e){function s(e){s.superclass.constructor.call(this,e)}var t=e("bui/common"),n=e("bui/data/node"),r=e("bui/data/proxy"),i=e("bui/data/abstractstore");return s.ATTRS={root:{},map:{},pidField:{},dataProperty:{value:"nodes"},events:{value:["add","update","remove","load"]}},t.extend(s,i),t.augment(s,{beforeInit:function(){this.initRoot()},_initData:function(){var e=this,t=e.get("autoLoad"),n=e.get("pidField"),r=e.get("proxy"),i=e.get("root");!r.get("url")&&n&&r.get("matchFields").push(n),t&&!i.children&&e.loadNode(i)},initRoot:function(){var e=this,t=e.get("map"),r=e.get("root");r||(r={}),r.isNode||(r=new n(r,t)),r.path=[r.id],r.level=0,r.children&&e.setChildren(r,r.children),e.set("root",r)},add:function(e,t,n){var r=this;return e=r._add(e,t,n),r.fire("add",{node:e,record:e,index:n}),e},_add:function(e,r,i){r=r||this.get("root");var s=this,o=s.get("map"),u=r.children,a;return e.isNode||(e=new n(e,o)),a=e.children||[],a.length==0&&e.leaf==null&&(e.leaf=!0),r&&(r.leaf=!1),e.parent=r,e.level=r.level+1,e.path=r.path.concat(e.id),i=i==null?r.children.length:i,t.Array.addAt(u,e,i),s.setChildren(e,a),e},remove:function(e){var n=e.parent||_self.get("root"),r=t.Array.indexOf(e,n.children);return t.Array.remove(n.children,e),n.children.length===0&&(n.leaf=!0),this.fire("remove",{node:e,record:e,index:r}),e.parent=null,e},setValue:function(e,t,n){var r=this;e[t]=n,r.fire("update",{node:e,record:e,field:t,value:n})},update:function(e){this.fire("update",{node:e,record:e})},getResult:function(){return this.get("root").children},setResult:function(e){var t=this,n=t.get("proxy"),i=t.get("root");n instanceof r.Memery?(t.set("data",e),t.load({id:i.id})):t.setChildren(i,e)},setChildren:function(e,n){var r=this;e.children=[];if(!n.length)return;t.each(n,function(t){r._add(t,e)})},findNode:function(e,t,n){return this.findNodeBy(function(t){return t.id===e},t,n)},findNodeBy:function(e,n,r){var i=this;r=r==null?!0:r;if(!n){var s=i.get("root");return e(s)?s:i.findNodeBy(e,s)}var o=n.children,u=null;return t.each(o,function(t){e(t)?u=t:r&&(u=i.findNodeBy(e,t));if(u)return!1}),u},findNodesBy:function(e,n){var r=this,i,s=[];return n||(n=r.get("root")),t.each(n.children,function(t){e(t)&&s.push(t),s=s.concat(r.findNodesBy(e,t))}),s},findNodeByPath:function(e){if(!e)return null;var t=this,n=t.get("root"),r=e.split(","),i,s,o=r[0];if(!o)return null;n.id==o?i=n:i=t.findNode(o,n,!1);if(!i)return;for(s=1;s<r.length;s+=1){var o=r[s];i=t.findNode(o,i,!1);if(!i)break}return i},contains:function(e,t){var n=this,r=n.findNode(e.id,t);return!!r},afterProcessLoad:function(e,n){var r=this,i=r.get("pidField"),s=n.id||n[i],o=r.get("dataProperty"),u=r.findNode(s)||r.get("root");t.isArray(e)?r.setChildren(u,e):r.setChildren(u,e[o]),u.loaded=!0,r.fire("load",{node:u,params:n})},hasData:function(){return this.get("root").children&&this.get("root").children.length!==0},isLoaded:function(e){var t=this.get("root");return e==t&&!t.children?!1:!this.get("url")&&!this.get("pidField")?!0:e.loaded||e.leaf||!!e.children&&!!e.children.length},loadNode:function(e,t){var n=this,r=n.get("pidField"),i;if(!t&&n.isLoaded(e))return;i={id:e.id},r&&(i[r]=e.id),n.load(i)},reloadNode:function(e){var t=this;e=e||t.get("root"),e.loaded=!1,t.loadNode(e,!0)},loadPath:function(e){var t=this,n=e.split(","),r=n[0];if(t.findNodeByPath(e))return;t.load({id:r,path:e})}}),s}),define("bui/data/store",["bui/data/proxy","bui/data/abstractstore","bui/data/sortable"],function(e){function i(e,t){if(e<0)return;var n=t,r=n[e];return n.splice(e,1),r}function s(e,t){var n=BUI.Array.indexOf(e,t);n>=0&&i(n,t)}function o(e,t){return BUI.Array.indexOf(e,t)!==-1}var t=e("bui/data/proxy"),n=e("bui/data/abstractstore"),r=e("bui/data/sortable"),u=function(e){u.superclass.constructor.call(this,e)};return u.ATTRS={autoSync:{value:!1},currentPage:{value:0},deletedRecords:{shared:!1,value:[]},errorProperty:{value:"error"},hasErrorProperty:{value:"hasError"},matchFunction:{value:function(e,t){return e==t}},modifiedRecords:{shared:!1,value:[]},newRecords:{shared:!1,value:[]},remoteSort:{value:!1},resultMap:{shared:!1,value:{}},root:{value:"rows"},rowCount:{value:0},totalProperty:{value:"results"},start:{value:0},pageSize:{}},BUI.extend(u,n),BUI.mixin(u,[r]),BUI.augment(u,{add:function(e,t,n){var r=this,i=r.getCount();r.addAt(e,i,t,n)},addAt:function(e,t,n,r){var i=this;r=r||i._getDefaultMatch(),BUI.isArray(e)||(e=[e]),$.each(e,function(e,o){if(!n||!i.contains(o,r))i._addRecord(o,e+t),i.get("newRecords").push(o),s(o,i.get("deletedRecords")),s(o,i.get("modifiedRecords"))})},contains:function(e,t){return this.findIndexBy(e,t)!==-1},find:function(e,t){var n=this,r=null,i=n.getResult();return $.each(i,function(n,i){if(i[e]===t)return r=i,!1}),r},findAll:function(e,t){var n=this,r=[],i=n.getResult();return $.each(i,function(n,i){i[e]===t&&r.push(i)}),r},findByIndex:function(e){return this.getResult()[e]},findIndexBy:function(e,t){var n=this,r=-1,i=n.getResult();return t=t||n._getDefaultMatch(),e===null||e===undefined?-1:($.each(i,function(n,i){if(t(e,i))return r=n,!1}),r)},findNextRecord:function(e){var t=this,n=t.findIndexBy(e);if(n>=0)return t.findByIndex(n+1);return},getCount:function(){return this.getResult().length},getTotalCount:function(){var e=this,t=e.get("resultMap"),n=e.get("totalProperty");return parseInt(t[n],10)||0},getResult:function(){var e=this,t=e.get("resultMap"),n=e.get("root");return t[n]},hasData:function(){return this.getCount()!==0},setResult:function(e){var n=this,r=n.get("proxy");r instanceof t.Memery?(n.set("data",e),n.load({start:0})):(n._setResult(e),n.get("filter")&&n.filter())},remove:function(e,t){var n=this,r=[];t=t||n._getDefaultMatch(),BUI.isArray(e)||(e=[e]),$.each(e,function(e,r){var e=n.findIndexBy(r,t),u=i(e,n.getResult());!o(u,n.get("newRecords"))&&!o(u,n.get("deletedRecords"))&&n.get("deletedRecords").push(u),s(u,n.get("newRecords")),s(u,n.get("modifiedRecords")),n.fire("remove",{record:u})})},save:function(e,t,n){var r=this,i=r.get("proxy");BUI.isFunction(e)&&(n=e,e=undefined),BUI.isObject(e)&&(n=t,t=e,e=undefined),e||(e=r._getSaveType(t)),e=="all"&&!t&&(t=r._getDirtyData()),r.fire("beforesave",{type:e,saveData:t}),i.save(e,t,function(i){r.onSave(e,t,i),n&&n(i,t)},r)},_getSaveType:function(e){var t=this;return e?BUI.Array.contains(e,t.get("newRecords"))?"add":BUI.Array.contains(e,t.get("modifiedRecords"))?"update":BUI.Array.contains(e,t.get("deletedRecords"))?"remove":"custom":"all"},_getDirtyData:function(){var e=this,t=e.get("proxy");return t.get("url")?{add:BUI.JSON.stringify(e.get("newRecords")),update:BUI.JSON.stringify(e.get("modifiedRecords")),remove:BUI.JSON.stringify(e.get("deletedRecords"))}:{add:e.get("newRecords"),update:e.get("modifiedRecords"),remove:e.get("deletedRecords")}},onSave:function(e,t,n){var r=this,i=r.get("hasErrorProperty");if(n[i]||n.exception){r.onException(n);return}r._clearDirty(e,t),r.fire("saved",{type:e,saveData:t,data:n}),r.get("autoSync")&&r.load()},_clearDirty:function(e,t){function r(e,t){BUI.Array.remove(n.get(t),e)}var n=this;switch(e){case"all":n._clearChanges();break;case"add":r(t,"newRecords");break;case"update":r(t,"modifiedRecords");break;case"remove":r(t,"deletedRecords");break;default:}},sort:function(e,t){var n=this,r=n.get("remoteSort");r?(n.set("sortField",e),n.set("sortDirection",t),n.load(n.get("sortInfo"))):n._localSort(e,t)},sum:function(e,t){var n=this,r=t||n.getResult(),i=0;return BUI.each(r,function(t){var n=t[e];isNaN(n)||(i+=parseFloat(n))}),i},setValue:function(e,t,n){var r=e,i=this;r[t]=n,!o(r,i.get("newRecords"))&&!o(r,i.get("modifiedRecords"))&&i.get("modifiedRecords").push(r),i.fire("update",{record:r,field:t,value:n})},update:function(e,t,n){var r=e,i=this,n=null,s=null;t&&(n=n||i._getDefaultMatch(),s=i.findIndexBy(e,n),s>=0&&(r=i.getResult()[s])),r=BUI.mix(r,e),!o(r,i.get("newRecords"))&&!o(r,i.get("modifiedRecords"))&&i.get("modifiedRecords").push(r),i.fire("update",{record:r})},_addRecord:function(e,t){var n=this.getResult();t==undefined&&(t=n.length),n.splice(t,0,e),this.fire("add",{record:e,index:t})},_clearChanges:function(){var e=this;BUI.Array.empty(e.get("newRecords")),BUI.Array.empty(e.get("modifiedRecords")),BUI.Array.empty(e.get("deletedRecords"))},_filterLocal:function(e,t){var n=this,r=[];return t=t||n.getResult(),e?(BUI.each(t,function(t){e(t)&&r.push(t)}),r):t},_getDefaultMatch:function(){return this.get("matchFunction")},_getPageParams:function(){var e=this,t=e.get("sortInfo"),n=e.get("start"),r=e.get("pageSize"),i=e.get("pageIndex")||(r?n/r:0);return params={start:n,limit:r,pageIndex:i},e.get("remoteSort")&&BUI.mix(params,t),params},getAppendParams:function(){return this._getPageParams()},beforeInit:function(){this._setResult([])},_localSort:function(e,t){var n=this;n._sortData(e,t),n.fire("localsort",{field:e,direction:t})},_sortData:function(e,t,n){var r=this;n=n||r.getResult(),r.sortData(e,t,n)},afterProcessLoad:function(e,t){var n=this,r=n.get("root"),i=t.start,s=t.limit,o=n.get("totalProperty");BUI.isArray(e)?n._setResult(e):n._setResult(e[r],e[o]),n.set("start",i),s&&n.set("pageIndex",i/s),n.get("remoteSort")||n._sortData(),n.fire("load",{params:t}),!n.get("remoteFilter")&&n.get("filter")&&n.filter(n.get("filter"))},_setResult:function(e,t){var n=this,r=n.get("resultMap");t=t||e.length,r[n.get("root")]=e,r[n.get("totalProperty")]=t,n._clearChanges()}}),u}),define("bui/overlay",["bui/common","bui/overlay/overlay","bui/overlay/dialog","bui/overlay/message"],function(e){var t=e("bui/common"),n=t.namespace("Overlay");return t.mix(n,{Overlay:e("bui/overlay/overlay"),Dialog:e("bui/overlay/dialog"),Message:e("bui/overlay/message")}),t.mix(n,{OverlayView:n.Overlay.View,DialogView:n.Dialog.View}),t.Message=t.Overlay.Message,n}),define("bui/overlay/overlay",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r="x-align-arrow",i=n.UIBase,s=n.View.extend([i.PositionView,i.CloseView]),o=n.Controller.extend([i.Position,i.Align,i.Close,i.AutoShow,i.AutoHide],{renderUI:function(){var e=this,t=e.get("el"),n=e.get("arrowContainer"),r=n?t.one(n):t;e.get("showArrow")&&$(e.get("arrowTpl")).appendTo(r)},show:function(){function o(){r==="visibility"?n.css({display:"block"}):e.set("visible",!0),t.callback&&t.callback.call(e);var i=e.get("autoHideDelay"),s=e.get("delayHandler");i&&(s&&clearTimeout(s),s=setTimeout(function(){e.hide(),e.set("delayHandler",null)},i),e.set("delayHandler",s))}var e=this,t=e.get("effect"),n=e.get("el"),r=e.get("visibleMode"),i=t.effect,s=t.duration;e.get("rendered")||(e.set("visible",!0),e.render(),e.set("visible",!1),n=e.get("el")),r==="visibility"&&(e.set("visible",!0),n.css({display:"none"}));switch(i){case"linear":n.show(s,o);break;case"fade":n.fadeIn(s,o);break;case"slide":n.slideDown(s,o);break;default:o()}},hide:function(){function s(){e.get("visibleMode")==="visibility"&&n.css({display:"block"}),e.set("visible",!1),t.callback&&t.callback.call(e)}var e=this,t=e.get("effect"),n=e.get("el"),r=t.effect,i=t.duration;switch(r){case"linear":n.hide(i,s);break;case"fade":n.fadeOut(i,s);break;case"slide":n.slideUp(i,s);break;default:s()}}},{ATTRS:{effect:{value:{effect:"none",duration:0,callback:null}},autoHideDelay:{},closeable:{value:!1},showArrow:{value:!1},arrowContainer:{view:!0},arrowTpl:{value:'<s class="'+r+'"><s class="'+r+'-inner"></s></s>'},visibleMode:{value:"visibility"},visible:{value:!1},xview:{value:s}}},{xclass:"overlay"});return o.View=s,o}),define("bui/overlay/dialog",["bui/overlay/overlay"],function(e){var t=e("bui/overlay/overlay"),n=BUI.Component.UIBase,r="header-title",i=BUI.prefix,s=20,o=t.View.extend([n.StdModView,n.MaskView],{getContentElement:function(){return this.get("body")},_uiSetTitle:function(e){var t=this,n=t.get("el");n.find("."+r).html(e)},_uiSetContentId:function(e){var t=this,n=t.get("body"),r=$("#"+e).children();r.appendTo(n)},_uiSetHeight:function(e){var t=this,n=e,r=t.get("header"),i=t.get("body"),o=t.get("footer");n-=r.outerHeight()+o.outerHeight(),n-=s*2,i.height(n)},_removeContent:function(){var e=this,t=e.get("body"),n=e.get("contentId");n?t.children().appendTo($("#"+n)):t.children().remove()}},{xclass:"dialog-view"}),u=t.extend([n.StdMod,n.Mask,n.Drag],{show:function(){var e=this;align=e.get("align"),u.superclass.show.call(this),e.set("align",align)},bindUI:function(){var e=this;e.on("closeclick",function(){return e.onCancel()})},onCancel:function(){var e=this,t=e.get("cancel");return t.call(this)},_uiSetButtons:function(e){var t=this,n=t.get("footer");n.children().remove(),BUI.each(e,function(e){t._createButton(e,n)})},_createButton:function(e,t){var n=this,r='<button class="'+e.elCls+'">'+e.text+"</button>",i=$(r).appendTo(t);i.on("click",function(){e.handler.call(n,n,this)})},destructor:function(){var e=this,t=e.get("contentId"),n=e.get("body"),r=e.get("closeAction");r=="destroy"&&(e.hide(),t&&n.children().appendTo("#"+t))}},{ATTRS:{closeTpl:{view:!0,value:'<a tabindex="0" href=javascript:void("\u5173\u95ed") role="button" class="'+i+'ext-close" style=""><span class="'+i+'ext-close-x x-icon x-icon-normal">\u00d7</span></a>'},buttons:{value:[{text:"\u786e\u5b9a",elCls:"button button-primary",handler:function(){var e=this,t=e.get("success");t&&t.call(e)}},{text:"\u53d6\u6d88",elCls:"button button-primary",handler:function(e,t){this.onCancel()!==!1&&this.close()}}]},contentId:{view:!0},success:{value:function(){this.close()}},cancel:{value:function(){}},dragNode:{valueFn:function(){return this
.get("header")}},defaultLoaderCfg:{valueFn:function(){var e=this;return{property:"bodyContent",autoLoad:!1,lazyLoad:{event:"show"},loadMask:{el:e.get("body")}}}},title:{view:!0,value:""},align:{value:{node:window,points:["cc","cc"]}},mask:{value:!0},maskShared:{value:!1},headerContent:{value:'<div class="'+r+'">\u6807\u9898</div>'},footerContent:{},closeable:{value:!0},xview:{value:o}}},{xclass:"dialog"});return u.View=o,u}),define("bui/overlay/message",["bui/overlay/dialog"],function(e){function o(e,t){return function(n,r,i){return BUI.isString(r)&&(i=r,r=null),i=i||t,r=r||f,u({buttons:e,icon:i,msg:n,success:r}),s}}function u(e){s||(s=new i({icon:"info",title:""})),s.set(e),s.show()}function a(){var e=this,t=e.get("success");t&&(t.call(e),e.hide())}function f(){this.hide()}var t=e("bui/overlay/dialog"),n=BUI.prefix,r={info:"i",error:"\u00d7",success:'<i class="icon-ok icon-white"></i>',question:"?",warning:"!"},i=t.extend({renderUI:function(){this._setContent()},bindUI:function(){var e=this,t=e.get("body");e.on("afterVisibleChange",function(n){if(n.newVal&&BUI.UA.ie<8){var r=t.outerWidth();BUI.UA.ie==6&&(r=r>350?350:r),e.get("header").width(r-20),e.get("footer").width(r)}})},_setContent:function(){var e=this,t=e.get("body"),n=BUI.substitute(e.get("contentTpl"),{msg:e.get("msg"),iconTpl:e.get("iconTpl")});t.empty(),$(n).appendTo(t)},_uiSetIcon:function(e){if(!this.get("rendered"))return;this._setContent()},_uiSetMsg:function(e){if(!this.get("rendered"))return;this._setContent()}},{ATTRS:{icon:{},msg:{},iconTpl:{getter:function(){var e=this,t=e.get("icon");return'<div class="x-icon x-icon-'+t+'">'+r[t]+"</div>"}},contentTpl:{value:'{iconTpl}<div class="'+n+'message-content">{msg}</div>'}}},{xclass:"message",priority:0}),s,l=o([{text:"\u786e\u5b9a",elCls:"button button-primary",handler:a}],"info"),c=o([{text:"\u786e\u5b9a",elCls:"button button-primary",handler:a},{text:"\u53d6\u6d88",elCls:"button button-primary",handler:f}],"question");return i.Alert=l,i.Confirm=c,i.Show=u,i}),function(){var e="bui/list/";define("bui/list",["bui/common",e+"list",e+"listitem",e+"simplelist",e+"listbox"],function(t){var n=t("bui/common"),r=n.namespace("List");return n.mix(r,{List:t(e+"list"),ListItem:t(e+"listitem"),SimpleList:t(e+"simplelist"),Listbox:t(e+"listbox")}),n.mix(r,{ListItemView:r.ListItem.View,SimpleListView:r.SimpleList.View}),r})}(),define("bui/list/domlist",["bui/common"],function(e){"use strict";function s(e,t){var n=t,r=n.get("itemCls"),i=n.get("itemStatusCls");return i&&i[e]?i[e]:r+"-"+e}function u(e,n){var i=e.attributes,o=n.get("itemStatusFields"),u={};return t.each(i,function(e){var t=e.nodeName;t.indexOf(r)!==-1&&(t=t.replace(r,""),u[t]=e.nodeValue)}),u.text=$(e).text(),t.each(o,function(t,r){var i=s(r,n);$(e).hasClass(i)&&(u[t]=!0)}),u}var t=e("bui/common"),n=t.Component.UIBase.Selection,r="data-",i=t.Component.UIBase.List,o=function(){};o.ATTRS={items:{}},o.prototype={clearControl:function(){var e=this,t=e.getItemContainer(),n=e.get("itemCls");t.find("."+n).remove()},addItem:function(e,t){return this._createItem(e,t)},getItems:function(){var e=this,n=e.getAllElements(),r=[];return t.each(n,function(t){r.push(e.getItemByElement(t))}),r},updateItem:function(e){var n=this,r=n.getItems(),i=t.Array.indexOf(e,r),s=null,o;return i>=0&&(s=n.findElement(e),o=n.getItemTpl(e,i),s&&$(s).html($(o).html())),s},removeItem:function(e,t){t=t||this.findElement(e),$(t).remove()},getItemContainer:function(){var e=this.get("itemContainer");return e.length?e:this.get("el")},getItemTpl:function(e,n){var r=this,i=r.get("itemTplRender"),s=r.get("itemTpl");return i?i(e,n):t.substitute(s,e)},_createItem:function(e,t){var n=this,r=n.getItemContainer(),i=n.get("itemCls"),s=n.get("dataField"),o=n.getItemTpl(e,t),u=$(o);if(t!==undefined){var a=r.find("."+i)[t];a?u.insertBefore(a):u.appendTo(r)}else u.appendTo(r);return u.addClass(i),u.data(s,e),u},getItemStatusCls:function(e){return s(e,this)},setItemStatusCls:function(e,t,n){var r=this,i=r.getItemStatusCls(e),s=n?"addClass":"removeClass";t&&$(t)[s](i)},hasStatus:function(e,t){var n=this,r=n.getItemStatusCls(e);return $(t).hasClass(r)},setItemSelected:function(e,t,n){var r=this;n=n||r.findElement(e),r.setItemStatusCls("selected",n,t)},getAllElements:function(){var e=this,t=e.get("itemCls"),n=e.get("el");return n.find("."+t)},getItemByElement:function(e){var t=this,n=t.get("dataField");return $(e).data(n)},getFirstElementByStatus:function(e){var t=this,n=t.getItemStatusCls(e),r=t.get("el");return r.find("."+n)[0]},getElementsByStatus:function(e){var t=this,n=t.getItemStatusCls(e),r=t.get("el");return r.find("."+n)},getSelectedElements:function(){var e=this,t=e.getItemStatusCls("selected"),n=e.get("el");return n.find("."+t)},findElement:function(e){var n=this,r=n.getAllElements(),i=null;return t.each(r,function(t){if(n.getItemByElement(t)==e)return i=t,!1}),i},isElementSelected:function(e){var t=this,n=t.getItemStatusCls("selected");return e&&$(e).hasClass(n)}};var a=function(){};return a.ATTRS=t.merge(!0,i.ATTRS,n.ATTRS,{dataField:{view:!0,value:"data-item"},itemContainer:{view:!0},itemStatusFields:{value:{}},itemCls:{view:!0},cancelSelected:{value:!1},textGetter:{},defaultLoaderCfg:{value:{property:"items",dataType:"json"}},events:{value:{itemrendered:!0,itemremoved:!0,itemupdated:!0,itemsshow:!1,beforeitemsshow:!1,itemsclear:!1,itemdblclick:!1,beforeitemsclear:!1}}}),a.PARSER={items:function(e){var n=this,r=[],i=n.get("itemCls"),s=n.get("dataField"),o=e.find("."+i);return o.length||(o=e.children(),o.addClass(i)),t.each(o,function(e){var t=u(e,n);r.push(t),$(e).data(s,t)}),r}},t.augment(a,i,n,{_uiSetItems:function(e){var t=this;if(t.get("srcNode")&&!t.get("rendered"))return;this.setItems(e)},__bindUI:function(){function i(t,n){var r=e.get("multipleSelect"),i;i=e.isItemSelected(t,n),i?r?e.setItemSelected(t,!1,n):e.get("cancelSelected")&&e.setSelected(null):(r||e.clearSelected(),e.setItemSelected(t,!0,n))}var e=this,t=e.get("selectedEvent"),n=e.get("itemCls"),r=e.get("view").getItemContainer();r.delegate("."+n,"click",function(n){if(e.get("disabled"))return;var r=$(n.currentTarget),s=e.getItemByElement(r);if(e.isItemDisabled(s,r))return;var o=e.fire("itemclick",{item:s,element:r[0],domTarget:n.target,domEvent:n});o!==!1&&t=="click"&&e.isItemSelectable(s)&&i(s,r)}),t!=="click"&&r.delegate("."+n,t,function(t){if(e.get("disabled"))return;var n=$(t.currentTarget),r=e.getItemByElement(n);if(e.isItemDisabled(r,n))return;e.isItemSelectable(r)&&i(r,n)}),r.delegate("."+n,"dblclick",function(t){if(e.get("disabled"))return;var n=$(t.currentTarget),r=e.getItemByElement(n);if(e.isItemDisabled(r,n))return;e.fire("itemdblclick",{item:r,element:n[0],domTarget:t.target})}),e.on("itemrendered itemupdated",function(t){var n=t.item,r=t.element;e._syncItemStatus(n,r)})},getValueByField:function(e,t){return e&&e[t]},_syncItemStatus:function(e,n){var r=this,i=r.get("itemStatusFields");t.each(i,function(t,i){e[t]!=null&&r.get("view").setItemStatusCls(i,n,e[t])})},getStatusValue:function(e,t){var n=this,r=n.get("itemStatusFields"),i=r[t];return e[i]},getCount:function(){var e=this.getItems();return e?e.length:0},getStatusField:function(e){var t=this,n=t.get("itemStatusFields");return n[e]},setStatusValue:function(e,t,n){var r=this,i=r.get("itemStatusFields"),s=i[t];s&&(e[s]=n)},getItemText:function(e){var t=this,n=t.get("textGetter");return e?n?n(e):$(t.findElement(e)).text():""},removeItem:function(e){var n=this,r=n.get("items"),i=n.findElement(e),s;s=t.Array.indexOf(e,r),s!==-1&&r.splice(s,1),n.get("view").removeItem(e,i),n.fire("itemremoved",{item:e,domTarget:$(i)[0],element:i})},addItemAt:function(e,t){var n=this,r=n.get("items");return t===undefined&&(t=r.length),r.splice(t,0,e),n.addItemToView(e,t),e},addItemToView:function(e,t){var n=this,r=n.get("view").addItem(e,t);return n.fire("itemrendered",{item:e,domTarget:$(r)[0],element:r}),r},updateItem:function(e){var t=this,n=t.get("view").updateItem(e);t.fire("itemupdated",{item:e,domTarget:$(n)[0],element:n})},setItems:function(e){var n=this;e!=n.getItems()&&n.setInternal("items",e),n.clearControl(),n.fire("beforeitemsshow"),t.each(e,function(e,t){n.addItemToView(e,t)}),n.fire("itemsshow")},getItems:function(){return this.get("items")},getItemByElement:function(e){return this.get("view").getItemByElement(e)},getSelected:function(){var e=this,t=e.get("view").getFirstElementByStatus("selected");return e.getItemByElement(t)||null},getItemsByStatus:function(e){var n=this,r=n.get("view").getElementsByStatus(e),i=[];return t.each(r,function(e){i.push(n.getItemByElement(e))}),i},findElement:function(e){var n=this;return t.isString(e)&&(e=n.getItem(e)),this.get("view").findElement(e)},findItemByField:function(e,n){var r=this,i=r.get("items"),s=null;return t.each(i,function(t){if(t[e]!=null&&t[e]==n)return s=t,!1}),s},setItemSelectedStatus:function(e,t,n){var r=this;n=n||r.findElement(e),r.setItemStatus(e,"selected",t,n)},setAllSelection:function(){var e=this,t=e.getItems();e.setSelection(t)},isItemSelected:function(e,t){var n=this;return t=t||n.findElement(e),n.get("view").isElementSelected(t)},isItemDisabled:function(e,t){return this.hasStatus(e,"disabled",t)},setItemDisabled:function(e,t){var n=this;n.setItemStatus(e,"disabled",t)},getSelection:function(){var e=this,n=e.get("view").getSelectedElements(),r=[];return t.each(n,function(t){r.push(e.getItemByElement(t))}),r},clearControl:function(){this.fire("beforeitemsclear"),this.get("view").clearControl(),this.fire("itemsclear")},hasStatus:function(e,t,n){if(!e)return!1;var r=this,i=r.getStatusField(t);return n=n||r.findElement(e),r.get("view").hasStatus(t,n)},setItemStatus:function(e,t,n,r){var i=this;e&&(r=r||i.findElement(e));if(!i.isItemDisabled(e,r)||t==="disabled")e&&(t==="disabled"&&n&&i.clearItemStatus(e),i.setStatusValue(e,t,n),i.get("view").setItemStatusCls(t,r,n),i.fire("itemstatuschange",{item:e,status:t,value:n,element:r})),t==="selected"&&i.afterSelected(e,n,r)},clearItemStatus:function(e,n,r){var i=this,s=i.get("itemStatusFields");r=r||i.findElement(e),n?i.setItemStatus(e,n,!1,r):(t.each(s,function(t,n){i.setItemStatus(e,n,!1,r)}),s.selected||i.setItemSelected(e,!1),i.setItemStatus(e,"hover",!1))}}),a.View=o,a}),define("bui/list/keynav",["bui/common"],function(e){"use strict";var t=e("bui/common"),n=function(){};return n.ATTRS={highlightedStatus:{value:"hover"}},t.augment(n,{setHighlighted:function(e,t){if(this.hasStatus(e,"hover",t))return;var n=this,r=n.get("highlightedStatus"),i=n._getHighLightedElement(),s=i?n.getItemByElement(i):null;s!==e&&(s&&this.setItemStatus(s,r,!1,i),this.setItemStatus(e,r,!0,t),n._scrollToItem(e,t))},_getHighLightedElement:function(){var e=this,t=e.get("highlightedStatus"),n=e.get("view").getFirstElementByStatus(t);return n},getHighlighted:function(){var e=this,t=e.get("highlightedStatus"),n=e.get("view").getFirstElementByStatus(t);return e.getItemByElement(n)||null},getColumnCount:function(){var e=this,t=e.getFirstItem(),n=e.findElement(t),r=$(n);return n?parseInt(r.parent().width()/r.outerWidth(),10):1},getRowCount:function(e){var t=this;return e=e||t.getColumnCount(),(this.getCount()+e-1)/e},_getNextItem:function(e,t,n){var r=this,i=r._getCurrentIndex(),s=r.getCount(),o=e?1:-1,u;return i===-1?e?r.getFirstItem():r.getLastItem():(e||(t*=o),u=(i+t+n)%n,u>s-1&&(e?u-=s-1:u+=t),r.getItemAt(u))},_getLeftItem:function(){var e=this,t=e.getCount(),n=e.getColumnCount();return!t||n<=1?null:e._getNextItem(!1,1,t)},_getCurrentItem:function(){return this.getHighlighted()},_getCurrentIndex:function(){var e=this,t=e._getCurrentItem();return this.indexOfItem(t)},_getRightItem:function(){var e=this,t=e.getCount(),n=e.getColumnCount();return!t||n<=1?null:this._getNextItem(!0,1,t)},_getDownItem:function(){var e=this,t=e.getColumnCount(),n=e.getRowCount(t);return n<=1?null:this._getNextItem(!0,t,t*n)},getScrollContainer:function(){return this.get("el")},isScrollVertical:function(){var e=this,t=e.get("el"),n=e.get("view").getItemContainer();return t.height()<n.height()},_scrollToItem:function(e,t){var n=this;if(n.isScrollVertical()){t=t||n.findElement(e);var r=n.getScrollContainer(),i=$(t).position().top,s=r.position().top,o=r.height(),u=i-s,a=$(t).height(),f=r.scrollTop();(u<0||u>o-a)&&r.scrollTop(f+u)}},_getUpperItem:function(){var e=this,t=e.getColumnCount(),n=e.getRowCount(t);return n<=1?null:this._getNextItem(!1,t,t*n)},handleNavUp:function(e){var t=this,n=t._getUpperItem();t.setHighlighted(n)},handleNavDown:function(e){this.setHighlighted(this._getDownItem())},handleNavLeft:function(e){this.setHighlighted(this._getLeftItem())},handleNavRight:function(e){this.setHighlighted(this._getRightItem())},handleNavEnter:function(e){var t=this,n=t._getCurrentItem(),r;n&&(r=t.findElement(n),$(r).trigger("click"))},handleNavEsc:function(e){this.setHighlighted(null)},handleNavTab:function(e){this.setHighlighted(this._getRightItem())}}),n}),define("bui/list/sortable",["bui/common","bui/data"],function(e){var t=e("bui/common"),n=e("bui/data").Sortable,r=function(){};return r.ATTRS=t.merge(!0,n.ATTRS,{}),t.augment(r,n,{compare:function(e,t,n,r){var i=this,s;return n=n||i.get("sortField"),r=r||i.get("sortDirection"),!n||!r?1:(s=r==="ASC"?1:-1,$.isPlainObject(e)||(e=i.getItemByElement(e)),$.isPlainObject(t)||(t=i.getItemByElement(t)),i.get("compareFunction")(e[n],t[n])*s)},getSortData:function(){return $.makeArray(this.get("view").getAllElements())},sort:function(e,n){var r=this,i=r.sortData(e,n),s=r.get("view").getItemContainer();r.get("store")||r.sortData(e,n,r.get("items")),t.each(i,function(e){$(e).appendTo(s)})}}),r}),define("bui/list/simplelist",["bui/common","bui/list/domlist","bui/list/keynav","bui/list/sortable"],function(e){var t=e("bui/common"),n=t.Component.UIBase,r=t.UA,i=e("bui/list/domlist"),s=e("bui/list/keynav"),o=e("bui/list/sortable"),u=t.prefix+"list-item",a=t.Component.View.extend([i.View],{setElementHover:function(e,t){var n=this;n.setItemStatusCls("hover",e,t)}},{ATTRS:{itemContainer:{valueFn:function(){return this.get("el").find(this.get("listSelector"))}}}},{xclass:"simple-list-view"}),f=t.Component.Controller.extend([i,n.Bindable,s,o],{bindUI:function(){var e=this,t=e.get("itemCls"),n=e.get("view").getItemContainer();n.delegate("."+t,"mouseover",function(t){if(e.get("disabled"))return;var n=t.currentTarget,i=e.getItemByElement(n);if(e.isItemDisabled(t.item,t.currentTarget))return;!(r.ie&&r.ie<8)&&e.get("focusable")&&e.get("highlightedStatus")==="hover"?e.setHighlighted(i,n):e.setItemStatus(i,"hover",!0,n)}).delegate("."+t,"mouseout",function(t){if(e.get("disabled"))return;var n=$(t.currentTarget);e.get("view").setElementHover(n,!1)})},onAdd:function(e){var t=this,n=t.get("store"),r=e.record;t.getCount()==0?t.setItems(n.getResult()):t.addItemToView(r,e.index)},onRemove:function(e){var t=this,n=e.record;t.removeItem(n)},onUpdate:function(e){this.updateItem(e.record)},onLocalSort:function(e){this.get("frontSortable")?this.sort(e.field,e.direction):this.onLoad(e)},onLoad:function(){var e=this,t=e.get("store"),n=t.getResult();e.set("items",n)},onFiltered:function(e){var t=this,n=e.data;t.set("items",n)}},{ATTRS:{frontSortable:{value:!1},focusable:{value:!1},items:{view:!0,value:[]},itemCls:{view:!0,value:u},idField:{value:"value"},listSelector:{view:!0,value:"ul"},itemTpl:{view:!0,value:'<li role="option" class="'+u+'">{text}</li>'},tpl:{value:"<ul></ul>"},xview:{value:a}}},{xclass:"simple-list",prority:0});return f.View=a,f}),define("bui/list/listbox",["bui/list/simplelist"],function(e){var t=e("bui/list/simplelist"),n=t.extend({bindUI:function(){var e=this;e.on("selectedchange",function(e){var t=e.item,n=$(e.domTarget),r=n.find("input");t&&r.attr("checked",e.selected)})}},{ATTRS:{itemTpl:{value:'<li><span class="x-checkbox"></span>{text}</li>'},multipleSelect:{value:!0}}},{xclass:"listbox"});return n}),define("bui/list/listitem",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=n.View.extend([r.ListItemView],{}),s=n.Controller.extend([r.ListItem],{},{ATTRS:{elTagName:{view:!0,value:"li"},xview:{value:i},tpl:{view:!0,value:"<span>{text}</span>"}}},{xclass:"list-item"});return s.View=i,s}),define("bui/list/list",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=n.Controller.extend([r.ChildList],{},{ATTRS:{elTagName:{view:!0,value:"ul"},idField:{value:"id"},defaultChildClass:{value:"list-item"}}},{xclass:"list"});return i}),define("bui/picker",["bui/common","bui/picker/mixin","bui/picker/picker","bui/picker/listpicker"],function(e){var t=e("bui/common"),n=t.namespace("Picker");return t.mix(n,{Mixin:e("bui/picker/mixin"),Picker:e("bui/picker/picker"),ListPicker:e("bui/picker/listpicker")}),n}),define("bui/picker/mixin",function(e){var t=function(){};return t.ATTRS={innerControl:{getter:function(){return this.get("children")[0]}},triggerEvent:{value:"click"},autoSetValue:{value:!0},changeEvent:{value:"selectedchange"},autoHide:{value:!0},hideEvent:{value:"itemclick"},textField:{},align:{value:{points:["bl","tl"],offset:[0,0]}},valueField:{}},t.prototype={__bindUI:function(){var e=this,t=e.get("hideEvent"),n=$(e.get("trigger"));e.on("show",function(t){e.get("isInit")||e._initControl();if(e.get("autoSetValue")){var n=e.get("valueField")||e.get("textField")||e.get("curTrigger"),r=$(n).val();e.setSelectedValue(r)}})},_initControl:function(){var e=this;if(e.get("isInit"))return;if(!e.get("innerControl")){var t=e.createControl();e.get("children").push(t)}e.initControlEvent(),e.set("isInit",!0)},initControl:function(){this._initControl()},createControl:function(){},initControlEvent:function(){var e=this,t=e.get("innerControl"),n=$(e.get("trigger")),r=e.get("hideEvent");t.on(e.get("changeEvent"),function(t){var r=e.get("curTrigger"),i=e.get("textField")||r||n,s=e.get("valueField"),o=e.getSelectedValue(),u=!1;if(i){var a=e.getSelectedText(),f=$(i).val();a!=f&&($(i).val(a),u=!0,$(i).trigger("change"))}if(s&&e.get("autoSetValue")){var l=$(s).val();s!=l&&($(s).val(o),u=!0,$(s).trigger("change"))}u&&e.onChange(a,o,t)}),r&&t.on(e.get("hideEvent"),function(){var t=e.get("curTrigger");try{t&&t.focus()}catch(n){BUI.log(n)}e.hide()})},setSelectedValue:function(e){},getSelectedValue:function(){},getSelectedText:function(){},focus:function(){this.get("innerControl").focus()},onChange:function(e,t,n){var r=this,i=r.get("curTrigger");r.fire("selectedchange",{value:t,text:e,curTrigger:i})},handleNavEsc:function(e){this.hide()},_uiSetValueField:function(e){var t=this;e!=null&&e!==""&&t.get("autoSetValue")&&t.setSelectedValue($(e).val())},_getTextField:function(){var e=this;return e.get("textField")||e.get("curTrigger")}},t}),define("bui/picker/picker",["bui/overlay","bui/picker/mixin"],function(e){var t=e("bui/overlay").Overlay,n=e("bui/picker/mixin"),r=t.extend([n],{},{ATTRS:{}},{xclass:"picker"});return r}),define("bui/picker/listpicker",["bui/picker/picker","bui/list"],function(e){var t=e("bui/list"),n=e("bui/picker/picker"),r=n.extend({initializer:function(){var e=this,t=e.get("children"),n=e.get("list");n||t.push({})},setSelectedValue:function(e){e=e?e.toString():"",this.get("isInit")||this._initControl();var t=this,n=t.get("list"),r=t.getSelectedValue();e!==r&&n.getCount()&&(n.get("multipleSelect")&&n.clearSelection(),n.setSelectionByField(e.split(",")))},onChange:function(e,t,n){var r=this,i=r.get("curTrigger");r.fire("selectedchange",{value:t,text:e,curTrigger:i,item:n.item})},getSelectedValue:function(){return this.get("isInit")||this._initControl(),this.get("list").getSelectionValues().join(",")},getSelectedText:function(){return this.get("isInit")||this._initControl(),this.get("list").getSelectionText().join(",")}},{ATTRS:{defaultChildClass:{value:"simple-list"},list:{getter:function(){return this.get("children")[0]}}}},{xclass:"list-picker"});return r}),function(){var e="bui/form/";define("bui/form",["bui/common",e+"fieldcontainer",e+"form",e+"row",e+"fieldgroup",e+"horizontal",e+"rules",e+"field",e+"fieldgroup"],function(t){var n=t("bui/common"),r=n.namespace("Form"),i=t(e+"tips");return n.mix(r,{Tips:i,TipItem:i.Item,FieldContainer:t(e+"fieldcontainer"),Form:t(e+"form"),Row:t(e+"row"),Group:t(e+"fieldgroup"),HForm:t(e+"horizontal"),Rules:t(e+"rules"),Field:t(e+"field"),FieldGroup:t(e+"fieldgroup")}),r})}(),define("bui/form/tips",["bui/common","bui/overlay"],function(e){var t=e("bui/common"),n=t.prefix,r=e("bui/overlay").Overlay,i="data-tip",s=n+"form-tip-container",o=r.extend({initializer:function(){var e=this,t=e.get("render");if(!t){var n=$(e.get("trigger")).parent();e.set("render",n)}},renderUI:function(){var e=this;e.resetVisible()},resetVisible:function(){var e=this,t=$(e.get("trigger"));t.val()?e.set("visible",!1):(e.set("align",{node:$(e.get("trigger")),points:["cl","cl"]}),e.set("visible",!0))},bindUI:function(){var e=this,t=$(e.get("trigger"));e.get("el").on("click",function(){e.hide(),t.focus()}),t.on("click focus",function(){e.hide()}),t.on("blur",function(){e.resetVisible()})}},{ATTRS:{trigger:{},text:{},iconCls:{},tpl:{value:'<span class="{iconCls}"></span><span class="tip-text">{text}</span>'}}},{xclass:"form-tip"}),u=function(e){if(this.constructor!==u)return new u(e);u.superclass.constructor.call(this,e),this._init()};return u.ATTRS={form:{},items:{valueFn:function(){return[]}}},t.extend(u,t.Base),t.augment(u,{_init:function(){var e=this,n=$(e.get("form"));n.length&&(t.each($.makeArray(n[0].elements),function(t){var n=$(t).attr(i);n&&e._initFormElement(t,$.parseJSON(n))}),n.addClass(s))},_initFormElement:function(e,t){t&&(t.trigger=e);var n=this,r=n.get("items"),i=new o(t);r.push(i)},getItem:function(e){var n=this,r=n.get("items"),i=null;return t.each(r,function(t){if($(t.get("trigger")).attr("name")===e)return i=t,!1}),i},resetVisible:function(){var e=this,n=e.get("items");t.each(n,function(e){e.resetVisible()})},render:function(){var e=this,n=e.get("items");t.each(n,function(e){e.render()})},destroy:function(){var e=this,n=e.get(n);t.each(n,function(e){e.destroy()})}}),u.Item=o,u}),define("bui/form/basefield",["bui/common","bui/form/tips","bui/form/valid","bui/form/remote"],function(e){var t=e("bui/common"),n=t.Component,r=e("bui/form/tips").Item,i=e("bui/form/valid"),s=e("bui/form/remote"),o=t.prefix+"form-field-error",u="bui-form-tip-container",a="data-error",f=n.View.extend([s.View,i.View],{renderUI:function(){var e=this,t=e.get("control");if(!t){var n=e.get("controlTpl"),r=e.getControlContainer();if(n){var t=$(n).appendTo(r);e.set("control",t)}}else e.set("controlContainer",t.parent())},clearErrors:function(){var e=this,t=e.get("msgEl");t&&(t.remove(),e.set("msgEl",null)),e.get("el").removeClass(o)},showError:function(e,n){var r=this,i=r.get("control"),s=t.substitute(n,{error:e}),u=$(s);u.appendTo(i.parent()),r.set("msgEl",u),r.get("el").addClass(o)},getControlContainer:function(){var e=this,n=e.get("el"),r=e.get("controlContainer");return r&&t.isString(r)&&(r=n.find(r)),r&&r.length?r:n},getLoadingContainer:function(){return this.getControlContainer()},_uiSetName:function(e){var t=this;t.get("control").attr("name",e)}},{ATTRS:{error:{},controlContainer:{},msgEl:{},control:{}}}),l=n.Controller.extend([s,i],{isField:!0,initializer:function(){var e=this;e.on("afterRenderUI",function(){var t=e.get("tip");if(t){var n=e.getTipTigger();n&&n.parent().addClass(u),t.trigger=n,t.autoRender=!0,t=new r(t),e.set("tip",t)}})},bindUI:function(){var e=this,t=e.get("validEvent"),n=e.get("changeEvent"),r=e.get("firstValidEvent"),i=e.getInnerControl();i.is("select")&&(t="change"),i.on(t,function(){var t=e.getControlValue(i);e.validControl(t)}),r&&i.on(r,function(){if(!e.get("hasValid")){var t=e.getControlValue(i);e.validControl(t)}}),e.on(n,function(){e.onValid()}),e.on("remotecomplete",function(t){e._setError(t.error)})},onValid:function(){var e=this,t=e.getControlValue();t=e.parseValue(t),e.isCurrentValue(t)||(e.setInternal("value",t),e.onChange())},onChange:function(){this.fire("change")},isCurrentValue:function(e){return e==this.get("value")},_clearError:function(){this.set("error",null),this.get("view").clearErrors()},_setError:function(e){this.set("error",e),this.showErrors()},getControlValue:function(e){var t=this;return e=e||t.getInnerControl(),e.val()},getControlContainer:function(){return this.get("view").getControlContainer()},getRemoteParams:function(){var e=this,t={};return t[e.get("name")]=e.getControlValue(),t},setControlValue:function(e){var t=this,n=t.getInnerControl();n.val(e)},parseValue:function(e){return e},valid:function(){var e=this;e.validControl()},validControl:function(e){var t=this,n;return e=e||t.getControlValue(),preError=t.get("error"),n=t.getValidError(e),t.setInternal("hasValid",!0),n?(t._setError(n),t.fire("error",{msg:n,value:e}),preError!==n&&t.fire("validchange",{valid:!1})):(t._clearError(),t.fire("valid"),preError&&t.fire("validchange",{valid:!0})),!n},focus:function(){this.getInnerControl().focus()},change:function(){var e=this.getInnerControl();e.change()},blur:function(){this.getInnerControl().blur()},isValid:function(){var e=this;return e.get("hasValid")||e.validControl(),!e.get("error")},getError:function(){return this.get("error")},getErrors:function(){var e=this.getError();return e?[e]:[]},clearErrors:function(e){var t=this;t._clearError(),e&&t.getControlValue()!=t.get("value")&&t.setControlValue(t.get("value"))},getInnerControl:function(){return this.get("view").get("control")},getTipTigger:function(){return this.getInnerControl()},destructor:function(){var e=this,t=e.get("tip");t&&t.destroy&&t.destroy()},setInnerWidth:function(e){var n=this,r=n.getInnerControl(),i=r.siblings(),s=r.outerWidth()-r.width();t.each(i,function(e){s+=$(e).outerWidth()}),r.width(e-s)},_resetTip:function(){var e=this,t=e.get("tip");t&&t.resetVisible()},resetTip:function(){this._resetTip()},_uiSetValue:function(e){var t=this;t.setControlValue(e),t.get("rendered")&&(t.validControl(),t.onChange()),t._resetTip()},_uiSetDisabled:function(e){var n=this,r=n.getInnerControl(),i=n.get("children");r.attr("disabled",e),n.get("rendered")&&(e&&n.clearErrors(),e||n.valid()),t.each(i,function(t){t.set("disabled",e)})},_uiSetWidth:function(e){var t=this;e!=null&&t.get("forceFit")&&t.setInnerWidth(e)}},{ATTRS:{hasValid:{value:!1},forceFit:{value:!1},tip:{},changeEvent:{value:"valid"},firstValidEvent:{value:"blur"},validEvent:{value:"keyup change"},name:{view:!0},showError:{view:!0,value:!0},value:{view:!0},label:{},controlContainer:{view:!0},control:{view:!0},controlTpl:{view:!0,value:'<input type="text"/>'},events:{value:{error:!1,valid:!1,change:!0,validchange:!0}},tpl:{value:"<label>{label}</label>"},xview:{value:f}},PARSER:{control:function(e){var t=e.find("input,select,textarea");return t.length?t:e},disabled:function(e){return!!e.attr("disabled")},value:function(e){var t=this,n="select,input,textarea",r=t.get("value");return r||(e.is(n)?(r=e.val(),!r&&e.is("select")&&(r=e.attr("value"))):r=e.find(n).val()),r},name:function(e){var t=this,n="select,input,textarea",r=t.get("name");return r||(e.is(n)?r=e.attr("name"):r=e.find(n).attr("name")),r}}},{xclass:"form-field"});return l.View=f,l}),define("bui/form/textfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({},{xclass:"form-field-text"});return n}),define("bui/form/textareafield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({_uiSetRows:function(e){var t=this,n=t.getInnerControl();e&&n.attr("rows",e)},_uiSetCols:function(e){var t=this,n=t.getInnerControl();e&&n.attr("cols",e)}},{ATTRS:{controlTpl:{value:"<textarea></textarea>"},rows:{},cols:{},decorateCfgFields:{value:{rows:!0,cols:!0}}}},{xclass:"form-field-textarea"});return n}),define("bui/form/numberfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({parseValue:function(e){if(e==""||e==null)return null;if(BUI.isNumber(e))return e;var t=this,n=t.get("allowDecimals");return e=e.replace(/\,/g,""),n?parseFloat(parseFloat(e).toFixed(t.get("decimalPrecision"))):parseInt(e,10)},_uiSetMax:function(e){this.addRule("max",e)},_uiSetMin:function(e){this.addRule("min",e)}},{ATTRS:{max:{},min:{},decorateCfgFields:{value:{min:!0,max:!0}},validEvent:{value:"keyup change"},defaultRules:{value:{number:!0}},allowDecimals:{value:!0},decimalPrecision:{value:2},step:{value:1}}},{xclass:"form-field-number"});return n}),define("bui/form/hiddenfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({},{ATTRS:{controlTpl:{value:'<input type="hidden"/>'},tpl:{value:""}}},{xclass:"form-field-hidden"});return n}),define("bui/form/readonlyfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({},{ATTRS:{controlTpl:{value:'<input type="text" readonly="readonly"/>'}}},{xclass:"form-field-readonly"});return n}),define("bui/form/selectfield",["bui/common","bui/form/basefield"],function(e){function r(e,n,r){e.children().remove();var s=r.get("emptyText");s&&r.get("showBlank")&&i("",s,e),t.each(n,function(t){i(t.value,t.text,e)})}function i(e,t,n){var r=new Option(t,e),i=n[0].options;i[i.length]=r}var t=e("bui/common"),n=e("bui/form/basefield"),s=n.extend({renderUI:function(){var e=this,t=e.getInnerControl(),n=e.get("select");if(e.get("srcNode")&&t.is("select"))return;$.isPlainObject(n)&&e._initSelect(n)},_initSelect:function(e){var n=this,r=n.get("items");t.use("bui/select",function(t){e.render=n.getControlContainer(),e.valueField=n.getInnerControl(),e.autoRender=!0,e=new t.Select(e),n.set("select",e),n.set("isCreate",!0),n.get("children").push(e),e.on("change",function(t){var r=e.getSelectedValue();n.set("value",r)})})},setItems:function(e){var n=this,i=n.get("select");if($.isPlainObject(e)){var s=[];t.each(e,function(e,t){s.push({value:t,text:e})}),e=s}var o=n.getInnerControl();o.is("select")&&(r(o,e,n),n.setControlValue(n.get("value")),n.getControlValue()||n.setInternal("value","")),i&&(i.set?i.set("items",e):i.items=e)},setControlValue:function(e){var t=this,n=t.get("select"),r=t.getInnerControl();r.val(e),n&&n.set&&n.getSelectedValue()!==e&&n.setSelectedValue(e)},getSelectedText:function(){var e=this,t=e.get("select"),n=e.getInnerControl();if(n.is("select")){var r=n[0],i=r.options[r.selectedIndex];return i?i.text:""}return t.getSelectedText()},getTipTigger:function(){var e=this,t=e.get("select");return t&&t.rendered?t.get("el").find("input"):e.get("el")},_uiSetItems:function(e){e&&this.setItems(e)},setInnerWidth:function(e){var t=this,n=t.getInnerControl(),r=t.get("select"),i=n.outerWidth()-n.width();n.width(e-i),r&&r.set&&r.set("width",e)}},{ATTRS:{items:{},controlTpl:{value:'<input type="hidden"/>'},showBlank:{value:!0},emptyText:{value:"\u8bf7\u9009\u62e9"},select:{shared:!1,value:{}}},PARSER:{emptyText:function(e){if(!this.get("showBlank"))return"";var t=e.find("option"),n=this.get("emptyText");return t.length&&(n=$(t[0]).text()),n}}},{xclass:"form-field-select"});return s}),define("bui/form/datefield",["bui/common","bui/form/basefield","bui/calendar"],function(e){var t=e("bui/common"),n=e("bui/form/basefield"),r=t.Date,i=n.extend({renderUI:function(){var e=this,t=e.get("datePicker");$.isPlainObject(t)&&e.initDatePicker(t),(t.get&&t.get("showTime")||t.showTime)&&e.getInnerControl().addClass("calendar-time")},initDatePicker:function(e){var n=this;t.use("bui/calendar",function(t){e.trigger=n.getInnerControl(),e.autoRender=!0,e=new t.DatePicker(e),n.set("datePicker",e),n.set("isCreatePicker",!0),n.get("children").push(e)})},setControlValue:function(e){var n=this,i=n.getInnerControl();t.isDate(e)&&(e=r.format(e,n._getFormatMask())),i.val(e)},_getFormatMask:function(){var e=this,t=e.get("datePicker");return t.showTime||t.get&&t.get("showTime")?"yyyy-mm-dd HH:MM:ss":"yyyy-mm-dd"},parseValue:function(e){return t.isNumber(e)?new Date(e):r.parse(e)},isCurrentValue:function(e){return r.isEquals(e,this.get("value"))},_uiSetMax:function(e){this.addRule("max",e);var t=this,n=t.get("datePicker");n&&(n.set?n.set("maxDate",e):n.maxDate=e)},_uiSetMin:function(e){this.addRule("min",e);var t=this,n=t.get("datePicker");n&&(n.set?n.set("minDate",e):n.minDate=e)}},{ATTRS:{controlTpl:{value:'<input type="text" class="calendar"/>'},defaultRules:{value:{date:!0}},max:{},min:{},value:{setter:function(e){return t.isNumber(e)?new Date(e):e}},datePicker:{shared:!1,value:{}},isCreatePicker:{value:!0}},PARSER:{datePicker:function(e){var n=this,r=n.get("datePicker")||{};return e.hasClass("calendar-time")&&t.mix(r,{showTime:!0}),r}}},{xclass:"form-field-date"});return i}),define("bui/form/checkfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.extend({onValid:function(){var e=this,t=e._getControlChecked();e.setInternal("checked",t),e.fire("change"),t?e.fire("checked"):e.fire("unchecked")},_setControlChecked:function(e){var t=this,n=t.getInnerControl();n.attr("checked",!!e)},_getControlChecked:function(
){var e=this,t=e.getInnerControl();return!!t.attr("checked")},_uiSetValue:function(e){this.setControlValue(e)},_uiSetWidth:function(e){},_uiSetChecked:function(e){var t=this;t._setControlChecked(e),t.get("rendered")&&t.onValid()}},{ATTRS:{validEvent:{value:"click"},checked:{value:!1},events:{value:{checked:!1,unchecked:!1}}},PARSER:{checked:function(e){return!!e.attr("checked")}}},{xclass:"form-check-field"});return n}),define("bui/form/checkboxfield",["bui/form/checkfield"],function(e){var t=e("bui/form/checkfield"),n=t.extend({},{ATTRS:{controlTpl:{view:!0,value:'<input type="checkbox"/>'},controlContainer:{value:".checkbox"},tpl:{value:'<label><span class="checkbox"></span>{label}</label>'}}},{xclass:"form-field-checkbox"});return n}),define("bui/form/radiofield",["bui/form/checkfield"],function(e){var t=e("bui/form/checkfield"),n=t.extend({bindUI:function(){var e=this,t=e.get("parent"),n=e.get("name");t&&e.getInnerControl().on("click",function(r){var i=t.getFields(n);BUI.each(i,function(t){t!=e&&t.set("checked",!1)})})}},{ATTRS:{controlTpl:{view:!0,value:'<input type="radio"/>'},controlContainer:{value:".radio"},tpl:{value:'<label><span class="radio"></span>{label}</label>'}}},{xclass:"form-field-radio"});return n}),define("bui/form/plainfield",["bui/form/basefield"],function(e){var t=e("bui/form/basefield"),n=t.View.extend({_uiSetValue:function(e){var t=this,n=t.get("textEl"),r=t.getControlContainer(),i=t.get("renderer"),s=i?i(e):e,o=t.get("width"),u=0,a;n&&n.remove(),s=s||" ",a=BUI.substitute(t.get("textTpl"),{text:s}),n=$(a).appendTo(r),u=n.outerWidth()-n.width(),n.width(o-u),t.set("textEl",n)}},{ATTRS:{textEl:{},value:{}}},{xclass:"form-field-plain-view"}),r=t.extend({},{ATTRS:{controlTpl:{value:'<input type="hidden"/>'},textTpl:{view:!0,value:'<span class="x-form-text">{text}</span>'},renderer:{view:!0,value:function(e){return e}},tpl:{value:""},xview:{value:n}}},{xclass:"form-field-plain"});return r}),define("bui/form/listfield",["bui/common","bui/form/basefield","bui/list"],function(e){function i(e){var n=e;return $.isPlainObject(e)&&(n=[],t.each(e,function(e,t){n.push({text:e,value:t})})),n}var t=e("bui/common"),n=e("bui/list"),r=e("bui/form/basefield"),n=r.extend({initializer:function(){var e=this;e._initList()},_getList:function(){var e=this,t=e.get("children");return t[0]},bindUI:function(){var e=this,t=e._getList();t&&t.on("selectedchange",function(){var n=e._getListValue(t);e.set("value",n)})},_getListValue:function(e){var t=this;return e=e||t._getList(),e.getSelectionValues().join(",")},setControlValue:function(e){var t=this,n=t.getInnerControl(),r=t._getList();n.val(e),t._getListValue(r)!==e&&r.getCount()&&(r.get("multipleSelect")&&r.clearSelection(),r.setSelectionByField(e.split(",")))},syncUI:function(){this.set("list",this._getList())},_initList:function(){var e=this,n=e.get("defaultListCfg"),r=e.get("children"),i=e.get("list")||{};if(r[0])return;$.isPlainObject(i)&&t.mix(i,n),r.push(i)},setItems:function(e){var t=this,n=t.get("value"),r=t._getList();r.set("items",i(e)),r.setSelectionByField(n.split(","))},_uiSetItems:function(e){e&&this.setItems(e)}},{ATTRS:{controlTpl:{value:'<input type="hidden"/>'},defaultListCfg:{value:{xclass:"simple-list"}},items:{setter:function(e){if($.isPlainObject(e)){var n=[];t.each(e,function(e,t){n.push({value:t,text:e})}),e=n}return e}},list:{}},PARSER:{list:function(e){var t=e.find(".bui-simple-list");if(t.length)return{srcNode:t}}}},{xclass:"form-field-list"});return n}),define("bui/form/uploaderfield",["bui/common","bui/form/basefield","bui/form/rules"],function(e){var t=e("bui/common"),n=t.JSON,r=e("bui/form/basefield"),i=e("bui/form/rules"),s=r.extend({renderUI:function(){var e=this,t=e.getInnerControl();if(e.get("srcNode")&&t.get(0).type==="file")return;e._initControlValue(),e._initUpload()},_initUpload:function(){var e=this,n=e.get("children"),r=e.get("uploader")||{};t.use("bui/uploader",function(t){r.render=e.getControlContainer(),r.autoRender=!0,r=new t.Uploader(r),e.set("uploader",r),e.set("isCreate",!0),e.get("children").push(r),e._initQueue(r.get("queue")),r.on("success",function(t){var n=e._getUploaderResult();e.setControlValue(n)}),r.get("queue").on("itemremoved",function(){var t=e._getUploaderResult();e.setControlValue(t)})})},_getUploaderResult:function(){var e=this,n=e.get("uploader"),r=n.get("queue"),i=r.getItems(),s=[];return t.each(i,function(e){e.result&&s.push(e.result)}),s},setControlValue:function(e){var t=this,r=t.getInnerControl();r.val(n.stringify(e))},_initControlValue:function(){var e=this,n=e.getControlValue(),r;n&&(r=t.JSON.parse(n),e.set("value",r))},_initQueue:function(e){var n=this,r=n.get("value"),i=[];t.each(r,function(e){var n=t.cloneObject(e);n.success=!0,n.result=e,i.push(n)}),e&&e.setItems(i)}},{ATTRS:{controlTpl:{value:'<input type="hidden"/>'},uploader:{setter:function(e){var t=this.get("disabled");return e&&e.isController&&e.set("disabled",t),e}},disabled:{setter:function(e){var t=this,n=t.get("uploader");n&&n.isController&&n.set("disabled",e)}},value:{shared:!1,value:[]},defaultRules:function(){!0}}},{xclass:"form-field-uploader"});return i.add({name:"uploader",msg:"\u4e0a\u4f20\u6587\u4ef6\u9009\u62e9\u6709\u8bef\uff01",validator:function(e,t,n,r){var i=r.get("uploader");if(i&&!i.isValid())return n}}),s}),define("bui/form/checklistfield",["bui/common","bui/form/listfield"],function(e){"use strict";var t=e("bui/common"),n=e("bui/form/listfield"),r=n.extend({},{ATTRS:{defaultListCfg:{value:{itemTpl:'<li><span class="x-checkbox"></span>{text}</li>',multipleSelect:!0,allowTextSelection:!1}}}},{xclass:"form-field-checklist"});return r}),define("bui/form/radiolistfield",["bui/common","bui/form/listfield"],function(e){"use strict";var t=e("bui/common"),n=e("bui/form/listfield"),r=n.extend({},{ATTRS:{defaultListCfg:{value:{itemTpl:'<li><span class="x-radio"></span>{text}</li>',allowTextSelection:!1}}}},{xclass:"form-field-radiolist"});return r}),function(){var e="bui/form/";define(e+"field",["bui/common",e+"textfield",e+"datefield",e+"selectfield",e+"hiddenfield",e+"numberfield",e+"checkfield",e+"radiofield",e+"checkboxfield",e+"plainfield",e+"listfield",e+"uploaderfield",e+"checklistfield",e+"radiolistfield",e+"textareafield"],function(t){var n=t("bui/common"),r=t(e+"basefield");return n.mix(r,{Text:t(e+"textfield"),Date:t(e+"datefield"),Select:t(e+"selectfield"),Hidden:t(e+"hiddenfield"),Number:t(e+"numberfield"),Check:t(e+"checkfield"),Radio:t(e+"radiofield"),Checkbox:t(e+"checkboxfield"),Plain:t(e+"plainfield"),List:t(e+"listfield"),TextArea:t(e+"textareafield"),Uploader:t(e+"uploaderfield"),CheckList:t(e+"checklistfield"),RadioList:t(e+"radiolistfield")}),r})}(),define("bui/form/valid",["bui/common","bui/form/rules"],function(e){var t=e("bui/common"),n=e("bui/form/rules"),r=function(){};r.prototype={getErrorsContainer:function(){var e=this,n=e.get("errorContainer");return n?t.isString(n)?e.get("el").find(n):n:e.getContentElement()},showErrors:function(e){var n=this,r=n.getErrorsContainer(),i=n.get("errorTpl");n.clearErrors();if(!n.get("showError"))return;if(n.get("showOneError")){e&&e.length&&n.showError(e[0],i,r);return}t.each(e,function(e){e&&n.showError(e,i,r)})},showError:function(e,t,n){},clearErrors:function(){}};var i=function(){};return i.ATTRS={defaultRules:{value:{}},defaultMessages:{value:{}},rules:{shared:!1,value:{}},messages:{shared:!1,value:{}},validator:{},errorContainer:{view:!0},errorTpl:{view:!0,value:'<span class="x-field-error"><span class="x-icon x-icon-mini x-icon-error">!</span><label class="x-field-error-text">{error}</label></span>'},showError:{view:!0,value:!0},showOneError:{},error:{},pauseValid:{value:!1}},i.prototype={__bindUI:function(){var e=this;e.on("afterDisabledChange",function(t){var n=t.newVal;n?e.clearErrors(!1,!1):e.valid()})},isValid:function(){},valid:function(){},validControl:function(){},validRules:function(e,t){if(!e)return null;if(this.get("pauseValid"))return null;var r=this,i=r._getValidMessages(),s=null;for(var o in e)if(e.hasOwnProperty(o)){var u=e[o];s=n.valid(o,t,u,i[o],r);if(s)break}return s},_getValidMessages:function(){var e=this,n=e.get("defaultMessages"),r=e.get("messages");return t.merge(n,r)},getValidError:function(e){var t=this,n=t.get("validator"),r=null;return r=t.validRules(t.get("defaultRules"),e)||t.validRules(t.get("rules"),e),!r&&!this.get("pauseValid")&&(t.parseValue&&(e=t.parseValue(e)),r=n?n.call(this,e):""),r},getErrors:function(){},showErrors:function(e){var t=this,e=e||t.getErrors();t.get("view").showErrors(e)},clearErrors:function(e,n){n=n==null?!0:n;var r=this,i=r.get("children");n&&t.each(i,function(t){t.clearErrors&&(t.field?t.clearErrors(e):t.clearErrors(e,n))}),r.set("error",null),r.get("view").clearErrors()},addRule:function(e,t,n){var r=this,i=r.get("rules"),s=r.get("messages");i[e]=t,n&&(s[e]=n)},addRules:function(e,n){var r=this;t.each(e,function(e,t){var i=n?n[t]:null;r.addRule(t,e,i)})},removeRule:function(e){var t=this,n=t.get("rules");delete n[e]},clearRules:function(){var e=this;e.set("rules",{})}},i.View=r,i}),define("bui/form/groupvalid",["bui/form/valid"],function(e){function r(){}function i(){}var t="x-form-error",n=e("bui/form/valid");return BUI.augment(r,n.View,{showError:function(e,n,r){var i=BUI.substitute(n,{error:e}),s=$(i);s.appendTo(r),s.addClass(t)},clearErrors:function(){var e=this,n=e.getErrorsContainer();n.children("."+t).remove()}}),i.ATTRS=ATTRS=BUI.merge(!0,n.ATTRS,{events:{value:{validchange:!0,change:!0}}}),BUI.augment(i,n,{__bindUI:function(){var e=this,t="validchange change";e.on(t,function(t){var n=t.target;if(n!=this&&e.get("showError")){var r=n.isValid();e._hasAllChildrenValid()&&(r=r&&e.isChildrenValid(),r&&(e.validControl(e.getRecord()),r=e.isSelfValid())),r?e.clearErrors():e.showErrors()}})},isValid:function(){if(this.get("disabled"))return!0;var e=this,t=e.isChildrenValid();return t&&e.isSelfValid()},valid:function(){var e=this,t=e.get("children");if(e.get("disabled"))return;BUI.each(t,function(e){e.get("disabled")||e.valid()})},_hasAllChildrenValid:function(){var e=this,t=e.get("children"),n=!0;return BUI.each(t,function(e){if(!e.get("disabled")&&e.get("hasValid")===!1)return n=!1,!1}),n},isChildrenValid:function(){var e=this,t=e.get("children"),n=!0;return BUI.each(t,function(e){if(!e.get("disabled")&&!e.isValid())return n=!1,!1}),n},isSelfValid:function(){return!this.get("error")},validControl:function(e){var t=this,n=t.getValidError(e);t.set("error",n)},getErrors:function(){var e=this,t=e.get("children"),n=e.get("showChildError"),r=null,i=[];return n&&BUI.each(t,function(e){e.getErrors&&(i=i.concat(e.getErrors()))}),e._hasAllChildrenValid()&&e.isChildrenValid()&&(r=e.get("error"),r&&i.push(r)),i},_uiSetErrorTpl:function(e){var t=this,n=t.get("children");BUI.each(n,function(t){t.get("userConfig").errorTpl||t.set("errorTpl",e)})}}),i.View=r,i}),define("bui/form/fieldcontainer",["bui/common","bui/form/field","bui/form/groupvalid"],function(e){function f(e){return e.is(a)}function l(e,n){if(e!=n){if(f(e))return[e];var r=e.attr("class");if(r&&(r.indexOf(u)!==-1||r.indexOf(o)!==-1))return[e]}var i=[],s=e.children();return t.each(s,function(e){i=i.concat(l($(e),n))}),i}var t=e("bui/common"),n=e("bui/form/field"),r=e("bui/form/groupvalid"),i=t.prefix,s="form-field",o=i+s,u=i+"form-group",a="input,select,textarea",c=t.Component.View.extend([r.View]),h=t.Component.Controller.extend([r],{syncUI:function(){var e=this,n=e.getFields(),r=e.get("validators");t.each(n,function(e){var t=e.get("name");r[t]&&e.set("validator",r[t])}),t.each(r,function(t,n){if(n.indexOf("#")==0){var r=n.replace("#",""),i=e.getChild(r,!0);i&&i.set("validator",t)}})},getDecorateElments:function(){var e=this,t=e.get("el"),n=l(t,t);return n},findXClassByNode:function(e,n){return e.attr("type")==="checkbox"?s+"-checkbox":e.attr("type")==="radio"?s+"-radio":e.attr("type")==="number"?s+"-number":e.hasClass("calendar")?s+"-date":e[0].tagName=="SELECT"?s+"-select":f(e)?s:t.Component.Controller.prototype.findXClassByNode.call(this,e,n)},getRecord:function(){var e=this,n={},r=e.getFields();return t.each(r,function(r){var i=r.get("name"),s=e._getFieldValue(r);if(!n[i])n[i]=s;else if(t.isArray(n[i])&&s!=null)n[i].push(s);else if(s!=null){var o=[n[i]];o.push(s),n[i]=o}}),n},getFields:function(e){var r=this,i=[],s=r.get("children");return t.each(s,function(t){t instanceof n?(!e||t.get("name")==e)&&i.push(t):t.getFields&&(i=i.concat(t.getFields(e)))}),i},getField:function(e){var n=this,r=n.getFields(),i=null;return t.each(r,function(t){if(t.get("name")===e)return i=t,!1}),i},getFieldAt:function(e){return this.getFields()[e]},setFieldValue:function(e,n){var r=this,i=r.getFields(e);t.each(i,function(e){r._setFieldValue(e,n)})},_setFieldValue:function(e,r){if(e.get("disabled"))return;if(e instanceof n.Check){var i=e.get("value");r&&(i===r||t.isArray(r)&&t.Array.contains(i,r))?e.set("checked",!0):e.set("checked",!1)}else r==null&&(r=""),e.clearErrors(!0),e.set("value",r)},getFieldValue:function(e){var n=this,r=n.getFields(e),i=[];return t.each(r,function(e){var t=n._getFieldValue(e);t&&i.push(t)}),i.length===0?null:i.length===1?i[0]:i},_getFieldValue:function(e){return e instanceof n.Check&&!e.get("checked")?null:e.get("value")},clearFields:function(){this.clearErrors(!0),this.setRecord({})},setRecord:function(e){var n=this,r=n.getFields();t.each(r,function(t){var r=t.get("name");n._setFieldValue(t,e[r])})},updateRecord:function(e){var n=this,r=n.getFields();t.each(r,function(t){var r=t.get("name");e.hasOwnProperty(r)&&n._setFieldValue(t,e[r])})},focus:function(){var e=this,t=e.getFields(),n=t[0];n&&n.focus()},_uiSetDisabled:function(e){var n=this,r=n.get("children");t.each(r,function(t){t.set("disabled",e)})}},{ATTRS:{record:{setter:function(e){this.setRecord(e)},getter:function(){return this.getRecord()}},validators:{value:{}},defaultLoaderCfg:{value:{property:"children",dataType:"json"}},disabled:{sync:!1},isDecorateChild:{value:!0},xview:{value:c}}},{xclass:"form-field-container"});return h.View=c,h}),define("bui/form/group/base",["bui/common","bui/form/fieldcontainer"],function(e){var t=e("bui/common"),n=e("bui/form/fieldcontainer"),r=n.extend({},{ATTRS:{label:{view:!0},defaultChildClass:{value:"form-field"}}},{xclass:"form-group"});return r}),define("bui/form/group/range",["bui/form/group/base"],function(e){function n(e,t,n){var r=e.get("allowEqual");return r?n<=t:n<t}var t=e("bui/form/group/base"),r=t.extend({},{ATTRS:{rangeText:{value:"\u5f00\u59cb\u4e0d\u80fd\u5927\u4e8e\u7ed3\u675f\uff01"},allowEqual:{value:!0},validator:{value:function(e){var t=this,r=t.getFields(),i=!0;for(var s=1;s<r.length;s++){var o=r[s],u=r[s-1],a,f;if(o&&u){a=o.get("value"),f=u.get("value");if(!n(t,a,f)){i=!1;break}}}return i?null:t.get("rangeText")}}}},{xclass:"form-group-range"});return r}),define("bui/form/group/check",["bui/form/group/base"],function(e){function n(e){var t=e.getFieldAt(0);return t?t.get("name"):""}var t=e("bui/form/group/base"),r=t.extend({bindUI:function(){var e=this;e.on("change",function(t){var r=n(e),i=e.get("range"),s=e.getRecord(),o=s[r],u=i[1];o&&o.length>=u?e._setFieldsEnable(r,!1):e._setFieldsEnable(r,!0)})},_setFieldsEnable:function(e,t){var n=this,r=n.getFields(e);BUI.each(r,function(e){t?e.enable():e.get("checked")||e.disable()})},_uiSetRange:function(e){this.addRule("checkRange",e)}},{ATTRS:{range:{setter:function(e){if(BUI.isString(e)||BUI.isNumber(e))e=[parseInt(e,10)];return e}}}},{xclass:"form-group-check"});return r}),define("bui/form/group/select",["bui/form/group/base","bui/data"],function(e){function i(e){var t=[];return BUI.each(e,function(e){t.push({text:e.text,value:e.id})}),t}var t=e("bui/form/group/base"),n=e("bui/data"),r=BUI.Component.UIBase.Bindable,s=t.extend([r],{initializer:function(){var e=this,t=e.get("url"),r=e.get("store")||e._getStore();r.isStore||(r.autoLoad=!0,t&&(r.url=t),r=new n.TreeStore(r)),e.set("store",r)},bindUI:function(){var e=this;e.on("change",function(t){var n=t.target;if(n!=e){var r=n,i=r.get("value"),s=e._getFieldIndex(r)+1;e._valueChange(i,s)}})},onLoad:function(e){var t=this,n=e?e.node:t.get("store").get("root");t._setFieldItems(n.level,n.children)},_getStore:function(){var e=this,t=e.get("type");return t&&o[t]?o[t]:{}},_valueChange:function(e,t){var n=this,r=n.get("store");if(e){var i=r.findNode(e);if(!i)return;r.isLoaded(i)?n._setFieldItems(t,i.children):r.loadNode(i)}else n._setFieldItems(t,[])},_setFieldItems:function(e,t){var n=this,r=n.getFieldAt(e),s=i(t);r&&(r.setItems(s),n._valueChange(r.get("value"),e+1))},_getFieldIndex:function(e){var t=this,n=t.getFields();return BUI.Array.indexOf(e,n)}},{ATTRS:{type:{},store:{}}},{xclass:"form-group-select"}),o={};return s.addType=function(e,t){o[e]=t},s.addType("city",{proxy:{url:"http://lp.taobao.com/go/rgn/citydistrictdata.php",dataType:"jsonp"},map:{isleaf:"leaf",value:"text"}}),s}),define("bui/form/fieldgroup",["bui/common","bui/form/group/base","bui/form/group/range","bui/form/group/check","bui/form/group/select"],function(e){var t=e("bui/common"),n=e("bui/form/group/base");return t.mix(n,{Range:e("bui/form/group/range"),Check:e("bui/form/group/check"),Select:e("bui/form/group/select")}),n}),define("bui/form/form",["bui/common","bui/form/fieldcontainer"],function(e){var t=e("bui/common"),n={NORMAL:"normal",AJAX:"ajax",IFRAME:"iframe"},r=e("bui/form/fieldcontainer"),i=t.Component,s=r.View.extend({_uiSetMethod:function(e){this.get("el").attr("method",e)},_uiSetAction:function(e){this.get("el").attr("action",e)}},{ATTRS:{method:{},action:{}}},{xclass:"form-view"}),o=r.extend({renderUI:function(){var e=this,n=e.get("buttonBar"),r;$.isPlainObject(n)&&e.get("buttons")&&(r=t.merge(e.getDefaultButtonBarCfg(),n),e._initButtonBar(r)),e._initSubmitMask()},_initButtonBar:function(e){var n=this;t.use("bui/toolbar",function(t){buttonBar=new t.Bar(e),n.set("buttonBar",buttonBar)})},bindUI:function(){var e=this,t=e.get("el");t.on("submit",function(t){e.valid();if(!e.isValid()||e.onBeforeSubmit()===!1){t.preventDefault(),e.focusError();return}e.isValid()&&e.get("submitType")===n.AJAX&&(t.preventDefault(),e.ajaxSubmit())})},getDefaultButtonBarCfg:function(){var e=this,t=e.get("buttons");return{autoRender:!0,elCls:"toolbar",render:e.get("el"),items:t,defaultChildClass:"bar-item-button"}},focusError:function(){var e=this,n=e.getFields();t.each(n,function(e){if(e.get("visible")&&!e.get("disabled")&&!e.isValid()){try{e.focus()}catch(n){t.log(n)}return!1}})},submit:function(e){var t=this,r=t.get("submitType");t.valid();if(t.isValid()){if(t.onBeforeSubmit()==0)return;r===n.NORMAL?t.get("el")[0].submit():r===n.AJAX&&t.ajaxSubmit(e)}else t.focusError()},ajaxSubmit:function(e){var n=this,r=n.get("method"),i=n.get("action"),s=n.get("callback"),o=n.get("submitMask"),u=n.serializeToObject(),a,f=t.merge(!0,{url:i,type:r,dataType:"json",data:u},e);e&&e.success&&(a=e.success),f.success=function(e){o&&o.hide&&o.hide(),a&&a(e),s&&s.call(n,e)},o&&o.show&&o.show(),$.ajax(f)},_initSubmitMask:function(){var e=this,r=e.get("submitType"),i=e.get("submitMask");r===n.AJAX&&i&&t.use("bui/mask",function(n){var r=$.isPlainObject(i)?i:{};i=new n.LoadMask(t.mix({el:e.get("el")},r)),e.set("submitMask",i)})},serializeToObject:function(){return t.FormHelper.serializeToObject(this.get("el")[0])},toObject:function(){return this.serializeToObject()},onBeforeSubmit:function(){return this.fire("beforesubmit")},reset:function(){var e=this,t=e.get("initRecord");e.setRecord(t)},resetTips:function(){var e=this,n=e.getFields();t.each(n,function(e){e.resetTip()})},destructor:function(){var e=this,t=e.get("buttonBar"),n=e.get("submitMask");t&&t.destroy&&t.destroy(),n&&n.destroy&&n.destroy()},_uiSetInitRecord:function(e){this.setRecord(e)}},{ATTRS:{action:{view:!0,value:""},allowTextSelection:{value:!0},events:{value:{beforesubmit:!1}},method:{view:!0,value:"get"},defaultLoaderCfg:{value:{autoLoad:!0,property:"record",dataType:"json"}},submitMask:{value:{msg:"\u6b63\u5728\u63d0\u4ea4\u3002\u3002\u3002"}},submitType:{value:"normal"},focusError:{value:!0},callback:{},decorateCfgFields:{value:{method:!0,action:!0}},defaultChildClass:{value:"form-field"},elTagName:{value:"form"},buttons:{},buttonBar:{shared:!1,value:{}},childContainer:{value:".x-form-fields"},initRecord:{},showError:{value:!1},xview:{value:s},tpl:{value:'<div class="x-form-fields"></div>'}}},{xclass:"form"});return o.View=s,o}),define("bui/form/horizontal",["bui/common","bui/form/form"],function(e){var t=e("bui/common"),n=e("bui/form/form"),r=n.extend({getDefaultButtonBarCfg:function(){var e=this,t=e.get("buttons");return{autoRender:!0,elCls:"actions-bar toolbar row",tpl:'<div class="form-actions span21 offset3"></div>',childContainer:".form-actions",render:e.get("el"),items:t,defaultChildClass:"bar-item-button"}}},{ATTRS:{defaultChildClass:{value:"form-row"},errorTpl:{value:'<span class="valid-text"><span class="estate error"><span class="x-icon x-icon-mini x-icon-error">!</span><em>{error}</em></span></span>'},elCls:{value:"form-horizontal"}},PARSER:{}},{xclass:"form-horizontal"});return r}),define("bui/form/row",["bui/common","bui/form/fieldcontainer"],function(e){var t=e("bui/common"),n=e("bui/form/fieldcontainer"),r=n.extend({},{ATTRS:{elCls:{value:"row"},defaultChildCfg:{value:{tpl:' <label class="control-label">{label}</label> <div class="controls"> </div>',childContainer:".controls",showOneError:!0,controlContainer:".controls",elCls:"control-group span8",errorTpl:'<span class="valid-text"><span class="estate error"><span class="x-icon x-icon-mini x-icon-error">!</span><em>{error}</em></span></span>'}},defaultChildClass:{value:"form-field-text"}}},{xclass:"form-row"});return r}),define("bui/form/rule",["bui/common"],function(e){function r(e,n,r,i,o){t.isArray(r)&&t.isString(r[1])&&(r[1]&&(i=r[1]),r=r[0]);var u=e,a=u.get("validator"),f=s(e,r,i),l=!0;return n=n==null?"":n,a.call(u,n,r,f,o)}function i(e){if(e==null)return{};if($.isPlainObject(e))return e;var n=e,r={};if(t.isArray(e)){for(var i=0;i<n.length;i++)r[i]=n[i];return r}return{0:e}}function s(e,n,r){var s=i(n);return r=r||e.get("msg"),t.substitute(r,s)}var t=e("bui/common"),n=function(e){n.superclass.constructor.call(this,e)};return t.extend(n,t.Base),n.ATTRS={name:{},msg:{},validator:{value:function(e,t,n,r){}}},t.augment(n,{valid:function(e,t,n,i){var s=this;return r(s,e,t,n,i)}}),n}),define("bui/form/rules",["bui/form/rule"],function(e){function n(e){return parseFloat(e)}function r(e){return BUI.Date.parse(e)}function w(e,t,n){var r=e&&e.equals!==!1;return r?n<=t:n<t}function E(e){return e==""||e==null}function S(e,t,n,r){var i=r.getFields(),s=!0;for(var o=1;o<i.length;o++){var u=i[o],a=i[o-1],f,l;if(u&&a){f=u.get("value"),l=a.get("value");if(!E(f)&&!E(l)&&!w(t,f,l)){s=!1;break}}}return s?null:n}function N(e){var t=e.getFieldAt(0);return t?t.get("name"):""}function C(e,t){BUI.isArray(t)||(t=[t]);if(!e||!t.length)return!1;var n=e?BUI.isArray(e)?e.length:1:0;if(t.length==1){var r=t[0];if(!r)return!0;if(r>n)return!1}else{var i=t[0],s=t[1];if(i>n||s<n)return!1}return!0}var t=e("bui/form/rule"),i={},s={add:function(e){var n;return $.isPlainObject(e)?(n=e.name,i[n]=new t(e)):e.get&&(n=e.get("name"),i[n]=e),i[n]},remove:function(e){delete i[e]},get:function(e){return i[e]},valid:function(e,t,n,r,i){var o=s.get(e);return o?o.valid(t,n,r,i):null},isValid:function(e,t,n,r){return s.valid(e,t,n,r)==null}},o=s.add({name:"required",msg:"\u4e0d\u80fd\u4e3a\u7a7a\uff01",validator:function(e,t,n){if(t!==!1&&/^\s*$/.test(e))return n}}),u=s.add({name:"equalTo",msg:"\u4e24\u6b21\u8f93\u5165\u4e0d\u4e00\u81f4\uff01",validator:function(e,t,n){var r=$(t);return r.length&&(t=r.val()),e===t?undefined:n}}),a=s.add({name:"min",msg:"\u8f93\u5165\u503c\u4e0d\u80fd\u5c0f\u4e8e{0}\uff01",validator:function(e,t,r){BUI.isString(e)&&(e=e.replace(/\,/g,""));if(e!==""&&n(e)<n(t))return r}}),f=s.add({name:"max",msg:"\u8f93\u5165\u503c\u4e0d\u80fd\u5927\u4e8e{0}\uff01",validator:function(e,t,r){BUI.isString(e)&&(e=e.replace(/\,/g,""));if(e!==""&&n(e)>n(t))return r}}),l=s.add({name:"length",msg:"\u8f93\u5165\u503c\u957f\u5ea6\u4e3a{0}\uff01",validator:function(e,t,n){if(e!=null){e=$.trim(e.toString());if(t!=e.length)return n}}}),c=s.add({name:"minlength",msg:"\u8f93\u5165\u503c\u957f\u5ea6\u4e0d\u5c0f\u4e8e{0}\uff01",validator:function(e,t,n){if(e!=null){e=$.trim(e.toString());var r=e.length;if(r<t)return n}}}),h=s.add({name:"maxlength",msg:"\u8f93\u5165\u503c\u957f\u5ea6\u4e0d\u5927\u4e8e{0}\uff01",validator:function(e,t,n){if(e){e=$.trim(e.toString());var r=e.length;if(r>t)return n}}}),p=s.add({name:"regexp",msg:"\u8f93\u5165\u503c\u4e0d\u7b26\u5408{0}\uff01",validator:function(e,t,n){if(t)return t.test(e)?undefined:n}}),d=s.add({name:"email",msg:"\u4e0d\u662f\u6709\u6548\u7684\u90ae\u7bb1\u5730\u5740\uff01",validator:function(e,t,n){e=$.trim(e);if(e)return/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e)?undefined:n}}),v=s.add({name:"date",msg:"\u4e0d\u662f\u6709\u6548\u7684\u65e5\u671f\uff01",validator:function(e,t,n){if(BUI.isNumber(e))return;if(BUI.isDate(e))return;e=$.trim(e);if(e)return BUI.Date.isDateString(e)?undefined:n}}),m=s.add({name:"minDate",msg:"\u8f93\u5165\u65e5\u671f\u4e0d\u80fd\u5c0f\u4e8e{0}\uff01",validator:function(e,t,n){if(e){var i=r(e);if(i&&i<r(t))return n}}}),g=s.add({name:"maxDate",msg:"\u8f93\u5165\u65e5\u671f\u4e0d\u80fd\u5927\u4e8e{0}\uff01",validator:function(e,t,n){if(e){var i=r(e);if(i&&i>r(t))return n}}}),y=s.add({name:"mobile",msg:"\u4e0d\u662f\u6709\u6548\u7684\u624b\u673a\u53f7\u7801\uff01",validator:function(e,t,n){e=$.trim(e);if(e)return/^\d{11}$/.test(e)?undefined:n}}),b=s.add({name:"number",msg:"\u4e0d\u662f\u6709\u6548\u7684\u6570\u5b57\uff01",validator:function(e,t,n){if(BUI.isNumber(e))return;return e=e.replace(/\,/g,""),isNaN(e)?n:undefined}}),x=s.add({name:"dateRange",msg:"\u7ed3\u675f\u65e5\u671f\u4e0d\u80fd\u5c0f\u4e8e\u8d77\u59cb\u65e5\u671f\uff01",validator:S}),T=s.add({name:"numberRange",msg:"\u7ed3\u675f\u6570\u5b57\u4e0d\u80fd\u5c0f\u4e8e\u5f00\u59cb\u6570\u5b57\uff01",validator:S}),k=s.add({name:"checkRange",msg:"\u5fc5\u987b\u9009\u4e2d{0}\u9879\uff01",validator:function(e,t,n,r){var i=N(r),s,o=t;if(i&&o){s=e[i];if(!C(s,o))return n}return null}});return s}),define("bui/form/remote",["bui/common"],function(e){var t=e("bui/common"),n=function(){};n.ATTRS={isLoading:{},loadingEl:{}},n.prototype={getLoadingContainer:function(){},_setLoading:function(){var e=this,t=e.get("loadingEl"),n=e.get("loadingTpl");n&&!t&&(t=$(n).appendTo(e.getLoadingContainer()),e.setInternal("loadingEl",t))},_clearLoading:function(){var e=this,t=e.get("loadingEl");t&&(t.remove(),e.setInternal("loadingEl",null))},_uiSetIsLoading:function(e){var t=this;e?t._setLoading():t._clearLoading()}};var r=function(){};return r.ATTRS={defaultRemote:{value:{method:"GET",cache:!0,callback:function(e){return e}}},remoteDaly:{value:500},cacheMap:{value:{}},loadingTpl:{view:!0,value:'<img src="http://img02.taobaocdn.com/tps/i2/T1NU8nXCVcXXaHNz_X-16-16.gif" alt="loading"/>'},isLoading:{view:!0,value:!1},remote:{setter:function(e){return t.isString(e)&&(e={url:e}),e}},remoteHandler:{},events:{value:{remotecomplete:!1,remotestart:!1}}},r.prototype={__bindUI:function(){var e=this;e.on("valid",function(t){if(e.get("remote")&&e.isValid()&&!e.get("pauseValid")){var n=e.getControlValue(),r=e.getRemoteParams();e._startRemote(r,n)}}),e.on("error",function(t){e.get("remote")&&e._cancelRemote()})},_startRemote:function(e,t){function o(){n._remoteValid(e,r,t),n.set("isLoading",!0)}var n=this,r=n.get("remoteHandler"),i=n.get("cacheMap"),s=n.get("remoteDaly");r&&n._cancelRemote(r);if(i[t]!=null){n._validResult(n._getCallback(),i[t]);return}r=setTimeout(o,s),n.setInternal("remoteHandler",r)},_validResult:function(e,t){var n=this,r=e(t);n.onRemoteComplete(r,t)},onRemoteComplete:function(e,t,n){var r=this;n==r.get("remoteHandler")&&(r.fire("remotecomplete",{error:e,data:t}),r.set("isLoading",!1),r.setInternal("remoteHandler",null))},_getOptions:function(e){var n=this,r=n.get("remote"),i=n.get("defaultRemote"),s=t.merge(i,r,{data:e});return s},_getCallback:function(){return this._getOptions().callback},_remoteValid:function(e,t,n){var r=this,i=r.get("cacheMap"),s=r._getOptions(e);s.success=function(e){var o=s.callback,u=o(e);i[n]=e,r.onRemoteComplete(u,e,t)},s.error=function(e,n,i){r.onRemoteComplete(i,null,t)},r.fire("remotestart",{data:e}),$.ajax(s)},getRemoteParams:function(){},clearCache:function(){this.set("cacheMap",{})},_cancelRemote:function(e){var t=this;e=e||t.get("remoteHandler"),e&&(clearTimeout(e),t.setInternal("remoteHandler",null)),t.set("isLoading",!1)}},r.View=n,r}),define("bui/select",["bui/common","bui/select/select","bui/select/combox","bui/select/suggest"],function(e){var t=e("bui/common"),n=t.namespace("Select");return t.mix(n,{Select:e("bui/select/select"),Combox:e("bui/select/combox"),Suggest:e("bui/select/suggest")}),n}),define("bui/select/select",["bui/common","bui/picker"],function(e){"use strict";function i(e){if($.isPlainObject(e)){var n=[];return t.each(e,function(e,t){n.push({value:t,text:e})}),n}var r=[];return t.each(e,function(e,n){t.isString(e)?r.push({value:e,text:e}):r.push(e)}),r}var t=e("bui/common"),n=e("bui/picker").ListPicker,r=t.prefix,s=t.Component,o=n,u=r+"select-input",a=s.Controller.extend({initializer:function(){var e=this,t=e.get("multipleSelect"),n,s=e.get("picker");s?e.get("valueField")&&s.set("valueField",e.get("valueField")):(n=t?"listbox":"simple-list",s=new o({children:[{xclass:n,elCls:r+"select-list",store:e.get("store"),items:i(e.get("items"))}],valueField:e.get("valueField")}),e.set("picker",s)),t&&s.set("hideEvent","")},renderUI:function(){var e=this,t=e.get("picker"),n=e._getTextEl();t.set("trigger",e.getTrigger()),t.set("triggerEvent",e.get("triggerEvent")),t.set("autoSetValue",e.get("autoSetValue")),t.set("textField",n),t.render(),e.set("list",t.get("list"))},bindUI:function(){var e=this,t=e.get("picker"),n=t.get("list"),r=n.get("store");t.on("selectedchange",function(t){e.fire("change",{text:t.text,value:t.value,item:t.item})}),n.on("itemsshow",function(){e._syncValue()}),t.on("show",function(){e.get("forceFit")&&t.set("width",e.get("el").outerWidth())})},containsElement:function(e){var t=this,n=t.get("picker");return s.Controller.prototype.containsElement.call(this,e)||n.containsElement(e)},getTrigger:function(){return this.get("el")},_uiSetItems:function(e){if(!e)return;var t=this,n=t.get("picker"),r=n.get("list");r.set("items",i(e)),t._syncValue()},_syncValue:function(){var e=this,t=e.get("picker"),n=e.get("valueField");n&&t.setSelectedValue($(n).val())},_uiSetName:function(e){var t=this,n=t._getTextEl();e&&n.attr("name",e)},_uiSetWidth:function(e){var t=this;if(e!=null){if(t.get("inputForceFit")){var n=t._getTextEl(),r=t.get("el").find(".x-icon"),i=n.outerWidth()-n.width(),s=e-r.outerWidth()-i;n.width(s)}if(t.get("forceFit")){var o=t.get("picker");o.set("width",e)}}},_uiSetDisabled:function(e){var t=this,n=t.get("picker"),r=t._getTextEl();n.set("disabled",e),r&&r.attr("disabled",e)},_getTextEl:function(){var e=this,t=e.get("el");return t.is("input")?t:t.find("input")},destructor:function(){var e=this,t=e.get("picker");t&&t.destroy()},_getList:function(){var e=this,t=e.get("picker"),n=t.get("list");return n},getSelectedValue:function(){return this.get("picker").getSelectedValue()},setSelectedValue:function(e){var t=this,n=t.get("picker");n.setSelectedValue(e)},getSelectedText:function(){return this.get("picker").getSelectedText()}},{ATTRS:{picker:{},list:{},valueField:{},store:{},focusable:{value:!0},autoSetValue:{value:!0},multipleSelect:{value:!1},inputForceFit:{value:!0},name:{},items:{sync:!1},inputCls:{value:u},forceFit:{value:!0},events:{value:{change:!1}},tpl:{view:!0,value:'<input type="text" readonly="readonly" class="'+u+'"/><span class="x-icon x-icon-normal"><i class="icon icon-caret icon-caret-down"></i></span>'},triggerEvent:{value:"click"}}},{xclass:"select"});return a}),define("bui/select/tag",["bui/common","bui/list"],function(e){var t=e("bui/common"),n=e("bui/list"),r=t.KeyCode,i="warn",s=function(){};return s.ATTRS={showTag:{value:!1},tagItemTpl:{value:"<li>{value}<button>\u00d7</button></li>"},tagList:{value:null},tagPlaceholder:{value:"\u8f93\u5165\u6807\u7b7e"},separator:{value:";"}},t.augment(s,{__renderUI:function(){var e=this,t=e.get("showTag"),n=e.get("tagPlaceholder"),r=e.getTagInput();t&&!r.attr("placeholder")&&(r.attr("placeholder",n),e.set("inputForceFit",!1))},__bindUI:function(){var e=this,t=e.get("showTag"),n=e.getTagInput();t&&(n.on("keydown",function(t){if(!n.val()){var s=e.get("tagList"),o=s.getLastItem(),u=e.get("picker");t.which==r.DELETE||t.which==r.BACKSPACE?(s.hasStatus(o,i)?e._delTag(o):s.setItemStatus(o,i,!0),u.hide()):s.setItemStatus(o,i,!1)}}),n.on("change",function(t){setTimeout(function(){var t=n.val();t&&e._addTag(t)})}))},__syncUI:function(){var e=this,t=e.get("showTag"),n=e.get("valueField");t&&n&&e._setTags($(n).val())},_setTags:function(e){var n=this,r=n.get("tagList"),i=n.get("separator"),s=e.split(i);r||(r=n._initTagList()),e&&t.each(s,function(e){r.addItem({value:e})})},_addTag:function(e){var t=this,n=t.get("tagList"),r=t.getTagInput(),i=n.getItem(e);i?t._blurItem(n,i):(n.addItem({value:e}),t._synTagsValue()),r.val("")},_blurItem:function(e,t){e.setItemStatus(t,"active",!0),setTimeout(function(){e.setItemStatus(t,"active",!1)},400)},_delTag:function(e){var t=this,n=t.get("tagList");n.removeItem(e),t._synTagsValue()},getTagsValue:function(){var e=this,n=e.get("tagList"),r=n.getItems(),i=[];return t.each(r,function(e){i.push(e.value)}),i
.join(e.get("separator"))},_initTagList:function(){var e=this,t=e.getTagInput(),r=new n.SimpleList({elBefore:t,itemTpl:e.get("tagItemTpl"),idField:"value"});return r.render(),e._initTagEvent(r),e.set("tagList",r),r},_initTagEvent:function(e){var t=this;e.on("itemclick",function(e){var n=$(e.domTarget);n.is("button")&&t._delTag(e.item)})},getTagInput:function(){var e=this,t=e.get("el");return t.is("input")?t:t.find("input")},_synTagsValue:function(){var e=this,t=e.get("valueField");t&&$(t).val(e.getTagsValue())}}),s}),define("bui/select/combox",["bui/common","bui/select/select"],function(e){var t=e("bui/common"),n=e("bui/select/select"),r=e("bui/select/tag"),i=t.prefix+"combox-input",s=n.extend([r],{renderUI:function(){var e=this,t=e.get("picker");t.set("autoFocused",!1)},_uiSetItems:function(e){var n=this;for(var r=0;r<e.length;r++){var i=e[r];t.isString(i)&&(e[r]={value:i,text:i})}s.superclass._uiSetItems.call(n,e)},bindUI:function(){var e=this,t=e.get("picker"),n=t.get("list"),r=t.get("textField");$(r).on("keyup",function(e){var t=n.getSelected();t&&n.clearItemStatus(t)}),t.on("show",function(){n.clearSelected()})},_uiSetValueField:function(){},getTrigger:function(){return this._getTextEl()}},{ATTRS:{tpl:{view:!0,value:'<input type="text" class="'+i+'"/>'},inputCls:{value:i},autoSetValue:{value:!1}}},{xclass:"combox"});return s}),define("bui/select/suggest",["bui/common","bui/select/combox"],function(e){"use strict";var t=e("bui/common"),n=e("bui/select/combox"),r=200,i="",s=n.extend({bindUI:function(){var e=this,t=e.get("el").find("input"),n=e.get("triggerEvent")==="keyup"?"keyup":"keyup click";t.on(n,function(){e._start()})},_start:function(){var e=this;e._timer=e.later(function(){e._updateContent()},r)},_updateContent:function(){var e=this,t=e.get("data"),n=e.get("el").find("input"),r;if(!t&&n.val()===e.get("query"))return;e.set("query",n.val()),r=n.val();if(!t&&!r)return;var i=e.get("cacheable"),s=e.get("url"),o=e.get("data");if(i&&s){var u=e.get("dataCache");u[r]!==undefined?e._handleResponse(u[r]):e._requestData()}else s?e._requestData():o&&e._handleResponse(o,!0)},_getStore:function(){var e=this,t=e.get("picker"),n=t.get("list");if(n)return n.get("store")},_requestData:function(){var e=this,t=e.get("el").find("input"),n=e.get("callback"),r=e.get("store"),i={};i[t.attr("name")]=t.val(),r?(i.start=0,r.load(i,n)):$.ajax({url:e.get("url"),type:"post",dataType:e.get("dataType"),data:i,success:function(t){e._handleResponse(t),n&&n(t)}})},_handleResponse:function(e,t){var n=this,r=t?n._getFilterItems(e):e;n.set("items",r),n.get("cacheable")&&(n.get("dataCache")[n.get("query")]=r)},_getItemText:function(e){var t=this,n=t.get("picker"),r=n.get("list");return r?r.getItemText(e):""},_getFilterItems:function(e){function u(e,n){t.isString(n)?r.push(e):r.push(n)}var n=this,r=[],i=n.get("el").find("input"),s=i.val(),o=n.get("data");return e=e||[],t.each(e,function(e){var r=t.isString(e)?e:n._getItemText(e);o?r.indexOf($.trim(s))!==-1&&u(r,e):u(r,e)}),r},later:function(e,t,n){t=t||0;var r=n?setInterval(e,t):setTimeout(e,t);return{id:r,interval:n,cancel:function(){this.interval?clearInterval(r):clearTimeout(r)}}}},{ATTRS:{data:{value:null},query:{value:i},cacheable:{value:!1},dataCache:{shared:!1,value:{}},dataType:{value:"jsonp"},url:{},callback:{},triggerEvent:{valueFn:function(){return this.get("data")?"click":"keyup"}},autoSetValue:{value:!1}}},{xclass:"suggest"});return s}),define("bui/mask",["bui/common","bui/mask/mask","bui/mask/loadmask"],function(e){var t=e("bui/common"),n=e("bui/mask/mask");return n.LoadMask=e("bui/mask/loadmask"),n}),define("bui/mask/mask",["bui/common"],function(e){var t=e("bui/common"),n=t.namespace("Mask"),r=t.UA,i=t.prefix+"ext-mask",s=i+"-msg";return t.mix(n,{maskElement:function(e,n,o){var u=$(e),a=u.children("."+i),f=null,l=null,c=null,h=null;if(!a.length){a=$('<div class="'+i+'"></div>').appendTo(u),u.addClass("x-masked-relative x-masked"),e=="body"?r.ie==6?a.height(t.docHeight()):a.css("position","fixed"):r.ie===6&&a.height(u.height());if(n){f=['<div class="'+s+'"><div>',n,"</div></div>"].join(""),l=$(f).appendTo(u),o&&l.addClass(o);try{e=="body"&&r.ie!=6?(c="50%",h="50%",l.css("position","fixed")):(c=(a.height()-l.height())/2,h=(a.width()-l.width())/2),l.css({left:h,top:c})}catch(p){t.log("mask error occurred")}}}return a},unmaskElement:function(e){var t=$(e),n=t.children("."+s),r=t.children("."+i);n&&n.remove(),r&&r.remove(),t.removeClass("x-masked-relative x-masked")}}),n}),define("bui/mask/loadmask",["bui/mask/mask"],function(e){function n(e){var t=this;n.superclass.constructor.call(t,e)}var t=e("bui/mask/mask");return BUI.extend(n,BUI.Base),n.ATTRS={el:{},msg:{value:"Loading..."},msgCls:{value:"x-mask-loading"},disabled:{value:!1}},BUI.augment(n,{disable:function(){this.set("disabled",!0)},onLoad:function(){t.unmaskElement(this.get("el"))},onBeforeLoad:function(){var e=this;e.get("disabled")||t.maskElement(e.get("el"),e.get("msg"),this.get("msgCls"))},show:function(){this.onBeforeLoad()},hide:function(){this.onLoad()},destroy:function(){this.hide(),this.clearAttrVals(),this.off()}}),n}),define("bui/menu",["bui/common","bui/menu/menu","bui/menu/menuitem","bui/memu/contextmenu","bui/menu/popmenu","bui/menu/sidemenu"],function(e){var t=e("bui/common"),n=t.namespace("Menu");return t.mix(n,{Menu:e("bui/menu/menu"),MenuItem:e("bui/menu/menuitem"),ContextMenu:e("bui/memu/contextmenu"),PopMenu:e("bui/menu/popmenu"),SideMenu:e("bui/menu/sidemenu")}),n.ContextMenuItem=n.ContextMenu.Item,n}),define("bui/menu/menuitem",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=t.prefix,s=i+"menu-item-open",o="x-caret",u=i+"menu-item-collapsed",a="data-id",f=n.View.extend([r.ListItemView,r.CollapsableView],{_uiSetOpen:function(e){var t=this,n=t.getStatusCls("open");e?t.get("el").addClass(n):t.get("el").removeClass(n)}},{ATTRS:{}},{xclass:"menu-item-view"}),l=n.Controller.extend([r.ListItem,r.Collapsable],{renderUI:function(){var e=this,n=e.get("el"),r=e.get("id"),i=null;r||(r=t.guid("menu-item"),e.set("id",r)),n.attr(a,r)},handleMouseEnter:function(e){var t=this;this.get("subMenu")&&this.get("openable")&&this.set("open",!0),l.superclass.handleMouseEnter.call(this,e)},handleMouseLeave:function(e){if(this.get("openable")){var t=this,n=t.get("subMenu"),r=e.toElement||e.relatedTarget;r&&n&&n.containsElement(r)?t.set("open",!0):t.set("open",!1)}l.superclass.handleMouseLeave.call(this,e)},containsElement:function(e){var t=this,n,r=l.superclass.containsElement.call(t,e);return r||(n=t.get("subMenu"),r=n&&n.containsElement(e)),r},_uiSetOpen:function(e){if(this.get("openable")){var t=this,n=t.get("subMenu"),r=t.get("subMenuAlign");if(n)if(e)r.node=t.get("el"),n.set("align",r),n.show();else{var i=n.get("align");(!i||i.node==t.get("el"))&&n.hide()}}},_uiSetSubMenu:function(e){if(e){var t=this,n=t.get("el"),r=t.get("parent");e.get("parentMenu")||(e.set("parentMenu",r),r.get("autoHide")&&(r.get("autoHideType")=="click"?e.set("autoHide",!1):e.set("autoHideType","leave"))),$(t.get("arrowTpl")).appendTo(n)}},destructor:function(){var e=this,t=e.get("subMenu");t&&t.destroy()}},{ATTRS:{elTagName:{value:"li"},xview:{value:f},open:{view:!0,value:!1},openable:{value:!0},subMenu:{view:!0},subMenuAlign:{valueFn:function(e){return{points:["tr","tl"],offset:[-5,0]}}},arrowTpl:{value:'<span class="'+o+" "+o+'-left"></span>'},events:{value:{afterOpenChange:!0}},subMenuType:{value:"pop-menu"}},PARSER:{subMenu:function(e){var n=e.find("ul"),r=this.get("subMenuType"),i;return n&&n.length&&(i=t.Component.create({srcNode:n,xclass:r}),r=="pop-menu"?(n.appendTo("body"),i.setInternal({autoHide:!0,autoHideType:"leave"})):this.get("children").push(i)),i}}},{xclass:"menu-item",priority:0}),c=l.extend({},{ATTRS:{focusable:{value:!1},selectable:{value:!1},handleMouseEvents:{value:!1}}},{xclass:"menu-item-sparator"});return l.View=f,l.Separator=c,l}),define("bui/menu/menu",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=n.Controller.extend([r.ChildList],{bindUI:function(){var e=this;e.on("click",function(t){var n=t.target,r=e.get("multipleSelect");e!=n&&!r&&e.get("clickHide")&&!n.get("subMenu")&&e.getTopAutoHideMenu().hide()}),e.on("afterOpenChange",function(n){var r=n.target,i=n.newVal,s=e.get("children");i&&t.each(s,function(e){e!==r&&e.get("open")&&e.set("open",!1)})}),e.on("afterVisibleChange",function(t){var n=t.newVal,r=e.get("parentMenu");e._clearOpen()})},getTopAutoHideMenu:function(){var e=this,t=e.get("parentMenu"),n;return t&&t.get("autoHide")?t.getTopAutoHideMenu():e.get("autoHide")?e:null},_clearOpen:function(){var e=this,n=e.get("children");t.each(n,function(e){e.set&&e.set("open",!1)})},findItemById:function(e){return this.findItemByField("id",e)},_uiSetSelectedItem:function(e){e&&_self.setSelected(e)}},{ATTRS:{elTagName:{view:!0,value:"ul"},idField:{value:"id"},isDecorateChild:{value:!0},defaultChildClass:{value:"menu-item"},selectedItem:{},parentMenu:{}}},{xclass:"menu",priority:0});return i}),define("bui/menu/popmenu",["bui/common","bui/menu/menu"],function(e){var t=e("bui/common"),n=t.Component.UIBase,r=e("bui/menu/menu"),i=t.Component.View.extend([n.PositionView],{}),s=r.extend([n.Position,n.Align,n.AutoShow,n.AutoHide],{},{ATTRS:{clickHide:{value:!0},align:{value:{points:["bl","tl"],offset:[0,0]}},visibleMode:{value:"visibility"},autoHide:{value:!0},visible:{value:!1},xview:{value:i}}},{xclass:"pop-menu"});return s}),define("bui/memu/contextmenu",["bui/common","bui/menu/menuitem","bui/menu/popmenu"],function(e){var t=e("bui/common"),n=e("bui/menu/menuitem"),r=e("bui/menu/popmenu"),i=t.prefix,s=i+"menu-item-link",o=i+"menu-item-icon",u=t.Component,a=u.UIBase,f=n.extend({bindUI:function(){var e=this;e.get("el").delegate("."+s,"click",function(e){e.preventDefault()})},_uiSetIconCls:function(e,t){var n=this,r=t.prevVal,i=n.get("el").find("."+o);i.removeClass(r),i.addClass(e)}},{ATTRS:{text:{veiw:!0,value:""},iconCls:{sync:!1,value:""},tpl:{value:'<a class="'+s+'" href="#"> <span class="'+o+' {iconCls}"></span><span class="'+i+'menu-item-text">{text}</span></a>'}}},{xclass:"context-menu-item"}),l=r.extend({},{ATTRS:{defaultChildClass:{value:"context-menu-item"},align:{value:null}}},{xclass:"context-menu"});return l.Item=f,l}),define("bui/menu/sidemenu",["bui/common","bui/menu/menu"],function(e){var t=e("bui/common"),n=e("bui/menu/menu"),r=t.Component,i=t.prefix+"menu-title",s="menu-leaf",o=n.extend({initializer:function(){var e=this,n=e.get("items"),r=e.get("children");t.each(n,function(t){var n=e._initMenuCfg(t);r.push(n)})},bindUI:function(){var e=this,n=e.get("children");t.each(n,function(e){var t=e.get("children")[0];t&&t.publish("click",{bubbles:1})}),e.get("el").delegate("a","click",function(e){e.preventDefault()}),e.on("itemclick",function(t){var n=t.item,r=$(t.domTarget).closest("."+e.get("collapsedCls"));if(r.length){var i=n.get("collapsed");n.set("collapsed",!i)}else n.get("el").hasClass(s)&&(e.fire("menuclick",{item:n}),e.clearSelection(),e.setSelected(n))})},getItems:function(){var e=this,n=[],r=e.get("children");return t.each(r,function(e){var t=e.get("children")[0];n=n.concat(t.get("children"))}),n},_initMenuCfg:function(e){var n=this,r=e.items,i=[],s={selectable:!1,children:[{xclass:"menu",children:i}]};return t.mix(s,{xclass:"menu-item",elCls:"menu-second"},e),t.each(r,function(e){var t=n._initSubMenuCfg(e);i.push(t)}),s},_initSubMenuCfg:function(e){var n=this,r={xclass:"menu-item",elCls:"menu-leaf",tpl:n.get("subMenuItemTpl")};return t.mix(r,e)}},{ATTRS:{defaultChildCfg:{value:{subMenuType:"menu",openable:!1,arrowTpl:""}},autoInitItems:{value:!1},itemTpl:{value:'<div class="'+i+'"><s></s><span class="'+i+'-text">{text}</span></div>'},subMenuItemTpl:{value:'<a href="{href}"><em>{text}</em></a>'},collapsedCls:{value:i},events:{value:{menuclick:!1}}}},{xclass:"side-menu"});return o}),define("bui/tab",["bui/common","bui/tab/tab","bui/tab/tabitem","bui/tab/navtabitem","bui/tab/navtab","bui/tab/tabpanel","bui/tab/tabpanelitem"],function(e){var t=e("bui/common"),n=t.namespace("Tab");return t.mix(n,{Tab:e("bui/tab/tab"),TabItem:e("bui/tab/tabitem"),NavTabItem:e("bui/tab/navtabitem"),NavTab:e("bui/tab/navtab"),TabPanel:e("bui/tab/tabpanel"),TabPanelItem:e("bui/tab/tabpanelitem")}),n}),define("bui/tab/panelitem",function(e){var t=function(){};return t.ATTRS={panel:{},panelContent:{},panelVisibleStatus:{value:"selected"},defaultLoaderCfg:{valueFn:function(){var e=this,t=e._getVisibleEvent();return{property:"panelContent",autoLoad:!1,lazyLoad:{event:t},loadMask:{el:e.get("panel")}}}},panelDestroyable:{value:!0}},BUI.augment(t,{__renderUI:function(){this._resetPanelVisible()},__bindUI:function(){var e=this,t=e._getVisibleEvent();e.on(t,function(t){e._setPanelVisible(t.newVal)})},_resetPanelVisible:function(){var e=this,t=e.get("panelVisibleStatus"),n=e.get(t);e._setPanelVisible(n)},_getVisibleEvent:function(){var e=this,t=e.get("panelVisibleStatus");return"after"+BUI.ucfirst(t)+"Change"},_setPanelVisible:function(e){var t=this,n=t.get("panel"),r=e?"show":"hide";n&&$(n)[r]()},__destructor:function(){var e=this,t=e.get("panel");t&&e.get("panelDestroyable")&&$(t).remove()},_setPanelContent:function(e,t){var n=$(e);$(e).html(t)},_uiSetPanelContent:function(e){var t=this,n=t.get("panel");t._setPanelContent(n,e)},_uiSetPanel:function(e){var t=this,n=t.get("panelContent");n&&t._setPanelContent(e,n),t._resetPanelVisible()}}),t}),define("bui/tab/panels",function(e){var t=function(){};return t.ATTRS={panelTpl:{},panelContainer:{},panelCls:{}},BUI.augment(t,{__renderUI:function(){var e=this,t=e.get("children"),n=e._initPanelContainer(),r=e.get("panelCls"),i=r?n.find("."+i):n.children();BUI.each(t,function(t,n){var r=i[n];e._initPanelItem(t,r)})},__bindUI:function(){var e=this;e.on("beforeAddChild",function(t){var n=t.child;e._initPanelItem(n)})},_initPanelContainer:function(){var e=this,t=e.get("panelContainer");return t&&BUI.isString(t)&&(t.indexOf("#")==0?t=$(t):t=e.get("el").find(t),e.setInternal("panelContainer",t)),t},_initPanelItem:function(e,t){var n=this;e.set?e.get("panel")||(t=t||n._getPanel(e.get("userConfig")),e.set("panel",t)):e.panel||(t=t||n._getPanel(e),e.panel=t)},_getPanel:function(e){var t=this,n=t.get("panelContainer"),r=BUI.substitute(t.get("panelTpl"),e);return $(r).appendTo(n)}}),t}),define("bui/tab/navtabitem",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r="tab-item-title",i="tab-item-close",s="tab-item-inner",o="tab-nav-actived",u="tab-content",a=n.View.extend({renderUI:function(){var e=this,t=e.get("tabContentContainer"),n=e.get("tabContentTpl");if(t){var r=$(n).appendTo(t);e.set("tabContentEl",r)}},_uiSetHref:function(e){this._setHref(e)},_setHref:function(e){var t=this,n=t.get("tabContentEl");e=e||t.get("href"),n&&$("iframe",n).attr("src",e)},resetHref:function(){this._setHref()},_uiSetTitle:function(e){var t=this,n=t.get("el");$("."+r,n).html(e)},_uiSetActived:function(e){var t=this,n=t.get("el");t.setTabContentVisible(e),e?n.addClass(o):n.removeClass(o)},destructor:function(){var e=this,t=e.get("tabContentEl");t&&t.remove()},setTabContentVisible:function(e){var t=this,n=t.get("tabContentEl");n&&(e?n.show():n.hide())}},{ATTRS:{tabContentContainer:{},tabContentEl:{},title:{},href:{}}}),f=n.Controller.extend({createDom:function(){var e=this,t=e.get("parent");t&&e.set("tabContentContainer",t.getTabContentContainer())},bindUI:function(){var e=this,t=e.get("el"),n=e.get("events");t.on("click",function(t){var n=$(t.target);n.hasClass(i)&&e.fire("closing")!==!1&&e.close()})},handleDblClick:function(e){var t=this;t.get("closeable")&&t.fire("closing")!==!1&&t.close(),t.fire("dblclick",{domTarget:e.target,domEvent:e})},handleContextMenu:function(e){e.preventDefault(),this.fire("showmenu",{position:{x:e.pageX,y:e.pageY}})},setTitle:function(e){this.set("title",e)},close:function(){this.fire("closed")},reload:function(){this.get("view").resetHref()},show:function(){var e=this;e.get("el").show(500,function(){e.set("visible",!0)})},hide:function(e){var t=this;this.get("el").hide(500,function(){t.set("visible",!1),e&&e()})},_uiSetActived:function(e){var t=this,n=t.get("parent");n&&e&&n._setItemActived(t)},_uiSetCloseable:function(e){var t=this,n=t.get("el"),r=n.find("."+i);e?r.show():r.hide()}},{ATTRS:{elTagName:{value:"li"},actived:{view:!0,value:!1},closeable:{value:!0},allowTextSelection:{view:!1,value:!1},events:{value:{click:!0,closing:!0,closed:!0,showmenu:!0,afterVisibleChange:!0}},tabContentContainer:{view:!0},tabContentTpl:{view:!0,value:'<div class="'+u+'" style="display:none;"><iframe src="" width="100%" height="100%" frameborder="0"></iframe></div>'},href:{view:!0,value:""},visible:{view:!0,value:!0},title:{view:!0,value:""},tpl:{view:!0,value:'<s class="l"></s><div class="'+s+'">{icon}<span class="'+r+'"></span><s class="'+i+'"></s></div><s class="r"></s>'},xview:{value:a}}},{xclass:"nav-tab-item",priority:0});return f.View=a,f}),define("bui/tab/navtab",["bui/common","bui/menu"],function(e){var t=e("bui/common"),n=e("bui/menu"),r=t.Component,i="tab-nav-list",s="arrow-left",o="arrow-right",u=t.prefix+"tab-force",a="m_close",f=140,l=r.View.extend({renderUI:function(){var e=this,t=e.get("el"),n=null;n=t.find("."+i),e.setInternal("listEl",n)},getContentElement:function(){return this.get("listEl")},getTabContentContainer:function(){return this.get("el").find(".tab-content-container")},_uiSetHeight:function(e){var t=this,n=t.get("el"),r=n.find(".tab-nav-bar"),i=t.getTabContentContainer();e&&i.height(e-r.height()),n.height(e)},_uiSetForceFit:function(e){var t=this,n=t.get("el");e?n.addClass(u):n.removeClass(u)}},{ATTRS:{forceFit:{}}},{xclass:"nav-tab-view",priority:0}),c=r.Controller.extend({addTab:function(e,n){var r=this,i=e.id||t.guid("tab-item"),s=r.get("forceFit"),o=r.getItemById(i);if(o){var u=!1;e.href&&o.get("href")!=e.href&&(o.set("href",e.href),u=!0),r._setItemActived(o),n&&!u&&o.reload()}else e=t.mix({id:i,visible:!1,actived:!0,xclass:"nav-tab-item"},e),o=r.addChild(e),s&&r.forceFit(),o.show(),r._resetItemList();return o},getTabContentContainer:function(){return this.get("view").getTabContentContainer()},bindUI:function(){var e=this,t=e.get("forceFit");t||(e._bindScrollEvent(),e.on("afterVisibleChange",function(t){var n=t.target;n.get("actived")&&e._scrollToItem(n)})),e.on("click",function(t){var n=t.target;n!=e&&(e._setItemActived(n),e.fire("itemclick",{item:n}))}),e.on("closed",function(t){var n=t.target;e._closeItem(n)}),e.on("showmenu",function(t){e._showMenu(t.target,t.position)})},_bindScrollEvent:function(){var e=this,t=e.get("el");t.find(".arrow-left").on("click",function(){t.hasClass(s+"-active")&&e._scrollLeft()}),t.find(".arrow-right").on("click",function(){t.hasClass(o+"-active")&&e._scrllRight()})},_showMenu:function(e,t){var n=this,r=n._getMenu(),i=e.get("closeable"),s;n.set("showMenuItem",e),r.set("xy",[t.x,t.y]),r.show(),s=r.getItem(a),s&&s.set("disabled",!i)},setActived:function(e){var t=this,n=t.getItemById(e);t._setItemActived(n)},getActivedItem:function(){var e=this,n=e.get("children"),r=null;return t.each(n,function(e){if(e.get("actived"))return r=e,!1}),r},getItemById:function(e){var n=this,r=n.get("children"),i=null;return t.each(r,function(t){if(t.get("id")===e)return i=t,!1}),i},_getMenu:function(){var e=this;return e.get("menu")||e._initMenu()},_initMenu:function(){var e=this,t=new n.ContextMenu({children:[{xclass:"context-menu-item",iconCls:"icon icon-refresh",text:"\u5237\u65b0",listeners:{click:function(){var t=e.get("showMenuItem");t&&t.reload()}}},{id:a,xclass:"context-menu-item",iconCls:"icon icon-remove",text:"\u5173\u95ed",listeners:{click:function(){var t=e.get("showMenuItem");t&&t.close()}}},{xclass:"context-menu-item",iconCls:"icon icon-remove-sign",text:"\u5173\u95ed\u5176\u4ed6",listeners:{click:function(){var t=e.get("showMenuItem");t&&e.closeOther(t)}}},{xclass:"context-menu-item",iconCls:"icon icon-remove-sign",text:"\u5173\u95ed\u6240\u6709",listeners:{click:function(){e.closeAll()}}}]});return e.set("menu",t),t},_closeItem:function(e){var t=this,n=t._getIndex(e),r=t.getActivedItem(),i=t.get("preItem")||t._getItemByIndex(n-1),s=t._getItemByIndex(n+1);e.hide(function(){t.removeChild(e,!0),t._resetItemList(),r===e?i?t._setItemActived(i):t._setItemActived(s):t._scrollToItem(r),t.forceFit()})},closeAll:function(){var e=this,n=e.get("children");t.each(n,function(e){e.get("closeable")&&e.close()})},closeOther:function(e){var n=this,r=n.get("children");t.each(r,function(t){e!==t&&t.close()})},_getItemByIndex:function(e){var t=this,n=t.get("children");return n[e]},_getIndex:function(e){var n=this,r=n.get("children");return t.Array.indexOf(e,r)},_resetItemList:function(){if(this.get("forceFit"))return;var e=this,t=e.getContentElement();t.width(e._getTotalWidth())},_getTotalWidth:function(){var e=this,t=e.get("children");return t.length*e.get("itemWidth")},_getForceItemWidth:function(){var e=this,t=e.getContentElement().width(),n=e.get("children"),r=e._getTotalWidth(),i=e.get(i);return r>t&&(i=t/n.length),i},forceFit:function(){var e=this;e._forceItemWidth(e._getForceItemWidth())},_forceItemWidth:function(e){e=e||this.get("itemWidth");var n=this,r=n.get("children");t.each(r,function(t){t.set("width",e)})},_scrollToItem:function(e){if(this.get("forceFit"))return;var t=this,n=t.getContentElement(),r=n.position(),i=t._getDistanceToEnd(e,n,r),s=t._getDistanceToBegin(e,r);if(n.width()<n.parent().width())t._scrollTo(n,0);else if(s<0)t._scrollTo(n,r.left-s);else if(i>0)t._scrollTo(n,r.left+i*-1);else if(r.left<0){var o=t._getLastDistance(n,r),u=0;o<0&&(u=r.left-o,u=u<0?u:0,t._scrollTo(n,u))}},_getDistanceToBegin:function(e,t){var n=e.get("el").position();return n.left+t.left},_getDistanceToEnd:function(e,t,n){var r=this,t=t||r.getContentElement(),i=t.parent().width(),n=n||t.position(),s=r._getDistanceToBegin(e,n),o=s+r.get("itemWidth")-i;return o},_getLastDistance:function(e,t){var n=this,r=n.get("children"),i=r[r.length-1];return i?n._getDistanceToEnd(i,e,t):0},_scrollTo:function(e,t,n){var r=this;e.animate({left:t},500,function(){r._setArrowStatus(e)})},_scrollLeft:function(){var e=this,t=e.getContentElement(),n=t.position(),r=e._getLastDistance(t,n),i;r>0&&(i=r>e.get("itemWidth")?e.get("itemWidth"):r,e._scrollTo(t,n.left-i))},_scrllRight:function(){var e=this,t=e.getContentElement(),n=t.position(),r;n.left<0&&(r=n.left+e.get("itemWidth"),r=r<0?r:0,e._scrollTo(t,r))},_setArrowStatus:function(e,t){e=e||this.getContentElement();var n=this,r=n.get("el"),i=t||e.position(),u=n._getLastDistance(e,t);i.left<0?r.addClass(o+"-active"):r.removeClass(o+"-active"),u>0?r.addClass(s+"-active"):r.removeClass(s+"-active")},_setItemActived:function(e){var t=this,n=t.getActivedItem();if(e===n)return;n&&n.set("actived",!1),t.set("preItem",n),e&&(e.get("actived")||e.set("actived",!0),e.get("visible")&&t._scrollToItem(e),t.fire("activeChange",{item:e}),t.fire("activedchange",{item:e}))}},{ATTRS:{defaultChildClass:{value:"nav-tab-item"},menu:{},forceFit:{view:!0,value:!1},itemWidth:{value:f},tpl:{view:!0,value:'<div class="tab-nav-bar"><s class="tab-nav-arrow arrow-left"></s><div class="tab-nav-wrapper"><div class="tab-nav-inner"><ul class="'+i+'"></ul></div></div><s class="tab-nav-arrow arrow-right"></s>'+"</div>"+'<div class="tab-content-container"></div>'},xview:{value:l},events:{value:{itemclick:!1,activedchange:!1}}}},{xclass:"nav-tab",priority:0});return c}),define("bui/tab/tabitem",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=n.View.extend([r.ListItemView],{},{xclass:"tab-item-view"}),s=n.Controller.extend([r.ListItem],{},{ATTRS:{elTagName:{view:!0,value:"li"},xview:{value:i},tpl:{view:!0,value:'<span class="bui-tab-item-text">{text}</span>'}}},{xclass:"tab-item"});return s.View=i,s}),define("bui/tab/tab",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=n.UIBase,i=n.Controller.extend([r.ChildList],{},{ATTRS:{elTagName:{view:!0,value:"ul"},defaultChildClass:{value:"tab-item"}}},{xclass:"tab"});return i}),define("bui/tab/tabpanelitem",["bui/common","bui/tab/tabitem","bui/tab/panelitem"],function(e){var t=e("bui/common"),n=e("bui/tab/tabitem"),r=e("bui/tab/panelitem"),i="bui-tab-item-text",s=t.Component,o=n.View.extend([s.UIBase.Close.View],{_uiSetTitle:function(e){var t=this,n=t.get("el"),r=n.find("."+i);r.text(e)}},{xclass:"tab-panel-item-view"}),u=n.extend([r,s.UIBase.Close],{},{ATTRS:{closeAction:{value:"remove"},title:{view:!0,sync:!1},tpl:{value:'<span class="'+i+'">{text}{title}</span>'},closeable:{value:!1},events:{value:{beforeclosed:!0}},xview:{value:o}}},{xclass:"tab-panel-item"});return u.View=o,u}),define("bui/tab/tabpanel",["bui/common","bui/tab/tab","bui/tab/panels"],function(e){var t=e("bui/common"),n=e("bui/tab/tab"),r=e("bui/tab/panels"),i=n.extend([r],{bindUI:function(){var e=this;e.on("beforeclosed",function(t){var n=t.target;e._beforeClosedItem(n)})},_beforeClosedItem:function(e){if(!e.get("selected"))return;var t=this,n=t.indexOfItem(e),r=t.getItemCount(),i,s;n!==r-1?(s=t.getItemAt(n+1),t.setSelected(s)):n!==0&&(i=t.getItemAt(n-1),t.setSelected(i))}},{ATTRS:{elTagName:{value:"div"},childContainer:{value:"ul"},tpl:{value:'<div class="tab-panel-inner"><ul></ul><div class="tab-panels"></div></div>'},panelTpl:{value:"<div></div>"},panelContainer:{value:".tab-panels"},defaultChildClass:{value:"tab-panel-item"}}},{xclass:"tab-panel"});return i}),define("bui/toolbar",["bui/common","bui/toolbar/baritem","bui/toolbar/bar","bui/toolbar/pagingbar","bui/toolbar/numberpagingbar"],function(e){var t=e("bui/common"),n=t.namespace("Toolbar");return t.mix(n,{BarItem:e("bui/toolbar/baritem"),Bar:e("bui/toolbar/bar"),PagingBar:e("bui/toolbar/pagingbar"),NumberPagingBar:e("bui/toolbar/numberpagingbar")}),n}),define("bui/toolbar/baritem",function(){var e=BUI.prefix,t=BUI.Component,n=t.UIBase,r=t.View.extend([n.ListItemView]),i=t.Controller.extend([n.ListItem],{renderUI:function(){var t=this.get("el");t.addClass(e+"inline-block"),t.attr("id")||t.attr("id",this.get("id"))}},{ATTRS:{elTagName:{view:!0,value:"li"},selectable:{value:!1},focusable:{value:!1},xview:{value:r}}},{xclass:"bar-item",priority:1}),s=i.extend({_uiSetDisabled:function(t){var n=this,r=n.get("el"),i=t?"addClass":"removeClass";r.find("button").attr("disabled",t)[i](e+"button-disabled")},_uiSetChecked:function(t){var n=this,r=n.get("el"),i=t?"addClass":"removeClass";r.find("button")[i](e+"button-checked")},_uiSetText:function(e){var t=this,n=t.get("el");n.find("button").text(e)},_uiSetbtnCls:function(e){var t=this,n=t.get("el");n.find("button").addClass(e)}},{ATTRS:{checked:{value:!1},tpl:{view:!0,value:'<button type="button" class="{btnCls}">{text}</button>'},btnCls:{sync:!1},text:{sync:!1,value:""}}},{xclass:"bar-item-button",priority:2}),o=i.extend({renderUI:function(){var e=this.get("el");e.attr("role","separator")}},{xclass:"bar-item-separator",priority:2}),u=i.extend({},{ATTRS:{width:{view:!0,value:2}}},{xclass:"bar-item-spacer",priority:2}),a=i.extend({_uiSetText:function(e){var t=this,n=t.get("el");n.html(e)}},{ATTRS:{text:{value:""}}},{xclass:"bar-item-text",priority:2});return i.types={button:s,separator:o,spacer:u,text:a},i}),define("bui/toolbar/bar",function(){var e=BUI.Component,t=e.UIBase,n=e.View.extend({renderUI:function(){var e=this.get("el");e.attr("role","toolbar"),e.attr("id")||e.attr("id",BUI.guid("bar"))}}),r=e.Controller.extend([t.ChildList],{getItem:function(e){return this.getChild(e)}},{ATTRS:{elTagName:{view:!0,value:"ul"},defaultChildClass:{value:"bar-item"},focusable:{value:!1},xview:{value:n}}},{xclass:"bar",priority:1});return r}),define("bui/toolbar/pagingbar",["bui/toolbar/bar"],function(e){var t=e("bui/toolbar/bar"),n=BUI.Component,r=n.UIBase.Bindable,i=BUI.prefix,s="first",o="prev",u="next",a="last",f="skip",l="refresh",c="totalPage",h="curPage",p="totalCount",d=[s,o,u,a,f,l],v=[c,h,p],m=t.extend([r],{initializer:function(){var e=this,t=e.get("children"),n=e.get("items"),r=e.get("store");n?BUI.each(n,function(n,r){BUI.isString(n)&&(BUI.Array.contains(n,d)?n=e._getButtonItem(n):BUI.Array.contains(n,v)?n=e._getTextItem(n):n={xtype:n}),t.push(n)}):(n=e._getItems(),BUI.each(n,function(e){t.push(e)})),r&&r.get("pageSize")&&e.set("pageSize",r.get("pageSize"))},bindUI:function(){var e=this;e._bindButtonEvent()},jumpToPage:function(e){if(e<=0||e>this.get("totalPage"))return;var t=this,n=t.get("store"),r=t.get("pageSize"),i=e-1,s=i*r,o=t.fire("beforepagechange",{from:t.get("curPage"),to:e});n&&o!==!1&&n.load({start:s,limit:r,pageIndex:i})},_afterStoreLoad:function(e,t){var n=this,r=n.get("pageSize"),i=0,s,o,u,a;i=e.get("start"),o=e.getTotalCount(),s=o-i>r?i+e.getCount()-1:o,a=parseInt((o+r-1)/r,10),a=a>0?a:1,u=parseInt(i/r,10)+1,n.set("start",i),n.set("end",s),n.set("totalCount",o),n.set("curPage",u),n.set("totalPage",a),n._setAllButtonsState(),n._setNumberPages()},_bindButtonEvent:function(){function n(){var t=parseInt(e._getCurrentPageValue(),10);e._isPageAllowRedirect(t)?e.jumpToPage(t):e._setCurrentPageValue(e.get("curPage"))}var e=this;e._bindButtonItemEvent(s,function(){e.jumpToPage(1)}),e._bindButtonItemEvent(o,function(){e.jumpToPage(e.get("curPage")-1)}),e._bindButtonItemEvent(u,function(){e.jumpToPage(e.get("curPage")+1)}),e._bindButtonItemEvent(a,function(){e.jumpToPage(e.get("totalPage"))}),e._bindButtonItemEvent(f,function(){n()}),e._bindButtonItemEvent(l,function(){e.jumpToPage(e.get("curPage"))});var t=e.getItem(h);t&&t.get("el").on("keyup",function(e){e.stopPropagation(),e.keyCode===13&&n()})},_bindButtonItemEvent:function(e,t){var n=this,r=n.getItem(e);r&&r.on("click",t)},onLoad:function(e){var t=this,n=t.get("store");t._afterStoreLoad(n,e)},_getItems:function(){var e=this,t=e.get("items");return t&&t.length?t:(t=[],t.push(e._getButtonItem(s)),t.push(e._getButtonItem(o)),t.push(e._getSeparator()),t.push(e._getTextItem(c)),t.push(e._getTextItem(h)),t.push(e._getButtonItem(f)),t.push(e._getSeparator()),t.push(e._getButtonItem(u)),t.push(e._getButtonItem(a)),t.push(e._getSeparator()),t.push(e._getTextItem(p)),t)},_getButtonItem:function(e){var t=this;return{id:e,xclass:"bar-item-button",text:t.get(e+"Text"),disabled:!0,elCls:t.get(e+"Cls")}},_getSeparator:function(){return{xclass:"bar-item-separator"}},_getTextItem:function(e){var t=this;return{id:e,xclass:"bar-item-text",text:t._getTextItemTpl(e)}},_getTextItemTpl:function(e){var t=this,n=t.getAttrVals();return BUI.substitute(this.get(e+"Tpl"),n)},_isPageAllowRedirect:function(e){var t=this;return e&&e>0&&e<=t.get("totalPage")&&e!==t.get("curPage")},_setAllButtonsState:function(){var e=this,t=e.get("store");t&&e._setButtonsState([o,u,s,a,f],!0),e.get("curPage")===1&&e._setButtonsState([o,s],!1),e.get("curPage")===e.get("totalPage")&&e._setButtonsState([u,a],!1)},_setButtonsState:function(e,t){var n=this,r=n.get("children");BUI.each(r,function(n){BUI.Array.indexOf(n.get("id"),e)!==-1&&n.set("disabled",!t)})},_setNumberPages:function(){var e=this,t=e.getItems();BUI.each(t,function(t){t.__xclass==="bar-item-text"&&t.set("content",e._getTextItemTpl(t.get("id")))})},_getCurrentPageValue:function(e){var t=this;e=e||t.getItem(h);if(e){var n=e.get("el").find("input");return n.val()}},_setCurrentPageValue:function(e,t){var n=this;t=t||n.getItem(h);if(t){var r=t.get("el").find("input");r.val(e)}}},{ATTRS:{firstText:{value:"\u9996 \u9875"},firstCls:{value:i+"pb-first"},prevText:{value:"\u4e0a\u4e00\u9875"},prevCls:{value:i+"pb-prev"},nextText:{value:"\u4e0b\u4e00\u9875"},nextCls:{value:i+"pb-next"},lastText:{value:"\u672b \u9875"},lastCls:{value:i+"pb-last"},skipText:{value:"\u786e\u5b9a"},skipCls:{value:i+"pb-skip"},refreshText:{value:"\u5237\u65b0"},refreshCls:{value:i+"pb-refresh"},totalPageTpl:{value:"\u5171 {totalPage} \u9875"},curPageTpl:{value:'\u7b2c <input type="text" autocomplete="off" class="'+i+'pb-page" size="20" value="{curPage}" name="inputItem"> \u9875'},totalCountTpl:{value:"\u5171{totalCount}\u6761\u8bb0\u5f55"},autoInitItems:{value:!1},curPage:{value:0},totalPage:{value:0},totalCount:{value:0},pageSize:{value:30},store:{}},ID_FIRST:s,ID_PREV:o,ID_NEXT:u,ID_LAST:a,ID_SKIP:f,ID_REFRESH:l,ID_TOTAL_PAGE:c,ID_CURRENT_PAGE:h,ID_TOTAL_COUNT:p},{xclass:"pagingbar",priority:2});return m}),define("bui/toolbar/numberpagingbar",["bui/toolbar/pagingbar"],function(e){var t=BUI.Component,n=e("bui/toolbar/pagingbar"),r=BUI.prefix,i="numberContainer",s=r+"button-number",o=n.extend({_getItems:function(){var e=this,t=e.get("items");return t?t:(t=[],t.push(e._getButtonItem(n.ID_PREV)),t.push(e._getButtonItem(n.ID_NEXT)),t)},_getButtonItem:function(e){var t=this;return{id:e,content:'<a href="javascript:;">'+t.get(e+"Text")+"</a>",disabled:!0}},_bindButtonEvent:function(){var e=this,t=e.get("numberButtonCls");e.constructor.superclass._bindButtonEvent.call(this),e.get("el").delegate("a","click",function(e){e.preventDefault()}),e.on("click",function(n){var r=n.target;if(r&&r.get("el").hasClass(t)){var i=r.get("id");
e.jumpToPage(i)}})},_setNumberPages:function(){var e=this;e._setNumberButtons()},_setNumberButtons:function(){var e=this,t=e.get("curPage"),n=e.get("totalPage"),r=e._getNumberItems(t,n),i;e._clearNumberButtons(),BUI.each(r,function(t){e._appendNumberButton(t)}),i=e.getItem(t),i&&i.set("selected",!0)},_appendNumberButton:function(e){var t=this,n=t.getItemCount(),r=t.addItemAt(e,n-1)},_clearNumberButtons:function(){var e=this,t=e.getItems(),n=e.getItemCount();while(n>2)e.removeItemAt(n-2),n=e.getItemCount()},_getNumberItems:function(e,t){function u(e,t){for(var i=e;i<=t;i++)r.push(n._getNumberItem(i))}function a(){r.push(n._getEllipsisItem())}var n=this,r=[],i=n.get("maxLimitCount"),s=n.get("showRangeCount"),o;if(t<i)o=t,u(1,t);else{var f=e<=i?1:e-s,l=e+s,c=l<t?l>i?l:i:t;f>1&&(u(1,1),f>2&&a()),o=c,u(f,c)}return o<t&&(o<t-1&&a(),u(t,t)),r},_getEllipsisItem:function(){var e=this;return{disabled:!0,content:e.get("ellipsisTpl")}},_getNumberItem:function(e){var t=this;return{id:e,elCls:t.get("numberButtonCls")}}},{ATTRS:{itemStatusCls:{value:{selected:"active",disabled:"disabled"}},itemTpl:{value:'<a href="">{id}</a>'},prevText:{value:"<<"},nextText:{value:">>"},maxLimitCount:{value:4},showRangeCount:{value:1},numberButtonCls:{value:s},ellipsisTpl:{value:'<a href="#">...</a>'}}},{xclass:"pagingbar-number",priority:3});return o}),define("bui/progressbar",["bui/common","bui/progressbar/base","bui/progressbar/load"],function(e){var t=e("bui/common"),n=t.namespace("ProgressBar");return t.mix(n,{Base:e("bui/progressbar/base"),Load:e("bui/progressbar/load")}),n}),define("bui/progressbar/base",["bui/common"],function(e){var t=e("bui/common"),n=t.Component.View.extend({_uiSetPercent:function(e){var n=this,r=n.get("el").children();t.isArray(e)||(e=[e]),t.each(r,function(t,n){$(t).width(e[n]+"%")})}},{ATTRS:{percent:{}}}),r=t.Component.Controller.extend({},{ATTRS:{percent:{view:!0,value:0},tpl:{value:'<div class="progress-bar-inner"></div>'},xview:{value:n}}},{xclass:"progress-bar"});return r}),define("bui/progressbar/load",["bui/progressbar/base"],function(e){var t=e("bui/progressbar/base"),n=0,r=1,i=2,s=t.extend({bindUI:function(){var e=this;e.on("afterPercentChange",function(t){if(e.isLoading()){var n=e.get("percent");n==100&&e.onCompleted(),e.onChange()}})},start:function(){var e=this;e.isLoading()||e.onstart()},complete:function(){var e=this;clearTimeout(e.get("t")),e.set("percent",100)},cancel:function(){var e=this;clearTimeout(e.get("t")),e.get("percent")&&e.set("percent",0),e.set("status",n)},onstart:function(){var e=this,t=e.get("cfg");e.set("percent",0),e.set("status",r),e.fire("start",t),e._startLoad()},onChange:function(){var e=this;e.fire("loadchange")},onCompleted:function(){var e=this;e.set("status",i),e.fire("completed")},isLoading:function(){return this.get("status")===r},isCompleted:function(){return this.get("status")===i},_startLoad:function(){var e=this,t=e.get("ajaxCfg"),n=e.get("interval"),r;t.success=function(i){var s=i.percent;e.set("percent",s),s<100&&e.isLoading()&&(r=setTimeout(function(){$.ajax(t)},n),e.set("t",r))},$.ajax(t)}},{ATTRS:{status:{value:0},ajaxCfg:{},interval:{value:500},events:{}}},{xclass:"progress-bar-load"});return s}),define("bui/calendar",["bui/common","bui/calendar/calendar","bui/calendar/monthpicker","bui/calendar/datepicker"],function(e){var t=e("bui/common"),n=t.namespace("Calendar");return t.mix(n,{Calendar:e("bui/calendar/calendar"),MonthPicker:e("bui/calendar/monthpicker"),DatePicker:e("bui/calendar/datepicker")}),n}),define("bui/calendar/monthpicker",["bui/common","bui/overlay","bui/list","bui/toolbar"],function(e){function v(){return $.map(d,function(e,t){return{text:e,value:t}})}var t=e("bui/common"),n=t.Component,r=e("bui/overlay").Overlay,i=e("bui/list").SimpleList,s=e("bui/toolbar"),o=t.prefix,u="x-monthpicker-month",a="data-month",f="data-year",l="x-monthpicker-year",c="x-monthpicker-yearnav",h="x-monthpicker-selected",p="x-monthpicker-item",d=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"],m=i.extend({bindUI:function(){var e=this;e.get("el").delegate("a","click",function(e){e.preventDefault()}).delegate("."+u,"dblclick",function(){e.fire("monthdblclick")})}},{ATTRS:{itemTpl:{view:!0,value:'<li class="'+p+' x-monthpicker-month"><a href="#" hidefocus="on">{text}</a></li>'},itemCls:{value:p},items:{view:!0,value:v()},elCls:{view:!0,value:"x-monthpicker-months"}}},{xclass:"calendar-month-panel"}),g=i.extend({bindUI:function(){var e=this,t=e.get("el");t.delegate("a","click",function(e){e.preventDefault()}),t.delegate("."+l,"dblclick",function(){e.fire("yeardblclick")}),t.delegate(".x-icon","click",function(t){var n=$(t.currentTarget);n.hasClass(c+"-prev")?e._prevPage():n.hasClass(c+"-next")&&e._nextPage()}),e.on("itemselected",function(t){t.item&&e.setInternal("year",t.item.value)})},_prevPage:function(){var e=this,t=e.get("start"),n=e.get("yearCount");e.set("start",t-n)},_nextPage:function(){var e=this,t=e.get("start"),n=e.get("yearCount");e.set("start",t+n)},_uiSetStart:function(){var e=this;e._setYearsContent()},_uiSetYear:function(e){var t=this,n=t.findItemByField("value",e);n?t.setSelectedByField(e):t.set("start",e)},_setYearsContent:function(){var e=this,t=e.get("year"),n=e.get("start"),r=e.get("yearCount"),i=[];for(var s=n;s<n+r;s++){var o=s.toString();i.push({text:o,value:s})}e.set("items",i),e.setSelectedByField(t)}},{ATTRS:{items:{view:!0,value:[]},elCls:{view:!0,value:"x-monthpicker-years"},itemCls:{value:p},year:{},start:{value:(new Date).getFullYear()},yearCount:{value:10},itemTpl:{view:!0,value:'<li class="'+p+" "+l+'"><a href="#" hidefocus="on">{text}</a></li>'},tpl:{view:!0,value:'<div class="'+c+'">'+'<span class="'+c+'-prev x-icon x-icon-normal x-icon-small"><span class="icon icon-caret icon-caret-left"></span></span>'+'<span class="'+c+'-next x-icon x-icon-normal x-icon-small"><span class="icon icon-caret icon-caret-right"></span></span>'+"</div>"+"<ul></ul>"}}},{xclass:"calendar-year-panel"}),y=r.extend({initializer:function(){var e=this,t=e.get("children"),n=new m,r=new g,i=e._createFooter();t.push(n),t.push(r),t.push(i),e.set("yearPanel",r),e.set("monthPanel",n)},bindUI:function(){var e=this;e.get("monthPanel").on("itemselected",function(t){t.item&&e.setInternal("month",t.item.value)}).on("monthdblclick",function(){e._successCall()}),e.get("yearPanel").on("itemselected",function(t){t.item&&e.setInternal("year",t.item.value)}).on("yeardblclick",function(){e._successCall()})},_successCall:function(){var e=this,t=e.get("success");t&&t.call(e)},_createFooter:function(){var e=this;return new s.Bar({elCls:o+"clear x-monthpicker-footer",children:[{xclass:"bar-item-button",text:"\u786e\u5b9a",btnCls:"button button-small button-primary",handler:function(){e._successCall()}},{xclass:"bar-item-button",text:"\u53d6\u6d88",btnCls:"button button-small last",handler:function(){var t=e.get("cancel");t&&t.call(e)}}]})},_uiSetYear:function(e){this.get("yearPanel").set("year",e)},_uiSetMonth:function(e){this.get("monthPanel").setSelectedByField(e)}},{ATTRS:{footer:{},align:{value:{}},year:{},success:{value:function(){}},cancel:{value:function(){}},width:{value:180},month:{},yearPanel:{},monthPanel:{}}},{xclass:"monthpicker"});return y}),define("bui/calendar/header",["bui/common"],function(e){var t=e("bui/common"),n=t.prefix,r=t.Component,i="year-text",s="month-text",o="x-datepicker-arrow",u="x-datepicker-prev",a="x-datepicker-next",f=r.Controller.extend({bindUI:function(){var e=this,t=e.get("el");t.delegate("."+o,"click",function(t){t.preventDefault();var n=$(t.currentTarget);n.hasClass(a)?e.nextMonth():n.hasClass(u)&&e.prevMonth()}),t.delegate(".x-datepicker-month","click",function(){e.fire("headerclick")})},setMonth:function(e,t){var n=this,r=n.get("year"),i=n.get("month");if(e!==r||t!==i)n.set("year",e),n.set("month",t),n.fire("monthchange",{year:e,month:t})},nextMonth:function(){var e=this,t=new Date(e.get("year"),e.get("month")+1);e.setMonth(t.getFullYear(),t.getMonth())},prevMonth:function(){var e=this,t=new Date(e.get("year"),e.get("month")-1);e.setMonth(t.getFullYear(),t.getMonth())},_uiSetYear:function(e){var t=this;t.get("el").find("."+i).text(e)},_uiSetMonth:function(e){var t=this;t.get("el").find("."+s).text(e+1)}},{ATTRS:{year:{sync:!1},month:{sync:!1,setter:function(e){this.set("monthText",e+1)}},monthText:{},tpl:{view:!0,value:'<div class="'+o+" "+u+'"><span class="icon icon-white icon-caret icon-caret-left"></span></div>'+'<div class="x-datepicker-month">'+'<div class="month-text-container">'+'<span><span class="year-text">{year}</span>\u5e74 <span class="month-text">{monthText}</span>\u6708</span>'+'<span class="'+n+"caret "+n+'caret-down"></span>'+"</div>"+"</div>"+'<div class="'+o+" "+a+'"><span class="icon icon-white icon-caret icon-caret-right"></span></div>'},elCls:{view:!0,value:"x-datepicker-header"},events:{value:{monthchange:!0}}}},{xclass:"calendar-header"});return f}),define("bui/calendar/panel",["bui/common"],function(e){var t=e("bui/common"),n=t.Component,r=t.Date,i="x-datepicker-date",s="x-datepicker-today",o="x-datepicker-disabled",u="x-datepicker-active",a="data-date",f="isoDate",l="x-datepicker-selected",c=6,h={deactive:"prevday",active:"active",disabled:"disabled"},p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],d=n.View.extend({renderUI:function(){this.updatePanel()},updatePanel:function(){var e=this,t=e.get("el"),n=t.find("tbody"),r=e._getPanelInnerTpl();n.empty(),$(r).appendTo(n)},_getPanelInnerTpl:function(){var e=this,t=e._getFirstDate(),n=[];for(var i=0;i<c;i++){var s=r.addWeek(i,t);n.push(e._getWeekTpl(s))}return n.join("")},_getWeekTpl:function(e){var n=this,i=n.get("weekTpl"),s=[];for(var o=0;o<p.length;o++){var u=r.addDay(o,e);s.push(n._getDayTpl(u))}return t.substitute(i,{daysTpl:s.join("")})},_getDayTpl:function(e){var n=this,i=n.get("dayTpl"),o=e.getDay(),u=n._isToday(e)?s:"",a=p[o],l=e.getDate(),c=n._isInRange(e)?n._isCurrentMonth(e)?h.active:h.deactive:h.disabled;return t.substitute(i,{dayOfWeek:a,dateType:c,dateNumber:l,todayCls:u,date:r.format(e,f)})},_getFirstDate:function(e,t){var n=this,i=n._getMonthFirstDate(e,t),s=i.getDay();return r.addDay(s*-1,i)},_getMonthFirstDate:function(e,t){var n=this,e=e||n.get("year"),t=t||n.get("month");return new Date(e,t)},_isCurrentMonth:function(e){return e.getMonth()===this.get("month")},_isToday:function(e){var t=new Date;return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()},_isInRange:function(e){var t=this,n=t.get("maxDate"),r=t.get("minDate");return r&&e<r?!1:n&&e>n?!1:!0},_clearSelectedDate:function(){var e=this;e.get("el").find("."+l).removeClass(l)},_findDateElement:function(e){var t=this,n=r.format(e,f),s=t.get("el").find("."+i),o=null;return n&&s.each(function(e,t){if($(t).attr("title")===n)return o=$(t),!1}),o},_setSelectedDate:function(e){var t=this,n=t._findDateElement(e);t._clearSelectedDate(),n&&n.addClass(l)}},{ATTRS:{}}),v=n.Controller.extend({initializer:function(){var e=this,t=new Date;e.get("year")||e.set("year",t.getFullYear()),e.get("month")||e.set("month",t.getMonth())},bindUI:function(){var e=this,t=e.get("el");t.delegate("."+i,"click",function(e){e.preventDefault()}),t.delegate("."+o,"mouseup",function(e){e.stopPropagation()})},performActionInternal:function(e){var t=this,n=$(e.target).closest("."+i);if(n){var s=n.attr("title");s&&(s=r.parse(s),t.get("view")._isInRange(s)&&t.set("selected",s))}},setMonth:function(e,t){var n=this,r=n.get("year"),i=n.get("month");if(e!==r||t!==i)n.set("year",e),n.set("month",t),n.get("view").updatePanel()},_uiSetSelected:function(e,t){var n=this;t&&t.prevVal&&r.isDateEquals(e,t.prevVal)||(n.setMonth(e.getFullYear(),e.getMonth()),n.get("view")._setSelectedDate(e),n.fire("selectedchange",{date:e}))},_uiSetMaxDate:function(e){e&&this.get("view").updatePanel()},_uiSetMinDate:function(e){e&&this.get("view").updatePanel()}},{ATTRS:{year:{view:!0},month:{view:!0},selected:{},focusable:{value:!0},dayTpl:{view:!0,value:'<td class="x-datepicker-date x-datepicker-{dateType} {todayCls} day-{dayOfWeek}" title="{date}"><a href="#" hidefocus="on" tabindex="1"><em><span>{dateNumber}</span></em></a></td>'},events:{value:{click:!1,selectedchange:!0}},maxDate:{view:!0,setter:function(e){if(e)return t.isString(e)?r.parse(e):e}},minDate:{view:!0,setter:function(e){if(e)return t.isString(e)?r.parse(e):e}},weekTpl:{view:!0,value:"<tr>{daysTpl}</tr>"},tpl:{view:!0,value:'<table class="x-datepicker-inner" cellspacing="0"><thead><tr><th title="Sunday"><span>\u65e5</span></th><th title="Monday"><span>\u4e00</span></th><th title="Tuesday"><span>\u4e8c</span></th><th title="Wednesday"><span>\u4e09</span></th><th title="Thursday"><span>\u56db</span></th><th title="Friday"><span>\u4e94</span></th><th title="Saturday"><span>\u516d</span></th></tr></thead><tbody class="x-datepicker-body"></tbody></table>'},xview:{value:d}}},{xclass:"calendar-panel",priority:0});return v}),define("bui/calendar/calendar",["bui/picker","bui/calendar/monthpicker","bui/calendar/header","bui/calendar/panel","bui/toolbar"],function(e){function v(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function m(e){return e<10?"0"+e:e.toString()}function g(e){var t=[];for(var n=0;n<e;n++)t.push({text:m(n),value:m(n)});return t}function y(e,t){var n=e.get("el").find("."+t);return parseInt(n.val(),10)}function b(e,n,r){var i=e.get("el").find("."+n);t.isNumber(r)&&(r=m(r)),i.val(r)}var t=e("bui/common"),n=t.prefix,r="x-datepicker-time",i="x-datepicker-hour",s="x-datepicker-minute",o="x-datepicker-second",u="x-timepicker",a=e("bui/picker").ListPicker,f=e("bui/calendar/monthpicker"),l=e("bui/calendar/header"),c=e("bui/calendar/panel"),h=e("bui/toolbar"),p=t.Component,d=t.Date,w=p.Controller.extend({initializer:function(){var e=this,t=e.get("children"),n=new l,r=new c,i=e.get("footer")||e._createFooter();t.push(n),t.push(r),t.push(i),e.set("header",n),e.set("panel",r),e.set("footer",i)},renderUI:function(){var e=this,t=e.get("children");if(e.get("showTime")){var n=e.get("timepicker")||e._initTimePicker();t.push(n),e.set("timepicker",n)}},bindUI:function(){var e=this,t=e.get("header"),n=e.get("panel");n.on("selectedchange",function(t){var n=t.date;d.isDateEquals(n,e.get("selectedDate"))||e.set("selectedDate",n)}),e.get("showTime")?e._initTimePickerEvent():n.on("click",function(){e.fire("accept")}),t.on("monthchange",function(t){e._setYearMonth(t.year,t.month)}),t.on("headerclick",function(){var n=e.get("monthpicker")||e._createMonthPicker();n.set("year",t.get("year")),n.set("month",t.get("month")),n.show()})},_initTimePicker:function(){var e=this,t=e.get("lockTime"),n={hour:i,minute:s,second:o};if(t)for(var f in t){var l=n[f.toLowerCase()];e.set(f,t[f]),t.editable||e.get("el").find("."+l).attr("disabled","")}var c=new a({elCls:u,children:[{itemTpl:'<li><a href="#">{text}</a></li>'}],autoAlign:!1,align:{node:e.get("el"),points:["bl","bl"],offset:[0,-30]},trigger:e.get("el").find("."+r)});return c.render(),e._initTimePickerEvent(c),c},_initTimePickerEvent:function(e){var t=this,e=t.get("timepicker");if(!e)return;e.get("el").delegate("a","click",function(e){e.preventDefault()}),e.on("triggerchange",function(t){var n=t.curTrigger;n.hasClass(i)?e.get("list").set("items",g(24)):e.get("list").set("items",g(60))}),e.on("selectedchange",function(e){var n=e.curTrigger,r=e.value;n.hasClass(i)?t.setInternal("hour",r):n.hasClass(s)?t.setInternal("minute",r):t.setInternal("second",r)})},_setYearMonth:function(e,t){var n=this,r=n.get("selectedDate"),i=r.getDate();if(e!==r.getFullYear()||t!==r.getMonth()){var s=new Date(e,t,i);s.getMonth()!=t&&(s=d.addDay(-1,new Date(e,t+1))),n.set("selectedDate",s)}},_createMonthPicker:function(){var e=this,t;return t=new f({render:e.get("el"),effect:{effect:"slide",duration:300},visibleMode:"display",success:function(){var t=this;e._setYearMonth(t.get("year"),t.get("month")),t.hide()},cancel:function(){this.hide()}}),e.set("monthpicker",t),e.get("children").push(t),t},_createFooter:function(){var e=this,t=this.get("showTime"),r=[];return t?(r.push({content:e.get("timeTpl")}),r.push({xclass:"bar-item-button",text:"\u786e\u5b9a",btnCls:"button button-small button-primary",listeners:{click:function(){e.fire("accept")}}})):(r.push({xclass:"bar-item-button",text:"\u4eca\u5929",btnCls:"button button-small",id:"todayBtn",listeners:{click:function(){var t=v();e.set("selectedDate",t),e.fire("accept")}}}),r.push({xclass:"bar-item-button",text:"\u6e05\u9664",btnCls:"button button-small",id:"clsBtn",listeners:{click:function(){e.fire("clear")}}})),new h.Bar({elCls:n+"calendar-footer",children:r})},_updateTodayBtnAble:function(){var e=this;if(!e.get("showTime")){var t=e.get("footer"),n=e.get("panel").get("view"),r=v(),i=t.getItem("todayBtn");n._isInRange(r)?i.enable():i.disable()}},_uiSetSelectedDate:function(e){var t=this,n=e.getFullYear(),r=e.getMonth();t.get("header").setMonth(n,r),t.get("panel").set("selected",e),t.fire("datechange",{date:e})},_uiSetHour:function(e){b(this,i,e)},_uiSetMinute:function(e){b(this,s,e)},_uiSetSecond:function(e){b(this,o,e)},_uiSetMaxDate:function(e){var t=this;t.get("panel").set("maxDate",e),t._updateTodayBtnAble()},_uiSetMinDate:function(e){var t=this;t.get("panel").set("minDate",e),t._updateTodayBtnAble()}},{ATTRS:{header:{},panel:{},maxDate:{},minDate:{},monthPicker:{},timepicker:{},width:{value:180},events:{value:{click:!1,accept:!1,datechange:!1,monthchange:!1}},showTime:{value:!1},lockTime:{},timeTpl:{value:'<input type="text" readonly class="'+r+" "+i+'" />:<input type="text" readonly class="'+r+" "+s+'" />:<input type="text" readonly class="'+r+" "+o+'" />'},selectedDate:{value:v()},hour:{value:(new Date).getHours()},minute:{value:(new Date).getMinutes()},second:{value:0}}},{xclass:"calendar",priority:0});return w}),define("bui/calendar/datepicker",["bui/common","bui/picker","bui/calendar/calendar"],function(e){var t=e("bui/common"),n=e("bui/picker").Picker,r=e("bui/calendar/calendar"),i=t.Date,s=n.extend({initializer:function(){},createControl:function(){var e=this,t=e.get("children"),n=new r({render:e.get("el"),showTime:e.get("showTime"),lockTime:e.get("lockTime"),minDate:e.get("minDate"),maxDate:e.get("maxDate"),autoRender:!0});return n.on("clear",function(){var t=e.get("curTrigger"),n=t.val();n&&(t.val(""),t.trigger("change"))}),e.get("dateMask")||(e.get("showTime")?e.set("dateMask","yyyy-mm-dd HH:MM:ss"):e.set("dateMask","yyyy-mm-dd")),t.push(n),e.set("calendar",n),n},setSelectedValue:function(e){if(!this.get("calendar"))return;var t=this,n=this.get("calendar"),r=i.parse(e,t.get("dateMask"));r=r||t.get("selectedDate"),n.set("selectedDate",i.getDate(r));if(t.get("showTime")){var s=this.get("lockTime"),o=r.getHours(),u=r.getMinutes(),a=r.getSeconds();s&&(!e||!s.editable)&&(o=s["hour"]!=null?s.hour:o,u=s["minute"]!=null?s.minute:u,a=s["second"]!=null?s.second:a),n.set("hour",o),n.set("minute",u),n.set("second",a)}},getSelectedValue:function(){if(!this.get("calendar"))return null;var e=this,t=e.get("calendar"),n=i.getDate(t.get("selectedDate"));return e.get("showTime")&&(n=i.addHour(t.get("hour"),n),n=i.addMinute(t.get("minute"),n),n=i.addSecond(t.get("second"),n)),n},getSelectedText:function(){return this.get("calendar")?i.format(this.getSelectedValue(),this._getFormatType()):""},_getFormatType:function(){return this.get("dateMask")},_uiSetMaxDate:function(e){if(!this.get("calendar"))return null;var t=this;t.get("calendar").set("maxDate",e)},_uiSetMinDate:function(e){if(!this.get("calendar"))return null;var t=this;t.get("calendar").set("minDate",e)}},{ATTRS:{showTime:{value:!1},lockTime:{},maxDate:{},minDate:{},dateMask:{},changeEvent:{value:"accept"},hideEvent:{value:"accept clear"},calendar:{},selectedDate:{value:new Date((new Date).setSeconds(0))}}},{xclass:"datepicker",priority:0});return s}),define("bui/editor",["bui/common","bui/form","bui/editor/editor","bui/editor/record","bui/editor/dialog"],function(e){var t=e("bui/common"),n=e("bui/form"),r=t.namespace("Editor");return t.mix(r,{Editor:e("bui/editor/editor"),RecordEditor:e("bui/editor/record"),DialogEditor:e("bui/editor/dialog")}),r}),define("bui/editor/mixin",function(e){function t(e){var t=e,n=t.get("controlCfgField"),r=t.get(n),i=t.addChild(r);t.setInternal(n,i)}var n=function(){t(this)};return n.ATTRS={acceptEvent:{value:"autohide"},preventHide:{value:!0},changeSourceEvent:{value:"show triggerchange"},ignoreInputFields:{value:!1},innerValueField:{},emptyValue:{},controlCfgField:{},focusable:{value:!0},autoUpdate:{value:!0},events:{value:{accept:!1,cancel:!1}}},n.prototype={__bindUI:function(){var e=this,t=e.get("acceptEvent"),n=e.get("changeSourceEvent");t&&e.on(t,function(){if(e.accept())return;if(e.get("preventHide"))return!1;e.cancel()}),n&&e.on(n,function(){e.setValue(e.getSourceValue()),e.get("visible")&&e.focus()})},getInnerControl:function(){var e=this,t=e.get("children");return t[0]},setValue:function(e,t){var n=this,r=n.getInnerControl();n.set("editValue",e),n.clearControlValue(),r.set(n.get("innerValueField"),e),e||n.valid(),t&&n.clearErrors()},getValue:function(){var e=this,t=e.getInnerControl();return t.get(e.get("innerValueField"))},isValid:function(){var e=this,t=e.getInnerControl();return t.isValid?t.isValid():!0},valid:function(){var e=this,t=e.getInnerControl();t.valid&&t.valid()},getErrors:function(){var e=this,t=e.getInnerControl();return t.getErrors?t.getErrors():[]},isChange:function(){var e=this,t=e.get("editValue"),n=e.getValue();return t!==n},clearValue:function(){this.clearControlValue(),this.clearErrors()},clearControlValue:function(){var e=this,t=e.getInnerControl();t.set(e.get("innerValueField"),e.get("emptyValue"))},clearErrors:function(){var e=this,t=e.getInnerControl();t.clearErrors()},getSourceValue:function(){},updateSource:function(){},handleNavEsc:function(){this.cancel()},handleNavEnter:function(e){var t=e.target;if(t.tagName==="TEXTAREA")return;t.tagName==="BUTTON"&&$(t).trigger("click"),this.accept()},focus:function(){var e=this,t=e.getInnerControl();t.focus&&t.focus()},accept:function(){var e=this,t;e.valid();if(!e.isValid())return!1;t=e.getValue(),e.get("autoUpdate")&&e.updateSource(t);if(e.fire("beforeaccept",{value:t})==0)return;return e.fire("accept",{value:t,editValue:e.get("editValue")}),e.hide(),!0},cancel:function(){this.fire("cancel"),this.clearValue(),this.close()}},n}),define("bui/editor/editor",["bui/common","bui/overlay","bui/editor/mixin"],function(e){var t=e("bui/common"),n=e("bui/overlay").Overlay;CLS_TIPS="x-editor-tips",Mixin=e("bui/editor/mixin");var r=n.extend([Mixin],{bindUI:function(){var e=this,t=e.getInnerControl();e.on("validchange",function(t){!e.isValid()&&e.get("visible")?e._showError(e.getErrors()):e._hideError()}),e.on("hide",function(){e._hideError()}),e.on("show",function(){e.isValid()||e._showError(e.getErrors())})},_initOverlay:function(){var e=this,t=e.get("tooltip"),r=new n(t);return r.render(),e.set("overlay",r),r},_getErrorList:function(){var e=this,t=e.get("overlay");return t&&t.get("children")[0]},_showError:function(e){var n=this,r=n.get("overlay")||n._initOverlay(),i=n._getErrorList(),s=n.get("errorAlign"),o=t.Array.map(e,function(e){return{error:e}});i.set("items",o),s.node=n.get("el"),r.set("align",s),r.show()},_hideError:function(){var e=this,t=e.get("overlay");t&&t.hide()},getSourceValue:function(){var e=this,t=e.get("curTrigger"),n=e.get("parser"),r=t.text();return n&&(r=n.call(this,r,t)),r},updateSource:function(e){var t=this,n=t.get("curTrigger");n&&n.length&&(e=t._formatText(e),n.text(e))},_formatText:function(e){var t=this,n=t.get("formatter");return n&&(e=n.call(t,e)),e},_uiSetWidth:function(e){var t=this;if(e!=null){var n=t.getInnerControl();n.set&&n.set("width",e)}}},{ATTRS:{innerValueField:{value:"value"},emptyValue:{value:""},autoHide:{value:!0},controlCfgField:{value:"field"},defaultChildCfg:{value:{tpl:"",forceFit:!0,errorTpl:""}},tooltip:{valueFn:function(){return{children:[{xclass:"simple-list",itemTpl:'<li><span class="x-icon x-icon-mini x-icon-error" title="{error}">!</span> <span>{error}</span></li>'}],elCls:CLS_TIPS}}},defaultChildClass:{value:"form-field"},align:{value:{points:["tl","tl"]}},parser:{},formatter:{},errorAlign:{value:{points:["bl","tl"],offset:[0,10]}},overlay:{},field:{value:{}}}},{xclass:"editor"});return r}),define("bui/editor/record",["bui/common","bui/editor/editor"],function(e){var t=e("bui/common"),n=e("bui/editor/editor"),r=n.extend({getSourceValue:function(){return this.get("record")},updateSource:function(e){var n=this,r=n.get("record");t.mix(r,e)},_uiSetRecord:function(e){this.setValue(e)}},{ATTRS:{innerValueField:{value:"record"},acceptEvent:{value:""},emptyValue:{value:{}},autoHide:{value:!1},record:{value:{}},controlCfgField:{value:"form"},form:{value:{}},errorAlign:{value:{points:["tr","tl"],offset:[10,0]}},defaultChildCfg:{valueFn:function(){var e=this;return{xclass:"form",errorTpl:"",showError:!0,showChildError:!0,defaultChildCfg:{elCls:"bui-inline-block",tpl:"",forceFit:!0},buttons:[{btnCls:"button button-primary",text:"\u786e\u5b9a",handler:function(){e.accept()}},{btnCls:"button",text:"\u53d6\u6d88",handler:function(){e.cancel()}}]}}}}},{xclass:"record-editor"});return r}),define("bui/editor/dialog",["bui/overlay","bui/editor/mixin"],function(e){var t=e("bui/overlay").Dialog,n=e("bui/editor/mixin"),r=t.extend([n],{getSourceValue:function(){return this.get("record")},handleNavEnter:function(e){var t=this,n=t.get("success"),r=e.target;if(r.tagName==="TEXTAREA")return;r.tagName==="BUTTON"&&$(r).trigger("click"),n?n.call(t):this.accept()},cancel:function(){this.fire("cancel"),this.clearValue(),this.close()},updateSource:function(e){var t=this,n=t.get("record");BUI.mix(n,e)},_uiSetRecord:function(e){this.setValue(e)}},{ATTRS:{innerValueField:{value:"record"},acceptEvent:{value:""},record:{value:{}},emptyValue:{shared:!1,value:{}},controlCfgField:{value:"form"},changeSourceEvent:{value:""},defaultChildCfg:{value:{xclass:"form-horizontal"}},focusable:{value:!1},success:{value:function(){this.accept()}},cancel:{value:function(){this.cancel()}},form:{value:{}}}},{xclass:"dialog-editor"});return r}),define("bui/grid",["bui/common","bui/grid/simplegrid","bui/grid/grid","bui/grid/column","bui/grid/header","bui/grid/format","bui/grid/plugins"],function(e){var t=e("bui/common"),n=t.namespace("Grid");return t.mix(n,{SimpleGrid:e("bui/grid/simplegrid"),Grid:e("bui/grid/grid"),Column:e("bui/grid/column"),Header:e("bui/grid/header"),Format:e("bui/grid/format"),Plugins:e("bui/grid/plugins")}),n}),define("bui/grid/simplegrid",["bui/common","bui/list"],function(e){var t=e("bui/common"),n=e("bui/list"),r=t.Component,i=r.UIBase,s=t.prefix,o=s+"grid",u=o+"-row",a=s+"grid-row-odd",f=s+"grid-row-even",l=s+"grid-border",c=s+"grid-row-first",h=n.SimpleListView.extend({setColumns:function(e){var n=this,r=n.get("headerRowEl");e=e||n.get("columns"),r.empty(),t.each(e,function(e){n._createColumn(e,r)})},_createColumn:function(e,n){var r=this,i=t.substitute(r.get("columnTpl"),e);$(i).appendTo(n)},getItemTpl:function(e,n){var r=this,i=r.get("columns"),s=r.get("rowTpl"),o=n%2===0?a:f,u=[],l;return t.each(i,function(t){var n=t.dataIndex;u.push(r._getCellTpl(t,n,e))}),s=t.substitute(s,{cellsTpl:u.join(""),oddCls:o}),s},_getCellTpl:function(e,n,r){var i=this,s=e.renderer,o=s?s(r[n],r):r[n],u=i.get("cellTpl");return t.substitute(u,{elCls:e.elCls,text:o})},clearData:function(){var e=this,t=e.get("itemContainer");t.empty()},showData:function(e){var n=this;t.each(e,function(e,t){n._createRow(e,t)})},_uiSetInnerBorder:function(e){var t=this,n=t.get("el");e?n.addClass(l):n.removeClass(l)},_uiSetTableCls:function(e){var t=this,n=t.get("el").find("table");n.attr("class",e)}},{ATTRS:{headerRowEl:{valueFn:function(){var e=this,t=e.get("el").find("thead");return t.children("tr")}},itemContainer:{valueFn:function(){return this.get("el").find("tbody")}},tableCls:{}}},{xclass:"simple-grid-veiw"}),p=t.List.SimpleList.extend({renderUI:function(){this.get("view").setColumns()},bindUI:function(){var e=this,t=e.get("itemCls"),n=t+"-hover",r=e.get("el");r.delegate("."+t,"mouseover",function(e){var t=$(e.currentTarget);t.addClass(n)}).delegate("."+t,"mouseout",function(e){var t=$(e.currentTarget);t.removeClass(n)})},showData:function(e){this.clearData(),this.set("items",e)},clearData:function(){this.get("view").clearData()},_uiSetColumns:function(e){var t=this;t.clearData(),t.get("view").setColumns(e)}},{ATTRS:{itemCls:{view:!0,value:u},tableCls:{view:!0,value:o+"-table"},columns:{view:!0,sync:!1,value:[]},tpl:{view:!0,value:'<table cellspacing="0" class="{tableCls}" cellpadding="0"><thead><tr></tr></thead><tbody></tbody></table>'},innerBorder:{view:!0,value:!0},rowTpl:{view:!0,value:'<tr class="'+u+' {oddCls}">{cellsTpl}</tr>'},cellTpl:{view:!0,value:'<td class="'+o+'-cell {elCls}"><div class="'+o+'-cell-inner"><span class="'+o+'-cell-text">{text}</span></div></td>'},columnTpl:{view:!0,value:'<th class="'+o+'-hd {elCls}" width="{width}"><div class="'+o+'-hd-inner"><span class="'+o+'-hd-title">{title}</span></div></th>'},events:{value:{}},xview:{value:h}}},{xclass:"simple-grid"});return p.View=h,p}),define("bui/grid/column",["bui/common"],function(e){var t=e("bui/common"),n=t.prefix,r=n+"grid-hd-title",i=n+"grid-hd-open",s="sort-",o="ASC",u="DESC",a=n+"grid-hd-menu-trigger",f="grid-hd-menu-trigger",l=t.Component.View.extend({setTplContent:function(e){var t=this,n=t.get("sortTpl"),i=t.get("triggerTpl"),s=t.get("el"),o;l.superclass.setTplContent.call(t,e),o=s.find("."+r),$(n).insertAfter(o),$(i).insertAfter(o)},_setContent:function(){this.setTplContent()},_uiSetShowMenu:function(e){var t=this,n=t.get("triggerTpl"),i=t.get("el"),s=i.find("."+r);e?$(n).insertAfter(s):i.find("."+a).remove()},_uiSetTitle:function(e){if(!this.get("rendered"))return;this._setContent()},_uiSetDraggable:function(e){if(!this.get("rendered"))return;this._setContent()},_uiSetSortable:function(e){if(!this.get("rendered"))return;this._setContent()},_uiSetTpl:function(e){if(!this.get("rendered"))return;this._setContent()},_uiSetSortState:function(e){var t=this,n=t.get("el"),r=e?"addClass":"removeClass",i=s+"asc",o=s+"desc";n.removeClass(i+" "+o),e==="ASC"?n.addClass(i):e==="DESC"&&n.addClass(o)},_uiSetOpen:function(e){var t=this,n=t.get("el");e?n.addClass(i):n.removeClass(i)}},{ATTRS:{sortTpl:{view:!0,getter:function(){var e=this,t=e.get("sortable");return t?'<span class="'+n+'grid-sort-icon"> </span>':""}},tpl:{}}}),c=t.Component.Controller.extend({_toggleSortState:function(){var e=this,t=e.get("sortState"),n=t?t===o?u:o:o;e.set("sortState",n)},performActionInternal:function(e){var t=this,n=$(e.target),r=t.get("prefixCls");n.hasClass(r+f)||t.get("sortable")&&t._toggleSortState()},_uiSetWidth:function(e){e&&this.set("originWidth",e)}},{ATTRS:{elTagName:{value:"th"},open:{view:!0,value:!1},dataIndex:{view:!0,value:""},draggable:{sync:!1,view:!0,value:!0},editor:{},focusable:{value:!1},fixed:{value:!1},id:{},renderer:{},resizable:{value:!0},sortable:{sync:!1,view:!0,value:!0},sortState:{view:!0,value:null},title:{sync:!1,view:!0,value:" "},width:{value:100},showMenu:{view:!0,value:!1},triggerTpl:{view:!0,value:'<span class="'+a+'"></span>'},tpl:{sync:!1,view:!0,value:'<div class="'+n+'grid-hd-inner">'+'<span class="'+r+'">{title}</span>'+"</div>"},cellTpl:{value:""},events:{value:{afterWidthChange:!0,afterSortStateChange:!0,afterVisibleChange:!0,click:!0,resize:!0,move:!0}},xview:{value:l}}},{xclass:"grid-hd",priority:1});return c.Empty=c.extend({},{ATTRS:{type:{value:"empty"},sortable:{view:!0,value:!1},width:{view:!0,value:null},tpl:{view:!0,value:'<div class="'+n+'grid-hd-inner"></div>'}}},{xclass:"grid-hd-empty",priority:1}),c}),define("bui/grid/header",["bui/common","bui/grid/column"],function(e){var t=e("bui/common"),n=t.prefix,r=t.namespace("Grid"),i=e("bui/grid/column"),s=t.Component.View,o=t.Component.Controller,u=17,a=t.UA,f=s.extend({getContentElement:function(){return this.get("el").find("tr")},scrollTo:function(e){var t=this,n=t.get("el");e.top!==undefined&&n.scrollTop(e.top),e.left!==undefined&&n.scrollLeft(e.left)},_uiSetTableCls:function(e){var t=this,n=t.get("el").find("table");n.attr("class",e)}},{ATTRS:{emptyCellEl:{},tableCls:{}}},{xclass:"header-view"}),l=o.extend({addColumn:function(e,t){var n=this,r=t,i=n.get("columns");return e=n._createColumn(e),t===undefined&&(t=i.length,r=n.get("children").length-1),i.splice(t,0,e),n.addChild(e,r),n.fire("add",{column:e,index:t}),e},removeColumn:function(e){var n=this,r=n.get("columns"),i;return e=t.isNumber(e)?r[e]:e,i=t.Array.indexOf(e,r),r.splice(i,1),n.fire("remove",{column:e,index:i}),n.removeChild(e,!0)},bindUI:function(){var e=this;e._bindColumnsEvent()},initializer:function(){var e=this,t=e.get("children"),n=e.get("columns"),r;$.each(n,function(r,i){var s=e._createColumn
(i);t[r]=s,n[r]=s}),r=e._createEmptyColumn(),t.push(r),e.set("emptyColumn",r)},getColumns:function(){return this.get("columns")},getColumnsWidth:function(){var e=this,t=e.getColumns(),n=0;return $.each(t,function(e,t){t.get("visible")&&(n+=t.get("el").outerWidth())}),n},getColumnOriginWidth:function(){var e=this,t=e.getColumns(),n=0;return $.each(t,function(e,t){if(t.get("visible")){var r=t.get("originWidth")||t.get("width");n+=r}}),n},getColumnByIndex:function(e){var t=this,n=t.getColumns(),r=n[e];return r},getColumn:function(e){var t=this,n=t.getColumns(),r=null;return $.each(n,function(t,n){if(e(n))return r=n,!1}),r},getColumnById:function(e){var t=this;return t.getColumn(function(t){return t.get("id")===e})},getColumnIndex:function(e){var n=this,r=n.getColumns();return t.Array.indexOf(e,r)},scrollTo:function(e){this.get("view").scrollTo(e)},_bindColumnsEvent:function(){var e=this;e.on("afterWidthChange",function(t){var n=t.target;n!==e&&e.setTableWidth()}),e.on("afterVisibleChange",function(t){var n=t.target;n!==e&&e.setTableWidth()}),e.on("afterSortStateChange",function(t){var n=t.target,r=e.getColumns(),i=t.newVal;i&&$.each(r,function(e,t){t!==n&&t.set("sortState","")})}),e.on("add",function(){e.setTableWidth()}),e.on("remove",function(){e.setTableWidth()})},_createColumn:function(e){return e instanceof i?e:(e.id||(e.id=t.guid("col")),new i(e))},_createEmptyColumn:function(){return new i.Empty},_isAllowScrollLeft:function(){var e=this,t=e.get("parent");return t&&!!t.get("height")},forceFitColumns:function(){function l(e,t){var n=e.get("el");e.set("width",t,{silent:1}),n.width(t)}var e=this,t=e.getColumns(),n=e.get("width"),r=n,i=e.getColumnOriginWidth(),s=0,o=0,a=null,f=e._isAllowScrollLeft();if(n){f&&(n-=u,r=n);var c=0;$.each(t,function(e,t){t.get("visible")&&t.get("resizable")&&c++;if(t.get("visible")&&!t.get("resizable")){var n=t.get("el").outerWidth();r-=n,i-=n}});var h=Math.floor(r/c),p=r/i;if(p===1)return;$.each(t,function(t,n){if(n.get("visible")&&n.get("resizable")){var r=e._getColumnBorderWith(n,t),i=n.get("originWidth");i||(n.set("originWidth",n.get("width")),i=n.get("width")),h=Math.floor((i+r)*p),l(n,h-r),s+=h,a=n}}),a&&(o=r-s,l(a,a.get("width")+o)),e.fire("forceFitWidth")}},_getColumnBorderWith:function(e,t){var n=e.get("el"),r=Math.round(parseFloat(n.css("border-left-width"))||0)+Math.round(parseFloat(n.css("border-right-width"))||0);return r=a.ie&&a.ie<8?t===0?1:r:r,r},setTableWidth:function(){var e=this,t=e.get("width"),n=0,r=null;if(t=="auto")return;e.get("forceFit")?e.forceFitColumns():e._isAllowScrollLeft()&&(n=e.getColumnsWidth(),r=e.get("emptyColumn"),t<n?r.get("el").width(u):r.get("el").width("auto"))},_uiSetWidth:function(){var e=this;e.setTableWidth()},_uiSetForceFit:function(e){var t=this;e&&t.setTableWidth()}},{ATTRS:{columns:{value:[]},emptyColumn:{},focusable:{value:!1},forceFit:{sync:!1,view:!0,value:!1},tpl:{view:!0,value:'<table cellspacing="0" class="'+n+'grid-table" cellpadding="0">'+"<thead><tr></tr></thead>"+"</table>"},tableCls:{view:!0},xview:{value:f},events:{value:{add:!1,remove:!1}}}},{xclass:"grid-header",priority:1});return l}),define("bui/grid/grid",["bui/common","bui/mask","bui/toolbar","bui/list","bui/grid/header","bui/grid/column"],function(e){function f(e){return t.isString(e)?e.indexOf("%")!==-1:!1}function P(e){var n=this;return t.isNumber(e)&&(e-=_),e}var t=e("bui/common"),n=e("bui/mask"),r=t.UA,i=t.Component,s=e("bui/toolbar"),o=e("bui/list"),u=e("bui/grid/header"),a=e("bui/grid/column"),l=t.prefix,c=l+"grid-header-container",h=l+"grid-body",p=l+"grid-width",d=l+"grid-height",v=l+"grid-border",m=l+"grid-tbar",g=l+"grid-bbar",y=l+"grid-button-bar",b=l+"grid-strip",w=l+"grid-row",E=l+"grid-row-odd",S=l+"grid-row-even",x=l+"grid-row-first",T=l+"grid-cell",N=l+"grid-cell-inner",C="grid-td-",k=l+"grid-cell-text",L=l+"grid-cell-empty",A="17",O=l+"hidden",M="data-column-field",_=2,D=1,H=o.SimpleListView.extend({renderUI:function(){var e=this,t=e.get("el"),n=t.find("."+h);e.set("bodyEl",n),e._setTableTpl()},getItemTpl:function(e,n){var r=this,i=r._getColumns(),s=r.get("tbodyEl"),o=r.get("rowTpl"),u=n%2===0?E:S,a=[],f;return t.each(i,function(t){var i=t.get("dataIndex");a.push(r._getCellTpl(t,i,e,n))}),r.get("useEmptyCell")&&a.push(r._getEmptyCellTpl()),o=t.substitute(o,{cellsTpl:a.join(""),oddCls:u}),o},findRow:function(e){var t=this;return $(t.findElement(e))},findCell:function(e,t){var n=C+e;return t.find("."+n)},resetHeaderRow:function(){if(!this.get("useHeaderRow"))return;var e=this,t=e.get("headerRowEl"),n=e.get("tbodyEl");t&&t.remove(),t=e._createHeaderRow(),t.prependTo(n),e.set("headerRowEl",t)},resetColumnsWidth:function(e,t){var n=this,r=n.get("headerRowEl"),i=n.findCell(e.get("id"),r);t=t||e.get("width"),i&&i.width(t),n.setTableWidth()},setTableWidth:function(e){if(!e&&f(this.get("width"))){this.get("tableEl").width("100%");return}var t=this,n=t._getInnerWidth(),i=t.get("height"),s=t.get("tableEl"),o=t.get("forceFit"),u=t.get("headerRowEl");if(!f(e)){e=e||t._getColumnsWidth();if(!n)return;if(n>=e){e=n;if(i){var a=r.ie==6||r.ie==7?A+2:A;e=n-a}}}s.width(e)},setBodyWidth:function(e){var t=this,n=t.get("bodyEl");e=e||t._getInnerWidth(),n.width(e)},setBodyHeight:function(e){var n=this,r=n.get("bodyEl"),i=e,s=r.siblings();t.each(s,function(e){$(e).css("display")!=="none"&&(i-=$(e).outerHeight())}),r.height(i)},setColumnVisible:function(e){var t=this,n=!e.get("visible"),r=e.get("id"),i=t.get("tbodyEl"),s=$("."+C+r,i);n?s.hide():s.show()},updateItem:function(e){var n=this,r=n.getItems(),i=t.Array.indexOf(e,r),s=n._getColumns(),o=null,u;if(i>=0)return o=n.findElement(e),t.each(s,function(t){var r=n.findCell(t.get("id"),$(o)),s=r.find("."+N),u=n._getCellText(t,e,i);s.html(u)}),o},showEmptyText:function(){var e=this,t=e.get("bodyEl"),n=e.get("emptyDataTpl"),r=e.get("emptyEl");r&&r.remove();var r=$(n).appendTo(t);e.set("emptyEl",r)},clearEmptyText:function(){var e=this,t=e.get("emptyEl");t&&t.remove()},_createHeaderRow:function(){var e=this,n=e._getColumns(),r=e.get("tbodyEl"),i=e.get("headerRowTpl"),s,o=[];return $.each(n,function(t,n){o.push(e._getHeaderCellTpl(n))}),e.get("useEmptyCell")&&o.push(e._getEmptyCellTpl()),i=t.substitute(i,{cellsTpl:o.join("")}),s=$(i).appendTo(r),s},_getColumnsWidth:function(){var e=this,n=e.get("columns"),r=0;return t.each(n,function(e){e.get("visible")&&(r+=e.get("el").outerWidth())}),r},_getColumns:function(){return this.get("columns")},_getCellText:function(e,n,r){var i=this,s=e.get("dataIndex"),o=e.get("cellTpl")||i.get("cellTextTpl"),u=i._getCellInnerText(e,s,n,r);return t.substitute(o,{text:u,tips:i._getTips(e,s,n)})},_getCellInnerText:function(e,t,n,r){try{var i=this,s=e.get("renderer"),o=s?s(n[t],n,r):n[t];return o==null?"":o}catch(u){throw"column:"+e.get("title")+" fomat error!"}},_getCellTpl:function(e,n,r,i){var s=this,o=s._getCellText(e,r,i),u=s.get("cellTpl");return t.substitute(u,{elCls:e.get("elCls"),id:e.get("id"),dataIndex:n,cellText:o,hideCls:e.get("visible")?"":O})},_getEmptyCellTpl:function(){return'<td class="'+T+" "+L+'"> </td>'},_getHeaderCellTpl:function(e){var n=this,r=n.get("headerCellTpl");return t.substitute(r,{id:e.get("id"),width:e.get("width"),hideCls:e.get("visible")?"":O})},_getInnerWidth:function(){return P(this.get("width"))},_getTips:function(e,n,r){var i=e.get("showTip"),s="";return i&&(s=r[n],t.isFunction(i)&&(s=i(s,r))),s},_uiSetInnerBorder:function(e){var t=this,n=t.get("el");e?n.addClass(v):n.removeClass(v)},_setTableTpl:function(e){var t=this,n=t.get("bodyEl");e=e||t.get("tableTpl"),$(e).appendTo(n);var r=n.find("table"),i=n.find("tbody");t.set("tableEl",r),t.set("tbodyEl",i),t.set("itemContainer",i),t._setTableCls(t.get("tableCls"))},_uiSetTableCls:function(e){this._setTableCls(e)},_uiSetHeight:function(e){var t=this,n=t.get("bodyEl");t.get("el").height(e),t.get("el").addClass(d)},_uiSetWidth:function(e){var t=this;t.get("el").width(e),t.setBodyWidth(t._getInnerWidth(e)),t.get("el").addClass(p)},_uiSetStripeRows:function(e){var t=this,n=e?"addClass":"removeClass";t.get("el")[n](b)},_setTableCls:function(e){var t=this,n=t.get("tableEl");n.attr("class",e)}},{ATTRS:{tableCls:{},bodyEl:{},tbodyEl:{},headerRowEl:{},tableEl:{},emptyEl:{}}},{xclass:"grid-view"}),B=o.SimpleList.extend({createDom:function(){var e=this,t=e.get("render"),n=$(t).width(),r=e.get("width");if(!r&&n){var i=e.getAppendWidth();e.set("width",n-i)}e.get("width")&&e.get("el").addClass(p),e.get("height")&&e.get("el").addClass(d),e.get("innerBorder")&&e.get("el").addClass(v)},renderUI:function(){var e=this;e._initHeader(),e._initBars(),e._initLoadMask(),e.get("view").resetHeaderRow()},bindUI:function(){var e=this;e._bindHeaderEvent(),e._bindBodyEvent(),e._bindItemsEvent()},addColumn:function(e,t){var n=this,r=n.get("header");return r?e=r.addColumn(e,t):(e=new a(e),n.get("columns").splice(t,0,e)),e},clearData:function(){this.clearItems()},getRecords:function(){return this.getItems()},findColumn:function(e){var n=this,r=n.get("header");return t.isNumber(e)?r.getColumnByIndex(e):r.getColumnById(e)},findColumnByField:function(e){var t=this,n=t.get("header");return n.getColumn(function(t){return t.get("dataIndex")===e})},findCell:function(e,t){var n=this,r=null;return t instanceof $?r=t:r=n.findRow(t),r?n.get("view").findCell(e,r):null},findRow:function(e){var t=this;return t.get("view").findRow(e)},removeColumn:function(e){var t=this;t.get("header").removeColumn(e)},showData:function(e){var t=this;t.set("items",e)},resetColumns:function(){var e=this,t=e.get("store");e.get("view").resetHeaderRow(),t&&e.onLoad()},_bindScrollEvent:function(){var e=this,t=e.get("el"),n=t.find("."+h),r=e.get("header");n.on("scroll",function(){var t=n.scrollLeft(),i=n.scrollTop();r.scrollTo({left:t,top:i}),e.fire("scroll",{scrollLeft:t,scrollTop:i,bodyWidth:n.width(),bodyHeight:n.height()})})},_bindHeaderEvent:function(){var e=this,t=e.get("header"),n=e.get("view"),r=e.get("store");t.on("afterWidthChange",function(e){var r=e.target;r!==t&&n.resetColumnsWidth(r)}),t.on("afterSortStateChange",function(e){var t=e.target,n=e.newVal;n&&r&&r.sort(t.get("dataIndex"),t.get("sortState"))}),t.on("afterVisibleChange",function(r){var i=r.target;i!==t&&(n.setColumnVisible(i),e.fire("columnvisiblechange",{column:i}))}),t.on("click",function(n){var r=n.target;r!==t&&e.fire("columnclick",{column:r,domTarget:n.domTarget})}),t.on("forceFitWidth",function(){e.get("rendered")&&e.resetColumns()}),t.on("add",function(t){e.get("rendered")&&(e.fire("columnadd",{column:t.column,index:t.index}),e.resetColumns())}),t.on("remove",function(t){e.get("rendered")&&(e.resetColumns(),e.fire("columnremoved",{column:t.column,index:t.index}))})},_bindBodyEvent:function(){var e=this;e._bindScrollEvent()},_bindItemsEvent:function(){function n(e){return{record:e.item,row:e.domTarget,domTarget:e.domTarget}}var e=this,t=e.get("store");e.on("itemsshow",function(){e.fire("aftershow")}),e.on("itemsclear",function(){e.fire("clear")}),e.on("itemclick",function(t){var n=t.domTarget,r=t.item,i=$(n).closest("."+T),s=$(n).closest("."+w),o;return i.length&&(o=e.fire("cellclick",{record:r,row:s[0],cell:i[0],field:i.attr(M),domTarget:n,domEvent:t.domEvent})),o===!1?o:e.fire("rowclick",{record:r,row:s[0],domTarget:n})}),e.on("itemunselected",function(t){e.fire("rowunselected",n(t))}),e.on("itemselected",function(t){e.fire("rowselected",n(t))}),e.on("itemrendered",function(t){e.fire("rowcreated",n(t))}),e.on("itemremoved",function(t){e.fire("rowremoved",n(t))}),e.on("itemupdated",function(t){e.fire("rowupdated",n(t))})},_getInnerWidth:function(e){return e=e||this.get("width"),P(e)},_initHeader:function(){var e=this,t=e.get("header"),n=e.get("el").find("."+c);t||(t=(new u({columns:e.get("columns"),tableCls:e.get("tableCls"),forceFit:e.get("forceFit"),width:e._getInnerWidth(),render:n,parent:e})).render(),e.set("header",t))},_initBars:function(){var e=this,t=e.get("bbar"),n=e.get("tbar");e._initBar(t,g,"bbar"),e._initBar(n,m,"tbar")},_initBar:function(e,n,r){var s=this,o=null,u=null;if(e){!e.xclass&&!(e instanceof i.Controller)&&(e.xclass="bar",e.children=e.children||[],e.items&&(e.children.push({xclass:"bar",defaultChildClass:"bar-item-button",elCls:y,children:e.items}),e.items=null),e.pagingBar&&(o=s.get("store"),u={xclass:"pagingbar",store:o,pageSize:o.pageSize},e.pagingBar!==!0&&(u=t.merge(u,e.pagingBar)),e.children.push(u)));if(e.xclass){var a=s.get("el").find("."+n);a.show(),e.render=a,e.elTagName="div",e.autoRender=!0,e=s.addChild(e)}s.set(r,e)}return e},_initLoadMask:function(){var e=this,n=e.get("loadMask");n&&!n.show&&(n=new t.Mask.LoadMask({el:e.get("el")}),e.set("loadMask",n))},_uiSetWidth:function(e){var t=this;t.get("rendered")&&(f(e)?t.get("header").set("width","100%"):t.get("header").set("width",t._getInnerWidth(e))),t.get("view").setTableWidth()},_uiSetForceFit:function(e){var t=this;t.get("header").set("forceFit",e)},_uiSetHeight:function(e,t){var n=this,r=n.get("header");n.get("view").setBodyHeight(e),n.get("rendered")&&(n.get("forceFit")&&!t.prevVal&&(r.forceFitColumns(),n.get("view").setTableWidth()),r.setTableWidth())},onLoad:function(){var e=this,t=e.get("store");B.superclass.onLoad.call(this),e.get("emptyDataTpl")&&(t&&t.getCount()==0?e.get("view").showEmptyText():e.get("view").clearEmptyText())}},{ATTRS:{header:{},bbar:{},itemCls:{value:w},columns:{view:!0,value:[]},forceFit:{sync:!1,view:!0,value:!1},emptyDataTpl:{view:!0},headerRowTpl:{view:!0,value:'<tr class="'+l+'grid-header-row">{cellsTpl}</tr>'},headerCellTpl:{view:!0,value:'<td class="{hideCls} '+C+'{id}" width="{width}" style="height:0"></td>'},rowTpl:{view:!0,value:'<tr class="'+w+' {oddCls}">{cellsTpl}</tr>'},cellTpl:{view:!0,value:'<td class="{elCls} {hideCls} '+T+" "+C+'{id}" data-column-id="{id}" data-column-field = "{dataIndex}" >'+'<div class="'+N+'" >{cellText}</div>'+"</td>"},cellTextTpl:{view:!0,value:'<span class="'+k+' " title = "{tips}">{text}</span>'},events:{value:{aftershow:!1,clear:!1,cellclick:!1,columnclick:!1,rowclick:!1,rowcreated:!1,rowremoved:!1,rowselected:!1,rowunselected:!1,scroll:!1}},stripeRows:{view:!0,value:!0},tbar:{},tableCls:{view:!0,sync:!1,value:l+"grid-table"},tableTpl:{view:!0,value:'<table cellspacing="0" cellpadding="0" ><tbody></tbody></table>'},tpl:{value:'<div class="'+m+'" style="display:none"></div><div class="'+c+'"></div><div class="'+h+'"></div><div style="display:none" class="'+g+'"></div>'},innerBorder:{sync:!1,value:!0},useEmptyCell:{view:!0,value:!0},useHeaderRow:{view:!0,value:!0},xview:{value:H}}},{xclass:"grid"});return B.View=H,B}),define("bui/grid/format",function(e){function t(e){return e<10?"0"+e:e}var n={dateRenderer:function(e){if(!e)return"";if(BUI.isString(e))return e;var n=null;try{n=new Date(e)}catch(r){return""}return!n||!n.getFullYear?"":n.getFullYear()+"-"+t(n.getMonth()+1)+"-"+t(n.getDate())},datetimeRenderer:function(e){if(!e)return"";if(BUI.isString(e))return e;var n=null;try{n=new Date(e)}catch(r){return""}return!n||!n.getFullYear?"":n.getFullYear()+"-"+t(n.getMonth()+1)+"-"+t(n.getDate())+" "+t(n.getHours())+":"+t(n.getMinutes())+":"+t(n.getSeconds())},cutTextRenderer:function(e){return function(t){return t=t||"",t.toString().length>e?t.toString().substring(0,e)+"...":t}},enumRenderer:function(e){return function(t){return e[t]||""}},multipleItemsRenderer:function(e){var t=n.enumRenderer(e);return function(e){var n=[];return e?(BUI.isArray(e)||(e=e.toString().split(",")),$.each(e,function(e,r){n.push(t(r))}),n.join(",")):""}},moneyCentRenderer:function(e){return BUI.isString(e)&&(e=parseFloat(e)),$.isNumberic(e)?(e*.01).toFixed(2):e}};return n}),function(){var e="bui/grid/plugins/";define("bui/grid/plugins",["bui/common",e+"selection",e+"cascade",e+"cellediting",e+"rowediting",e+"autofit",e+"dialogediting",e+"menu",e+"summary",e+"rownumber",e+"columngroup",e+"rowgroup",e+"columnresize"],function(t){var n=t("bui/common"),r=t(e+"selection"),i={};return n.mix(i,{CheckSelection:r.CheckSelection,RadioSelection:r.RadioSelection,Cascade:t(e+"cascade"),CellEditing:t(e+"cellediting"),RowEditing:t(e+"rowediting"),DialogEditing:t(e+"dialogediting"),AutoFit:t(e+"autofit"),GridMenu:t(e+"menu"),Summary:t(e+"summary"),RowNumber:t(e+"rownumber"),ColumnGroup:t(e+"columngroup"),RowGroup:t(e+"rowgroup"),ColumnResize:t(e+"columnresize")}),i})}(),define("bui/grid/plugins/autofit",["bui/common"],function(e){var t=e("bui/common"),n=t.UA,r=function(e){r.superclass.constructor.call(this,e)};return t.extend(r,t.Base),r.ATTRS={},t.augment(r,{bindUI:function(e){var t=this,n;$(window).on("resize",function(){function r(){clearTimeout(n),n=setTimeout(function(){t._autoFit(e)},100),t.set("handler",n)}r()})},_autoFit:function(e){var t=this,n=$(e.get("render")),r=$(window).width(),i,s=0,o=e.get("el").parent();while(o[0]&&o[0]!=$("body")[0])s+=o.outerWidth()-o.width(),o=o.parent();e.set("width",r-s)}}),r}),define("bui/grid/plugins/menu",["bui/common","bui/menu"],function(e){var t=e("bui/common"),n=e("bui/menu"),r=t.prefix,i="sort-asc",s="sort-desc",o="column-setting",u="icon-check",a=function(e){a.superclass.constructor.call(this,e)};return t.extend(a,t.Base),a.ATTRS={menu:{},activedColumn:{},triggerCls:{value:r+"grid-hd-menu-trigger"},items:{value:[{id:i,text:"\u5347\u5e8f",iconCls:"icon-arrow-up"},{id:s,text:"\u964d\u5e8f",iconCls:"icon-arrow-down"},{xclass:"menu-item-sparator"},{id:o,text:"\u8bbe\u7f6e\u5217",iconCls:"icon-list-alt"}]}},t.augment(a,{initializer:function(e){var t=this;t.set("grid",e)},renderUI:function(e){var n=this,r=e.get("columns");t.each(r,function(e){n._addShowMenu(e)})},bindUI:function(e){var t=this;e.on("columnadd",function(e){t._addShowMenu(e.column)}),e.on("columnclick",function(e){var n=$(e.domTarget),r=e.column,i;t.set("activedColumn",r),n.hasClass(t.get("triggerCls"))&&(i=t.get("menu")||t._initMenu(),i.set("align",{node:n,points:["bl","tl"],offset:[0,0]}),i.show(),t._afterShow(r,i))})},_addShowMenu:function(e){e.get("fixed")||e.set("showMenu",!0)},_afterShow:function(e,t){var n=this,r=n.get("grid");t=t||n.get("menu"),n._resetSortMenuItems(e,t),n._resetColumnsVisible(t)},_resetColumnsVisible:function(e){var t=this,n=e.findItemById(o),r=n.get("subMenu")||t._initColumnsMenu(n),i=t.get("grid").get("columns");r.removeChildren(!0),$.each(i,function(e,t){if(!t.get("fixed")){var n={xclass:"context-menu-item",text:t.get("title"),column:t,iconCls:"icon"},i=r.addChild(n);t.get("visible")&&i.set("selected",!0)}})},_resetSortMenuItems:function(e,t){var n=t.findItemById(i),r=t.findItemById(s);e.get("sortable")?(n.set("disabled",!1),r.set("disabled",!1)):(n.set("disabled",!0),r.set("disabled",!0))},_initMenu:function(){var e=this,t=e.get("menu"),r;return t||(r=e.get("items"),$.each(r,function(e,t){t.xclass||(t.xclass="context-menu-item")}),t=new n.ContextMenu({children:r,elCls:"grid-menu"}),e._initMenuEvent(t),e.set("menu",t)),t},_initMenuEvent:function(e){var t=this;e.on("itemclick",function(e){var n=e.item,r=n.get("id"),o=t.get("activedColumn");r===i?o.set("sortState","ASC"):r===s&&o.set("sortState","DESC")}),e.on("afterVisibleChange",function(e){var n=e.newVal,r=t.get("activedColumn");n&&r?r.set("open",!0):r.set("open",!1)})},_initColumnsMenu:function(e){var t=new n.ContextMenu({multipleSelect:!0,elCls:"grid-column-menu"});return e.set("subMenu",t),t.on("itemclick",function(e){var t=e.item,n=t.get("column"),r=t.get("selected");r?n.set("visible",!0):n.set("visible",!1)}),t},destructor:function(){var e=this,t=e.get("menu");t&&t.destroy(),e.off(),e.clearAttrVals()}}),a}),define("bui/grid/plugins/cascade",["bui/common"],function(e){var t=e("bui/common"),n=t.prefix,r="",i="data-record",s=n+"grid-cascade",o=s+"-expand",u=s+"-row",a=s+"-cell",f=s+"-collapse",l=function(e){l.superclass.constructor.call(this,e)};return t.extend(l,t.Base),l.ATTRS={width:{value:40},cellInner:{value:'<span class="'+s+'"><i class="'+s+'-icon"></i></span>'},rowTpl:{value:'<tr class="'+u+'"><td class="'+a+'"></td></tr>'},renderer:{},events:["expand","collapse","removed"]},t.augment(l,{initializer:function(e){var t=this,n={title:"",elCls:"center",width:t.get("width"),resizable:!1,fixed:!0,sortable:!1,cellTpl:t.get("cellInner")},r=e.addColumn(n,0);e.set("innerBorder",!1),t.set("grid",e)},bindUI:function(e){var t=this;e.on("cellclick",function(e){var n=$(e.domTarget),r=n.closest("."+s);r.length&&(r.hasClass(o)?t._onCollapse(e.record,e.row,r):t._onExpand(e.record,e.row,r))}),e.on("columnvisiblechange",function(){t._resetColspan()}),e.on("rowremoved",function(e){t.remove(e.record)}),e.on("clear",function(){t.removeAll()})},expandAll:function(){var e=this,t=e.get("grid"),n=t.getRecords();$.each(n,function(t,n){e.expand(n)})},expand:function(e){var t=this,n=t.get("grid"),r=n.findRow(e);r&&t._onExpand(e,r)},collapse:function(e){var t=this,n=t.get("grid"),r=n.findRow(e);r&&t._onCollapse(e,r)},removeAll:function(){var e=this,t=e._getAllCascadeRows();t.each(function(t,n){e._removeCascadeRow(n)})},remove:function(e){var t=this,n=t._findCascadeRow(e);n&&t._removeCascadeRow(n)},collapseAll:function(){var e=this,t=e.get("grid"),n=t.getRecords();$.each(n,function(t,n){e.collapse(n)})},_getRowRecord:function(e){return $(e).data(i)},_removeCascadeRow:function(e){this.fire("removed",{record:$(e).data(i),row:e}),$(e).remove()},_findCascadeRow:function(e){var t=this,n=t._getAllCascadeRows(),r=null;return $.each(n,function(n,i){if(t._getRowRecord(i)===e)return r=i,!1}),r},_getAllCascadeRows:function(){var e=this,t=e.get("grid");return t.get("el").find("."+u)},_getCascadeRow:function(e){var t=$(e).next();return t.hasClass(u)?t:null},_getRowContent:function(e){var t=this,n=t.get("renderer"),r=n?n(e):"";return r},_createCascadeRow:function(e,t){var n=this,r=n.get("rowTpl"),s=n._getRowContent(e),o=$(r).insertAfter(t);return o.find("."+a).append($(s)),o.data(i,e),o},_onExpand:function(e,t,n){var r=this,i=r._getCascadeRow(t),u=r._getColumnCount(t);n=n||$(t).find("."+s),n.addClass(o);if(!i||!i.length)i=r._createCascadeRow(e,t);$(i).removeClass(f),r._setColSpan(i,t),r.fire("expand",{record:e,row:i[0]})},_onCollapse:function(e,t,n){var r=this,i=r._getCascadeRow(t);n=n||$(t).find("."+s),n.removeClass(o);if(i||!i.length)$(i).addClass(f),r.fire("collapse",{record:e,row:i[0]})},_getColumnCount:function(e){return $(e).children().filter(function(){return $(this).css("display")!=="none"}).length},_setColSpan:function(e,t){t=t||$(e).prev();var n=this,r=n._getColumnCount(t);$(e).find("."+a).attr("colspan",r)},_resetColspan:function(){var e=this,t=e._getAllCascadeRows();$.each(t,function(t,n){e._setColSpan(n)})},destructor:function(){var e=this;e.removeAll(),e.off(),e.clearAttrVals()}}),l}),define("bui/grid/plugins/selection",["bui/common"],function(e){function o(e){o.superclass.constructor.call(this,e)}var t=e("bui/common"),n=t.prefix,r=n+"grid-checkBox",i="x-grid-checkbox",s=n+"grid-radio";t.extend(o,t.Base),o.ATTRS={width:{value:40},column:{},cellInner:{value:'<div class="'+r+'-container"><span class="'+i+'"></span></div>'}},t.augment(o,{createDom:function(e){var t=this,r={title:"",width:t.get("width"),fixed:!0,resizable:!1,sortable:!1,tpl:'<div class="'+n+'grid-hd-inner">'+t.get("cellInner")+"",cellTpl:t.get("cellInner")},i=e.addColumn(r,0);e.set("multipleSelect",!0),t.set("column",i)},bindUI:function(e){var t=this,n=t.get("column"),r=n.get("el"),s=r.find("."+i);s.on("click",function(){var t=r.hasClass("checked");t?(e.clearSelection(),r.removeClass("checked")):(e.setAllSelection(),r.addClass("checked"))}),e.on("rowunselected",function(e){r.removeClass("checked")}),e.on("clear",function(){r.removeClass("checked")})}});var u=function(e){u.superclass.constructor.call(this,e)};t.extend(u,t.Base),u.ATTRS={width:{value:40},column:{},cellInner:{value:'<div class="'+n+'grid-radio-container"><input class="'+s+'" type="radio"></div>'}},t.augment(u,{createDom:function(e){var t=this,n={title:"",width:t.get("width"),resizable:!1,fixed:!0,sortable:!1,cellTpl:t.get("cellInner")},r=e.addColumn(n,0);e.set("multipleSelect",!1),t.set("column",r)},bindUI:function(e){var t=this;e.on("rowselected",function(e){t._setRowChecked(e.row,!0)}),e.on("rowunselected",function(e){t._setRowChecked(e.row,!1)})},_setRowChecked:function(e,t){var n=$(e),r=n.find("."+s);r.attr("checked",t)}});var a={CheckSelection:o,RadioSelection:u};return a}),define("bui/grid/plugins/summary",["bui/common"],function(e){function l(e){return e>0?'<td class="'+f+'" colspan="'+e+'"> </td>':""}function c(e,t){return'<td class="'+f+" "+u+t+'">'+h(e)+"</td>"}function h(e){return'<div class="'+o+'" >'+'<span class="'+a+' ">'+e+"</span>"+"</div>"}function p(){return'<td class="'+f+" "+f+'-empty"> </td>'}var t=e("bui/common"),n=t.prefix,r=n+"grid-row",i=n+"grid-body",s=n+"grid-summary-row",o=n+"grid-cell-inner",u="grid-td-",a=n+"grid-cell-text",f=n+"grid-cell",d=function(e){d.superclass.constructor.call(this,e)};return d.ATTRS={footerTpl:{value:"<tfoot></tfoot>"},footerEl:{},summaryTitle:{value:"\u67e5\u8be2\u5408\u8ba1"},pageSummaryTitle:{value:"\u672c\u9875\u5408\u8ba1"},field:{value:"summary"},pageSummaryField:{value:"pageSummary"},summaryField:{value:"summary"},pageSummary:{},summary:{}},t.extend(d,t.Base),t.augment(d,{initializer:function(e){var t=this;t.set("grid",e)},renderUI:function(e){var t=this,n=e.get("el").find("."+i),r=n.find("table"),s=$(t.get("footerTpl")).appendTo(r);t.set("footerEl",s)},bindUI:function(e){var t=this,n=e.get("store");n&&(n.on("beforeprocessload",function(e){t._processSummary(e.data)}),n.on("add",function(){t.resetPageSummary()}),n.on("remove",function(){t.resetPageSummary()}),n.on("update",function(){t.resetPageSummary()})),e.on("aftershow",function(){t.resetSummary()}),e.get("header").on("afterVisibleChange",function(){t.resetSummary()})},_processSummary:function(e){var t=this,n=t.get("footerEl");n.empty();if(!e)return;var r=e[t.get("pageSummaryField")],i=e[t.get("summaryField")];t.set("pageSummary",r),t.set("summary",i)},resetPageSummary:function(){var e=this,n=e.get("grid"),r=n.get("columns"),i=e._calculatePageSummary(),s=e.get("pageEl");e.set("pageSummary",i),s&&(t.each(r,function(t){if(t.get("summary")&&t.get("visible")){var n=t.get("id"),r=s.find("."+u+n),o=e._getSummaryCellText(t,i);r.find("."+a).text(o)}}),e._updateFirstRow(s,e.get("pageSummaryTitle")))},resetSummary:function(e,t){var n=this,r=n.get("footerEl"),i=null;r.empty(),e=e||n.get("pageSummary"),e||(e=n._calculatePageSummary(),n.set("pageSummary",e)),t=t||n.get("summary"),i=n._creatSummaryRow(e,n.get("pageSummaryTitle")),n.set("pageEl",i),n._creatSummaryRow(t,n.get("summaryTitle"))},_creatSummaryRow:function(e,t){if(!e)return null;var n=this,r=n.get("footerEl"),i=n._getSummaryTpl(e),s=$(i).appendTo(r);return n._updateFirstRow(s,t),s},_updateFirstRow:function(e,t){var n=e.find("td").first(),r=n.find("."+o);if(r.length){var i=t+": ";text=r.text(),text.indexOf(i)===-1&&(text=i+text),n.html(h(text))}else n.html(h(t+":"))},_getSummaryTpl:function(e){var t=this,n=t.get("grid"),i=n.get("columns"),o=[],u=-1,a=-1,f=null;return $.each(i,function(n,r){if(r.get("visible")){a+=1;if(r.get("summary")){o.push(l(a-u-1));var i=t._getSummaryCellText(r,e),s=c(i,r.get("id"));o.push(s),u=a}}}),u!==a&&o.push(l(a-u)),f=['<tr class="',s," ",r,'">',o.join(""),p(),"</tr>"].join(""),f},_getSummaryCellText:function(e,t){var n=this,r=t[e.get("dataIndex")],i=r==null?"":r,s=e.get("renderer"),o=s?s(i,t):i;return o},_calculatePageSummary:function(){var e=this,n=e.get("grid"),r=n.get("store"),i=n.get("columns"),s={};return t.each(i,function(e){if(e.get("summary")){var t=e.get("dataIndex");s[t]=r.sum(t)}}),s}}),d}),define("bui/grid/plugins/editing",function(e){function r(e){r.superclass.constructor.call(this,e)}var t=BUI.prefix+"grid-cell-inner",n=BUI.prefix+"grid-cell-error";return BUI.extend(r,BUI.Base),r.ATTRS={align:{value:{points:["cl","cl"]}},showError:{value:!0},errorTpl:{value:'<span class="x-icon '+n+' x-icon-mini x-icon-error" title="{error}">!</span>'},isInitEditors:{value:!1},record:{},curEditor:{},hasValid:{},editors:{shared:!1,value:[]},triggerCls:{},triggerSelected:{value:!0}},BUI.augment(r,{initializer:function(e){var t=this;t.set("grid",e),t.initEditing(e)},renderUI:function(){var e=this,t=e.get("grid");BUI.use("bui/editor",function(n){e.initEditors(n),e._initGridEvent(t),e.set("isInitEditors",!0),e.fire("editorready")})},initEditing:function(e){},_getCurEditor:function(){return this.get("curEditor")},_initGridEvent:function(e){function r(e,n){t.get("hasValid")&&t.validRecord(e,t.getFields(),$(n))}var t=this,n=e.get("header");e.on("cellclick",function(e){var n=null,r=e.domTarget,i=t.get("triggerCls"),s=t._getCurEditor();s&&s.get("acceptEvent")?(s.accept(),s.hide()):s&&s.cancel(),n=t.getEditor(e.field);if(n&&$(r).closest("."+i).length){t.showEditor(n,e);if(!t.get("triggerSelected"))return!1}}),e.on("rowcreated",function(e){r(e.record,e.row)}),e.on("rowremoved",function(e){t.get("record")==e.record&&t.cancel()}),e.on("rowupdated",function(e){r(e.record,e.row)}),e.on("scroll",function(e){var n=t._getCurEditor();if(n){var r=n.get("align"),i=r.node,s=i.position();s.top<0||s.top>e.bodyHeight?n.hide():(n.set("align",r),n.show())}}),n.on("afterVisibleChange",function(e){if(e.target&&e.target!=n){var r=e.target;t.onColumnVisibleChange(r)}})},initEditors:function(e){var t=this,n=t.get("grid"),r=[],i=n.get("columns");BUI.each(i,function(e){var n=t.getFieldConfig(e);n&&(n.name=e.get("dataIndex"),n.validator&&(n.validator=t.wrapValidator(n.validator)),r.push(n))});var s=t.getEditorCfgs(r);BUI.each(s,function(n){t.initEidtor(n,e)})},getFieldConfig:function(e){return e.get("editor")},wrapValidator:function(e){var t=this;return function(n){var r=t.get("record");return e(n,r)}},onColumnVisibleChange:function(e){},getEditorCfgs:function(e){},getEditorConstructor:function(e){return e.Editor},initEidtor:function(e,t){var n=this,r=n.getEditorConstructor(t),i=new r(e);return i.render(),n.get("editors").push(i),n.bindEidtor(i),i},bindEidtor:function(e){var t=this,n=t.get("grid"),r=n.get("store");e.on("accept",function(){var n=t.get("record");t.updateRecord(r,n,e),t.fire("accept",{editor:e,record:n}),t.set("curEditor",null)}),e.on("cancel",function(){t.fire("cancel",{editor:e,record:t.get("record")}),t.set("curEditor",null)})},getEditor:function(e){},getAlignNode:function(e){},getEditValue:function(e){},showEditor:function(e,t){var n=this,r=n.getEditValue(t),i=n.getAlignNode(t);n.beforeShowEditor(e,t),n.set("record",t.record),n.fire("beforeeditorshow",{editor:e,record:t.record}),e.setValue(r);if(i){var s=n.get("align");s.node=i,e.set("align",s)}e.show(),n.focusEditor(e,t.field),n.set("curEditor",e),n.fire("editorshow",{editor:e,record:t.record})},focusEditor:function(e,t){e.focus()},beforeShowEditor:function(e,t){},_createEditOptions:function(e,t){var n=this,r=n.get("grid"),i=r.findRow(e),s=r.findColumnByField(t),o=r.findCell(s.get("id"),i);return{record:e,field:t,cell:o[0],row:i[0]}},valid:function(){var e=this,t=e.get("grid"),n=t.get("store");if(n){var r=n.getResult();BUI.each(r,function(t){e.validRecord(t,e.getFields())})}e.set("hasValid",!0)},isValid:function(){var e=this,t=e.get("grid");return e.get("hasValid")||e.valid(),!t.get("el").find("."+n).length},clearErrors:function(){var e=this,t=e.get("grid");t.get("el").find("."+n).remove()},getFields:function(e){},validRecord:function(e,t,n){var r=this,i=[];r.setInternal("record",e),t=t||r.getFields(),BUI.each(t,function(t){var n=t.get("name"),r=e[n]||"",s=t.getValidError(r);s&&i.push({name:n,error:s,id:t.get("id")})}),r.showRecordError(e,i,n)},showRecordError:function(e,t,n){var r=this,i=r.get("grid");n=n||i.findRow(e),n&&(r._clearRowError(n),BUI.each(t,function(e){var t=i.findCell(e.id,n);r._showCellError(t,e.error)}))},updateRecord:function(e,t,n){},_clearRowError:function(e){e.find("."+n).remove()},_showCellError:function(e,n){var r=this,i=BUI.substitute(r.get("errorTpl"),{error:n}),s=e.find("."+t);$(i).appendTo(s)},edit:function(e,t){var n=this,r=n._createEditOptions(e,t),i=n.getEditor(t);n.showEditor(i,r)},cancel:function(){var e=this,t=e.get("editors");BUI.each(t,function(e){e.get("visible")&&e.cancel()}),e.set("curEditor",null),e.set("record",null)},destructor:function(){var e=this,t=e.get("editors");BUI.each(t,function(e){e.destroy&&e.destroy()}),e.off(),e.clearAttrVals()}}),r}),define("bui/grid/plugins/cellediting",["bui/grid/plugins/editing"],function(e){var t=e("bui/grid/plugins/editing"),n=BUI.prefix+"grid-body",r=BUI.prefix+"grid-cell",i=function(e){i.superclass.constructor.call(this,e)};return i.ATTRS={triggerCls:{value:r}},BUI.extend(i,t),BUI.augment(i,{getEditorCfgs:function(e){var t=this,r=t.get("grid"),i=r.get("el").find("."+n),s=[];return BUI.each(e,function(e){var t={field:e,changeSourceEvent:null,hideExceptNode:i,autoUpdate:!1,preventHide:!1,editableFn:e.editableFn};e.xtype==="checkbox"&&(t.innerValueField="checked"),s.push(t)}),s},getEditor:function(e)
{if(!e)return null;var t=this,n=t.get("editors"),r=null;return BUI.each(n,function(t){if(t.get("field").get("name")===e)return r=t,!1}),r},beforeShowEditor:function(e,t){var n=this,r=$(t.cell);n.resetWidth(e,r.outerWidth()),n._makeEnable(e,t)},_makeEnable:function(e,t){var n=e.get("editableFn"),r,i,s;BUI.isFunction(n)&&(r=t.field,s=t.record,s&&r&&(i=n(s[r],s),i?e.get("field").enable():e.get("field").disable()))},resetWidth:function(e,t){e.set("width",t)},updateRecord:function(e,t,n){var r=this,i=n.getValue(),s=n.get("field").get("name"),o=t[s];i=BUI.isDate(i)?i.getTime():i,o!==i&&e.setValue(t,s,i)},getAlignNode:function(e){return $(e.cell)},getFields:function(){var e=[],t=this,n=t.get("editors");return BUI.each(n,function(t){e.push(t.get("field"))}),e},getEditValue:function(e){if(e.record&&e.field){var t=e.record[e.field];return t==null?"":t}return""}}),i}),define("bui/grid/plugins/rowediting",["bui/common","bui/grid/plugins/editing"],function(e){var t=e("bui/common"),n=e("bui/grid/plugins/editing"),r=t.prefix+"grid-row",i=function(e){i.superclass.constructor.call(this,e)};return i.ATTRS={autoSave:{value:!1},align:{value:{points:["tl","tl"],offset:[-2,0]}},triggerCls:{value:r},editor:{}},t.extend(i,n),t.augment(i,{getEditorCfgs:function(e){var n=this,r=n.get("editor"),i=[],s=t.mix(!0,{changeSourceEvent:null,autoUpdate:!1,form:{children:e,buttonBar:{elCls:"centered toolbar"}}},r);return i.push(s),i},wrapValidator:function(e){var t=this;return function(n){var r=t.get("curEditor"),i=t.get("record"),s=r?r.getValue():i;if(s)return e(n,s,i)}},focusEditor:function(e,t){var n=e.get("form"),r=n.getField(t);r&&r.focus()},getFieldConfig:function(e){var t=e.get("editor");if(t)return t.xtype==="checkbox"&&(t.innerValueField="checked"),t;var n={xtype:"plain"};return e.get("dataIndex")&&e.get("renderer")&&(n.renderer=e.get("renderer")),n},updateRecord:function(e,n,r){var i=this,s=r.getValue();t.each(s,function(e,n){t.isDate(e)&&(s[n]=e.getTime())}),t.mix(n,s),e.update(n),i.get("autoSave")&&e.save(n)},getEditor:function(e){var t=this,n=t.get("editors");return n[0]},onColumnVisibleChange:function(e){var t=this,n=e.get("id"),r=t.getEditor(),i=r.getChild(n,!0);i&&i.set("visible",e.get("visible"))},beforeShowEditor:function(e,n){var r=this,i=r.get("grid"),s=i.get("columns"),o=e.get("form"),u=$(n.row);e.set("width",u.width()),t.each(s,function(e){var t=e.get("dataIndex"),n=o.getField(t);if(!e.get("visible"))n&&n.set("visible",!1);else{var r=e.get("el").outerWidth()-n.getAppendWidth();n.set("width",r)}})},getEditValue:function(e){return e.record},getEditorConstructor:function(e){return e.RecordEditor},getAlignNode:function(e){return $(e.row)},getFields:function(){var e=this,t=e.get("editors");return t[0].get("form").get("children")}}),i}),define("bui/grid/plugins/dialogediting",["bui/common"],function(e){function i(e){i.superclass.constructor.call(this,e)}var t=e("bui/common"),n="add",r="edit";return i.ATTRS={autoSave:{value:!1},record:{},curIndex:{},contentId:{},editor:{},form:{},events:{value:{recordchange:!1}},editType:{}},t.extend(i,t.Base),t.augment(i,{initializer:function(e){var n=this;n.set("grid",e),t.use("bui/editor",function(e){n._initEditor(e),n.fire("editorready")})},bindUI:function(e){var t=this,n=t.get("triggerCls");n&&e.on("cellclick",function(r){var i=$(r.domTarget),s=t.get("editor");if(i.hasClass(n)&&s){t.edit(r.record);if(e.get("multipleSelect"))return!1}})},_initEditor:function(e){var n=this,r=n.get("contentId"),i=$("#"+r).find("form"),s=n.get("editor"),o=t.merge(s,{contentId:r,form:{srcNode:i}});s=new e.DialogEditor(o),n._bindEditor(s),n.set("editor",s),n.set("form",s.get("form"))},_bindEditor:function(e){var t=this;e.on("accept",function(){var n=e.get("form"),r=n.serializeToObject();t.saveRecord(r),t.fire("accept",{editor:e,record:t.get("record"),form:n})}),e.on("cancel",function(){t.fire("cancel",{editor:e,record:t.get("record"),form:e.get("form")})})},edit:function(e){var t=this;t.set("editType",r),t.showEditor(e)},add:function(e,t){var r=this;r.set("editType",n),r.set("curIndex",t),r.showEditor(e)},saveRecord:function(e){var r=this,i=r.get("grid"),s=r.get("editType"),o=r.get("curIndex"),u=i.get("store"),a=r.get("record");t.mix(a,e),s==n?o!=null?u.addAt(a,o):u.add(a):u.update(a),r.get("autoSave")&&u.save(a)},showEditor:function(e){var t=this,n=t.get("editor");t.set("record",e),n.show(),n.setValue(e,!0),t.fire("recordchange",{record:e,editType:t.get("editType")}),t.fire("editorshow",{eidtor:n,editType:t.get("editType")})},cancel:function(){var e=this,t=e.get("editor");t.cancel()},destructor:function(){var e=this,t=e.get("editor");t&&t.destroy(),e.off(),e.clearAttrVals()}}),i}),define("bui/grid/plugins/rownumber",function(e){function n(e){n.superclass.constructor.call(this,e)}var t="x-grid-rownumber";return BUI.extend(n,BUI.Base),n.ATTRS={width:{value:40},column:{}},BUI.augment(n,{createDom:function(e){var n=this,r={title:"",width:n.get("width"),fixed:!0,resizable:!1,sortable:!1,renderer:function(e,t,n){return n+1},elCls:t},i=e.addColumn(r,0);n.set("column",i)}}),n}),define("bui/grid/plugins/columngroup",["bui/common"],function(e){var t=e("bui/common"),n=t.prefix,r=n+"grid-hd-title",i=n+"grid-column-group",s=n+"grid-group-header",o=n+"grid-db-hd",u=function(e){u.superclass.constructor.call(this,e)};return u.ATTRS={groups:{value:[]},columnTpl:{value:'<th class="bui-grid-hd center" colspan="{colspan}"><div class="'+n+'grid-hd-inner">'+'<span class="'+r+'">{title}</span>'+"</div></th>"}},t.extend(u,t.Base),t.augment(u,{renderUI:function(e){var n=this,r=n.get("groups"),u=e.get("header"),a=u.get("el"),f=u.get("children"),l=$('<tr class="'+i+'"></tr>').prependTo(a.find("thead"));a.addClass(s),t.each(r,function(e){var t=n._getGroupTpl(e),r=$(t).appendTo(l);e.el=r;for(var i=e.from;i<=e.to;i++){var s=f[i];s&&s.set("group",e)}});var c;for(var h=f.length-1;h>=0;h--){var p=f[h],d=p.get("group");if(d)c=d.el;else{var v=p.get("el");v.addClass(o),v.attr("rowspan",2),c?v.insertBefore(c):v.appendTo(l),c=v}}if(r[0].from!==0){var m=f[r[0].from];m&&m.get("el").css("border-left-width",1)}},_getGroupTpl:function(e){var n=this,r=n.get("columnTpl"),i=e.to-e.from+1;return t.substitute(r,{colspan:i,title:e.title})}}),u}),define("bui/grid/plugins/rowgroup",["bui/common"],function(e){function u(e,t){return{items:[],value:e,text:t}}var t=e("bui/common"),n="data-group",r=t.prefix,i=r+"grid-row-group",s=r+"grid-cascade",o=r+"grid-cascade-expand",a=function(e){a.superclass.constructor.call(this,e)};return a.ATTRS={groups:{shared:!1,value:[]},renderer:{}},t.extend(a,t.Base),t.augment(a,{renderUI:function(e){var t=this,n=e.get("el").find("tbody");t.set("grid",e),t.set("tbodyEl",n)},bindUI:function(e){var n=this,r=[];e.on("aftershow",function(){var i=e.getItems(),s=n._getSortColumn();n._clear();if(s){e.get("view").getAllElements().hide();var o=s.get("dataIndex");t.each(i,function(e,t){var i=r[r.length-1],a=s.get("renderer"),f=e[o],l;if(!i||f!=i.value){l=a?a(f,e):f;var c=u(f,l);c.begin=t,r.push(c),i&&n._createGroup(i),i=c}i.items.push(e)});var a=r[r.length-1];a&&n._createGroup(a),n.set("groups",r)}}),e.on("clear",function(){n._clear()}),n.get("tbodyEl").delegate("."+s,"click",function(e){var t=$(e.currentTarget),r=n._getGroupData(t);t.hasClass(o)?(n._collapse(r),t.removeClass(o)):(n._expand(r),t.addClass(o))})},_getSortColumn:function(){var e=this,t=e.get("grid"),n=t.get("store"),r=n.get("sortField");return t.findColumnByField(r)},_getGroupData:function(e){var t=this,r=e.closest("."+i);return r.data(n)},_createGroup:function(e){var t=this,r=t.get("grid"),s=e.items[0],o=r.findElement(s),u=r.get("columns").length,a=t.get("renderer"),f=a?a(e.text,e):e.text,l='<tr class="'+i+'"><td colspan="'+(u+1)+'"><div class="bui-grid-cell-inner"><span class="bui-grid-cell-text"><span class="bui-grid-cascade"><i class="bui-grid-cascade-icon"></i></span> '+f+"</span></div></td></tr>",c=$(l).insertBefore(o);c.data(n,e)},_getGroupedElements:function(e){var t=this,n=t.get("grid"),r=n.get("view").getAllElements(),i=e.begin,s=e.items.length+i,o=[];for(var u=i;u<s;u++)o.push(r[u]);return $(o)},_expand:function(e){var t=this,n=t._getGroupedElements(e);n.show()},_collapse:function(e){var t=this,n=t._getGroupedElements(e);n.hide()},_clear:function(){var e=this,n=e.get("groups"),r=e.get("tbodyEl");t.Array.empty(n),r.find("."+i).remove()}}),a}),define("bui/grid/plugins/columnresize",function(e){var t=e("bui/common"),n=15,r=30,i="col-resize",s=function(e){s.superclass.constructor.call(this,e)};return s.ATTRS={resizing:{value:!1},draging:{}},t.extend(s,t.Base),t.augment(s,{renderUI:function(e){this.set("grid",e)},bindUI:function(e){function f(n){var r=t.get("draging");if(o&&r){var i=a>0?o:u,s=i.get("width"),l=r.end-r.start;t.hideDrag();if(e.get("forceFit")){var c=i.get("originWidth"),h=s/c,p=(s+l)/h;i.set("originWidth",p),i.set("width",p)}else i.set("width",s+l)}$(document).off("mouseup",f)}function l(){$(document).on("mouseup",f)}var t=this,s=e.get("header"),o,u,a;s.get("el").delegate(".bui-grid-hd","mouseenter",function(e){var n=t.get("resizing");if(!n){var r=e.currentTarget;o=t._getColumn(r),u=t._getPreCol(o)}}).delegate(".bui-grid-hd","mouseleave",function(e){var n=t.get("resizing");!n&&o&&(o.get("el").css("cursor",""),o=null)}).delegate(".bui-grid-hd","mousemove",function(s){var f=t.get("resizing");if(!f&&o){var l=o.get("el"),c=s.pageX,h=l.offset(),p=h.left,d=l.width();c-p<n&&u?(l.css("cursor",i),a=-1):p+d-c<n?(a=1,l.css("cursor",i)):o.get("el").css("cursor","")}if(f){s.preventDefault();var v=t.get("draging"),m=v.start,c=s.pageX,g=c-m,d=a>0?o.get("width"):u.get("width"),y=d+g;y>r&&y<e.get("el").width()&&(v.end=c,t.moveDrag(c))}}).delegate(".bui-grid-hd","mousedown",function(e){var n=t.get("resizing");!n&&o&&o.get("el").css("cursor")==i&&(e.preventDefault(),t.showDrag(e.pageX),l())})},showDrag:function(e){var t=this,n=t.get("grid"),r=n.get("header"),i=n.get("el").find(".bui-grid-body"),s=r.get("el").height()+i.height(),o=r.get("el").offset(),u=t.get("dragEl");if(!u){var a='<div class="bui-drag-line"></div>';u=$(a).appendTo("body"),t.set("dragEl",u)}u.css({top:o.top,left:e,height:s}),t.set("resizing",!0),t.set("draging",{start:e,end:e}),u.show()},hideDrag:function(){var e=this,t=e.get("dragEl");t&&t.hide(),e.set("draging",null),e.set("resizing",!1)},moveDrag:function(e){var t=this,n=t.get("dragEl");n&&n.css("left",e)},_getColumn:function(e){var n=this,r=n.get("grid").get("columns"),i=null;return t.each(r,function(t){if(t.containsElement(e))return i=t,!1}),i},_getPreCol:function(e){var n=this,r=n.get("grid").get("columns"),i=null;return t.each(r,function(t,n){if(t==e)return!1;t.get("visible")&&(i=t)}),i}}),s}),define("bui/tree",["bui/common","bui/tree/treemixin","bui/tree/treelist","bui/tree/treemenu"],function(e){var t=e("bui/common"),n=t.namespace("Tree");return t.mix(n,{TreeList:e("bui/tree/treelist"),Mixin:e("bui/tree/treemixin"),TreeMenu:e("bui/tree/treemenu")}),n}),define("bui/tree/treemixin",["bui/common","bui/data"],function(e){function t(e,t){return r.isString(t)&&(t=e.findNode(t)),t}function n(e,t,n){setTimeout(function(){e()},t/n)}var r=e("bui/common"),i=e("bui/data"),s="expanded",o="loading",u="checked",a="partial-checked",f={NONE:"none",ALL:"all",CUSTOM:"custom",ONLY_LEAF:"onlyLeaf"},l="x-tree-icon",c="x-tree-elbow",h="x-tree-show-line",p=c+"-",d=l+"-wraper",v=p+"line",m=p+"end",g=p+"empty",y=p+"expander",b=l+"-checkbox",w=l+"-radio",E=y+"-end",S=function(){};return S.ATTRS={store:{getter:function(e){if(!e){var t=this,n=new i.TreeStore({root:t.get("root"),data:t.get("nodes")});return t.setInternal("store",n),n}return e}},root:{},nodes:{sync:!1},iconContainer:{},iconWraperTpl:{value:'<span class="'+d+'">{icons}</span>'},showLine:{value:!1},showIcons:{value:!0},iconTpl:{value:'<span class="x-tree-icon {cls}"></span>'},leafCls:{value:p+"leaf"},dirCls:{value:p+"dir"},checkType:{value:"custom"},cascadeCheckd:{value:!0},accordion:{value:!1},multipleCheck:{value:!0},checkedField:{valueFn:function(){return this.getStatusField("checked")}},checkableField:{value:"checkable"},itemStatusFields:{value:{expanded:"expanded",disabled:"disabled",checked:"checked"}},dirSelectable:{value:!0},showRoot:{value:!1},events:{value:{expanded:!1,collapsed:!1,checkedchange:!1}},expandEvent:{value:"itemdblclick"},expandAnimate:{value:!1},collapseEvent:{value:"itemdblclick"},startLevel:{value:1}},r.augment(S,{collapseAll:function(){var e=this,t=e.get("view").getAllElements();r.each(t,function(t){var n=e.getItemByElement(t);n&&e._collapseNode(n,t,!0)})},collapseNode:function(e){var t=this,n;r.isString(e)&&(e=t.findNode(e));if(!e)return;n=t.findElement(e),t._collapseNode(e,n)},expandAll:function(){var e=this,t=e.get("view").getAllElements();r.each(t,function(t){var n=e.getItemByElement(t);e._expandNode(n,t,!0)})},expandNode:function(e,t){var n=this,i;r.isString(e)&&(e=n.findNode(e));if(!e)return;e.parent&&!n.isExpanded(e.parent)&&n.expandNode(e.parent),i=n.findElement(e),n._expandNode(e,i,t)},expandPath:function(e,t,n){if(!e)return;n=n||0;var r=this,i=r.get("store"),s,o,u,a,f=e.split(",");s=r.findNode(f[n]);for(u=n+1;u<f.length;u++){a=f[u],o=r.findNode(a,s);if(s&&o)r.expandNode(s),s=o;else if(s&&t){i.load({id:s.id},function(){o=r.findNode(a,s),o&&r.expandPath(e,t,u)});break}}},findNode:function(e,t){return this.get("store").findNode(e,t)},getCheckedLeaf:function(e){var t=this,n=t.get("store");return n.findNodesBy(function(e){return e.leaf&&t.isChecked(e)},e)},getCheckedNodes:function(e){var t=this,n=t.get("store");return n.findNodesBy(function(e){return t.isChecked(e)},e)},isItemSelectable:function(e){var t=this,n=t.get("dirSelectable"),r=e;return r&&!n&&!r.leaf?!1:!0},isExpanded:function(e){if(!e||e.leaf)return!1;var t=this,n;return t._isRoot(e)&&!t.get("showRoot")?!0:(r.isString(e)&&(item=t.getItem(e)),n=t.findElement(e),this._isExpanded(e,n))},isChecked:function(e){return e?!!e[this.get("checkedField")]:!1},toggleExpand:function(e){var t=this,n;r.isString(e)&&(item=t.getItem(e)),n=t.findElement(e),t._toggleExpand(e,n)},setNodeChecked:function(e,n,i){i=i==null?!0:i;if(!e)return;var s=this,o,a=s.get("multipleCheck"),f=s.get("cascadeCheckd"),l;e=t(this,e);if(!e)return;o=e.parent;if(!s.isCheckable(e))return;if(s.isChecked(e)!==n||s.hasStatus(e,"checked")!==n){l=s.findElement(e),f?(l?(s.setItemStatus(e,u,n,l),a?s._resetPatialChecked(e,n,n,l):n&&o&&s.isChecked(o)!=n&&s.setNodeChecked(o,n,!1)):s.isItemDisabled(e)||s.setStatusValue(e,u,n),o&&(s.isChecked(o)!=n?s._resetParentChecked(o):a&&s._resetPatialChecked(o,null,null,null,!0))):s.isItemDisabled(e)||(l?s.setItemStatus(e,u,n,l):s.setStatusValue(e,u,n));if(n&&!a&&(s.isChecked(o)||o==s.get("root")||!f)){var c=o.children;r.each(c,function(t){t!==e&&s.isChecked(t)&&s.setNodeChecked(t,!1)})}s.fire("checkedchange",{node:e,element:l,checked:n})}!e.leaf&&i&&f&&r.each(e.children,function(e,t){(a||!n||!a&&t==0)&&s.setNodeChecked(e,n,i)})},setChecked:function(e){this.setNodeChecked(e,!0)},clearAllChecked:function(){var e=this,t=e.getCheckedNodes();r.each(t,function(t){e.setNodeChecked(t,!1)})},_initRoot:function(){var e=this,t=e.get("store"),n,i=e.get("showRoot"),s;t&&(n=t.get("root"),e.setInternal("root",n),i?s=[n]:s=n.children,r.each(s,function(t){e._initChecked(t,!0)}),e.clearItems(),e.addItems(s))},_initChecked:function(e,t){var n=this,i=n.get("checkType"),s=n.get("checkedField"),o=n.get("multipleCheck"),u=n.get("checkableField"),a=n.get("cascadeCheckd"),l;if(i===f.NONE){e[u]=!1,e[s]=!1;return}if(i===f.ONLY_LEAF){e.leaf?e[u]=!0:(e[u]=!1,e[s]=!1,t&&r.each(e.children,function(e){n._initChecked(e,t)}));return}i===f.CUSTOM&&e[u]==null&&(e[u]=e[s]!=null),i===f.ALL&&(e[u]=!0);if(!e||!n.isCheckable(e))return;l=e.parent,!n.isChecked(e)&&a&&(l&&n.isChecked(l)&&(o||!n._hasChildChecked(l))&&n.setStatusValue(e,"checked",!0),(e.children&&e.children.length&&n._isAllChildrenChecked(e)||!o&&n._hasChildChecked(e))&&n.setStatusValue(e,"checked",!0)),t&&r.each(e.children,function(e){n._initChecked(e,t)})},_resetPatialChecked:function(e,t,n,r,i){if(!e||e.leaf)return!0;var s=this,n;t=t==null?s.isChecked(e):t;if(t){s.setItemStatus(e,a,!1,r);return}n=n==null?s._hasChildChecked(e):n,s.setItemStatus(e,a,n,r),i&&e.parent&&s._resetPatialChecked(e.parent,!1,n?n:null,null,i)},_resetParentChecked:function(e){if(!this.isCheckable(e))return;var t=this,n=t.get("multipleCheck"),r=n?t._isAllChildrenChecked(e):t._hasChildChecked(e);t.setStatusValue(e,"checked",r),t.setNodeChecked(e,r,!1),n&&t._resetPatialChecked(e,r,null,null,!0)},__bindUI:function(){var e=this,t=e.get("el"),n=e.get("multipleCheck");e.on("itemclick",function(t){var n=$(t.domTarget),r=t.element,i=t.item;if(n.hasClass(y))return e._toggleExpand(i,r),!1;if(n.hasClass(b)){var s=e.isChecked(i);e.setNodeChecked(i,!s)}else n.hasClass(w)&&e.setNodeChecked(i,!0)}),e.on("itemrendered",function(t){var r=t.item,i=t.domTarget;e._resetIcons(r,i),e.isCheckable(r)&&n&&e.get("cascadeCheckd")&&e._resetPatialChecked(r,null,null,i),e._isExpanded(r,i)&&e._showChildren(r)}),e._initExpandEvent()},_initExpandEvent:function(){function i(t){return function(n){var r=$(n.domTarget),i=n.element,s=n.item;r.hasClass(y)||e[t](s,i)}}var e=this,t=e.get("el"),n=e.get("expandEvent"),r=e.get("collapseEvent");n==r?e.on(n,i("_toggleExpand")):(n&&e.on(n,i("_expandNode")),r&&e.on(r,i("_collapseNode")))},_isForceChecked:function(e){var t=this,n=t.get("multipleCheck");return n?t._isAllChildrenChecked():_isForceChecked()},_isAllChildrenChecked:function(e){if(!e||e.leaf)return!1;var t=this,n=e.children,i=!0;return r.each(n,function(e){i=i&&t.isChecked(e);if(!i)return!1}),i},_hasChildChecked:function(e){if(!e||e.leaf)return!1;var t=this;return t.getCheckedNodes(e).length!=0},_isRoot:function(e){var t=this,n=t.get("store");return n&&n.get("root")==e?!0:!1},_setLoadStatus:function(e,t,n){var r=this;r.setItemStatus(e,o,n,t)},_beforeLoadNode:function(e){var t=this,n;r.isString(e)&&(e=t.findNode(e)),n=t.findElement(e),n?(t._collapseNode(e,n),t._setLoadStatus(e,n,!0)):e&&r.each(e.children,function(e){t._removeNode(e)})},onBeforeLoad:function(e){var t=this,n=e.params,r=n.id,i=t.findNode(r)||t.get("root");t._beforeLoadNode(i)},_addNode:function(e,t){var n=this,r=e.parent,i,s,o,u;n._initChecked(e,!0),r?(n.isExpanded(r)&&(i=r.children.length,u=n._getInsetIndex(e),n.addItemAt(e,u),t==i-1&&t>0&&(s=r.children[t-1],n._updateIcons(s))),n._updateIcons(r)):(u=n._getInsetIndex(e),n.addItemAt(e,u),s=n.get("nodes")[t-1],n._updateIcons(s))},_getInsetIndex:function(e){var t=this,n,r=null;return n=t._getNextItem(e),n?t.indexOfItem(n):t.getItemCount()},_getNextItem:function(e){var t=this,n=e.parent,i,s,o=null;return n?(i=n.children,s=r.Array.indexOf(e,i),o=i[s+1],o||t._getNextItem(n)):null},onAdd:function(e){var t=this,n=e.node,r=e.index;t._addNode(n,r)},_updateNode:function(e){var t=this;t.updateItem(e),t._updateIcons(e)},onUpdate:function(e){var t=this,n=e.node;t._updateNode(n)},_removeNode:function(e,t){var n=this,r=e.parent,i,s;n.collapseNode(e);if(!r)return;n.removeItem(e),n.isExpanded(r)&&(i=r.children.length,i==t&&t!==0&&(s=r.children[t-1],n._updateIcons(s))),n._updateIcons(r),n._resetParentChecked(r)},onRemove:function(e){var t=this,n=e.node,r=e.index;t._removeNode(n,r)},_loadNode:function(e){var t=this;t._initChecked(e,!0),t.expandNode(e),t._updateIcons(e),t.setItemStatus(e,o,!1)},__syncUI:function(){var e=this,t=e.get("store"),n=e.get("showRoot");n&&!t.hasData()&&e._initRoot()},onLoad:function(e){var t=this,n=t.get("store"),r=n.get("root"),i;(!e||e.node==r)&&t._initRoot(),e&&e.node&&t._loadNode(e.node)},_isExpanded:function(e,t){return this.hasStatus(e,s,t)},_getIconsTpl:function(e){var t=this,n=e.level,i=t.get("startLevel"),s=t.get("iconWraperTpl"),o=[],u;for(u=i;u<n;u+=1)o.push(t._getLevelIcon(e,u));return o.push(t._getExpandIcon(e)),o.push(t._getCheckedIcon(e)),o.push(t._getNodeTypeIcon(e)),r.substitute(s,{icons:o.join("")})},_getCheckedIcon:function(e){var t=this,n=t.isCheckable(e),r;return n?(r=t.get("multipleCheck")?b:w,t._getIcon(r)):""},isCheckable:function(e){return e[this.get("checkableField")]},_getExpandIcon:function(e){var t=this,n=y;return e.leaf?t._getLevelIcon(e):(t._isLastNode(e)&&(n=n+" "+E),t._getIcon(n))},_getNodeTypeIcon:function(e){var t=this,n=e.cls?e.cls:e.leaf?t.get("leafCls"):t.get("dirCls");return t._getIcon(n)},_getLevelIcon:function(e,t){var n=this,r=n.get("showLine"),i=g,s;return r&&(e.level===t||t==null?i=n._isLastNode(e)?m:c:(s=n._getParentNode(e,t),i=n._isLastNode(s)?g:v)),n._getIcon(i)},_getParentNode:function(e,t){var n=e.level,r=e.parent,i=n-1;if(n<=t)return null;while(i>t)r=r.parent,i-=1;return r},_getIcon:function(e){var t=this,n=t.get("iconTpl");return r.substitute(n,{cls:e})},_isLastNode:function(e){if(!e)return!1;if(e==this.get("root"))return!0;var t=this,n=e.parent,r=n?n.children:t.get("nodes"),i;return i=r.length,r[i-1]===e},_initNodes:function(e,t,n){var i=this;r.each(e,function(e){e.level=t,e.leaf==null&&(e.leaf=e.children?!1:!0),n&&!e.parent&&(e.parent=n),i._initChecked(e),e.children&&i._initNodes(e.children,t+1,e)})},_collapseNode:function(e,t,n){var r=this;if(e.leaf)return;r.hasStatus(e,s,t)&&(r.setItemStatus(e,s,!1,t),n?(r._collapseChildren(e,n),r.removeItems(e.children)):r._hideChildrenNodes(e),r.fire("collapsed",{node:e,element:t}))},_hideChildrenNodes:function(e){var t=this,n=e.children,i=[];r.each(n,function(e){var n=t.findElement(e);n&&(i.push(n),t._hideChildrenNodes(e))}),t.get("expandAnimate")?(i=$(i),i.animate({height:0},function(){t.removeItems(n)})):t.removeItems(n)},_collapseChildren:function(e,t){var n=this,i=e.children;r.each(i,function(e){n.collapseNode(e,t)})},_expandNode:function(e,t,n){var i=this,o=i.get("accordion"),u=i.get("store");if(e.leaf)return;if(!i.hasStatus(e,s,t)){if(o&&e.parent){var a=e.parent.children;r.each(a,function(t){t!=e&&i.collapseNode(t)})}u&&!u.isLoaded(e)?i._isLoading(e,t)||u.loadNode(e):t&&(i.setItemStatus(e,s,!0,t),i._showChildren(e),i.fire("expanded",{node:e,element:t}))}r.each(e.children,function(e){(n||i.isExpanded(e))&&i.expandNode(e,n)})},_showChildren:function(e){if(!e||!e.children)return;var t=this,n=t.indexOfItem(e),r=e.children.length,i,s=r-1,o=[];for(s=r-1;s>=0;s--)i=e.children[s],t.getItem(i)||(t.get("expandAnimate")?(el=t._addNodeAt(i,n+1),el.hide(),el.slideDown()):t.addItemAt(i,n+1))},_addNodeAt:function(e,t){var n=this,r=n.get("items");return t===undefined&&(t=r.length),r.splice(t,0,e),n.addItemToView(e,t)},_isLoading:function(e,t){var n=this;return n.hasStatus(e,o,t)},_resetIcons:function(e,t){if(!this.get("showIcons"))return;var n=this,r=n.get("iconContainer"),i,s=n._getIconsTpl(e);$(t).find("."+d).remove(),i=$(t).find(r).first(),r&&i.length?$(s).prependTo(i):$(t).prepend($(s))},_toggleExpand:function(e,t){var n=this;n._isExpanded(e,t)?n._collapseNode(e,t):n._expandNode(e,t)},_updateIcons:function(e){var t=this,n=t.findElement(e);n&&(t._resetIcons(e,n),t._isExpanded(e,n)&&!e.leaf&&r.each(e.children,function(e){t._updateIcons(e)}))},_uiSetShowRoot:function(e){var t=this,n=this.get("showRoot")?0:1;t.set("startLevel",n)},_uiSetNodes:function(e){var t=this,n=t.get("store");n.setResult(e)},_uiSetShowLine:function(e){var t=this,n=t.get("el");e?n.addClass(h):n.removeClass(h)}}),S}),define("bui/tree/selection",["bui/list"],function(e){var t=e("bui/common"),n=e("bui/list").SimpleList,r=function(){};return r.ATTRS={},t.augment(r,{getSelection:function(){var e=this,t=e.getStatusField("selected"),r;return t?(r=e.get("store"),r.findNodesBy(function(e){return e[t]})):n.prototype.getSelection.call(this)},getSelected:function(){var e=this,t=e.getStatusField("selected"),r;return t?(r=e.get("store"),r.findNodeBy(function(e){return e[t]})):n.prototype.getSelected.call(this)}}),r}),define("bui/tree/treelist",["bui/common","bui/list","bui/tree/treemixin","bui/tree/selection"],function(e){var t=e("bui/common"),n=e("bui/list"),r=e("bui/tree/treemixin"),i=e("bui/tree/selection"),s=n.SimpleList.extend([r,i],{},{ATTRS:{itemCls:{value:t.prefix+"tree-item"},itemTpl:{value:"<li>{text}</li>"},idField:{value:"id"}}},{xclass:"tree-list"});return s}),define("bui/tree/treemenu",["bui/common","bui/list","bui/tree/treemixin","bui/tree/selection"],function(e){var t=e("bui/common"),n=e("bui/list"),r=e("bui/tree/treemixin"),i=e("bui/tree/selection"),s=n.SimpleList.View.extend({getItemTpl:function(e,n){var r=this,i=r.get("itemTplRender"),s=e.leaf?r.get("leafTpl"):r.get("dirTpl");return i?i(e,n):t.substitute(s,e)}},{xclass:"tree-menu-view"}),o=n.SimpleList.extend([r,i],{},{ATTRS:{itemCls:{value:t.prefix+"tree-item"},dirSelectable:{value:!1},expandEvent:{value:"itemclick"},itemStatusFields:{value:{selected:"selected"}},collapseEvent:{value:"itemclick"},xview:{value:s},dirTpl:{view:!0,value:'<li class="{cls}"><a href="#">{text}</a></li>'},leafTpl:{view:!0,value:'<li class="{cls}"><a href="{href}">{text}</a></li>'},idField:{value:"id"}}},{xclass:"tree-menu"});return o.View=s,o}),define("bui/tooltip",["bui/common","bui/tooltip/tip","bui/tooltip/tips"],function(e){var t=e("bui/common"),n=t.namespace("Tooltip"),r=e("bui/tooltip/tip"),i=e("bui/tooltip/tips");return t.mix(n,{Tip:r,Tips:i}),n}),define("bui/tooltip/tip",["bui/common","bui/overlay"],function(e){function s(e,t){if(e==="left")return[-1*t,-4];if(e==="right")return[t,-4];if(e.indexOf("top"))return[0,t];if(e.indexOf("bottom"))return[0,-1*t]}var t=e("bui/common"),n=e("bui/overlay"),r="x-align-",i={left:["cl","cr"],right:["cr","cl"],top:["tc","bc"],bottom:["bc","tc"],"top-left":["tl","bl"],"top-right":["tr","br"],"bottom-left":["bl","tl"],"bottom-right":["br","tr"]},o=n.OverlayView.extend({renderUI:function(){},_getTitleContainer:function(){return this.get("el")},_uiSetTitle:function(e){var n=this,r=n.get("titleTpl"),i=n._getTitleContainer(),s=n.get("titleEl"),o;s&&s.remove(),e=e||"",t.isString(e)&&(e={title:e}),o=t.substitute(r,e),s=$(o).appendTo(i),n.set("titleEl",s)},_uiSetAlignType:function(e,t){var n=this;t&&t.prevVal&&n.get("el").removeClass(r+t.prevVal),e&&n.get("el").addClass(r+e)}},{ATTRS:{title:{},titleEl:{},alignType:{}}},{xclass:"tooltip-view"}),u=n.Overlay.extend({_uiSetAlignType:function(e){var t=this,n=t.get("offset"),r=t.get("align")||{},o=i[e];o&&(r.points=o,n&&(r.offset=s(e,n)),t.set("align",r))}},{ATTRS:{delegateTrigger:{value:!0},alignType:{view:!0},title:{view:!0},showArrow:{value:!0},arrowContainer:{view:!0},autoHide:{value:!0},autoHideType:{value:"leave"},offset:{value:0},triggerEvent:{value:"mouseover"},titleTpl:{view:!0,value:"<span>{title}</span>"},xview:{value:o}}},{xclass:"tooltip"});return u.View=o,u}),define("bui/tooltip/tips",["bui/common","bui/tooltip/tip"],function(e){function t(e){return/^{.*}$/.test(e)}var n=e("bui/common"),r=e("bui/tooltip/tip"),i=function(e){i.superclass.constructor.call(this,e)};return i.ATTRS={tip:{},defaultAlignType:{}},n.extend(i,n.Base),n.augment(i,{_init:function(){this._initDom(),this._initEvent()},_initDom:function(){var e=this,t=e.get("tip"),n;t&&!t.isController&&(n=t.alignType,t=new r(t),t.render(),e.set("tip",t),n&&e.set("defaultAlignType",n))},_initEvent:function(){var e=this,t=e.get("tip");t.on("triggerchange",function(n){var r=n.curTrigger;e._replaceTitle(r),e._setTitle(r,t)})},_replaceTitle:function(e){var t=e.attr("title");t&&(e.attr("data-title",t),e[0].removeAttribute("title"))},_setTitle:function(e,r){var i=this,s=e.attr("data-title"),o=e.attr("data-align")||i.get("defaultAlignType");t(s)&&(s=n.JSON.looseParse(s)),r.set("title",s),o&&r.set("alignType",o)},render:function(){return this._init(),this}}),i}),function(){if(BUI.loaderScript.getAttribute("data-auto-use")=="false")return;BUI.use(["bui/common","bui/data","bui/list","bui/picker","bui/menu","bui/toolbar","bui/progressbar","bui/cookie","bui/form","bui/mask","bui/select","bui/tab","bui/calendar","bui/overlay","bui/editor","bui/grid","bui/tree","bui/tooltip"])}();
|
/**
* @license
* Copyright 2014 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
CLASS({
package: 'foam.ui',
name: 'BooleanView',
extends: 'foam.ui.SimpleView',
properties: [
{
name: 'data'
},
{
name: 'name',
label: 'Name',
type: 'String',
defaultValue: 'field'
}
],
methods: {
toHTML: function() {
return '<input type="checkbox" id="' + this.id + '" ' + ( this.data ? 'checked ' : '' ) + 'name="' + this.name + '"' + this.cssClassAttr() + '/>';
},
initHTML: function() {
this.domValue = DomValue.create(this.$, 'change', 'checked');
this.$.addEventListener('click', this.onClick);
Events.link(this.data$, this.domValue);
},
destroy: function(isParentDestroyed) {
this.SUPER(isParentDestroyed);
Events.unlink(this.domValue, this.data$);
}
},
listeners: [
{
name: 'onClick',
code: function(e) { e.stopPropagation(); }
}
]
});
|
/**
* @author Swagatam Mitra
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, document, console, brackets, $, Mustache */
define(function (require, exports, module) {
"use strict";
var AppInit = brackets.getModule("utils/AppInit");
var FileUtils = brackets.getModule("file/FileUtils");
var RuleSetCreator = require("stylemodule/RuleSetCreator");
var RuleSetFinder = require("stylemodule/RuleSetFinder");
var CSSProperties = require("text!propertysheet/CSSProperties.json"),
properties = JSON.parse(CSSProperties);
var inCaptureMode = false;
var $hLayer1,
$hLayer2,
$vLayer1,
$vLayer2,
$xOffsetAxisGrid,
$yOffsetAxisGrid;
var PropTemplate = "<button id='{{id}}' class='topcoat-button' style='float:left;'>{{name}}</button>";
var ChangeSetEntryTemplate = "<div id='{{id}}' style='float:left;width:99%;'><span style='float:left;width:40%;margin-top:4px;'>{{name}}</span><input class='topcoat-text-input changeset-value' style='float:left;width:50% !important' value='{{value}}' data-key='{{name}}'></div>";
var simulationSelectorName = null;
var proprtyNames = [];
var capturedDef = {};
var ruleName;
for (ruleName in properties) {
if (properties.hasOwnProperty(ruleName)) {
proprtyNames.push(ruleName);
}
}
var canvas,context;
var lastSelectedRuleset = null;
$(document).on("click","#transition-toolbox-anchor",function(event){
$("#transition-editor").show();
_valueToBeizerCurveControls("0.250, 0.100, 0.250, 1.000");
event.preventDefault();
event.stopPropagation();
});
$(document).on("click","#transition-editor-close",function(event){
$("#transition-editor").hide();
event.preventDefault();
event.stopPropagation();
});
$(document).on("ruleset-wrapper.created ruleset-wrapper.refreshed","#html-design-editor",function(event,rulesetref){
var asynchPromise = new $.Deferred();
lastSelectedRuleset = rulesetref;
asynchPromise.resolve();
return asynchPromise.promise();
});
$(document).on("focus","#trn-property-input",function(event){
$("#trn-property-input").keydown();
event.preventDefault();
event.stopPropagation();
});
$(document).on("change","#timing-fn-select",function(event){
$("#timing-fn-value").val($("#timing-fn-select").val());
_valueToBeizerCurveControls($("#timing-fn-select").val());
event.preventDefault();
event.stopPropagation();
});
$(document).on("change","#timing-fn-value",function(event){
_valueToBeizerCurveControls($("#timing-fn-value").val());
event.preventDefault();
event.stopPropagation();
});
function _createCurvePoint(xValue,yValue){
return {
x:parseFloat(xValue)*100*2,
y:parseFloat(yValue)*100*2
};
}
function _updateBezierControlPoints(cp1,cp2){
$("#bezier-cp1").css("left",cp1.x-0).css("top",cp1.y-0);
$("#bezier-cp2").css("left",cp2.x-0).css("top",cp2.y-0);
}
function _valueToBeizerCurveControls(value){
var params = value.split(", ");
var cp1 = _createCurvePoint(params[0],params[1]),
cp2 = _createCurvePoint(params[2],params[3]);
_drawCurve(cp1,cp2);
_updateBezierControlPoints(cp1,cp2);
}
function _getCubicBezierPointsValue(cp1,cp2){
return (cp1.x/100/2).toFixed(3)+", "+(cp1.y/100/2).toFixed(3)+", "+(cp2.x/100/2).toFixed(3)+", "+(cp2.y/100/2).toFixed(3);
}
function _captureCSSChanges(event,key,value){
capturedDef[key]= value;
$("#properties-container").find("#prop-"+key).remove();
$(ChangeSetEntryTemplate.split("{{name}}").join(key).split("{{id}}").join("prop-"+key).split("{{value}}").join(value)).appendTo("#properties-container");
}
function _drawCurve(ctrp1,ctrp2){
context.clearRect(0,0,canvas.width,canvas.height);
context.strokeStyle = "#288edf";
context.lineWidth = 3;
context.beginPath();
context.moveTo(0, 200);
context.bezierCurveTo(ctrp1.x,ctrp1.y,ctrp2.x,ctrp2.y, 200, 0);
context.stroke();
// draw control point lines
context.strokeStyle = 'gray';
context.lineWidth = 2;
context.beginPath();
context.moveTo(0, 200);
context.lineTo(ctrp1.x, ctrp1.y);
context.moveTo(200,0);
context.lineTo(ctrp2.x, ctrp2.y);
context.stroke();
}
$(document).on("change",".changeset-value",function(){
var key = $(this).data("key");
capturedDef[key] = $(this).val();
});
$(document).on("click","#stop-capture-property-changes",function(){
$("#stop-capture-property-changes").removeClass("blinkingcaptureindicator");
$("#html-design-editor").off("css-prop-modification css-prop-addition css-prop-removal", _captureCSSChanges);
lastSelectedRuleset.rollBack();
inCaptureMode = false;
});
$(document).on("click","#capture-property-changes",function(){
capturedDef = {};
$("#properties-container").html("");
if(inCaptureMode){
lastSelectedRuleset.rollBack();
} else {
$("#stop-capture-property-changes").addClass("blinkingcaptureindicator");
$("#html-design-editor").on("css-prop-modification css-prop-addition css-prop-removal", _captureCSSChanges);
$("#changeset-selector-name").removeAttr("disabled");
}
lastSelectedRuleset.createSavePoint();
inCaptureMode = true;
});
$(document).on("drag",".beziercontrolpoint",function(){
var cp1 = {x:parseInt($("#bezier-cp1").css("left"))+0,y:parseInt($("#bezier-cp1").css("top"))+0},
cp2 = {x:parseInt($("#bezier-cp2").css("left"))+0,y:parseInt($("#bezier-cp2").css("top"))+0};
_drawCurve(cp1,cp2);
$("#timing-fn-value").val(_getCubicBezierPointsValue(cp1,cp2));
});
function _getTransitionConfigAsText(){
var config = "all "
+($("#trn-duration-input").val() || 0)+"ms "
+"cubic-bezier("+$("#timing-fn-value").val()+") "
+($("#trn-delay-input").val() || 0)+"ms";
return config;
}
function _showSelection(){
$("#selection-outline").show();
$hLayer1.show();
$hLayer2.show();
$vLayer1.show();
$vLayer2.show();
$xOffsetAxisGrid.show();
$yOffsetAxisGrid.show();
}
function _hideSelection(){
$("#selection-outline").hide();
$hLayer1.hide();
$hLayer2.hide();
$vLayer1.hide();
$vLayer2.hide();
$xOffsetAxisGrid.hide();
$yOffsetAxisGrid.hide();
}
$(document).on("click","#preview-trn-animation",function(){
var trigger = $("#item-state-selector").val();
if(trigger === 'custom'){
$(lastSelectedRuleset.element).one("transitionend webkitTransitionend",function(){
$(lastSelectedRuleset.element).removeClass(simulationSelectorName.replace(".",""));
});
$(lastSelectedRuleset.element).addClass(simulationSelectorName.replace(".",""));
_hideSelection();
window.setTimeout(function(){
_showSelection();
},($("#trn-duration-input").val() || 1)*2);
} else {
if(trigger === 'hover'){
$(lastSelectedRuleset.element).triggerHandler("mouseover");
} else if(trigger === 'focus'){
lastSelectedRuleset.element.focus();
}
$("#selection-outline").hide();
window.setTimeout(function(){
$("#selection-outline").show();
},($("#trn-duration-input").val() || 1)*2);
}
});
function _getCapturedChangesAsRuleDef(){
var text= "{ ";
for(var key in capturedDef){
text = text + key + ":"+capturedDef[key]+ " !important;";
}
text = text + " }";
return text;
}
$(document).on("click","#apply-transition-animation",function(){
lastSelectedRuleset.css("transition",_getTransitionConfigAsText());
lastSelectedRuleset.persist();
});
$(document).on("click","#save-changeset",function(){
var selectorText = $("#changeset-selector-name").val();
if(selectorText){
var cssDef = _getCapturedChangesAsRuleDef();
var cssText = selectorText + " "+cssDef;
var info = RuleSetFinder.findRuleByName(selectorText);
if(info){
RuleSetCreator.updateRule(info[0],cssText,info[1]);
} else {
RuleSetCreator.createNewRule(null,cssText,0);
}
simulationSelectorName = selectorText;
}
});
AppInit.appReady(function () {
$("#trn-property-input").autocomplete({
source: proprtyNames,
minLength: 0
});
canvas = document.getElementById("cubic-bezier-curve");
context = canvas.getContext("2d");
$(".beziercontrolpoint")
.draggable({handle:'.beziercontroldragger',
containment : '#cubic-bezier-container'
});
$hLayer1 = $("#h-layer1");
$hLayer2 = $("#h-layer2");
$vLayer1 = $("#v-layer1");
$vLayer2 = $("#v-layer2");
$xOffsetAxisGrid = $(".offsetHAxis");
$yOffsetAxisGrid = $(".offsetVAxis");
});
});
|
/**
* @license MIT
* @fileOverview Favico animations
* @author Miroslav Magda, http://blog.ejci.net
* @version 0.3.10
*/
!function () {
var e = function (e) {
"use strict";
function t(e) {
if (e.paused || e.ended || g)return !1;
try {
f.clearRect(0, 0, s, l), f.drawImage(e, 0, 0, s, l)
} catch (o) {
}
p = setTimeout(function () {
t(e)
}, S.duration), O.setIcon(h)
}
function o(e) {
var t = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
e = e.replace(t, function (e, t, o, n) {
return t + t + o + o + n + n
});
var o = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
return o ? {r: parseInt(o[1], 16), g: parseInt(o[2], 16), b: parseInt(o[3], 16)} : !1
}
function n(e, t) {
var o, n = {};
for (o in e)n[o] = e[o];
for (o in t)n[o] = t[o];
return n
}
function r() {
return b.hidden || b.msHidden || b.webkitHidden || b.mozHidden
}
e = e ? e : {};
var i, a, l, s, h, f, c, d, u, y, w, g, x, m, p, b, v = {
bgColor: "#d00",
textColor: "#fff",
fontFamily: "sans-serif",
fontStyle: "bold",
type: "circle",
position: "down",
animation: "slide",
elementId: !1,
dataUrl: !1,
win: window
};
x = {}, x.ff = "undefined" != typeof InstallTrigger, x.chrome = !!window.chrome, x.opera = !!window.opera || navigator.userAgent.indexOf("Opera") >= 0, x.ie = /*@cc_on!@*/ !1, x.safari = Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0, x.supported = x.chrome || x.ff || x.opera;
var C = [];
w = function () {
}, d = g = !1;
var E = function () {
i = n(v, e), i.bgColor = o(i.bgColor), i.textColor = o(i.textColor), i.position = i.position.toLowerCase(), i.animation = S.types["" + i.animation] ? i.animation : v.animation, b = i.win.document;
var t = i.position.indexOf("up") > -1, r = i.position.indexOf("left") > -1;
if (t || r)for (var d = 0; d < S.types["" + i.animation].length; d++) {
var u = S.types["" + i.animation][d];
t && (u.y = u.y < .6 ? u.y - .4 : u.y - 2 * u.y + (1 - u.w)), r && (u.x = u.x < .6 ? u.x - .4 : u.x - 2 * u.x + (1 - u.h)), S.types["" + i.animation][d] = u
}
i.type = A["" + i.type] ? i.type : v.type, a = O.getIcon(), h = document.createElement("canvas"), c = document.createElement("img"), a.hasAttribute("href") ? (c.setAttribute("crossOrigin", "anonymous"), c.onload = function () {
l = c.height > 0 ? c.height : 32, s = c.width > 0 ? c.width : 32, h.height = l, h.width = s, f = h.getContext("2d"), M.ready()
}, c.setAttribute("src", a.getAttribute("href"))) : (c.onload = function () {
l = 32, s = 32, c.height = l, c.width = s, h.height = l, h.width = s, f = h.getContext("2d"), M.ready()
}, c.setAttribute("src", ""))
}, M = {};
M.ready = function () {
d = !0, M.reset(), w()
}, M.reset = function () {
d && (C = [], u = !1, y = !1, f.clearRect(0, 0, s, l), f.drawImage(c, 0, 0, s, l), O.setIcon(h), window.clearTimeout(m), window.clearTimeout(p))
}, M.start = function () {
if (d && !y) {
var e = function () {
u = C[0], y = !1, C.length > 0 && (C.shift(), M.start())
};
if (C.length > 0) {
y = !0;
var t = function () {
["type", "animation", "bgColor", "textColor", "fontFamily", "fontStyle"].forEach(function (e) {
e in C[0].options && (i[e] = C[0].options[e])
}), S.run(C[0].options, function () {
e()
}, !1)
};
u ? S.run(u.options, function () {
t()
}, !0) : t()
}
}
};
var A = {}, I = function (e) {
return e.n = "number" == typeof e.n ? Math.abs(0 | e.n) : e.n, e.x = s * e.x, e.y = l * e.y, e.w = s * e.w, e.h = l * e.h, e.len = ("" + e.n).length, e
};
A.circle = function (e) {
e = I(e);
var t = !1;
2 === e.len ? (e.x = e.x - .4 * e.w, e.w = 1.4 * e.w, t = !0) : e.len >= 3 && (e.x = e.x - .65 * e.w, e.w = 1.65 * e.w, t = !0), f.clearRect(0, 0, s, l), f.drawImage(c, 0, 0, s, l), f.beginPath(), f.font = i.fontStyle + " " + Math.floor(e.h * (e.n > 99 ? .85 : 1)) + "px " + i.fontFamily, f.textAlign = "center", t ? (f.moveTo(e.x + e.w / 2, e.y), f.lineTo(e.x + e.w - e.h / 2, e.y), f.quadraticCurveTo(e.x + e.w, e.y, e.x + e.w, e.y + e.h / 2), f.lineTo(e.x + e.w, e.y + e.h - e.h / 2), f.quadraticCurveTo(e.x + e.w, e.y + e.h, e.x + e.w - e.h / 2, e.y + e.h), f.lineTo(e.x + e.h / 2, e.y + e.h), f.quadraticCurveTo(e.x, e.y + e.h, e.x, e.y + e.h - e.h / 2), f.lineTo(e.x, e.y + e.h / 2), f.quadraticCurveTo(e.x, e.y, e.x + e.h / 2, e.y)) : f.arc(e.x + e.w / 2, e.y + e.h / 2, e.h / 2, 0, 2 * Math.PI), f.fillStyle = "rgba(" + i.bgColor.r + "," + i.bgColor.g + "," + i.bgColor.b + "," + e.o + ")", f.fill(), f.closePath(), f.beginPath(), f.stroke(), f.fillStyle = "rgba(" + i.textColor.r + "," + i.textColor.g + "," + i.textColor.b + "," + e.o + ")", "number" == typeof e.n && e.n > 999 ? f.fillText((e.n > 9999 ? 9 : Math.floor(e.n / 1e3)) + "k+", Math.floor(e.x + e.w / 2), Math.floor(e.y + e.h - .2 * e.h)) : f.fillText(e.n, Math.floor(e.x + e.w / 2), Math.floor(e.y + e.h - .15 * e.h)), f.closePath()
}, A.rectangle = function (e) {
e = I(e);
var t = !1;
2 === e.len ? (e.x = e.x - .4 * e.w, e.w = 1.4 * e.w, t = !0) : e.len >= 3 && (e.x = e.x - .65 * e.w, e.w = 1.65 * e.w, t = !0), f.clearRect(0, 0, s, l), f.drawImage(c, 0, 0, s, l), f.beginPath(), f.font = i.fontStyle + " " + Math.floor(e.h * (e.n > 99 ? .9 : 1)) + "px " + i.fontFamily, f.textAlign = "center", f.fillStyle = "rgba(" + i.bgColor.r + "," + i.bgColor.g + "," + i.bgColor.b + "," + e.o + ")", f.fillRect(e.x, e.y, e.w, e.h), f.fillStyle = "rgba(" + i.textColor.r + "," + i.textColor.g + "," + i.textColor.b + "," + e.o + ")", "number" == typeof e.n && e.n > 999 ? f.fillText((e.n > 9999 ? 9 : Math.floor(e.n / 1e3)) + "k+", Math.floor(e.x + e.w / 2), Math.floor(e.y + e.h - .2 * e.h)) : f.fillText(e.n, Math.floor(e.x + e.w / 2), Math.floor(e.y + e.h - .15 * e.h)), f.closePath()
};
var T = function (e, t) {
t = ("string" == typeof t ? {animation: t} : t) || {}, w = function () {
try {
if ("number" == typeof e ? e > 0 : "" !== e) {
var n = {type: "badge", options: {n: e}};
if ("animation" in t && S.types["" + t.animation] && (n.options.animation = "" + t.animation), "type" in t && A["" + t.type] && (n.options.type = "" + t.type), ["bgColor", "textColor"].forEach(function (e) {
e in t && (n.options[e] = o(t[e]))
}), ["fontStyle", "fontFamily"].forEach(function (e) {
e in t && (n.options[e] = t[e])
}), C.push(n), C.length > 100)throw new Error("Too many badges requests in queue.");
M.start()
} else M.reset()
} catch (r) {
throw new Error("Error setting badge. Message: " + r.message)
}
}, d && w()
}, U = function (e) {
w = function () {
try {
var t = e.width, o = e.height, n = document.createElement("img"), r = o / l > t / s ? t / s : o / l;
n.setAttribute("crossOrigin", "anonymous"), n.onload = function () {
f.clearRect(0, 0, s, l), f.drawImage(n, 0, 0, s, l), O.setIcon(h)
}, n.setAttribute("src", e.getAttribute("src")), n.height = o / r, n.width = t / r
} catch (i) {
throw new Error("Error setting image. Message: " + i.message)
}
}, d && w()
}, R = function (e) {
w = function () {
try {
if ("stop" === e)return g = !0, M.reset(), void(g = !1);
e.addEventListener("play", function () {
t(this)
}, !1)
} catch (o) {
throw new Error("Error setting video. Message: " + o.message)
}
}, d && w()
}, L = function (e) {
if (window.URL && window.URL.createObjectURL || (window.URL = window.URL || {}, window.URL.createObjectURL = function (e) {
return e
}), x.supported) {
var o = !1;
navigator.getUserMedia = navigator.getUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia, w = function () {
try {
if ("stop" === e)return g = !0, M.reset(), void(g = !1);
o = document.createElement("video"), o.width = s, o.height = l, navigator.getUserMedia({
video: !0,
audio: !1
}, function (e) {
o.src = URL.createObjectURL(e), o.play(), t(o)
}, function () {
})
} catch (n) {
throw new Error("Error setting webcam. Message: " + n.message)
}
}, d && w()
}
}, O = {};
O.getIcon = function () {
var e = !1, t = function () {
for (var e = b.getElementsByTagName("head")[0].getElementsByTagName("link"), t = e.length,
o = t - 1; o >= 0; o--)if (/(^|\s)icon(\s|$)/i.test(e[o].getAttribute("rel")))return e[o];
return !1
};
return i.element ? e = i.element : i.elementId ? (e = b.getElementById(i.elementId), e.setAttribute("href", e.getAttribute("src"))) : (e = t(), e === !1 && (e = b.createElement("link"), e.setAttribute("rel", "icon"), b.getElementsByTagName("head")[0].appendChild(e))), e.setAttribute("type", "image/png"), e
}, O.setIcon = function (e) {
var t = e.toDataURL("image/png");
if (i.dataUrl && i.dataUrl(t), i.element) i.element.setAttribute("href", t), i.element.setAttribute("src", t); else if (i.elementId) {
var o = b.getElementById(i.elementId);
o.setAttribute("href", t), o.setAttribute("src", t)
} else if (x.ff || x.opera) {
var n = a;
a = b.createElement("link"), x.opera && a.setAttribute("rel", "icon"), a.setAttribute("rel", "icon"), a.setAttribute("type", "image/png"), b.getElementsByTagName("head")[0].appendChild(a), a.setAttribute("href", t), n.parentNode && n.parentNode.removeChild(n)
} else a.setAttribute("href", t)
};
var S = {};
return S.duration = 40, S.types = {}, S.types.fade = [{x: .4, y: .4, w: .6, h: .6, o: 0}, {
x: .4,
y: .4,
w: .6,
h: .6,
o: .1
}, {x: .4, y: .4, w: .6, h: .6, o: .2}, {x: .4, y: .4, w: .6, h: .6, o: .3}, {
x: .4,
y: .4,
w: .6,
h: .6,
o: .4
}, {x: .4, y: .4, w: .6, h: .6, o: .5}, {x: .4, y: .4, w: .6, h: .6, o: .6}, {
x: .4,
y: .4,
w: .6,
h: .6,
o: .7
}, {x: .4, y: .4, w: .6, h: .6, o: .8}, {x: .4, y: .4, w: .6, h: .6, o: .9}, {
x: .4,
y: .4,
w: .6,
h: .6,
o: 1
}], S.types.none = [{x: .4, y: .4, w: .6, h: .6, o: 1}], S.types.pop = [{x: 1, y: 1, w: 0, h: 0, o: 1}, {
x: .9,
y: .9,
w: .1,
h: .1,
o: 1
}, {x: .8, y: .8, w: .2, h: .2, o: 1}, {x: .7, y: .7, w: .3, h: .3, o: 1}, {
x: .6,
y: .6,
w: .4,
h: .4,
o: 1
}, {x: .5, y: .5, w: .5, h: .5, o: 1}, {x: .4, y: .4, w: .6, h: .6, o: 1}], S.types.popFade = [{
x: .75,
y: .75,
w: 0,
h: 0,
o: 0
}, {x: .65, y: .65, w: .1, h: .1, o: .2}, {x: .6, y: .6, w: .2, h: .2, o: .4}, {
x: .55,
y: .55,
w: .3,
h: .3,
o: .6
}, {x: .5, y: .5, w: .4, h: .4, o: .8}, {x: .45, y: .45, w: .5, h: .5, o: .9}, {
x: .4,
y: .4,
w: .6,
h: .6,
o: 1
}], S.types.slide = [{x: .4, y: 1, w: .6, h: .6, o: 1}, {x: .4, y: .9, w: .6, h: .6, o: 1}, {
x: .4,
y: .9,
w: .6,
h: .6,
o: 1
}, {x: .4, y: .8, w: .6, h: .6, o: 1}, {x: .4, y: .7, w: .6, h: .6, o: 1}, {
x: .4,
y: .6,
w: .6,
h: .6,
o: 1
}, {x: .4, y: .5, w: .6, h: .6, o: 1}, {x: .4, y: .4, w: .6, h: .6, o: 1}], S.run = function (e, t, o, a) {
var l = S.types[r() ? "none" : i.animation];
return a = o === !0 ? "undefined" != typeof a ? a : l.length - 1 : "undefined" != typeof a ? a : 0, t = t ? t : function () {
}, a < l.length && a >= 0 ? (A[i.type](n(e, l[a])), m = setTimeout(function () {
o ? a -= 1 : a += 1, S.run(e, t, o, a)
}, S.duration), O.setIcon(h), void 0) : void t()
}, E(), {badge: T, video: R, image: U, webcam: L, reset: M.reset, browser: {supported: x.supported}}
};
"undefined" != typeof define && define.amd ? define([], function () {
return e
}) : "undefined" != typeof module && module.exports ? module.exports = e : this.Favico = e
}();
|
// Bento components must import `bento-mustache.js` instead of `mustache` directly.
// This is so that the bundler links it to the external `bento-mustache.js` binary.
import mustache from '#bento/third_party/mustache/mustache';
export default mustache;
|
import Mock from 'mockjs'
import {menuBottons, menuSource, navMenuList, systemRoutes} from './routesData.js'
// const top = [
// {
// label: "首页",
// path: "/wel/index",
// icon: 'el-icon-menu',
// meta: {
// i18n: 'dashboard',
// },
// parentId: 0
// },
// {
// label: "bladex官网",
// icon: 'el-icon-document',
// meta: {
// i18n: 'website',
// },
// path: "https://bladex.vip/#/",
// parentId: 1
// },
// {
// label: "avuex官网",
// icon: 'el-icon-document',
// meta: {
// i18n: 'avuexwebsite',
// },
// path: "https://avuex.avue.top",
// parentId: 2
// },
// {
// label: "测试",
// icon: 'el-icon-document',
// path: "/test/index",
// meta: {
// i18n: 'test',
// },
// parentId: 3
// }]
export default ({mock}) => {
if (!mock) return;
Mock.mock('/user/getTopMenu', 'get', () => {
console.log("mock /user/getTopMenu");
return {
"code": 200,
"success": true,
"msg": "操作成功",
"data": navMenuList
}
});
Mock.mock('/user/routes', 'get', () => {
console.log("mock /user/routes");
return {
"code": 200,
"success": true,
"msg": "操作成功",
"data": systemRoutes
};
});
Mock.mock('/user/permissions', 'get', () => {
console.log("/user/permissions");
return {
"code": 200,
"success": true,
"msg": "操作成功",
"data": [
"user-list", "user-edit", "user-add"
]
};
})
}
|
jQuery.fn.vectorMap('addMap', 'us-dc_lcc_en', {
"insets": [{
"width": 1000,
"top": 0,
"height": 1048.6785719604895,
"bbox": [{"y": -4900672.096351757, "x": 1950622.2429646673}, {
"y": -4881057.772820286,
"x": 1969326.0899354331
}],
"left": 0
}],
"paths": {
"11001": {
"path": "M143.71,567.79l-3.82,-2.06l-17.52,-11.46l-17.62,-10.43l-2.12,-5.54l-2.88,-5.16l-14.58,-16.94l-16.4,-14.47l-30.94,-20.21l-8.34,-6.84l-7.37,-8.26l-9.47,-14.73l-6.65,-6.75l-5.52,-3.63l2.39,-6.5l6.76,-10.59l9.5,-16.7l31.23,-52.29l6.88,-11.12l6.91,-9.99l2.76,-4.51l64.23,-109.39l10.25,-18.09l13.81,-22.83l64.41,-109.61l10.25,-16.34l14.11,-24.4l12.55,-20.71l2.05,-4.28l2.22,-3.44l17.89,9.62l12.4,7.09l72.08,42.76l13.41,7.66l3.73,1.73l5.41,3.54l10.65,6.22l18.17,10.18l62.12,36.95l8.88,6.14l90.8,53.74l32.46,19.54l119.43,70.47l76.83,44.39l35.16,20.68l19.49,12.98l139.76,82.74l-269.69,459.04l-27.2,45.81l-24.2,42.43l-32.26,54.87l-15.14,1.99l-11.3,7.16l-7.76,-3.61l-8.68,-3.2l-8.38,-13.45l-9.11,-8.3l-0.01,-10.53l-2.55,-8.74l-7.52,-39.37l-1.42,-9.48l-1.36,-14.13l0.62,-13.15l1.39,-15.35l-2.3,-14.73l-1.91,-31.09l-0.0,-13.58l0.95,-22.39l8.36,-62.79l5.71,-11.28l15.4,-13.94l8.04,-18.43l7.52,-33.13l5.04,-9.07l17.91,-2.74l13.1,0.45l7.7,-1.83l6.59,-4.96l6.76,-9.87l18.72,-22.12l12.37,-11.43l10.52,-8.29l18.71,-13.63l7.13,-7.06l4.26,-11.62l2.68,-11.59l8.9,-19.86l6.05,-9.06l4.39,-16.2l0.66,-16.13l-0.5,-13.3l-6.21,-14.43l-0.39,-0.24l-0.36,0.29l-5.0,17.26l0.9,12.61l-17.53,48.03l-4.73,20.0l-4.91,9.59l-10.95,7.58l-14.59,9.35l-6.59,4.74l-9.36,8.32l-9.05,10.11l-11.57,15.51l-7.0,7.82l-9.3,0.44l-11.85,-0.73l-20.81,1.72l-16.08,13.26l-5.56,16.28l-4.9,18.81l-5.07,14.23l-10.39,4.98l-5.67,11.52l-9.4,6.15l-6.29,-16.29l-3.83,-14.89l-13.75,-39.0l-6.93,-3.21l-14.0,-12.49l-17.41,-10.4l-14.74,-6.68l-13.82,1.11l-0.25,0.68l13.28,13.09l11.95,6.68l8.92,5.68l12.21,12.06l8.53,13.47l6.2,11.35l3.31,10.12l7.29,25.64l-0.89,17.68l-20.27,-19.86l-16.48,-21.5l-17.8,-19.46l-13.73,-11.62l-15.66,-9.89l-14.62,-7.0l-10.15,-7.95l-10.73,-0.6l-7.55,-3.71l-19.11,-10.65l-15.84,-9.29l-8.86,-5.96l-5.24,-7.96l-13.37,-11.23l-11.04,-14.95l-2.91,-9.6l-11.39,-21.2l-24.2,-3.87l-14.88,-4.68l-13.0,-0.01l-25.16,1.24l-13.8,1.86l-12.23,2.4l-13.58,4.79l-15.92,-1.92l-18.74,-1.23l-11.65,-2.47l-10.62,-5.12l-9.65,-0.25l-0.41,0.44l1.27,11.95ZM372.84,667.35l30.34,17.44l7.35,5.83l-1.48,5.23l-4.52,4.88l-6.08,-0.45l-3.66,-7.23l-4.2,-5.55l-16.43,-11.7l-3.01,-0.98l-1.27,0.26l-2.77,-0.66l-7.58,2.64l-3.45,0.89l-3.9,-0.05l-3.92,-3.22l-3.07,-5.34l-3.67,-4.2l-2.88,-4.41l-9.66,-9.62l-6.76,-7.9l-3.71,-3.58l-2.18,-3.27l0.12,-3.19l2.99,-0.77l6.68,-0.23l3.45,1.37l4.93,3.91l6.39,6.89l11.05,9.55l13.53,9.5l7.36,3.95ZM334.86,618.59l0.22,4.79l-7.41,-3.47l-5.45,0.48l-6.95,-5.36l-3.75,-4.46l-0.28,-1.14l-14.7,-15.79l-4.85,-14.94l10.86,-3.97l11.73,2.82l8.69,12.3l-0.15,0.99l5.8,15.2l6.24,12.56Z",
"name": "District of Columbia"
}
},
"height": 1048.6785719604895,
"projection": {"type": "lcc", "centralMeridian": -100.0},
"width": 1000.0
});
|
/*
artifact generator: C:\My\wizzi\stfnbssl\wizzi\node_modules\wizzi-js\lib\artifacts\js\module\gen\main.js
package: wizzi-js@0.7.7
primary source IttfDocument: C:\My\wizzi\stfnbssl\wizzi\packages\wizzi.plugin.pdf\.wizzi\ittf\root\index.js.ittf
utc time: Mon, 15 Mar 2021 12:41:28 GMT
*/
'use strict';
var util = require('util');
var path = require('path');
var stringify = require('json-stringify-safe');
var errors = require('./errors');
var md = module.exports = {};
md.name = '.index';
// window(s) vars must be declared even if empty
var window_modelFactories = {
'pdf': require('./lib/wizzi/models/pdf-factory.g')
};
var window_artifactGenerators = {
'pdf/document': require('./lib/artifacts/pdf/document/gen/main')
};
var window_transformers = {
'pdf/extended': require('./lib/artifacts/pdf/extended/trans/main')
};
var window_schemaDefinitions = {};
//
class FactoryPlugin {
constructor(wizziPackage, provides) {
this.file = wizziPackage.file;
this.provides = provides;
this.modelFactories = {};
this.modelTransformers = {};
this.artifactGenerators = {};
this.schemaDefinitions = {};
}
initialize(options, callback) {
// TODO
return callback(null);
}
getName() {
return '';
}
getFilename() {
return __filename;
}
getProvides() {
return this.provides;
}
//
getModelFactory(schemaName) {
var factory = this.modelFactories[schemaName] || null;
if (factory == null) {
if (typeof window !== 'undefined') {
factory = window_modelFactories[schemaName];
}
else {
var modulePath = path.resolve(__dirname, './lib/wizzi/models/' + schemaName + '-factory.g.js');
if (this.file.exists(modulePath)) {
try {
factory = require('./lib/wizzi/models/' + schemaName + '-factory.g');
}
catch (ex) {
return error('WizziPluginError', 'getModelFactory', 'Error loading wizzi model factory: ' + modulePath + ', in plugin: ' + this.getFilename(), ex);
}
}
}
this.modelFactories[schemaName] = factory;
}
return factory;
}
//
getModelTransformer(transformerName) {
var transformer = this.modelTransformers[transformerName] || null;
if (transformer == null) {
if (typeof window !== 'undefined') {
transformer = window_transformers[transformerName];
}
else {
var modulePath = path.resolve(__dirname, './lib/artifacts/' + transformerName + '/trans/main.js');
if (this.file.exists(modulePath)) {
try {
transformer = require('./lib/artifacts/' + transformerName + '/trans/main');
}
catch (ex) {
return error('WizziPluginError', 'getModelTransformer', 'Error loading wizzi model transformer: ' + modulePath + ', in plugin: ' + this.getFilename(), ex);
}
}
}
this.modelTransformers[transformerName] = transformer;
}
return transformer;
}
//
getArtifactGenerator(generationName) {
var generator = this.artifactGenerators[generationName] || null;
if (generator == null) {
if (typeof window !== 'undefined') {
generator = window_artifactGenerators[generationName];
}
else {
var modulePath = path.resolve(__dirname, './lib/artifacts/' + generationName + '/gen/main.js');
if (this.file.exists(modulePath)) {
try {
generator = require('./lib/artifacts/' + generationName + '/gen/main');
}
catch (ex) {
return error('WizziPluginError', 'getArtifactGenerator', 'Error loading artifact generator: ' + modulePath + ', in plugin: ' + this.getFilename(), ex);
}
}
}
this.artifactGenerators[generationName] = generator;
}
return generator;
}
//
getSchemaDefinition(schemaName) {
var definition = this.schemaDefinitions[schemaName] || null;
if (definition == null) {
if (typeof window !== 'undefined') {
definition = window_schemaDefinitions[schemaName];
}
else {
var schemaJsonUri = path.resolve(__dirname, './lib/wizzi/models/' + schemaName + '-schema.g.json');
if (this.file.exists(schemaJsonUri)) {
try {
definition = this.file.readJSON(schemaJsonUri);
}
catch (ex) {
return error('WizziPluginError', 'getSchemaDefinition', 'Error loading wizzi schema definition: ' + schemaJsonUri + ', in plugin: ' + this.getFilename(), ex);
}
this.schemaDefinitions[schemaName] = definition;
}
}
}
return definition;
}
}
function error(errorName, method, message, innerError) {
return new errors.WizziPluginError(message, null, {
errorName: errorName,
method: md.name + '.' + method,
sourcePath: __filename,
inner: innerError
});
}
module.exports = {
provides: {
schemas: [
'pdf'
],
modelTransformers: [
'pdf/extended'
],
artifactGenerators: [
'pdf/document'
]
},
provides: {
schemas: [
'Pdf'
],
modelTransformers: [
'Pdf/extended'
],
artifactGenerators: [
'Pdf/document'
]
},
createFactoryPlugin: function(wizziPackage, options, callback) {
var plugin = new FactoryPlugin(wizziPackage, this.provides);
plugin.initialize(options, function(err, notUsed) {
if (err) {
return callback(err);
}
return callback(null, plugin);
})
}
};
|
import { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
function LanguageSetter(txtBr, txtEn, txtEs) {
const router = useRouter();
const { locale } = router;
const languages = {
pt: txtBr,
en: txtEn,
es: txtEs,
};
const defineLanguage = (location) => languages[location];
const [TextContent, setTextContent] = useState(defineLanguage(locale));
useEffect(() => {
setTextContent(defineLanguage(locale));
}, [locale]);
return TextContent;
}
export default LanguageSetter;
|
import { mat3, vec3, vec4 } from 'gl-matrix';
import { gltfTextureInfo } from './texture.js';
import { jsToGl, initGlForMembers } from './utils.js';
import { GltfObject } from './gltf_object.js';
class gltfMaterial extends GltfObject
{
constructor()
{
super();
this.name = undefined;
this.pbrMetallicRoughness = undefined;
this.normalTexture = undefined;
this.occlusionTexture = undefined;
this.emissiveTexture = undefined;
this.emissiveFactor = vec3.fromValues(0, 0, 0);
this.alphaMode = "OPAQUE";
this.alphaCutoff = 0.5;
this.doubleSided = false;
// pbr next extension toggles
this.hasClearcoat = false;
this.hasSheen = false;
this.hasTransmission = false;
this.hasIOR = false;
this.hasVolume = false;
// non gltf properties
this.type = "unlit";
this.textures = [];
this.properties = new Map();
this.defines = [];
}
static createDefault()
{
const defaultMaterial = new gltfMaterial();
defaultMaterial.type = "MR";
defaultMaterial.name = "Default Material";
defaultMaterial.defines.push("MATERIAL_METALLICROUGHNESS 1");
const baseColorFactor = vec4.fromValues(1, 1, 1, 1);
const metallicFactor = 1;
const roughnessFactor = 1;
defaultMaterial.properties.set("u_BaseColorFactor", baseColorFactor);
defaultMaterial.properties.set("u_MetallicFactor", metallicFactor);
defaultMaterial.properties.set("u_RoughnessFactor", roughnessFactor);
return defaultMaterial;
}
getShaderIdentifier()
{
switch (this.type)
{
default:
case "SG": // fall through till we sparate shaders
case "MR": return "pbr.frag";
//case "SG": return "specular-glossiness.frag" ;
}
}
getDefines(renderingParameters)
{
const defines = Array.from(this.defines);
if (this.hasClearcoat && renderingParameters.enabledExtensions.KHR_materials_clearcoat)
{
defines.push("MATERIAL_CLEARCOAT 1");
}
if (this.hasSheen && renderingParameters.enabledExtensions.KHR_materials_sheen)
{
defines.push("MATERIAL_SHEEN 1");
}
if (this.hasTransmission && renderingParameters.enabledExtensions.KHR_materials_transmission)
{
defines.push("MATERIAL_TRANSMISSION 1");
}
if (this.hasVolume && renderingParameters.enabledExtensions.KHR_materials_volume)
{
defines.push("MATERIAL_VOLUME 1");
}
if(this.hasIOR && renderingParameters.enabledExtensions.KHR_materials_ior)
{
defines.push("MATERIAL_IOR 1");
}
if(this.hasSpecular && renderingParameters.enabledExtensions.KHR_materials_specular)
{
defines.push("MATERIAL_SPECULAR 1");
}
return defines;
}
getProperties()
{
return this.properties;
}
getTextures()
{
return this.textures;
}
parseTextureInfoExtensions(textureInfo, textureKey)
{
if(textureInfo.extensions === undefined)
{
return;
}
if(textureInfo.extensions.KHR_texture_transform !== undefined)
{
const uvTransform = textureInfo.extensions.KHR_texture_transform;
// override uvset
if(uvTransform.texCoord !== undefined)
{
textureInfo.texCoord = uvTransform.texCoord;
}
let rotation = mat3.create();
let scale = mat3.create();
let translation = mat3.create();
if(uvTransform.rotation !== undefined)
{
const s = Math.sin(uvTransform.rotation);
const c = Math.cos(uvTransform.rotation);
rotation = jsToGl([
c, -s, 0.0,
s, c, 0.0,
0.0, 0.0, 1.0]);
}
if(uvTransform.scale !== undefined)
{
scale = jsToGl([
uvTransform.scale[0], 0, 0,
0, uvTransform.scale[1], 0,
0, 0, 1
]);
}
if(uvTransform.offset !== undefined)
{
translation = jsToGl([
1, 0, 0,
0, 1, 0,
uvTransform.offset[0], uvTransform.offset[1], 1
]);
}
let uvMatrix = mat3.create();
mat3.multiply(uvMatrix, translation, rotation);
mat3.multiply(uvMatrix, uvMatrix, scale);
this.defines.push("HAS_" + textureKey.toUpperCase() + "_UV_TRANSFORM 1");
this.properties.set("u_" + textureKey + "UVTransform", uvMatrix);
}
}
initGl(gltf, webGlContext)
{
if (this.normalTexture !== undefined)
{
this.normalTexture.samplerName = "u_NormalSampler";
this.parseTextureInfoExtensions(this.normalTexture, "Normal");
this.textures.push(this.normalTexture);
this.defines.push("HAS_NORMAL_MAP 1");
this.properties.set("u_NormalScale", this.normalTexture.scale);
this.properties.set("u_NormalUVSet", this.normalTexture.texCoord);
}
if (this.occlusionTexture !== undefined)
{
this.occlusionTexture.samplerName = "u_OcclusionSampler";
this.parseTextureInfoExtensions(this.occlusionTexture, "Occlusion");
this.textures.push(this.occlusionTexture);
this.defines.push("HAS_OCCLUSION_MAP 1");
this.properties.set("u_OcclusionStrength", this.occlusionTexture.strength);
this.properties.set("u_OcclusionUVSet", this.occlusionTexture.texCoord);
}
this.properties.set("u_EmissiveFactor", this.emissiveFactor);
if (this.emissiveTexture !== undefined)
{
this.emissiveTexture.samplerName = "u_EmissiveSampler";
this.parseTextureInfoExtensions(this.emissiveTexture, "Emissive");
this.textures.push(this.emissiveTexture);
this.defines.push("HAS_EMISSIVE_MAP 1");
this.properties.set("u_EmissiveUVSet", this.emissiveTexture.texCoord);
}
if (this.baseColorTexture !== undefined)
{
this.baseColorTexture.samplerName = "u_BaseColorSampler";
this.parseTextureInfoExtensions(this.baseColorTexture, "BaseColor");
this.textures.push(this.baseColorTexture);
this.defines.push("HAS_BASE_COLOR_MAP 1");
this.properties.set("u_BaseColorUVSet", this.baseColorTexture.texCoord);
}
if (this.metallicRoughnessTexture !== undefined)
{
this.metallicRoughnessTexture.samplerName = "u_MetallicRoughnessSampler";
this.parseTextureInfoExtensions(this.metallicRoughnessTexture, "MetallicRoughness");
this.textures.push(this.metallicRoughnessTexture);
this.defines.push("HAS_METALLIC_ROUGHNESS_MAP 1");
this.properties.set("u_MetallicRoughnessUVSet", this.metallicRoughnessTexture.texCoord);
}
if (this.diffuseTexture !== undefined)
{
this.diffuseTexture.samplerName = "u_DiffuseSampler";
this.parseTextureInfoExtensions(this.diffuseTexture, "Diffuse");
this.textures.push(this.diffuseTexture);
this.defines.push("HAS_DIFFUSE_MAP 1");
this.properties.set("u_DiffuseUVSet", this.diffuseTexture.texCoord);
}
if (this.specularGlossinessTexture !== undefined)
{
this.specularGlossinessTexture.samplerName = "u_SpecularGlossinessSampler";
this.parseTextureInfoExtensions(this.specularGlossinessTexture, "SpecularGlossiness");
this.textures.push(this.specularGlossinessTexture);
this.defines.push("HAS_SPECULAR_GLOSSINESS_MAP 1");
this.properties.set("u_SpecularGlossinessUVSet", this.specularGlossinessTexture.texCoord);
}
this.defines.push("ALPHAMODE_OPAQUE 0");
this.defines.push("ALPHAMODE_MASK 1");
this.defines.push("ALPHAMODE_BLEND 2");
if(this.alphaMode === 'MASK') // only set cutoff value for mask material
{
this.defines.push("ALPHAMODE ALPHAMODE_MASK");
this.properties.set("u_AlphaCutoff", this.alphaCutoff);
}
else if (this.alphaMode === 'OPAQUE')
{
this.defines.push("ALPHAMODE ALPHAMODE_OPAQUE");
}
else
{
this.defines.push("ALPHAMODE ALPHAMODE_BLEND");
}
// if we have SG, we prefer SG (best practice) but if we have neither objects we use MR default values
if(this.type !== "SG" )
{
this.defines.push("MATERIAL_METALLICROUGHNESS 1");
this.properties.set("u_BaseColorFactor", vec4.fromValues(1, 1, 1, 1));
this.properties.set("u_MetallicFactor", 1);
this.properties.set("u_RoughnessFactor", 1);
}
if (this.pbrMetallicRoughness !== undefined && this.type !== "SG")
{
if (this.pbrMetallicRoughness.baseColorFactor !== undefined)
{
let baseColorFactor = jsToGl(this.pbrMetallicRoughness.baseColorFactor);
this.properties.set("u_BaseColorFactor", baseColorFactor);
}
if (this.pbrMetallicRoughness.metallicFactor !== undefined)
{
let metallicFactor = this.pbrMetallicRoughness.metallicFactor;
this.properties.set("u_MetallicFactor", metallicFactor);
}
if (this.pbrMetallicRoughness.roughnessFactor !== undefined)
{
let roughnessFactor = this.pbrMetallicRoughness.roughnessFactor;
this.properties.set("u_RoughnessFactor", roughnessFactor);
}
}
if (this.extensions !== undefined)
{
if (this.extensions.KHR_materials_unlit !== undefined)
{
this.defines.push("MATERIAL_UNLIT 1");
}
if (this.extensions.KHR_materials_pbrSpecularGlossiness !== undefined)
{
this.defines.push("MATERIAL_SPECULARGLOSSINESS 1");
let diffuseFactor = vec4.fromValues(1, 1, 1, 1);
let specularFactor = vec3.fromValues(1, 1, 1);
let glossinessFactor = 1;
if (this.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor !== undefined)
{
diffuseFactor = jsToGl(this.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor);
}
if (this.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor !== undefined)
{
specularFactor = jsToGl(this.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor);
}
if (this.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor !== undefined)
{
glossinessFactor = this.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor;
}
this.properties.set("u_DiffuseFactor", diffuseFactor);
this.properties.set("u_SpecularFactor", specularFactor);
this.properties.set("u_GlossinessFactor", glossinessFactor);
}
// Clearcoat is part of the default metallic-roughness shader
if(this.extensions.KHR_materials_clearcoat !== undefined)
{
let clearcoatFactor = 0.0;
let clearcoatRoughnessFactor = 0.0;
this.hasClearcoat = true;
if(this.extensions.KHR_materials_clearcoat.clearcoatFactor !== undefined)
{
clearcoatFactor = this.extensions.KHR_materials_clearcoat.clearcoatFactor;
}
if(this.extensions.KHR_materials_clearcoat.clearcoatRoughnessFactor !== undefined)
{
clearcoatRoughnessFactor = this.extensions.KHR_materials_clearcoat.clearcoatRoughnessFactor;
}
if (this.clearcoatTexture !== undefined)
{
this.clearcoatTexture.samplerName = "u_ClearcoatSampler";
this.parseTextureInfoExtensions(this.clearcoatTexture, "Clearcoat");
this.textures.push(this.clearcoatTexture);
this.defines.push("HAS_CLEARCOAT_MAP 1");
this.properties.set("u_ClearcoatUVSet", this.clearcoatTexture.texCoord);
}
if (this.clearcoatRoughnessTexture !== undefined)
{
this.clearcoatRoughnessTexture.samplerName = "u_ClearcoatRoughnessSampler";
this.parseTextureInfoExtensions(this.clearcoatRoughnessTexture, "ClearcoatRoughness");
this.textures.push(this.clearcoatRoughnessTexture);
this.defines.push("HAS_CLEARCOAT_ROUGHNESS_MAP 1");
this.properties.set("u_ClearcoatRoughnessUVSet", this.clearcoatRoughnessTexture.texCoord);
}
if (this.clearcoatNormalTexture !== undefined)
{
this.clearcoatNormalTexture.samplerName = "u_ClearcoatNormalSampler";
this.parseTextureInfoExtensions(this.clearcoatNormalTexture, "ClearcoatNormal");
this.textures.push(this.clearcoatNormalTexture);
this.defines.push("HAS_CLEARCOAT_NORMAL_MAP 1");
this.properties.set("u_ClearcoatNormalUVSet", this.clearcoatNormalTexture.texCoord);
this.properties.set("u_ClearcoatNormalScale", this.clearcoatNormalTexture.scale);
}
this.properties.set("u_ClearcoatFactor", clearcoatFactor);
this.properties.set("u_ClearcoatRoughnessFactor", clearcoatRoughnessFactor);
}
// Sheen material extension
// https://github.com/sebavan/glTF/tree/KHR_materials_sheen/extensions/2.0/Khronos/KHR_materials_sheen
if(this.extensions.KHR_materials_sheen !== undefined)
{
let sheenRoughnessFactor = 0.0;
let sheenColorFactor = vec3.fromValues(1.0, 1.0, 1.0);
this.hasSheen = true;
if(this.extensions.KHR_materials_sheen.sheenRoughnessFactor !== undefined)
{
sheenRoughnessFactor = this.extensions.KHR_materials_sheen.sheenRoughnessFactor;
}
if(this.extensions.KHR_materials_sheen.sheenColorFactor !== undefined)
{
sheenColorFactor = jsToGl(this.extensions.KHR_materials_sheen.sheenColorFactor);
}
if (this.sheenRoughnessTexture !== undefined)
{
this.sheenRoughnessTexture.samplerName = "u_sheenRoughnessSampler";
this.parseTextureInfoExtensions(this.sheenRoughnessTexture, "SheenRoughness");
this.textures.push(this.sheenRoughnessTexture);
this.defines.push("HAS_SHEEN_ROUGHNESS_MAP 1");
this.properties.set("u_SheenRoughnessUVSet", this.sheenRoughnessTexture.texCoord);
}
if (this.sheenColorTexture !== undefined)
{
this.sheenColorTexture.samplerName = "u_SheenColorSampler";
this.parseTextureInfoExtensions(this.sheenColorTexture, "SheenColor");
this.sheenColorTexture.linear = false;
this.textures.push(this.sheenColorTexture);
this.defines.push("HAS_SHEEN_COLOR_MAP 1");
this.properties.set("u_SheenColorUVSet", this.sheenColorTexture.texCoord);
}
this.properties.set("u_SheenRoughnessFactor", sheenRoughnessFactor);
this.properties.set("u_SheenColorFactor", sheenColorFactor);
}
// KHR Extension: Specular
if (this.extensions.KHR_materials_specular !== undefined)
{
this.hasSpecular = true;
if (this.specularTexture !== undefined)
{
this.specularTexture.samplerName = "u_SpecularSampler";
this.parseTextureInfoExtensions(this.specularTexture, "Specular");
this.textures.push(this.specularTexture);
this.defines.push("HAS_SPECULAR_MAP 1");
this.properties.set("u_SpecularUVSet", this.specularTexture.texCoord);
}
if (this.specularColorTexture !== undefined)
{
this.specularColorTexture.samplerName = "u_SpecularColorSampler";
this.parseTextureInfoExtensions(this.specularColorTexture, "SpecularColor");
this.specularColorTexture.linear = false;
this.textures.push(this.specularColorTexture);
this.defines.push("HAS_SPECULAR_COLOR_MAP 1");
this.properties.set("u_SpecularColorUVSet", this.specularColorTexture.texCoord);
}
let specularColorFactor = jsToGl(this.extensions.KHR_materials_specular.specularColorFactor ?? [1.0, 1.0, 1.0]);
let specularFactor = this.extensions.KHR_materials_specular.specularFactor ?? 1.0;
this.properties.set("u_KHR_materials_specular_specularColorFactor", specularColorFactor);
this.properties.set("u_KHR_materials_specular_specularFactor", specularFactor);
}
// KHR Extension: Transmission
if (this.extensions.KHR_materials_transmission !== undefined)
{
let transmissionFactor = 0.0;
this.hasTransmission = true;
if (transmissionFactor !== undefined)
{
transmissionFactor = this.extensions.KHR_materials_transmission.transmissionFactor;
}
if (this.transmissionTexture !== undefined)
{
this.transmissionTexture.samplerName = "u_TransmissionSampler";
this.parseTextureInfoExtensions(this.transmissionTexture, "Transmission");
this.textures.push(this.transmissionTexture);
this.defines.push("HAS_TRANSMISSION_MAP 1");
this.properties.set("u_TransmissionUVSet", this.transmissionTexture.texCoord);
}
this.properties.set("u_TransmissionFactor", transmissionFactor);
}
// KHR Extension: IOR
//https://github.com/DassaultSystemes-Technology/glTF/tree/KHR_materials_ior/extensions/2.0/Khronos/KHR_materials_ior
if (this.extensions.KHR_materials_ior !== undefined)
{
let ior = 1.5;
this.hasIOR = true;
if(this.extensions.KHR_materials_ior.ior !== undefined)
{
ior = this.extensions.KHR_materials_ior.ior;
}
this.properties.set("u_Ior", ior);
}
// KHR Extension: Volume
if (this.extensions.KHR_materials_volume !== undefined)
{
this.hasVolume = true;
if (this.thicknessTexture !== undefined)
{
this.thicknessTexture.samplerName = "u_ThicknessSampler";
this.parseTextureInfoExtensions(this.thicknessTexture, "Thickness");
this.textures.push(this.thicknessTexture);
this.defines.push("HAS_THICKNESS_MAP 1");
this.properties.set("u_ThicknessUVSet", this.thicknessTexture.texCoord);
}
let attenuationColor = jsToGl(this.extensions.KHR_materials_volume.attenuationColor ?? [1.0, 1.0, 1.0]);
let attenuationDistance = this.extensions.KHR_materials_volume.attenuationDistance ?? 0.0;
let thicknessFactor = this.extensions.KHR_materials_volume.thicknessFactor ?? 0.0;
this.properties.set("u_AttenuationColor", attenuationColor);
this.properties.set("u_AttenuationDistance", attenuationDistance);
this.properties.set("u_ThicknessFactor", thicknessFactor);
}
}
initGlForMembers(this, gltf, webGlContext);
}
fromJson(jsonMaterial)
{
super.fromJson(jsonMaterial);
if (jsonMaterial.emissiveFactor !== undefined)
{
this.emissiveFactor = jsToGl(jsonMaterial.emissiveFactor);
}
if (jsonMaterial.normalTexture !== undefined)
{
const normalTexture = new gltfTextureInfo();
normalTexture.fromJson(jsonMaterial.normalTexture);
this.normalTexture = normalTexture;
}
if (jsonMaterial.occlusionTexture !== undefined)
{
const occlusionTexture = new gltfTextureInfo();
occlusionTexture.fromJson(jsonMaterial.occlusionTexture);
this.occlusionTexture = occlusionTexture;
}
if (jsonMaterial.emissiveTexture !== undefined)
{
const emissiveTexture = new gltfTextureInfo(undefined, 0, false);
emissiveTexture.fromJson(jsonMaterial.emissiveTexture);
this.emissiveTexture = emissiveTexture;
}
if(jsonMaterial.extensions !== undefined)
{
this.fromJsonMaterialExtensions(jsonMaterial.extensions);
}
if (jsonMaterial.pbrMetallicRoughness !== undefined && this.type !== "SG")
{
this.type = "MR";
this.fromJsonMetallicRoughness(jsonMaterial.pbrMetallicRoughness);
}
}
fromJsonMaterialExtensions(jsonExtensions)
{
if (jsonExtensions.KHR_materials_pbrSpecularGlossiness !== undefined)
{
this.type = "SG";
this.fromJsonSpecularGlossiness(jsonExtensions.KHR_materials_pbrSpecularGlossiness);
}
if(jsonExtensions.KHR_materials_unlit !== undefined)
{
this.type = "unlit";
}
if(jsonExtensions.KHR_materials_clearcoat !== undefined)
{
this.fromJsonClearcoat(jsonExtensions.KHR_materials_clearcoat);
}
if(jsonExtensions.KHR_materials_sheen !== undefined)
{
this.fromJsonSheen(jsonExtensions.KHR_materials_sheen);
}
if(jsonExtensions.KHR_materials_transmission !== undefined)
{
this.fromJsonTransmission(jsonExtensions.KHR_materials_transmission);
}
if(jsonExtensions.KHR_materials_specular !== undefined)
{
this.fromJsonSpecular(jsonExtensions.KHR_materials_specular);
}
if(jsonExtensions.KHR_materials_volume !== undefined)
{
this.fromJsonVolume(jsonExtensions.KHR_materials_volume);
}
}
fromJsonMetallicRoughness(jsonMetallicRoughness)
{
if (jsonMetallicRoughness.baseColorTexture !== undefined)
{
const baseColorTexture = new gltfTextureInfo(undefined, 0, false);
baseColorTexture.fromJson(jsonMetallicRoughness.baseColorTexture);
this.baseColorTexture = baseColorTexture;
}
if (jsonMetallicRoughness.metallicRoughnessTexture !== undefined)
{
const metallicRoughnessTexture = new gltfTextureInfo();
metallicRoughnessTexture.fromJson(jsonMetallicRoughness.metallicRoughnessTexture);
this.metallicRoughnessTexture = metallicRoughnessTexture;
}
}
fromJsonSpecularGlossiness(jsonSpecularGlossiness)
{
if (jsonSpecularGlossiness.diffuseTexture !== undefined)
{
const diffuseTexture = new gltfTextureInfo(undefined, 0, false);
diffuseTexture.fromJson(jsonSpecularGlossiness.diffuseTexture);
this.diffuseTexture = diffuseTexture;
}
if (jsonSpecularGlossiness.specularGlossinessTexture !== undefined)
{
const specularGlossinessTexture = new gltfTextureInfo(undefined, 0, false);
specularGlossinessTexture.fromJson(jsonSpecularGlossiness.specularGlossinessTexture);
this.specularGlossinessTexture = specularGlossinessTexture;
}
}
fromJsonClearcoat(jsonClearcoat)
{
if(jsonClearcoat.clearcoatTexture !== undefined)
{
const clearcoatTexture = new gltfTextureInfo();
clearcoatTexture.fromJson(jsonClearcoat.clearcoatTexture);
this.clearcoatTexture = clearcoatTexture;
}
if(jsonClearcoat.clearcoatRoughnessTexture !== undefined)
{
const clearcoatRoughnessTexture = new gltfTextureInfo();
clearcoatRoughnessTexture.fromJson(jsonClearcoat.clearcoatRoughnessTexture);
this.clearcoatRoughnessTexture = clearcoatRoughnessTexture;
}
if(jsonClearcoat.clearcoatNormalTexture !== undefined)
{
const clearcoatNormalTexture = new gltfTextureInfo();
clearcoatNormalTexture.fromJson(jsonClearcoat.clearcoatNormalTexture);
this.clearcoatNormalTexture = clearcoatNormalTexture;
}
}
fromJsonSheen(jsonSheen)
{
if(jsonSheen.sheenColorTexture !== undefined)
{
const sheenColorTexture = new gltfTextureInfo(undefined, 0, false);
sheenColorTexture.fromJson(jsonSheen.sheenColorTexture);
this.sheenColorTexture = sheenColorTexture;
}
if(jsonSheen.sheenRoughnessTexture !== undefined)
{
const sheenRoughnessTexture = new gltfTextureInfo();
sheenRoughnessTexture.fromJson(jsonSheen.sheenRoughnessTexture);
this.sheenRoughnessTexture = sheenRoughnessTexture;
}
}
fromJsonTransmission(jsonTransmission)
{
if(jsonTransmission.transmissionTexture !== undefined)
{
const transmissionTexture = new gltfTextureInfo();
transmissionTexture.fromJson(jsonTransmission.transmissionTexture);
this.transmissionTexture = transmissionTexture;
}
}
fromJsonSpecular(jsonSpecular)
{
if(jsonSpecular.specularTexture !== undefined)
{
const specularTexture = new gltfTextureInfo();
specularTexture.fromJson(jsonSpecular.specularTexture);
this.specularTexture = specularTexture;
}
if(jsonSpecular.specularColorTexture !== undefined)
{
const specularColorTexture = new gltfTextureInfo();
specularColorTexture.fromJson(jsonSpecular.specularColorTexture);
this.specularColorTexture = specularColorTexture;
}
}
fromJsonVolume(jsonVolume)
{
if(jsonVolume.thicknessTexture !== undefined)
{
const thicknessTexture = new gltfTextureInfo();
thicknessTexture.fromJson(jsonVolume.thicknessTexture);
this.thicknessTexture = thicknessTexture;
}
}
}
export { gltfMaterial };
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.