Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const prefixCls = classCreator('modal')();
const contentPrefixCls = `${prefixCls}-confirm`;
// 判断是否SanComponent, 可能会随着san的版本迭代变更,参考依据如下:
// https://github.com/baidu/san/blob/36085399ab3d84df3ff8b741bb2f57c483b59acb/src/view/node-type.js
// https://github.com/baidu/san/blob/9a7cd2e74ecd4f307afd1733aa5b745707edc0c9/src/view/component.js#L278
// 改成使用传统方式判断 by erik at 2019-10-03
function isValidComponent(content) {
return content && content.prototype instanceof san.Component;
}
// 动态加载content组件
let contentFun;
const contentLoader = san.createComponentLoader(() => new Promise((resolve, reject) => {
contentFun = {resolve, reject};
}));
export default san.defineComponent({
template: `<template>
</template>
const contentPrefixCls = `${prefixCls}-confirm`;
// 判断是否SanComponent, 可能会随着san的版本迭代变更,参考依据如下:
// https://github.com/baidu/san/blob/36085399ab3d84df3ff8b741bb2f57c483b59acb/src/view/node-type.js
// https://github.com/baidu/san/blob/9a7cd2e74ecd4f307afd1733aa5b745707edc0c9/src/view/component.js#L278
function isValidComponent(content) {
if (typeof content === 'function' && 5 === content.prototype.nodeType) {
return true;
}
return false;
}
// 动态加载content组件
let contentFun;
const contentLoader = san.createComponentLoader(() => new Promise((resolve, reject) => {
contentFun = {resolve, reject};
}));
export default inherits(san.defineComponent({
template: `<template>
</template>
<span class="san-spin-dot san-spin-dot-spin">
<i>
<i>
<i>
<i>
</i></i></i></i></span><i><i><i>
`
});
const SpinTip = san.defineComponent({
template: `
<div class="${prefixCls}-text">{{tip}}</div>
`
});
const IndicatorLoader = san.createComponentLoader(() => {
const promise = new Promise(resolve => {
resolve(isValidComponent(defaultIndicator) ? defaultIndicator : SpinDot);
});
return promise;
});
const Spin = san.defineComponent({
template: `
<div class="{{nestedClassName || spinClassName}}">
<div>
<div class="{{spinClassName}}">
</div></div></div></i></i></i>
return false;
}
const SpinDot = san.defineComponent({
template: `
<span class="${prefixCls}-dot ${prefixCls}-dot-spin">
<i>
<i>
<i>
<i>
</i></i></i></i></span><i><i><i>
`
});
const IndicatorLoader = san.createComponentLoader(() => {
const promise = new Promise(resolve => {
resolve(isValidComponent(defaultIndicator) ? defaultIndicator : SpinDot);
});
return promise;
});
const Spin = san.defineComponent({
template: `
<div class="{{hasContent ? '${prefixCls}-nested-loading ' + (wrapperClassName ? wrapperClassName : '') : spinClasses}}">
<div>
<div class="{{spinClasses}}">
</div></div></div></i></i></i>