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


TypeScript Container.Container函数代码示例

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


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

示例1: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Register, RegisterProperties } from './../widgets/Register';
import {
	registerProcess,
	registerEmailInputProcess,
	registerPasswordInputProcess,
	registerUsernameInputProcess
} from './../processes/loginProcesses';
import { State } from '../interfaces';

function getProperties(store: Store<State>): RegisterProperties {
	const { get, path } = store;

	return {
		email: get(path('register', 'email')),
		password: get(path('register', 'password')),
		username: get(path('register', 'username')),
		errors: get(path('errors')),
		inProgress: get(path('register', 'loading')),
		onEmailInput: registerEmailInputProcess(store),
		onPasswordInput: registerPasswordInputProcess(store),
		onUsernameInput: registerUsernameInputProcess(store),
		onRegister: registerProcess(store)
	};
}

export const RegisterContainer = Container(Register, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:28,代码来源:RegisterContainer.ts

示例2: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Feeds, FeedsProperties } from './../widgets/Feeds';
import { fetchFeedProcess, favoriteFeedArticleProcess } from './../processes/feedProcesses';

import { State } from './../interfaces';

function getProperties(store: Store<State>, properties: FeedsProperties): FeedsProperties {
	const { get, path } = store;
	const loading = get(path('feed', 'loading'));
	const isAuthenticated = !!get(path('user', 'token'));
	const username = properties.username || get(path('user', 'username'));
	const defaultType = isAuthenticated ? 'feed' : 'global';
	const type = properties.type ? properties.type : get(path('feed', 'category')) || defaultType;

	return {
		items: get(path('feed', 'items')),
		type,
		loading,
		username,
		isAuthenticated,
		tagName: get(path('feed', 'tagName')),
		total: get(path('feed', 'total')),
		currentPage: get(path('feed', 'pageNumber')),
		fetchFeed: fetchFeedProcess(store),
		favoriteArticle: favoriteFeedArticleProcess(store)
	};
}

export const FeedsContainer = Container(Feeds, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:FeedsContainer.ts

示例3: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Header, HeaderProperties } from './../widgets/Header';
import { State } from '../interfaces';

function getProperties(store: Store<State>): HeaderProperties {
	const { get, path } = store;

	return {
		route: get(path('routing', 'outlet')),
		isAuthenticated: !!get(path('user', 'token')),
		loggedInUser: get(path('user', 'username'))
	};
}

export const HeaderContainer = Container(Header, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:16,代码来源:HeaderContainer.ts

示例4: getProperties

import { Container } from '@dojo/widget-core/Container';
import Store from '@dojo/stores/Store';

import { TodoDetails } from './../widgets/TodoDetails';
import {
	editTodoProcess,
	saveTodoProcess,
	TodoStore
} from './../todoProcesses';

function getProperties(store: Store<TodoStore>, properties: any) {
	const { get, path } = store;
	return {
		todo: get(path('editedTodo')) || get(path('todos', properties.id)),
		editTodo: editTodoProcess(store),
		saveTodo: saveTodoProcess(store)
	};
}

export const TodoDetailsContainer = Container(TodoDetails, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:20,代码来源:TodoDetailsContainer.ts

示例5: getProperties

	setCurrentTodoProcess,
	searchProcess,
	clearCompletedProcess,
	toggleTodoProcess,
	toggleTodosProcess,
	removeTodoProcess,
	TodoStore
} from '../todoProcesses';

function getProperties(store: Store<TodoStore>) {
	const { get, path } = store;
	return {
		todos: Object.keys(get(path('todos'))).map(key => get(path('todos', key))),
		currentTodo: get(path('currentTodo')),
		addTodo: addTodoProcess(store),
		editTodo: editTodoProcess(store),
		setCurrentTodo: setCurrentTodoProcess(store),
		search: searchProcess(store),
		searchValue: get(path('currentSearch')),
		completed: get(path('completed')),
		clearCompleted: clearCompletedProcess(store),
		toggleTodos: toggleTodosProcess(store),
		toggleTodo: toggleTodoProcess(store),
		activeCount: get(path('todoCount')) - get(path('completedCount')),
		todoCount: get(path('todoCount')),
		removeTodo: removeTodoProcess(store)
	};
}

export const TodoAppContainer = Container(TodoApp, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:TodoAppContainer.ts

示例6: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Tags, TagsProperties } from './../widgets/Tags';
import { fetchFeedProcess } from '../processes/feedProcesses';
import { State } from '../interfaces';

function getProperties(store: Store<State>): TagsProperties {
	const { get, path } = store;
	return {
		tags: get(path('tags')) || [],
		fetchFeed: fetchFeedProcess(store)
	};
}

export const TagsContainer = Container(Tags, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:15,代码来源:TagsContainer.ts

示例7: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Profile, ProfileProperties } from './../widgets/Profile';
import { State } from '../interfaces';
import { followUserProcess } from './../processes/profileProcesses';

function getProperties(store: Store<State>, properties: ProfileProperties): ProfileProperties {
	const { get, path } = store;

	return {
		username: properties.username,
		type: properties.type,
		image: get(path('profile', 'image')),
		bio: get(path('profile', 'bio')),
		following: get(path('profile', 'following')),
		currentUser: get(path('user', 'username')),
		followUser: followUserProcess(store)
	};
}

export const ProfileContainer = Container(Profile, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:21,代码来源:ProfileContainer.ts

示例8: getProperties

import { Container } from '@dojo/widget-core/Container';
import { Store } from '@dojo/stores/Store';
import { Login, LoginProperties } from './../widgets/Login';
import { loginProcess, loginEmailInputProcess, loginPasswordInputProcess } from './../processes/loginProcesses';
import { State } from '../interfaces';

function getProperties(store: Store<State>): LoginProperties {
	const { get, path } = store;

	return {
		email: get(path('login', 'email')),
		password: get(path('login', 'password')),
		errors: get(path('errors')),
		inProgress: get(path('login', 'loading')),
		onEmailInput: loginEmailInputProcess(store),
		onPasswordInput: loginPasswordInputProcess(store),
		onLogin: loginProcess(store)
	};
}

export const LoginContainer = Container(Login, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:21,代码来源:LoginContainer.ts

示例9: getProperties

	bioInputProcess,
	emailInputProcess,
	passwordInputProcess,
	imageUrlInputProcess,
	usernameInputProcess,
	updateUserSettingsProcess
} from './../processes/settingsProcesses';
import { logoutProcess } from '../processes/loginProcesses';
import { State } from '../interfaces';

function getProperties(store: Store<State>): SettingsProperties {
	const { get, path } = store;

	return {
		email: get(path('settings', 'email')),
		password: get(path('settings', 'password')),
		username: get(path('settings', 'username')),
		imageUrl: get(path('settings', 'image')),
		bio: get(path('settings', 'bio')),
		onEmailInput: emailInputProcess(store),
		onPasswordInput: passwordInputProcess(store),
		onUsernameInput: usernameInputProcess(store),
		onBioInput: bioInputProcess(store),
		onImageUrlInput: imageUrlInputProcess(store),
		onUpdateSettings: updateUserSettingsProcess(store),
		logout: logoutProcess(store)
	};
}

export const SettingsContainer = Container(Settings, 'state', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:30,代码来源:SettingsContainer.ts

示例10: getProperties

import { Container } from '@dojo/widget-core/Container';
import Injector from '@dojo/widget-core/Injector';
import { switchLocale } from '@dojo/i18n/i18n';

import { ThemeSwitcher } from './../widgets/ThemeSwitcher';
import pirateThemeStyles from './../themes/pirate';

function getProperties(themeContext: Injector) {
	return {
		changeTheme(wantsPirate: boolean) {
			if (wantsPirate) {
				switchLocale('en-PR');
				themeContext.set(pirateThemeStyles);
			}
			else {
				switchLocale('en');
				themeContext.set(undefined);
			}
		}
	};
}

export const ThemeSwitcherContainer = Container(ThemeSwitcher, 'theme-context', { getProperties });
开发者ID:dylans,项目名称:examples,代码行数:23,代码来源:ThemeSwitcherContainer.ts


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