diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtable.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtable.directive.js index 399ce8877a..ae41073c0d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtable.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtable.directive.js @@ -110,77 +110,72 @@ **/ (function () { - 'use strict'; + 'use strict'; - function TableDirective(iconHelper) { + function TableController(iconHelper) { - function link(scope, el, attr, ctrl) { + var vm = this; - scope.clickItem = function (item, $event) { - if (scope.onClick) { - scope.onClick(item); - $event.stopPropagation(); + vm.clickItem = function (item, $event) { + if (vm.onClick) { + vm.onClick({ item: item}); + $event.stopPropagation(); } - }; + }; - scope.selectItem = function (item, $index, $event) { - if (scope.onSelect) { - scope.onSelect(item, $index, $event); - $event.stopPropagation(); + vm.selectItem = function (item, $index, $event) { + if (vm.onSelect) { + vm.onSelect({ item: item, $index: $index, $event: $event }); + $event.stopPropagation(); } - }; + }; - scope.selectAll = function ($event) { - if (scope.onSelectAll) { - scope.onSelectAll($event); + vm.selectAll = function ($event) { + if (vm.onSelectAll) { + vm.onSelectAll({ $event: $event}); } - }; + }; - scope.isSelectedAll = function () { - if (scope.onSelectedAll && scope.items && scope.items.length > 0) { - return scope.onSelectedAll(); + vm.isSelectedAll = function () { + if (vm.onSelectedAll && vm.items && vm.items.length > 0) { + return vm.onSelectedAll(); } - }; + }; - scope.isSortDirection = function (col, direction) { - if (scope.onSortingDirection) { - return scope.onSortingDirection(col, direction); + vm.isSortDirection = function (col, direction) { + if (vm.onSortingDirection) { + return vm.onSortingDirection({ col: col, direction: direction }); } - }; + }; - scope.sort = function (field, allow, isSystem) { - if (scope.onSort) { - scope.onSort(field, allow, isSystem); + vm.sort = function (field, allow, isSystem) { + if (vm.onSort) { + vm.onSort({ field: field, allow: allow, isSystem: isSystem }); } - }; + }; - scope.getIcon = function (entry) { - return iconHelper.convertFromLegacyIcon(entry.icon); - }; + vm.getIcon = function (entry) { + return iconHelper.convertFromLegacyIcon(entry.icon); + }; + } - } - - var directive = { - restrict: 'E', - replace: true, - templateUrl: 'views/components/umb-table.html', - scope: { - items: '=', - itemProperties: '=', - allowSelectAll: '=', - onSelect: '=', - onClick: '=', - onSelectAll: '=', - onSelectedAll: '=', - onSortingDirection: '=', - onSort: '=' - }, - link: link - }; - - return directive; - } - - angular.module('umbraco.directives').directive('umbTable', TableDirective); + angular + .module('umbraco.directives') + .component('umbTable', { + templateUrl: 'views/components/umb-table.html', + controller: TableController, + controllerAs: 'vm', + bindings: { + items: '<', + itemProperties: '<', + allowSelectAll: '<', + onSelect: '&', + onClick: '&', + onSelectAll: '&', + onSelectedAll: '&', + onSortingDirection: '&', + onSort: '&' + } + }); })(); diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-table.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-table.html index 91c0af5005..003ab9832c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-table.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-table.html @@ -1,29 +1,29 @@
-
+
+ ng-show="vm.allowSelectAll" + ng-click="vm.selectAll($event)" + ng-checked="vm.isSelectedAll()">
-
+
Status
- @@ -31,30 +31,30 @@
+ ng-click="vm.selectItem(item, $index, $event)">
- +
-
+
-
+
@@ -71,7 +71,7 @@
- There are no items show in the list. diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html index 45f51e754c..4cfa8c7984 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html @@ -25,12 +25,12 @@ items="items" allow-select-all="options.bulkActionsAllowed" item-properties="options.includeProperties" - on-select="vm.selectItem" - on-click="vm.clickItem" - on-select-all="vm.selectAll" - on-selected-all="vm.isSelectedAll" - on-sorting-direction="vm.isSortDirection" - on-sort="vm.sort"> + on-select="vm.selectItem(item, $index, $event)" + on-click="vm.clickItem(item)" + on-select-all="vm.selectAll($event)" + on-selected-all="vm.isSelectedAll()" + on-sorting-direction="vm.isSortDirection(col, direction)" + on-sort="vm.sort(field, allow, isSystem)">
@@ -42,19 +42,19 @@ items="items" allow-select-all="options.bulkActionsAllowed" item-properties="options.includeProperties" - on-select="vm.selectItem" - on-click="vm.clickItem" - on-select-all="vm.selectAll" - on-selected-all="vm.isSelectedAll" - on-sorting-direction="vm.isSortDirection" - on-sort="vm.sort"> + on-select="vm.selectItem(item, $index, $event)" + on-click="vm.clickItem(item)" + on-select-all="vm.selectAll($event)" + on-selected-all="vm.isSelectedAll()" + on-sorting-direction="vm.isSortDirection(col, direction)" + on-sort="vm.sort(field, allow, isSystem)"> -
No content has been added
-
No members have been added
+
No content has been added
+
No members have been added