Skip to content

Commit dabf147

Browse files
committed
更新树型表格组件checkbox中间选中状态,增加了健壮性检测
1 parent c7b3e93 commit dabf147

File tree

4 files changed

+199
-5
lines changed

4 files changed

+199
-5
lines changed

sample/Util.Samples.Webs/Typings/util/core/tree.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export class TreeViewModel implements ISort, IKey {
4545
* 数据
4646
*/
4747
data?;
48+
/**
49+
* 展开
50+
*/
51+
expanded?: boolean;
4852
}
4953

5054
/**

sample/Util.Samples.Webs/Typings/util/prime/treetable.component.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,20 +912,27 @@ export class TreeTable<T extends TreeViewModel & TreeNode> implements AfterConte
912912
}
913913

914914
/**
915-
* 复选框的确定状态
915+
* 复选框的中间状态
916916
*/
917917
isIndeterminate(treeNode: T) {
918918
if (!this.dataSource || this.dataSource.length === 0)
919919
return false;
920920
if (!this.selection || this.selection.length === 0)
921921
return false;
922-
if (!treeNode) {
923-
let length = this.getNodesLength(this.dataSource);
924-
return this.selection.length !== length;
925-
}
922+
if (!treeNode)
923+
return this.isIndeterminateForNodes(this.dataSource);
926924
if (!treeNode.children || treeNode.children.length === 0)
927925
return false;
928926
let nodes = this.getChildNodes([treeNode]);
927+
return this.isIndeterminateForNodes(nodes);
928+
}
929+
930+
/**
931+
* 复选框的中间状态
932+
*/
933+
private isIndeterminateForNodes(nodes: TreeNode[]) {
934+
if (!nodes || nodes.length === 0)
935+
return false;
929936
if (nodes.every(node => this.isSelected(node)))
930937
return false;
931938
return nodes.some(node => this.isSelected(node));
10.5 KB
Binary file not shown.

template/CodeSmith/CodeGenerator/CodeGenerator.csproj

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,144 @@
6767
<Reference Include="System.Xml" />
6868
</ItemGroup>
6969
<ItemGroup>
70+
<Compile Include="02-Result\Datas\IGreatWallUnitOfWork.cs" />
71+
<Compile Include="02-Result\Datas\Mappings\Systems\SqlServer\ApplicationMap.cs" />
72+
<Compile Include="02-Result\Datas\Mappings\Systems\SqlServer\PermissionMap.cs" />
73+
<Compile Include="02-Result\Datas\Mappings\Systems\SqlServer\ResourceMap.cs" />
74+
<Compile Include="02-Result\Datas\Mappings\Systems\SqlServer\RoleMap.cs" />
75+
<Compile Include="02-Result\Datas\Mappings\Systems\SqlServer\UserMap.cs" />
76+
<Compile Include="02-Result\Datas\Repositories\Systems\ApplicationRepository.cs" />
77+
<Compile Include="02-Result\Datas\Repositories\Systems\PermissionRepository.cs" />
78+
<Compile Include="02-Result\Datas\Repositories\Systems\ResourceRepository.cs" />
79+
<Compile Include="02-Result\Datas\Repositories\Systems\RoleRepository.cs" />
80+
<Compile Include="02-Result\Datas\Repositories\Systems\UserRepository.cs" />
81+
<Compile Include="02-Result\Datas\UnitOfWorks\SqlServer\GreatWallUnitOfWork.cs" />
82+
<Compile Include="02-Result\Domains\Systems\Factories\ApplicationFactory.cs" />
83+
<Compile Include="02-Result\Domains\Systems\Factories\PermissionFactory.cs" />
84+
<Compile Include="02-Result\Domains\Systems\Factories\ResourceFactory.cs" />
85+
<Compile Include="02-Result\Domains\Systems\Factories\RoleFactory.cs" />
86+
<Compile Include="02-Result\Domains\Systems\Factories\UserFactory.cs" />
87+
<Compile Include="02-Result\Domains\Systems\Models\Application.Base.cs">
88+
<DependentUpon>Application.cs</DependentUpon>
89+
</Compile>
90+
<Compile Include="02-Result\Domains\Systems\Models\Application.cs" />
91+
<Compile Include="02-Result\Domains\Systems\Models\Permission.Base.cs">
92+
<DependentUpon>Permission.cs</DependentUpon>
93+
</Compile>
94+
<Compile Include="02-Result\Domains\Systems\Models\Permission.cs" />
95+
<Compile Include="02-Result\Domains\Systems\Models\Resource.Base.cs">
96+
<DependentUpon>Resource.cs</DependentUpon>
97+
</Compile>
98+
<Compile Include="02-Result\Domains\Systems\Models\Resource.cs" />
99+
<Compile Include="02-Result\Domains\Systems\Models\Role.Base.cs">
100+
<DependentUpon>Role.cs</DependentUpon>
101+
</Compile>
102+
<Compile Include="02-Result\Domains\Systems\Models\Role.cs" />
103+
<Compile Include="02-Result\Domains\Systems\Models\User.Base.cs">
104+
<DependentUpon>User.cs</DependentUpon>
105+
</Compile>
106+
<Compile Include="02-Result\Domains\Systems\Models\User.cs" />
107+
<Compile Include="02-Result\Domains\Systems\Repositories\IApplicationRepository.cs" />
108+
<Compile Include="02-Result\Domains\Systems\Repositories\IPermissionRepository.cs" />
109+
<Compile Include="02-Result\Domains\Systems\Repositories\IResourceRepository.cs" />
110+
<Compile Include="02-Result\Domains\Systems\Repositories\IRoleRepository.cs" />
111+
<Compile Include="02-Result\Domains\Systems\Repositories\IUserRepository.cs" />
112+
<Compile Include="02-Result\Persists\Datas\Mappings\Systems\SqlServer\ApplicationPoMap.cs" />
113+
<Compile Include="02-Result\Persists\Datas\Mappings\Systems\SqlServer\PermissionPoMap.cs" />
114+
<Compile Include="02-Result\Persists\Datas\Mappings\Systems\SqlServer\ResourcePoMap.cs" />
115+
<Compile Include="02-Result\Persists\Datas\Mappings\Systems\SqlServer\RolePoMap.cs" />
116+
<Compile Include="02-Result\Persists\Datas\Mappings\Systems\SqlServer\UserPoMap.cs" />
117+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\ApplicationPo.cs" />
118+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\Extensions\Extension.ApplicationPo.cs" />
119+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\Extensions\Extension.PermissionPo.cs" />
120+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\Extensions\Extension.ResourcePo.cs" />
121+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\Extensions\Extension.RolePo.cs" />
122+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\Extensions\Extension.UserPo.cs" />
123+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\PermissionPo.cs" />
124+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\ResourcePo.cs" />
125+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\RolePo.cs" />
126+
<Compile Include="02-Result\Persists\Datas\Pos\Systems\UserPo.cs" />
127+
<Compile Include="02-Result\Persists\Datas\Repositories\Systems\ApplicationRepository.cs" />
128+
<Compile Include="02-Result\Persists\Datas\Repositories\Systems\PermissionRepository.cs" />
129+
<Compile Include="02-Result\Persists\Datas\Repositories\Systems\ResourceRepository.cs" />
130+
<Compile Include="02-Result\Persists\Datas\Repositories\Systems\RoleRepository.cs" />
131+
<Compile Include="02-Result\Persists\Datas\Repositories\Systems\UserRepository.cs" />
132+
<Compile Include="02-Result\Persists\Datas\Stores\Abstractions\Systems\IApplicationPoStore.cs" />
133+
<Compile Include="02-Result\Persists\Datas\Stores\Abstractions\Systems\IPermissionPoStore.cs" />
134+
<Compile Include="02-Result\Persists\Datas\Stores\Abstractions\Systems\IResourcePoStore.cs" />
135+
<Compile Include="02-Result\Persists\Datas\Stores\Abstractions\Systems\IRolePoStore.cs" />
136+
<Compile Include="02-Result\Persists\Datas\Stores\Abstractions\Systems\IUserPoStore.cs" />
137+
<Compile Include="02-Result\Persists\Datas\Stores\Implements\Systems\ApplicationPoStore.cs" />
138+
<Compile Include="02-Result\Persists\Datas\Stores\Implements\Systems\PermissionPoStore.cs" />
139+
<Compile Include="02-Result\Persists\Datas\Stores\Implements\Systems\ResourcePoStore.cs" />
140+
<Compile Include="02-Result\Persists\Datas\Stores\Implements\Systems\RolePoStore.cs" />
141+
<Compile Include="02-Result\Persists\Datas\Stores\Implements\Systems\UserPoStore.cs" />
142+
<Compile Include="02-Result\Persists\Domains\Systems\Repositories\IApplicationRepository.cs" />
143+
<Compile Include="02-Result\Persists\Domains\Systems\Repositories\IPermissionRepository.cs" />
144+
<Compile Include="02-Result\Persists\Domains\Systems\Repositories\IResourceRepository.cs" />
145+
<Compile Include="02-Result\Persists\Domains\Systems\Repositories\IRoleRepository.cs" />
146+
<Compile Include="02-Result\Persists\Domains\Systems\Repositories\IUserRepository.cs" />
147+
<Compile Include="02-Result\Persists\Services\Systems\ApplicationService.cs" />
148+
<Compile Include="02-Result\Persists\Services\Systems\PermissionService.cs" />
149+
<Compile Include="02-Result\Persists\Services\Systems\ResourceService.cs" />
150+
<Compile Include="02-Result\Persists\Services\Systems\RoleService.cs" />
151+
<Compile Include="02-Result\Persists\Services\Systems\UserService.cs" />
152+
<Compile Include="02-Result\Presentation\Apis\Systems\ApplicationController.cs" />
153+
<Compile Include="02-Result\Presentation\Apis\Systems\PermissionController.cs" />
154+
<Compile Include="02-Result\Presentation\Apis\Systems\ResourceController.cs" />
155+
<Compile Include="02-Result\Presentation\Apis\Systems\RoleController.cs" />
156+
<Compile Include="02-Result\Presentation\Apis\Systems\UserController.cs" />
157+
<Compile Include="02-Result\Presentation\Areas\Systems\Controllers\ApplicationController.cs" />
158+
<Compile Include="02-Result\Presentation\Areas\Systems\Controllers\PermissionController.cs" />
159+
<Compile Include="02-Result\Presentation\Areas\Systems\Controllers\ResourceController.cs" />
160+
<Compile Include="02-Result\Presentation\Areas\Systems\Controllers\RoleController.cs" />
161+
<Compile Include="02-Result\Presentation\Areas\Systems\Controllers\UserController.cs" />
162+
<Compile Include="02-Result\Services\Abstractions\Systems\IApplicationService.cs" />
163+
<Compile Include="02-Result\Services\Abstractions\Systems\IPermissionService.cs" />
164+
<Compile Include="02-Result\Services\Abstractions\Systems\IResourceService.cs" />
165+
<Compile Include="02-Result\Services\Abstractions\Systems\IRoleService.cs" />
166+
<Compile Include="02-Result\Services\Abstractions\Systems\IUserService.cs" />
167+
<Compile Include="02-Result\Services\Configs\IocConfig.cs" />
168+
<Compile Include="02-Result\Services\Dtos\Systems\ApplicationDto.cs" />
169+
<Compile Include="02-Result\Services\Dtos\Systems\Extensions\Extensions.ApplicationDto.cs" />
170+
<Compile Include="02-Result\Services\Dtos\Systems\Extensions\Extensions.PermissionDto.cs" />
171+
<Compile Include="02-Result\Services\Dtos\Systems\Extensions\Extensions.ResourceDto.cs" />
172+
<Compile Include="02-Result\Services\Dtos\Systems\Extensions\Extensions.RoleDto.cs" />
173+
<Compile Include="02-Result\Services\Dtos\Systems\Extensions\Extensions.UserDto.cs" />
174+
<Compile Include="02-Result\Services\Dtos\Systems\PermissionDto.cs" />
175+
<Compile Include="02-Result\Services\Dtos\Systems\ResourceDto.cs" />
176+
<Compile Include="02-Result\Services\Dtos\Systems\RoleDto.cs" />
177+
<Compile Include="02-Result\Services\Dtos\Systems\UserDto.cs" />
178+
<Compile Include="02-Result\Services\Implements\Systems\ApplicationService.cs" />
179+
<Compile Include="02-Result\Services\Implements\Systems\PermissionService.cs" />
180+
<Compile Include="02-Result\Services\Implements\Systems\ResourceService.cs" />
181+
<Compile Include="02-Result\Services\Implements\Systems\RoleService.cs" />
182+
<Compile Include="02-Result\Services\Implements\Systems\UserService.cs" />
183+
<Compile Include="02-Result\Services\Queries\Systems\ApplicationQuery.cs" />
184+
<Compile Include="02-Result\Services\Queries\Systems\PermissionQuery.cs" />
185+
<Compile Include="02-Result\Services\Queries\Systems\ResourceQuery.cs" />
186+
<Compile Include="02-Result\Services\Queries\Systems\RoleQuery.cs" />
187+
<Compile Include="02-Result\Services\Queries\Systems\UserQuery.cs" />
188+
<Compile Include="02-Result\Tests\IntegrationTests\Dtos\Systems\ApplicationDtoTest.cs" />
189+
<Compile Include="02-Result\Tests\IntegrationTests\Dtos\Systems\PermissionDtoTest.cs" />
190+
<Compile Include="02-Result\Tests\IntegrationTests\Dtos\Systems\ResourceDtoTest.cs" />
191+
<Compile Include="02-Result\Tests\IntegrationTests\Dtos\Systems\RoleDtoTest.cs" />
192+
<Compile Include="02-Result\Tests\IntegrationTests\Dtos\Systems\UserDtoTest.cs" />
193+
<Compile Include="02-Result\Tests\IntegrationTests\Services\Systems\ApplicationServiceTest.cs" />
194+
<Compile Include="02-Result\Tests\IntegrationTests\Services\Systems\PermissionServiceTest.cs" />
195+
<Compile Include="02-Result\Tests\IntegrationTests\Services\Systems\ResourceServiceTest.cs" />
196+
<Compile Include="02-Result\Tests\IntegrationTests\Services\Systems\RoleServiceTest.cs" />
197+
<Compile Include="02-Result\Tests\IntegrationTests\Services\Systems\UserServiceTest.cs" />
198+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\ApplicationTest.cs" />
199+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\ApplicationTest.Data.cs" />
200+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\PermissionTest.cs" />
201+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\PermissionTest.Data.cs" />
202+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\ResourceTest.cs" />
203+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\ResourceTest.Data.cs" />
204+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\RoleTest.cs" />
205+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\RoleTest.Data.cs" />
206+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\UserTest.cs" />
207+
<Compile Include="02-Result\Tests\UnitTests\Models\Systems\UserTest.Data.cs" />
70208
<Compile Include="Properties\AssemblyInfo.cs" />
71209
<Compile Include="01-Templates\Common\Extensions.cs" />
72210
<Compile Include="01-Templates\Common\Generator.cs" />
@@ -125,9 +263,54 @@
125263
<None Include="01-Templates\Templates\Tests\EntityTest.cst" />
126264
<None Include="01-Templates\Templates\Tests\EntityTest.Data.cst" />
127265
<None Include="01-Templates\Templates\Tests\ServiceTest.cst" />
266+
<None Include="02-Result\Presentation\Areas\Systems\Views\Application\Detail.cshtml" />
267+
<None Include="02-Result\Presentation\Areas\Systems\Views\Application\Edit.cshtml" />
268+
<None Include="02-Result\Presentation\Areas\Systems\Views\Application\Index.cshtml" />
269+
<None Include="02-Result\Presentation\Areas\Systems\Views\Permission\Detail.cshtml" />
270+
<None Include="02-Result\Presentation\Areas\Systems\Views\Permission\Edit.cshtml" />
271+
<None Include="02-Result\Presentation\Areas\Systems\Views\Permission\Index.cshtml" />
272+
<None Include="02-Result\Presentation\Areas\Systems\Views\Resource\Detail.cshtml" />
273+
<None Include="02-Result\Presentation\Areas\Systems\Views\Resource\Edit.cshtml" />
274+
<None Include="02-Result\Presentation\Areas\Systems\Views\Resource\Index.cshtml" />
275+
<None Include="02-Result\Presentation\Areas\Systems\Views\Role\Detail.cshtml" />
276+
<None Include="02-Result\Presentation\Areas\Systems\Views\Role\Edit.cshtml" />
277+
<None Include="02-Result\Presentation\Areas\Systems\Views\Role\Index.cshtml" />
278+
<None Include="02-Result\Presentation\Areas\Systems\Views\User\Detail.cshtml" />
279+
<None Include="02-Result\Presentation\Areas\Systems\Views\User\Edit.cshtml" />
280+
<None Include="02-Result\Presentation\Areas\Systems\Views\User\Index.cshtml" />
128281
<None Include="Project.csp" />
129282
<None Include="01-Templates\Templates.cst" />
130283
</ItemGroup>
284+
<ItemGroup>
285+
<Content Include="02-Result\Domains\Systems\ItemGroup..txt" />
286+
<Content Include="02-Result\Presentation\Typings\app\systems\application\application-detail.component.ts" />
287+
<Content Include="02-Result\Presentation\Typings\app\systems\application\application-edit.component.ts" />
288+
<Content Include="02-Result\Presentation\Typings\app\systems\application\application-index.component.ts" />
289+
<Content Include="02-Result\Presentation\Typings\app\systems\application\model\application-query.ts" />
290+
<Content Include="02-Result\Presentation\Typings\app\systems\application\model\application-view-model.ts" />
291+
<Content Include="02-Result\Presentation\Typings\app\systems\permission\model\permission-query.ts" />
292+
<Content Include="02-Result\Presentation\Typings\app\systems\permission\model\permission-view-model.ts" />
293+
<Content Include="02-Result\Presentation\Typings\app\systems\permission\permission-detail.component.ts" />
294+
<Content Include="02-Result\Presentation\Typings\app\systems\permission\permission-edit.component.ts" />
295+
<Content Include="02-Result\Presentation\Typings\app\systems\permission\permission-index.component.ts" />
296+
<Content Include="02-Result\Presentation\Typings\app\systems\resource\model\resource-query.ts" />
297+
<Content Include="02-Result\Presentation\Typings\app\systems\resource\model\resource-view-model.ts" />
298+
<Content Include="02-Result\Presentation\Typings\app\systems\resource\resource-detail.component.ts" />
299+
<Content Include="02-Result\Presentation\Typings\app\systems\resource\resource-edit.component.ts" />
300+
<Content Include="02-Result\Presentation\Typings\app\systems\resource\resource-index.component.ts" />
301+
<Content Include="02-Result\Presentation\Typings\app\systems\role\model\role-query.ts" />
302+
<Content Include="02-Result\Presentation\Typings\app\systems\role\model\role-view-model.ts" />
303+
<Content Include="02-Result\Presentation\Typings\app\systems\role\role-detail.component.ts" />
304+
<Content Include="02-Result\Presentation\Typings\app\systems\role\role-edit.component.ts" />
305+
<Content Include="02-Result\Presentation\Typings\app\systems\role\role-index.component.ts" />
306+
<Content Include="02-Result\Presentation\Typings\app\systems\system.module.ts" />
307+
<Content Include="02-Result\Presentation\Typings\app\systems\system.routing.module.ts" />
308+
<Content Include="02-Result\Presentation\Typings\app\systems\user\model\user-query.ts" />
309+
<Content Include="02-Result\Presentation\Typings\app\systems\user\model\user-view-model.ts" />
310+
<Content Include="02-Result\Presentation\Typings\app\systems\user\user-detail.component.ts" />
311+
<Content Include="02-Result\Presentation\Typings\app\systems\user\user-edit.component.ts" />
312+
<Content Include="02-Result\Presentation\Typings\app\systems\user\user-index.component.ts" />
313+
</ItemGroup>
131314
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
132315
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
133316
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)