Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { DataHierarchy, DataHierarchyProvider } from '../../../libappsop/datahierarchy';
import { ListSOP } from '../../../libappsop/listsop';
import { PanelSOP } from '../../../libappsop/panelsop';
import { DialogDummy } from '../dialog.dummy';
 
export class PanelManageContents extends PanelSOP {
  public static readonly title = 'Manage Contents';
 
  public listManageContents = new ListManageContents();
  public listManageContentsProduct = new ListManageContentsProduct();
 
  public constructor() {
    super('pnlManageContents');
  }
}
 
export interface ListManageContentsColumn {
  Name?: string;
}
 
export class ListManageContents extends ListSOP<DialogDummy, ListManageContentsColumn> {
  public static readonly title = 'Manage Contents';
 
  public constructor() {
    super('lstManageContents', new DialogDummy());
 
    // Set primary key column name(s), to display in error message when assert fails
    this.rowPrimaryColumnNames = { Name: '' };
  }
}
 
export interface ListManageContentsProductColumn {
  Name?: string;
}
 
export class ListManageContentsProduct extends ListSOP<DialogDummy, ListManageContentsProductColumn> {
  public static readonly title = 'Manage contents overview';
 
  public constructor() {
    super('lstListProducts', new DialogDummy());
 
    // Set primary key column name(s), to display in error message when assert fails
    this.rowPrimaryColumnNames = { Name: '' };
  }
 
  // Overrides ListSOP
  public getHierarchy(hierarchyProvider: DataHierarchyProvider, name: DataHierarchy): [ListManageContentsProductColumn, ListManageContentsProductColumn[] | undefined] {
    const [targetRowName, parentRowNames] = hierarchyProvider.getHierarchy(name);
 
    const thisProduct: ListManageContentsProductColumn = { Name: targetRowName.Name };
    const parents: ListManageContentsProductColumn[] = [];
    for (const p of parentRowNames) {
      parents.push({ Name: p.Name });
    }
 
    return [thisProduct, parents.length > 0 ? parents : undefined];
  }
}
 
const listManageContentsProductContextMenuItems = {
  Exclude: { ContextMenu: 'cmListProducts', Name: 'MenuExcludeProducts', Label: 'Exclude' },
};
 
export { listManageContentsProductContextMenuItems as ListManageContentsProductContextMenuItems };