Skip to content

Commit

Permalink
Convert meteor-autocomplete package to main module structure (#12491)
Browse files Browse the repository at this point in the history
* First wave of removal of Meteor global

* Second wave of removal of Meteor global

* Third wave of removal of Meteor global

* Fix tests

* Remove global variable SHA256

* Remove global variable WebApp

* Remove global variable EJSON

* Remove global variable Email

* Remove global variable HTTP

* Remove global variable Random

* Remove global variable ReactiveDict

* Remove global variable ReactiveVar

* Remove global variable Accounts

* Remove globals variables Match and check

* Remove global variable Mongo

* Remove global variable moment

* Remove global variable Tracker

* Remove global variable Blaze

* Remove global variables FlowRouter and BlazeLayout

* Add FlowRouter to eslint global in tests file

* Remove global variable DDPRateLimiter

* Remove global variable Session

* Remove global variable UAParser

* Remove global variable Promise

* Remove global variable Reload

* Remove global variable CryptoJS

* Remove global variable Template

* Remove global variable TAPi18n

* Remove global variable TAPi18next

* Exposing t function from rocketchat:ui package

* Convert chatpal search to main module structure

* Fix ESLint

* Convert meteor-accounts-saml to main module structure

* Convert meteor-autocomplete to main module structure
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Nov 1, 2018
1 parent c5a14f2 commit b871405
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 24 deletions.
7 changes: 4 additions & 3 deletions packages/meteor-autocomplete/client/autocomplete-client.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -454,4 +455,4 @@ this.AutoComplete = class {
return this.rules[this.matched].template;
}

};
}
8 changes: 8 additions & 0 deletions packages/meteor-autocomplete/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import './autocomplete.css';
import './inputs.html';
import './templates';
import AutoComplete from './autocomplete-client';

export {
AutoComplete,
};
2 changes: 1 addition & 1 deletion packages/meteor-autocomplete/client/templates.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 12 additions & 16 deletions packages/meteor-autocomplete/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
1 change: 1 addition & 0 deletions packages/meteor-autocomplete/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './autocomplete-server';
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Package.onUse(function(api) {
'less',
'rocketchat:lib',
'rocketchat:channel-settings',
'mizzao:autocomplete',
'mongo',
]);

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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)) };
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-ui-flextab/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Package.onUse(function(api) {
'ecmascript',
'templating',
'rocketchat:lib',
'mizzao:autocomplete',
]);

api.addFiles('client/flexTabBar.html', 'client');
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-ui/client/views/app/createChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -266,7 +267,7 @@ Template.createChannel.onRendered(function() {
users.set(usersArr);
});
});
/* global AutoComplete */

Template.createChannel.onCreated(function() {
this.selectedUsers = new ReactiveVar([]);

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-ui/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit b871405

Please sign in to comment.