forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3016387
commit 6800909
Showing
708 changed files
with
40,380 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare function getComponentLocale(props: any, context: any, componentName: any, getDefaultLocale: any): any; | ||
export declare function getLocaleCode(context: any): any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
|
||
var _extends3 = _interopRequireDefault(_extends2); | ||
|
||
exports.getComponentLocale = getComponentLocale; | ||
exports.getLocaleCode = getLocaleCode; | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
function getComponentLocale(props, context, componentName, getDefaultLocale) { | ||
var locale = {}; | ||
if (context && context.antLocale && context.antLocale[componentName]) { | ||
locale = context.antLocale[componentName]; | ||
} else { | ||
var defaultLocale = getDefaultLocale(); | ||
// TODO: make default lang of antd be English | ||
// https://github.com/ant-design/ant-design/issues/6334 | ||
locale = defaultLocale['default'] || defaultLocale; | ||
} | ||
var result = (0, _extends3['default'])({}, locale, props.locale); | ||
result.lang = (0, _extends3['default'])({}, locale.lang, props.locale.lang); | ||
return result; | ||
} | ||
function getLocaleCode(context) { | ||
var localeCode = context.antLocale && context.antLocale.locale; | ||
// Had use LocaleProvide but didn't set locale | ||
if (context.antLocale && context.antLocale.exist && !localeCode) { | ||
return 'zh-cn'; | ||
} | ||
return localeCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default function getRequestAnimationFrame(): any; | ||
export declare function cancelRequestAnimationFrame(id: any): any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = getRequestAnimationFrame; | ||
exports.cancelRequestAnimationFrame = cancelRequestAnimationFrame; | ||
var availablePrefixs = ['moz', 'ms', 'webkit']; | ||
function requestAnimationFramePolyfill() { | ||
var lastTime = 0; | ||
return function (callback) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = window.setTimeout(function () { | ||
callback(currTime + timeToCall); | ||
}, timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
} | ||
function getRequestAnimationFrame() { | ||
if (typeof window === 'undefined') { | ||
return function () {}; | ||
} | ||
if (window.requestAnimationFrame) { | ||
// https://github.com/vuejs/vue/issues/4465 | ||
return window.requestAnimationFrame.bind(window); | ||
} | ||
var prefix = availablePrefixs.filter(function (key) { | ||
return key + 'RequestAnimationFrame' in window; | ||
})[0]; | ||
return prefix ? window[prefix + 'RequestAnimationFrame'] : requestAnimationFramePolyfill(); | ||
} | ||
function cancelRequestAnimationFrame(id) { | ||
if (typeof window === 'undefined') { | ||
return null; | ||
} | ||
if (window.cancelAnimationFrame) { | ||
return window.cancelAnimationFrame(id); | ||
} | ||
var prefix = availablePrefixs.filter(function (key) { | ||
return key + 'CancelAnimationFrame' in window || key + 'CancelRequestAnimationFrame' in window; | ||
})[0]; | ||
return prefix ? (window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame']).call(this, id) : clearTimeout(id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default function getScroll(target: any, top: any): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = getScroll; | ||
function getScroll(target, top) { | ||
if (typeof window === 'undefined') { | ||
return 0; | ||
} | ||
var prop = top ? 'pageYOffset' : 'pageXOffset'; | ||
var method = top ? 'scrollTop' : 'scrollLeft'; | ||
var isWindow = target === window; | ||
var ret = isWindow ? target[prop] : target[method]; | ||
// ie6,7,8 standard mode | ||
if (isWindow && typeof ret !== 'number') { | ||
ret = window.document.documentElement[method]; | ||
} | ||
return ret; | ||
} | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare function isCssAnimationSupported(): any; | ||
export default isCssAnimationSupported; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var animation = void 0; | ||
function isCssAnimationSupported() { | ||
if (animation !== undefined) { | ||
return animation; | ||
} | ||
var domPrefixes = 'Webkit Moz O ms Khtml'.split(' '); | ||
var elm = document.createElement('div'); | ||
if (elm.style.animationName !== undefined) { | ||
animation = true; | ||
} | ||
if (animation !== undefined) { | ||
for (var i = 0; i < domPrefixes.length; i++) { | ||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) { | ||
animation = true; | ||
break; | ||
} | ||
} | ||
} | ||
animation = animation || false; | ||
return animation; | ||
} | ||
exports['default'] = isCssAnimationSupported; | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default function isFlexSupported(): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = isFlexSupported; | ||
function isFlexSupported() { | ||
if (typeof window !== 'undefined' && window.document && window.document.documentElement) { | ||
var documentElement = window.document.documentElement; | ||
|
||
return 'flex' in documentElement.style || 'webkitFlex' in documentElement.style || 'Flex' in documentElement.style || 'msFlex' in documentElement.style; | ||
} | ||
return false; | ||
} | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare const animation: { | ||
enter(node: any, done: any): any; | ||
leave(node: any, done: any): any; | ||
appear(node: any, done: any): any; | ||
}; | ||
export default animation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _cssAnimation = require('css-animation'); | ||
|
||
var _cssAnimation2 = _interopRequireDefault(_cssAnimation); | ||
|
||
var _getRequestAnimationFrame = require('./getRequestAnimationFrame'); | ||
|
||
var _getRequestAnimationFrame2 = _interopRequireDefault(_getRequestAnimationFrame); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var reqAnimFrame = (0, _getRequestAnimationFrame2['default'])(); | ||
function animate(node, show, done) { | ||
var height = void 0; | ||
var requestAnimationFrameId = void 0; | ||
return (0, _cssAnimation2['default'])(node, 'ant-motion-collapse', { | ||
start: function start() { | ||
if (!show) { | ||
node.style.height = node.offsetHeight + 'px'; | ||
node.style.opacity = 1; | ||
} else { | ||
height = node.offsetHeight; | ||
node.style.height = 0; | ||
node.style.opacity = 0; | ||
} | ||
}, | ||
active: function active() { | ||
if (requestAnimationFrameId) { | ||
(0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); | ||
} | ||
requestAnimationFrameId = reqAnimFrame(function () { | ||
node.style.height = (show ? height : 0) + 'px'; | ||
node.style.opacity = show ? 1 : 0; | ||
}); | ||
}, | ||
end: function end() { | ||
if (requestAnimationFrameId) { | ||
(0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); | ||
} | ||
node.style.height = ''; | ||
node.style.opacity = ''; | ||
done(); | ||
} | ||
}); | ||
} | ||
var animation = { | ||
enter: function enter(node, done) { | ||
return animate(node, true, done); | ||
}, | ||
leave: function leave(node, done) { | ||
return animate(node, false, done); | ||
}, | ||
appear: function appear(node, done) { | ||
return animate(node, true, done); | ||
} | ||
}; | ||
exports['default'] = animation; | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function throttleByAnimationFrame(fn: any): (...args: any[]) => void; | ||
export declare function throttleByAnimationFrameDecorator(): (target: any, key: any, descriptor: any) => { | ||
configurable: boolean; | ||
get(): any; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
|
||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
|
||
exports['default'] = throttleByAnimationFrame; | ||
exports.throttleByAnimationFrameDecorator = throttleByAnimationFrameDecorator; | ||
|
||
var _getRequestAnimationFrame = require('../_util/getRequestAnimationFrame'); | ||
|
||
var _getRequestAnimationFrame2 = _interopRequireDefault(_getRequestAnimationFrame); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var reqAnimFrame = (0, _getRequestAnimationFrame2['default'])(); | ||
function throttleByAnimationFrame(fn) { | ||
var requestId = void 0; | ||
var later = function later(args) { | ||
return function () { | ||
requestId = null; | ||
fn.apply(undefined, (0, _toConsumableArray3['default'])(args)); | ||
}; | ||
}; | ||
var throttled = function throttled() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
|
||
if (requestId == null) { | ||
requestId = reqAnimFrame(later(args)); | ||
} | ||
}; | ||
throttled.cancel = function () { | ||
return (0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestId); | ||
}; | ||
return throttled; | ||
} | ||
function throttleByAnimationFrameDecorator() { | ||
return function (target, key, descriptor) { | ||
var fn = descriptor.value; | ||
var definingProperty = false; | ||
return { | ||
configurable: true, | ||
get: function get() { | ||
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) { | ||
return fn; | ||
} | ||
var boundFn = throttleByAnimationFrame(fn.bind(this)); | ||
definingProperty = true; | ||
Object.defineProperty(this, key, { | ||
value: boundFn, | ||
configurable: true, | ||
writable: true | ||
}); | ||
definingProperty = false; | ||
return boundFn; | ||
} | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default function triggerEvent(el: any, type: any): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = triggerEvent; | ||
function triggerEvent(el, type) { | ||
if ('createEvent' in document) { | ||
// modern browsers, IE9+ | ||
var e = document.createEvent('HTMLEvents'); | ||
e.initEvent(type, false, true); | ||
el.dispatchEvent(e); | ||
} | ||
} | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: (valid: boolean, message: string) => void; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _warning = require('warning'); | ||
|
||
var _warning2 = _interopRequireDefault(_warning); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var warned = {}; | ||
|
||
exports['default'] = function (valid, message) { | ||
if (!valid && !warned[message]) { | ||
(0, _warning2['default'])(false, message); | ||
warned[message] = true; | ||
} | ||
}; | ||
|
||
module.exports = exports['default']; |
Oops, something went wrong.