@unicom-cloud/ui 0.8.110 → 0.8.111
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.
- package/RichText.js +12 -69
- package/chunk/BlflTd2i.js +2160 -0
- package/hooks/index.js +106 -107
- package/index.js +702 -703
- package/package.json +1 -1
- package/rich-text/index.js +65 -128
- package/version/index.js +1 -1
- package/chunk/COc48wzV.js +0 -64
- package/chunk/zFFM4RBT.js +0 -2100
- package/rich-text/eventemitter/index.d.ts +0 -135
- package/types/pc/rich-text/eventemitter/index.d.ts +0 -101
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui","version":"0.8.
|
|
1
|
+
{"name":"@unicom-cloud/ui","version":"0.8.111","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"react":"^19.1.1","react-dom":"^19.1.1","dayjs":"^1.11.10","lodash":"^4.17.21","uuid":"^11.1.0","qrcode.react":"^4.2.0"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|
package/rich-text/index.js
CHANGED
|
@@ -1,105 +1,36 @@
|
|
|
1
1
|
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as w, useContext as D, useRef as E, useEffect as
|
|
3
|
-
import { a as
|
|
4
|
-
import "../chunk/DsaQZE4X.js";
|
|
5
|
-
import "../chunk/CdXR6dj7.js";
|
|
6
|
-
import "@unicom-cloud/utils/js-cookie";
|
|
7
|
-
import "dayjs";
|
|
8
|
-
import "lodash/debounce";
|
|
9
|
-
import { u as x } from "../chunk/COc48wzV.js";
|
|
10
|
-
import "@unicom-cloud/utils/screenfull";
|
|
11
|
-
import "../chunk/BDgzrqDN.js";
|
|
12
|
-
import "lodash/throttle";
|
|
13
|
-
import "@unicom-cloud/utils/constant/platform";
|
|
14
|
-
import "lodash/isPlainObject";
|
|
15
|
-
import "@unicom-cloud/utils/query-string";
|
|
16
|
-
import "react-router";
|
|
17
|
-
import "lodash/isEqualWith";
|
|
18
|
-
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
19
|
-
import "lodash/isNumber";
|
|
20
|
-
import "lodash/merge";
|
|
21
|
-
import "../chunk/d1c9z8T1.js";
|
|
22
|
-
import "@unicom-cloud/utils/date";
|
|
23
|
-
import "@unicom-cloud/utils/case-name";
|
|
24
|
-
import G from "@unicom-cloud/utils/class-name";
|
|
25
|
-
import "@unicom-cloud/utils/constant/ui";
|
|
26
|
-
import "@unicom-cloud/utils/clipboard-copy";
|
|
27
|
-
import "../chunk/DS_deHpN.js";
|
|
28
|
-
import "@unicom-cloud/utils/file/fileToURL";
|
|
29
|
-
import "lodash/escapeRegExp";
|
|
30
|
-
import "lodash/isArray";
|
|
31
|
-
import "lodash/isString";
|
|
32
|
-
import "lodash/isFunction";
|
|
33
|
-
import "lodash/camelCase";
|
|
34
|
-
import "lodash/capitalize";
|
|
35
|
-
import "lodash/cloneDeep";
|
|
36
|
-
import "lodash/get";
|
|
37
|
-
import "lodash/has";
|
|
38
|
-
import "lodash/kebabCase";
|
|
39
|
-
import "lodash/mergeWith";
|
|
40
|
-
import "lodash/set";
|
|
41
|
-
import "lodash/setWith";
|
|
42
|
-
import "lodash/snakeCase";
|
|
43
|
-
import "lodash/startCase";
|
|
44
|
-
import "lodash/uniq";
|
|
45
|
-
import "lodash/upperFirst";
|
|
46
|
-
import "@unicom-cloud/utils/math";
|
|
47
|
-
import "@unicom-cloud/utils/mitt";
|
|
48
|
-
import "@unicom-cloud/utils/pinyin";
|
|
49
|
-
import "../chunk/BJ9_azwQ.js";
|
|
50
|
-
import "../chunk/CXrVhA6-.js";
|
|
51
|
-
import "@unicom-cloud/utils/file/saveAs";
|
|
52
|
-
import "@unicom-cloud/utils/constant/ui.js";
|
|
53
|
-
import "@unicom-cloud/utils/tinycolor";
|
|
54
|
-
import "@unicom-cloud/utils/ui-color";
|
|
55
|
-
import "react-is";
|
|
56
|
-
import "@unicom-cloud/utils/tree";
|
|
57
|
-
import "@unicom-cloud/utils/is";
|
|
58
|
-
import "uuid";
|
|
59
|
-
import "../chunk/hc_ufgVf.js";
|
|
60
|
-
import "../chunk/RjJoagzL.js";
|
|
2
|
+
import { forwardRef as w, useContext as D, useRef as E, useEffect as a, useImperativeHandle as P } from "react";
|
|
3
|
+
import { a as G } from "../chunk/BcEZk8pT.js";
|
|
61
4
|
import { u as _ } from "../chunk/FgWHhRFz.js";
|
|
62
|
-
import "@unicom-cloud/utils/
|
|
5
|
+
import M from "@unicom-cloud/utils/class-name";
|
|
63
6
|
import "./rich.js";
|
|
64
|
-
import { R as
|
|
65
|
-
import { A as
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
function S(
|
|
69
|
-
const { getPrefixCls: T, renderEmpty: L, componentConfig:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
7
|
+
import { R as t } from "../chunk/BDMqvmVH.js";
|
|
8
|
+
import { A as U, D as W, M as Y, O as Z, I as ee, P as te, a as ne } from "../chunk/BDMqvmVH.js";
|
|
9
|
+
t.import("delta");
|
|
10
|
+
const k = {};
|
|
11
|
+
function S(s, v) {
|
|
12
|
+
const { getPrefixCls: T, renderEmpty: L, componentConfig: x, rtl: V } = D(G), n = _(
|
|
13
|
+
s,
|
|
14
|
+
k,
|
|
15
|
+
x?.RichText
|
|
73
16
|
), N = T?.("rich-text"), {
|
|
74
|
-
style:
|
|
75
|
-
className:
|
|
76
|
-
defaultValue:
|
|
77
|
-
value:
|
|
78
|
-
readOnly:
|
|
79
|
-
...
|
|
80
|
-
} =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
async: !0
|
|
84
|
-
}
|
|
85
|
-
}), x(
|
|
86
|
-
"https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",
|
|
87
|
-
{
|
|
88
|
-
css: {
|
|
89
|
-
async: !0
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
function u() {
|
|
94
|
-
return t.current.getContents();
|
|
17
|
+
style: y,
|
|
18
|
+
className: b,
|
|
19
|
+
defaultValue: O,
|
|
20
|
+
value: c,
|
|
21
|
+
readOnly: i,
|
|
22
|
+
...j
|
|
23
|
+
} = n, A = "defaultValue" in n, l = "value" in n, u = "readOnly" in n, f = E(void 0), e = E(void 0);
|
|
24
|
+
function d() {
|
|
25
|
+
return e.current.getContents();
|
|
95
26
|
}
|
|
96
|
-
return
|
|
97
|
-
const
|
|
98
|
-
|
|
27
|
+
return a(() => {
|
|
28
|
+
const o = f.current, H = o.appendChild(
|
|
29
|
+
o.ownerDocument.createElement("div")
|
|
99
30
|
);
|
|
100
|
-
|
|
31
|
+
e.current = new t(H, {
|
|
101
32
|
theme: "snow",
|
|
102
|
-
readOnly:
|
|
33
|
+
readOnly: i,
|
|
103
34
|
modules: {
|
|
104
35
|
// syntax: true,
|
|
105
36
|
// toolbar: refRichTextToolbarDom.current,
|
|
@@ -124,7 +55,13 @@ function S(i, R) {
|
|
|
124
55
|
[{ list: "ordered" }, { list: "bullet" }],
|
|
125
56
|
[{ indent: "-1" }, { indent: "+1" }],
|
|
126
57
|
[{ direction: "rtl" }],
|
|
127
|
-
[
|
|
58
|
+
[
|
|
59
|
+
"link",
|
|
60
|
+
"image",
|
|
61
|
+
"video",
|
|
62
|
+
!1,
|
|
63
|
+
!1
|
|
64
|
+
].filter(Boolean),
|
|
128
65
|
["undo", "redo"],
|
|
129
66
|
["clean"]
|
|
130
67
|
],
|
|
@@ -136,47 +73,47 @@ function S(i, R) {
|
|
|
136
73
|
table: !0
|
|
137
74
|
},
|
|
138
75
|
placeholder: "请输入富文本内容"
|
|
139
|
-
}), console.log("new Rich",
|
|
140
|
-
function
|
|
141
|
-
|
|
76
|
+
}), console.log("new Rich", e.current);
|
|
77
|
+
function m(r, C, g) {
|
|
78
|
+
n.onTextChange?.(r, C, g), n.onChange?.(d(), r, C, g);
|
|
142
79
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
80
|
+
function p(...r) {
|
|
81
|
+
n.onSelectionChange?.(...r);
|
|
145
82
|
}
|
|
146
|
-
function h(...
|
|
147
|
-
|
|
83
|
+
function h(...r) {
|
|
84
|
+
n.onEditorChange?.(...r);
|
|
148
85
|
}
|
|
149
|
-
return
|
|
150
|
-
|
|
86
|
+
return e.current.on(t.events.TEXT_CHANGE, m), e.current.on(t.events.SELECTION_CHANGE, p), e.current.on(t.events.EDITOR_CHANGE, h), () => {
|
|
87
|
+
e.current.off(t.events.TEXT_CHANGE, m), e.current.off(t.events.SELECTION_CHANGE, p), e.current.off(t.events.EDITOR_CHANGE, h), e.current = null, o.innerHTML = "";
|
|
151
88
|
};
|
|
152
|
-
}, []),
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
|
|
156
|
-
}, [
|
|
157
|
-
}), []), P(
|
|
158
|
-
const
|
|
89
|
+
}, []), a(() => {
|
|
90
|
+
l && e.current.setContents(c);
|
|
91
|
+
}, [l, c]), a(() => {
|
|
92
|
+
u && e.current.enable(!i);
|
|
93
|
+
}, [u, i]), a(() => (A && e.current.setContents(O), () => {
|
|
94
|
+
}), []), P(v, () => {
|
|
95
|
+
const o = e.current;
|
|
159
96
|
return {
|
|
160
97
|
getInstance() {
|
|
161
|
-
return
|
|
98
|
+
return o;
|
|
162
99
|
},
|
|
163
|
-
getContents:
|
|
100
|
+
getContents: d
|
|
164
101
|
};
|
|
165
|
-
}), /* @__PURE__ */ I("div", { ref:
|
|
102
|
+
}), /* @__PURE__ */ I("div", { ref: f, style: y, className: M(N, b) });
|
|
166
103
|
}
|
|
167
|
-
const
|
|
168
|
-
Reflect.ownKeys(
|
|
169
|
-
|
|
104
|
+
const R = w(S);
|
|
105
|
+
Reflect.ownKeys(t).forEach((s) => {
|
|
106
|
+
R[s] = t[s];
|
|
170
107
|
});
|
|
171
|
-
|
|
108
|
+
R.displayName = "RichText";
|
|
172
109
|
export {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
110
|
+
U as AttributeMap,
|
|
111
|
+
W as Delta,
|
|
112
|
+
Y as Module,
|
|
113
|
+
Z as Op,
|
|
114
|
+
ee as OpIterator,
|
|
115
|
+
te as Parchment,
|
|
116
|
+
ne as Range,
|
|
117
|
+
t as Rich,
|
|
118
|
+
R as default
|
|
182
119
|
};
|
package/version/index.js
CHANGED
package/chunk/COc48wzV.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useState as i, useRef as l, useEffect as f } from "react";
|
|
2
|
-
const a = {}, y = (t, s = {}) => {
|
|
3
|
-
const n = document.querySelector(`script[src="${t}"]`);
|
|
4
|
-
if (!n) {
|
|
5
|
-
const e = document.createElement("script");
|
|
6
|
-
return e.src = t, Object.keys(s).forEach((r) => {
|
|
7
|
-
e[r] = s[r];
|
|
8
|
-
}), e.setAttribute("data-status", "loading"), document.body.appendChild(e), {
|
|
9
|
-
ref: e,
|
|
10
|
-
status: "loading"
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
ref: n,
|
|
15
|
-
status: n.getAttribute("data-status") || "ready"
|
|
16
|
-
};
|
|
17
|
-
}, E = (t, s = {}) => {
|
|
18
|
-
const n = document.querySelector(`link[href="${t}"]`);
|
|
19
|
-
if (!n) {
|
|
20
|
-
const e = document.createElement("link");
|
|
21
|
-
return e.rel = "stylesheet", e.href = t, Object.keys(s).forEach((u) => {
|
|
22
|
-
e[u] = s[u];
|
|
23
|
-
}), "hideFocus" in e && e.relList && (e.rel = "preload", e.as = "style"), e.setAttribute("data-status", "loading"), document.head.appendChild(e), {
|
|
24
|
-
ref: e,
|
|
25
|
-
status: "loading"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
ref: n,
|
|
30
|
-
status: n.getAttribute("data-status") || "ready"
|
|
31
|
-
};
|
|
32
|
-
}, v = (t, s) => {
|
|
33
|
-
const [n, e] = i(t ? "loading" : "unset"), r = l(void 0);
|
|
34
|
-
return f(() => {
|
|
35
|
-
if (!t) {
|
|
36
|
-
e("unset");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const u = t.replace(/[|#].*$/, "");
|
|
40
|
-
if (s?.type === "css" || !s?.type && /(^css!|\.css$)/.test(u)) {
|
|
41
|
-
const c = E(t, s?.css);
|
|
42
|
-
r.current = c.ref, e(c.status);
|
|
43
|
-
} else if (s?.type === "js" || !s?.type && /(^js!|\.js$)/.test(u)) {
|
|
44
|
-
const c = y(t, s?.js);
|
|
45
|
-
r.current = c.ref, e(c.status);
|
|
46
|
-
} else
|
|
47
|
-
console.error(
|
|
48
|
-
"Cannot infer the type of external resource, and please provide a type ('js' | 'css'). "
|
|
49
|
-
);
|
|
50
|
-
if (!r.current)
|
|
51
|
-
return;
|
|
52
|
-
a[t] === void 0 ? a[t] = 1 : a[t] += 1;
|
|
53
|
-
const o = (c) => {
|
|
54
|
-
const d = c.type === "load" ? "ready" : "error";
|
|
55
|
-
r.current?.setAttribute("data-status", d), e(d);
|
|
56
|
-
};
|
|
57
|
-
return r.current.addEventListener("load", o), r.current.addEventListener("error", o), () => {
|
|
58
|
-
r.current?.removeEventListener("load", o), r.current?.removeEventListener("error", o), a[t] -= 1, a[t] === 0 && !s?.keepWhenUnused && r.current?.remove(), r.current = void 0;
|
|
59
|
-
};
|
|
60
|
-
}, [t]), n;
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
v as u
|
|
64
|
-
};
|