mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
DEV: Import makeArray
from discourse-common
instead using Ember
global (#8977)
This commit is contained in:
@ -81,7 +81,7 @@ export default SelectKitComponent.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
selectedContent: computed("value.[]", "content.[]", function() {
|
selectedContent: computed("value.[]", "content.[]", function() {
|
||||||
const value = Ember.makeArray(this.value).map(v =>
|
const value = makeArray(this.value).map(v =>
|
||||||
this.selectKit.options.castInteger && this._isNumeric(v) ? Number(v) : v
|
this.selectKit.options.castInteger && this._isNumeric(v) ? Number(v) : v
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
|
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
|
||||||
export default SelectKitHeaderComponent.extend({
|
export default SelectKitHeaderComponent.extend({
|
||||||
classNames: ["multi-select-header"],
|
classNames: ["multi-select-header"],
|
||||||
@ -7,11 +8,11 @@ export default SelectKitHeaderComponent.extend({
|
|||||||
"select-kit/templates/components/multi-select/multi-select-header",
|
"select-kit/templates/components/multi-select/multi-select-header",
|
||||||
|
|
||||||
selectedNames: computed("selectedContent", function() {
|
selectedNames: computed("selectedContent", function() {
|
||||||
return Ember.makeArray(this.selectedContent).map(c => this.getName(c));
|
return makeArray(this.selectedContent).map(c => this.getName(c));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
selectedValue: computed("selectedContent", function() {
|
selectedValue: computed("selectedContent", function() {
|
||||||
return Ember.makeArray(this.selectedContent)
|
return makeArray(this.selectedContent)
|
||||||
.map(c => {
|
.map(c => {
|
||||||
if (this.getName(c) !== this.getName(this.selectKit.noneItem)) {
|
if (this.getName(c) !== this.getName(this.selectKit.noneItem)) {
|
||||||
return this.getValue(c);
|
return this.getValue(c);
|
||||||
|
@ -318,7 +318,7 @@ export default Component.extend(
|
|||||||
validateSelect() {
|
validateSelect() {
|
||||||
this.clearErrors();
|
this.clearErrors();
|
||||||
|
|
||||||
const selection = Ember.makeArray(this.value);
|
const selection = makeArray(this.value);
|
||||||
|
|
||||||
const maximum = this.selectKit.options.maximum;
|
const maximum = this.selectKit.options.maximum;
|
||||||
if (maximum && selection.length >= maximum) {
|
if (maximum && selection.length >= maximum) {
|
||||||
|
@ -28,7 +28,7 @@ export default MultiSelectComponent.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
content: computed("value.[]", function() {
|
content: computed("value.[]", function() {
|
||||||
return Ember.makeArray(this.value).map(x => this.defaultItem(x, x));
|
return makeArray(this.value).map(x => this.defaultItem(x, x));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
excludedUsers: computed(
|
excludedUsers: computed(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
import { isNone } from "@ember/utils";
|
import { isNone } from "@ember/utils";
|
||||||
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
|
||||||
let _appendContentCallbacks = {};
|
let _appendContentCallbacks = {};
|
||||||
function appendContent(pluginApiIdentifiers, contentFunction) {
|
function appendContent(pluginApiIdentifiers, contentFunction) {
|
||||||
@ -109,10 +110,10 @@ export function applyContentPluginApiCallbacks(
|
|||||||
) {
|
) {
|
||||||
identifiers.forEach(key => {
|
identifiers.forEach(key => {
|
||||||
(_prependContentCallbacks[key] || []).forEach(c => {
|
(_prependContentCallbacks[key] || []).forEach(c => {
|
||||||
content = Ember.makeArray(c(selectKit, content)).concat(content);
|
content = makeArray(c(selectKit, content)).concat(content);
|
||||||
});
|
});
|
||||||
(_appendContentCallbacks[key] || []).forEach(c => {
|
(_appendContentCallbacks[key] || []).forEach(c => {
|
||||||
content = content.concat(Ember.makeArray(c(selectKit, content)));
|
content = content.concat(makeArray(c(selectKit, content)));
|
||||||
});
|
});
|
||||||
const filterCallbacks = _filterContentCallbacks[key] || [];
|
const filterCallbacks = _filterContentCallbacks[key] || [];
|
||||||
if (filterCallbacks.length) {
|
if (filterCallbacks.length) {
|
||||||
|
Reference in New Issue
Block a user