1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/components/wizard-mapper.js.es6

45 Zeilen
1,6 KiB
Text

2020-04-01 07:03:26 +02:00
import { getOwner } from 'discourse-common/lib/get-owner';
import { on } from 'discourse-common/utils/decorators';
2020-04-02 07:21:57 +02:00
import { newInput } from '../lib/wizard-mapper';
2020-04-01 07:03:26 +02:00
import { default as discourseComputed } from 'discourse-common/utils/decorators';
export default Ember.Component.extend({
classNames: 'wizard-mapper',
@discourseComputed('inputs.[]', 'options.singular')
canAdd(inputs, singular) {
return !singular || !inputs || inputs.length < 1;
},
@discourseComputed('options')
inputOptions(options) {
return {
hasOutput: options.hasOutput || false,
inputTypes: options.inputTypes || null,
pairConnector: options.pairConnector || null,
outputConnector: options.outputConnector || null,
textSelection: options.textSelection || true,
wizardSelection: options.wizardSelection || false,
2020-04-02 10:21:03 +02:00
userFieldSelection: options.userFieldSelection || false,
2020-04-01 07:03:26 +02:00
categorySelection: options.categorySelection || false,
tagSelection: options.tagSelection || false,
groupSelection: options.groupSelection || false,
2020-04-02 10:21:03 +02:00
userSelection: options.userSelection || false,
2020-04-01 07:03:26 +02:00
keyDefaultSelection: options.keyDefaultSelection || null,
valueDefaultSelection: options.valueDefaultSelection || null,
outputDefaultSelection: options.outputDefaultSelection || null
}
},
actions: {
add() {
if (!this.get('inputs')) this.set('inputs', Ember.A());
this.get('inputs').pushObject(newInput(this.inputOptions));
},
remove(input) {
this.get('inputs').removeObject(input);
}
}
});