@voplus/morpho-document 1.4.102 → 1.4.104

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.
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ declare const ReferenceList: {
3
+ (props: {
4
+ /** 已选文件信息documents: {id, name}[] */
5
+ document: {
6
+ id: string;
7
+ name: string;
8
+ }[];
9
+ /** placeholder */
10
+ placeholder?: string | undefined;
11
+ /** 多选, default true */
12
+ multiple?: boolean | undefined;
13
+ /**可以更改与否,default true */
14
+ canEdit?: boolean | undefined;
15
+ /** 变更事件 */
16
+ onChange?: ((list: {
17
+ id: string;
18
+ name: string;
19
+ }[]) => void) | undefined;
20
+ }): JSX.Element;
21
+ defaultProps: {
22
+ placeholder: string;
23
+ canEdit: boolean;
24
+ multiple: boolean;
25
+ };
26
+ };
27
+ export default ReferenceList;
@@ -0,0 +1,36 @@
1
+ import React, { useState } from "react";
2
+ import { observe } from "@voplus/morpho-ui";
3
+ import { faEdit } from "@fortawesome/pro-light-svg-icons";
4
+ import { faEdit as faEditSolid } from "@fortawesome/free-solid-svg-icons";
5
+ import DocumentQuickViewDialog from "../../components/DocumentQuickViewDialog";
6
+ import DocumentSelectDialog from "../../components/DocumentSelectDialog";
7
+ import Icon from "@voplus/morpho-ui/es/controls/HoverSwitchIcon";
8
+ import styles from "./index.less";
9
+ const ReferenceList = (props) => {
10
+ const [folder, setFolder] = useState(false);
11
+ const [ids, setIds] = useState("");
12
+ const [visible, setVisible] = useState(false);
13
+ return observe(() => (React.createElement(React.Fragment, null,
14
+ React.createElement("div", { className: "reference-list" },
15
+ React.createElement("div", null, props.document.length ? (props.multiple ? (props.document.map((item) => (React.createElement("span", { className: styles["prosemirror-mention-node"], key: item.id, onClick: () => {
16
+ setVisible(true);
17
+ setIds(item.id);
18
+ } }, `&${item.name}`)))) : (React.createElement("span", { className: styles["prosemirror-mention-node"], onClick: () => {
19
+ setVisible(true);
20
+ setIds(props.document[0].id);
21
+ } }, `&${props.document[0].name}`))) : (React.createElement("span", { style: { color: "#00000040" } }, props.placeholder))),
22
+ React.createElement("div", null, props.canEdit === true && (React.createElement(Icon, { className: "edit-icon", icon: faEdit, hover: faEditSolid, onClick: () => setFolder(true) })))),
23
+ folder && (React.createElement(DocumentSelectDialog, { multiSelect: props.multiple, defaultSelected: props.document, onCancel: () => setFolder(false), onSelect: (data) => {
24
+ var _a;
25
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, data);
26
+ setFolder(false);
27
+ } })),
28
+ React.createElement(DocumentQuickViewDialog, { id: ids, visible: visible, onCancel: () => setVisible(false) }))));
29
+ };
30
+ ReferenceList.defaultProps = {
31
+ placeholder: "Select documents",
32
+ canEdit: true,
33
+ multiple: true,
34
+ };
35
+ export default ReferenceList;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controls/ReferenceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,uBAAuB,MAAM,0CAA0C,CAAC;AAC/E,OAAO,oBAAoB,MAAM,uCAAuC,CAAC;AACzE,OAAO,IAAI,MAAM,+CAA+C,CAAC;AACjE,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,KAWtB,EAAE,EAAE;IACJ,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,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AAC,SAAS,CAAC,IAAI,CAAC,GAC7B,CACF,CACI,CACD;QACL,MAAM,IAAI,CACV,oBAAC,oBAAoB,IACpB,WAAW,EAAE,KAAK,CAAC,QAAQ,EAC3B,eAAe,EAAE,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,CAAC,IAAoC,EAAE,EAAE;;gBAClD,MAAA,KAAK,CAAC,QAAQ,+CAAd,KAAK,EAAY,IAAI,CAAC,CAAC;gBACvB,SAAS,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,GACA,CACF;QACD,oBAAC,uBAAuB,IAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,GAAI,CACzE,CACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,aAAa,CAAC,YAAY,GAAG;IAC5B,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;CACd,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,52 @@
1
+ @import "~@voplus/morpho-theme/styles/index.less";
2
+
3
+ :global {
4
+ .reference-list {
5
+ display: flex;
6
+ justify-content: space-between;
7
+ align-items: center;
8
+
9
+ > .buttons {
10
+ :hover {
11
+ color: @primary-color;
12
+ font-size: 1.05rem;
13
+
14
+ svg {
15
+ filter: drop-shadow(2px 2px 2px @primary-color);
16
+ }
17
+ }
18
+
19
+ cursor: pointer;
20
+ font-size: 1rem;
21
+
22
+ svg {
23
+ margin-left: 5px;
24
+ }
25
+ }
26
+
27
+ &:not(:hover) {
28
+ .edit-icon {
29
+ display: none;
30
+ }
31
+ }
32
+
33
+ .edit-icon {
34
+ cursor: pointer;
35
+ font-size: 1rem;
36
+ color: lightgray;
37
+ }
38
+ }
39
+ }
40
+
41
+ .prosemirror-mention-node {
42
+ display: inline-block;
43
+ color: @reference-color;
44
+ cursor: pointer;
45
+ line-height: unit((24/18), em);
46
+ word-break: break-word;
47
+ background: @reference-bg-color;
48
+ border-radius: @border-radius;
49
+ padding: unit((8/18), em);
50
+ margin-right: unit((8/18), em);
51
+ margin-bottom: unit((8/18), em);
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voplus/morpho-document",
3
- "version": "1.4.102",
3
+ "version": "1.4.104",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://voplus.visualstudio.com/morpho-document/_git/morpho-document"