Skip to content

Commit

Permalink
Merge 556bc29 into ad9ae87
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOtherDude committed Jan 11, 2018
2 parents ad9ae87 + 556bc29 commit 752a8de
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 16,247 deletions.
12 changes: 8 additions & 4 deletions addon/components/array-inline-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export default Component.extend(HookMixin, PropTypeMixin, {
}
},

getCell (arrayOptions, index) {
return get(arrayOptions, `tupleCells.${index}`) ||
get(arrayOptions, `itemCell.${index}`) ||
arrayOptions.itemCell
},

@readOnly
@computed('formDisabled', 'cellConfig')
disabled (formDisabled, cellConfig) {
Expand Down Expand Up @@ -101,16 +107,14 @@ export default Component.extend(HookMixin, PropTypeMixin, {

@readOnly
@computed('cellConfig', 'index')
itemCell (cellConfig, index, bunsenModel) {
itemCell (cellConfig, index) {
const arrayOptions = get(cellConfig, 'arrayOptions')

if (!isPresent(arrayOptions)) {
return {}
}

const cell = get(arrayOptions, `tupleCells.${index}`) ||
get(arrayOptions, `itemCell.${index}`) ||
arrayOptions.itemCell
const cell = this.getCell(arrayOptions, index)

return isPresent(cell) && !Array.isArray(cell) ? cell : {}
},
Expand Down
2 changes: 2 additions & 0 deletions addon/components/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export default Component.extend(HookMixin, PropTypeMixin, {

@readOnly
@computed('cellConfig', 'bunsenModel.type')
/* eslint-disable complexity */
showSection (cellConfig, type) {
const isArrayCell = type === 'array' && cellConfig.renderer === undefined
return (
Expand All @@ -280,6 +281,7 @@ export default Component.extend(HookMixin, PropTypeMixin, {
(isArrayCell && !cellConfig.hideLabel)
)
},
/* eslint-enable complexity */

@readOnly
@computed('cellConfig.model', 'children')
Expand Down
2 changes: 2 additions & 0 deletions addon/components/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, {
return batchedChanges
},

/* eslint-disable complexity */
/**
* Get the view to render (generate one if consumer doesn't supply a view)
* @param {BunsenModel} model - the model schema to use to generate a view (if view is undefined)
Expand All @@ -339,6 +340,7 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, {

return normalizeView(view)
},
/* eslint-enable complexity */

/**
* Inform renderers that registered to be notified of form value changes of
Expand Down
2 changes: 2 additions & 0 deletions addon/input-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function getAttr (attrs, name) {
return get(attrs, `${firstSegment}.value.${remainingPath}`)
}

/* eslint-disable complexity */
export function getOption (attrs, optionName, formValue, fallback = '', useValue = true) {
if (!attrs) {
return undefined
Expand All @@ -36,3 +37,4 @@ export function getOption (attrs, optionName, formValue, fallback = '', useValue

return parseVariables(mutableFormValue, configOption, bunsenId, true) || fallback
}
/* eslint-enable complexity */
6 changes: 5 additions & 1 deletion addon/list-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export function getItemsFromAjaxCall ({ajax, bunsenId, data, filter, options, va
})
}

/* eslint-disable complexity */
/**
* Fetch the list of network functions from the backend and set them
* @param {Object} value the bunsen value for this form
Expand Down Expand Up @@ -186,13 +187,16 @@ export function getItemsFromEmberData ({value, modelDef, data, bunsenId, store,

if (arrayRecords) {
const recordsToAdd = arrayRecords.filter(record => {
return shouldAddCurrentValue({items, valueRecord: record, labelAttribute, valueAttribute, filter})
// Note: filtering current values out of multi-select data would clear those selections,
// so we ignore the filter in this case (@theotherdude 1/10/2018)
return shouldAddCurrentValue({items, valueRecord: record, labelAttribute, valueAttribute, filter: ''})
})
return normalizeItems({data: items, labelAttribute, records: recordsToAdd, valueAttribute})
}
return items
})
}
/* eslint-enable complexity */

/**
* Fetch the list of items from elsewhere in the form value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
valueChangeSet=valueChangeSet
}}
{{else}}
{{log label}}
{{frost-bunsen-input-wrapper
bunsenId=bunsenId
bunsenModel=bunsenModel
Expand Down
2 changes: 2 additions & 0 deletions addon/tree-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export function traverseCell (cell, iteratee) {
}
}

/* eslint-disable complexity */
/**
* Post-order breadth-first traversal
* @param {Object} object - cellConfig
Expand Down Expand Up @@ -185,6 +186,7 @@ export function traverseCellBreadthFirst (object, iteratee) {
iteratee(obj)
}
}
/* eslint-enable complexity */

/**
* Traverses an object, ignoring arrays
Expand Down
2 changes: 2 additions & 0 deletions addon/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export function validateRenderer (owner, rendererName) {
return rendererName in builtInRenderers || owner.hasRegistration(`component:${rendererName}`)
}

/* eslint-disable complexity */
/**
* Get an error message from an error Object
* @param {Object} error - may be an Error, an API response, or anything else (maybe?)
Expand All @@ -386,6 +387,7 @@ export function getErrorMessage (error) {

return message
}
/* eslint-enable complexity */

/**
* Used to sanity check if the path to the model is valid
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
module.exports = {
name: 'ember-frost-bunsen',

/* eslint-disable complexity */
init: function (app) {
this.options = this.options || {}
this.options.babel = this.options.babel || {}
Expand All @@ -17,4 +18,5 @@ module.exports = {
this._super.init && this._super.init.apply(this, arguments)
/* eslint-enable no-unused-expressions */
}
/* eslint-enable complexity */
}
Loading

0 comments on commit 752a8de

Please sign in to comment.