Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @file Santd trigger popup file
* @author mayihui@baidu.com
**/
import san, {DataTypes} from 'san';
import Animate from '../../core/util/animate';
import PopupInner from './popupInner';
export default san.defineComponent({
dataTypes: {
visible: DataTypes.bool,
getClassNameFromAlign: DataTypes.func,
align: DataTypes.object,
destroyPopupOnHide: DataTypes.bool,
prefixCls: DataTypes.string,
point: DataTypes.object
},
inited() {
const destroyPopupOnHide = this.data.get('destroyPopupOnHide');
this.data.set('destroy', true);
this.watch('visible', val => {
if (!val) {
this.data.set('currentAlignClassName', '');
// 这里先简单的设置一个timeout来保证动画结束后且destroyPopupOnHide为true时删除popup子节点
window.setTimeout(() => {
this.data.set('destroy', !destroyPopupOnHide);
}, 500);
}
else {
* @author mayihui@baidu.com
**/
import san, {DataTypes} from 'san';
import Steps from './steps';
import Marks from './marks';
import Handle from '../handle';
import * as utils from '../utils';
import inherits from '../../../core/util/inherits';
export default san.defineComponent({
dataTypes: {
min: DataTypes.number,
max: DataTypes.number,
step: DataTypes.number,
marks: DataTypes.object,
included: DataTypes.bool,
className: DataTypes.string,
prefixCls: DataTypes.string,
disabled: DataTypes.bool,
handle: DataTypes.func,
dots: DataTypes.bool,
vertical: DataTypes.bool,
style: DataTypes.object,
handleStyle: DataTypes.oneOfType([DataTypes.object, DataTypes.array]),
trackStyle: DataTypes.oneOfType([DataTypes.object, DataTypes.array]),
railStyle: DataTypes.object,
dotStyle: DataTypes.object,
activeDotStyle: DataTypes.object,
autoFocus: DataTypes.bool
},
initData() {
/**
* @file Santd calendar today button file
* @author mayihui@baidu.com
**/
import san, {DataTypes} from 'san';
import {getTodayTimeStr, getTodayTime, isAllowedDate} from '../util/index';
export default san.defineComponent({
dataTypes: {
prefixCls: DataTypes.string,
value: DataTypes.object,
locale: DataTypes.object,
disabledDate: DataTypes.func,
text: DataTypes.string
},
computed: {
disabledToday() {
const value = this.data.get('value');
const disabledDate = this.data.get('disabledDate');
return disabledDate && !isAllowedDate(getTodayTime(value), disabledDate);
},
localeNow() {
const text = this.data.get('text');
const showTime = this.data.get('showTime');
const locale = this.data.get('locale');
return (!text && showTime ? locale.now : text) || locale.today;
* @author mayihui@baidu.com
**/
import san, {DataTypes} from 'san';
import TodayButton from './todayButton';
import OkButton from './okButton';
import TimepickerButton from './timepickerButton';
export default san.defineComponent({
dataTypes: {
prefixCls: DataTypes.string,
showDateInput: DataTypes.bool,
disabledDate: DataTypes.func,
disabledTime: DataTypes.func,
selectedValue: DataTypes.object,
value: DataTypes.object,
mode: DataTypes.string,
defaultValue: DataTypes.object
},
components: {
's-todaybutton': TodayButton,
's-okbutton': OkButton,
's-timepickerbutton': TimepickerButton
},
handleOk() {
this.fire('ok');
},
handleToday() {
this.fire('today');
},
handleCloseTimePicker() {
this.fire('closeTimePicker');
* @author raowenjuan
*/
import './style/index.less';
import san, {DataTypes} from 'san';
import Icon from '../icon';
import Nav from './nav';
import {classCreator} from '../core/util';
const prefixCls = classCreator('suggestions')();
const prefixDropCls = classCreator('dropdown')();
export default san.defineComponent({
dataTypes: {
placement: DataTypes.string,
position: DataTypes.object,
isShowSug: DataTypes.bool,
loading: DataTypes.bool
},
components: {
's-icon': Icon,
's-nav': Nav
},
computed: {
innerStyle() {
const isShowSug = this.data.get('isShowSug');
const position = this.data.get('position');
const isTop = this.data.get('placement') === 'top';
return {
display: isShowSug ? 'block' : 'none',
left: `${position.left}px`,
top: isTop ? 'auto' : `${position.top + position.height}px`,
/**
* @file Santd calendar year panel file
* @author mayihui@baidu.com
**/
import san, {DataTypes} from 'san';
import YearTable from './yearTable';
export default san.defineComponent({
dataTypes: {
rootPrefixCls: DataTypes.string,
value: DataTypes.object,
defaultValue: DataTypes.object,
renderFooter: DataTypes.func
},
inited() {
const value = this.data.get('value');
const defaultValue = this.data.get('defaultValue');
this.data.set('value', value || defaultValue);
this.data.set('instance', this);
},
computed: {
prefixCls() {
const rootPrefixCls = this.data.get('rootPrefixCls');
return rootPrefixCls + '-year-panel';
},
startYear() {
return cx.mainClass(this);
}
},
initData() {
return {
error: null,
value: null,
label: '开始',
url: 'https://sp3.baidu.com/6qUDsjip0QIZ8tyhnq/echo.fcgi'
};
},
dataTypes: {
/**
* 错误状态
*/
error: DataTypes.object,
/**
* 识别的结果
* <pre><code>{
* text: string,
* corpus_no?: string
* }</code></pre>
*/
value: DataTypes.object,
/**
* 按钮上的文字
* @default 开始
*/
label: DataTypes.string,
}
if (node.children) {
const children = flatFilter(node.children, callback);
acc.push(...children);
}
return acc;
}, []);
};
export default san.defineComponent({
dataTypes: {
dataSource: DataTypes.array,
columns: DataTypes.array,
prefixCls: DataTypes.string,
useFixedHeader: DataTypes.bool,
rowSelection: DataTypes.object,
className: DataTypes.string,
size: DataTypes.string,
loading: DataTypes.bool,
bordered: DataTypes.bool,
locale: DataTypes.object,
dropdownPrefixCls: DataTypes.string,
sortDirections: DataTypes.array,
pagination: DataTypes.object
},
initData() {
return {
dataSource: [],
prefixCls: prefixCls,
useFixedHeader: false,
className: '',
size: 'default',
let AutoComplete = san.defineComponent({
components: {
's-select': Select,
's-select-option': Select.Option
},
dataTypes: {
allowClear: DataTypes.bool,
autoFocus: DataTypes.bool,
backfill: DataTypes.bool,
dataSource: DataTypes.array,
defaultValue: DataTypes.array,
disabled: DataTypes.bool,
filterOption: DataTypes.oneOfType([DataTypes.bool, DataTypes.func]),
placeholder: DataTypes.string,
value: DataTypes.oneOfType([DataTypes.string, DataTypes.object, DataTypes.array]),
defaultOpen: DataTypes.bool,
open: DataTypes.bool
},
onSearch(value) {
this.fire('search', value);
},
onSelect(value) {
this.fire('select', value);
},
onChange(value) {
this.fire('change', value);
this.dispatch('UI:form-item-interact', {fieldValue: value, type: 'change'});
},
/**
* @file select 头部分
* @author fuqiangqiang@baidu.com
*/
import san, {DataTypes} from 'san';
import {classCreator} from '../core/util';
import KEYCODE from '../core/util/keyCode';
import Icon from '../icon';
const prefixCls = classCreator('select')();
const SingleHeadComponent = san.defineComponent({
dataTypes: {
hideTag: DataTypes.bool,
allData: DataTypes.object
},
computed: {
opacityStyle() {
const isShow = this.data.get('allData._open');
const hideTag = this.data.get('hideTag');
const showSearch = this.data.get('allData.showSearch');
return {
opacity: hideTag ? '0' : (isShow && showSearch ? '0.4' : '1')
};
},
sigleSearch() {
return [`${prefixCls}-search`, `${prefixCls}-search--inline`];
},
sigleSearchStyle() {
const isOpen = this.data.get('allData._open');
return {