How to use the san.DataTypes.array 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 / santd / santd / core / trigger / index.js View on Github external
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
    const points = align.points;
    for (const placement in builtinPlacements) {
        if (builtinPlacements.hasOwnProperty(placement)) {
            if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
                return `${prefixCls}-placement-${placement}`;
            }
        }
    }
    return '';
}

export default san.defineComponent({
    dataTypes: {
        action: DataTypes.oneOfType([DataTypes.string, DataTypes.array]),
        showAction: DataTypes.array,
        hideAction: DataTypes.array,
        getPopupClassNameFromAlign: DataTypes.func,
        popup: DataTypes.func, // 必须是san组件
        popupStyle: DataTypes.oneOfType([DataTypes.string, DataTypes.object]),
        prefixCls: DataTypes.string,
        popupClassName: DataTypes.string,
        className: DataTypes.string,
        popupPlacement: DataTypes.string,
        builtinPlacements: DataTypes.object,
        popupTransitionName: DataTypes.oneOfType([DataTypes.string, DataTypes.object]),
        popupAnimation: DataTypes.object,
        mouseEnterDelay: DataTypes.number,
        mouseLeaveDelay: DataTypes.number,
        zIndex: DataTypes.number,
        focusDelay: DataTypes.number,
        blurDelay: DataTypes.number,
github ecomfe / san-xui / src / x / components / MultiPicker.js View on Github external
*/
        disabled: DataTypes.bool,

        /**
         * MultiPicker 组件的数据源,不一定是完整的,可以通过 loader 逐步填充
         * <pre><code>{
         *   text: string,
         *   value: any,
         *   disabled?: bool, // 是否禁止选择当前项
         *   expandable?: bool, // 如果是 true,说明可以继续展开
         *   children?: any[] // 如果可以展开,那么子节点的内容(可以是 loader 动态返回的)
         * }
         * </code></pre>
         * @default []
         */
        datasource: DataTypes.array,

        /**
         * 如果需要异步的加载数据,那么就设置这个参数<br>
         * <code>function(values: any[]): Promise.&lt;DatasourceItem[], Error&gt;</code>
         */
        loader: DataTypes.func,

        /**
         * 浮层的宽度,例如 'auto', '100px', '100%', 300
         *
         * @default 'auto'
         */
        layerWidth: DataTypes.any
    },
    computed: {
        // datasource 是树形结构
github ecomfe / santd / src / collapse / collapse.js View on Github external
/**
 * @file Santd collapse collapse source file
 * @author mayihui@baidu.com
 **/

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

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

export default san.defineComponent({
    dataTypes: {
        activeKey: DataTypes.oneOfType([DataTypes.string, DataTypes.array]),
        defaultActiveKey: DataTypes.oneOfType([DataTypes.string, DataTypes.array]),
        acordion: DataTypes.bool,
        destroyInactivePanel: DataTypes.bool
    },

    initData() {
        return {
            bordered: true,
            accordion: false,
            destroyInactivePanel: false
        };
    },

    inited() {
        this.panelChildren = [];

        let activeKey = this.data.get('activeKey') || this.data.get('defaultActiveKey');
github ecomfe / santd / src / tree-select / tree-select.js View on Github external
return node;
        });
    }

    return loop(treeData.concat());
};*/

const sizeMap = {
    small: 'sm',
    large: 'lg'
};

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,
github ecomfe / san-xui / src / x / components / Select.js View on Github external
* 浮层的打开或者关闭状态
         *
         * @bindx
         * @default false
         */
        active: DataTypes.bool,

        /**
         * Select 的数据源,每一项的格式如下:
         * <pre><code>{
         *   text: string,
         *   value: any,
         *   group?: string (如需要分组展示,设置这个字段)
         * }</code></pre>
         */
        datasource: DataTypes.array,

        /**
         * 未选中任何项时的文字
         *
         * @default '请选择'
         */
        defaultLabel: DataTypes.string,

        /**
         * 是否支持选择多项,如果设置为 true,那么 value 的类型是 any[]
         *
         * @default false
         */
        multi: DataTypes.bool,

        /**
github ecomfe / santd / src / tree / tree.js View on Github external
return data;
}

export default san.defineComponent({
    components: {
        's-tree-node': treeNode
    },
    dataTypes: {
        autoExpandParent: DataTypes.bool,
        blockNode: DataTypes.bool,
        checkable: DataTypes.bool,
        checkedKeys: DataTypes.oneOfType([DataTypes.array, DataTypes.object]),
        checkStrictly: DataTypes.bool,
        defaultCheckedKeys: DataTypes.array,
        defaultExpandAll: DataTypes.bool,
        defaultExpandedKeys: DataTypes.array,
        defaultSelectedKeys: DataTypes.array,
        disabled: DataTypes.bool,
        draggable: DataTypes.bool,
        expandedKeys: DataTypes.array,
        loadData: DataTypes.func,
        loadedKeys: DataTypes.array,
        multiple: DataTypes.bool,
        selectedKeys: DataTypes.array,
        showIcon: DataTypes.bool,
        showLine: DataTypes.bool
    },
    computed: {
        classes() {
            const showLine = this.data.get('showLine');
            const blockNode = this.data.get('blockNode');
            const directory = this.data.get('isDirectory');
github ecomfe / san-xui / src / x / components / MonthView.js View on Github external
* @bindx
         * @default new Date()
         */
        value: DataTypes.date,

        /**
         * 日期的可选范围
         * @default {begin: new Date(2014, 1, 1), end: new Date(2046, 10, 4)}
         */
        range: DataTypes.object,

        /**
         * 星期的名称
         * @default ['一', '二', '三', '四', '五', '六', '日']
         */
        titles: DataTypes.array
    },
    initYearOptions() {
        const value = this.data.get('value');
        const {begin, end} = this.data.get('range');
        const year = value.getFullYear();
        const datasource = [];

        const endYear = end.getFullYear();
        for (let year = begin.getFullYear(); year &lt;= endYear; year++) {
            datasource.push({text: year, value: year});
        }

        this.data.set('yearDs.datasource', datasource);
        this.data.set('yearDs.value', year);
    },
    initMonthOptions(year) {
github ecomfe / santd / santd / table / table.js View on Github external
return tree.reduce((acc, node) => {
        if (callback(node)) {
            acc.push(node);
        }
        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,
github ecomfe / santd / src / timepicker / header.js View on Github external
* @author mayihui@baidu.com
 **/

import san, {DataTypes} from 'san';
import moment from 'moment';

export default san.defineComponent({
    dataTypes: {
        format: DataTypes.string,
        prefixCls: DataTypes.string,
        placeholder: DataTypes.string,
        value: DataTypes.object,
        inputReadOnly: DataTypes.bool,
        hourOptions: DataTypes.array,
        minuteOptions: DataTypes.array,
        secondOptions: DataTypes.array,
        disabledHours: DataTypes.func,
        disabledMinutes: DataTypes.func,
        disabledSeconds: DataTypes.func,
        defaultOpenValue: DataTypes.object,
        focusOnOpen: DataTypes.bool
    },
    initData() {
        return {
            invalid: false,
            inputReadOnly: false
        };
    },
    computed: {
        showTime() {
            const value = this.data.get('value');
            const format = this.data.get('format');
github ecomfe / santd / src / table / table.js View on Github external
<div class="${prefixCls}-footer">
        
        <template>{{footer}}</template>
    </div>
`;

export default san.defineComponent({
    dataTypes: {
        loading: DataTypes.bool,
        scroll: DataTypes.object,
        size: DataTypes.string,
        title: DataTypes.string,
        data: DataTypes.array,
        pagination: DataTypes.oneOfType([DataTypes.bool, DataTypes.object])
    },
    initData() {
        return {
            loading: false,
            scroll: {},
            size: 'default',
            data: [],
            pagination: {
                current: 1,
                pageSize: 10
            },
            selectedKeys: {},
            indentSize: 20,
            expandedKeys: [],
            selectedRows: [],