Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @file menuItemGroup component
* @author fuqiangqiang@baidu.com
*/
import san, {DataTypes} from 'san';
import {classCreator} from '../core/util';
const prefixCls = classCreator('menu')();
export default san.defineComponent({
dataTypes: {
title: DataTypes.any
},
computed: {
// 因为menu有其他组件调用传入prefixCls,所以这里需要重新设置menu prefixCls
groupPrefixCls() {
const rootPrefixCls = this.data.get('prefixCls');
return (rootPrefixCls ? rootPrefixCls : prefixCls) + '-item-group';
}
},
initData() {
return {
inlineIndent: 24
};
},
* 是否完全展开所有节点,默认只展开根节点
*
* @default false
*/
expandAll: DataTypes.bool,
/**
* 是否支持多选
*
* @default false
*/
multi: DataTypes.bool,
/**
* 如果multi等于true,表示选中的节点集合
* 如果multi等于false,则表示最近点击的叶子节点
*/
value: DataTypes.any,
/**
* 是否支持编辑(增删改)
*
* @default false
*/
edit: DataTypes.bool
},
deleteNode(node) {
const datasource = this.data.get('datasource');
if (node.level === 0) {
// 整个树都删掉
this.data.set('datasource', {});
}
else {
let parentNodeKey = getParentKeyByNode(datasource, node);
const tempNode = this.data.get(`${parentNodeKey}`);
export default san.defineComponent({
components: {
's-icon': Icon,
's-checkbox': Checkbox,
's-tree-node': 'self'
},
dataTypes: {
disableCheckbox: DataTypes.bool,
disabled: DataTypes.bool,
icon: DataTypes.any,
isLeaf: DataTypes.bool,
key: DataTypes.string,
selectable: DataTypes.bool,
title: DataTypes.any
},
initData() {
return {
selectable: true,
disabled: false,
loading: false,
hasTitle: true
};
},
computed: {
selected() {
return getComputedKeys(this.data.get('selectedKeys'), this.data.get('key'));
},
top: DataTypes.string,
/**
* 宽度,`expandTo`为 `left|right` 时候有效
* @default 400px
*/
width: DataTypes.string,
/**
* 高度,`expandTo`为 `top|bottom` 时候有效
* @default 400px
*/
height: DataTypes.string,
/**
* 传递给业务组件的参数
* @default {}
*/
payload: DataTypes.any,
/**
* 是否打开
* @default false
*/
expand: DataTypes.bool,
/**
* 展开方式 top|bottom|left|right
* @default right
*/
expandTo: DataTypes.string,
/**
* 文本标题
* @default ''
*/
title: DataTypes.string
},
`
});
export default san.defineComponent({
components: {
's-icon': Icon,
's-tree-node': 'self'
},
dataTypes: {
disableCheckbox: DataTypes.bool,
disabled: DataTypes.bool,
icon: DataTypes.any,
isLeaf: DataTypes.bool,
key: DataTypes.string,
selectable: DataTypes.bool,
title: DataTypes.any
},
computed: {
isLeaf2() {
const isLeaf = this.data.get('isLeaf');
const loadData = this.data.get('treeData.loadData');
const hasChildren = this.data.get('hasChildren');
if (isLeaf === false) {
return false;
}
const res = isLeaf || (!loadData && !hasChildren);
return res;
},
itemClass() {
const expandedKeys = this.data.get('treeData.expandedKeys');
const selectedKeys = this.data.get('treeData.selectedKeys');
const checkedKeys = this.data.get('treeData.checkedKeys');
adjustX: 0,
adjustY: 1
}
}
};
export default san.defineComponent({
dataTypes: {
showArrow: DataTypes.bool,
loading: DataTypes.bool,
defaultActiveFirstOption: DataTypes.bool,
disabled: DataTypes.bool,
maxTagCount: DataTypes.number,
autoClearSearchValue: DataTypes.bool,
dropdownClassName: DataTypes.string,
maxTagPlaceholder: DataTypes.any,
mode: DataTypes.string,
notFoundContent: DataTypes.oneOfType([DataTypes.string, DataTypes.func]),
labelInValue: DataTypes.bool,
dropdownStyle: DataTypes.object,
disabled: DataTypes.bool,
defaultValue: DataTypes.any,
autoFocus: DataTypes.bool,
dropdownMatchSelectWidth: DataTypes.bool,
optionFilterProp: DataTypes.string,
placeholder: DataTypes.string,
showSearch: DataTypes.bool,
size: DataTypes.oneOf(['default', 'small', 'large']),
clearIcon: DataTypes.func,
suffixIcon: DataTypes.func,
tokenSeparators: DataTypes.array,
defaultOpen: DataTypes.bool,
/**
* @file menuItemGroup component
* @author fuqiangqiang@baidu.com
*/
import san, {DataTypes} from 'san';
import {classCreator} from '../core/util';
const prefixCls = classCreator('menu-item-group')();
export default san.defineComponent({
dataTypes: {
title: DataTypes.any
},
computed: {
styles() {
const inlineIndent = this.data.get('inlineIndent');
if (this.data.get('mode') === 'inline' && !this.data.get('inlineCollapsed')) {
const levels = this.data.get('level');
return {'padding-left': inlineIndent + levels * inlineIndent + 'px'};
}
},
newTitle() {
const title = this.data.get('title');
if (typeof title === 'string') {
return title;
}
return '';
},
import san, {DataTypes} from 'san';
import button from '../button';
export default san.defineComponent({
template: `
<template>
</template>
`,
dataTypes: {
actionFn: DataTypes.any,
autoFocus: DataTypes.bool,
buttonProps: DataTypes.object,
closeModal: DataTypes.func,
loading: DataTypes.bool,
type: DataTypes.string
},
components: {
's-button': button
},
initData() {
return {
loading: false
};
},
attached() {
const buttonNode = this.ref('button').el;
let tmpCount = 0;
export default san.defineComponent({
dataTypes: {
allowClear: DataTypes.bool,
treeData: DataTypes.array,
autoClearSearchValue: DataTypes.bool,
defaultValue: DataTypes.oneOfType([DataTypes.string, DataTypes.array]),
disabled: DataTypes.bool,
dropdownClassName: DataTypes.string,
dropdownMatchSelectWidth: DataTypes.bool,
dropdownStyle: DataTypes.object,
filterTreeNode: DataTypes.func,
labelInValue: DataTypes.bool,
maxTagCount: DataTypes.number,
maxTagPlaceholder: DataTypes.any,
multiple: DataTypes.bool,
placeholder: DataTypes.string,
searchPlaceholder: DataTypes.string,
searchValue: DataTypes.string,
treeIcon: DataTypes.bool,
showSearch: DataTypes.bool,
size: DataTypes.oneOf(['default', 'small', 'large']),
treeCheckable: DataTypes.bool,
treeCheckStrictly: DataTypes.bool,
treeDefaultExpandAll: DataTypes.bool,
treeDefaultExpandedKeys: DataTypes.array,
treeExpandedKeys: DataTypes.array,
value: DataTypes.oneOfType([DataTypes.string, DataTypes.array])
},
components: {
's-icon': Icon,
{{okText || (okCancel ? locale.okText : locale.justOkText)}}
`,
dataTypes: {
actionFn: DataTypes.any
},
components: {
'content-loader': contentLoader,
's-button': ActionButton,
's-dialog': Dialog,
's-icon': icon
},
afterClose() {
const afterCloseFn = this.data.get('afterClose');
'function' === typeof afterCloseFn && afterCloseFn();
},
computed: {
contentIsComponent() {
const content = this.data.get('content');
return isValidComponent(content);
}