How to use the san.DataTypes.oneOf function in san

To help you get started, we’ve selected a few san examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ecomfe / san-xui / src / x / components / Clipboard.js View on Github external
tipPosition: 's', // 'n', 'e', 's', 'w'
            text: null
        };
    },
    dataTypes: {
        /**
         * Tip的文案
         * @default 复制到剪贴板
         */
        ariaLabel: DataTypes.string,

        /**
         * Tip展示的位置
         * @default s
         */
        tipPosition: DataTypes.oneOf(['n', 'e', 's', 'w']),

        /**
         * 需要复制的内容
         */
        text: DataTypes.string.isRequired
    },
    detached() {
        this.client.destroy();
    },
    attached() {
        this.client = new XClipboard(this.el, {
            action: () => 'copy',                   // eslint-disable-line
            text: () => this.data.get('text')       // eslint-disable-line
        });
        this.client.on('beforecopy', () => this.fire('beforecopy'));
        this.client.on('success', () => {
github ecomfe / santd / src / radio / group.js View on Github external
/**
 * @file Santd radio group file
 * @author mayihui@baidu.com
 **/

import san, {DataTypes} from 'san';
import {classCreator} from '../core/util';
import Radio from './radio';

const prefixCls = classCreator('radio')();

export default san.defineComponent({
    DataTypes: {
        defaultValue: DataTypes.oneOf([DataTypes.string, DataTypes.number]),
        value: DataTypes.oneOf([DataTypes.string, DataTypes.number]),
        options: DataTypes.array,
        disabled: DataTypes.bool,
        name: DataTypes.string
    },

    components: {
        's-radio': Radio
    },

    initData() {
        return {
            buttonStyle: 'outline',
            options: [],
            disabled: false
        };
github ecomfe / santd / src / select / select.js View on Github external
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,
        open: DataTypes.bool
    },
    components: {
        's-head': Header,
        's-icon': Icon,
        's-create-menu': CreateMenu,
        's-trigger': Trigger
    },
    computed: {
        classes() {
            const open = this.data.get('createdData._open');
            const disabled = this.data.get('disabled');
github ecomfe / santd / src / progress / index.js View on Github external
return 0;
    }
    if (progress > 100) {
        return 100;
    }
    return progress;
};

const statusColorMap = {
    normal: '#108ee9',
    exception: '#ff5500',
    success: '#87d068'
};

export const ProgressType = DataTypes.oneOf(['line', 'circle', 'dashboard']);
export const ProgressSize = DataTypes.oneOf(['default', 'small']);

const ProgressInfo = san.defineComponent({
    template: `
        <span title="{{text}}" class="${prefixCls}-text">
            {{text}}
            
        </span>
    `,
    components: {
        's-icon': Icon
    }
});

const ProgressCirle = san.defineComponent({
    template: `
github ecomfe / san-mui / src / InputNumber / InputNumber.js View on Github external
min: -Number.MAX_VALUE,
            size: 'normal',
            step: 1,
            preVal: ''

        };
    }

    static dataTypes = {
        plusIcon: DataTypes.string,
        minusIcon: DataTypes.string,
        disabled: DataTypes.bool,
        value: DataTypes.string,
        max: DataTypes.number,
        min: DataTypes.number,
        size: DataTypes.oneOf(['small', 'normal', 'large']),
        step: DataTypes.number
    };

    attached() {
        this.data.set('preVal', this.data.get('value'));
        this.watch('value', function (value) {
            let newVal = Number(value);
            if (isNaN(newVal)) {
                return;
            }
            let max = this.data.get('max');
            let min = this.data.get('min');
            if (newVal &gt;= max) {
                newVal = max;
            }
            if (newVal &lt;= min) {
github ecomfe / san-mui / src / Table / TR.js View on Github external
static computed = {
        checked() {
            let selected = this.data.get('selected');
            let tableSelectable = this.data.get('tableSelectable');
            switch (tableSelectable) {
                case 'single':
                    return selected ? 'ON' : '';
                case 'multi':
                    return selected ? ['ON'] : [];
            }
        }
    };

    static dataTypes = {
        selected: DataTypes.bool,
        pos: DataTypes.oneOf(['tbody', 'thead', 'tfoot'])
    };

    initData() {
        return {
            pos: 'tbody',
            selected: false
        };
    }

    inited() {
        this.dispatch('UI:tr-inited');
    }

    /**
     * 选中
     *
github ecomfe / santd / src / select / Select.js View on Github external
dropdownClassName: DataTypes.string,
        dropdownMatchSelectWidth: DataTypes.bool,
        dropdownRender: DataTypes.func,
        dropdownStyle: DataTypes.object,
        dropdownMenuStyle: DataTypes.object,
        filterOption: DataTypes.oneOfType([
            DataTypes.bool,
            DataTypes.func
        ]),
        firstActiveValue: DataTypes.bool,
        getPopupContainer: DataTypes.func,
        labelInValue: DataTypes.bool,
        maxTagCount: DataTypes.number,
        maxTagTextLength: DataTypes.number,
        maxTagPlaceholder: DataTypes.func,
        mode: DataTypes.oneOf([
            'default',
            'multiple',
            'tags',
            'combobox',
            SECRET_COMBOBOX_MODE_DO_NOT_USE
        ]),
        notFoundContent: DataTypes.string,
        optionFilterProp: DataTypes.string,
        optionLabelProp: DataTypes.string,
        placeholder: DataTypes.string,
        showArrow: DataTypes.bool,
        showSearch: DataTypes.bool,
        size: DataTypes.oneOf([
            'default',
            'large',
            'small'
github ecomfe / santd / santd / tabs / src / scrollableTabBarNode.js View on Github external
/**
 * @file Santd tabs scrollable tab bar node file
 * @author mayihui@baidu.com
 **/

import san, {DataTypes} from 'san';
import debounce from 'lodash/debounce';
import ResizeObserver from 'resize-observer-polyfill';
import {setTransform, isTransform3dSupported} from './utils';
import Icon from '../../icon';

export default san.defineComponent({
    dataTypes: {
        prefixCls: DataTypes.string,
        className: DataTypes.string,
        tabBarPosition: DataTypes.oneOf(['left', 'right', 'top', 'bottom']),
        activeKey: DataTypes.string,
        scrollAnimated: DataTypes.bool
    },
    initData() {
        return {
            prefixCls: '',
            className: '',
            tabBarPosition: 'left',
            scrollAnimated: true,
            next: false,
            prev: false,
            offset: 0
        };
    },
    computed: {
        classes() {
github baidu / san-devtool / src / panel / components / TreeView / TreeView.js View on Github external
initiallyOpen="{{initiallyOpen}}"
                    dataSource="JSON"
                &gt;
                
            
        
    `,

    dataTypes: {
        compact: DataTypes.bool,
        wholeLineSelected: DataTypes.bool,
        keepingSelected: DataTypes.bool,
        defaultSelectedIdentity: DataTypes.string,
        filterBar: DataTypes.bool,
        filterBarHintText: DataTypes.string,
        dataSource: DataTypes.oneOf(['ATTRIBUTE', 'JSON']),
        highlighted: DataTypes.bool,
        treeData: DataTypes.arrayOf(DataTypes.object),
        loading: DataTypes.bool,
        loadingToast: DataTypes.string,
        loadingAsync: DataTypes.bool,
        progress: DataTypes.number
    },

    components: {
        'san-icon': Icon,
        'san-text-field': TextField,
        'san-tree-view-item': TreeViewItem,
    },

    inited() {
    },
github ecomfe / santd / santd / tabs / index.js View on Github external
's-icon': Icon
    },
    template: `<span class="{{prefixCls}}-tab-next-icon">
        
    </span>`
});

const Tabs = san.defineComponent({
    dataTypes: {
        activeKey: DataTypes.string,
        defaultActiveKey: DataTypes.string,
        hideAdd: DataTypes.bool,
        tabBarStyle: DataTypes.oneOfType([DataTypes.string, DataTypes.object]),
        type: DataTypes.oneOf(['line', 'card', 'editable-card']),
        tabPosition: DataTypes.oneOf(['top', 'right', 'bottom', 'left']),
        size: DataTypes.oneOf(['large', 'default', 'small']),
        style: DataTypes.oneOfType([DataTypes.string, DataTypes.object]),
        prefixCls: DataTypes.string,
        className: DataTypes.string,
        animated: DataTypes.oneOfType([DataTypes.bool, DataTypes.object]),
        tabBarGutter: DataTypes.number,
        renderTabBar: DataTypes.func,
        renderTabContent: DataTypes.func,
        tabBarExtraContent: DataTypes.func
    },
    initData() {
        return {
            type: 'line',
            hideAdd: false,
            tabPosition: 'top',
            prefixCls: prefixCls,
            defaultRenderTabBar() {