示例#1
0
def selector_on_new_item(e, d):
    if this.state.search_query:
        active_items = utils.lodash_array.concat(
            this.state.selected,
            this.props.defaultSelected if this.props.defaultSelected else [])
        new_item = {'name': this.state.search_query}
        old_item = utils.find_in_list(active_items, new_item, key='name')
        if not old_item:
            selected = utils.update_object(None,
                                           this.state.selected,
                                           new_item,
                                           op="append")
            this.setState({'selected': selected, 'search_query': ''})
示例#2
0
def update_title_language(value, n):
    data = this.props.data or this.state.data
    t = utils.find_in_list(data, n, index=True)
    if t:
        t.language = value
        this.update_data(data)
示例#3
0
def update_url(value, n):
    data = this.props.data or this.state.data
    t = utils.find_in_list(data, n, index=True)
    if t:
        t.js_name = value
        this.update_data(data)