scheduler-models 1.3.110 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,3 +2,4 @@ export * from './general';
2
2
  export * from './viewstate';
3
3
  export * from './logs';
4
4
  export * from './notices';
5
+ export * from './menu';
package/general/index.js CHANGED
@@ -18,4 +18,5 @@ __exportStar(require("./general"), exports);
18
18
  __exportStar(require("./viewstate"), exports);
19
19
  __exportStar(require("./logs"), exports);
20
20
  __exportStar(require("./notices"), exports);
21
+ __exportStar(require("./menu"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/general/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,yCAAuB;AACvB,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/general/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,yCAAuB;AACvB,4CAA0B;AAC1B,yCAAuB"}
@@ -0,0 +1,31 @@
1
+ import { IUser } from "../users";
2
+ export interface IMenuItem {
3
+ id: number;
4
+ name: string;
5
+ link: string;
6
+ application: string;
7
+ groups: string[];
8
+ }
9
+ export declare class MenuItem implements IMenuItem {
10
+ id: number;
11
+ name: string;
12
+ link: string;
13
+ application: string;
14
+ groups: string[];
15
+ constructor(item?: IMenuItem);
16
+ compareTo(other?: MenuItem): number;
17
+ use(iuser: IUser): boolean;
18
+ }
19
+ export interface IMenuGroup {
20
+ id: number;
21
+ name: string;
22
+ items?: IMenuItem[];
23
+ }
24
+ export declare class MenuGroup implements IMenuGroup {
25
+ id: number;
26
+ name: string;
27
+ items: MenuItem[];
28
+ constructor(group?: IMenuGroup);
29
+ compareTo(other?: MenuGroup): number;
30
+ useGroup(iuser: IUser): boolean;
31
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuGroup = exports.MenuItem = void 0;
4
+ const users_1 = require("../users");
5
+ class MenuItem {
6
+ id;
7
+ name;
8
+ link;
9
+ application;
10
+ groups;
11
+ constructor(item) {
12
+ this.id = (item) ? item.id : 0;
13
+ this.name = (item) ? item.name : '';
14
+ this.link = (item) ? item.link : '';
15
+ this.application = (item) ? item.application : 'scheduler';
16
+ this.groups = [];
17
+ if (item && item.groups && item.groups.length > 0) {
18
+ item.groups.forEach(gp => {
19
+ this.groups.push(gp);
20
+ });
21
+ }
22
+ }
23
+ compareTo(other) {
24
+ if (other) {
25
+ return (this.id < other.id) ? -1 : 1;
26
+ }
27
+ return -1;
28
+ }
29
+ use(iuser) {
30
+ const user = new users_1.User(iuser);
31
+ let answer = false;
32
+ this.groups.forEach(grp => {
33
+ if (user.hasPermission(this.application, grp)) {
34
+ answer = true;
35
+ }
36
+ });
37
+ return answer;
38
+ }
39
+ }
40
+ exports.MenuItem = MenuItem;
41
+ class MenuGroup {
42
+ id;
43
+ name;
44
+ items;
45
+ constructor(group) {
46
+ this.id = (group) ? group.id : 0;
47
+ this.name = (group) ? group.name : '';
48
+ this.items = [];
49
+ if (group && group.items && group.items.length > 0) {
50
+ group.items?.forEach(item => {
51
+ this.items.push(new MenuItem(item));
52
+ });
53
+ this.items.sort((a, b) => a.compareTo(b));
54
+ }
55
+ }
56
+ compareTo(other) {
57
+ if (other) {
58
+ return (this.id < other.id) ? -1 : 1;
59
+ }
60
+ return -1;
61
+ }
62
+ useGroup(iuser) {
63
+ let answer = false;
64
+ this.items.forEach(item => {
65
+ if (item.use(iuser)) {
66
+ answer = true;
67
+ }
68
+ });
69
+ return answer;
70
+ }
71
+ }
72
+ exports.MenuGroup = MenuGroup;
73
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/general/menu.ts"],"names":[],"mappings":";;;AAAA,oC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AAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,QAAQ,CAAC,KAAY;QACnB,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjCD,8BAiCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-models",
3
- "version": "1.3.110",
3
+ "version": "1.4.1",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -1,8 +1,10 @@
1
+ import { IMenuGroup } from "../../general";
1
2
  import { ISecurityQuestion } from "../../users";
2
3
  import { IEmployee } from "../employees";
3
4
  import { ISite } from "../sites";
4
5
  import { ITeam } from "../teams";
5
6
  export interface InitialResponse {
7
+ menu: IMenuGroup[];
6
8
  team?: ITeam;
7
9
  site?: ISite;
8
10
  employee?: IEmployee;