@bennerinformatics/ember-fw-table 2.1.5 → 2.1.6

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.
@@ -64,11 +64,11 @@ const TableResort = Component.extend({
64
64
  * If defined with an action, adds a delete button to delete items
65
65
  *
66
66
  * @public
67
- * @default true
67
+ * @default null
68
68
  * @property delete
69
69
  * @type {Action}
70
70
  */
71
- delete: () => {},
71
+ delete: null,
72
72
 
73
73
  /**
74
74
  * The icon that will be used for the delete button. Useful if you want the button to do something other than delete.
@@ -187,6 +187,19 @@ const TableSortable = Component.extend({
187
187
  */
188
188
  defaultSort: null,
189
189
 
190
+ // enables collapse UI
191
+ collapsible: false,
192
+
193
+ // initial open state (optional)
194
+ defaultOpen: true,
195
+
196
+ // internal open/closed state
197
+ _internalOpen: null,
198
+
199
+ // treat non-collapsible tables as always open
200
+ _open: computed('collapsible', '_internalOpen', function() {
201
+ return this.collapsible ? !!this._internalOpen : true;
202
+ }),
190
203
  /**
191
204
  * Private copy of defaultSort, made an array if its not
192
205
  *
@@ -362,6 +375,10 @@ const TableSortable = Component.extend({
362
375
  if (this.noPanel) {
363
376
  this.set('classNames', null);
364
377
  }
378
+ // initialize collapse state once when enabled
379
+ if (this.collapsible && isNone(this._internalOpen)) {
380
+ this.set('_internalOpen', this.defaultOpen !== false);
381
+ }
365
382
  },
366
383
 
367
384
  actions: {
@@ -414,6 +431,12 @@ const TableSortable = Component.extend({
414
431
  */
415
432
  export() {
416
433
  exportTable(this.table, this.title);
434
+ },
435
+ /**
436
+ * Called by the chevron icon to collapse the current table
437
+ */
438
+ toggleCollapse() {
439
+ this.toggleProperty('_internalOpen');
417
440
  }
418
441
  }
419
442
  });
@@ -1,5 +1,12 @@
1
- {{#if (or (and hasBlock showHeader) title canExport)}}
1
+ {{#if (or collapsible (and hasBlock showHeader) title canExport)}}
2
2
  <header class="panel-heading">
3
+ {{#if collapsible}}
4
+ <a role="button"
5
+ aria-expanded={{if _open "true" "false"}}
6
+ {{action "toggleCollapse"}}>
7
+ <i class="fas {{if _open "fa-chevron-down" "fa-chevron-right"}} fa-fw"></i>
8
+ </a>
9
+ {{/if}}
3
10
  {{#if (and hasBlock showHeader)}}
4
11
  {{yield (action 'export') true}}
5
12
  {{else}}
@@ -17,6 +24,7 @@
17
24
  <div class="clearfix"/>
18
25
  </header>
19
26
  {{/if}}
27
+ {{#if _open}}
20
28
  <section class="panel-body table-body">
21
29
  {{#if (and table.isEmpty (not headerEmpty))}}
22
30
  {{empty}}
@@ -47,6 +55,7 @@
47
55
  {{/light-table}}
48
56
  {{/if}}
49
57
  </section>
58
+ {{/if}}
50
59
  {{#if (and hasBlock showFooter)}}
51
60
  <footer class="panel-footer clearfix">
52
61
  {{yield (action 'export') false}}
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "@bennerinformatics/ember-fw-table",
3
- "version": "2.1.5",
4
- "description": "Additional resources related to tables for the Ember FW App System.",
5
- "keywords": [
6
- "ember-addon",
7
- "fw"
8
- ],
9
- "license": "MIT",
10
- "author": "David Burnett <djburnett@olivet.edu>",
11
- "directories": {
12
- "doc": "doc",
13
- "test": "tests"
14
- },
15
- "repository": "",
16
- "scripts": {
17
- "build": "ember build",
18
- "start": "ember server",
19
- "test": "npm run lint && ember try:each",
20
- "lint": "ember test --launch phantomjs --filter=\"ESLint\""
21
- },
22
- "dependencies": {
23
- "ember-cli-babel": "7.13.2",
24
- "ember-cli-htmlbars": "^3.1.0",
25
- "ember-light-table": "3.0.0-beta.1",
26
- "ember-papaparse": "^1.0.0",
27
- "ember-sortable": "https://bitbucket.org/linformatics/ember-sortable#firefox-fix",
28
- "ember-truth-helpers": "^2.1.0",
29
- "papaparse": "^5.0.2",
30
- "sass": "1.32.13"
31
- },
32
- "devDependencies": {
33
- "@bennerinformatics/ember-fw": "^2.1.2",
34
- "broccoli-asset-rev": "^3.0.0",
35
- "ember-ajax": "^5.0.0",
36
- "ember-cli": "~3.10.0",
37
- "ember-cli-addon-docs-yuidoc": "^1.0.0",
38
- "ember-cli-app-version": "^3.2.0",
39
- "ember-cli-dependency-checker": "^3.2.0",
40
- "ember-cli-eslint": "^5.1.0",
41
- "ember-cli-htmlbars-inline-precompile": "^2.1.0",
42
- "ember-cli-inject-live-reload": "^2.0.1",
43
- "ember-cli-qunit": "^4.4.0",
44
- "ember-cli-shims": "^1.2.0",
45
- "ember-cli-sri": "^2.1.0",
46
- "ember-cli-uglify": "^3.0.0",
47
- "ember-cli-yuidoc": "^0.8.8",
48
- "ember-disable-prototype-extensions": "^1.1.3",
49
- "ember-export-application-global": "^2.0.0",
50
- "ember-load-initializers": "^2.0.0",
51
- "ember-resolver": "^5.2.1",
52
- "ember-responsive": "^3.0.5",
53
- "ember-source": "~3.10.0",
54
- "eslint-plugin-ember": "^6.9.1",
55
- "eslint-plugin-ember-suave": "^1.0.0",
56
- "loader.js": "^4.7.0",
57
- "moment": "^2.24.0"
58
- },
59
- "engines": {
60
- "node": ">= 0.10.0"
61
- },
62
- "ember-addon": {
63
- "configPath": "tests/dummy/config"
64
- }
1
+ {
2
+ "name": "@bennerinformatics/ember-fw-table",
3
+ "version": "2.1.6",
4
+ "description": "Additional resources related to tables for the Ember FW App System.",
5
+ "keywords": [
6
+ "ember-addon",
7
+ "fw"
8
+ ],
9
+ "license": "MIT",
10
+ "author": "David Burnett <djburnett@olivet.edu>",
11
+ "directories": {
12
+ "doc": "doc",
13
+ "test": "tests"
14
+ },
15
+ "repository": "",
16
+ "scripts": {
17
+ "build": "ember build",
18
+ "start": "ember server",
19
+ "test": "npm run lint && ember try:each",
20
+ "lint": "ember test --launch phantomjs --filter=\"ESLint\""
21
+ },
22
+ "dependencies": {
23
+ "ember-cli-babel": "7.13.2",
24
+ "ember-cli-htmlbars": "^3.1.0",
25
+ "ember-light-table": "3.0.0-beta.1",
26
+ "ember-papaparse": "^1.0.0",
27
+ "ember-sortable": "https://bitbucket.org/linformatics/ember-sortable#firefox-fix",
28
+ "ember-truth-helpers": "^2.1.0",
29
+ "papaparse": "^5.0.2",
30
+ "sass": "1.32.13"
31
+ },
32
+ "devDependencies": {
33
+ "@bennerinformatics/ember-fw": "^2.1.2",
34
+ "broccoli-asset-rev": "^3.0.0",
35
+ "ember-ajax": "^5.0.0",
36
+ "ember-cli": "~3.10.0",
37
+ "ember-cli-addon-docs-yuidoc": "^1.0.0",
38
+ "ember-cli-app-version": "^3.2.0",
39
+ "ember-cli-dependency-checker": "^3.2.0",
40
+ "ember-cli-eslint": "^5.1.0",
41
+ "ember-cli-htmlbars-inline-precompile": "^2.1.0",
42
+ "ember-cli-inject-live-reload": "^2.0.1",
43
+ "ember-cli-qunit": "^4.4.0",
44
+ "ember-cli-shims": "^1.2.0",
45
+ "ember-cli-sri": "^2.1.0",
46
+ "ember-cli-uglify": "^3.0.0",
47
+ "ember-cli-yuidoc": "^0.8.8",
48
+ "ember-disable-prototype-extensions": "^1.1.3",
49
+ "ember-export-application-global": "^2.0.0",
50
+ "ember-load-initializers": "^2.0.0",
51
+ "ember-resolver": "^5.2.1",
52
+ "ember-responsive": "^3.0.5",
53
+ "ember-source": "~3.10.0",
54
+ "eslint-plugin-ember": "^6.9.1",
55
+ "eslint-plugin-ember-suave": "^1.0.0",
56
+ "loader.js": "^4.7.0",
57
+ "moment": "^2.24.0"
58
+ },
59
+ "engines": {
60
+ "node": ">= 0.10.0"
61
+ },
62
+ "ember-addon": {
63
+ "configPath": "tests/dummy/config"
64
+ }
65
65
  }