@bennerinformatics/ember-fw-table 2.0.21 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +6 -0
  2. package/addon/classes/Row.js +19 -13
  3. package/addon/classes/Table.js +18 -13
  4. package/addon/components/fw-cell-action.js +9 -5
  5. package/addon/components/fw-cell-boolean.js +4 -3
  6. package/addon/components/fw-cell-nullable.js +5 -2
  7. package/addon/components/fw-cell-permission-icon.js +19 -3
  8. package/addon/components/fw-column-sortable.js +12 -4
  9. package/addon/components/fw-column-title.js +12 -4
  10. package/addon/components/fw-delete-modal.js +30 -11
  11. package/addon/components/fw-expandable-row.js +5 -0
  12. package/addon/components/fw-pagination-wrapper.js +81 -162
  13. package/addon/components/fw-row-toggle-index.js +4 -4
  14. package/addon/components/fw-row-toggle.js +12 -5
  15. package/addon/components/fw-table-expanded-row.js +5 -6
  16. package/addon/components/fw-table-expanded-rows.js +8 -4
  17. package/addon/components/fw-table-resort.js +29 -16
  18. package/addon/components/fw-table-sortable.js +40 -24
  19. package/addon/documentation.js +26 -61
  20. package/addon/templates/components/fw-delete-modal.hbs +1 -1
  21. package/addon/utils/base-cells.js +40 -5
  22. package/addon/utils/export.js +3 -1
  23. package/addon/utils/formats.js +54 -7
  24. package/addon/utils/table.js +2 -1
  25. package/index.js +2 -1
  26. package/package.json +5 -7
  27. package/yuidoc-ember-theme/LICENSE +21 -0
  28. package/yuidoc-ember-theme/README.md +88 -0
  29. package/yuidoc-ember-theme/assets/css/custom.css +82 -0
  30. package/yuidoc-ember-theme/assets/css/external-small.png +0 -0
  31. package/yuidoc-ember-theme/assets/css/main.css +793 -0
  32. package/yuidoc-ember-theme/assets/css/theme.css +547 -0
  33. package/yuidoc-ember-theme/assets/icons/android-icon-144x144.png +0 -0
  34. package/yuidoc-ember-theme/assets/icons/android-icon-192x192.png +0 -0
  35. package/yuidoc-ember-theme/assets/icons/android-icon-36x36.png +0 -0
  36. package/yuidoc-ember-theme/assets/icons/android-icon-48x48.png +0 -0
  37. package/yuidoc-ember-theme/assets/icons/android-icon-72x72.png +0 -0
  38. package/yuidoc-ember-theme/assets/icons/android-icon-96x96.png +0 -0
  39. package/yuidoc-ember-theme/assets/icons/apple-icon-114x114.png +0 -0
  40. package/yuidoc-ember-theme/assets/icons/apple-icon-120x120.png +0 -0
  41. package/yuidoc-ember-theme/assets/icons/apple-icon-144x144.png +0 -0
  42. package/yuidoc-ember-theme/assets/icons/apple-icon-152x152.png +0 -0
  43. package/yuidoc-ember-theme/assets/icons/apple-icon-180x180.png +0 -0
  44. package/yuidoc-ember-theme/assets/icons/apple-icon-57x57.png +0 -0
  45. package/yuidoc-ember-theme/assets/icons/apple-icon-60x60.png +0 -0
  46. package/yuidoc-ember-theme/assets/icons/apple-icon-72x72.png +0 -0
  47. package/yuidoc-ember-theme/assets/icons/apple-icon-76x76.png +0 -0
  48. package/yuidoc-ember-theme/assets/icons/apple-icon-precomposed.png +0 -0
  49. package/yuidoc-ember-theme/assets/icons/apple-icon.png +0 -0
  50. package/yuidoc-ember-theme/assets/icons/browserconfig.xml +2 -0
  51. package/yuidoc-ember-theme/assets/icons/favicon-16x16.png +0 -0
  52. package/yuidoc-ember-theme/assets/icons/favicon-32x32.png +0 -0
  53. package/yuidoc-ember-theme/assets/icons/favicon-96x96.png +0 -0
  54. package/yuidoc-ember-theme/assets/icons/favicon.ico +0 -0
  55. package/yuidoc-ember-theme/assets/icons/manifest.json +41 -0
  56. package/yuidoc-ember-theme/assets/icons/ms-icon-144x144.png +0 -0
  57. package/yuidoc-ember-theme/assets/icons/ms-icon-150x150.png +0 -0
  58. package/yuidoc-ember-theme/assets/icons/ms-icon-310x310.png +0 -0
  59. package/yuidoc-ember-theme/assets/icons/ms-icon-70x70.png +0 -0
  60. package/yuidoc-ember-theme/assets/img/ember-logo.png +0 -0
  61. package/yuidoc-ember-theme/assets/img/fw-logo.png +0 -0
  62. package/yuidoc-ember-theme/assets/img/spinner.gif +0 -0
  63. package/yuidoc-ember-theme/assets/index.html +10 -0
  64. package/yuidoc-ember-theme/assets/js/yuidoc-bootstrap.js +274 -0
  65. package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
  66. package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
  67. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  68. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  69. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  70. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  71. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  72. package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  73. package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  74. package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
  75. package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
  76. package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
  77. package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
  78. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  79. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  80. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
  81. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  82. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  83. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  84. package/yuidoc-ember-theme/assets/vendor/github-slugger/slugger.js +59 -0
  85. package/yuidoc-ember-theme/assets/vendor/jquery/jquery.min.js +6 -0
  86. package/yuidoc-ember-theme/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
  87. package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.css +1 -0
  88. package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.js +1 -0
  89. package/yuidoc-ember-theme/helpers/helpers.js +236 -0
  90. package/yuidoc-ember-theme/layouts/main.handlebars +111 -0
  91. package/yuidoc-ember-theme/layouts/xhr.handlebars +7 -0
  92. package/yuidoc-ember-theme/package.json +15 -0
  93. package/yuidoc-ember-theme/partials/attrs.handlebars +144 -0
  94. package/yuidoc-ember-theme/partials/classes.handlebars +229 -0
  95. package/yuidoc-ember-theme/partials/events.handlebars +140 -0
  96. package/yuidoc-ember-theme/partials/files.handlebars +9 -0
  97. package/yuidoc-ember-theme/partials/index.handlebars +25 -0
  98. package/yuidoc-ember-theme/partials/method.handlebars +193 -0
  99. package/yuidoc-ember-theme/partials/module.handlebars +108 -0
  100. package/yuidoc-ember-theme/partials/options.handlebars +22 -0
  101. package/yuidoc-ember-theme/partials/props.handlebars +122 -0
  102. package/yuidoc-ember-theme/partials/sidebar.handlebars +77 -0
  103. package/yuidoc-ember-theme/theme.json +4 -0
  104. package/yuidoc-ember-theme/yarn.lock +4 -0
  105. package/yuidoc.json +4 -2
  106. /package/{bitbucket-helpers-override.js → yuidoc-ember-theme/helpers/bitbucket-helpers-override.js} +0 -0
@@ -9,124 +9,30 @@ import Table from 'ember-light-table';
9
9
  import RSVP from 'rsvp';
10
10
  import layout from '../templates/components/fw-pagination-wrapper';
11
11
  /**
12
- * In order to use this component, you also need to install the `ember-cli-pagination` addon
13
- * to your app. And to make sure that the css looks correct for the pages, in your app.scss file
14
- * import the styling after all related `ember-fw` imports:
15
- * ```css
16
- * @import "ember-fw/pagination/pagination-fw";
17
- * ```
18
- *
19
- * This component works very closely with our Informatics Framework system to create a
20
- * paginated table, but being such, it also expects certain things from the browse request
21
- * to get it to work. So that being said, this documentation will need to describe how to use
22
- * both the client side and the serverside of this component. If you do not use our FW system as
23
- * your server side, you will need to find a way to get it to return count and limited as is detailed here.
24
- *
25
- * ###Client Side
26
- * There are a few things that are needed to be talked about with the client side. There are some parameters
27
- * that are needed no matter whether you wrap a table or use a default table. But when it comes to the table,
28
- * you can use block form, where you specify the table (see [fw-table-sortable](FW-Table-Sortable.html)),
29
- * or you can pass in extra parameters so this function, and it will make a table for you.
30
- *
31
- * ####Mandatory Parameters
32
- * While below deals with all of the different options that you can pass in as properties to this parameter, as
33
- * well as all internal properties used by the component by way of explanation, referencing those parameters that
34
- * are necessary for the proper functioning of this component are helpful here. See below for details about each property:
35
- *
36
- * * Basic Properties
37
- * - `modelName`
38
- * - `defaultSortKey`
39
- * - `tableWrapperClass`
40
- * - `entriesPerPage`
41
- * * Action Properties (these need to be actions that are passed in)
42
- * - `onSearch`
43
- * - `makeQuery`
44
- * - `getTitle`
45
- * - `getExportColumns`
46
- *
47
- * ####Setting Up the Table
48
- * #####Table Column Usage
49
- * The following parameters from table columns are utilized in searching and sorting.
50
- * searchKey: Key to send to the server side when sorting by this column. If unset, defaults to valuePath. Most commonly used when valuePath uses a relationship property, as searchKey can then just use the relationship name.
51
- * component: To show the loading spinner on the header during searching, component must be set to a header component that shows a spinner when column.loading is true. fw-column-title is an option that will handle this for you.
12
+ * For an in depth guide on how to implement pagination, including on the server, see our [Paginated Table Concept](https://linformatics.bitbucket.io/docs/addons/client/ember-fw-table/concepts/paginated-table).
13
+ * All of the possible parameters are documented below. At its most basic, however, there are two ways to use `FwPaginationWrapper` in parameter form or in block form. Here is a brief example of each:
52
14
  *
53
- * #####Block invoking
54
- * This template is typically invoked in block format, wrapping around the history search panel. When called in block form, a single hash parameter called actions is provided. This contains the following properties:
55
- * actions.search: Action to call to use search parameter and fetch entries.
56
- * actions.export: Action to call to fetch all entries and export them into a CSV file.
57
- *
58
- * These actions should be used within the search panel to create search and export buttons.
59
- * Table
60
- * The results table can be provided in two forms: block format and parameter format.
61
- * Parameter format
62
- * Calling the table in parameter format will use a default fw-table-sortable. In this format, the following additional parameters to fw-pagination-wrapper are available:
63
- * getTableColumns: Action callback to get the table columns. Callback in case it changes on search, but has no parameters
64
- * emptyText: Text to display when the table is empty. If unset, hides the table when empty.
65
- * tableActions: Parameter to send into fw-table-sortable’s tableActions
66
- * Block format
67
- * Block format allows passing in a custom table component instead of using fw-table-sortable. In this format, the table is included in the block with the search panel. To distinguish the two, a second parameter, table, is included. It will be an object for the table, and null for the search panel. The code below shows an example of using the block format with both parameters:
68
- * ```hbs
69
- * <FwPaginationWrapper
70
- * …
71
- * as |actions table|
72
- * >
15
+ * Parameter form:
16
+ * ```handlebars
17
+ * <FwPaginationWrapper @modelName="myModel" @defaultSortKey="sortKey" @makeQuery={{action "makeQuery"}} @getTitle={{action "getTitle"}} @getTableColumns={{action "getTableColumns"}} @tableActions={{hash ...}} as |actions|>
18
+ * {{!-- Search panel contents --}}
19
+ * {{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
20
+ * </FwPaginationWrapper>
21
+ * ```
22
+ * Block form:
23
+ * ```handlebars
24
+ * <FwPaginationWrapper @modelName="myModel" @defaultSortKey="sortKey" @makeQuery={{action "makeQuery"}} @getTitle={{action "getTitle"}} as |actions table|>
73
25
  * {{#unless table}}
74
26
  * {{!-- Search panel contents --}}
27
+ * {{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
75
28
  * {{else}}
76
29
  * {{!-- Table component invocation --}}
30
+ * {{!-- actions.sort and table.title, table.suffix, table.entries, and table.sortKey are defined for you to use in this section appropriately--}}
77
31
  * {{/unless}}
78
32
  * </FwPaginationWrapper>
79
33
  * ```
80
- * In block format when table is defined, actions contains the following actions:
81
- * actions.sort: Action to use in fw-table-sortable’s onSort, called when a column is clicked.
82
- *
83
- * table contains the following parameters:
84
- * table.title: Full title for the table, pass to tables as title.
85
- * table.suffix: Suffix for the table title. Used in some custom table components.
86
- * table.entries: List of entries to display in the table. Passed to a table as the first unnamed parameter, rows.
87
- * table.sortKey: Currently active sort key for the table. Passed to a table as defaultSort *
88
- * ###Server Side
89
- *
90
- * The client side performs all history behavior using the browse method of the given model, based on the modelName parameter. The browse route must support several query parameters to handle all cases.
91
- * Count
92
- * The count parameter is a boolean that when set to true returns a count of results instead of the results. This is needed to calculate the number of pages available and to show the total in the table title.
93
- *
94
- * Count can be performed simply using $this->adapter->count in place of findAll. It takes two parameters, $modelName and $query, same as the first two parameters to findAll. For usage in the table, the result must be placed in a key, “count”, such as with the following code:
95
- * $count = $this->adapter->count($modelName, $query);
96
- * return $this->view->helper('json')->add($count, 'count');
97
- * Limit and Offset
98
- * The main feature of pagination is the ability to fetch only one page of results at a time, reducing the amount of data fetched in requests.
99
- * limit:
100
- * This parameter determines the number of entries per page, as defined by entriesPerPage.
101
- * This can be accomplished using a filter with $qb->limit.
102
- * offset:
103
- * This determines the first entry to be fetched for the limit.
104
- * This can be accomplished using a filter with $qb->offset.
105
- *
106
- * The following code implements both limit and offset:
107
- * ```js
108
- * if (isset($options->limit)) {* $limit = $options->limit;* $offset = $options->offset ?? 0;* $this->adapter->addFilter($modelName, function($qb)* use ($limit, $offset) {* $qb->limit($limit);* $qb->offset($offset);* });
109
- * }
110
- * ```
111
- * Sorting
112
- * Pagination requires refetching all pages every time the sort order changes, as the first result may not be on the first page. fw-pagination-wrapper handles all the logic needed to do that client side, but it needs to be supported on the server side to work. This requires two parameters:
113
- * sortKey: Table key to use in sorting
114
- * ascending: If true, sorts results ascending. If false, sorts them descending.
115
- *
116
- * The following code implements sort key and ascending:
117
- * ```js
118
- * if (isset($options->sortKey)) {* $sortKey = alias($options->sortKey);* $ascending = ($options->ascending ?? 'false') == 'true';* $ascending = $ascending ? 'ASC' : 'DESC';* $this->adapter->addFilter($modelName, function($qb)* use ($sortKey, $ascending) {* $qb->orderBy($sortKey, $ascending);
119
- * });
120
- * }
121
- * ```
122
- * In this code, alias is a function that maps the sortKey from the client side name used in the parameter to the server side name supported by SQL. Point of Sales handles this using a function in the model, called using $this->adapter->aliasKey.
123
- *
124
- * Note you may need more complex code to sort by complex table fields, such as a relationship (such as Status’s location name) or a computed value (such as Point of Sales’s transaction log total). An example of this can be found in Point of Sales.
125
- * Design Considerations
126
- * It is important to note that if you want to use SQL limiting and offsets, you should do all filtering and sorting using SQL. This means that any filters in PHP need to be migrated to SQL or otherwise some pages will return too few results.
127
- *
128
- *
129
- * @class FW-Pagination-Wrapper
34
+ * @class FwPaginationWrapper
35
+ * @module Components
130
36
  */
131
37
  export default Component.extend({
132
38
  layout,
@@ -139,7 +45,7 @@ export default Component.extend({
139
45
 
140
46
  didReceiveAttrs() {
141
47
  this._super(...arguments);
142
- if (this.get('searchOnRender')) {
48
+ if (this.searchOnRender) {
143
49
  this.send('search');
144
50
  }
145
51
  },
@@ -193,7 +99,7 @@ export default Component.extend({
193
99
 
194
100
  /**
195
101
  * Gets the title of this table at the given time
196
- * @property getTitle
102
+ * @method getTitle
197
103
  * @type {Action}
198
104
  * @return {String} Title of this table
199
105
  */
@@ -203,7 +109,7 @@ export default Component.extend({
203
109
 
204
110
  /**
205
111
  * Gets a list of table columns for exporting
206
- * @property getTableColumns
112
+ * @method getTableColumns
207
113
  * @type {Action}
208
114
  * @return {Array} Array of table columns
209
115
  */
@@ -212,19 +118,20 @@ export default Component.extend({
212
118
  /**
213
119
  * Action to be called when the table search button is pressed.
214
120
  * @type {Function}
215
- * @property onSearch
121
+ * @method onSearch
216
122
  */
217
123
  onSearch() {},
218
124
 
219
125
  /**
220
- * Called to delete the full page of entries
221
- * Should be passed in with a function
222
- * @property deletePage
126
+ * Called to delete the full page of entries.
127
+ * Should be passed in with a function. Button will only appear if this is defined
128
+ * @method deletePage
129
+ * @type {Action}
223
130
  */
224
131
  deletePage: undefined,
225
132
 
226
133
  /**
227
- * Determines permission for deleteTablePermission for fw-table-sortable
134
+ * Determines permission for deleteTablePermission for `FwTableSortable`. Should probably use a `has-role` helper from Group Control
228
135
  * @property deletePagePermission
229
136
  * @type {Boolean}
230
137
  * @default true
@@ -232,7 +139,7 @@ export default Component.extend({
232
139
  deletePagePermission: true,
233
140
  /**
234
141
  * Makes a query object based on the search fields
235
- * @property makeQuery
142
+ * @method makeQuery
236
143
  * @type {Action}
237
144
  * @param {Boolean} count If true, counting
238
145
  * @param {Number} page If defined, page number for a page search
@@ -262,7 +169,7 @@ export default Component.extend({
262
169
  emptyText: null,
263
170
 
264
171
  /**
265
- * Actions to pass into the table
172
+ * Actions to pass into the table. Should be a hash as usual
266
173
  * @property tableActions
267
174
  * @type {Object}
268
175
  */
@@ -280,17 +187,19 @@ export default Component.extend({
280
187
  */
281
188
 
282
189
  /**
283
- * Table title at this time
190
+ * Table title at this time. Internal property. Set by `getTableTitle`
284
191
  * @property currentTitle
285
192
  * @type {String}
193
+ * @private
286
194
  */
287
195
  currentTitle: null,
288
196
 
289
197
  /**
290
- * If true, currently doing the main search
198
+ * If true, currently doing the main search. Internal property set by search functionality.
291
199
  * @property searchingTable
292
200
  * @type {Boolean}
293
201
  * @default false
202
+ * @private
294
203
  */
295
204
  searchingTable: false,
296
205
 
@@ -302,32 +211,36 @@ export default Component.extend({
302
211
  */
303
212
  showExport: true,
304
213
  /**
305
- * Number of pages being searched
214
+ * Number of pages being searched. Internal property
306
215
  * @property pagesSearching
307
216
  * @type {Number}
308
217
  * @default 0
218
+ * @private
309
219
  */
310
220
  pagesSearching: 0,
311
221
 
312
222
  /**
313
- * Array of entries, indexes are the pages
223
+ * Array of entries, indexes are the pages. Internal Property for more quickly rendering pages that have been searched this time.
314
224
  * @property pageEntries
315
225
  * @type {Array}
226
+ * @private
316
227
  */
317
228
  pageEntries: null,
318
229
 
319
230
  /**
320
- * Currently selected page
231
+ * Currently selected page. Internal property to be set by clicking one of the page numbers.
321
232
  * @property page
322
233
  * @type {Number}
323
234
  * @default 1
235
+ * @private
324
236
  */
325
237
  page: 1,
326
238
 
327
239
  /**
328
- * Total number of entries
240
+ * Total number of entries. Internal property set by the count network request.
329
241
  * @property count
330
242
  * @type {Number}
243
+ * @private
331
244
  */
332
245
  count: null,
333
246
 
@@ -338,9 +251,10 @@ export default Component.extend({
338
251
  lastQuery: null,
339
252
 
340
253
  /**
341
- * Current sort order for the table
254
+ * Current sort order for the table. Internal property to keep track of current sort key.
342
255
  * @type {String}
343
256
  * @property currentSortKey
257
+ * @private
344
258
  */
345
259
  currentSortKey: null,
346
260
 
@@ -355,7 +269,7 @@ export default Component.extend({
355
269
  * @internal
356
270
  */
357
271
  index: computed('page', function() {
358
- return this.get('page') - 1;
272
+ return this.page - 1;
359
273
  }),
360
274
 
361
275
  /**
@@ -365,11 +279,11 @@ export default Component.extend({
365
279
  * @internal
366
280
  */
367
281
  currentEntries: computed('pageEntries.[]', 'index', function() {
368
- let entries = this.get('pageEntries');
282
+ let entries = this.pageEntries;
369
283
  if (isNone(entries)) {
370
284
  return [];
371
285
  }
372
- return entries.objectAt(this.get('index'));
286
+ return entries.objectAt(this.index);
373
287
  }),
374
288
 
375
289
  /**
@@ -387,9 +301,9 @@ export default Component.extend({
387
301
  * @internal
388
302
  */
389
303
  tableSortKey: computed('defaultSortKey', 'currentSortKey', function() {
390
- let current = this.get('currentSortKey');
304
+ let current = this.currentSortKey;
391
305
  if (isEmpty(current)) {
392
- return `${this.get('defaultSortKey')}:desc`;
306
+ return `${this.defaultSortKey}:desc`;
393
307
  }
394
308
  return current;
395
309
  }),
@@ -401,12 +315,12 @@ export default Component.extend({
401
315
  * @internal
402
316
  */
403
317
  totalPages: computed('count', 'entriesPerPage', function() {
404
- let count = this.get('count');
318
+ let count = this.count;
405
319
  if (isNone(count)) {
406
320
  return 0;
407
321
  }
408
322
 
409
- return Math.ceil(count / this.get('entriesPerPage'));
323
+ return Math.ceil(count / this.entriesPerPage);
410
324
  }),
411
325
 
412
326
  /**
@@ -416,7 +330,7 @@ export default Component.extend({
416
330
  * @internal
417
331
  */
418
332
  showPages: computed('totalPages', function() {
419
- return this.get('totalPages') > 1;
333
+ return this.totalPages > 1;
420
334
  }),
421
335
 
422
336
  /**
@@ -426,7 +340,7 @@ export default Component.extend({
426
340
  * @internal
427
341
  */
428
342
  maxPageButtons: computed('media.{isMobile,isTablet}', function() {
429
- let media = this.get('media');
343
+ let media = this.media;
430
344
  if (media.get('isMobile')) {
431
345
  return 3;
432
346
  }
@@ -444,8 +358,8 @@ export default Component.extend({
444
358
  * @internal
445
359
  */
446
360
  routeName: computed('modelName', function() {
447
- let name = this.get('modelName');
448
- return this.get('store').adapterFor(name).pathForType(name);
361
+ let name = this.modelName;
362
+ return this.store.adapterFor(name).pathForType(name);
449
363
  }),
450
364
 
451
365
  /**
@@ -455,8 +369,8 @@ export default Component.extend({
455
369
  * @internal
456
370
  */
457
371
  tableSuffix: computed('count', 'currentEntries', 'index', function() {
458
- let count = this.get('count');
459
- let entries = this.get('currentEntries');
372
+ let count = this.count;
373
+ let entries = this.currentEntries;
460
374
  if (isEmpty(entries)) {
461
375
  return `${count} entries`;
462
376
  }
@@ -470,7 +384,7 @@ export default Component.extend({
470
384
  * @internal
471
385
  */
472
386
  fullTableTitle: computed('currentTitle', 'tableSuffix', function() {
473
- return `${this.get('currentTitle')} - ${this.get('tableSuffix')}`;
387
+ return `${this.currentTitle} - ${this.tableSuffix}`;
474
388
  }),
475
389
 
476
390
  /**
@@ -484,8 +398,9 @@ export default Component.extend({
484
398
  /* Functions */
485
399
 
486
400
  /**
487
- * Queries the serverside to get the total record count
401
+ * Queries the serverside to get the total record count. Internal method.
488
402
  * @method queryCount
403
+ * @private
489
404
  * @return {Promise} Promise that resolves to a number
490
405
  */
491
406
  queryCount() {
@@ -494,20 +409,21 @@ export default Component.extend({
494
409
  query.count = true;
495
410
 
496
411
  // make request
497
- let url = this.get('config').formUrl(this.get('routeName'));
498
- return this.get('ajax').request(url, {data: query}).then((({count}) => count)).catch(handleAjaxError.bind(this));
412
+ let url = this.config.formUrl(this.routeName);
413
+ return this.ajax.request(url, {data: query}).then((({count}) => count)).catch(handleAjaxError.bind(this));
499
414
  },
500
415
 
501
416
  /**
502
- * Query for settign a new sort order
417
+ * Query for settign a new sort order. Internal method.
503
418
  * @method querySort
419
+ * @private
504
420
  * @param {Number} page Page number to start
505
421
  * @param {String} sortKey New sort order
506
422
  * @param {Boolean} ascending If true, sorts ascending, false descending
507
423
  * @return {Promise} Promise that resolves to a entry array
508
424
  */
509
425
  querySort(page, sortKey, ascending) {
510
- let query = this.get('lastQuery');
426
+ let query = this.lastQuery;
511
427
 
512
428
  // set sort key stuff if present
513
429
  if (!isNone(ascending)) {
@@ -518,43 +434,45 @@ export default Component.extend({
518
434
  }
519
435
 
520
436
  // set limits on query
521
- let entriesPerPage = this.get('entriesPerPage');
437
+ let entriesPerPage = this.entriesPerPage;
522
438
  query.limit = entriesPerPage;
523
439
  query.offset = (page - 1) * entriesPerPage;
524
440
 
525
441
  // make promise
526
- return RSVP.resolve(this.get('store').query(this.get('modelName'), query)).catch(handleAjaxError.bind(this));
442
+ return RSVP.resolve(this.store.query(this.modelName, query)).catch(handleAjaxError.bind(this));
527
443
  },
528
444
 
529
445
  /**
530
- * Fetches the entries for the given page number
446
+ * Fetches the entries for the given page number. Internal method
531
447
  * @method queryPage
448
+ * @private
532
449
  * @param {Number} page Page to fetch
533
450
  * @return {Promise} Promise that resolves to an entry array
534
451
  */
535
452
  queryPage(page) {
536
453
  // same as sort, but handles the entries
537
454
  return this.querySort(page).then((entries) => {
538
- this.get('pageEntries')[page - 1] = entries;
455
+ this.pageEntries[page - 1] = entries;
539
456
  return entries;
540
457
  });
541
458
  },
542
459
 
543
460
  /**
544
- * Gets all entries for the given query
461
+ * Gets all entries for the given query. Internal method
545
462
  * @method queryAll
463
+ * @private
546
464
  * @return {Promise} Promise that resolves to entries
547
465
  */
548
466
  queryAll() {
549
467
  let query = this.makeQuery({export: true});
550
- return RSVP.resolve(this.get('store').query(this.get('modelName'), query)).catch(handleAjaxError.bind(this));
468
+ return RSVP.resolve(this.store.query(this.modelName, query)).catch(handleAjaxError.bind(this));
551
469
  },
552
470
 
553
471
  actions: {
554
472
  /* Search buttons */
555
473
 
556
474
  /**
557
- * This action is called when the search button is pressed
475
+ * This action is called when the search button is pressed. This is yielded as `actions.search` in the block.
558
476
  * @method search
559
477
  * @return {Promise} Promise that resolves after searching
560
478
  */
@@ -601,7 +519,7 @@ export default Component.extend({
601
519
  },
602
520
 
603
521
  /**
604
- * This action is called when the export button is clicked to export all data
522
+ * This action is called when the export button is clicked to export all data. This is yielded in the block as `actions.export`.
605
523
  * @method export
606
524
  * @return {Promise} Promise that resolves after exporting the table
607
525
  */
@@ -609,9 +527,9 @@ export default Component.extend({
609
527
  // TODO: canSearch?
610
528
 
611
529
  // build table for export
612
- let table = new Table(this.getExportColumns());
530
+ let table = Table.create({columns: this.getExportColumns()});
613
531
  return this.queryAll().then((entries) => {
614
- table.setRows(entries.sortBy(this.get('defaultSortKey')).reverse());
532
+ table.setRows(entries.sortBy(this.defaultSortKey).reverse());
615
533
  exportTable(table, `${this.getTitle()} - All Entries`);
616
534
  }).catch(handleAjaxError.bind(this));
617
535
  },
@@ -619,13 +537,14 @@ export default Component.extend({
619
537
  /* Pagination */
620
538
 
621
539
  /**
622
- * This action is called when a page button is clicked to switch pages
540
+ * This action is called when a page button is clicked to switch pages. This is an internal action used in the page number button.
623
541
  * @method setPage
542
+ * @private
624
543
  * @param {Number} page New page number to set
625
544
  */
626
545
  setPage(page) {
627
546
  // clamp page number
628
- let max = this.get('totalPages');
547
+ let max = this.totalPages;
629
548
  if (page < 1) {
630
549
  page = 1;
631
550
  } else if (page > max) {
@@ -634,7 +553,7 @@ export default Component.extend({
634
553
 
635
554
  // if we havve entries at the page number, use those
636
555
  // if missing, query them
637
- if (isNone(this.get('pageEntries').objectAt(page - 1))) {
556
+ if (isNone(this.pageEntries.objectAt(page - 1))) {
638
557
  this.incrementProperty('pagesSearching');
639
558
  this.set('page', page);
640
559
  this.queryPage(page).then(() => {
@@ -649,7 +568,7 @@ export default Component.extend({
649
568
  /* Sorting */
650
569
 
651
570
  /**
652
- * This action resorts the entry by the given column
571
+ * This action resorts the entry by the given column. This is yielded as `actions.sort`, when table is also defined. To be used in the `onSort` of your `FwSortableTable`.
653
572
  * @method sortColumn
654
573
  * @param {Column} column Column to use for sorting
655
574
  * @param {String} sortKey String to use for sorting in the column
@@ -657,7 +576,7 @@ export default Component.extend({
657
576
  */
658
577
  sortColumn(column, sortKey) {
659
578
  // if the sort key is unchanged, do nothing
660
- if (sortKey === this.get('tableSortKey')) {
579
+ if (sortKey === this.tableSortKey) {
661
580
  return RSVP.resolve();
662
581
  }
663
582
 
@@ -665,7 +584,7 @@ export default Component.extend({
665
584
  column.set('sorting', true);
666
585
 
667
586
  // search for data
668
- let page = this.get('page');
587
+ let page = this.page;
669
588
  return this.querySort(page, column.searchKey || column.valuePath, column.ascending).then((entries) => {
670
589
  // set entries to new list
671
590
  let pageEntries = [];
@@ -3,11 +3,11 @@ import layout from '../templates/components/fw-row-toggle-index';
3
3
 
4
4
  /**
5
5
  * Creates a table cell that shows if the row is expanded or hidden on hover, but
6
- * displays the value otherwise. While this can be called directly using `cellComponent`,
7
- * the [`rowToggle` util](../classes/BaseCells.html) will display this component if there
8
- * is a `valuePath` defined. See also [`FW-Row-Toggle`](FW-Row-Toggle.html).
6
+ * displays the value otherwise. See also [`FwRowToggle`](FwRowToggle.html).
9
7
  * @public
10
- * @class FW-Row-Toggle-Index
8
+ * @deprecated While this can be called directly using `cellComponent`, you should use the [`rowToggle` util](../classes/BaseCells.html) import, which will display this component if there is a `valuePath` defined.
9
+ * @class FwRowToggleIndex
10
+ * @module CellComponents
11
11
  */
12
12
  export default Toggle.extend({
13
13
  layout
@@ -3,14 +3,21 @@ import {computed} from '@ember/object';
3
3
  import layout from '../templates/components/fw-row-toggle';
4
4
 
5
5
  /**
6
- * Creates a table cell that shows if the row is expanded or hidden. While this can be called directly using `cellComponent`,
7
- * the [`rowToggle` util](../classes/BaseCells.html) will display this component if there
8
- * is no `valuePath` defined. See also [`FW-Row-Toggle-Index`](FW-Row-Toggle-Index.html).
9
- * @class FW-Row-Toggle
6
+ * Creates a table cell that shows if the row is expanded or hidden. See also [`FwRowToggleIndex`](FwRowToggleIndex.html).
7
+ *
8
+ * @deprecated While this can be called directly using `cellComponent`, you should use the [`rowToggle` util](../classes/BaseCells.html) import, which will display this component if there is no `valuePath` defined.
9
+ * @class FwRowToggle
10
+ * @module CellComponents
10
11
  */
11
12
  export default Component.extend({
12
13
  layout,
13
-
14
+ /**
15
+ * Computed property used internally to determine whether the "open" or "closed" toggle will be shown based on whether the row is expanded or not
16
+ * @private
17
+ * @property toggleClass
18
+ * @type {Computed}
19
+ * @return {String} This returns the appropriate Fontawesome class.
20
+ */
14
21
  toggleClass: computed('row.{canExpand,expanded}', function () {
15
22
  let classes;
16
23
  if (!this.get('row.canExpand')) {
@@ -3,17 +3,16 @@ import {computed} from '@ember/object';
3
3
  import layout from '../templates/components/fw-table-expanded-row';
4
4
 
5
5
  /**
6
- * This component is used internally as the logic behind the rows displayed inside rows
7
- * It is not included in the exports as it is not intended to be called directly
8
- * @protected
9
- * @module Components
10
- * @submodule Internal
6
+ * This component is used internally as the logic behind the rows displayed inside rows.
7
+ * It is not included in the exports as it is not intended to be called directly.
8
+ * @private
9
+ * @class FwTableExpandedRow
11
10
  */
12
11
  export default Component.extend({
13
12
  layout,
14
13
 
15
14
  value: computed('rawValue', function() {
16
- let rawValue = this.get('rawValue');
15
+ let rawValue = this.rawValue;
17
16
  let format = this.get('column.format');
18
17
 
19
18
  if (format && typeof format === 'function') {
@@ -3,19 +3,23 @@ import {computed} from '@ember/object';
3
3
  import {isEmpty} from '@ember/utils';
4
4
  import {showExpanded} from '../utils/table';
5
5
  import layout from '../templates/components/fw-table-expanded-rows';
6
-
6
+ /**
7
+ * This component contains all of the hidden rows of `FwTableExpandedRow`. This is also used completely internally and should not be called directly.
8
+ * @private
9
+ * @class FwTableExpandedRow
10
+ */
7
11
  export default Component.extend({
8
12
  layout,
9
13
 
10
14
  columns: computed('table.expandedColumns', 'row', 'row.{canExpand}', function() {
11
- let row = this.get('row');
12
- let table = this.get('table');
15
+ let row = this.row;
16
+ let table = this.table;
13
17
  return this.get('table.expandedColumns').filter((column) => {
14
18
  return showExpanded(table, row, column);
15
19
  });
16
20
  }),
17
21
 
18
22
  hasColumns: computed('columns', function() {
19
- return !isEmpty(this.get('columns'));
23
+ return !isEmpty(this.columns);
20
24
  })
21
25
  });