How to use the san.DataTypes.instanceOf 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 / input / input.js View on Github external
if (suffix && typeof suffix === 'function') {
            renderer = suffix();
            renderer.attach(this.ref('suffix'));
        }
        else if (typeof suffix === 'string') {
            this.data.set('suffixString', suffix);
        }
    },
    template: presuffix
});

export default san.defineComponent({
    dataTypes: {
        addonAfter: DataTypes.oneOfType([DataTypes.string, DataTypes.instanceOf(Object)]),
        addonBefore: DataTypes.oneOfType([DataTypes.string, DataTypes.instanceOf(Object)]),
        prefix: DataTypes.oneOfType([DataTypes.string, DataTypes.instanceOf(Object)]),
        suffix: DataTypes.oneOfType([DataTypes.string, DataTypes.instanceOf(Object)]),
        defaultValue: DataTypes.any,
        placeholder: DataTypes.string,
        disabled: DataTypes.bool,
        inputType: DataTypes.oneOf(['inputGroup', 'inputFix']),
        id: DataTypes.oneOfType([DataTypes.string, DataTypes.number]),
        size: DataTypes.oneOf(['large', 'default', 'small']),
        type: DataTypes.string,
        value: DataTypes.any
    },
    components: {
        's-base-input': BaseInput,
        's-icon': Icon,
        'a-addonrenderer': AddonRenderer,
        'a-presuffix': PresuffixRenderer
    },
github ecomfe / santd / src / breadcrumb / breadcrumb.js View on Github external
);
        return name;
    },
    template: `<span>
        <span>{{getBreadcrumbName(route, params)}}</span>
        <a href="{{getHref(paths)}}">{{getBreadcrumbName(route, params)}}</a>
    </span>`
});

export default san.defineComponent({
    components: {
        's-breadcrumb-item': breadcrumbItem
    },
    dataTypes: {
        separator: DataTypes.string,
        routes: DataTypes.instanceOf(Array)
    },
    initData() {
        return {
            separator: '/',
            paths: []
        };
    },
    computed: {
        injectItemRender() {
            const instance = this.data.get('instance');
            const itemRender = this.data.get('itemRender') || defaultItemRender;
            if (instance) {
                instance.components.itemrender = itemRender;
            }
        }
    },
github ecomfe / santd / santd / breadcrumb / breadcrumbList.js View on Github external
return san.defineComponent({
        template: `
            <span>
                <span>{{route.breadcrumbName}}</span>
                <a href="#{{route.path}}">{{route.breadcrumbName}}</a>
            </span>
        `
    });
};

export default san.defineComponent({
    dataTypes: {
        href: DataTypes.string,
        route: DataTypes.instanceOf(Object),
        index: DataTypes.number,
        params: DataTypes.instanceOf(Object)
    },
    attached() {
        let itemRender = this.data.get('itemRender');
        const {route, index, params, allLen} = this.data.get();
        let renderer;
        itemRender = itemRender ? itemRender : defaultItem;
        if (route &amp;&amp; itemRender) {
            if (params) {
                route.path = route.path || '';
                let path = route.path.replace(/^\//, '');
                Object.keys(params).forEach(key =&gt; {
                    path = path.replace(`:${key}`, params[key]);
                });
                route.path = path;
            }
            let Renderer = itemRender();
github ecomfe / santd / santd / breadcrumb / breadcrumbList.js View on Github external
const defaultItem = function () {
    return san.defineComponent({
        template: `
            <span>
                <span>{{route.breadcrumbName}}</span>
                <a href="#{{route.path}}">{{route.breadcrumbName}}</a>
            </span>
        `
    });
};

export default san.defineComponent({
    dataTypes: {
        href: DataTypes.string,
        route: DataTypes.instanceOf(Object),
        index: DataTypes.number,
        params: DataTypes.instanceOf(Object)
    },
    attached() {
        let itemRender = this.data.get('itemRender');
        const {route, index, params, allLen} = this.data.get();
        let renderer;
        itemRender = itemRender ? itemRender : defaultItem;
        if (route &amp;&amp; itemRender) {
            if (params) {
                route.path = route.path || '';
                let path = route.path.replace(/^\//, '');
                Object.keys(params).forEach(key =&gt; {
                    path = path.replace(`:${key}`, params[key]);
                });
                route.path = path;