@bennerinformatics/ember-fw-table 2.1.3 → 2.1.5

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 (130) hide show
  1. package/addon/components/fw-pagination-wrapper.js +2 -2
  2. package/addon/components/fw-table-resort.js +16 -2
  3. package/addon/components/fw-table-sortable.js +14 -3
  4. package/addon/templates/components/fw-table-resort.hbs +7 -4
  5. package/docs/api.js +61 -0
  6. package/docs/assets/css/custom.css +82 -0
  7. package/docs/assets/css/external-small.png +0 -0
  8. package/docs/assets/css/logo.png +0 -0
  9. package/docs/assets/css/main.css +793 -0
  10. package/docs/assets/css/theme.css +547 -0
  11. package/docs/assets/favicon.ico +0 -0
  12. package/docs/assets/icons/android-icon-144x144.png +0 -0
  13. package/docs/assets/icons/android-icon-192x192.png +0 -0
  14. package/docs/assets/icons/android-icon-36x36.png +0 -0
  15. package/docs/assets/icons/android-icon-48x48.png +0 -0
  16. package/docs/assets/icons/android-icon-72x72.png +0 -0
  17. package/docs/assets/icons/android-icon-96x96.png +0 -0
  18. package/docs/assets/icons/apple-icon-114x114.png +0 -0
  19. package/docs/assets/icons/apple-icon-120x120.png +0 -0
  20. package/docs/assets/icons/apple-icon-144x144.png +0 -0
  21. package/docs/assets/icons/apple-icon-152x152.png +0 -0
  22. package/docs/assets/icons/apple-icon-180x180.png +0 -0
  23. package/docs/assets/icons/apple-icon-57x57.png +0 -0
  24. package/docs/assets/icons/apple-icon-60x60.png +0 -0
  25. package/docs/assets/icons/apple-icon-72x72.png +0 -0
  26. package/docs/assets/icons/apple-icon-76x76.png +0 -0
  27. package/docs/assets/icons/apple-icon-precomposed.png +0 -0
  28. package/docs/assets/icons/apple-icon.png +0 -0
  29. package/docs/assets/icons/browserconfig.xml +2 -0
  30. package/docs/assets/icons/favicon-16x16.png +0 -0
  31. package/docs/assets/icons/favicon-32x32.png +0 -0
  32. package/docs/assets/icons/favicon-96x96.png +0 -0
  33. package/docs/assets/icons/favicon.ico +0 -0
  34. package/docs/assets/icons/manifest.json +41 -0
  35. package/docs/assets/icons/ms-icon-144x144.png +0 -0
  36. package/docs/assets/icons/ms-icon-150x150.png +0 -0
  37. package/docs/assets/icons/ms-icon-310x310.png +0 -0
  38. package/docs/assets/icons/ms-icon-70x70.png +0 -0
  39. package/docs/assets/img/ember-logo.png +0 -0
  40. package/docs/assets/img/fw-logo.png +0 -0
  41. package/docs/assets/img/spinner.gif +0 -0
  42. package/docs/assets/index.html +10 -0
  43. package/docs/assets/js/api-filter.js +56 -0
  44. package/docs/assets/js/api-list.js +255 -0
  45. package/docs/assets/js/api-search.js +98 -0
  46. package/docs/assets/js/apidocs.js +376 -0
  47. package/docs/assets/js/yui-prettify.js +17 -0
  48. package/docs/assets/js/yuidoc-bootstrap.js +274 -0
  49. package/docs/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
  50. package/docs/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
  51. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  52. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  53. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  54. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  55. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  56. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  57. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  58. package/docs/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
  59. package/docs/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
  60. package/docs/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
  61. package/docs/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
  62. package/docs/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  63. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  64. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
  65. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  66. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  67. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  68. package/docs/assets/vendor/github-slugger/slugger.js +59 -0
  69. package/docs/assets/vendor/jquery/jquery.min.js +6 -0
  70. package/docs/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
  71. package/docs/assets/vendor/prettify/CHANGES.html +130 -0
  72. package/docs/assets/vendor/prettify/COPYING +202 -0
  73. package/docs/assets/vendor/prettify/README.html +203 -0
  74. package/docs/assets/vendor/prettify/prettify-min.css +1 -0
  75. package/docs/assets/vendor/prettify/prettify-min.js +1 -0
  76. package/docs/classes/BaseCells.html +484 -0
  77. package/docs/classes/Export.html +457 -0
  78. package/docs/classes/Format.html +577 -0
  79. package/docs/classes/FwCellAction.html +312 -0
  80. package/docs/classes/FwCellBoolean.html +311 -0
  81. package/docs/classes/FwCellNullable.html +312 -0
  82. package/docs/classes/FwCellPermissionIcon.html +321 -0
  83. package/docs/classes/FwColumnSortable.html +358 -0
  84. package/docs/classes/FwColumnTitle.html +314 -0
  85. package/docs/classes/FwDeleteModal.html +485 -0
  86. package/docs/classes/FwExpandableRow.html +307 -0
  87. package/docs/classes/FwPaginationWrapper.html +2129 -0
  88. package/docs/classes/FwRowToggle.html +355 -0
  89. package/docs/classes/FwRowToggleIndex.html +312 -0
  90. package/docs/classes/FwTableExpandedRow.html +307 -0
  91. package/docs/classes/FwTableResort.html +827 -0
  92. package/docs/classes/FwTableSortable.html +1293 -0
  93. package/docs/classes/Row.html +352 -0
  94. package/docs/classes/Table.html +672 -0
  95. package/docs/classes/TableUtil.html +410 -0
  96. package/docs/classes/index.html +10 -0
  97. package/docs/data.json +2324 -0
  98. package/docs/elements/index.html +10 -0
  99. package/docs/files/addon_classes_Row.js.html +318 -0
  100. package/docs/files/addon_classes_Table.js.html +390 -0
  101. package/docs/files/addon_components_fw-cell-action.js.html +257 -0
  102. package/docs/files/addon_components_fw-cell-boolean.js.html +251 -0
  103. package/docs/files/addon_components_fw-cell-nullable.js.html +253 -0
  104. package/docs/files/addon_components_fw-cell-permission-icon.js.html +266 -0
  105. package/docs/files/addon_components_fw-column-sortable.js.html +281 -0
  106. package/docs/files/addon_components_fw-column-title.js.html +259 -0
  107. package/docs/files/addon_components_fw-delete-modal.js.html +318 -0
  108. package/docs/files/addon_components_fw-expandable-row.js.html +248 -0
  109. package/docs/files/addon_components_fw-pagination-wrapper.js.html +838 -0
  110. package/docs/files/addon_components_fw-row-toggle-index.js.html +252 -0
  111. package/docs/files/addon_components_fw-row-toggle.js.html +270 -0
  112. package/docs/files/addon_components_fw-table-expanded-row.js.html +261 -0
  113. package/docs/files/addon_components_fw-table-expanded-rows.js.html +263 -0
  114. package/docs/files/addon_components_fw-table-resort.js.html +457 -0
  115. package/docs/files/addon_components_fw-table-sortable.js.html +663 -0
  116. package/docs/files/addon_documentation.js.html +301 -0
  117. package/docs/files/addon_initializers_responsive.js.html +253 -0
  118. package/docs/files/addon_utils_base-cells.js.html +313 -0
  119. package/docs/files/addon_utils_export.js.html +316 -0
  120. package/docs/files/addon_utils_formats.js.html +335 -0
  121. package/docs/files/addon_utils_table.js.html +274 -0
  122. package/docs/files/index.html +10 -0
  123. package/docs/index.html +252 -0
  124. package/docs/modules/CellComponents.html +313 -0
  125. package/docs/modules/ColumnComponents.html +284 -0
  126. package/docs/modules/Components.html +285 -0
  127. package/docs/modules/Introduction.html +261 -0
  128. package/docs/modules/Utils.html +285 -0
  129. package/docs/modules/index.html +10 -0
  130. package/package.json +65 -65
@@ -0,0 +1,838 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>addon\components\fw-pagination-wrapper.js - Ember-FW-Table</title>
6
+ <meta name="description" content="A set of components surrounding the functionality of the fw-table-sortable, which is a simplified table, with ember-light-table as its internals.">
7
+ <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
8
+ <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
+ <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
10
+ <link rel="stylesheet" href="../assets/css/custom.css">
11
+ <link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap.css">
12
+ <link rel="stylesheet" href="../assets/vendor/font-awesome/css/font-awesome.min.css">
13
+ <link rel="stylesheet" href="../assets/css/theme.css">
14
+ <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,600,700' rel='stylesheet' type='text/css'>
15
+ <!-- favicon information -->
16
+ <link rel="apple-touch-icon" sizes="57x57" href="/assets/icons/apple-icon-57x57.png">
17
+ <link rel="apple-touch-icon" sizes="60x60" href="/assets/icons/apple-icon-60x60.png">
18
+ <link rel="apple-touch-icon" sizes="72x72" href="/assets/icons/apple-icon-72x72.png">
19
+ <link rel="apple-touch-icon" sizes="76x76" href="/assets/icons/apple-icon-76x76.png">
20
+ <link rel="apple-touch-icon" sizes="114x114" href="/assets/icons/apple-icon-114x114.png">
21
+ <link rel="apple-touch-icon" sizes="120x120" href="/assets/icons/apple-icon-120x120.png">
22
+ <link rel="apple-touch-icon" sizes="144x144" href="/assets/icons/apple-icon-144x144.png">
23
+ <link rel="apple-touch-icon" sizes="152x152" href="/assets/icons/apple-icon-152x152.png">
24
+ <link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-icon-180x180.png">
25
+ <link rel="icon" type="image/png" sizes="192x192" href="/assets/icons/android-icon-192x192.png">
26
+ <link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png">
27
+ <link rel="icon" type="image/png" sizes="96x96" href="/assets/icons/favicon-96x96.png">
28
+ <link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png">
29
+ <link rel="manifest" href="/assets/icons/manifest.json">
30
+ <meta name="msapplication-TileImage" content="/assets/icons/ms-icon-144x144.png">
31
+
32
+
33
+ <style>
34
+ body a {
35
+ color: #7E3DB7;
36
+ }
37
+ body a:hover {
38
+ color: #7E3DB7;
39
+ opacity: 0.5;
40
+ }
41
+ .navbar.navbar-default .navbar-nav> li> a:focus, .navbar.navbar-default .navbar-nav> li> a:hover {
42
+ color: #7E3DB7;
43
+ }
44
+ .navbar.navbar-default .navbar-nav> .active> a, .navbar.navbar-default .navbar-nav> .active> a:focus, .navbar.navbar-default .navbar-nav> .active> a:hover {
45
+ color: #7E3DB7;
46
+ }
47
+ #docs-main .page-header {
48
+ color: #7E3DB7;
49
+ }
50
+ #docs-main .page-section .nav-tabs {
51
+ border-bottom: 1px solid #7E3DB7;
52
+ }
53
+ #docs-main .page-section .nav-tabs> li.active a {
54
+ background: #7E3DB7;
55
+ border: 1px solid #7E3DB7;
56
+ }
57
+ #sidebar li.panel .panel-body ol> li.active, #sidebar li.panel .panel-body ol> li:hover {
58
+ background: #efefef;
59
+ }
60
+ </style>
61
+ </head>
62
+ <body>
63
+ <nav class="navbar navbar-default">
64
+ <div class="container-fluid">
65
+ <div class="navbar-header">
66
+ <a href="../" class="navbar-brand">
67
+ <img src="..\assets\img\fw-logo.png" alt="enterprise logo">
68
+ <span>Ember-FW-Table (API)</span>
69
+ </a>
70
+ </div>
71
+
72
+ <div class="collapse navbar-collapse" id="nav">
73
+ <ul class="nav navbar-nav navbar-right">
74
+ <li><a href="https://linformatics.bitbucket.io/docs/">Docs</a></li>
75
+ <li><a href="https://linformatics.bitbucket.io/downloads/">Downloads</a></li>
76
+ <li><a href="https://linformatics.bitbucket.io/api/">API</a></li>
77
+ <li><a href="https://bitbucket.org/linformatics/ember-fw-table" class="fa fa-github github"></a></li>
78
+ </ul>
79
+ </div>
80
+ </div>
81
+ </nav>
82
+ <div id="main-wrapper" class="row">
83
+ <div id="content-wrapper">
84
+ <ol class="panel-group" id="sidebar" role="tablist" aria-multiselectable="true">
85
+ <li class="panel panel-default">
86
+ <div class="panel-heading" role="tab" id="sidebar-search-heading">
87
+ <h4 class="panel-title">
88
+ <a role="button" data-toggle="collapse" href="#sidebar-search" aria-expanded="true" aria-controls="collapseOne">
89
+ Search
90
+ </a>
91
+ </h4>
92
+ </div>
93
+ <div id="sidebar-search" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-search-heading">
94
+ <div class="panel-body">
95
+ <div id="api-tabview-filter">
96
+ <input type="search" id="api-filter" placeholder="Search...">
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </li>
101
+ <li class="panel panel-default">
102
+ <div class="panel-heading" role="tab" id="sidebar-version-heading">
103
+ <h4 class="panel-title">
104
+ <a role="button" href="https://bitbucket.org/linformatics/ember-fw-table/commits/04d3b2ce" target="_blank">
105
+ Tag: 2.1.4.04d3b2ce
106
+ </a>
107
+ </h4>
108
+ </div>
109
+ </li>
110
+ <li class="panel panel-default">
111
+ <div class="panel-heading" role="tab" id="sidebar-modules-heading">
112
+ <h4 class="panel-title">
113
+ <a role="button" data-toggle="collapse" href="#sidebar-modules" aria-expanded="true" aria-controls="collapseOne">
114
+ Modules
115
+ </a>
116
+ </h4>
117
+ </div>
118
+ <div id="sidebar-modules" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-modules-heading">
119
+ <div class="panel-body">
120
+ <ol>
121
+ <li>
122
+ <a href="../modules/CellComponents.html">CellComponents</a>
123
+ </li>
124
+ <li>
125
+ <a href="../modules/ColumnComponents.html">ColumnComponents</a>
126
+ </li>
127
+ <li>
128
+ <a href="../modules/Components.html">Components</a>
129
+ </li>
130
+ <li>
131
+ <a href="../modules/Introduction.html">Introduction</a>
132
+ </li>
133
+ <li>
134
+ <a href="../modules/Utils.html">Utils</a>
135
+ </li>
136
+ </ol>
137
+ </div>
138
+ </div>
139
+ </li>
140
+
141
+ <li class="panel panel-default">
142
+ <div class="panel-heading" role="tab" id="sidebar-classes-heading">
143
+ <h4 class="panel-title">
144
+ <a role="button" data-toggle="collapse" href="#sidebar-classes" aria-expanded="true" aria-controls="collapseOne">
145
+ Classes
146
+ </a>
147
+ </h4>
148
+ </div>
149
+ <div id="sidebar-classes" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-classes-heading">
150
+ <div class="panel-body">
151
+ <ol>
152
+ <li>
153
+ <a href="../classes/BaseCells.html">BaseCells</a>
154
+ </li>
155
+ <li>
156
+ <a href="../classes/Export.html">Export</a>
157
+ </li>
158
+ <li>
159
+ <a href="../classes/Format.html">Format</a>
160
+ </li>
161
+ <li>
162
+ <a href="../classes/FwCellAction.html">FwCellAction</a>
163
+ </li>
164
+ <li>
165
+ <a href="../classes/FwCellBoolean.html">FwCellBoolean</a>
166
+ </li>
167
+ <li>
168
+ <a href="../classes/FwCellNullable.html">FwCellNullable</a>
169
+ </li>
170
+ <li>
171
+ <a href="../classes/FwCellPermissionIcon.html">FwCellPermissionIcon</a>
172
+ </li>
173
+ <li>
174
+ <a href="../classes/FwColumnSortable.html">FwColumnSortable</a>
175
+ </li>
176
+ <li>
177
+ <a href="../classes/FwColumnTitle.html">FwColumnTitle</a>
178
+ </li>
179
+ <li>
180
+ <a href="../classes/FwDeleteModal.html">FwDeleteModal</a>
181
+ </li>
182
+ <li>
183
+ <a href="../classes/FwPaginationWrapper.html">FwPaginationWrapper</a>
184
+ </li>
185
+ <li>
186
+ <a href="../classes/FwRowToggle.html">FwRowToggle</a>
187
+ </li>
188
+ <li>
189
+ <a href="../classes/FwRowToggleIndex.html">FwRowToggleIndex</a>
190
+ </li>
191
+ <li>
192
+ <a href="../classes/FwTableResort.html">FwTableResort</a>
193
+ </li>
194
+ <li>
195
+ <a href="../classes/FwTableSortable.html">FwTableSortable</a>
196
+ </li>
197
+ <li>
198
+ <a href="../classes/Row.html">Row</a>
199
+ </li>
200
+ <li>
201
+ <a href="../classes/Table.html">Table</a>
202
+ </li>
203
+ <li>
204
+ <a href="../classes/TableUtil.html">TableUtil</a>
205
+ </li>
206
+ </ol>
207
+ </div>
208
+ </div>
209
+ </li>
210
+ </ol>
211
+ <div class="content-container">
212
+ <div class="apidocs">
213
+ <div id="docs-main">
214
+ <div class="content">
215
+ <div class="page-header">
216
+ <h1><i class="fa fa-file-code-o" aria-hidden="true"></i> File</h1>
217
+ </div>
218
+
219
+ <div class="file">
220
+ <pre class="prettyprint linenums">
221
+ import Component from &#x27;@ember/component&#x27;;
222
+ import {computed} from &#x27;@ember/object&#x27;;
223
+ import {empty, filterBy} from &#x27;@ember/object/computed&#x27;;
224
+ import {inject} from &#x27;@ember/service&#x27;;
225
+ import {isEmpty, isNone} from &#x27;@ember/utils&#x27;;
226
+ import {handleAjaxError} from &#x27;@bennerinformatics/ember-fw/utils/error&#x27;;
227
+ import exportTable from &#x27;@bennerinformatics/ember-fw-table/utils/export&#x27;;
228
+ import Table from &#x27;ember-light-table&#x27;;
229
+ import RSVP from &#x27;rsvp&#x27;;
230
+ import layout from &#x27;../templates/components/fw-pagination-wrapper&#x27;;
231
+ /**
232
+ * 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).
233
+ * All of the possible parameters are documented below. At its most basic, however, there are two ways to use &#x60;FwPaginationWrapper&#x60; in parameter form or in block form. Here is a brief example of each:
234
+ *
235
+ * Parameter form:
236
+ * &#x60;&#x60;&#x60;handlebars
237
+ * &lt;FwPaginationWrapper @modelName=&quot;myModel&quot; @defaultSortKey=&quot;sortKey&quot; @makeQuery={{action &quot;makeQuery&quot;}} @getTitle={{action &quot;getTitle&quot;}} @getTableColumns={{action &quot;getTableColumns&quot;}} @tableActions={{hash ...}} as |actions|&gt;
238
+ * {{!-- Search panel contents --}}
239
+ * {{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
240
+ * &lt;/FwPaginationWrapper&gt;
241
+ * &#x60;&#x60;&#x60;
242
+ * Block form:
243
+ * &#x60;&#x60;&#x60;handlebars
244
+ * &lt;FwPaginationWrapper @modelName=&quot;myModel&quot; @defaultSortKey=&quot;sortKey&quot; @makeQuery={{action &quot;makeQuery&quot;}} @getTitle={{action &quot;getTitle&quot;}} as |actions table|&gt;
245
+ * {{#unless table}}
246
+ * {{!-- Search panel contents --}}
247
+ * {{!-- actions.search and actions.export are defined for you to use in this section appropriately--}}
248
+ * {{else}}
249
+ * {{!-- Table component invocation --}}
250
+ * {{!-- actions.sort and table.title, table.suffix, table.entries, and table.sortKey are defined for you to use in this section appropriately--}}
251
+ * {{/unless}}
252
+ * &lt;/FwPaginationWrapper&gt;
253
+ * &#x60;&#x60;&#x60;
254
+ * @class FwPaginationWrapper
255
+ * @module Components
256
+ */
257
+ export default Component.extend({
258
+ layout,
259
+ ajax: inject(),
260
+ config: inject(),
261
+ media: inject(),
262
+ notifications: inject(),
263
+ store: inject(),
264
+ tagName: &#x27;&#x27;,
265
+
266
+ didReceiveAttrs() {
267
+ this._super(...arguments);
268
+ if (this.searchOnRender) {
269
+ this.send(&#x27;search&#x27;);
270
+ }
271
+ },
272
+
273
+ /*
274
+ * Parameters
275
+ */
276
+
277
+ /**
278
+ * Name of the model in search
279
+ * @type {String}
280
+ * @property modelName
281
+ */
282
+
283
+ /**
284
+ * Whether or not the table loads on page load. If true, it will call the search based on your defaults already set, whenever the table is rendered for the first time.
285
+ * @type {Boolean}
286
+ * @property searchOnRender
287
+ * @default false
288
+ */
289
+ searchOnRender: false,
290
+ /**
291
+ * Default sort order for the table
292
+ * @type {String}
293
+ * @property defaultSortKey
294
+ */
295
+ defaultSortKey: null,
296
+
297
+ /**
298
+ * Number of entries per page
299
+ * @type {Number}
300
+ * @property entriesPerPage
301
+ * @default 100
302
+ */
303
+ entriesPerPage: 100,
304
+ /**
305
+ * Show the page numbers above the table. If false, they won&#x27;t show.
306
+ * @type {Boolean}
307
+ * @property showPagesTop
308
+ * @default true
309
+ */
310
+ showPagesTop: true,
311
+
312
+ /**
313
+ * Show the page numbers below the table. If false, they won&#x27;t show.
314
+ * @type {Boolean}
315
+ * @property showPagesBottom
316
+ * @default true
317
+ */
318
+ showPagesBottom: true,
319
+
320
+ /**
321
+ * Gets the title of this table at the given time
322
+ * @method getTitle
323
+ * @type {Action}
324
+ * @return {String} Title of this table
325
+ */
326
+ getTitle() {
327
+ return &#x27;Table&#x27;;
328
+ },
329
+
330
+ /**
331
+ * Gets a list of table columns for exporting
332
+ * @method getTableColumns
333
+ * @type {Action}
334
+ * @return {Array} Array of table columns
335
+ */
336
+ getExportColumns() {},
337
+
338
+ /**
339
+ * Action to be called when the table search button is pressed.
340
+ * @type {Function}
341
+ * @method onSearch
342
+ */
343
+ onSearch() {},
344
+
345
+ /**
346
+ * Called to delete the full page of entries.
347
+ * Should be passed in with a function. Button will only appear if this is defined
348
+ * @method deletePage
349
+ * @type {Action}
350
+ */
351
+ deletePage: undefined,
352
+
353
+ /**
354
+ * Determines permission for deleteTablePermission for &#x60;FwTableSortable&#x60;. Should probably use a &#x60;has-role&#x60; helper from Group Control
355
+ * @property deletePagePermission
356
+ * @type {Boolean}
357
+ * @default true
358
+ */
359
+ deletePagePermission: true,
360
+ /**
361
+ * Makes a query object based on the search fields
362
+ * @method makeQuery
363
+ * @type {Action}
364
+ * @param {Boolean} count If true, counting
365
+ * @param {Number} page If defined, page number for a page search
366
+ * @param {Boolean} export If true, exporting
367
+ * @return {Object} Query object
368
+ */
369
+ makeQuery(/* {count, page, export} */) {
370
+ return {};
371
+ },
372
+
373
+ /* Table generation properties */
374
+
375
+ /**
376
+ * Gets a list of table columns for the results. If null, yields for table
377
+ * @method getTableColumns
378
+ * @return {Array} Array of table columns
379
+ */
380
+ getTableColumns() {
381
+ return null;
382
+ },
383
+
384
+ /**
385
+ * Text to show for empty tables. If null, hides on empty
386
+ * @property emptyText
387
+ * @type {String}
388
+ */
389
+ emptyText: null,
390
+
391
+ /**
392
+ * Actions to pass into the table. Should be a hash as usual
393
+ * @property tableActions
394
+ * @type {Object}
395
+ */
396
+ tableActions: null,
397
+
398
+ /**
399
+ * Class names for the wrapper around the loading spinner and the table
400
+ * @property tableWrapperClass
401
+ * @type {String}
402
+ */
403
+ tableWrapperClass: &#x27;&#x27;,
404
+
405
+ /*
406
+ * Search properties
407
+ */
408
+
409
+ /**
410
+ * Table title at this time. Internal property. Set by &#x60;getTableTitle&#x60;
411
+ * @property currentTitle
412
+ * @type {String}
413
+ * @private
414
+ */
415
+ currentTitle: null,
416
+
417
+ /**
418
+ * If true, currently doing the main search. Internal property set by search functionality.
419
+ * @property searchingTable
420
+ * @type {Boolean}
421
+ * @default false
422
+ * @private
423
+ */
424
+ searchingTable: false,
425
+
426
+ /**
427
+ * If true, show export page button
428
+ * @property showExport
429
+ * @type {Boolean}
430
+ * @default true
431
+ */
432
+ showExport: true,
433
+ /**
434
+ * Number of pages being searched. Internal property
435
+ * @property pagesSearching
436
+ * @type {Number}
437
+ * @default 0
438
+ * @private
439
+ */
440
+ pagesSearching: 0,
441
+
442
+ /**
443
+ * Array of entries, indexes are the pages. Internal Property for more quickly rendering pages that have been searched this time.
444
+ * @property pageEntries
445
+ * @type {Array}
446
+ * @private
447
+ */
448
+ pageEntries: null,
449
+
450
+ /**
451
+ * Currently selected page. Internal property to be set by clicking one of the page numbers.
452
+ * @property page
453
+ * @type {Number}
454
+ * @default 1
455
+ * @private
456
+ */
457
+ page: 1,
458
+
459
+ /**
460
+ * Total number of entries. Internal property set by the count network request.
461
+ * @property count
462
+ * @type {Number}
463
+ * @private
464
+ */
465
+ count: null,
466
+
467
+ /**
468
+ * Query last time createQuery was called
469
+ * @property lastQuery
470
+ */
471
+ lastQuery: null,
472
+
473
+ /**
474
+ * Current sort order for the table. Internal property to keep track of current sort key.
475
+ * @type {String}
476
+ * @property currentSortKey
477
+ * @private
478
+ */
479
+ currentSortKey: null,
480
+
481
+ /*
482
+ * Computed properties
483
+ */
484
+
485
+ /**
486
+ * Array index for the selected page
487
+ * @type {Number - Computed}
488
+ * @property index
489
+ * @internal
490
+ */
491
+ index: computed(&#x27;page&#x27;, function() {
492
+ return this.page - 1;
493
+ }),
494
+
495
+ /**
496
+ * Array of entries at the current page
497
+ * @type {Array - Computed}
498
+ * @property currentEntries
499
+ * @internal
500
+ */
501
+ currentEntries: computed(&#x27;pageEntries.[]&#x27;, &#x27;index&#x27;, function() {
502
+ let entries = this.pageEntries;
503
+ if (isNone(entries)) {
504
+ return [];
505
+ }
506
+ return entries.objectAt(this.index);
507
+ }),
508
+
509
+ /**
510
+ * Filtered entries, removing deleted entries
511
+ * @type {Array - Computed}
512
+ * @property filteredEntries
513
+ * @internal
514
+ */
515
+ filteredEntries: filterBy(&#x27;currentEntries&#x27;, &#x27;isDeleted&#x27;, false),
516
+
517
+ /**
518
+ * Current table sort key based on given properties
519
+ * @type {String - Computed}
520
+ * @property tableSortKey
521
+ * @internal
522
+ */
523
+ tableSortKey: computed(&#x27;defaultSortKey&#x27;, &#x27;currentSortKey&#x27;, function() {
524
+ let current = this.currentSortKey;
525
+ if (isEmpty(current)) {
526
+ return &#x60;${this.defaultSortKey}:desc&#x60;;
527
+ }
528
+ return current;
529
+ }),
530
+
531
+ /**
532
+ * Number of pages available
533
+ * @type {Number - Computed}
534
+ * @property totalPages
535
+ * @internal
536
+ */
537
+ totalPages: computed(&#x27;count&#x27;, &#x27;entriesPerPage&#x27;, function() {
538
+ let count = this.count;
539
+ if (isNone(count)) {
540
+ return 0;
541
+ }
542
+
543
+ return Math.ceil(count / this.entriesPerPage);
544
+ }),
545
+
546
+ /**
547
+ * True if we have multiple pages
548
+ * @type {Boolean - Computed}
549
+ * @property showPages
550
+ * @internal
551
+ */
552
+ showPages: computed(&#x27;totalPages&#x27;, function() {
553
+ return this.totalPages &gt; 1;
554
+ }),
555
+
556
+ /**
557
+ * Maximum number of pages to show in the pagination component
558
+ * @type {Number - Computed}
559
+ * @property maxPageButtons
560
+ * @internal
561
+ */
562
+ maxPageButtons: computed(&#x27;media.{isMobile,isTablet}&#x27;, function() {
563
+ let media = this.media;
564
+ if (media.get(&#x27;isMobile&#x27;)) {
565
+ return 3;
566
+ }
567
+ if (media.get(&#x27;isTablet&#x27;)) {
568
+ return 5;
569
+ }
570
+
571
+ return 7;
572
+ }),
573
+
574
+ /**
575
+ * Gets the serverside route to use for this model name
576
+ * @type {String - Computed}
577
+ * @property routeName
578
+ * @internal
579
+ */
580
+ routeName: computed(&#x27;modelName&#x27;, function() {
581
+ let name = this.modelName;
582
+ return this.store.adapterFor(name).pathForType(name);
583
+ }),
584
+
585
+ /**
586
+ * Final piece of title for table
587
+ * @type {String - Computed}
588
+ * @property tableSuffix
589
+ * @internal
590
+ */
591
+ tableSuffix: computed(&#x27;count&#x27;, &#x27;currentEntries&#x27;, &#x27;index&#x27;, function() {
592
+ let count = this.count;
593
+ let entries = this.currentEntries;
594
+ if (isEmpty(entries)) {
595
+ return &#x60;${count} entries&#x60;;
596
+ }
597
+ return &#x60;${entries.get(&#x27;length&#x27;)} of ${count} entries&#x60;;
598
+ }),
599
+
600
+ /**
601
+ * Title for the table
602
+ * @type {String - Computed}
603
+ * @property fullTableTitle
604
+ * @internal
605
+ */
606
+ fullTableTitle: computed(&#x27;currentTitle&#x27;, &#x27;tableSuffix&#x27;, function() {
607
+ return &#x60;${this.currentTitle} - ${this.tableSuffix}&#x60;;
608
+ }),
609
+
610
+ /**
611
+ * If true, hide the table when empty
612
+ * @type {Boolean - Computed}
613
+ * @property hideEmpty
614
+ * @internal
615
+ */
616
+ hideEmpty: empty(&#x27;emptyText&#x27;),
617
+
618
+ /* Functions */
619
+
620
+ /**
621
+ * Queries the serverside to get the total record count. Internal method.
622
+ * @method queryCount
623
+ * @private
624
+ * @return {Promise} Promise that resolves to a number
625
+ */
626
+ queryCount() {
627
+ // fetch standard query
628
+ let query = this.makeQuery({count: true});
629
+ query.count = true;
630
+
631
+ // make request
632
+ let url = this.config.formUrl(this.routeName);
633
+ return this.ajax.request(url, {data: query}).then((({count}) =&gt; count)).catch(handleAjaxError.bind(this));
634
+ },
635
+
636
+ /**
637
+ * Query for setting a new sort order. Internal method.
638
+ * @method querySort
639
+ * @private
640
+ * @param {Number} page Page number to start
641
+ * @param {String} sortKey New sort order
642
+ * @param {Boolean} ascending If true, sorts ascending, false descending
643
+ * @return {Promise} Promise that resolves to a entry array
644
+ */
645
+ querySort(page, sortKey, ascending) {
646
+ let query = this.lastQuery;
647
+
648
+ // set sort key stuff if present
649
+ if (!isNone(ascending)) {
650
+ query.ascending = ascending;
651
+ }
652
+ if (!isEmpty(sortKey)) {
653
+ query.sortKey = sortKey;
654
+ }
655
+
656
+ // set limits on query
657
+ let entriesPerPage = this.entriesPerPage;
658
+ query.limit = entriesPerPage;
659
+ query.offset = (page - 1) * entriesPerPage;
660
+
661
+ // make promise
662
+ return RSVP.resolve(this.store.query(this.modelName, query)).catch(handleAjaxError.bind(this));
663
+ },
664
+
665
+ /**
666
+ * Fetches the entries for the given page number. Internal method
667
+ * @method queryPage
668
+ * @private
669
+ * @param {Number} page Page to fetch
670
+ * @return {Promise} Promise that resolves to an entry array
671
+ */
672
+ queryPage(page) {
673
+ // same as sort, but handles the entries
674
+ return this.querySort(page).then((entries) =&gt; {
675
+ this.pageEntries[page - 1] = entries;
676
+ return entries;
677
+ });
678
+ },
679
+
680
+ /**
681
+ * Gets all entries for the given query. Internal method
682
+ * @method queryAll
683
+ * @private
684
+ * @return {Promise} Promise that resolves to entries
685
+ */
686
+ queryAll() {
687
+ let query = this.makeQuery({export: true});
688
+ return RSVP.resolve(this.store.query(this.modelName, query)).catch(handleAjaxError.bind(this));
689
+ },
690
+
691
+ actions: {
692
+ /* Search buttons */
693
+
694
+ /**
695
+ * This action is called when the search button is pressed. This is yielded as &#x60;actions.search&#x60; in the block.
696
+ * @method search
697
+ * @return {Promise} Promise that resolves after searching
698
+ */
699
+ search() {
700
+ // TODO: canSearch?
701
+ // else a title getter
702
+
703
+ // start search and clean up old data
704
+ this.setProperties({
705
+ currentTitle: this.getTitle(),
706
+ // search data
707
+ lastQuery: this.makeQuery({page: 1}),
708
+ pageEntries: [],
709
+ page: 1,
710
+ // searching keys
711
+ searchingTable: true,
712
+ pagesSearching: 0,
713
+ tableColumns: this.getTableColumns()
714
+ });
715
+
716
+ // search callback
717
+ this.onSearch();
718
+
719
+ // make two requests: one for the total count and one for the first 100 entries
720
+ return RSVP.hash({
721
+ count: this.queryCount(),
722
+ entries: this.queryPage(1)
723
+ }).then(({count}) =&gt; {
724
+ // entries already set as part of queryPage
725
+ this.setProperties({
726
+ count,
727
+ searchingTable: false
728
+ });
729
+ }).catch(() =&gt; {
730
+ // request failed, clean up data
731
+ this.setProperties({
732
+ // search data
733
+ pageEntries: null,
734
+ count: 0,
735
+ // searching keys
736
+ searchingTable: false
737
+ });
738
+ });
739
+ },
740
+
741
+ /**
742
+ * This action is called when the export button is clicked to export all data. This is yielded in the block as &#x60;actions.export&#x60;.
743
+ * @method export
744
+ * @return {Promise} Promise that resolves after exporting the table
745
+ */
746
+ export() {
747
+ // TODO: canSearch?
748
+
749
+ // build table for export
750
+ let table = Table.create({columns: this.getExportColumns()});
751
+ return this.queryAll().then((entries) =&gt; {
752
+ table.setRows(entries.sortBy(this.defaultSortKey).reverse());
753
+ exportTable(table, &#x60;${this.getTitle()} - All Entries&#x60;);
754
+ }).catch(handleAjaxError.bind(this));
755
+ },
756
+
757
+ /* Pagination */
758
+
759
+ /**
760
+ * This action is called when a page button is clicked to switch pages. This is an internal action used in the page number button.
761
+ * @method setPage
762
+ * @private
763
+ * @param {Number} page New page number to set
764
+ */
765
+ setPage(page) {
766
+ // clamp page number
767
+ let max = this.totalPages;
768
+ if (page &lt; 1) {
769
+ page = 1;
770
+ } else if (page &gt; max) {
771
+ page = max;
772
+ }
773
+
774
+ // if we have entries at the page number, use those
775
+ // if missing, query them
776
+ if (isNone(this.pageEntries.objectAt(page - 1))) {
777
+ this.incrementProperty(&#x27;pagesSearching&#x27;);
778
+ this.set(&#x27;page&#x27;, page);
779
+ this.queryPage(page).then(() =&gt; {
780
+ // entries set in promise logic
781
+ this.decrementProperty(&#x27;pagesSearching&#x27;);
782
+ });
783
+ } else {
784
+ this.set(&#x27;page&#x27;, page);
785
+ }
786
+ },
787
+
788
+ /* Sorting */
789
+
790
+ /**
791
+ * This action resorts the entry by the given column. This is yielded as &#x60;actions.sort&#x60;, when table is also defined. To be used in the &#x60;onSort&#x60; of your &#x60;FwSortableTable&#x60;.
792
+ * @method sortColumn
793
+ * @param {Column} column Column to use for sorting
794
+ * @param {String} sortKey String to use for sorting in the column
795
+ * @return {Promise} Promise that resolves to entries
796
+ */
797
+ sortColumn(column, sortKey) {
798
+ // if the sort key is unchanged, do nothing
799
+ if (sortKey === this.tableSortKey) {
800
+ return RSVP.resolve();
801
+ }
802
+
803
+ // mark that we are sorting, column properties do not add desc
804
+ column.set(&#x27;sorting&#x27;, true);
805
+
806
+ // search for data
807
+ let page = this.page;
808
+ return this.querySort(page, column.searchKey || column.valuePath, column.ascending).then((entries) =&gt; {
809
+ // set entries to new list
810
+ let pageEntries = [];
811
+ pageEntries[page - 1] = entries;
812
+ this.setProperties({pageEntries, currentSortKey: sortKey});
813
+
814
+ // mark that we are done sorting
815
+ column.set(&#x27;sorting&#x27;, false);
816
+ return entries;
817
+ });
818
+ }
819
+ }
820
+ });
821
+
822
+ </pre>
823
+ </div>
824
+ </div>
825
+ </div>
826
+ </div>
827
+ </div>
828
+ </div>
829
+ </div>
830
+ <script src="../assets/vendor/prettify/prettify-min.js"></script>
831
+ <script>prettyPrint();</script>
832
+ <script src="../assets/vendor/jquery/jquery.min.js"></script>
833
+ <script src="../assets/vendor/jquery-ui/jquery-ui.min.js"></script>
834
+ <script src="../assets/vendor/bootstrap/js/bootstrap.js"></script>
835
+ <script src="../assets/vendor/github-slugger/slugger.js"></script>
836
+ <script src="../assets/js/yuidoc-bootstrap.js"></script>
837
+ </body>
838
+ </html>