浏览代码

lubasictable filter transclude

tags/0.1.6
Robin Thoni 8 年前
父节点
当前提交
e3e8503332
共有 3 个文件被更改,包括 47 次插入40 次删除
  1. 1
    1
      dist/luticate-utils.min.js
  2. 38
    34
      src/lubasictable.js
  3. 8
    5
      src/luedittable.js

+ 1
- 1
dist/luticate-utils.min.js
文件差异内容过多而无法显示
查看文件


+ 38
- 34
src/lubasictable.js 查看文件

@@ -10,6 +10,9 @@ angular.module('luticateUtils')
10 10
                 scope: {
11 11
                     options: '&'
12 12
                 },
13
+                transclude: {
14
+                    'lu-basic-table-filter': '?lu-basic-table-filter'
15
+                },
13 16
                 templateUrl: "/luticate/lubasictable.html",
14 17
                 link: function ($scope, element, attrs) {
15 18
                     $scope.items = [];
@@ -173,38 +176,39 @@ angular.module('luticateUtils')
173 176
 
174 177
 angular.module('luticateUtils').run(['$templateCache', function($templateCache)
175 178
 {
176
-    $templateCache.put('/luticate/lubasictable.html', '<div lu-busy="tableOptions.luBusy">' +
177
-'<div class="col-sm-3 pull-right" ng-show="tableOptions.canFilter()"><input placeholder="Filter" class="form-control" ng-model-options="{debounce: 500}" ' +
178
-        'ng-model="tableOptions.query" ng-change="loadPage(0)"/></div>' +
179
-'        <table class="col-sm-12 table table-hover">' +
180
-'    <thead>' +
181
-'    <tr>' +
182
-'    <th ng-show="tableOptions.canCheck()">' +
183
-'    <input type="checkbox" ng-click="toggleCheckAll()"' +
184
-'    ng-checked="tableOptions.checkedItems.length == items.Data.length && items.Data.length != 0">' +
185
-'        </th>' +
186
-'        <th class="col-sm-{{ col.width }}" ng-repeat="col in tableOptions.columns">{{ col.name }}</th>' +
187
-'</tr>' +
188
-'</thead>' +
189
-'<tbody>' +
190
-'<tr ng-repeat="item in items.Data" ng-style="{\'cursor\': tableOptions.canClick(item) ? \'pointer\' : \'\'}" ng-click="onItemClicked(item)">' +
191
-'    <td ng-show="tableOptions.canCheck()">' +
192
-'    <input name="tableOptions.checkedItems[]" type="checkbox" ng-checked="isItemChecked(item)"' +
193
- '   ng-click="$event.stopPropagation();toggleCheckedItem(item)" >' +
194
-'        </td>' +
195
-'        <td ng-repeat="col in tableOptions.columns">{{ col.getValue(item) }}</td>' +
196
-'</tr>' +
197
-'</tbody>' +
198
-'</table>' +
199
-
200
-        '<div class="col-sm-12 text-center">' +
201
-'<div class="pagination"><ul>' +
202
-'    <li class="previous">' +
203
-'        <a href="" class="fui-arrow-left" ng-click="loadPage(tableOptions.page - 1)"></a></li>' +
204
-'    <li ng-repeat="p in pages" ng-class="{ \'active\' : p == tableOptions.page}">' +
205
-'        <a href="" ng-click="loadPage(p)">{{ p + 1 }}</a></li>' +
206
-'    <li class="next">' +
207
-'        <a href="" class="fui-arrow-right" ng-click="loadPage(tableOptions.page + 1)"></a></li>' +
208
-'</ul></div></div>' +
209
-'    </div>');
179
+    $templateCache.put('/luticate/lubasictable.html',
180
+'<div lu-busy="tableOptions.luBusy">' +
181
+'    <div class="col-sm-9"><ng-transclude ng-transclude="lu-basic-table-filter"></ng-transclude></div>' +
182
+'    <div class="col-sm-3" ng-show="tableOptions.canFilter()"><input placeholder="Filter" class="form-control" ng-model-options="{debounce: 500}" ' +
183
+'       ng-model="tableOptions.query" ng-change="loadPage(0)"/></div>' +
184
+'    <table class="col-sm-12 table table-hover">' +
185
+'       <thead>' +
186
+'           <tr>' +
187
+'               <th ng-show="tableOptions.canCheck()">' +
188
+'                   <input type="checkbox" ng-click="toggleCheckAll()"' +
189
+'                       ng-checked="tableOptions.checkedItems.length == items.Data.length && items.Data.length != 0">' +
190
+'               </th>' +
191
+'               <th class="col-sm-{{ col.width }}" ng-repeat="col in tableOptions.columns">{{ col.name }}</th>' +
192
+'           </tr>' +
193
+'       </thead>' +
194
+'       <tbody>' +
195
+'           <tr ng-repeat="item in items.Data" ng-style="{\'cursor\': tableOptions.canClick(item) ? \'pointer\' : \'\'}" ng-click="onItemClicked(item)">' +
196
+'               <td ng-show="tableOptions.canCheck()">' +
197
+'                   <input name="tableOptions.checkedItems[]" type="checkbox" ng-checked="isItemChecked(item)"' +
198
+'                       ng-click="$event.stopPropagation();toggleCheckedItem(item)" >' +
199
+'               </td>' +
200
+'               <td ng-repeat="col in tableOptions.columns">{{ col.getValue(item) }}</td>' +
201
+'           </tr>' +
202
+'       </tbody>' +
203
+'   </table>' +
204
+'   <div class="col-sm-12 text-center">' +
205
+'       <div class="pagination"><ul>' +
206
+'           <li class="previous">' +
207
+'               <a href="" class="fui-arrow-left" ng-click="loadPage(tableOptions.page - 1)"></a></li>' +
208
+'           <li ng-repeat="p in pages" ng-class="{ \'active\' : p == tableOptions.page}">' +
209
+'               <a href="" ng-click="loadPage(p)">{{ p + 1 }}</a></li>' +
210
+'           <li class="next">' +
211
+'               <a href="" class="fui-arrow-right" ng-click="loadPage(tableOptions.page + 1)"></a></li>' +
212
+'   </ul></div></div>' +
213
+'</div>');
210 214
 }]);

+ 8
- 5
src/luedittable.js 查看文件

@@ -10,6 +10,9 @@ angular.module('luticateUtils')
10 10
                 scope: {
11 11
                     options: '&'
12 12
                 },
13
+                transclude: {
14
+                    'lu-basic-table-filter': '?lu-basic-table-filter'
15
+                },
13 16
                 templateUrl: "/luticate/lutable.html",
14 17
                 link: function ($scope, element, attrs) {
15 18
 
@@ -130,14 +133,14 @@ angular.module('luticateUtils')
130 133
 angular.module('luticateUtils').run(['$templateCache', function($templateCache)
131 134
 {
132 135
     $templateCache.put('/luticate/lutable.html',
133
-'        <lu-basic-table options="tableOptions"></lu-basic-table>' +
136
+'<lu-basic-table options="tableOptions"><lu-basic-table-filter><ng-transclude ng-transclude="lu-basic-table-filter"></ng-transclude></lu-basic-table-filter></lu-basic-table>' +
134 137
 '<div class="col-sm-12">' +
135 138
 '    <button class="btn btn-danger" type="button" ng-click="deleteItems()"' +
136
-'ng-disabled="tableOptions.checkedItems.length == 0" ng-show="tableOptions.canDel()">' +
137
-'    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
139
+'       ng-disabled="tableOptions.checkedItems.length == 0" ng-show="tableOptions.canDel()">' +
140
+'       <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete' +
138 141
 '    </button>' +
139 142
 '    <button class="btn btn-primary" type="button" ng-click="tableOptions.addItem()" ng-show="tableOptions.canAdd()">' +
140
-'    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add' +
143
+'       <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add' +
141 144
 '    </button>' +
142
-'    </div>');
145
+'</div>');
143 146
 }]);

正在加载...
取消
保存