mirror of
https://github.com/discourse/discourse.git
synced 2026-08-10 04:58:31 -05:00
@@ -22,17 +22,23 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
actions: {
|
||||
changeKey(index, newValue) {
|
||||
changeKey(index, event) {
|
||||
const newValue = event.target.value;
|
||||
|
||||
if (this._checkInvalidInput(newValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._replaceValue(index, newValue, "key");
|
||||
},
|
||||
|
||||
changeSecret(index, newValue) {
|
||||
changeSecret(index, event) {
|
||||
const newValue = event.target.value;
|
||||
|
||||
if (this._checkInvalidInput(newValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._replaceValue(index, newValue, "secret");
|
||||
},
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
@action
|
||||
changeValue(index, newValue) {
|
||||
this.collection.replace(index, 1, [newValue]);
|
||||
changeValue(index, event) {
|
||||
this.collection.replace(index, 1, [event.target.value]);
|
||||
this.collection.arrayContentDidChange(index);
|
||||
this._onChange();
|
||||
},
|
||||
@@ -65,7 +65,7 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
_onChange() {
|
||||
this.attrs.onChange && this.attrs.onChange(this.collection);
|
||||
this.onChange?.(this.collection);
|
||||
},
|
||||
|
||||
@discourseComputed("collection")
|
||||
|
||||
@@ -39,8 +39,8 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
actions: {
|
||||
changeValue(index, newValue) {
|
||||
this._replaceValue(index, newValue);
|
||||
changeValue(index, event) {
|
||||
this._replaceValue(index, event.target.value);
|
||||
},
|
||||
|
||||
addValue(newValue) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
{{#each this.collection as |value index|}}
|
||||
<div class="value" data-index={{index}}>
|
||||
<DButton @action={{action "removeValue"}} @actionParam={{value}} @icon="times" @class="remove-value-btn btn-small" />
|
||||
<Input @value={{value.key}} class="value-input" {{on "focusout" (action "changeKey" index)}} />
|
||||
<Input @value={{value.secret}} class="value-input" @type={{if this.isSecret "password" "text"}} {{on "focusout" (action "changeSecret" index)}} />
|
||||
<Input @value={{value.key}} class="value-input" {{on "focusout" (fn (action "changeKey") index)}} />
|
||||
<Input @value={{value.secret}} class="value-input" @type={{if this.isSecret "password" "text"}} {{on "focusout" (fn (action "changeSecret") index)}} />
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div data-index={{index}} class="value">
|
||||
<DButton @action={{action "removeValue"}} @actionParam={{value}} @icon="times" @class="remove-value-btn btn-small" />
|
||||
|
||||
<Input title={{value}} @value={{value}} class="value-input" {{on "focusout" (action "changeValue" index)}} />
|
||||
<Input title={{value}} @value={{value}} class="value-input" {{on "focusout" (fn (action "changeValue") index)}} />
|
||||
|
||||
{{#if this.showUpDownButtons}}
|
||||
<DButton @action={{action "shift" -1 index}} @icon="arrow-up" @class="shift-up-value-btn btn-small" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div data-index={{index}} class="value">
|
||||
<DButton @action={{action "removeValue"}} @actionParam={{value}} @icon="times" @class="remove-value-btn btn-small" />
|
||||
|
||||
<Input title={{value}} @value={{value}} class="value-input" {{on "focusout" (action "changeValue" index)}} />
|
||||
<Input title={{value}} @value={{value}} class="value-input" {{on "focusout" (fn (action "changeValue") index)}} />
|
||||
|
||||
{{#if this.showUpDownButtons}}
|
||||
<DButton @action={{action "shift" -1 index}} @icon="arrow-up" @class="shift-up-value-btn btn-small" />
|
||||
|
||||
Reference in New Issue
Block a user