@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.
- package/README.md +6 -0
- package/addon/classes/Row.js +19 -13
- package/addon/classes/Table.js +18 -13
- package/addon/components/fw-cell-action.js +9 -5
- package/addon/components/fw-cell-boolean.js +4 -3
- package/addon/components/fw-cell-nullable.js +5 -2
- package/addon/components/fw-cell-permission-icon.js +19 -3
- package/addon/components/fw-column-sortable.js +12 -4
- package/addon/components/fw-column-title.js +12 -4
- package/addon/components/fw-delete-modal.js +30 -11
- package/addon/components/fw-expandable-row.js +5 -0
- package/addon/components/fw-pagination-wrapper.js +81 -162
- package/addon/components/fw-row-toggle-index.js +4 -4
- package/addon/components/fw-row-toggle.js +12 -5
- package/addon/components/fw-table-expanded-row.js +5 -6
- package/addon/components/fw-table-expanded-rows.js +8 -4
- package/addon/components/fw-table-resort.js +29 -16
- package/addon/components/fw-table-sortable.js +40 -24
- package/addon/documentation.js +26 -61
- package/addon/templates/components/fw-delete-modal.hbs +1 -1
- package/addon/utils/base-cells.js +40 -5
- package/addon/utils/export.js +3 -1
- package/addon/utils/formats.js +54 -7
- package/addon/utils/table.js +2 -1
- package/index.js +2 -1
- package/package.json +5 -7
- package/yuidoc-ember-theme/LICENSE +21 -0
- package/yuidoc-ember-theme/README.md +88 -0
- package/yuidoc-ember-theme/assets/css/custom.css +82 -0
- package/yuidoc-ember-theme/assets/css/external-small.png +0 -0
- package/yuidoc-ember-theme/assets/css/main.css +793 -0
- package/yuidoc-ember-theme/assets/css/theme.css +547 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-144x144.png +0 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-192x192.png +0 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-36x36.png +0 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-48x48.png +0 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-72x72.png +0 -0
- package/yuidoc-ember-theme/assets/icons/android-icon-96x96.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-114x114.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-120x120.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-144x144.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-152x152.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-180x180.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-57x57.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-60x60.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-72x72.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-76x76.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon-precomposed.png +0 -0
- package/yuidoc-ember-theme/assets/icons/apple-icon.png +0 -0
- package/yuidoc-ember-theme/assets/icons/browserconfig.xml +2 -0
- package/yuidoc-ember-theme/assets/icons/favicon-16x16.png +0 -0
- package/yuidoc-ember-theme/assets/icons/favicon-32x32.png +0 -0
- package/yuidoc-ember-theme/assets/icons/favicon-96x96.png +0 -0
- package/yuidoc-ember-theme/assets/icons/favicon.ico +0 -0
- package/yuidoc-ember-theme/assets/icons/manifest.json +41 -0
- package/yuidoc-ember-theme/assets/icons/ms-icon-144x144.png +0 -0
- package/yuidoc-ember-theme/assets/icons/ms-icon-150x150.png +0 -0
- package/yuidoc-ember-theme/assets/icons/ms-icon-310x310.png +0 -0
- package/yuidoc-ember-theme/assets/icons/ms-icon-70x70.png +0 -0
- package/yuidoc-ember-theme/assets/img/ember-logo.png +0 -0
- package/yuidoc-ember-theme/assets/img/fw-logo.png +0 -0
- package/yuidoc-ember-theme/assets/img/spinner.gif +0 -0
- package/yuidoc-ember-theme/assets/index.html +10 -0
- package/yuidoc-ember-theme/assets/js/yuidoc-bootstrap.js +274 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
- package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/yuidoc-ember-theme/assets/vendor/github-slugger/slugger.js +59 -0
- package/yuidoc-ember-theme/assets/vendor/jquery/jquery.min.js +6 -0
- package/yuidoc-ember-theme/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
- package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.css +1 -0
- package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.js +1 -0
- package/yuidoc-ember-theme/helpers/helpers.js +236 -0
- package/yuidoc-ember-theme/layouts/main.handlebars +111 -0
- package/yuidoc-ember-theme/layouts/xhr.handlebars +7 -0
- package/yuidoc-ember-theme/package.json +15 -0
- package/yuidoc-ember-theme/partials/attrs.handlebars +144 -0
- package/yuidoc-ember-theme/partials/classes.handlebars +229 -0
- package/yuidoc-ember-theme/partials/events.handlebars +140 -0
- package/yuidoc-ember-theme/partials/files.handlebars +9 -0
- package/yuidoc-ember-theme/partials/index.handlebars +25 -0
- package/yuidoc-ember-theme/partials/method.handlebars +193 -0
- package/yuidoc-ember-theme/partials/module.handlebars +108 -0
- package/yuidoc-ember-theme/partials/options.handlebars +22 -0
- package/yuidoc-ember-theme/partials/props.handlebars +122 -0
- package/yuidoc-ember-theme/partials/sidebar.handlebars +77 -0
- package/yuidoc-ember-theme/theme.json +4 -0
- package/yuidoc-ember-theme/yarn.lock +4 -0
- package/yuidoc.json +4 -2
- /package/{bitbucket-helpers-override.js → yuidoc-ember-theme/helpers/bitbucket-helpers-override.js} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# ember-fw-table
|
|
2
2
|
|
|
3
|
+
We have a couple of documentation websites, which may help in using this package:
|
|
4
|
+
|
|
5
|
+
[Ember FW Table Docs](https://linformatics.bitbucket.io/docs/addons/client/ember-fw-table) give a more robust guide to some of the important features of the package.
|
|
6
|
+
|
|
7
|
+
[Ember FW Table API Docs](https://linformatics.bitbucket.io/docs/addons/client-api/ember-fw-table) are api documentation for each of our components, which are generated from code comments.
|
|
8
|
+
|
|
3
9
|
This README outlines the details of collaborating on this Ember addon.
|
|
4
10
|
|
|
5
11
|
## Installation
|
package/addon/classes/Row.js
CHANGED
|
@@ -9,20 +9,20 @@ import {showExpanded} from '../utils/table';
|
|
|
9
9
|
* @return {computed} Computed property
|
|
10
10
|
*/
|
|
11
11
|
function canExpand(keys) {
|
|
12
|
-
return computed('table.{alwaysExpand,hasExpandedColumns}', ...keys, function() {
|
|
12
|
+
return computed('table.{alwaysExpand,hasExpandedColumns,expandedColumns}', ...keys, function() {
|
|
13
13
|
// start with some short exits
|
|
14
14
|
// no expanded columns is false
|
|
15
|
-
if (!this.
|
|
15
|
+
if (!this.table.hasExpandedColumns) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
// if it has an expanded column that always shows, automatically true
|
|
19
|
-
if (this.
|
|
19
|
+
if (this.table.alwaysExpand) {
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// try and find any column that has something
|
|
24
|
-
return this.
|
|
25
|
-
return showExpanded(this.
|
|
24
|
+
return this.table.expandedColumns.any((column) => {
|
|
25
|
+
return showExpanded(this.table, this, column);
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -49,10 +49,10 @@ export default class Row extends LightRow.extend({
|
|
|
49
49
|
/** Disables expanded state if canExpand is false */
|
|
50
50
|
expanded: computed('canExpand', '_expanded', {
|
|
51
51
|
get() {
|
|
52
|
-
return this.
|
|
52
|
+
return this.canExpand && this.get('_expanded');
|
|
53
53
|
},
|
|
54
54
|
set(_, value) {
|
|
55
|
-
value &= this.
|
|
55
|
+
value &= this.canExpand;
|
|
56
56
|
this.set('_expanded', value);
|
|
57
57
|
return value;
|
|
58
58
|
}
|
|
@@ -63,12 +63,18 @@ export default class Row extends LightRow.extend({
|
|
|
63
63
|
*/
|
|
64
64
|
// eslint-disable-next-line ember/no-observers
|
|
65
65
|
updateColumns: observer('table.expandedKeys', function() {
|
|
66
|
-
defineProperty(this, 'canExpand', canExpand(this.
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.
|
|
66
|
+
defineProperty(this, 'canExpand', canExpand(this.table.expandedKeys));
|
|
67
|
+
}),
|
|
68
|
+
|
|
69
|
+
init({content, table}) {
|
|
70
|
+
this._super(...arguments);
|
|
71
|
+
this.table = table;
|
|
72
72
|
defineProperty(this, 'canExpand', canExpand(table.get('expandedKeys')));
|
|
73
73
|
}
|
|
74
|
+
}) {
|
|
75
|
+
// constructor({content, table}) {
|
|
76
|
+
// super(content);
|
|
77
|
+
// this.table = table;
|
|
78
|
+
// defineProperty(this, 'canExpand', canExpand(table.get('expandedKeys')));
|
|
79
|
+
// }
|
|
74
80
|
}
|
package/addon/classes/Table.js
CHANGED
|
@@ -14,7 +14,7 @@ import {isEmpty, isNone} from '@ember/utils';
|
|
|
14
14
|
* @return {Array} Array of table rows
|
|
15
15
|
*/
|
|
16
16
|
function createRows(rows = [], table) {
|
|
17
|
-
return rows.map((r) =>
|
|
17
|
+
return rows.map((r) => Row.create({content: r, table}));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -41,7 +41,7 @@ export class Table extends LightTable.extend({
|
|
|
41
41
|
* @type {Ember.Array}
|
|
42
42
|
*/
|
|
43
43
|
visibleColumnGroups: computed('tableColumns.[]', 'tableColumns.@each.{isHidden,isVisibleGroupColumn}', function() {
|
|
44
|
-
return this.
|
|
44
|
+
return this.tableColumns.filter((c) => {
|
|
45
45
|
return c.get('isVisibleGroupColumn') || (!c.get('isGroupColumn') && !c.get('isHidden'));
|
|
46
46
|
});
|
|
47
47
|
}).readOnly(),
|
|
@@ -51,7 +51,7 @@ export class Table extends LightTable.extend({
|
|
|
51
51
|
* @type {Ember.Array}
|
|
52
52
|
*/
|
|
53
53
|
visibleSubColumns: computed('tableColumns.@each.visibleSubColumns', function() {
|
|
54
|
-
return emberArray([].concat(...this.
|
|
54
|
+
return emberArray([].concat(...this.tableColumns.getEach('visibleSubColumns')));
|
|
55
55
|
}).readOnly(),
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -59,7 +59,7 @@ export class Table extends LightTable.extend({
|
|
|
59
59
|
* @type {Ember.Array}
|
|
60
60
|
*/
|
|
61
61
|
allColumns: computed('tableColumns.@each.subColumns', function() {
|
|
62
|
-
return this.
|
|
62
|
+
return this.tableColumns.reduce((arr, c) => {
|
|
63
63
|
arr.pushObjects(c.get('isGroupColumn') ? c.get('subColumns') : [c]);
|
|
64
64
|
return arr;
|
|
65
65
|
}, emberArray([]));
|
|
@@ -88,12 +88,12 @@ export class Table extends LightTable.extend({
|
|
|
88
88
|
}).readOnly(),
|
|
89
89
|
|
|
90
90
|
alwaysExpand: computed('expandedColumns.@each.canExpand', function() {
|
|
91
|
-
return this.
|
|
91
|
+
return this.expandedColumns.any((column) => column.get('showExpanded') === true);
|
|
92
92
|
}),
|
|
93
93
|
|
|
94
94
|
expandedKeys: computed('expandedColumns.[]', function() {
|
|
95
95
|
let keys = [];
|
|
96
|
-
this.
|
|
96
|
+
this.expandedColumns.forEach((column) => {
|
|
97
97
|
// check if we have a specific expansion property
|
|
98
98
|
let showExpanded = column.get('showExpanded');
|
|
99
99
|
if (typeof showExpanded === 'string') {
|
|
@@ -117,7 +117,7 @@ export class Table extends LightTable.extend({
|
|
|
117
117
|
* @type {Boolean}
|
|
118
118
|
*/
|
|
119
119
|
hasExpandedColumns: computed('expandedColumns', function() {
|
|
120
|
-
return !isEmpty(this.
|
|
120
|
+
return !isEmpty(this.expandedColumns);
|
|
121
121
|
}),
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -127,13 +127,18 @@ export class Table extends LightTable.extend({
|
|
|
127
127
|
* @return {Array} rows
|
|
128
128
|
*/
|
|
129
129
|
setRows(rows = []) {
|
|
130
|
-
return this.
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
return this.rows.setObjects(createRows(rows, this));
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
init({columns, rows}) {
|
|
134
|
+
this._super(...arguments);
|
|
135
135
|
this.setRows(rows);
|
|
136
136
|
}
|
|
137
|
+
}) {
|
|
138
|
+
// constructor({columns, rows}) {
|
|
139
|
+
// super(columns, []);
|
|
140
|
+
// this.setRows(rows);
|
|
141
|
+
// }
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
/**
|
|
@@ -143,5 +148,5 @@ export class Table extends LightTable.extend({
|
|
|
143
148
|
* @return {Table} Table class to use in ember-light-table
|
|
144
149
|
*/
|
|
145
150
|
export default function newTable(columns, rows) {
|
|
146
|
-
return
|
|
151
|
+
return Table.create({columns, rows});
|
|
147
152
|
}
|
|
@@ -2,13 +2,17 @@ import Component from '@ember/component';
|
|
|
2
2
|
import layout from '../templates/components/fw-cell-action';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* This cell contains buttons to edit and delete a model, which can have actions passed in
|
|
6
|
-
* The edit action is expected to be passed in as tableActions.edit
|
|
5
|
+
* This cell contains buttons to edit and delete a model, which can have actions passed in.
|
|
6
|
+
* The edit action is expected to be passed in as `tableActions.edit`, while delete as `tableActions.delete`.
|
|
7
|
+
* This component will only give you two actions, so if you need a more complicated component than edit and delete,
|
|
8
|
+
* you will need to create your own cell component.
|
|
9
|
+
* Setting the variable `small` in the column will cause the buttons to display smaller.
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* The easiest way to add this cell is through the base cell in utils, for more information, [click here](../classes/BaseCells.html). In most cases, it is best
|
|
12
|
+
* to use the util rather than this cell component directly.
|
|
10
13
|
* @public
|
|
11
|
-
* @class
|
|
14
|
+
* @class FwCellAction
|
|
15
|
+
* @module CellComponents
|
|
12
16
|
*/
|
|
13
17
|
export default Component.extend({
|
|
14
18
|
layout
|
|
@@ -2,10 +2,11 @@ import Component from '@ember/component';
|
|
|
2
2
|
import layout from '../templates/components/fw-cell-boolean';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Displays a cell containing a boolean as either "Yes" or "No"
|
|
5
|
+
* Displays a cell containing a boolean as either "Yes" or "No".
|
|
6
6
|
* @public
|
|
7
|
-
* @deprecated
|
|
8
|
-
* @class
|
|
7
|
+
* @deprecated You should use the [`formatBoolean` in the Format Util](../classes/BaseCells.html) instead.
|
|
8
|
+
* @class FwCellBoolean
|
|
9
|
+
* @module CellComponents
|
|
9
10
|
*/
|
|
10
11
|
export default Component.extend({
|
|
11
12
|
layout
|
|
@@ -3,9 +3,12 @@ import layout from '../templates/components/fw-cell-nullable';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a table cell that displays a default value if null.
|
|
6
|
-
* That value defaults to "None", but can be changed by setting the nullText property in a column
|
|
6
|
+
* That value defaults to "None", but can be changed by setting the `nullText` property in a column.
|
|
7
|
+
* @deprecated You should use the [`formatNullable` in the Format Util](../classes/BaseCells.html) instead.
|
|
7
8
|
* @public
|
|
8
|
-
* @class
|
|
9
|
+
* @class FwCellNullable
|
|
10
|
+
* @module CellComponents
|
|
11
|
+
*
|
|
9
12
|
*/
|
|
10
13
|
export default Component.extend({
|
|
11
14
|
layout
|
|
@@ -2,10 +2,26 @@ import Component from '@ember/component';
|
|
|
2
2
|
import layout from '../templates/components/fw-cell-permission-icon';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* This component displays the permission icon for the table on the Permissions page. It should be used in the following way:
|
|
6
|
+
* ```js
|
|
7
|
+
* columns: [{
|
|
8
|
+
* label: 'Admin',
|
|
9
|
+
* valuePath: 'admin',
|
|
10
|
+
* cellComponent: 'fw-cell-permission-icon',
|
|
11
|
+
* align: 'center',
|
|
12
|
+
* width: '80px'
|
|
13
|
+
* }]
|
|
14
|
+
* ```
|
|
15
|
+
* This component will take the value, and display the proper Fontawesome icon based on its value. The value should be one of the following three numbers:
|
|
16
|
+
*
|
|
17
|
+
* - 0 means that that role does not have access to that feature, and it will display a red X.
|
|
18
|
+
* - 1 means that that feature is controlled by access control, not by Group Control, and it will display a lock icon in the primary color of the app
|
|
19
|
+
* - 2 means that that role has access to that feature, and will display a green check mark.
|
|
20
|
+
* - If the value is anything else, the cell will just be empty
|
|
21
|
+
*
|
|
6
22
|
* @public
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
23
|
+
* @class FwCellPermissionIcon
|
|
24
|
+
* @module CellComponents
|
|
9
25
|
*/
|
|
10
26
|
export default Component.extend({
|
|
11
27
|
layout
|
|
@@ -3,11 +3,19 @@ import {computed} from '@ember/object';
|
|
|
3
3
|
import layout from '../templates/components/fw-column-sortable';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Displays a column title which can show a sorting icon
|
|
6
|
+
* Displays a column title which can show a sorting icon if a network request is still active. This can be used for your columns when using the [FwPaginationWrapper](../classes/FwPaginationWrapper.html),
|
|
7
|
+
* so that sorting works properly. It should be set as the columns component (not the cellComponent), like so:
|
|
8
|
+
* ```js
|
|
9
|
+
* columns: [{
|
|
10
|
+
* label: 'Name',
|
|
11
|
+
* valuePath: 'name',
|
|
12
|
+
* component: 'fw-column-sortable'
|
|
13
|
+
* }...]
|
|
14
|
+
* ```
|
|
15
|
+
* If you do this, when you are sorting the table within the paginated wrapper, it will display a spinning icon letting the user know that the sort is loading.
|
|
7
16
|
* @public
|
|
8
|
-
* @class
|
|
9
|
-
* @module
|
|
10
|
-
* @submodule Internal
|
|
17
|
+
* @class FwColumnSortable
|
|
18
|
+
* @module ColumnComponents
|
|
11
19
|
*/
|
|
12
20
|
export default Component.extend({
|
|
13
21
|
layout,
|
|
@@ -2,11 +2,19 @@ import Sortable from './fw-column-sortable';
|
|
|
2
2
|
import layout from '../templates/components/fw-column-title';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* This column component extends [`fw-column-sortable` component](../classes/FwColumnSortable.html), so it will display a sort-icon, but it also display a column title
|
|
6
|
+
* which will truncate with an ellipsis if too long. This can be used for your columns when using the [FwPaginationWrapper](../classes/FwPaginationWrapper.html),
|
|
7
|
+
* so that sorting works properly. It should be set as the columns component (not the cellComponent), like so:
|
|
8
|
+
* ```js
|
|
9
|
+
* columns: [{
|
|
10
|
+
* label: 'Name',
|
|
11
|
+
* valuePath: 'name',
|
|
12
|
+
* component: 'fw-column-title'
|
|
13
|
+
* }...]
|
|
14
|
+
* ```
|
|
6
15
|
* @public
|
|
7
|
-
* @class
|
|
8
|
-
* @module
|
|
9
|
-
* @submodule Internal
|
|
16
|
+
* @class FwColumnTitle
|
|
17
|
+
* @module ColumnComponents
|
|
10
18
|
*/
|
|
11
19
|
export default Sortable.extend({
|
|
12
20
|
layout
|
|
@@ -3,58 +3,77 @@ import {computed} from '@ember/object';
|
|
|
3
3
|
import layout from '../templates/components/fw-delete-modal';
|
|
4
4
|
import RSVP from 'rsvp';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* The FwDeleteModal component is a pseudo component/modal hybrid because it opens a modal and internally uses the `FwFullscreenModal` component, specifically
|
|
7
|
+
* the [`confirm-choice` modal](https://linformatics.bitbucket.io/docs/addons/client-api/ember-fw/classes/Confirm-ChoiceModal.html) in the "sm" size. However, `FwDeleteModal` requires even less
|
|
8
|
+
* set up than that, thus it has the extremely niche case of opening a delete modal, and cannot really be expanded even to an "are you sure you want to archive?" modal. However, it
|
|
9
|
+
* is very useful for what it is intended. How you use it is you follow the instructions for actions in [Calling the Modal](https://linformatics.bitbucket.io/docs/addons/client/ember-fw/concepts/modals#calling-the-modal), but using
|
|
10
|
+
* `FwDeleteModal` instead of `FwFullscreenModal`. The only properties you can pass in to either `confirm-choice` or `FwFullscreenModal` itself are those listed below. An example of how to use it would be:
|
|
11
|
+
* ```handlebars
|
|
12
|
+
* {{#if shouldRender}}
|
|
13
|
+
* <FwDeleteModal @model={{modelToDelete}} @type="modelName" @close={{action "toggleShouldRender"}} />
|
|
14
|
+
* {{/if}}
|
|
15
|
+
* ```
|
|
16
|
+
* When the user confirms the choice to delete, this component will automatically call `destroyRecord` on that model, deleting it for you.
|
|
17
|
+
* @public
|
|
18
|
+
* @class FwDeleteModal
|
|
19
|
+
* @module Components
|
|
8
20
|
*/
|
|
9
21
|
export default Component.extend({
|
|
10
22
|
layout,
|
|
11
23
|
/**
|
|
12
|
-
* Action called to close the modal
|
|
24
|
+
* Action called to close the modal.
|
|
25
|
+
* @property close
|
|
13
26
|
* @type {Action}
|
|
14
27
|
*/
|
|
15
28
|
close: null,
|
|
16
29
|
|
|
17
30
|
/**
|
|
18
|
-
* Model which will be deleted
|
|
31
|
+
* Model which will be deleted.
|
|
32
|
+
* @property model
|
|
19
33
|
* @type {DS.Model}
|
|
20
34
|
*/
|
|
21
35
|
model: null,
|
|
22
36
|
|
|
23
37
|
/**
|
|
24
|
-
* Message displayed in the confirmation. If unset use the default
|
|
38
|
+
* Message displayed in the confirmation. If unset use the default (which looks at type property).
|
|
39
|
+
* @property message
|
|
40
|
+
* @default "Are you sure you want to delete this {type}? It cannot be undone."
|
|
25
41
|
* @type {String}
|
|
26
42
|
*/
|
|
27
43
|
message: null,
|
|
28
44
|
|
|
29
45
|
/**
|
|
30
|
-
* Model type being deleted, used to create the message
|
|
46
|
+
* Model type being deleted, used to create the message.
|
|
47
|
+
* @property type
|
|
31
48
|
* @type {String}
|
|
32
49
|
*/
|
|
33
50
|
type: null,
|
|
34
51
|
|
|
35
52
|
/**
|
|
36
|
-
* Determines whether opening this modal caused the web browser to scroll to the top
|
|
53
|
+
* Determines whether opening this modal caused the web browser to scroll to the top.
|
|
54
|
+
* @property scrollTop
|
|
55
|
+
* @default false
|
|
37
56
|
* @type {Boolean}
|
|
38
57
|
*/
|
|
39
58
|
scrollTop: false,
|
|
40
59
|
|
|
41
60
|
_message: computed('message', 'type', function() {
|
|
42
61
|
// if we have a message, use that
|
|
43
|
-
let message = this.
|
|
62
|
+
let message = this.message;
|
|
44
63
|
if (message) {
|
|
45
64
|
return message;
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
// if no message, determine the type and use the default
|
|
49
|
-
let type = this.
|
|
68
|
+
let type = this.type || 'model';
|
|
50
69
|
return `Are you sure you want to delete this ${type}? It cannot be undone.`;
|
|
51
70
|
}),
|
|
52
71
|
|
|
53
72
|
actions: {
|
|
54
73
|
// deletes the contained model
|
|
55
74
|
deleteModel() {
|
|
56
|
-
if (this.
|
|
57
|
-
return RSVP.resolve(this.
|
|
75
|
+
if (this.model) {
|
|
76
|
+
return RSVP.resolve(this.model.destroyRecord());
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
79
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import LightRow from 'ember-light-table/components/lt-row';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* This is a component internal to ember-fw-table, and should not be called outside. It extends the `lt-row` component from Ember Light Table, and simply allows it to be expandable.
|
|
5
|
+
* @private
|
|
6
|
+
* @class FwExpandableRow
|
|
7
|
+
*/
|
|
3
8
|
export default LightRow.extend({
|
|
4
9
|
classNameBindings: ['row.canExpand:is-expandable']
|
|
5
10
|
});
|