当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Themed.default函数代码示例

本文整理汇总了TypeScript中@dojo/widget-core/mixins/Themed.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: ThemedMixin

import WidgetBase from '@dojo/widget-core/WidgetBase';
import ThemedMixin, { theme } from '@dojo/widget-core/mixins/Themed';
import { v } from '@dojo/widget-core/d';

import { Todo } from './../todoProcesses';

import * as css from './styles/todoItem.m.css';

export interface TodoItemProperties {
	todo: Todo;
	toggleTodo: (payload: { id: string }) => void;
	removeTodo: (payload: { id: string }) => void;
	editTodo: (payload: { id: string }) => void;
}

export const TodoItemBase = ThemedMixin(WidgetBase);

@theme(css)
export default class TodoItem extends TodoItemBase<TodoItemProperties> {

	private toggleTodo() {
		this.properties.toggleTodo({ id: this.properties.todo.id });
	}

	private editTodo() {
		this.properties.editTodo({ id: this.properties.todo.id });
	}

	private removeTodo() {
		this.properties.removeTodo({ id: this.properties.todo.id });
	}
开发者ID:agubler,项目名称:examples,代码行数:31,代码来源:TodoItem.ts

示例2: ThemedMixin

import TodoCard from './TodoCard';
import TodoDetailsOutlet from './../outlets/TodoDetailsOutlet';

import * as css from './styles/todoList.m.css';

export interface TodoListProperties {
	view: string;
	filter: string;
	todos: Todo[];
	searchValue: string;
	toggleTodo: (payload: { id: string }) => void;
	removeTodo: (payload: { id: string }) => void;
	editTodo: (payload: { id: string }) => void;
}

export const TodoListBase = ThemedMixin(WidgetBase);

function filterTodos(todos: Todo[], quickFilter: string, filter: string): Todo[] {
	return todos.filter((todo) => {
		return (quickFilter === '' || 	todo.label.toLowerCase().indexOf(quickFilter.toLowerCase()) >= 0) &&
			(filter === 'completed' && todo.completed || filter === 'active' && !todo.completed || filter === 'all');
	});
}

@theme(css)
export default class TodoList extends TodoListBase<TodoListProperties> {
	protected render() {
		const { todos, searchValue, view, filter, toggleTodo, removeTodo, editTodo } = this.properties;

		return [
			v('ul', { classes: this.theme([ css.todoList, view === 'card' && todos.length > 0 ? css.cardList : null ]) }, filterTodos(todos, searchValue, filter).map((todo) => {
开发者ID:agubler,项目名称:examples,代码行数:31,代码来源:TodoList.ts

示例3: parseUnits

 * @return        An object containing `hour`, `second`, and `number` properties.
 */
export function parseUnits (value: string | TimeUnits): TimeUnits {
	if (typeof value === 'string') {
		if (!TIME_PATTERN.test(value)) {
			throw new Error('Time strings must be in the format HH:mm or HH:mm:ss');
		}

		const [ hour, minute, second = 0 ] = value.split(':').map(unit => parseInt(unit, 10));
		return { hour, minute, second } as TimeUnits;
	}

	return value;
}

export const TimePickerBase = ThemedMixin(WidgetBase);

@theme(css)
export class TimePicker extends TimePickerBase<TimePickerProperties> {
	protected options: TimeUnits[] | null;

	private _formatUnits(units: TimeUnits): string {
		const { step = 60 } = this.properties;
		const { hour, minute, second } = units;

		return (step >= 60 ? [ hour, minute ] : [ hour, minute, second ])
			.map(unit => padStart(String(unit), 2, '0'))
			.join(':');
	}

	private _getOptionLabel(value: TimeUnits) {
开发者ID:bitpshr,项目名称:widgets,代码行数:31,代码来源:TimePicker.ts

示例4: parseUnits

 * @return        An object containing `hour`, `second`, and `number` properties.
 */
export function parseUnits (value: string | TimeUnits): TimeUnits {
	if (typeof value === 'string') {
		if (!TIME_PATTERN.test(value)) {
			throw new Error('Time strings must be in the format HH:mm or HH:mm:ss');
		}

		const [ hour, minute, second = 0 ] = value.split(':').map(unit => parseInt(unit, 10));
		return { hour, minute, second } as TimeUnits;
	}

	return value;
}

export const ThemedBase = ThemedMixin(WidgetBase);

@theme(css)
export class TimePickerBase<P extends TimePickerProperties = TimePickerProperties> extends ThemedBase<P, null> {
	protected options: TimeUnits[] | null;

	private _uuid: string;

	constructor() {
		super();
		this._uuid = uuid();
	}

	private _formatUnits(units: TimeUnits): string {
		const { step = 60 } = this.properties;
		const { hour, minute, second } = units;
开发者ID:dylans,项目名称:widgets,代码行数:31,代码来源:TimePicker.ts


注:本文中的@dojo/widget-core/mixins/Themed.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。