mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-04 10:14:13 +08:00
Implement types on the listview
This commit is contained in:
parent
e365daa410
commit
b52bbf6a6d
5 changed files with 22 additions and 2 deletions
|
@ -20,7 +20,10 @@
|
|||
*cdkHeaderCellDef>{{
|
||||
vm.language.appStrings[column.label] || column.label}}
|
||||
</th>
|
||||
<td cdk-cell *cdkCellDef="let record">{{record.attributes[column.fieldName]}}</td>
|
||||
<td cdk-cell *cdkCellDef="let record">
|
||||
<scrm-field [mode]="'list'" [type]="column.type"
|
||||
[field]="{type: column.type, value: record.attributes[column.fieldName]}"></scrm-field>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr cdk-header-row *cdkHeaderRowDef="vm.displayedColumns"></tr>
|
||||
|
|
|
@ -11,6 +11,7 @@ import {LanguageStore} from '@store/language/language.store';
|
|||
import {languageMockData} from '@store/language/language.store.spec.mock';
|
||||
import {of} from 'rxjs';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {FieldModule} from "@fields/field.module";
|
||||
|
||||
@Component({
|
||||
selector: 'table-body-ui-test-host-component',
|
||||
|
@ -29,6 +30,7 @@ describe('TablebodyUiComponent', () => {
|
|||
imports: [
|
||||
CdkTableModule,
|
||||
ApolloTestingModule,
|
||||
FieldModule
|
||||
],
|
||||
declarations: [TableBodyComponent, TableBodyUITestHostComponent],
|
||||
providers: [
|
||||
|
|
|
@ -5,6 +5,7 @@ import {AppManagerModule} from '@base/app-manager/app-manager.module';
|
|||
import {TableBodyComponent} from './table-body.component';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {CdkTableModule} from '@angular/cdk/table';
|
||||
import {FieldModule} from "@fields/field.module";
|
||||
|
||||
@NgModule({
|
||||
declarations: [TableBodyComponent],
|
||||
|
@ -14,6 +15,7 @@ import {CdkTableModule} from '@angular/cdk/table';
|
|||
AppManagerModule.forChild(TableBodyComponent),
|
||||
AngularSvgIconModule,
|
||||
CdkTableModule,
|
||||
FieldModule,
|
||||
]
|
||||
})
|
||||
export class TablebodyUiModule {
|
||||
|
|
|
@ -19,6 +19,7 @@ export interface Field {
|
|||
module: string;
|
||||
id: string;
|
||||
sortable: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface SearchMetaField {
|
||||
|
|
|
@ -110,7 +110,19 @@ class ViewDefinitionsHandler extends LegacyHandler implements ViewDefinitionsPro
|
|||
$viewDef->setId($moduleName);
|
||||
|
||||
if (in_array('listView', $views, true)) {
|
||||
$viewDef->setListView($this->fetchListViewDef($legacyModuleName));
|
||||
$listViewDef = $this->fetchListViewDef($legacyModuleName);
|
||||
|
||||
foreach ($listViewDef as $i => $def) {
|
||||
if (!isset($listViewDef[$i]['type'])) {
|
||||
$listViewDef[$i]['type'] = $fieldDefinition->vardef[$def['fieldName']]['type'];
|
||||
}
|
||||
|
||||
if (!isset($listViewDef[$i]['label'])) {
|
||||
$listViewDef[$i]['label'] = $fieldDefinition->vardef[$def['fieldName']]['label'];
|
||||
}
|
||||
}
|
||||
|
||||
$viewDef->setListView($listViewDef);
|
||||
}
|
||||
|
||||
if (in_array('search', $views, true)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue