本文整理汇总了TypeScript中@fuse/utils.FuseUtils类的典型用法代码示例。如果您正苦于以下问题:TypeScript FuseUtils类的具体用法?TypeScript FuseUtils怎么用?TypeScript FuseUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FuseUtils类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
/**
* Constructor
*
* @param order
*/
constructor(order?)
{
order = order || {};
this.id = order.id || FuseUtils.generateGUID();
this.reference = order.reference || FuseUtils.generateGUID();
this.subtotal = order.subtotal || 0;
this.tax = order.tax || 0;
this.discount = order.discount || 0;
this.total = order.total || 0;
this.date = order.date || '';
this.customer = order.customer || {};
this.products = order.products || [];
this.status = order.status || [];
this.payment = order.payment || {};
this.shippingDetails = order.shippingDetails || [];
}
示例2: Promise
return new Promise((resolve, reject) => {
// Generate a new id
const chatId = FuseUtils.generateGUID();
// Prepare the chat object
const chat = {
id : chatId,
dialog: []
};
// Prepare the chat list entry
const chatListItem = {
chatId : chatId,
contactId : contactId,
lastMessageTime: '2017-02-18T10:30:18.931Z'
};
// Add new chat list item to the user's chat list
this.user.chatList.push(chatListItem);
// Post the created chat to the server
this._httpClient.post('api/chat-panel-chats', {...chat})
.subscribe(() => {
// Post the updated user data to the server
this._httpClient.post('api/chat-panel-user/' + this.user.id, this.user)
.subscribe(() => {
// Resolve the promise
resolve();
});
}, reject);
});
示例3: Todo
.subscribe((todos: any) => {
this.todos = todos.map(todo => {
return new Todo(todo);
});
this.todos = FuseUtils.filterArrayByString(this.todos, this.searchText);
this.onTodosChanged.next(this.todos);
resolve(this.todos);
});
示例4: constructor
/**
* Constructor
*
* @param product
*/
constructor(product?)
{
product = product || {};
this.id = product.id || FuseUtils.generateGUID();
this.name = product.name || '';
this.handle = product.handle || FuseUtils.handleize(this.name);
this.description = product.description || '';
this.categories = product.categories || [];
this.tags = product.tags || [];
this.images = product.images || [];
this.priceTaxExcl = product.priceTaxExcl || 0;
this.priceTaxIncl = product.priceTaxIncl || 0;
this.taxRate = product.taxRate || 0;
this.comparedPrice = product.comparedPrice || 0;
this.quantity = product.quantity || 0;
this.sku = product.sku || 0;
this.width = product.width || 0;
this.height = product.height || 0;
this.depth = product.depth || 0;
this.weight = product.weight || 0;
this.extraShippingFee = product.extraShippingFee || 0;
this.active = product.active || true;
}
示例5: constructor
/**
* Constructor
*
* @param board
*/
constructor(board)
{
this.name = board.name || 'Untitled Board';
this.uri = board.uri || 'untitled-board';
this.id = board.id || FuseUtils.generateGUID();
this.settings = board.settings || {
color : '',
subscribed : true,
cardCoverImages: true
};
this.lists = [];
this.cards = [];
this.members = board.members || sampleMembers;
this.labels = board.labels || sampleLabels;
}
示例6: constructor
/**
* Constructor
*
* @param card
*/
constructor(card)
{
this.id = card.id || FuseUtils.generateGUID();
this.name = card.name || '';
this.description = card.description || '';
this.idAttachmentCover = card.idAttachmentCover || '';
this.idMembers = card.idMembers || [];
this.idLabels = card.idLabels || [];
this.attachments = card.attachments || [];
this.subscribed = card.subscribed || true;
this.checklists = card.checklists || [];
this.checkItems = card.checkItems || 0;
this.checkItemsChecked = card.checkItemsChecked || 0;
this.comments = card.comments || [];
this.activities = card.activities || [];
this.due = card.due || '';
}
示例7: constructor
/**
* Constructor
*
* @param contact
*/
constructor(contact)
{
{
this.id = contact.id || FuseUtils.generateGUID();
this.name = contact.name || '';
this.lastName = contact.lastName || '';
this.avatar = contact.avatar || 'assets/images/avatars/profile.jpg';
this.nickname = contact.nickname || '';
this.company = contact.company || '';
this.jobTitle = contact.jobTitle || '';
this.email = contact.email || '';
this.phone = contact.phone || '';
this.address = contact.address || '';
this.birthday = contact.birthday || '';
this.notes = contact.notes || '';
}
}
示例8: saveProduct
/**
* Save product
*/
saveProduct(): void
{
const data = this.productForm.getRawValue();
data.handle = FuseUtils.handleize(data.name);
this._ecommerceProductService.saveProduct(data)
.then(() => {
// Trigger the subscription with new data
this._ecommerceProductService.onProductChanged.next(data);
// Show the success message
this._matSnackBar.open('Product saved', 'OK', {
verticalPosition: 'top',
duration : 2000
});
});
}
示例9: Promise
return new Promise((resolve, reject) => {
const contact = this.contacts.find((item) => {
return item.id === contactId;
});
const chatId = FuseUtils.generateGUID();
const chat = {
id : chatId,
dialog: []
};
const chatListItem = {
contactId : contactId,
id : chatId,
lastMessageTime: '2017-02-18T10:30:18.931Z',
name : contact.name,
unread : null
};
// Add new chat list item to the user's chat list
this.user.chatList.push(chatListItem);
// Post the created chat
this._httpClient.post('api/chat-chats', {...chat})
.subscribe((response: any) => {
// Post the new the user data
this._httpClient.post('api/chat-user/' + this.user.id, this.user)
.subscribe(newUserData => {
// Update the user data from server
this.getUser().then(updatedUser => {
this.onUserUpdated.next(updatedUser);
resolve(updatedUser);
});
});
}, reject);
});
示例10:
(entities, searchText) => {
const arr = Object.keys(entities).map((id) => entities[id]);
return FuseUtils.filterArrayByString(arr, searchText);
}