diff --git a/packages/meteor-autocomplete/client/autocomplete-client.js b/packages/meteor-autocomplete/client/autocomplete-client.js index 2476c42db373..e57cbcbd6e00 100755 --- a/packages/meteor-autocomplete/client/autocomplete-client.js +++ b/packages/meteor-autocomplete/client/autocomplete-client.js @@ -1,9 +1,10 @@ -/* globals Deps, getCaretCoordinates*/ import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Blaze } from 'meteor/blaze'; +import { Deps } from 'meteor/deps'; import _ from 'underscore'; import AutoCompleteRecords from './collection'; +import { getCaretCoordinates } from 'meteor/dandv:caret-position'; const isServerSearch = function(rule) { return _.isString(rule.collection); @@ -72,7 +73,7 @@ const getField = function(obj, str) { return obj; }; -this.AutoComplete = class { +export default class AutoComplete { constructor(settings) { this.KEYS = [40, 38, 13, 27, 9]; this.limit = settings.limit || 5; @@ -454,4 +455,4 @@ this.AutoComplete = class { return this.rules[this.matched].template; } -}; +} diff --git a/packages/meteor-autocomplete/client/index.js b/packages/meteor-autocomplete/client/index.js new file mode 100644 index 000000000000..d77150ea4f49 --- /dev/null +++ b/packages/meteor-autocomplete/client/index.js @@ -0,0 +1,8 @@ +import './autocomplete.css'; +import './inputs.html'; +import './templates'; +import AutoComplete from './autocomplete-client'; + +export { + AutoComplete, +}; diff --git a/packages/meteor-autocomplete/client/templates.js b/packages/meteor-autocomplete/client/templates.js index 388bb5726b4f..81782c33ecd2 100755 --- a/packages/meteor-autocomplete/client/templates.js +++ b/packages/meteor-autocomplete/client/templates.js @@ -1,6 +1,6 @@ -/* globals AutoComplete */ import { Blaze } from 'meteor/blaze'; import { Template } from 'meteor/templating'; +import AutoComplete from './autocomplete-client'; import _ from 'underscore'; // Events on template instances, sent to the autocomplete class diff --git a/packages/meteor-autocomplete/package.js b/packages/meteor-autocomplete/package.js index 3143f3f22275..763da8c1ddb3 100755 --- a/packages/meteor-autocomplete/package.js +++ b/packages/meteor-autocomplete/package.js @@ -6,23 +6,19 @@ Package.describe({ }); Package.onUse(function(api) { - api.use(['blaze', 'templating', 'jquery'], 'client'); - api.use(['ecmascript']); // both - api.use(['mongo', 'ddp']); + api.use([ + 'ecmascript', + 'mongo', + 'ddp', + ]); - api.use('dandv:caret-position@2.1.0-3', 'client'); - - // Our files - api.addFiles([ - 'client/autocomplete.css', - 'client/inputs.html', - 'client/autocomplete-client.js', - 'client/templates.js', + api.use([ + 'blaze', + 'templating', + 'jquery', + 'dandv:caret-position@2.1.0-3', ], 'client'); - api.addFiles([ - 'server/autocomplete-server.js', - ], 'server'); - - api.export('Autocomplete', 'server'); + api.mainModule('client/index.js', 'client'); + api.mainModule('server/index.js', 'server'); }); diff --git a/packages/meteor-autocomplete/server/index.js b/packages/meteor-autocomplete/server/index.js new file mode 100644 index 000000000000..6ababa09bd75 --- /dev/null +++ b/packages/meteor-autocomplete/server/index.js @@ -0,0 +1 @@ +import './autocomplete-server'; diff --git a/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.js b/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.js index 492a30b28c3d..f83f02603e2f 100644 --- a/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.js +++ b/packages/rocketchat-channel-settings-mail-messages/client/views/mailMessagesInstructions.js @@ -1,9 +1,10 @@ -/* global AutoComplete Deps */ +/* global Deps */ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import { Blaze } from 'meteor/blaze'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; +import { AutoComplete } from 'meteor/mizzao:autocomplete'; import toastr from 'toastr'; import resetSelection from '../resetSelection'; diff --git a/packages/rocketchat-channel-settings-mail-messages/package.js b/packages/rocketchat-channel-settings-mail-messages/package.js index ddb5ed278493..3e363bf13460 100644 --- a/packages/rocketchat-channel-settings-mail-messages/package.js +++ b/packages/rocketchat-channel-settings-mail-messages/package.js @@ -13,6 +13,7 @@ Package.onUse(function(api) { 'less', 'rocketchat:lib', 'rocketchat:channel-settings', + 'mizzao:autocomplete', 'mongo', ]); diff --git a/packages/rocketchat-ui-clean-history/client/views/cleanHistory.js b/packages/rocketchat-ui-clean-history/client/views/cleanHistory.js index f277e5741d89..132bec2a7ed2 100644 --- a/packages/rocketchat-ui-clean-history/client/views/cleanHistory.js +++ b/packages/rocketchat-ui-clean-history/client/views/cleanHistory.js @@ -1,9 +1,9 @@ -/* globals AutoComplete */ import { Tracker } from 'meteor/tracker'; import { Blaze } from 'meteor/blaze'; import { ReactiveVar } from 'meteor/reactive-var'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; +import { AutoComplete } from 'meteor/mizzao:autocomplete'; import moment from 'moment'; import { call } from 'meteor/rocketchat:lib'; diff --git a/packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js b/packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js index d9e1b34e6b8e..26e60310006e 100644 --- a/packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js +++ b/packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js @@ -3,6 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Blaze } from 'meteor/blaze'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; +import { AutoComplete } from 'meteor/mizzao:autocomplete'; import toastr from 'toastr'; const acEvents = { @@ -121,7 +122,7 @@ Template.inviteUsers.onRendered(function() { users.set(usersArr); }); }); -/* global AutoComplete Deps */ +/* global Deps */ Template.inviteUsers.onCreated(function() { this.selectedUsers = new ReactiveVar([]); const filter = { exceptions :[Meteor.user().username].concat(this.selectedUsers.get().map((u) => u.username)) }; diff --git a/packages/rocketchat-ui-flextab/package.js b/packages/rocketchat-ui-flextab/package.js index 81709bdcff52..7a421084ec5f 100644 --- a/packages/rocketchat-ui-flextab/package.js +++ b/packages/rocketchat-ui-flextab/package.js @@ -16,6 +16,7 @@ Package.onUse(function(api) { 'ecmascript', 'templating', 'rocketchat:lib', + 'mizzao:autocomplete', ]); api.addFiles('client/flexTabBar.html', 'client'); diff --git a/packages/rocketchat-ui/client/views/app/createChannel.js b/packages/rocketchat-ui/client/views/app/createChannel.js index 4cf0a907e6b4..6a67df806389 100644 --- a/packages/rocketchat-ui/client/views/app/createChannel.js +++ b/packages/rocketchat-ui/client/views/app/createChannel.js @@ -4,6 +4,7 @@ import { Tracker } from 'meteor/tracker'; import { Blaze } from 'meteor/blaze'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; +import { AutoComplete } from 'meteor/mizzao:autocomplete'; import _ from 'underscore'; const acEvents = { @@ -266,7 +267,7 @@ Template.createChannel.onRendered(function() { users.set(usersArr); }); }); -/* global AutoComplete */ + Template.createChannel.onCreated(function() { this.selectedUsers = new ReactiveVar([]); diff --git a/packages/rocketchat-ui/package.js b/packages/rocketchat-ui/package.js index c1345a87ea93..c12b151dc0d6 100644 --- a/packages/rocketchat-ui/package.js +++ b/packages/rocketchat-ui/package.js @@ -26,6 +26,7 @@ Package.onUse(function(api) { 'raix:ui-dropped-event', 'rocketchat:lazy-load', 'rocketchat:e2e', + 'mizzao:autocomplete', ]); api.use('kadira:flow-router', 'client');