@voplus/morpho-workspace 6.0.145 → 6.0.146

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  import { ILoadable } from "@voplus/morpho-data";
2
+ import { INode } from "@voplus/morpho-document-core";
2
3
  export type WorkTypeStatus = "Active" | "Disabled";
3
4
  export interface ICheckListItem {
4
5
  key?: string;
@@ -23,7 +24,7 @@ export interface IAuditAuditorInfo {
23
24
  id: string;
24
25
  }[];
25
26
  }
26
- export interface IWorkType extends ILoadable {
27
+ export interface IWorkType extends ILoadable, INode {
27
28
  /** id of the workType */
28
29
  id: string;
29
30
  sequence?: ISequenceInfo;
@@ -34,11 +35,6 @@ export interface IWorkType extends ILoadable {
34
35
  defaultDue?: number;
35
36
  status?: string;
36
37
  autoAccept?: boolean;
37
- actions?: {
38
- canDelete: boolean;
39
- canEnable: boolean;
40
- canDisable: boolean;
41
- };
42
38
  defaultFolder?: {
43
39
  id: string;
44
40
  name: string;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { Access, Delete } from "@voplus/morpho-org/es/controls/NodeMenu/items";
3
3
  import { Button } from "antd";
4
+ import { useApplicationContext } from "@voplus/morpho-data";
4
5
  import { useWorkType, useWorkTypeStore } from "../../../../../data/worktype";
5
6
  import { faUserLock, faUserUnlock } from "@fortawesome/pro-light-svg-icons";
6
7
  import { observe } from "@voplus/morpho-ui";
@@ -10,26 +11,22 @@ import Select from "./item/Select";
10
11
  const WorkTypeMenu = (props) => {
11
12
  /** 加class name 为了方便做integration tests */
12
13
  const classId = "workType-menu";
13
- const worktype = useWorkType(props.id, {
14
- reload: (i) => !i.actions,
15
- includes: "actions",
16
- });
14
+ const { id } = props;
15
+ const { user } = useApplicationContext();
17
16
  const store = useWorkTypeStore();
18
- return observe(() => {
19
- var _a, _b, _c;
20
- return (React.createElement(NodeMenu, { id: props.id, icon: props.icon, store: store, menus: React.createElement(React.Fragment, null,
21
- React.createElement(Access, null),
22
- React.createElement(Select, { id: props.id, className: classId + "-move" }),
23
- ((_a = worktype.actions) === null || _a === void 0 ? void 0 : _a.canDelete) && React.createElement(Delete, { closeAside: props.closeAside }),
24
- ((_b = worktype.actions) === null || _b === void 0 ? void 0 : _b.canDisable) && (React.createElement(Button, { type: "link", onClick: () => onChangeStatus("Disabled"), className: classId + "-disabled" },
25
- React.createElement(FAIcon, { icon: faUserLock }),
26
- React.createElement("span", null, "Disabled"))),
27
- ((_c = worktype.actions) === null || _c === void 0 ? void 0 : _c.canEnable) && (React.createElement(Button, { type: "link", onClick: () => onChangeStatus("Enable"), className: classId + "-enable" },
28
- React.createElement(FAIcon, { icon: faUserUnlock }),
29
- React.createElement("span", null, "Enable")))) }));
30
- });
17
+ const worktype = useWorkType(id, { reload: (i) => !i.p, includes: "permissions" });
18
+ return observe(() => (React.createElement(NodeMenu, { id: id, icon: props.icon, store: store, menus: React.createElement(React.Fragment, null,
19
+ React.createElement(Access, null),
20
+ React.createElement(Select, { id: id, className: classId + "-move" }),
21
+ user.can("delete", worktype.p) && React.createElement(Delete, { closeAside: props.closeAside }),
22
+ user.can("disable", worktype.p) && (React.createElement(Button, { type: "link", onClick: () => onChangeStatus("Disabled"), className: classId + "-disabled" },
23
+ React.createElement(FAIcon, { icon: faUserLock }),
24
+ React.createElement("span", null, "Disabled"))),
25
+ user.can("enable", worktype.p) && (React.createElement(Button, { type: "link", onClick: () => onChangeStatus("Enable"), className: classId + "-enable" },
26
+ React.createElement(FAIcon, { icon: faUserUnlock }),
27
+ React.createElement("span", null, "Enable")))) })));
31
28
  function onChangeStatus(status) {
32
- store.edit(props.id, { data: { Status: status }, error: "message" });
29
+ store.edit(id, { data: { Status: status }, error: "message" });
33
30
  }
34
31
  };
35
32
  export default WorkTypeMenu;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/work/work-type/controls/WorkTypeMenu/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EA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T;YACA,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAClC,oBAAC,MAAM,IACN,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EACvC,SAAS,EAAE,OAAO,GAAG,SAAS;gBAE9B,oBAAC,MAAM,IAAC,IAAI,EAAE,YAAY,GAAI;gBAC9B,2CAAmB,CACX,CACT,CACC,GAEH,CACF,CAAC,CAAC;IAEH,SAAS,cAAc,CAAC,MAAe;QACtC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAChE,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voplus/morpho-workspace",
3
- "version": "6.0.145",
3
+ "version": "6.0.146",
4
4
  "description": "morpho workspace module",
5
5
  "repository": {
6
6
  "type": "git",