listBody.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. const subManager = new SubsManager();
  2. const InfiniteScrollIter = 10;
  3. BlazeComponent.extendComponent({
  4. onCreated() {
  5. // for infinite scrolling
  6. this.cardlimit = new ReactiveVar(InfiniteScrollIter);
  7. },
  8. mixins() {
  9. return [Mixins.PerfectScrollbar];
  10. },
  11. openForm(options) {
  12. options = options || {};
  13. options.position = options.position || 'top';
  14. const forms = this.childComponents('inlinedForm');
  15. let form = forms.find((component) => {
  16. return component.data().position === options.position;
  17. });
  18. if (!form && forms.length > 0) {
  19. form = forms[0];
  20. }
  21. form.open();
  22. },
  23. addCard(evt) {
  24. evt.preventDefault();
  25. const firstCardDom = this.find('.js-minicard:first');
  26. const lastCardDom = this.find('.js-minicard:last');
  27. const textarea = $(evt.currentTarget).find('textarea');
  28. const position = this.currentData().position;
  29. const title = textarea.val().trim();
  30. const formComponent = this.childComponents('addCardForm')[0];
  31. let sortIndex;
  32. if (position === 'top') {
  33. sortIndex = Utils.calculateIndex(null, firstCardDom).base;
  34. } else if (position === 'bottom') {
  35. sortIndex = Utils.calculateIndex(lastCardDom, null).base;
  36. }
  37. const members = formComponent.members.get();
  38. const labelIds = formComponent.labels.get();
  39. const customFields = formComponent.customFields.get();
  40. const board = this.data().board();
  41. let linkedId = '';
  42. let swimlaneId = '';
  43. const boardView = Meteor.user().profile.boardView;
  44. let cardType = 'cardType-card';
  45. if (title) {
  46. if (board.isTemplatesBoard()) {
  47. swimlaneId = this.parentComponent().parentComponent().data()._id; // Always swimlanes view
  48. const swimlane = Swimlanes.findOne(swimlaneId);
  49. // If this is the card templates swimlane, insert a card template
  50. if (swimlane.isCardTemplatesSwimlane())
  51. cardType = 'template-card';
  52. // If this is the board templates swimlane, insert a board template and a linked card
  53. else if (swimlane.isBoardTemplatesSwimlane()) {
  54. linkedId = Boards.insert({
  55. title,
  56. permission: 'private',
  57. type: 'template-board',
  58. });
  59. Swimlanes.insert({
  60. title: TAPi18n.__('default'),
  61. boardId: linkedId,
  62. });
  63. cardType = 'cardType-linkedBoard';
  64. }
  65. } else if (boardView === 'board-view-swimlanes')
  66. swimlaneId = this.parentComponent().parentComponent().data()._id;
  67. else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal'))
  68. swimlaneId = board.getDefaultSwimline()._id;
  69. const _id = Cards.insert({
  70. title,
  71. members,
  72. labelIds,
  73. customFields,
  74. listId: this.data()._id,
  75. boardId: board._id,
  76. sort: sortIndex,
  77. swimlaneId,
  78. type: cardType,
  79. linkedId,
  80. });
  81. // if the displayed card count is less than the total cards in the list,
  82. // we need to increment the displayed card count to prevent the spinner
  83. // to appear
  84. const cardCount = this.data().cards(this.idOrNull(swimlaneId)).count();
  85. if (this.cardlimit.get() < cardCount) {
  86. this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
  87. }
  88. // In case the filter is active we need to add the newly inserted card in
  89. // the list of exceptions -- cards that are not filtered. Otherwise the
  90. // card will disappear instantly.
  91. // See https://github.com/wekan/wekan/issues/80
  92. Filter.addException(_id);
  93. // We keep the form opened, empty it, and scroll to it.
  94. textarea.val('').focus();
  95. autosize.update(textarea);
  96. if (position === 'bottom') {
  97. this.scrollToBottom();
  98. }
  99. formComponent.reset();
  100. }
  101. },
  102. scrollToBottom() {
  103. const container = this.firstNode();
  104. $(container).animate({
  105. scrollTop: container.scrollHeight,
  106. });
  107. },
  108. clickOnMiniCard(evt) {
  109. if (MultiSelection.isActive() || evt.shiftKey) {
  110. evt.stopImmediatePropagation();
  111. evt.preventDefault();
  112. const methodName = evt.shiftKey ? 'toggleRange' : 'toggle';
  113. MultiSelection[methodName](this.currentData()._id);
  114. // If the card is already selected, we want to de-select it.
  115. // XXX We should probably modify the minicard href attribute instead of
  116. // overwriting the event in case the card is already selected.
  117. } else if (Session.equals('currentCard', this.currentData()._id)) {
  118. evt.stopImmediatePropagation();
  119. evt.preventDefault();
  120. Utils.goBoardId(Session.get('currentBoard'));
  121. }
  122. },
  123. cardIsSelected() {
  124. return Session.equals('currentCard', this.currentData()._id);
  125. },
  126. toggleMultiSelection(evt) {
  127. evt.stopPropagation();
  128. evt.preventDefault();
  129. MultiSelection.toggle(this.currentData()._id);
  130. },
  131. idOrNull(swimlaneId) {
  132. const currentUser = Meteor.user();
  133. if (currentUser.profile.boardView === 'board-view-swimlanes' ||
  134. this.data().board().isTemplatesBoard())
  135. return swimlaneId;
  136. return undefined;
  137. },
  138. cardsWithLimit(swimlaneId) {
  139. const limit = this.cardlimit.get();
  140. const selector = {
  141. listId: this.currentData()._id,
  142. archived: false,
  143. };
  144. if (swimlaneId)
  145. selector.swimlaneId = swimlaneId;
  146. return Cards.find(Filter.mongoSelector(selector), {
  147. sort: ['sort'],
  148. limit,
  149. });
  150. },
  151. showSpinner(swimlaneId) {
  152. const list = Template.currentData();
  153. return list.cards(swimlaneId).count() > this.cardlimit.get();
  154. },
  155. canSeeAddCard() {
  156. return !this.reachedWipLimit() && Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
  157. },
  158. reachedWipLimit() {
  159. const list = Template.currentData();
  160. return !list.getWipLimit('soft') && list.getWipLimit('enabled') && list.getWipLimit('value') <= list.cards().count();
  161. },
  162. events() {
  163. return [{
  164. 'click .js-minicard': this.clickOnMiniCard,
  165. 'click .js-toggle-multi-selection': this.toggleMultiSelection,
  166. 'click .open-minicard-composer': this.scrollToBottom,
  167. submit: this.addCard,
  168. }];
  169. },
  170. }).register('listBody');
  171. function toggleValueInReactiveArray(reactiveValue, value) {
  172. const array = reactiveValue.get();
  173. const valueIndex = array.indexOf(value);
  174. if (valueIndex === -1) {
  175. array.push(value);
  176. } else {
  177. array.splice(valueIndex, 1);
  178. }
  179. reactiveValue.set(array);
  180. }
  181. BlazeComponent.extendComponent({
  182. onCreated() {
  183. this.labels = new ReactiveVar([]);
  184. this.members = new ReactiveVar([]);
  185. this.customFields = new ReactiveVar([]);
  186. const currentBoardId = Session.get('currentBoard');
  187. arr = [];
  188. _.forEach(Boards.findOne(currentBoardId).customFields().fetch(), function(field){
  189. if(field.automaticallyOnCard)
  190. arr.push({_id: field._id, value: null});
  191. });
  192. this.customFields.set(arr);
  193. },
  194. reset() {
  195. this.labels.set([]);
  196. this.members.set([]);
  197. this.customFields.set([]);
  198. },
  199. getLabels() {
  200. const currentBoardId = Session.get('currentBoard');
  201. return Boards.findOne(currentBoardId).labels.filter((label) => {
  202. return this.labels.get().indexOf(label._id) > -1;
  203. });
  204. },
  205. pressKey(evt) {
  206. // Pressing Enter should submit the card
  207. if (evt.keyCode === 13 && !evt.shiftKey) {
  208. evt.preventDefault();
  209. const $form = $(evt.currentTarget).closest('form');
  210. // XXX For some reason $form.submit() does not work (it's probably a bug
  211. // of blaze-component related to the fact that the submit event is non-
  212. // bubbling). This is why we click on the submit button instead -- which
  213. // work.
  214. $form.find('button[type=submit]').click();
  215. // Pressing Tab should open the form of the next column, and Maj+Tab go
  216. // in the reverse order
  217. } else if (evt.keyCode === 9) {
  218. evt.preventDefault();
  219. const isReverse = evt.shiftKey;
  220. const list = $(`#js-list-${this.data().listId}`);
  221. const listSelector = '.js-list:not(.js-list-composer)';
  222. let nextList = list[isReverse ? 'prev' : 'next'](listSelector).get(0);
  223. // If there is no next list, loop back to the beginning.
  224. if (!nextList) {
  225. nextList = $(listSelector + (isReverse ? ':last' : ':first')).get(0);
  226. }
  227. BlazeComponent.getComponentForElement(nextList).openForm({
  228. position:this.data().position,
  229. });
  230. }
  231. },
  232. events() {
  233. return [{
  234. keydown: this.pressKey,
  235. 'click .js-link': Popup.open('linkCard'),
  236. 'click .js-search': Popup.open('searchElement'),
  237. 'click .js-card-template': Popup.open('searchElement'),
  238. }];
  239. },
  240. onRendered() {
  241. const editor = this;
  242. const $textarea = this.$('textarea');
  243. autosize($textarea);
  244. $textarea.escapeableTextComplete([
  245. // User mentions
  246. {
  247. match: /\B@([\w.]*)$/,
  248. search(term, callback) {
  249. const currentBoard = Boards.findOne(Session.get('currentBoard'));
  250. callback($.map(currentBoard.activeMembers(), (member) => {
  251. const user = Users.findOne(member.userId);
  252. return user.username.indexOf(term) === 0 ? user : null;
  253. }));
  254. },
  255. template(user) {
  256. return user.username;
  257. },
  258. replace(user) {
  259. toggleValueInReactiveArray(editor.members, user._id);
  260. return '';
  261. },
  262. index: 1,
  263. },
  264. // Labels
  265. {
  266. match: /\B#(\w*)$/,
  267. search(term, callback) {
  268. const currentBoard = Boards.findOne(Session.get('currentBoard'));
  269. callback($.map(currentBoard.labels, (label) => {
  270. if (label.name.indexOf(term) > -1 ||
  271. label.color.indexOf(term) > -1) {
  272. return label;
  273. }
  274. return null;
  275. }));
  276. },
  277. template(label) {
  278. return Blaze.toHTMLWithData(Template.autocompleteLabelLine, {
  279. hasNoName: !label.name,
  280. colorName: label.color,
  281. labelName: label.name || label.color,
  282. });
  283. },
  284. replace(label) {
  285. toggleValueInReactiveArray(editor.labels, label._id);
  286. return '';
  287. },
  288. index: 1,
  289. },
  290. ], {
  291. // When the autocomplete menu is shown we want both a press of both `Tab`
  292. // or `Enter` to validation the auto-completion. We also need to stop the
  293. // event propagation to prevent the card from submitting (on `Enter`) or
  294. // going on the next column (on `Tab`).
  295. onKeydown(evt, commands) {
  296. if (evt.keyCode === 9 || evt.keyCode === 13) {
  297. evt.stopPropagation();
  298. return commands.KEY_ENTER;
  299. }
  300. return null;
  301. },
  302. });
  303. },
  304. }).register('addCardForm');
  305. BlazeComponent.extendComponent({
  306. onCreated() {
  307. this.selectedBoardId = new ReactiveVar('');
  308. this.selectedSwimlaneId = new ReactiveVar('');
  309. this.selectedListId = new ReactiveVar('');
  310. this.boardId = Session.get('currentBoard');
  311. // In order to get current board info
  312. subManager.subscribe('board', this.boardId);
  313. this.board = Boards.findOne(this.boardId);
  314. // List where to insert card
  315. const list = $(Popup._getTopStack().openerElement).closest('.js-list');
  316. this.listId = Blaze.getData(list[0])._id;
  317. // Swimlane where to insert card
  318. const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane');
  319. this.swimlaneId = '';
  320. const boardView = Meteor.user().profile.boardView;
  321. if (boardView === 'board-view-swimlanes')
  322. this.swimlaneId = Blaze.getData(swimlane[0])._id;
  323. else if (boardView === 'board-view-lists')
  324. this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
  325. },
  326. boards() {
  327. const boards = Boards.find({
  328. archived: false,
  329. 'members.userId': Meteor.userId(),
  330. _id: {$ne: Session.get('currentBoard')},
  331. type: 'board',
  332. }, {
  333. sort: ['title'],
  334. });
  335. return boards;
  336. },
  337. swimlanes() {
  338. if (!this.selectedBoardId.get()) {
  339. return [];
  340. }
  341. const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
  342. if (swimlanes.count())
  343. this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id);
  344. return swimlanes;
  345. },
  346. lists() {
  347. if (!this.selectedBoardId.get()) {
  348. return [];
  349. }
  350. const lists = Lists.find({boardId: this.selectedBoardId.get()});
  351. if (lists.count())
  352. this.selectedListId.set(lists.fetch()[0]._id);
  353. return lists;
  354. },
  355. cards() {
  356. if (!this.board) {
  357. return [];
  358. }
  359. const ownCardsIds = this.board.cards().map((card) => { return card.linkedId || card._id; });
  360. return Cards.find({
  361. boardId: this.selectedBoardId.get(),
  362. swimlaneId: this.selectedSwimlaneId.get(),
  363. listId: this.selectedListId.get(),
  364. archived: false,
  365. linkedId: {$nin: ownCardsIds},
  366. _id: {$nin: ownCardsIds},
  367. type: {$nin: ['template-card']},
  368. });
  369. },
  370. events() {
  371. return [{
  372. 'change .js-select-boards'(evt) {
  373. subManager.subscribe('board', $(evt.currentTarget).val());
  374. this.selectedBoardId.set($(evt.currentTarget).val());
  375. },
  376. 'change .js-select-swimlanes'(evt) {
  377. this.selectedSwimlaneId.set($(evt.currentTarget).val());
  378. },
  379. 'change .js-select-lists'(evt) {
  380. this.selectedListId.set($(evt.currentTarget).val());
  381. },
  382. 'click .js-done' (evt) {
  383. // LINK CARD
  384. evt.stopPropagation();
  385. evt.preventDefault();
  386. const linkedId = $('.js-select-cards option:selected').val();
  387. if (!linkedId) {
  388. Popup.close();
  389. return;
  390. }
  391. const _id = Cards.insert({
  392. title: $('.js-select-cards option:selected').text(), //dummy
  393. listId: this.listId,
  394. swimlaneId: this.swimlaneId,
  395. boardId: this.boardId,
  396. sort: Lists.findOne(this.listId).cards().count(),
  397. type: 'cardType-linkedCard',
  398. linkedId,
  399. });
  400. Filter.addException(_id);
  401. Popup.close();
  402. },
  403. 'click .js-link-board' (evt) {
  404. //LINK BOARD
  405. evt.stopPropagation();
  406. evt.preventDefault();
  407. const impBoardId = $('.js-select-boards option:selected').val();
  408. if (!impBoardId || Cards.findOne({linkedId: impBoardId, archived: false})) {
  409. Popup.close();
  410. return;
  411. }
  412. const _id = Cards.insert({
  413. title: $('.js-select-boards option:selected').text(), //dummy
  414. listId: this.listId,
  415. swimlaneId: this.swimlaneId,
  416. boardId: this.boardId,
  417. sort: Lists.findOne(this.listId).cards().count(),
  418. type: 'cardType-linkedBoard',
  419. linkedId: impBoardId,
  420. });
  421. Filter.addException(_id);
  422. Popup.close();
  423. },
  424. }];
  425. },
  426. }).register('linkCardPopup');
  427. BlazeComponent.extendComponent({
  428. mixins() {
  429. return [Mixins.PerfectScrollbar];
  430. },
  431. onCreated() {
  432. this.isCardTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-card-template');
  433. this.isListTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-list-template');
  434. this.isSwimlaneTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-open-add-swimlane-menu');
  435. this.isBoardTemplateSearch = $(Popup._getTopStack().openerElement).hasClass('js-add-board');
  436. this.isTemplateSearch = this.isCardTemplateSearch ||
  437. this.isListTemplateSearch ||
  438. this.isSwimlaneTemplateSearch ||
  439. this.isBoardTemplateSearch;
  440. let board = {};
  441. if (this.isTemplateSearch) {
  442. board = Boards.findOne(Meteor.user().profile.templatesBoardId);
  443. } else {
  444. // Prefetch first non-current board id
  445. board = Boards.findOne({
  446. archived: false,
  447. 'members.userId': Meteor.userId(),
  448. _id: {$nin: [Session.get('currentBoard'), Meteor.user().profile.templatesBoardId]},
  449. });
  450. }
  451. if (!board) {
  452. Popup.close();
  453. return;
  454. }
  455. const boardId = board._id;
  456. // Subscribe to this board
  457. subManager.subscribe('board', boardId);
  458. this.selectedBoardId = new ReactiveVar(boardId);
  459. if (!this.isBoardTemplateSearch) {
  460. this.boardId = Session.get('currentBoard');
  461. // In order to get current board info
  462. subManager.subscribe('board', this.boardId);
  463. this.swimlaneId = '';
  464. // Swimlane where to insert card
  465. const swimlane = $(Popup._getTopStack().openerElement).parents('.js-swimlane');
  466. if (Meteor.user().profile.boardView === 'board-view-swimlanes')
  467. this.swimlaneId = Blaze.getData(swimlane[0])._id;
  468. else
  469. this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
  470. // List where to insert card
  471. const list = $(Popup._getTopStack().openerElement).closest('.js-list');
  472. this.listId = Blaze.getData(list[0])._id;
  473. }
  474. this.term = new ReactiveVar('');
  475. },
  476. boards() {
  477. const boards = Boards.find({
  478. archived: false,
  479. 'members.userId': Meteor.userId(),
  480. _id: {$ne: Session.get('currentBoard')},
  481. type: 'board',
  482. }, {
  483. sort: ['title'],
  484. });
  485. return boards;
  486. },
  487. results() {
  488. if (!this.selectedBoardId) {
  489. return [];
  490. }
  491. const board = Boards.findOne(this.selectedBoardId.get());
  492. if (!this.isTemplateSearch || this.isCardTemplateSearch) {
  493. return board.searchCards(this.term.get(), false);
  494. } else if (this.isListTemplateSearch) {
  495. return board.searchLists(this.term.get());
  496. } else if (this.isSwimlaneTemplateSearch) {
  497. return board.searchSwimlanes(this.term.get());
  498. } else if (this.isBoardTemplateSearch) {
  499. const boards = board.searchBoards(this.term.get());
  500. boards.forEach((board) => {
  501. subManager.subscribe('board', board.linkedId);
  502. });
  503. return boards;
  504. } else {
  505. return [];
  506. }
  507. },
  508. events() {
  509. return [{
  510. 'change .js-select-boards'(evt) {
  511. subManager.subscribe('board', $(evt.currentTarget).val());
  512. this.selectedBoardId.set($(evt.currentTarget).val());
  513. },
  514. 'submit .js-search-term-form'(evt) {
  515. evt.preventDefault();
  516. this.term.set(evt.target.searchTerm.value);
  517. },
  518. 'click .js-minicard'(evt) {
  519. // 0. Common
  520. const title = $('.js-element-title').val().trim();
  521. if (!title)
  522. return;
  523. const element = Blaze.getData(evt.currentTarget);
  524. element.title = title;
  525. let _id = '';
  526. if (!this.isTemplateSearch || this.isCardTemplateSearch) {
  527. // Card insertion
  528. // 1. Common
  529. element.sort = Lists.findOne(this.listId).cards().count();
  530. // 1.A From template
  531. if (this.isTemplateSearch) {
  532. element.type = 'cardType-card';
  533. element.linkedId = '';
  534. _id = element.copy(this.boardId, this.swimlaneId, this.listId);
  535. // 1.B Linked card
  536. } else {
  537. delete element._id;
  538. element.type = 'cardType-linkedCard';
  539. element.linkedId = element.linkedId || element._id;
  540. _id = Cards.insert(element);
  541. }
  542. Filter.addException(_id);
  543. // List insertion
  544. } else if (this.isListTemplateSearch) {
  545. element.sort = Swimlanes.findOne(this.swimlaneId).lists().count();
  546. element.type = 'list';
  547. _id = element.copy(this.boardId, this.swimlaneId);
  548. } else if (this.isSwimlaneTemplateSearch) {
  549. element.sort = Boards.findOne(this.boardId).swimlanes().count();
  550. element.type = 'swimlalne';
  551. _id = element.copy(this.boardId);
  552. } else if (this.isBoardTemplateSearch) {
  553. board = Boards.findOne(element.linkedId);
  554. board.sort = Boards.find({archived: false}).count();
  555. board.type = 'board';
  556. board.title = element.title;
  557. delete board.slug;
  558. _id = board.copy();
  559. }
  560. Popup.close();
  561. },
  562. }];
  563. },
  564. }).register('searchElementPopup');
  565. BlazeComponent.extendComponent({
  566. onCreated() {
  567. this.cardlimit = this.parentComponent().cardlimit;
  568. this.listId = this.parentComponent().data()._id;
  569. this.swimlaneId = '';
  570. const boardView = Meteor.user().profile.boardView;
  571. if (boardView === 'board-view-swimlanes')
  572. this.swimlaneId = this.parentComponent().parentComponent().parentComponent().data()._id;
  573. },
  574. onRendered() {
  575. this.spinner = this.find('.sk-spinner-list');
  576. this.container = this.$(this.spinner).parents('.js-perfect-scrollbar')[0];
  577. $(this.container).on(`scroll.spinner_${this.swimlaneId}_${this.listId}`, () => this.updateList());
  578. $(window).on(`resize.spinner_${this.swimlaneId}_${this.listId}`, () => this.updateList());
  579. this.updateList();
  580. },
  581. onDestroyed() {
  582. $(this.container).off(`scroll.spinner_${this.swimlaneId}_${this.listId}`);
  583. $(window).off(`resize.spinner_${this.swimlaneId}_${this.listId}`);
  584. },
  585. updateList() {
  586. if (this.spinnerInView()) {
  587. this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
  588. window.requestIdleCallback(() => this.updateList());
  589. }
  590. },
  591. spinnerInView() {
  592. const parentViewHeight = this.container.clientHeight;
  593. const bottomViewPosition = this.container.scrollTop + parentViewHeight;
  594. const threshold = this.spinner.offsetTop;
  595. // spinner deleted
  596. if (!this.spinner.offsetTop) {
  597. return false;
  598. }
  599. return bottomViewPosition > threshold;
  600. },
  601. }).register('spinnerList');