mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-03-17 11:13:33 +00:00
Compare commits
1679 Commits
v1.0.0-rc.
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18bfbefaf2 | ||
|
|
1b9492165c | ||
|
|
61f00a0fb7 | ||
|
|
6d91a7a844 | ||
|
|
3e4d49dd45 | ||
|
|
1b854d2347 | ||
|
|
814549e168 | ||
|
|
71d6dd9e38 | ||
|
|
0d698b20e7 | ||
|
|
67d93ec35f | ||
|
|
084ff6ff68 | ||
|
|
ecaa0f5f28 | ||
|
|
eee87c6d01 | ||
|
|
0b7b6884ae | ||
|
|
575993fe34 | ||
|
|
c23d02558e | ||
|
|
450af8021d | ||
|
|
0ec8af20e0 | ||
|
|
b4c2c65ccb | ||
|
|
06fd5392a9 | ||
|
|
89ac777a7f | ||
|
|
6cf2f38194 | ||
|
|
e6e68ae69a | ||
|
|
5110f0cbca | ||
|
|
da2e2c393b | ||
|
|
e6d1624a6c | ||
|
|
8956035e41 | ||
|
|
10c36c1980 | ||
|
|
5f57d620da | ||
|
|
cfaaaad66e | ||
|
|
df611571c7 | ||
|
|
5267381ebf | ||
|
|
3cfec95612 | ||
|
|
c1b12e6f40 | ||
|
|
c2d2eee749 | ||
|
|
03b6180a02 | ||
|
|
8150f042ff | ||
|
|
b71a5ef891 | ||
|
|
01158e01fc | ||
|
|
98c2e2ff1f | ||
|
|
9d4324dd6b | ||
|
|
2630f00f13 | ||
|
|
b0d8c5383b | ||
|
|
f0a39667e1 | ||
|
|
5fe91e89b7 | ||
|
|
f7811fdb24 | ||
|
|
7a0dae9f5a | ||
|
|
304aaac8dc | ||
|
|
0f596b5c42 | ||
|
|
e3db0c93e5 | ||
|
|
3250c53097 | ||
|
|
756612eda5 | ||
|
|
2a7ab4e916 | ||
|
|
d039cee913 | ||
|
|
83664cd440 | ||
|
|
b3ce1a3b93 | ||
|
|
738e8611a4 | ||
|
|
9815fb7c51 | ||
|
|
411a28946e | ||
|
|
70d730ca82 | ||
|
|
a2a9556ab8 | ||
|
|
7e71c070f1 | ||
|
|
8d55d0cd8d | ||
|
|
8d7c8fa725 | ||
|
|
ad746319e9 | ||
|
|
0dd7f54ebc | ||
|
|
69ac90fe22 | ||
|
|
2667981e4c | ||
|
|
b536eba81c | ||
|
|
054ed561b6 | ||
|
|
c1dc58c97c | ||
|
|
bb7ec0aa1b | ||
|
|
849b4dc319 | ||
|
|
8aef360ed7 | ||
|
|
8d65127cdd | ||
|
|
93640257e9 | ||
|
|
09dfaad2cc | ||
|
|
5dbe1fb655 | ||
|
|
82df2a8f5c | ||
|
|
4dc5f0a298 | ||
|
|
3b913c1af4 | ||
|
|
310054b7d6 | ||
|
|
fa0e10f687 | ||
|
|
bf6598c871 | ||
|
|
6a7f80c48d | ||
|
|
e2708b868b | ||
|
|
97affb2bff | ||
|
|
e418130a66 | ||
|
|
55a2869818 | ||
|
|
0ecc116652 | ||
|
|
310aa47c1d | ||
|
|
27555d6b2f | ||
|
|
da9884645f | ||
|
|
1a08b16a39 | ||
|
|
a96ca8092c | ||
|
|
489d321677 | ||
|
|
3d0081e48e | ||
|
|
acda22d5cb | ||
|
|
7b19a01849 | ||
|
|
d0179028fb | ||
|
|
564a7f4271 | ||
|
|
6f0498a9e7 | ||
|
|
4f52fcb122 | ||
|
|
1297939db2 | ||
|
|
b3cfc0b5d3 | ||
|
|
b96036b23c | ||
|
|
3c3ba6525b | ||
|
|
0f3dfcf511 | ||
|
|
12e6dd18b4 | ||
|
|
cbec52936d | ||
|
|
979b834fac | ||
|
|
dabeba85a0 | ||
|
|
954bd37d52 | ||
|
|
59aa9f14b3 | ||
|
|
38192a6d48 | ||
|
|
ec479b9296 | ||
|
|
7f0aef7bee | ||
|
|
36508aba88 | ||
|
|
f30a8ddc41 | ||
|
|
a28705e3df | ||
|
|
ca0f8fc988 | ||
|
|
68c69ac405 | ||
|
|
3a9c94a6a6 | ||
|
|
5fe57cd389 | ||
|
|
51e9732894 | ||
|
|
630301bce2 | ||
|
|
507e51a2dc | ||
|
|
11d25603a8 | ||
|
|
8f0d99a4a6 | ||
|
|
08b476e04f | ||
|
|
1cb2d57ade | ||
|
|
d59428d2d6 | ||
|
|
e36da82d29 | ||
|
|
8809351537 | ||
|
|
5387a18024 | ||
|
|
2b80ba3efd | ||
|
|
6c3916c580 | ||
|
|
4dfdc836f6 | ||
|
|
fef1e2c2b4 | ||
|
|
51f95aef6f | ||
|
|
81aa8f151d | ||
|
|
cae11dce12 | ||
|
|
83bf36d980 | ||
|
|
2888004c17 | ||
|
|
abab44ad24 | ||
|
|
849b561933 | ||
|
|
1031595a97 | ||
|
|
f5cb19dfa4 | ||
|
|
e400175ffe | ||
|
|
958c78d968 | ||
|
|
9f81597596 | ||
|
|
001f2b6c9e | ||
|
|
a56bb562d8 | ||
|
|
7695f005f6 | ||
|
|
a10f9d230d | ||
|
|
9f350541bf | ||
|
|
0643699fac | ||
|
|
9f63dff49b | ||
|
|
7d3a2df793 | ||
|
|
0967c3449e | ||
|
|
f267643c42 | ||
|
|
f3387ed5e9 | ||
|
|
71d1aab69e | ||
|
|
4c6118f50f | ||
|
|
77da3f9762 | ||
|
|
8b3cb63f77 | ||
|
|
fc1c9feafd | ||
|
|
371be8aa27 | ||
|
|
7bb14e6c25 | ||
|
|
cdb07dfaea | ||
|
|
c2830fca6b | ||
|
|
bba67b5533 | ||
|
|
eda9924327 | ||
|
|
07b8f5fe83 | ||
|
|
d31a544a23 | ||
|
|
01b7b58065 | ||
|
|
870dd99e2c | ||
|
|
01b88dba25 | ||
|
|
2605011df4 | ||
|
|
00cf312a91 | ||
|
|
e3ed80b121 | ||
|
|
0752abc312 | ||
|
|
ded24c8b4f | ||
|
|
7799a5da61 | ||
|
|
6cb08cf458 | ||
|
|
305ea4619f | ||
|
|
291de2005d | ||
|
|
34bc223f02 | ||
|
|
bf9fad18b6 | ||
|
|
cebf3506d4 | ||
|
|
a43825caa2 | ||
|
|
1736d495fd | ||
|
|
44b592f36a | ||
|
|
6a54720068 | ||
|
|
aaf8046c63 | ||
|
|
5242585500 | ||
|
|
4637c80125 | ||
|
|
5b7d2dd248 | ||
|
|
5ab7030c3a | ||
|
|
84bf9ba2f9 | ||
|
|
c87e539dd3 | ||
|
|
49f3f6853e | ||
|
|
222a96e465 | ||
|
|
2f4a7a33b8 | ||
|
|
c984c1a0cf | ||
|
|
727af1058d | ||
|
|
68abaae750 | ||
|
|
0e8043664e | ||
|
|
3f7d03959c | ||
|
|
ee06c26ca5 | ||
|
|
9e590c5cf7 | ||
|
|
8d6da3712e | ||
|
|
b78ef20602 | ||
|
|
18e8df4a55 | ||
|
|
b6a260471d | ||
|
|
32681964b3 | ||
|
|
95d6263f42 | ||
|
|
bbf93cb2b5 | ||
|
|
3b1e41b217 | ||
|
|
bdd59cff9b | ||
|
|
c3633b0481 | ||
|
|
652670fa4c | ||
|
|
1614b62d2a | ||
|
|
6152a78467 | ||
|
|
b1f020d532 | ||
|
|
6b4ca4b83a | ||
|
|
b72f4dae28 | ||
|
|
0bd8496fac | ||
|
|
b78b2011e5 | ||
|
|
3097e8eddb | ||
|
|
cd4656e54f | ||
|
|
5f246bbc98 | ||
|
|
e01ce2128e | ||
|
|
9ee748710b | ||
|
|
2565d67add | ||
|
|
92534fc915 | ||
|
|
0196eb343a | ||
|
|
8142a7ab6d | ||
|
|
c7b2734090 | ||
|
|
1cee0bf4aa | ||
|
|
4288ab9873 | ||
|
|
b78d2fda1f | ||
|
|
dc37d4e8bd | ||
|
|
a35789c0cf | ||
|
|
1e396d4a8d | ||
|
|
444858491d | ||
|
|
1f7ad2fbb8 | ||
|
|
d66ee4db48 | ||
|
|
abe27db47a | ||
|
|
d628ffad26 | ||
|
|
79f65fb516 | ||
|
|
fc886715c7 | ||
|
|
1444eb6ae7 | ||
|
|
5b8c2c2111 | ||
|
|
7dbf464e38 | ||
|
|
936eb08a94 | ||
|
|
d1e99a46a7 | ||
|
|
e0d5efb022 | ||
|
|
054d12601b | ||
|
|
6b481c4473 | ||
|
|
8195c105c0 | ||
|
|
06a3dc8436 | ||
|
|
b88ca14fde | ||
|
|
9289ffd187 | ||
|
|
179b797c5c | ||
|
|
9252822c58 | ||
|
|
50b74d10e6 | ||
|
|
85284e54f5 | ||
|
|
ed01cfca87 | ||
|
|
687bf33eb2 | ||
|
|
1852560b55 | ||
|
|
2dc0bbc679 | ||
|
|
e5bcd762b2 | ||
|
|
6dc007388b | ||
|
|
378c75658d | ||
|
|
7eded0e44a | ||
|
|
cdfb3adfa9 | ||
|
|
ba05ecbf60 | ||
|
|
9d8ee4b2d3 | ||
|
|
e774c9ff5f | ||
|
|
604ae1eb52 | ||
|
|
105de9d2c6 | ||
|
|
0987901a46 | ||
|
|
de52ff4fe1 | ||
|
|
0e911337b8 | ||
|
|
fd7e737e8c | ||
|
|
e7e9197ae3 | ||
|
|
5e0e776d40 | ||
|
|
31515c4046 | ||
|
|
42adb962fd | ||
|
|
0bcd7d0755 | ||
|
|
54e00f2852 | ||
|
|
f91eb415db | ||
|
|
18524d89fb | ||
|
|
840c2c3c7d | ||
|
|
9b546645f3 | ||
|
|
38ea57c6cb | ||
|
|
c8fc2f7bfb | ||
|
|
b715a87f40 | ||
|
|
f17ef325b1 | ||
|
|
4ddc55aa6d | ||
|
|
2a714ae9cc | ||
|
|
d53a479b21 | ||
|
|
f5742c107a | ||
|
|
9c7d711c16 | ||
|
|
11c027c71b | ||
|
|
16f1c47db6 | ||
|
|
72108e0019 | ||
|
|
0c207c7b83 | ||
|
|
f671c670db | ||
|
|
a293bd8d3f | ||
|
|
7dad6720e4 | ||
|
|
402f05f3d6 | ||
|
|
0736646c63 | ||
|
|
8d0040da53 | ||
|
|
6f5bb84c04 | ||
|
|
63fe6ec68b | ||
|
|
ff07147270 | ||
|
|
c8e1cffca9 | ||
|
|
5ba2a73c70 | ||
|
|
a4d021d2fb | ||
|
|
3c66319b03 | ||
|
|
775fcf5693 | ||
|
|
f5315122e4 | ||
|
|
90abde57cc | ||
|
|
91cde30d75 | ||
|
|
2114b71d47 | ||
|
|
94d0ed1fd0 | ||
|
|
4026c0c305 | ||
|
|
6d2b9d5f21 | ||
|
|
f2f9044be0 | ||
|
|
ebc873d6f3 | ||
|
|
4d77b669ba | ||
|
|
6f2c6b151d | ||
|
|
6e2b5aea47 | ||
|
|
098351bb21 | ||
|
|
a0e7ee7292 | ||
|
|
3fbcbf25ca | ||
|
|
413134b21d | ||
|
|
6d82c0f730 | ||
|
|
900b701c80 | ||
|
|
9cabbe8c7c | ||
|
|
155c4a75b3 | ||
|
|
aec80388f0 | ||
|
|
51b62cfe92 | ||
|
|
8136477dd9 | ||
|
|
877a4eaa49 | ||
|
|
7fa3181376 | ||
|
|
c524cd4086 | ||
|
|
5c0cfe44dd | ||
|
|
51ca1e60af | ||
|
|
e234428965 | ||
|
|
701a9d6f30 | ||
|
|
e8461f91e6 | ||
|
|
e9c6a3bb2f | ||
|
|
215ef93173 | ||
|
|
34878d26f8 | ||
|
|
040b787e8f | ||
|
|
b215062177 | ||
|
|
ad2545c2e2 | ||
|
|
df1cb5f3e7 | ||
|
|
8b1201626d | ||
|
|
ab7df6c21e | ||
|
|
895c461e2b | ||
|
|
1baec3f1d4 | ||
|
|
552df3a614 | ||
|
|
1bcefdb1e8 | ||
|
|
e57fc7b718 | ||
|
|
8feac3861e | ||
|
|
ee0b10746c | ||
|
|
ac2b8dbfcf | ||
|
|
8aaf941d24 | ||
|
|
4313ddca54 | ||
|
|
a831413151 | ||
|
|
833dbcd8b4 | ||
|
|
7b0a476677 | ||
|
|
9e35642879 | ||
|
|
e8bbdf613b | ||
|
|
246e6941d5 | ||
|
|
ec94eed787 | ||
|
|
46a26af5d6 | ||
|
|
616a4a506d | ||
|
|
a9b4ac0879 | ||
|
|
5939f1d487 | ||
|
|
af46d775f0 | ||
|
|
d48d40a2b7 | ||
|
|
c29afba89e | ||
|
|
18f92823c2 | ||
|
|
7887a14f6b | ||
|
|
712e317e40 | ||
|
|
957b0d9b40 | ||
|
|
432f1f5a55 | ||
|
|
039ab9d192 | ||
|
|
5cd6d21b2e | ||
|
|
7a8da68edb | ||
|
|
e421a58f4e | ||
|
|
74f76d0ba3 | ||
|
|
4f23aebd7f | ||
|
|
98f45d2334 | ||
|
|
6cf20cee34 | ||
|
|
cf104e64aa | ||
|
|
7109df9deb | ||
|
|
23eafb135d | ||
|
|
4c54355a42 | ||
|
|
d8815237f5 | ||
|
|
3cae4fbc1c | ||
|
|
e6909dc052 | ||
|
|
a569d51f6b | ||
|
|
35ad61034d | ||
|
|
d56b5873ff | ||
|
|
d58cac7909 | ||
|
|
2fd646fdea | ||
|
|
cf2382ac55 | ||
|
|
a0f39d90d6 | ||
|
|
0d6420215c | ||
|
|
945aaaddcb | ||
|
|
5caae4e953 | ||
|
|
12230c2f4e | ||
|
|
e3f6ef48e6 | ||
|
|
9948360435 | ||
|
|
d1197279fd | ||
|
|
2186fc4e87 | ||
|
|
f79e89e0ec | ||
|
|
6e2c12f5ff | ||
|
|
ade98ff924 | ||
|
|
e3f28abe1a | ||
|
|
6030ed1684 | ||
|
|
b51bafe509 | ||
|
|
03942dc49e | ||
|
|
7a47315bc1 | ||
|
|
0727fe4fea | ||
|
|
cdf2dc2b36 | ||
|
|
b4136c91c2 | ||
|
|
9f7d67b17b | ||
|
|
0a1f03b5c7 | ||
|
|
52c1124e97 | ||
|
|
f33f965354 | ||
|
|
eb614c47b0 | ||
|
|
7cd1bc7aec | ||
|
|
aaba8bff03 | ||
|
|
a6e9ecbe50 | ||
|
|
9741c4f3df | ||
|
|
b24b3749c4 | ||
|
|
7964921389 | ||
|
|
88b243a8f4 | ||
|
|
13abe898a9 | ||
|
|
12ce5c568e | ||
|
|
d33ddcfa65 | ||
|
|
6521fdc988 | ||
|
|
8d231e14cc | ||
|
|
6e2a41afbc | ||
|
|
ed6d9b2b67 | ||
|
|
fc38fc3957 | ||
|
|
5dad9f0ec9 | ||
|
|
b1b1229a0b | ||
|
|
25646317ae | ||
|
|
8b7dca8e23 | ||
|
|
f587a99385 | ||
|
|
5267b4bb93 | ||
|
|
f6885a06b6 | ||
|
|
eb8126c32f | ||
|
|
8aba06ac38 | ||
|
|
2885e81c8b | ||
|
|
815a83f9ad | ||
|
|
995a9c9b57 | ||
|
|
fd80bada97 | ||
|
|
054474634e | ||
|
|
dbb58e507d | ||
|
|
c343fe4775 | ||
|
|
34bd98a815 | ||
|
|
e6239af7d8 | ||
|
|
d3f5b2ec91 | ||
|
|
a99da7aa00 | ||
|
|
1de4d95bd4 | ||
|
|
0c665c6b3c | ||
|
|
7a19b7204c | ||
|
|
d9ef4b91fa | ||
|
|
368c9afc7f | ||
|
|
9da15002ff | ||
|
|
595d3cc7ca | ||
|
|
54c8169c34 | ||
|
|
7b9ceb9cfb | ||
|
|
6fd30242c0 | ||
|
|
8cd2962b4b | ||
|
|
f17ff8e58b | ||
|
|
45d676f38f | ||
|
|
59417e8248 | ||
|
|
65c7ac919b | ||
|
|
f30f8ab13b | ||
|
|
815854bad8 | ||
|
|
0d901c018f | ||
|
|
a2c79c79cd | ||
|
|
47a21d6544 | ||
|
|
34fc0a15b9 | ||
|
|
c3bc1035ad | ||
|
|
6e71448158 | ||
|
|
2bb2a35fcc | ||
|
|
ee469dfd65 | ||
|
|
0be82bedee | ||
|
|
735af70af6 | ||
|
|
e057ddc187 | ||
|
|
b2410a8739 | ||
|
|
c82e3257c1 | ||
|
|
6754c3a8a5 | ||
|
|
79767c8ec1 | ||
|
|
f589df7303 | ||
|
|
ea79a0d601 | ||
|
|
798ace76f3 | ||
|
|
0979282504 | ||
|
|
feaa295606 | ||
|
|
c73a27eb1a | ||
|
|
0e44372a7e | ||
|
|
7384e8babe | ||
|
|
ee1a019727 | ||
|
|
b0d42d79aa | ||
|
|
c5ce6d3c10 | ||
|
|
4f7b6cede4 | ||
|
|
e53c0e1ce5 | ||
|
|
d4408aaa32 | ||
|
|
9dd10d7ea1 | ||
|
|
9494ed79a3 | ||
|
|
39e68bd33a | ||
|
|
80040a69ef | ||
|
|
5e61f23106 | ||
|
|
cab36b49a3 | ||
|
|
60d2b64aa5 | ||
|
|
9e4da0a5c2 | ||
|
|
b00e7aec13 | ||
|
|
3758cf8e0a | ||
|
|
5ed534e364 | ||
|
|
7aeca39521 | ||
|
|
de47514f69 | ||
|
|
5e7ac69929 | ||
|
|
fc2fd851c3 | ||
|
|
3a7bfef5cf | ||
|
|
1fa27e1239 | ||
|
|
7173d28e5b | ||
|
|
a750fcd108 | ||
|
|
4ce3f3e34e | ||
|
|
e5a0fb7eca | ||
|
|
65f7816c59 | ||
|
|
883e227d54 | ||
|
|
45d246abce | ||
|
|
8d54bcafc1 | ||
|
|
fa2d00ba36 | ||
|
|
69f3cb2f12 | ||
|
|
831cdfb2d6 | ||
|
|
5e95f56c34 | ||
|
|
92e6d40e75 | ||
|
|
81a221e561 | ||
|
|
c8d6a4f4d1 | ||
|
|
59f05270ae | ||
|
|
9f8088164e | ||
|
|
211673c6a5 | ||
|
|
96224b4d92 | ||
|
|
b249563f94 | ||
|
|
837daf6cab | ||
|
|
72a7c151e9 | ||
|
|
3fa21fd3eb | ||
|
|
ea556d69f6 | ||
|
|
0bbf7c5643 | ||
|
|
16d4eff385 | ||
|
|
c456798751 | ||
|
|
57be30cf6b | ||
|
|
8d111ea976 | ||
|
|
059c0056c4 | ||
|
|
e209aa36e8 | ||
|
|
a67058e1e5 | ||
|
|
d85c6c1b2c | ||
|
|
1fc04b4464 | ||
|
|
2b8648ed35 | ||
|
|
602da25b6d | ||
|
|
eb376b261b | ||
|
|
1e93e9bacc | ||
|
|
5d6de7c405 | ||
|
|
033ef19d6b | ||
|
|
aabca93c27 | ||
|
|
c8870c5c12 | ||
|
|
58a34b0ad6 | ||
|
|
9989b97fe9 | ||
|
|
6cdeaa0c1b | ||
|
|
ecfaff2e0d | ||
|
|
ef04fd31f0 | ||
|
|
882d222800 | ||
|
|
022c10f2df | ||
|
|
c089adae9e | ||
|
|
dd243c6c5e | ||
|
|
f112abf246 | ||
|
|
079679997a | ||
|
|
a164e2be62 | ||
|
|
0c5485b1d0 | ||
|
|
0ffc223459 | ||
|
|
77f13fa898 | ||
|
|
654961b349 | ||
|
|
c63c807232 | ||
|
|
c2f25c8c7f | ||
|
|
3f974a27b2 | ||
|
|
e4a06bd12d | ||
|
|
80e42cc997 | ||
|
|
f4c2cdce2b | ||
|
|
a66ef3273a | ||
|
|
5c43fbfd96 | ||
|
|
948c194a60 | ||
|
|
7ee7f53938 | ||
|
|
5873842260 | ||
|
|
9eb99ed176 | ||
|
|
a30e8a3eea | ||
|
|
094635cc0e | ||
|
|
5ac768f15b | ||
|
|
83b14767b3 | ||
|
|
653cafbe81 | ||
|
|
ac7bb93a37 | ||
|
|
e1f8392261 | ||
|
|
0cd83825b7 | ||
|
|
b198417ad1 | ||
|
|
78e9a0ab15 | ||
|
|
aa25aa6d85 | ||
|
|
3b87589d01 | ||
|
|
697442ba63 | ||
|
|
4670adadc0 | ||
|
|
9448d94e99 | ||
|
|
94db430b85 | ||
|
|
7fb4d96cb0 | ||
|
|
7dad247374 | ||
|
|
2d133f47f1 | ||
|
|
cd191f6815 | ||
|
|
50d238a48c | ||
|
|
49e9d5b985 | ||
|
|
d98029d5e7 | ||
|
|
a66da8de9e | ||
|
|
ee269917f8 | ||
|
|
cc8ec39dad | ||
|
|
92e9d888e9 | ||
|
|
faabf1bb3a | ||
|
|
2ea876a2a0 | ||
|
|
15e9cdc2d6 | ||
|
|
d5ce54f35e | ||
|
|
f8dd062a50 | ||
|
|
66001dae04 | ||
|
|
47c42222b3 | ||
|
|
5ce099c11d | ||
|
|
c6ac0a0a2b | ||
|
|
20a540f0fc | ||
|
|
af3f621424 | ||
|
|
58466dbb0a | ||
|
|
fbac2f820e | ||
|
|
22eb7453be | ||
|
|
238762dd0f | ||
|
|
7a13cd851b | ||
|
|
901fe4dd94 | ||
|
|
5074c9e68b | ||
|
|
88c04c6dac | ||
|
|
831204663a | ||
|
|
ff60d0238b | ||
|
|
c665bf3ccc | ||
|
|
708d3db4bb | ||
|
|
9034cef0d2 | ||
|
|
0f2bd3f01d | ||
|
|
6b081fdc53 | ||
|
|
e39a7d140f | ||
|
|
71c90d1d4d | ||
|
|
ad2146f3bd | ||
|
|
9174e775ae | ||
|
|
7a9e5ca6f6 | ||
|
|
883e5d60fa | ||
|
|
f467c88b10 | ||
|
|
013365388d | ||
|
|
03be7bcbd3 | ||
|
|
69c555f567 | ||
|
|
fc1a7a09ff | ||
|
|
4054c6ed57 | ||
|
|
b1e79c1e05 | ||
|
|
92049cf251 | ||
|
|
006133102f | ||
|
|
872c978b9b | ||
|
|
3af247febb | ||
|
|
f35fca0eeb | ||
|
|
05527a41a1 | ||
|
|
0e0f50187e | ||
|
|
47b19ae7fa | ||
|
|
edfe5c6973 | ||
|
|
ceff0d4147 | ||
|
|
934398911d | ||
|
|
66e16452a8 | ||
|
|
f92127e3d6 | ||
|
|
7049b1ff45 | ||
|
|
15b88c97fc | ||
|
|
3f06ca3623 | ||
|
|
a4fc95775e | ||
|
|
03fe553344 | ||
|
|
6ccd8bb06b | ||
|
|
b564907b12 | ||
|
|
f999b60a79 | ||
|
|
1dcdab8f92 | ||
|
|
da2da0827d | ||
|
|
b3cf919273 | ||
|
|
96149bd2ae | ||
|
|
e2326ff4f6 | ||
|
|
92b7a2aecf | ||
|
|
0c746aa3d9 | ||
|
|
9d405428be | ||
|
|
24d029574f | ||
|
|
d5354c11d6 | ||
|
|
2e11d7cf42 | ||
|
|
fff56a97f7 | ||
|
|
42f1f28b02 | ||
|
|
de1711d713 | ||
|
|
c83e76e641 | ||
|
|
36a1a18615 | ||
|
|
62e7888fcf | ||
|
|
f881b9ea3b | ||
|
|
38145ff461 | ||
|
|
523545ec7e | ||
|
|
d9b95563b5 | ||
|
|
8c9018407a | ||
|
|
52f09f9f22 | ||
|
|
ca2c6af060 | ||
|
|
7ce60b223e | ||
|
|
cae928f7f9 | ||
|
|
5fc649607a | ||
|
|
4f31eed71a | ||
|
|
d71e6b1933 | ||
|
|
a035f02f83 | ||
|
|
260286f9cf | ||
|
|
c68d4e05de | ||
|
|
a3b41caf06 | ||
|
|
cda6c0f791 | ||
|
|
900acb6eb0 | ||
|
|
842fa221aa | ||
|
|
e692e01c4f | ||
|
|
6dbac52c50 | ||
|
|
94a6004608 | ||
|
|
032f7c03e0 | ||
|
|
e272370fea | ||
|
|
8e18336fa3 | ||
|
|
16e45cb45d | ||
|
|
5cf137e5e8 | ||
|
|
0315389ce9 | ||
|
|
0e314ef5ad | ||
|
|
ffc3e57aa1 | ||
|
|
1b3c598a66 | ||
|
|
6821ce5fbf | ||
|
|
a073b8c50d | ||
|
|
c65470186c | ||
|
|
0df98bc226 | ||
|
|
58b62d18e4 | ||
|
|
d59f5abdf5 | ||
|
|
aec37c35cc | ||
|
|
a1e09c3b54 | ||
|
|
3fe83f9fa4 | ||
|
|
b4df7f5eea | ||
|
|
fcede5c0ac | ||
|
|
33fcee66df | ||
|
|
455c696ff0 | ||
|
|
06ff39b800 | ||
|
|
074d76456b | ||
|
|
0d471a96ed | ||
|
|
cda5413fd1 | ||
|
|
8d1ba220c1 | ||
|
|
7db8d8f45f | ||
|
|
fbb5b3c947 | ||
|
|
2432bc5a69 | ||
|
|
01f8040a1a | ||
|
|
9e263f9e23 | ||
|
|
2114b89365 | ||
|
|
2d5bd2ddb4 | ||
|
|
c30e7d340b | ||
|
|
3613237350 | ||
|
|
edc7c11929 | ||
|
|
30929e8bd3 | ||
|
|
2679969cb6 | ||
|
|
e4af8cadb0 | ||
|
|
22e8ae47f1 | ||
|
|
115123a0bc | ||
|
|
6f7415e116 | ||
|
|
b4bf5ddc0a | ||
|
|
84cbc745c7 | ||
|
|
f8443ed316 | ||
|
|
a10ae0ddd1 | ||
|
|
5c54f50365 | ||
|
|
aa601f8703 | ||
|
|
81e3d0a18e | ||
|
|
eeb4566a69 | ||
|
|
511acfdb5b | ||
|
|
ab5e31dfea | ||
|
|
acab44aaa4 | ||
|
|
5a5288c9da | ||
|
|
3c167f3b54 | ||
|
|
783f7c3fc1 | ||
|
|
310c1c21ce | ||
|
|
d3777b236d | ||
|
|
6b4bfae30b | ||
|
|
23269625e1 | ||
|
|
320420478c | ||
|
|
1073204858 | ||
|
|
fbe1d88d27 | ||
|
|
d981014160 | ||
|
|
2dc810a9fd | ||
|
|
2dcef449bf | ||
|
|
7c90b9339d | ||
|
|
f9cf6fa500 | ||
|
|
bd8bbc6154 | ||
|
|
e385ed5d34 | ||
|
|
41a3b8c7c7 | ||
|
|
7b6dcedfad | ||
|
|
698c3451ff | ||
|
|
4ec0b69a8d | ||
|
|
86bdb9f099 | ||
|
|
2a5b9ec6bd | ||
|
|
09fe6d29e2 | ||
|
|
538f96c082 | ||
|
|
b72e487b58 | ||
|
|
f212be136e | ||
|
|
7305f878f3 | ||
|
|
978391fe90 | ||
|
|
04a72da06c | ||
|
|
a2ee21faba | ||
|
|
25a0604073 | ||
|
|
268ec4c27a | ||
|
|
cf72039ff1 | ||
|
|
ba2f1e5ac5 | ||
|
|
0c994f1e23 | ||
|
|
a9d794dc19 | ||
|
|
456692ff8a | ||
|
|
fc89d4cbe8 | ||
|
|
25a8456312 | ||
|
|
fe26ac5ffc | ||
|
|
cc202d79f9 | ||
|
|
70f2b11df5 | ||
|
|
e50e332818 | ||
|
|
741140fa71 | ||
|
|
258d2bc2ea | ||
|
|
5c6a3455b0 | ||
|
|
75dd89f2fe | ||
|
|
4870babc43 | ||
|
|
78762b920e | ||
|
|
7f9c4f3855 | ||
|
|
6299d286ba | ||
|
|
141e1c7130 | ||
|
|
f8125aa149 | ||
|
|
eb43deb9f5 | ||
|
|
b0fcafd089 | ||
|
|
33c8f8bf5a | ||
|
|
4bbde1a5f6 | ||
|
|
c9aab11e03 | ||
|
|
19d24f4089 | ||
|
|
8765cf10f6 | ||
|
|
f305f0a93e | ||
|
|
5547eb4ee8 | ||
|
|
5549e8cff9 | ||
|
|
979d6e2e31 | ||
|
|
e35a963b67 | ||
|
|
ad008b66b4 | ||
|
|
ab02c2f3ee | ||
|
|
eea8032f0d | ||
|
|
cdba8aeaf2 | ||
|
|
c80ea829ac | ||
|
|
fded26251f | ||
|
|
2e6d8afb93 | ||
|
|
94641bad76 | ||
|
|
2b10e7eda9 | ||
|
|
9098504e5f | ||
|
|
ffd8130269 | ||
|
|
ce0c941bf1 | ||
|
|
7f6ba9de99 | ||
|
|
3b789f4d13 | ||
|
|
436fb3f5aa | ||
|
|
8dcff6b731 | ||
|
|
fb7bac8bfd | ||
|
|
f0f94d4fcc | ||
|
|
7a228b13e6 | ||
|
|
168ec281aa | ||
|
|
6fda0e6e44 | ||
|
|
4e6b1fe6aa | ||
|
|
263533f09a | ||
|
|
1c3f8abaf4 | ||
|
|
2d5b7726ef | ||
|
|
801399777b | ||
|
|
ae0b206c4c | ||
|
|
5880dfbe15 | ||
|
|
480d013994 | ||
|
|
5021c746fc | ||
|
|
905f34ae24 | ||
|
|
7d251f04e8 | ||
|
|
8d8c8df82f | ||
|
|
f48afa98f2 | ||
|
|
cb2ff28129 | ||
|
|
1876ccb377 | ||
|
|
7d1bd60ea8 | ||
|
|
58951caa2f | ||
|
|
8d8b30441b | ||
|
|
b9a7d002f1 | ||
|
|
808c82f193 | ||
|
|
257c8c9fa1 | ||
|
|
af72d819fe | ||
|
|
5e7a0a0c53 | ||
|
|
6a5374726e | ||
|
|
2e5b5665ce | ||
|
|
2d5afb1646 | ||
|
|
5a345575c4 | ||
|
|
6cfcbdb76e | ||
|
|
359806da96 | ||
|
|
bfb30923e1 | ||
|
|
bd9686dbd8 | ||
|
|
1c516bb24b | ||
|
|
d3171f4c69 | ||
|
|
04025682d5 | ||
|
|
921867f650 | ||
|
|
70b6bcd66b | ||
|
|
c25be06441 | ||
|
|
ed3c3d60ce | ||
|
|
e4613ba053 | ||
|
|
83ab94fcad | ||
|
|
588ec68b21 | ||
|
|
803bf323ce | ||
|
|
65854d9c0a | ||
|
|
9072642f22 | ||
|
|
4c46a4e575 | ||
|
|
56dfacbaaa | ||
|
|
163f630959 | ||
|
|
d4a8b89e6f | ||
|
|
2b2a9c6706 | ||
|
|
1ce6411e05 | ||
|
|
a22e59e2bd | ||
|
|
355c2f983f | ||
|
|
8b7a1e4e3c | ||
|
|
36988cd3e0 | ||
|
|
740c2a73fa | ||
|
|
5a25899b57 | ||
|
|
578af946b3 | ||
|
|
5840ee537f | ||
|
|
28b3d2e4b3 | ||
|
|
1c6c9ab3e8 | ||
|
|
e9eb47308a | ||
|
|
436914e7ee | ||
|
|
ac303405ef | ||
|
|
a9c5004f4d | ||
|
|
75b0d9cdf3 | ||
|
|
7a617d4a17 | ||
|
|
502e59cfd7 | ||
|
|
ea1cae7968 | ||
|
|
13ff7f8d8a | ||
|
|
3cd1ac1cc4 | ||
|
|
7bf59929b0 | ||
|
|
2bd1033665 | ||
|
|
a0a2242341 | ||
|
|
17ff5c38f3 | ||
|
|
c94cde2931 | ||
|
|
e3bffde883 | ||
|
|
eacb1e6475 | ||
|
|
a8eea1a73b | ||
|
|
cda3b04b85 | ||
|
|
2ccf47f7dd | ||
|
|
372c36893d | ||
|
|
7b2fd6ebd4 | ||
|
|
f9ba8b8df5 | ||
|
|
cd50d36394 | ||
|
|
2bd86d2101 | ||
|
|
c5a1c2db76 | ||
|
|
0865cf4952 | ||
|
|
131ec6fff3 | ||
|
|
7f48b4d9f5 | ||
|
|
8c93d9a5be | ||
|
|
5c9fd9a0f4 | ||
|
|
54ec6de4f2 | ||
|
|
bd6fae9aed | ||
|
|
644fa4f7c0 | ||
|
|
5319afa563 | ||
|
|
5de5fc933a | ||
|
|
0274c36afd | ||
|
|
573f1a2c17 | ||
|
|
60e14fe53e | ||
|
|
3f833d41f3 | ||
|
|
ec8e8a17d2 | ||
|
|
ccd6fd2be3 | ||
|
|
2b07a6de2d | ||
|
|
07a02714df | ||
|
|
babaadb0cf | ||
|
|
df236d172d | ||
|
|
07c49bee4e | ||
|
|
e3b2594c57 | ||
|
|
d8a2a1f805 | ||
|
|
a8f8f488ad | ||
|
|
5927b394a7 | ||
|
|
b1ea4cebad | ||
|
|
4c9ef87975 | ||
|
|
dacec716bc | ||
|
|
aabc77d903 | ||
|
|
26cd37be23 | ||
|
|
63d8c98822 | ||
|
|
44efb3a967 | ||
|
|
f9dc628ef4 | ||
|
|
cc195d2f5f | ||
|
|
92df80e711 | ||
|
|
c389c614d7 | ||
|
|
46f6aeaaf7 | ||
|
|
5887977e45 | ||
|
|
35862078b3 | ||
|
|
0d3cd11ade | ||
|
|
2f28252c64 | ||
|
|
b424abd17a | ||
|
|
d79c9686e5 | ||
|
|
ded82aae41 | ||
|
|
90205f5395 | ||
|
|
1f6ae515f3 | ||
|
|
23bee0b3ae | ||
|
|
ce6d2684b7 | ||
|
|
5e316e4d54 | ||
|
|
434e163626 | ||
|
|
eccc27e91a | ||
|
|
e577628852 | ||
|
|
2a0680c707 | ||
|
|
1a546c326c | ||
|
|
fa2862090f | ||
|
|
0a9c7c9dda | ||
|
|
21f445dc13 | ||
|
|
8e82d38bbb | ||
|
|
6ddac803a2 | ||
|
|
07cd3065b2 | ||
|
|
ee3ad63aa3 | ||
|
|
476b1d4ecb | ||
|
|
565881c8c9 | ||
|
|
a19fd5450a | ||
|
|
0d7893c4a4 | ||
|
|
c9b9e76514 | ||
|
|
17101687bf | ||
|
|
9d24069dcd | ||
|
|
fd53170e59 | ||
|
|
24bb45e2b9 | ||
|
|
bb682cb2d7 | ||
|
|
bbbc982be1 | ||
|
|
434bf2ed70 | ||
|
|
b0f2ed55f6 | ||
|
|
2d4a6aa22a | ||
|
|
5b3c700f00 | ||
|
|
42b043670e | ||
|
|
47c26ed189 | ||
|
|
d8d9184f3f | ||
|
|
d480a03369 | ||
|
|
74c9deaa29 | ||
|
|
649720079a | ||
|
|
fbf3896878 | ||
|
|
b952e6efd1 | ||
|
|
c886a4bc40 | ||
|
|
4daf6b4410 | ||
|
|
1660e941d7 | ||
|
|
91e4680024 | ||
|
|
9de04ddaa4 | ||
|
|
591c4d05b2 | ||
|
|
2b881c3863 | ||
|
|
1f5527270c | ||
|
|
8ca6b3fbe4 | ||
|
|
9716aceabf | ||
|
|
b37568b440 | ||
|
|
50b058c3c5 | ||
|
|
da18842e42 | ||
|
|
06d289aff3 | ||
|
|
567b054b32 | ||
|
|
01d1dccbb6 | ||
|
|
ed4b3c77ef | ||
|
|
391fceef30 | ||
|
|
bdad1a41f9 | ||
|
|
97101f18a6 | ||
|
|
39033ca6fb | ||
|
|
256a9586d7 | ||
|
|
e83cf322b5 | ||
|
|
9281d06723 | ||
|
|
05dfd9d936 | ||
|
|
4314e4adab | ||
|
|
dad90a1cec | ||
|
|
011496fcd8 | ||
|
|
668991de26 | ||
|
|
aac478eebc | ||
|
|
d0ec2fd588 | ||
|
|
a97523e800 | ||
|
|
24604c9d36 | ||
|
|
e4079d1e60 | ||
|
|
982cc4685e | ||
|
|
ea4af425f3 | ||
|
|
26835f6a29 | ||
|
|
af393e34fb | ||
|
|
315e83da19 | ||
|
|
0295d6f4b5 | ||
|
|
e5c13e9e76 | ||
|
|
fded83ee0d | ||
|
|
bd0321fe2d | ||
|
|
51dadabc2c | ||
|
|
abc6835786 | ||
|
|
41cd22b17f | ||
|
|
befaf67ba7 | ||
|
|
abcac71826 | ||
|
|
84e2cdf22d | ||
|
|
3d9f38781a | ||
|
|
40adc77978 | ||
|
|
a60e067d4e | ||
|
|
1b7d840e4d | ||
|
|
8aa2ecd9c8 | ||
|
|
1b5d3e564d | ||
|
|
ffb99645d6 | ||
|
|
aa12779598 | ||
|
|
6340bcc04b | ||
|
|
fb026a134f | ||
|
|
44290b65ba | ||
|
|
74ce204489 | ||
|
|
5eb3b0dcae | ||
|
|
37045f7201 | ||
|
|
39468f3b95 | ||
|
|
cfd2a6eee3 | ||
|
|
0cac40eb31 | ||
|
|
899991794b | ||
|
|
3b6ca97f4c | ||
|
|
35f9a59f44 | ||
|
|
3b3fbb288d | ||
|
|
54e2ce2c7e | ||
|
|
fa89af920c | ||
|
|
36c4ffa02e | ||
|
|
a4f32ef8dc | ||
|
|
cb99304993 | ||
|
|
b9248498eb | ||
|
|
b6652624e3 | ||
|
|
f1f100f952 | ||
|
|
763038cc11 | ||
|
|
b16c1fa5fc | ||
|
|
5d446f0ccf | ||
|
|
67428f606a | ||
|
|
ad293fcd31 | ||
|
|
a8407503b9 | ||
|
|
2a457c9553 | ||
|
|
c025508cd7 | ||
|
|
449efcc56b | ||
|
|
e3af0b2914 | ||
|
|
219aa2b550 | ||
|
|
ece65e7460 | ||
|
|
e0c0143970 | ||
|
|
b8cda53d6a | ||
|
|
dc96720641 | ||
|
|
c9bacb96cd | ||
|
|
b4bee9eb82 | ||
|
|
bf5844c72a | ||
|
|
dd884b96ba | ||
|
|
6610f30afd | ||
|
|
c41af9d01d | ||
|
|
62038c8c60 | ||
|
|
174695b94c | ||
|
|
8edf023a00 | ||
|
|
fcb69b7743 | ||
|
|
010918198a | ||
|
|
8102aaeb12 | ||
|
|
a013f35cd9 | ||
|
|
6637fdc92b | ||
|
|
4d0b4c3178 | ||
|
|
3501a69b2f | ||
|
|
d06a874c3b | ||
|
|
8369b2c22c | ||
|
|
8e870c835e | ||
|
|
de4d77c1ec | ||
|
|
ae5c627902 | ||
|
|
aa566e9535 | ||
|
|
89fa321088 | ||
|
|
bf547fe1a0 | ||
|
|
0b537f5bff | ||
|
|
e42aee84bc | ||
|
|
a94f5d72e8 | ||
|
|
a6226cba18 | ||
|
|
b9d4e8c66c | ||
|
|
0491487385 | ||
|
|
23708e4644 | ||
|
|
3b30d89956 | ||
|
|
a41a5b3ad4 | ||
|
|
8fa1d4a5c3 | ||
|
|
032ec81b86 | ||
|
|
f8be386c02 | ||
|
|
0f073e9441 | ||
|
|
4ad66b27e8 | ||
|
|
b13aaeb0e9 | ||
|
|
3934ebd030 | ||
|
|
87a19c9bae | ||
|
|
9b324d17cc | ||
|
|
cfc57f17af | ||
|
|
841b75eef1 | ||
|
|
ac11fc5926 | ||
|
|
dd8ac99d5d | ||
|
|
c3888bedf2 | ||
|
|
c3a57a2bea | ||
|
|
649c80b0ff | ||
|
|
ffb84cffca | ||
|
|
7c823022ae | ||
|
|
d051aeb155 | ||
|
|
a40db172bb | ||
|
|
3dcdc04127 | ||
|
|
9dec40805c | ||
|
|
138614a57a | ||
|
|
ba20eb8cf1 | ||
|
|
ccb4e675ab | ||
|
|
328b3135e5 | ||
|
|
12d56aeda9 | ||
|
|
14550ddc0f | ||
|
|
7445d24531 | ||
|
|
e813129eb8 | ||
|
|
8ab6cdb03c | ||
|
|
bd5aa8e0b9 | ||
|
|
f3574a5029 | ||
|
|
e703c17a47 | ||
|
|
45a20d9405 | ||
|
|
67c7faf832 | ||
|
|
180252f3f5 | ||
|
|
f6dca97442 | ||
|
|
51f7963197 | ||
|
|
828681e960 | ||
|
|
45eaea6f68 | ||
|
|
f050ec1273 | ||
|
|
102aed78e5 | ||
|
|
f235e4665b | ||
|
|
75eddb913b | ||
|
|
f360db1859 | ||
|
|
f6262be397 | ||
|
|
c143a5f767 | ||
|
|
164d777ebf | ||
|
|
3291530b32 | ||
|
|
b7934f9f51 | ||
|
|
239b5d3efe | ||
|
|
ea8b863694 | ||
|
|
830c8d8747 | ||
|
|
64d71bef42 | ||
|
|
3fb880d09b | ||
|
|
deeb55cd0b | ||
|
|
e497ab0008 | ||
|
|
d46d61184b | ||
|
|
76a8eee6c5 | ||
|
|
fc50c87ad5 | ||
|
|
f44500d21b | ||
|
|
eacc4dc794 | ||
|
|
5ae32f0792 | ||
|
|
db91b3e6c6 | ||
|
|
47e851ce5e | ||
|
|
a4f9467d53 | ||
|
|
dc730cddc3 | ||
|
|
994cd4133a | ||
|
|
13dc3ca259 | ||
|
|
8195a600f5 | ||
|
|
a55c6eb8b0 | ||
|
|
0680bca2b4 | ||
|
|
f0d6624fc4 | ||
|
|
aa9293af55 | ||
|
|
813ca55ef6 | ||
|
|
54bc196685 | ||
|
|
bddfcee92b | ||
|
|
0fa44da0d4 | ||
|
|
bb5aa6722f | ||
|
|
b512e14129 | ||
|
|
bc4b62a4c1 | ||
|
|
8271a3b497 | ||
|
|
4e182e5f6e | ||
|
|
a575073387 | ||
|
|
4fe45eb36d | ||
|
|
52fc452823 | ||
|
|
16f671cd8f | ||
|
|
cc21c47829 | ||
|
|
f824b661bd | ||
|
|
8de58a2101 | ||
|
|
4c94fa0a8f | ||
|
|
258ac4d56b | ||
|
|
f5a8d6bdc6 | ||
|
|
04e18572fd | ||
|
|
6c5cc55f31 | ||
|
|
958bcd3ec5 | ||
|
|
a03ac7c78b | ||
|
|
c2b000ac5f | ||
|
|
b2702aaa9e | ||
|
|
c7a8552d9b | ||
|
|
c4293f17a6 | ||
|
|
60c572ec30 | ||
|
|
0eab817a11 | ||
|
|
0f0ec183a8 | ||
|
|
d98d3748d3 | ||
|
|
3673d6016d | ||
|
|
3e78a0809b | ||
|
|
2bbca87e51 | ||
|
|
eae776990c | ||
|
|
d8d6342505 | ||
|
|
929d7c463f | ||
|
|
617b025ce1 | ||
|
|
6fdc28e121 | ||
|
|
66e727838b | ||
|
|
8d8ef55b81 | ||
|
|
e8c53c2bd1 | ||
|
|
c2e8a1caae | ||
|
|
131ae30bae | ||
|
|
95be9e9390 | ||
|
|
bb01427a42 | ||
|
|
723da40bc7 | ||
|
|
9fd8385651 | ||
|
|
0ca0abf2da | ||
|
|
f8d7eaea5e | ||
|
|
49c0ec9dd9 | ||
|
|
5ab38a9077 | ||
|
|
73ecdfff70 | ||
|
|
2dda4f3488 | ||
|
|
554e695ef5 | ||
|
|
9787a9e379 | ||
|
|
638e996516 | ||
|
|
baedcaba05 | ||
|
|
bc0f17c18f | ||
|
|
f416530d38 | ||
|
|
11e0e04cbd | ||
|
|
f6b7e8dad8 | ||
|
|
bab4bf86cb | ||
|
|
a06555268f | ||
|
|
a44bf0928f | ||
|
|
f9682a7b70 | ||
|
|
d2eaecfaab | ||
|
|
b965e66440 | ||
|
|
0437171b7a | ||
|
|
f6af025355 | ||
|
|
2c31caf34f | ||
|
|
40410292d7 | ||
|
|
a6ecbb66d1 | ||
|
|
6caa8cdb79 | ||
|
|
8c5518170d | ||
|
|
43691911b7 | ||
|
|
0444f68f3a | ||
|
|
e01d5d913f | ||
|
|
f9e2d80973 | ||
|
|
d5e8a77821 | ||
|
|
237cc15387 | ||
|
|
3539daceaa | ||
|
|
3baf6ffffc | ||
|
|
b77cf108cd | ||
|
|
476e715982 | ||
|
|
91bfa5698e | ||
|
|
63c61caccc | ||
|
|
6d432ba1da | ||
|
|
32a24ad578 | ||
|
|
4090536c97 | ||
|
|
1ca339f2ea | ||
|
|
36f396ac24 | ||
|
|
3a1a9795f6 | ||
|
|
c613b12f11 | ||
|
|
e2d784176b | ||
|
|
e3b7f587ee | ||
|
|
6ec67438d2 | ||
|
|
7da3509bd0 | ||
|
|
52722ec5d4 | ||
|
|
d8488782df | ||
|
|
6a65ab812b | ||
|
|
040d679b7f | ||
|
|
551da1a64b | ||
|
|
0baec3e532 | ||
|
|
85951de24d | ||
|
|
84b24f11b8 | ||
|
|
2ac3645bb0 | ||
|
|
3bb8ecc975 | ||
|
|
caa47823be | ||
|
|
bbb5927e0c | ||
|
|
b3bae36d94 | ||
|
|
024e908947 | ||
|
|
ac065504f6 | ||
|
|
3570a67f30 | ||
|
|
96648767e4 | ||
|
|
c87e3b2164 | ||
|
|
6cf1f8636c | ||
|
|
1c3565035c | ||
|
|
dafcf33255 | ||
|
|
869b9f23cb | ||
|
|
d830b16aa4 | ||
|
|
b50f6a9fbf | ||
|
|
23bc21f064 | ||
|
|
00cd237f61 | ||
|
|
765c0a227d | ||
|
|
37181d3084 | ||
|
|
415ecad24c | ||
|
|
92f3696e44 | ||
|
|
0b3585c150 | ||
|
|
bfaa8317e3 | ||
|
|
5de3eeda71 | ||
|
|
ff3adbb1d0 | ||
|
|
c3b502254b | ||
|
|
09c9af8454 | ||
|
|
b3ae294a6a | ||
|
|
c2637b1b0c | ||
|
|
27d8640fbc | ||
|
|
a452cecc44 | ||
|
|
9e1fb42783 | ||
|
|
071619b9bd | ||
|
|
4e6fbab26d | ||
|
|
134efbfb0f | ||
|
|
2356ff514d | ||
|
|
896f92b5a8 | ||
|
|
310ee32d75 | ||
|
|
bc000e9ca6 | ||
|
|
7b961f1284 | ||
|
|
ddd22ff486 | ||
|
|
8b9ac826fc | ||
|
|
441a412817 | ||
|
|
fc749b7375 | ||
|
|
8a9971ab7b | ||
|
|
fa0149773f | ||
|
|
5b220a0e06 | ||
|
|
25d9de10e2 | ||
|
|
2f803c963a | ||
|
|
0c25cf795f | ||
|
|
040d5d0d2c | ||
|
|
7020ab4a1f | ||
|
|
7640c06ccb | ||
|
|
452c80d829 | ||
|
|
2a8cfe58c4 | ||
|
|
f1242ee3f4 | ||
|
|
0c2c33f854 | ||
|
|
e69e193874 | ||
|
|
66c5daca49 | ||
|
|
4643acb0f8 | ||
|
|
a16a7e6a4d | ||
|
|
c817ad6bb6 | ||
|
|
cda0c41ad4 | ||
|
|
0a412ace9f | ||
|
|
f853299226 | ||
|
|
eb03ce358f | ||
|
|
34b628cc07 | ||
|
|
b0419cdbaf | ||
|
|
a96d547c20 | ||
|
|
fa4a6d71f6 | ||
|
|
560a3acfae | ||
|
|
afe1e0f20e | ||
|
|
cebb152416 | ||
|
|
b835bb2488 | ||
|
|
6d91cacc84 | ||
|
|
6d6490ab31 | ||
|
|
8c8b180371 | ||
|
|
e0697833da | ||
|
|
ddf0fcdecc | ||
|
|
f10ab21ce8 | ||
|
|
30bb39d71a | ||
|
|
d76c753483 | ||
|
|
835189adc9 | ||
|
|
22c57f444f | ||
|
|
39cd7d8ab7 | ||
|
|
3b4a57fa94 | ||
|
|
d748090b5c | ||
|
|
ee361271e7 | ||
|
|
5bb42e6107 | ||
|
|
bee9f92abb | ||
|
|
10d2b3cc9b | ||
|
|
3ff823a59f | ||
|
|
33a09cccc7 | ||
|
|
45be838f20 | ||
|
|
695efc00a8 | ||
|
|
b915accb71 | ||
|
|
3a5bd4e216 | ||
|
|
66579793c2 | ||
|
|
e0a16bcf0a | ||
|
|
e8550728d1 | ||
|
|
3b23e7be6f | ||
|
|
601528d752 | ||
|
|
c2cd1c40cf | ||
|
|
3e024d21ed | ||
|
|
bdd544e87e | ||
|
|
c307386190 | ||
|
|
458f493150 | ||
|
|
08faee9cab | ||
|
|
d84c6d08c3 | ||
|
|
2468082be9 | ||
|
|
e67cbceb7d | ||
|
|
13ef262bc2 | ||
|
|
166424a878 | ||
|
|
53f36bcebb | ||
|
|
8db7821032 | ||
|
|
793d02a706 | ||
|
|
3af6f11f9f | ||
|
|
2201fbe80c | ||
|
|
9e167474a2 | ||
|
|
4a59b4b0f4 | ||
|
|
6c0b92e808 | ||
|
|
d3342a04c9 | ||
|
|
7dfb0ea7b6 | ||
|
|
f3c376a31f | ||
|
|
de8ef8dc58 | ||
|
|
dd3075be56 | ||
|
|
4872e5352b | ||
|
|
ca5e4d2702 | ||
|
|
814984d5bf | ||
|
|
091bf37b6d | ||
|
|
9b9c9db683 | ||
|
|
5529bbc6e1 | ||
|
|
98bc4e2dbb | ||
|
|
31029bc8f1 | ||
|
|
3cdcca3b0b | ||
|
|
9b0db4a807 | ||
|
|
547e733c65 | ||
|
|
cfda89a2f6 | ||
|
|
56b8ed1d73 | ||
|
|
a7fa9f3a29 | ||
|
|
221336f634 | ||
|
|
f3c9ba475f | ||
|
|
edcfe685d8 | ||
|
|
6cc1d8e3c0 | ||
|
|
de380357ee | ||
|
|
143bded648 | ||
|
|
0536ac29ae | ||
|
|
aed4b42191 | ||
|
|
87f1bfbdd6 | ||
|
|
4e4cae4a77 | ||
|
|
8f8d6ba420 | ||
|
|
6573e8606f | ||
|
|
e1c0614265 | ||
|
|
5f0e421550 | ||
|
|
c19afda58c | ||
|
|
2cde4bb5a0 | ||
|
|
b1bd7a870e | ||
|
|
41a8400095 | ||
|
|
59e6aff70a | ||
|
|
9d2e2210d1 | ||
|
|
79cee1cbdc | ||
|
|
cacf228511 | ||
|
|
52973d2a34 | ||
|
|
4f8ea94ee8 | ||
|
|
b1ce0be682 | ||
|
|
edf66cc076 | ||
|
|
c949590f80 | ||
|
|
8f5acff0a6 | ||
|
|
cf9768ba96 | ||
|
|
78fe83bddc | ||
|
|
31d60eb1ba | ||
|
|
0e82f652a9 | ||
|
|
882774311a | ||
|
|
554e7cfd52 | ||
|
|
ea83830f17 | ||
|
|
41cdc6e650 | ||
|
|
fb93527b44 | ||
|
|
b6fa064b0b | ||
|
|
5ccb5f1ec9 | ||
|
|
beee67b3eb | ||
|
|
23617a63e9 | ||
|
|
66d013f510 | ||
|
|
538ec01507 | ||
|
|
100cb940cb | ||
|
|
a7057d2568 | ||
|
|
0a126c1f71 | ||
|
|
46e0e23785 | ||
|
|
a4dd4eac02 | ||
|
|
9ac3e12487 | ||
|
|
5f78bbd7b7 | ||
|
|
eba6cbccde | ||
|
|
1d8149b5eb | ||
|
|
7de649d8c4 | ||
|
|
3d1a803ec9 | ||
|
|
8c5250403b | ||
|
|
3bcc0c408a | ||
|
|
08dae20aa0 | ||
|
|
5e36ca8e47 | ||
|
|
9ffecf62f7 | ||
|
|
a4e91fa66d | ||
|
|
574e03f685 | ||
|
|
6e199897ac | ||
|
|
e8b8d35cbd | ||
|
|
a57fef4947 | ||
|
|
abde532654 | ||
|
|
14e9b6ec59 | ||
|
|
32fdf05eb1 | ||
|
|
624da4c29a | ||
|
|
55661ee2e7 | ||
|
|
e5f0506a00 | ||
|
|
f18e7b275d | ||
|
|
f1a8097e06 | ||
|
|
3c0f19347d | ||
|
|
2008bc7da1 | ||
|
|
da0cb7d614 | ||
|
|
8c64ea798a | ||
|
|
af2fa3eee4 | ||
|
|
b702857aad | ||
|
|
a02fd2c695 | ||
|
|
259a5aa530 | ||
|
|
8e1e7ef0de | ||
|
|
05f9bb8141 | ||
|
|
ccca4eb653 | ||
|
|
699e6fe953 | ||
|
|
aa20c74131 | ||
|
|
9858327eb8 | ||
|
|
0a1cf060a5 | ||
|
|
4ff07ea5a9 | ||
|
|
340eeb32d7 | ||
|
|
fff587d9eb | ||
|
|
ec1bf1dcb7 | ||
|
|
a2fb92d988 | ||
|
|
a4884c504f | ||
|
|
fff974bbdb | ||
|
|
11d790d245 | ||
|
|
c1fc6b8f94 | ||
|
|
0450de481f | ||
|
|
bf95925878 | ||
|
|
9747e0f516 | ||
|
|
dd1ec53064 | ||
|
|
940b08b2c5 | ||
|
|
1f6c59ee41 | ||
|
|
818b5ea02a | ||
|
|
89f863d873 | ||
|
|
d334b697ae | ||
|
|
923e8ea5ab | ||
|
|
3ccabfbe44 | ||
|
|
fe520bf600 | ||
|
|
1750467d5b | ||
|
|
a4abf5feea | ||
|
|
d8d0096350 | ||
|
|
30b209b628 | ||
|
|
7c42f751a4 | ||
|
|
48294ea21b | ||
|
|
fe281cfade | ||
|
|
4c5817a922 | ||
|
|
0e0e3ee310 | ||
|
|
cec111beed | ||
|
|
260b6435cf | ||
|
|
de0c6952c7 | ||
|
|
f3e2d9ca39 | ||
|
|
803f93caab | ||
|
|
014859fd2f | ||
|
|
7dc0b4e261 | ||
|
|
f2893880b1 | ||
|
|
d5f6f69994 | ||
|
|
e901ad4dd0 | ||
|
|
5c74e0f296 | ||
|
|
49c9e87d6e | ||
|
|
8d5eab0ef8 | ||
|
|
dd1a8e22c5 | ||
|
|
8b70edeaf2 | ||
|
|
db96610c91 | ||
|
|
56a7707721 | ||
|
|
3090bc7763 | ||
|
|
9454bb3679 | ||
|
|
26c60c316a | ||
|
|
68302c01f1 | ||
|
|
a7afe057fb | ||
|
|
de81218dc0 | ||
|
|
4e4d380afd | ||
|
|
4216880d11 | ||
|
|
6d4323123f | ||
|
|
e1705c350e | ||
|
|
1950c11629 | ||
|
|
fab8717fcf | ||
|
|
32e86d8167 | ||
|
|
fd1fea2519 | ||
|
|
3de29e0316 | ||
|
|
ecd80cb4a4 | ||
|
|
618f853d63 | ||
|
|
c83d83b1a1 | ||
|
|
83cd10159d | ||
|
|
33990b819f | ||
|
|
ac2aef980c | ||
|
|
906002f809 | ||
|
|
069aec64c1 | ||
|
|
fb612eaddc | ||
|
|
363330e07a | ||
|
|
f9fd249fc4 | ||
|
|
7467aba75e | ||
|
|
c2de910f3c | ||
|
|
6e7837dc39 | ||
|
|
def0e3ef8d | ||
|
|
23776299a7 | ||
|
|
a49bf42407 | ||
|
|
f72b8c7614 | ||
|
|
b751621488 | ||
|
|
0521328465 | ||
|
|
0fe6e0ed75 | ||
|
|
e5f269cd88 | ||
|
|
3ab29d7022 | ||
|
|
7ad80e848f | ||
|
|
eae9725ccb | ||
|
|
7c5c4cb4ae | ||
|
|
feff6177c9 | ||
|
|
48c4f784c4 | ||
|
|
154860c66c | ||
|
|
10577aea68 | ||
|
|
2856ee3b6c | ||
|
|
b8dbb37b9b | ||
|
|
4e812c396d | ||
|
|
470033487c | ||
|
|
a72658d697 | ||
|
|
c57037030d | ||
|
|
9f23cd6361 | ||
|
|
f80825331e | ||
|
|
2ed4557536 |
@ -1,10 +0,0 @@
|
||||
dist
|
||||
coverage
|
||||
node_modules
|
||||
dest
|
||||
|
||||
comp-entry.ts
|
||||
config-entry.ts
|
||||
value-entry.ts
|
||||
|
||||
magic-admin/web/public/runtime
|
||||
68
.eslintrc.js
68
.eslintrc.js
@ -1,68 +0,0 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
node: true,
|
||||
browser: true,
|
||||
es2021: true,
|
||||
},
|
||||
globals: {
|
||||
describe: true,
|
||||
it: true,
|
||||
expect: true,
|
||||
beforeEach: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint-config-tencent',
|
||||
'eslint-config-tencent/ts',
|
||||
'plugin:vue/vue3-essential',
|
||||
'eslint-config-tencent/prettier',
|
||||
],
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
parser: '@typescript-eslint/parser',
|
||||
extraFileExtensions: ['.vue'],
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: [
|
||||
'vue',
|
||||
'@typescript-eslint',
|
||||
'simple-import-sort'
|
||||
],
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'vue/no-mutating-props': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
"@typescript-eslint/no-misused-promises": [
|
||||
"error",
|
||||
{
|
||||
"checksVoidReturn": false
|
||||
}
|
||||
],
|
||||
'simple-import-sort/imports': [
|
||||
"error", {
|
||||
groups: [
|
||||
['./polyfills'],
|
||||
// Node.js builtins. You could also generate this regex if you use a `.js` config.
|
||||
// For example: `^(${require("module").builtinModules.join("|")})(/|$)`
|
||||
[
|
||||
"^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)",
|
||||
],
|
||||
// Packages. `react|vue` related packages come first.
|
||||
["^(react|vue|vite)", "^@?\\w"],
|
||||
["^(@tmagic)(/.*|$)"],
|
||||
// Internal packages.
|
||||
["^(@|@editor)(/.*|$)"],
|
||||
// Side effect imports.
|
||||
["^\\u0000"],
|
||||
// Parent imports. Put `..` last.
|
||||
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
||||
// Other relative imports. Put same-folder imports and `.` last.
|
||||
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
||||
// Style imports.
|
||||
["^.+\\.s?css$"],
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
};
|
||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
50
.github/workflows/pages.yml
vendored
Normal file
50
.github/workflows/pages.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
pages:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: dev
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Set node version to 22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'pnpm'
|
||||
|
||||
- run: pnpm bootstrap
|
||||
|
||||
- name: Build VuePress site
|
||||
run: npm run docs:build
|
||||
|
||||
- name: Build Playground site
|
||||
run: npm run build:playground
|
||||
|
||||
- name: clean dist
|
||||
run: rm -rf dist
|
||||
|
||||
- name: mkdir dist
|
||||
run: mkdir dist && mkdir dist/docs && mkdir dist/playground
|
||||
|
||||
- name: move to dist
|
||||
run: mv docs/.vitepress/dist/* dist/docs && mv playground/dist/* dist/playground
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: crazy-max/ghaction-github-pages@v2
|
||||
with:
|
||||
target_branch: gh-pages
|
||||
build_dir: dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,6 +1,11 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
dist
|
||||
types
|
||||
|
||||
.temp
|
||||
.cache
|
||||
temp
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
@ -22,3 +27,10 @@ pnpm-debug.log*
|
||||
*.sw?
|
||||
|
||||
coverage
|
||||
|
||||
auto-imports.d.ts
|
||||
components.d.ts
|
||||
docs/.vitepress/cache
|
||||
|
||||
.eslintcache
|
||||
.npmrc
|
||||
|
||||
@ -1,4 +1 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx --no-install commitlint --edit $1
|
||||
@ -1,4 +1 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged
|
||||
npx lint-staged && npm run check:type
|
||||
|
||||
@ -1,4 +1 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm test
|
||||
|
||||
3333
CHANGELOG.md
Normal file
3333
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ $ git clone git@github.com:<yourname>/tmagic-editor.git
|
||||
```bash
|
||||
$ git remote add <name> <url>
|
||||
# 例如:
|
||||
$ git remote add wepy git@github.com:Tencent/tmagic-editor.git
|
||||
$ git remote add tmagic git@github.com:Tencent/tmagic-editor.git
|
||||
```
|
||||
|
||||
#### 保持与 tmagic-editor 仓库的同步
|
||||
|
||||
479
LICENSE
479
LICENSE
@ -1,6 +1,6 @@
|
||||
Tencent is pleased to support the open source community by making TMagicEditor available.
|
||||
|
||||
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
Copyright (C) 2025 Tencent. All rights reserved.
|
||||
|
||||
TMagicEditor is licensed under the Apache License Version 2.0 except for the third-party components listed below.
|
||||
|
||||
@ -74,15 +74,6 @@ Open Source Software Licensed under the Apache License Version 2.0:
|
||||
1. typescript
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
2. log4js
|
||||
Copyright 2015 Gareth Jones (with contributions from many other people)
|
||||
|
||||
3. reflect-metadata
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
4. xlsx
|
||||
Copyright (C) 2013-present SheetJS
|
||||
|
||||
|
||||
Terms of the Apache License Version 2.0:
|
||||
--------------------------------------------------------------------
|
||||
@ -355,8 +346,8 @@ Open Source Software Licensed under the BSD 2-Clause License:
|
||||
1. @typescript-eslint/parser
|
||||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
|
||||
2. uglify-js
|
||||
Copyright 2012-2019 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
||||
2. terser
|
||||
Copyright 2012-2018 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
||||
|
||||
|
||||
Terms of the BSD 2-Clause License:
|
||||
@ -390,8 +381,8 @@ Open Source Software Licensed under the BSD 3-Clause License:
|
||||
Copyright 2014 Yahoo! Inc.
|
||||
All rights reserved.
|
||||
|
||||
2. serialize-javascript
|
||||
Copyright 2014 Yahoo! Inc.
|
||||
2. highlight.js
|
||||
Copyright (c) 2006, Ivan Sagalaev.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@ -411,11 +402,14 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
|
||||
Open Source Software Licensed under the ISC License:
|
||||
--------------------------------------------------------------------
|
||||
1. raiz
|
||||
Copyright raiz original authour and authors
|
||||
1. c8
|
||||
Copyright (c) 2017, Contributors
|
||||
|
||||
2. axios-jsonp
|
||||
Copyright (c) Adonis
|
||||
2. picocolors
|
||||
Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
|
||||
|
||||
3. semver
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
|
||||
Terms of the ISC License:
|
||||
@ -428,232 +422,239 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE
|
||||
|
||||
Open Source Software Licensed under the MIT License:
|
||||
--------------------------------------------------------------------
|
||||
1. events
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
2. vite-plugin-dts
|
||||
Copyright (c) 2021-present qmhc
|
||||
|
||||
3. color
|
||||
Copyright (c) 2012 Heather Arthur
|
||||
|
||||
4. element-plus
|
||||
Copyright element-plus original authour and authors
|
||||
|
||||
5. @types/node
|
||||
Copyright (c) Microsoft TypeScript, DefinitelyTyped, Alberto Schiabel, Alvis HT Tang, Andrew Makarov, Benjamin Toueg, Chigozirim C., David Junger, Deividas Bakanas, Eugene Y. Q. Shen, Hannes Magnusson, Hoàng Văn Khải, Huw, Kelvin Jin, Klaus Meinhardt, Lishude, Mariusz Wiktorczyk, Mohsen Azimi, Nicolas Even, Nikita Galkin, Parambir Singh, Sebastian Silbermann, Simon Schick, Thomas den Hollander, Wilco Bakker, wwwy3y3, Zane Hannan AU, Samuel Ainsworth, Kyle Uehlein, Thanik Bhongbhibhat, Marcin Kopacz, Trivikram Kamat, Junxiao Shi, Ilia Baryshnikov, and ExE Boss.
|
||||
|
||||
6. vue
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
7. @vitejs/plugin-vue
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and contributors
|
||||
|
||||
8. @vitejs/plugin-vue-jsx
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
9. @vue/compiler-sfc
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
10. @vue/test-utils
|
||||
Copyright (c) 2021-present vuejs
|
||||
|
||||
11. sass
|
||||
Copyright (c) 2016, Google Inc.
|
||||
|
||||
12. vue-tsc
|
||||
Copyright (c) 2021-present Johnson Chu
|
||||
|
||||
13. moment
|
||||
Copyright (c) JS Foundation and other contributors
|
||||
|
||||
14. sortablejs
|
||||
Copyright (c) 2019 All contributors to Sortable
|
||||
|
||||
15. @scena/guides
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
16. moveable
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
17. delegate
|
||||
Copyright (c) Zeno Rocha
|
||||
|
||||
18. tiny-emitter
|
||||
Copyright (c) 2017 Scott Corgan
|
||||
|
||||
19. @testing-library/vue
|
||||
Copyright (c) 2018 Daniel Cook
|
||||
Copyright (c) 2017 Kent C. Dodds
|
||||
|
||||
20. react
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
21. react-dom
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
22. vue
|
||||
Copyright (c) 2013-present, Yuxi (Evan) You
|
||||
|
||||
23. @vue/composition-api
|
||||
Copyright (c) 2019-present, liximomo(X.L)
|
||||
|
||||
24. vite-plugin-vue2
|
||||
Copyright © underfin
|
||||
|
||||
25. vue-template-compiler
|
||||
Copyright (c)-present, Yuxi (Evan) You
|
||||
|
||||
26. rollup-plugin-external-globals
|
||||
Copyright (c) 2018 eight
|
||||
|
||||
27. recast
|
||||
Copyright (c) 2012 Ben Newman <bn@cs.stanford.edu>
|
||||
|
||||
28. @babel/preset-env
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
29. @vitejs/plugin-react-refresh
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
30. @commitlint/cli
|
||||
1. @commitlint/cli
|
||||
Copyright (c) 2016 - present Mario Nebl
|
||||
|
||||
31. @commitlint/config-conventional
|
||||
2. @commitlint/config-conventional
|
||||
Copyright (c) 2016 - present Mario Nebl
|
||||
|
||||
32. @typescript-eslint/eslint-plugin
|
||||
3. @element-plus/icons-vue
|
||||
Copyright (c) element-plus contributors
|
||||
|
||||
4. @eslint/js
|
||||
Copyright OpenJS Foundation and other contributors
|
||||
|
||||
5. @popperjs/core
|
||||
Copyright (c) 2019 Federico Zivolo
|
||||
|
||||
6. @scena/guides
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
7. @stylistic/eslint-plugin
|
||||
Copyright (c) Anthony Fu
|
||||
|
||||
8. @types/events
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
9. @types/fs-extra
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
10. @types/lodash-es
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
11. @types/node
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
12. @types/qrcode
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
13. @types/react
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
14. @types/react-dom
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
15. @types/serialize-javascript
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
16. @types/sortablejs
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
17. @typescript-eslint/eslint-plugin
|
||||
Copyright (c) 2019 TypeScript ESLint and other contributors
|
||||
|
||||
33. @vue/cli-plugin-babel
|
||||
Copyright (c) 2017-present, Yuxi (Evan) You
|
||||
18. @vitejs/plugin-legacy
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
34. @vue/cli-plugin-unit-jest
|
||||
Copyright (c) 2017-present, Yuxi (Evan) You
|
||||
19. @vitejs/plugin-react-refresh
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
35. babel-eslint
|
||||
Copyright (c) 2014-2016 Sebastian McKenzie <sebmck@gmail.com>
|
||||
20. @vitejs/plugin-vue
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and contributors
|
||||
|
||||
36. cz-conventional-changelog
|
||||
Copyright (c) 2015-2018 Commitizen Contributors
|
||||
21. @vitejs/plugin-vue-jsx
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
||||
|
||||
37. eslint
|
||||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
22. @vitest/coverage-v8
|
||||
Copyright (c) 2021-present, Anthony Fu and Vitest contributors
|
||||
|
||||
38. eslint-plugin-import
|
||||
Copyright (c) 2015 Ben Mosher
|
||||
23. @vue/compiler-sfc
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
39. eslint-plugin-prettier
|
||||
Copyright © 2017 Andres Suarez and Teddy Katz
|
||||
24. @vue/test-utils
|
||||
Copyright (c) 2021-present vuejs
|
||||
|
||||
40. eslint-plugin-simple-import-sort
|
||||
Copyright (c) 2018, 2019, 2020 Simon Lydell
|
||||
|
||||
41. eslint-plugin-vue
|
||||
Copyright (c) 2017 Toru Nagashima
|
||||
|
||||
42. husky
|
||||
Copyright (c) 2021 typicode
|
||||
|
||||
43. lerna
|
||||
Copyright (c) 2015-present Lerna Contributors
|
||||
|
||||
44. lint-staged
|
||||
Copyright (c) 2016 Andrey Okonetchnikov
|
||||
|
||||
45. prettier
|
||||
Copyright © James Long and contributors
|
||||
|
||||
46. vue-jest
|
||||
Copyright (c) 2017 Edd Yerburgh
|
||||
|
||||
47. axios
|
||||
25. axios
|
||||
Copyright (c) 2014-present Matt Zabriskie
|
||||
|
||||
48. core-js
|
||||
Copyright (c) 2014-2021 Denis Pushkarev
|
||||
26. buffer
|
||||
Copyright (c) Feross Aboukhadijeh, and other contributors
|
||||
|
||||
49. js-cookie
|
||||
Copyright (c) 2018 Copyright 2018 Klaus Hartl, Fagner Brack, GitHub Contributors
|
||||
27. cac
|
||||
Copyright (c) egoist <0x142857@gmail.com>
|
||||
|
||||
50. vue-router
|
||||
Copyright (c) 2020 Eduardo San Martin Morote
|
||||
28. chokidar
|
||||
Copyright (c) Paul Miller (https://paulmillr.com)
|
||||
|
||||
51. koa
|
||||
Copyright (c) 2019 Koa contributors
|
||||
29. commitizen
|
||||
Copyright (c) 2015 Jim Cummins
|
||||
|
||||
52. koa-bodyparser
|
||||
Copyright (c) 2014 dead_horse
|
||||
30. conventional-changelog-cli
|
||||
Copyright (c) Steve Mao
|
||||
|
||||
53. koa-router
|
||||
Copyright (c) 2015 Alexander C. Mingoia
|
||||
31. cosmiconfig
|
||||
Copyright (c) 2015 David Clark
|
||||
|
||||
54. koa-send
|
||||
Copyright (c) 2020 Koa contributors
|
||||
32. cz-conventional-changelog
|
||||
Copyright (c) 2015-2018 Commitizen Contributors
|
||||
|
||||
55. module-alias
|
||||
Copyright (c) 2018, Nick Gavrilov
|
||||
33. dayjs
|
||||
Copyright (c) 2018-present, iamkun
|
||||
|
||||
56. mysql2
|
||||
Copyright (c) 2016 Andrey Sidorov (sidorares@yandex.ru) and contributors
|
||||
34. deep-object-diff
|
||||
Copyright (c) 2017 Matt Phillips
|
||||
|
||||
57. sequelize
|
||||
Copyright (c) 2014-present Sequelize contributors
|
||||
35. deep-state-observer
|
||||
Copyright (c) neuronet.io
|
||||
|
||||
58. sequelize-typescript
|
||||
Copyright (c) 2017 Robin Buschmann
|
||||
36. element-plus
|
||||
Copyright element-plus original authour and authors
|
||||
|
||||
59. lodash
|
||||
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
37. emmet-monaco-es
|
||||
Copyright (c) Troy
|
||||
|
||||
60. jest
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
38. enquirer
|
||||
Copyright (c) 2016-present, Jon Schlinkert
|
||||
|
||||
61. fs-extra
|
||||
39. esbuild
|
||||
Copyright (c) 2020 Evan Wallace
|
||||
|
||||
40. eslint
|
||||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
|
||||
41. eslint-config-prettier
|
||||
Copyright (c) 2017 Simon Lydell
|
||||
|
||||
42. eslint-plugin-import
|
||||
Copyright (c) 2015 Ben Mosher
|
||||
|
||||
43. eslint-plugin-prettier
|
||||
Copyright © 2017 Andres Suarez and Teddy Katz
|
||||
|
||||
44. eslint-plugin-simple-import-sort
|
||||
Copyright (c) 2018, 2019, 2020 Simon Lydell
|
||||
|
||||
45. eslint-plugin-vue
|
||||
Copyright (c) 2017 Toru Nagashima
|
||||
|
||||
46. events
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
47. execa
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com>
|
||||
|
||||
48. fs-extra
|
||||
Copyright (c) 2011-2017 JP Richardson
|
||||
|
||||
62. moment-timezone
|
||||
Copyright (c) JS Foundation and other contributors
|
||||
49. gesto
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
63. nodemon
|
||||
Copyright (C) Remy Sharp
|
||||
50. globals
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com>
|
||||
|
||||
64. ts-node
|
||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||
51. husky
|
||||
Copyright (c) 2021 typicode
|
||||
|
||||
65. tsconfig-paths
|
||||
Copyright (c) 2016 Jonas Kello
|
||||
52. jsdom
|
||||
Copyright (c) 2010 Elijah Insua
|
||||
|
||||
66. prettier
|
||||
Copyright © James Long and contributors
|
||||
53. keycon
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
67. @babel/core
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
54. lint-staged
|
||||
Copyright (c) 2016 Andrey Okonetchnikov
|
||||
|
||||
68. @babel/preset-typescript
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
55. merge-options
|
||||
Copyright (c) Michael Mayer
|
||||
|
||||
69. @types/fs-extra
|
||||
Copyright (c) Microsoft Corporation.
|
||||
56. minimist
|
||||
Copyright (c) James Halliday
|
||||
|
||||
70. @types/jest
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
71. @types/koa
|
||||
Copyright (C) DavidCai1993, jKey Lu, Brice Bernard, harryparkdotio, Wooram Jun, Christian Vaagland Tellnes, Piotr Kuczynski, and vnoder.
|
||||
|
||||
72. @types/koa-bodyparser
|
||||
Copyright (C) Jerry Chin, Anup Kishore, Hiroshi Ioka, Alexi Maschas, and Pirasis Leelatanon.
|
||||
|
||||
73. zepto
|
||||
Copyright (c) 2010-2016 Thomas Fuchs
|
||||
http://zeptojs.com/
|
||||
|
||||
74. monaco-editor
|
||||
57. monaco-editor
|
||||
Copyright (c) 2016 - present Microsoft Corporation
|
||||
|
||||
75. @types/koa-router
|
||||
Copyright (C) Jerry Chin, Pavel Ivanov, JounQin, Romain Faust, Guillaume Mayer, Andrea Gueugnaut, and Yves Kaufmann.
|
||||
58. moveable
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
59. moveable-helper
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
60. prettier
|
||||
Copyright © James Long and contributors
|
||||
|
||||
61. qrcode
|
||||
Copyright (c) Ryan Day
|
||||
|
||||
62. react
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
63. react-dom
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
64. recast
|
||||
Copyright (c) 2012 Ben Newman <bn@cs.stanford.edu>
|
||||
|
||||
65. rolldown
|
||||
Copyright (c) 2023-present Rolldown contributors
|
||||
|
||||
66. rolldown-plugin-dts
|
||||
Copyright (c) Kevin Deng
|
||||
|
||||
67. sass-embedded
|
||||
Copyright (c) 2019 Google Inc.
|
||||
|
||||
68. scenejs
|
||||
Copyright (c) 2019 Daybrush
|
||||
|
||||
69. shx
|
||||
Copyright (c) ShellJS contributors
|
||||
|
||||
70. sortablejs
|
||||
Copyright (c) 2019 All contributors to Sortable
|
||||
|
||||
71. tdesign-vue-next
|
||||
Copyright (c) Tencent
|
||||
|
||||
72. typescript-eslint
|
||||
Copyright (c) 2019 TypeScript ESLint and other contributors
|
||||
|
||||
73. vite-plugin-commonjs
|
||||
Copyright (c) vite-plugin contributors
|
||||
|
||||
74. vitepress
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You
|
||||
|
||||
75. vitest
|
||||
Copyright (c) 2021-present, Anthony Fu and Vitest contributors
|
||||
|
||||
76. vue
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
77. vue-router
|
||||
Copyright (c) 2020 Eduardo San Martin Morote
|
||||
|
||||
78. vue-tsc
|
||||
Copyright (c) 2021-present Johnson Chu
|
||||
|
||||
|
||||
Terms of the MIT License:
|
||||
@ -5430,3 +5431,73 @@ Repository: github:eemeli/yaml
|
||||
> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
> THIS SOFTWARE.
|
||||
|
||||
|
||||
|
||||
Open Source Software Licensed under the Zero-Clause BSD License (0BSD):
|
||||
--------------------------------------------------------------------
|
||||
1. tslib
|
||||
Copyright (c) Microsoft Corp.
|
||||
|
||||
|
||||
Terms of the Zero-Clause BSD License (0BSD):
|
||||
--------------------------------------------------------------------
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
|
||||
Open Source Software Licensed under the Blue Oak Model License 1.0.0:
|
||||
--------------------------------------------------------------------
|
||||
1. rimraf
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
|
||||
Terms of the Blue Oak Model License 1.0.0:
|
||||
--------------------------------------------------------------------
|
||||
Blue Oak Model License
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
Purpose
|
||||
|
||||
This license gives everyone as much permission to work with this software as possible, while protecting contributors from liability.
|
||||
|
||||
Acceptance
|
||||
|
||||
In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with this software that triggers a rule that you cannot or will not follow.
|
||||
|
||||
Copyright
|
||||
|
||||
Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it.
|
||||
|
||||
Notices
|
||||
|
||||
You must ensure that everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license or a link to https://blueoakcouncil.org/license/1.0.0.
|
||||
|
||||
Excuse
|
||||
|
||||
If anyone notifies you in writing that you have not complied with Notices, you can keep your license by taking all practical steps to comply within 30 days after the notice. If you do not do so, your license ends immediately.
|
||||
|
||||
Patent
|
||||
|
||||
Each contributor licenses you to do everything with this software that would otherwise infringe any patent claims they can license or become able to license.
|
||||
|
||||
Reliability
|
||||
|
||||
No contributor can revoke this license.
|
||||
|
||||
No Liability
|
||||
|
||||
As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim.
|
||||
|
||||
|
||||
|
||||
Open Source Software Licensed under the (MIT OR CC0-1.0) License:
|
||||
--------------------------------------------------------------------
|
||||
1. type-fest
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
|
||||
A copy of the MIT License is included in this file.
|
||||
|
||||
|
||||
19
README.md
19
README.md
@ -16,7 +16,9 @@ https://tencent.github.io/tmagic-editor/playground/index.html
|
||||
|
||||
## 环境准备
|
||||
|
||||
node.js >= 16
|
||||
node.js >= 18
|
||||
|
||||
pnpm >= 9
|
||||
|
||||
先安装 pnpm
|
||||
|
||||
@ -40,10 +42,14 @@ $ pnpm playground
|
||||
|
||||
最后在浏览器中打开
|
||||
|
||||
http://localhost:8098/
|
||||
http://localhost:8098/tmagic-editor/playground/
|
||||
|
||||
即可得到一个魔方编辑器示例项目
|
||||
|
||||
## magic-admin
|
||||
|
||||
已迁移至 https://github.com/vft-magic/tmagic-admin
|
||||
|
||||
## 项目介绍
|
||||
在本项目中,我们核心内容,是包含在 `packages/editor` 中的编辑器,以及 `runtime` 和 `packages/ui` 提供的各个前端框架相关的 runtime 和 ui。
|
||||
|
||||
@ -71,10 +77,19 @@ runtime 是魔方提供的页面渲染环境。通过加载在编辑器中产出
|
||||
### 使用
|
||||
playground 的示例项目,就是为开发者提供的基础应用示例。开发者可以基于此或者参考自行实现,搭建一个基于魔方的可视化搭建平台。
|
||||
|
||||
tmagic-editor主要定位是搭建生成移动端H5页面,如果有搭建PC端低代码平台的需求,可以了解一下腾讯出品的另外一个低代码平台:[无极低代码平台](https://wujicode.cn?from=tmagic)。
|
||||
|
||||
### 参与贡献
|
||||
|
||||
如果你有好的意见或建议,欢迎给我们提 Issues 或 Pull Requests,为提升魔方可视化编辑器开发体验贡献力量。<br>详见:[CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
## 贡献者
|
||||
|
||||
<a href="https://github.com/Tencent/tmagic-editor/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Tencent/tmagic-editor" />
|
||||
</a>
|
||||
|
||||
|
||||
### 欢迎入群交流
|
||||
|
||||
<img src="https://vfiles.gtimg.cn/vupload/20220412/b85d331649748582992.jpg" width=375>
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
presets: ['@vue/cli-plugin-babel/preset'],
|
||||
};
|
||||
@ -1 +1 @@
|
||||
module.exports = { extends: ['@commitlint/config-conventional'] };
|
||||
export default { extends: ['@commitlint/config-conventional'] };
|
||||
|
||||
3
docs/.gitignore
vendored
3
docs/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
.temp
|
||||
.cache
|
||||
577
docs/.vitepress/config.ts
Normal file
577
docs/.vitepress/config.ts
Normal file
@ -0,0 +1,577 @@
|
||||
import path from 'path';
|
||||
import { defineConfig } from 'vitepress'
|
||||
|
||||
export default defineConfig({
|
||||
title: 'tmagic-editor',
|
||||
description: '页面可视化平台',
|
||||
|
||||
base: '/tmagic-editor/docs/',
|
||||
|
||||
head: [
|
||||
['meta', { name: 'theme-color', content: '#646cff' }],
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
logo: './favicon.png',
|
||||
|
||||
search: {
|
||||
provider: 'local'
|
||||
},
|
||||
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/Tencent/tmagic-editor' }
|
||||
],
|
||||
|
||||
footer: {
|
||||
message: 'Powered by 腾讯视频会员平台技术中心',
|
||||
copyright: 'Copyright (C) 2025 Tencent.'
|
||||
},
|
||||
|
||||
nav: [
|
||||
{ text: '文档', link: '/guide/', activeMatch: '/guide/' },
|
||||
{ text: 'Editor API', link: '/api/editor/props', activeMatch: '/api/' },
|
||||
{ text: 'Runtime API', link: '/runtime-api/core/app', activeMatch: '/runtime-api/' },
|
||||
{ text: '表单配置', link: '/form-config/fields/text', activeMatch: '/form-config/' },
|
||||
{ text: '更新日志', link: 'https://github.com/Tencent/tmagic-editor/releases' },
|
||||
{ text: 'Playground', link: 'https://tencent.github.io/tmagic-editor/playground/index.html' },
|
||||
],
|
||||
|
||||
sidebar: {
|
||||
'/guide/': [
|
||||
{
|
||||
text: '文档',
|
||||
items: [
|
||||
{
|
||||
text: '介绍',
|
||||
link: '/guide/introduction.md'
|
||||
},
|
||||
{
|
||||
text: '快速开始',
|
||||
link: '/guide/'
|
||||
},
|
||||
{
|
||||
text: 'RUNTIME',
|
||||
link: '/guide/runtime.md'
|
||||
},
|
||||
{
|
||||
text: '组件开发',
|
||||
link: '/guide/component.md'
|
||||
},
|
||||
{
|
||||
text: '基础概念',
|
||||
link: '/guide/conception.md',
|
||||
},
|
||||
{
|
||||
text: '页面发布',
|
||||
link: '/guide/publish.md'
|
||||
},
|
||||
{
|
||||
text: '编辑器扩展',
|
||||
link: '/guide/editor-expand.md'
|
||||
},
|
||||
{
|
||||
text: '升级到1.5.x',
|
||||
link: '/guide/migration.md'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '进阶指南',
|
||||
items: [
|
||||
{
|
||||
text: 'JS Schema',
|
||||
link: '/guide/advanced/js-schema.md',
|
||||
},
|
||||
{
|
||||
text: '布局原理',
|
||||
link: '/guide/advanced/layout.md',
|
||||
},
|
||||
{
|
||||
text: '页面渲染',
|
||||
link: '/guide/advanced/page.md',
|
||||
},
|
||||
{
|
||||
text: '联动原理',
|
||||
link: '/guide/advanced/coupling.md',
|
||||
},
|
||||
{
|
||||
text: '代码块',
|
||||
link: '/guide/advanced/code-block.md',
|
||||
},
|
||||
{
|
||||
text: '数据源',
|
||||
link: '/guide/advanced/data-source.md'
|
||||
},
|
||||
{
|
||||
text: '@tmagic/ui',
|
||||
link: '/guide/advanced/tmagic-ui.md',
|
||||
},
|
||||
{
|
||||
text: '@tmagic/form',
|
||||
link: '/guide/advanced/tmagic-form.md',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '教程',
|
||||
items: [
|
||||
{
|
||||
text: '写在前面',
|
||||
link: '/guide/tutorial/'
|
||||
},
|
||||
{
|
||||
text: '1.Hello World',
|
||||
link: '/guide/tutorial/hello-world.md'
|
||||
},
|
||||
{
|
||||
text: '2.Runtime',
|
||||
link: '/guide/tutorial/runtime.md'
|
||||
},
|
||||
{
|
||||
text: '3.DSL解析渲染',
|
||||
link: '/guide/tutorial/render.md'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'/api/': [
|
||||
{
|
||||
text: '编辑器',
|
||||
items: [
|
||||
{
|
||||
text: 'Editor组件',
|
||||
items: [
|
||||
{
|
||||
text: 'props',
|
||||
link: '/api/editor/props.md'
|
||||
},
|
||||
{
|
||||
text: 'slots',
|
||||
link: '/api/editor/slots.md'
|
||||
},
|
||||
{
|
||||
text: 'events',
|
||||
link: '/api/editor/events.md'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'editorService',
|
||||
items: [
|
||||
{
|
||||
text: '方法',
|
||||
link: '/api/editor/editorServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: '事件',
|
||||
link: '/api/editor/editorServiceEvents.md',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'propsService',
|
||||
items: [
|
||||
{
|
||||
text: '方法',
|
||||
link: '/api/editor/propsServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: '事件',
|
||||
link: '/api/editor/propsServiceEvents.md',
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'historyService',
|
||||
items: [
|
||||
{
|
||||
text: '方法',
|
||||
link: '/api/editor/historyServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: '事件',
|
||||
link: '/api/editor/historyServiceEvents.md',
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'eventsService',
|
||||
link: '/api/editor/eventsServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: 'uiService',
|
||||
link: '/api/editor/uiServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: 'codeBlockService',
|
||||
link: '/api/editor/codeBlockServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: 'componentListService',
|
||||
link: '/api/editor/componentListServiceMethods.md',
|
||||
},
|
||||
{
|
||||
text: 'storageService',
|
||||
link: '/api/editor/storageServiceMethods.md',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '表单',
|
||||
items: [
|
||||
{
|
||||
text: 'Form组件',
|
||||
items: [
|
||||
{
|
||||
text: 'props',
|
||||
link: '/api/form/form-props'
|
||||
},
|
||||
{
|
||||
text: 'methods',
|
||||
link: '/api/form/form-methods'
|
||||
},
|
||||
{
|
||||
text: 'events',
|
||||
link: '/api/form/form-events'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'FormDialog组件',
|
||||
items: [
|
||||
{
|
||||
text: 'props',
|
||||
link: '/api/form/form-dialog-props'
|
||||
},
|
||||
{
|
||||
text: 'methods',
|
||||
link: '/api/form/form-dialog-methods'
|
||||
},
|
||||
{
|
||||
text: 'events',
|
||||
link: '/api/form/form-dialog-events'
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '表格',
|
||||
items: [
|
||||
{
|
||||
text: 'Table组件',
|
||||
items: [
|
||||
{
|
||||
text: 'props',
|
||||
link: '/api/table/props'
|
||||
},
|
||||
{
|
||||
text: 'methods',
|
||||
link: '/api/table/methods'
|
||||
},
|
||||
{
|
||||
text: 'events',
|
||||
link: '/api/table/events'
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'stage',
|
||||
items: [
|
||||
{
|
||||
text: 'StageCore',
|
||||
items: [
|
||||
{
|
||||
text: '方法',
|
||||
link: '/api/stage/coreMethods',
|
||||
},
|
||||
{
|
||||
text: '事件',
|
||||
link: '/api/stage/coreEvents',
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'/form-config/': [
|
||||
{
|
||||
text: '基础配置',
|
||||
items: [
|
||||
{
|
||||
text: 'Input输入框',
|
||||
link: '/form-config/fields/text.md'
|
||||
},
|
||||
{
|
||||
text: 'Textarea文本域',
|
||||
link: '/form-config/fields/textarea.md'
|
||||
},
|
||||
{
|
||||
text: 'InputNumber计数器',
|
||||
link: '/form-config/fields/number.md'
|
||||
},
|
||||
{
|
||||
text: 'NumberRange数字范围',
|
||||
link: '/form-config/fields/number-range.md'
|
||||
},
|
||||
{
|
||||
text: 'Display只读文本',
|
||||
link: '/form-config/fields/display.md'
|
||||
},
|
||||
{
|
||||
text: 'Hidden隐藏域',
|
||||
link: '/form-config/fields/hidden.md'
|
||||
},
|
||||
{
|
||||
text: 'Link链接',
|
||||
link: '/form-config/fields/link.md'
|
||||
},
|
||||
{
|
||||
text: 'Checkbox多选框',
|
||||
link: '/form-config/fields/checkbox.md'
|
||||
},
|
||||
{
|
||||
text: 'Radio单选框',
|
||||
link: '/form-config/fields/radio.md'
|
||||
},
|
||||
{
|
||||
text: 'Switch开关',
|
||||
link: '/form-config/fields/switch.md'
|
||||
},
|
||||
{
|
||||
text: 'Select选择器',
|
||||
link: '/form-config/fields/select.md'
|
||||
},
|
||||
{
|
||||
text: 'Cascader级联选择器',
|
||||
link: '/form-config/fields/cascader.md'
|
||||
},
|
||||
{
|
||||
text: 'ColorPicker颜色选择器',
|
||||
link: '/form-config/fields/color-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'DatePick日期选择器',
|
||||
link: '/form-config/fields/date-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'DateRangePick日期范围选择器',
|
||||
link: '/form-config/fields/daterange-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'DatetimePick日期时间选择器',
|
||||
link: '/form-config/fields/datetime-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'TimePick时间选择器',
|
||||
link: '/form-config/fields/time-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'TimeRangePick时间范围选择器',
|
||||
link: '/form-config/fields/timerange-picker.md'
|
||||
},
|
||||
{
|
||||
text: 'DynamicField动态表单',
|
||||
link: '/form-config/fields/dynamic-field.md'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '编辑器中可用配置',
|
||||
items: [
|
||||
{
|
||||
text: 'Code代码编辑器',
|
||||
link: '/form-config/editor-fields/code.md'
|
||||
},
|
||||
{
|
||||
text: 'CodeLink代码链接',
|
||||
link: '/form-config/editor-fields/code-link.md'
|
||||
},
|
||||
{
|
||||
text: 'CodeSelect代码块选择器',
|
||||
link: '/form-config/editor-fields/code-select.md'
|
||||
},
|
||||
{
|
||||
text: 'CodeSelectCol代码块选择列',
|
||||
link: '/form-config/editor-fields/code-select-col.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceSelect数据源选择器',
|
||||
link: '/form-config/editor-fields/data-source-select.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceFieldSelect数据源字段选择器',
|
||||
link: '/form-config/editor-fields/data-source-field-select.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceMethodSelect数据源方法选择器',
|
||||
link: '/form-config/editor-fields/data-source-method-select.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceFields数据源字段配置',
|
||||
link: '/form-config/editor-fields/data-source-fields.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceInput数据源输入框',
|
||||
link: '/form-config/editor-fields/data-source-input.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceMethods数据源方法配置',
|
||||
link: '/form-config/editor-fields/data-source-methods.md'
|
||||
},
|
||||
{
|
||||
text: 'DataSourceMocks数据源Mock配置',
|
||||
link: '/form-config/editor-fields/data-source-mocks.md'
|
||||
},
|
||||
{
|
||||
text: 'UISelect组件选择器',
|
||||
link: '/form-config/editor-fields/ui-select.md'
|
||||
},
|
||||
{
|
||||
text: 'KeyValue键值对',
|
||||
link: '/form-config/editor-fields/key-value.md'
|
||||
},
|
||||
{
|
||||
text: 'PageFragmentSelect页面片选择器',
|
||||
link: '/form-config/editor-fields/page-fragment-select.md'
|
||||
},
|
||||
{
|
||||
text: 'EventSelect事件选择器',
|
||||
link: '/form-config/editor-fields/event-select.md'
|
||||
},
|
||||
{
|
||||
text: 'DisplayConds显示条件配置',
|
||||
link: '/form-config/editor-fields/display-conds.md'
|
||||
},
|
||||
{
|
||||
text: 'CondOpSelect条件操作选择器',
|
||||
link: '/form-config/editor-fields/cond-op-select.md'
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '布局配置',
|
||||
items: [
|
||||
{
|
||||
text: '布局',
|
||||
link: '/form-config/layout.md',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '联动配置',
|
||||
items: [
|
||||
{
|
||||
text: '联动',
|
||||
link: '/form-config/relate.md',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '表单对比',
|
||||
items: [
|
||||
{
|
||||
text: '表单对比',
|
||||
link: '/form-config/compare.md',
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'/runtime-api/': [
|
||||
{
|
||||
text: '@tmagic/core',
|
||||
items: [
|
||||
{
|
||||
text: 'App',
|
||||
link: '/runtime-api/core/app',
|
||||
},
|
||||
{
|
||||
text: 'Node',
|
||||
link: '/runtime-api/core/node',
|
||||
},
|
||||
{
|
||||
text: 'Page',
|
||||
link: '/runtime-api/core/page',
|
||||
},
|
||||
{
|
||||
text: 'EventHelper',
|
||||
link: '/runtime-api/core/eventHelper',
|
||||
},
|
||||
{
|
||||
text: 'Env',
|
||||
link: '/runtime-api/core/env',
|
||||
},
|
||||
{
|
||||
text: 'IteratorContainer',
|
||||
link: '/runtime-api/core/iteratorContainer',
|
||||
},
|
||||
{
|
||||
text: 'FlowState',
|
||||
link: '/runtime-api/core/flowState',
|
||||
},
|
||||
{
|
||||
text: 'DevtoolApi',
|
||||
link: '/runtime-api/core/devtoolApi',
|
||||
},
|
||||
{
|
||||
text: '工具函数',
|
||||
link: '/runtime-api/core/utils',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '@tmagic/data-source',
|
||||
items: [
|
||||
{
|
||||
text: 'DataSourceManager',
|
||||
link: '/runtime-api/data-source/dataSourceManager',
|
||||
},
|
||||
{
|
||||
text: 'DataSource',
|
||||
link: '/runtime-api/data-source/dataSource',
|
||||
},
|
||||
{
|
||||
text: 'HttpDataSource',
|
||||
link: '/runtime-api/data-source/httpDataSource',
|
||||
},
|
||||
{
|
||||
text: '观察者数据类',
|
||||
link: '/runtime-api/data-source/observedData',
|
||||
},
|
||||
{
|
||||
text: '工具函数',
|
||||
link: '/runtime-api/data-source/utils',
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
rolldownOptions: {
|
||||
transform: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias:[
|
||||
{ find: /^@tmagic\/form-schema/, replacement: path.join(__dirname, '../../packages/form-schema/src/index.ts') },
|
||||
{ find: /^@tmagic\/form/, replacement: path.join(__dirname, '../../packages/form/src/index.ts') },
|
||||
{ find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../packages/utils/src/index.ts') },
|
||||
{ find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../packages/schema/src/index.ts') },
|
||||
{ find: /^@tmagic\/design/, replacement: path.join(__dirname, '../../packages/design/src/index.ts') },
|
||||
{ find: /^@tmagic\/element-plus-adapter/, replacement: path.join(__dirname, '../../packages/element-plus-adapter/src/index.ts') },
|
||||
]
|
||||
},
|
||||
ssr: {
|
||||
noExternal: ['lodash-es'],
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -17,11 +17,7 @@
|
||||
<slot name="highlight"></slot>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="demo-block-control"
|
||||
ref="control"
|
||||
@click="isExpanded = !isExpanded"
|
||||
>
|
||||
<div class="demo-block-control" ref="control" @click="isExpanded = !isExpanded">
|
||||
<transition name="arrow-slide">
|
||||
<i :class="[iconClass, hovering]"></i>
|
||||
</transition>
|
||||
@ -30,23 +26,14 @@
|
||||
</transition>
|
||||
<el-tooltip effect="dark" :content="'前往 codepen.io 运行此示例'" placement="right">
|
||||
<transition name="text-slide">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
text
|
||||
class="control-button"
|
||||
@click.stop="goCodepen"
|
||||
>
|
||||
{{type === 'form' ? '查看结果' : '在线运行'}}
|
||||
<el-button size="small" type="primary" text class="control-button" @click.stop="goCodepen">
|
||||
{{ type === 'form' ? '查看结果' : '在线运行' }}
|
||||
</el-button>
|
||||
</transition>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="resultVisible"
|
||||
title="result"
|
||||
>
|
||||
<el-dialog v-model="resultVisible" title="result">
|
||||
<pre><code class="language-javascript hljs" v-html="result"></code></pre>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@ -60,7 +47,9 @@
|
||||
transition: 0.2s;
|
||||
|
||||
&.hover {
|
||||
box-shadow: 0 0 8px 0 rgba(232, 237, 250, 0.6), 0 2px 4px 0 rgba(232, 237, 250, 0.5);
|
||||
box-shadow:
|
||||
0 0 8px 0 rgba(232, 237, 250, 0.6),
|
||||
0 2px 4px 0 rgba(232, 237, 250, 0.5);
|
||||
}
|
||||
|
||||
code {
|
||||
@ -196,8 +185,9 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/babel" lang="ts">
|
||||
<script lang="ts">
|
||||
import hljs from 'highlight.js';
|
||||
import serialize from 'serialize-javascript';
|
||||
|
||||
export function stripScript(content) {
|
||||
const result = content.match(/<(script)>([\s\S]+)<\/\1>/);
|
||||
@ -218,9 +208,7 @@ export function stripTemplate(content) {
|
||||
}
|
||||
|
||||
export default {
|
||||
props: [
|
||||
'type', 'config'
|
||||
],
|
||||
props: ['type', 'config'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
@ -292,9 +280,15 @@ export default {
|
||||
},
|
||||
|
||||
text() {
|
||||
return this.isStringConfig ?
|
||||
hljs.highlight('js', this.config).value :
|
||||
hljs.highlight('json', JSON.stringify(this.config, null, 2)).value;
|
||||
return this.isStringConfig
|
||||
? hljs.highlight('js', this.config).value
|
||||
: hljs.highlight(
|
||||
'js',
|
||||
serialize(this.config, {
|
||||
space: 2,
|
||||
unsafe: true,
|
||||
}).replace(/"(\w+)":\s/g, '$1: '),
|
||||
).value;
|
||||
},
|
||||
|
||||
formConfig() {
|
||||
@ -303,7 +297,7 @@ export default {
|
||||
|
||||
isStringConfig() {
|
||||
return typeof this.config === 'string';
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
@ -352,7 +346,7 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
this.removeScrollHandler();
|
||||
},
|
||||
};
|
||||
46
docs/.vitepress/theme/index.ts
Normal file
46
docs/.vitepress/theme/index.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'highlight.js/styles/github.css';
|
||||
|
||||
import ElementPlus from 'element-plus';
|
||||
import Theme from 'vitepress/theme';
|
||||
|
||||
import TMagicDesign from '@tmagic/design';
|
||||
import MagicElementPlusAdapter from '@tmagic/element-plus-adapter';
|
||||
import MagicForm from '@tmagic/form';
|
||||
|
||||
import DemoBlock from './components/demo-block.vue';
|
||||
|
||||
import './styles/vars.css';
|
||||
|
||||
export default {
|
||||
...Theme,
|
||||
|
||||
enhanceApp({ app }) {
|
||||
app.use(ElementPlus);
|
||||
app.use(TMagicDesign, MagicElementPlusAdapter)
|
||||
app.use(MagicForm, {
|
||||
request: (options: any) => new Promise((resolve) => {
|
||||
if (options.url === 'select/remote') {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
data: [
|
||||
{
|
||||
name: 'select-1',
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
name: 'select-2',
|
||||
id: 2
|
||||
},
|
||||
],
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
resolve({});
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
app.component('demo-block', DemoBlock);
|
||||
},
|
||||
};
|
||||
10
docs/.vitepress/theme/styles/vars.css
Normal file
10
docs/.vitepress/theme/styles/vars.css
Normal file
@ -0,0 +1,10 @@
|
||||
:root {
|
||||
--vp-c-brand: #2882e0;
|
||||
--vp-button-brand-border: #2882e0;
|
||||
--vp-button-brand-hover-border: #2882e0;
|
||||
--vp-c-brand-light: #559ce7;
|
||||
--vp-c-brand-lighter: #2882e0;
|
||||
--vp-c-brand-lightest: #2882e0;
|
||||
--vp-c-brand-dark: #2882e0;
|
||||
--vp-c-brand-darker: #2882e0;
|
||||
}
|
||||
370
docs/api/editor/codeBlockServiceMethods.md
Normal file
370
docs/api/editor/codeBlockServiceMethods.md
Normal file
@ -0,0 +1,370 @@
|
||||
# codeBlockService方法
|
||||
|
||||
|
||||
|
||||
## setCodeDsl
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCodeDsl
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCodeContentById
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setCodeDslById
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCodeDslByIds
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setCodeEditorShowStatus
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCodeEditorShowStatus
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setCodeEditorContent
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCurrentDsl
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getEditStatus
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
## setEditStatus
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setId
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getId
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getMode
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setMode
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setCombineIds
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCombineIds
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## refreshAllRelations
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCombineInfo
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getUndeletableList
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setUndeleteableList
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## setCodeDraft
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getCodeDraft
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## removeCodeDraft
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## deleteCodeDslByIds
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## getUniqueId
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## deleteCompsInRelation
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
## use
|
||||
|
||||
使用中间件的方式扩展方法,上述方法中标记有`扩展支持: 是`的方法都支持使用use扩展
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
|
||||
104
docs/api/editor/componentListServiceMethods.md
Normal file
104
docs/api/editor/componentListServiceMethods.md
Normal file
@ -0,0 +1,104 @@
|
||||
# componentListService方法
|
||||
|
||||
## setList
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[ComponentGroup](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/editor/src/type.ts#L355)[]} componentGroupList 组件列表配置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置左侧面板的组件列表配置
|
||||
|
||||
:::tip
|
||||
该方法通常由编辑器内部调用,开发者可以通过 [m-editor 的 componentGroupList prop](./props.md#componentgrouplist) 来配置组件列表
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { componentListService } from '@tmagic/editor';
|
||||
|
||||
componentListService.setList([
|
||||
{
|
||||
title: '基础组件',
|
||||
items: [
|
||||
{
|
||||
icon: 'text-icon',
|
||||
text: '文本',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
icon: 'button-icon',
|
||||
text: '按钮',
|
||||
type: 'button',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
```
|
||||
|
||||
## getList
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[ComponentGroup](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/editor/src/type.ts#L355)[]} 组件列表配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取当前的组件列表配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { componentListService } from '@tmagic/editor';
|
||||
|
||||
const list = componentListService.getList();
|
||||
console.log(list);
|
||||
```
|
||||
|
||||
## resetState
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置组件列表状态,清空所有配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { componentListService } from '@tmagic/editor';
|
||||
|
||||
componentListService.resetState();
|
||||
```
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁 componentListService,清空状态并移除所有事件监听和插件
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { componentListService } from '@tmagic/editor';
|
||||
|
||||
componentListService.destroy();
|
||||
```
|
||||
541
docs/api/editor/dataSourceServiceMethods.md
Normal file
541
docs/api/editor/dataSourceServiceMethods.md
Normal file
@ -0,0 +1,541 @@
|
||||
# dataSourceService方法
|
||||
|
||||
## get
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{StateKey}` name 状态键名
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{any}` 对应的状态值
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取数据源服务的内部状态
|
||||
|
||||
可用的状态键:
|
||||
- `datasourceTypeList`: 数据源类型列表
|
||||
- `dataSources`: 当前数据源列表
|
||||
- `editable`: 是否可编辑
|
||||
- `configs`: 数据源表单配置
|
||||
- `values`: 数据源默认值
|
||||
- `events`: 数据源事件列表
|
||||
- `methods`: 数据源方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const dataSources = dataSourceService.get('dataSources');
|
||||
console.log(dataSources);
|
||||
```
|
||||
|
||||
## set
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{StateKey}` name 状态键名
|
||||
- `{any}` value 状态值
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置数据源服务的内部状态
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.set('editable', false);
|
||||
```
|
||||
|
||||
## getFormConfig
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型,默认为 'base'
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)} 表单配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定类型数据源的表单配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const config = dataSourceService.getFormConfig('http');
|
||||
console.log(config);
|
||||
```
|
||||
|
||||
## setFormConfig
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型
|
||||
- {[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)} config 表单配置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定类型数据源的表单配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.setFormConfig('http', [
|
||||
{
|
||||
name: 'url',
|
||||
text: '请求地址',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'method',
|
||||
text: '请求方法',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ text: 'GET', value: 'GET' },
|
||||
{ text: 'POST', value: 'POST' },
|
||||
],
|
||||
},
|
||||
]);
|
||||
```
|
||||
|
||||
## getFormValue
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型,默认为 'base'
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Partial<[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)>} 数据源默认值
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定类型数据源的默认值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const defaultValue = dataSourceService.getFormValue('http');
|
||||
console.log(defaultValue);
|
||||
```
|
||||
|
||||
## setFormValue
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型
|
||||
- {Partial<[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)>} value 数据源默认值
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定类型数据源的默认值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.setFormValue('http', {
|
||||
type: 'http',
|
||||
method: 'GET',
|
||||
url: '',
|
||||
});
|
||||
```
|
||||
|
||||
## getFormEvent
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型,默认为 'base'
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} 事件列表
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定类型数据源的事件列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const events = dataSourceService.getFormEvent('http');
|
||||
console.log(events);
|
||||
```
|
||||
|
||||
## setFormEvent
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} value 事件列表
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定类型数据源的事件列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.setFormEvent('http', [
|
||||
{ label: '请求成功', value: 'success' },
|
||||
{ label: '请求失败', value: 'error' },
|
||||
]);
|
||||
```
|
||||
|
||||
## getFormMethod
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型,默认为 'base'
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} 方法列表
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定类型数据源的方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const methods = dataSourceService.getFormMethod('http');
|
||||
console.log(methods);
|
||||
```
|
||||
|
||||
## setFormMethod
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 数据源类型
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} value 方法列表
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定类型数据源的方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.setFormMethod('http', [
|
||||
{ label: '发起请求', value: 'request' },
|
||||
{ label: '重试', value: 'retry' },
|
||||
]);
|
||||
```
|
||||
|
||||
## add
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)} config 数据源配置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)} 添加后的数据源配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
添加一个数据源,如果配置中没有id或id已存在,会自动生成新的id
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const newDs = dataSourceService.add({
|
||||
type: 'http',
|
||||
title: '用户信息',
|
||||
url: '/api/user',
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
console.log(newDs.id); // 自动生成的id
|
||||
```
|
||||
|
||||
## update
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)} config 数据源配置
|
||||
- `{Object}` options 可选配置
|
||||
- {[ChangeRecord](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/form/src/schema.ts#L27-L39)[]} changeRecords 变更记录
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221)} 更新后的数据源配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
更新数据源
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const updatedDs = dataSourceService.update({
|
||||
id: 'ds_123',
|
||||
type: 'http',
|
||||
title: '用户详情',
|
||||
url: '/api/user/detail',
|
||||
});
|
||||
|
||||
console.log(updatedDs);
|
||||
```
|
||||
|
||||
## remove
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` id 数据源id
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
删除指定id的数据源
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.remove('ds_123');
|
||||
```
|
||||
|
||||
## createId
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{string}` 生成的唯一id
|
||||
|
||||
- **详情:**
|
||||
|
||||
生成一个唯一的数据源id,格式为 `ds_` + guid
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const id = dataSourceService.createId();
|
||||
console.log(id); // 'ds_xxx-xxx-xxx'
|
||||
```
|
||||
|
||||
## getDataSourceById
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` id 数据源id
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[DataSourceSchema](https://github.com/Tencent/tmagic-editor/blob/5880dfbe15fcead63e9dc7c91900f8c4e7a574d8/packages/schema/src/index.ts#L221) | undefined} 数据源配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
根据id获取数据源配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
const ds = dataSourceService.getDataSourceById('ds_123');
|
||||
console.log(ds);
|
||||
```
|
||||
|
||||
## copyWithRelated
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]} config 组件节点配置
|
||||
- `{TargetOptions}` collectorOptions 可选的收集器配置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
复制组件时会带上组件关联的数据源,将关联的数据源存储到 localStorage
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService, editorService } from '@tmagic/editor';
|
||||
|
||||
const node = editorService.get('node');
|
||||
dataSourceService.copyWithRelated(node);
|
||||
```
|
||||
|
||||
## paste
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
粘贴数据源,从 localStorage 中读取复制的数据源并添加到当前页面
|
||||
|
||||
如果数据源id已存在,则不会覆盖
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.paste();
|
||||
```
|
||||
|
||||
## resetState
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置数据源服务状态,清空所有数据源
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.resetState();
|
||||
```
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁 dataSourceService,移除所有事件监听并重置状态
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.destroy();
|
||||
```
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.usePlugin({
|
||||
beforeAdd(config) {
|
||||
console.log('添加前:', config);
|
||||
return [config];
|
||||
},
|
||||
|
||||
afterAdd(result, config) {
|
||||
console.log('添加后:', result);
|
||||
return result;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { dataSourceService } from '@tmagic/editor';
|
||||
|
||||
dataSourceService.removeAllPlugins();
|
||||
```
|
||||
40
docs/api/editor/editorServiceEvents.md
Normal file
40
docs/api/editor/editorServiceEvents.md
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
# editorService事件
|
||||
|
||||
## root-change
|
||||
|
||||
- **详情:** dsl跟节点发生变化,[editorService.set('root', {})](./editorServiceMethods.md#set)后触发
|
||||
|
||||
- **回调函数:** (value: [MApp](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/schema/src/index.ts?plain=1#L66-L73), preValue: [MApp](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/schema/src/index.ts?plain=1#L66-L73)) => void
|
||||
|
||||
## select
|
||||
|
||||
- **详情:** 选中组件,[editorService.select()](./editorServiceMethods.md#select)后触发
|
||||
|
||||
- **回调函数:** (node: [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)) => void
|
||||
|
||||
## add
|
||||
|
||||
- **详情:** 选中组件,[editorService.add()](./editorServiceMethods.md#add)后触发
|
||||
|
||||
- **回调函数:** (node: [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]) => void
|
||||
|
||||
|
||||
## remove
|
||||
|
||||
- **详情:** 选中组件,[editorService.remove()](./editorServiceMethods.md#remove)后触发
|
||||
|
||||
- **回调函数:** (node: [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]) => void
|
||||
|
||||
|
||||
## update
|
||||
|
||||
- **详情:** 选中组件,[editorService.update()](./editorServiceMethods.md#update)后触发
|
||||
|
||||
- **回调函数:** (node: [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]) => void
|
||||
|
||||
|
||||
## history-change
|
||||
- **详情:** 历史记录改变,[editorService.redo(),editorService.undo()](./editorServiceMethods.html#undo)后触发
|
||||
|
||||
- **回调函数:** (node: [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)) => void
|
||||
665
docs/api/editor/editorServiceMethods.md
Normal file
665
docs/api/editor/editorServiceMethods.md
Normal file
@ -0,0 +1,665 @@
|
||||
# editorService方法
|
||||
|
||||
## get
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'modifiedNodeIds' | 'pageLength' | 'stage'} name`
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{any} value`
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取当前指指定name的值
|
||||
|
||||
'root': 当前整个配置,也就是当前编辑器的值
|
||||
|
||||
'page': 当前正在编辑的页面配置
|
||||
|
||||
'parent': 当前选中的节点的父节点
|
||||
|
||||
'node': 当前选中的第一个节点
|
||||
|
||||
'highlightNode': 当前高亮的节点
|
||||
|
||||
'nodes': 当前选中的所有节点
|
||||
|
||||
'modifiedNodeIds': 当前页面所有改动过的节点id
|
||||
|
||||
'pageLength': 所以页面个数
|
||||
|
||||
'stage': [StageCore](../stage/coreMethods.md)实例
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const node = editorService.get('node');
|
||||
```
|
||||
|
||||
## set
|
||||
- `{'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'modifiedNodeIds' | 'pageLength' | 'stage'} name`
|
||||
- `{any} value`
|
||||
|
||||
- **详情:**
|
||||
参考[get](#get)方法
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const node = editorService.get('node');
|
||||
|
||||
editorService.set('node', {
|
||||
...node,
|
||||
name: 'new name'
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
## getNodeInfo
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number | string}` id 组件id
|
||||
|
||||
- `{boolean}` raw 是否使用toRaw,默认为true
|
||||
|
||||
:::tip
|
||||
如果raw为false,对获取到的对象进行操作会触发vue响应式处理
|
||||
:::
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[EditorNodeInfo](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/editor/src/type.ts#L139-L143)}
|
||||
|
||||
- **详情:**
|
||||
|
||||
根据id获取组件、组件的父组件以及组件所属的页面节点
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const info = editorService.getNodeInfo('text_123');
|
||||
|
||||
console.log(info.node);
|
||||
console.log(info.parent);
|
||||
console.log(info.page);
|
||||
```
|
||||
|
||||
## getNodeById
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number | string}` id
|
||||
|
||||
- `{boolean}` raw 是否使用toRaw,默认为true
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} 组件节点配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
根据id获取组件的信息
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const node = editorService.getNodeById('text_123');
|
||||
|
||||
console.log(node);
|
||||
```
|
||||
|
||||
## getParentById
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number | string}` id
|
||||
|
||||
- `{boolean}` raw 是否使用toRaw,默认为true
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} 指点组件的父节点配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
根据ID获取指点节点的父节点配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const parent = editorService.getParentById('text_123');
|
||||
|
||||
console.log(parent);
|
||||
```
|
||||
|
||||
## getLayout
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} parent
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} node 可选
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[Layout](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/editor/src/type.ts#L297-L302)>} 当前布局模式
|
||||
|
||||
- **详情:**
|
||||
|
||||
只有容器拥有布局,目前支持的布局有流式布局(relative),绝对定位布局(absolute),固定定位布局(fixed)
|
||||
|
||||
:::tip
|
||||
固定定位布局需要从当前选中节点判断,固需要传递可选参数 node
|
||||
|
||||
其他布局则是从父组件(容器)来判断
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
const parent = editorService.getParentById('text_123');
|
||||
editorService.getLayout(parent).then((layout) => {
|
||||
console.log(parent);
|
||||
});
|
||||
```
|
||||
|
||||
## select
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {number | string | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} config 需要选中的节点或节点ID
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>} 当前选中的节点配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
选中指点节点(将指点节点设置成当前选中状态)
|
||||
|
||||
:::tip
|
||||
editorService.select只是设置了编辑器的选中状态,并没有设置画布的选中状态,所以根据实际情况可以调用[stage.select](../stage/coreMethods.md#select)来设置画布的选中态
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
editorService.select('text_123');
|
||||
editorService.get('stage')?.select('text_123');
|
||||
```
|
||||
|
||||
## multiSelect
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {(number | string)[]} ids 需要选中的节点ID集合
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
选中多个节点
|
||||
|
||||
:::tip
|
||||
editorService.multiSelect只是设置了编辑器的选中状态,并没有设置画布的选中状态,所以根据实际情况可以调用[stage.multiSelect](../stage/coreMethods.md#multiSelect)来设置画布的选中态
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
editorService.multiSelect(['text_123', 'button_123']);
|
||||
editorService.get('stage')?.multiSelect(['text_123', 'button_123']);
|
||||
```
|
||||
|
||||
## highlight
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {number | string | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} config 需要高亮的节点或节点ID
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
高亮指定节点
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
editorService.highlight('text_123');
|
||||
```
|
||||
|
||||
## doAdd
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} node 新组件节点
|
||||
|
||||
- {[MContainer](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L54-L59)} parent 指定的容器节点
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>} 新增的组件
|
||||
|
||||
- **详情:**
|
||||
|
||||
往指定的容器中添加组件
|
||||
|
||||
## add
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]} node 新组件节点配置或多个节点集合
|
||||
|
||||
- {[MContainer](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L54-L59)} parent 指定的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} 新增的组件或组件集合
|
||||
|
||||
- **详情:**
|
||||
|
||||
往指定的容器或当前容器中添加组件
|
||||
|
||||
:::tip
|
||||
**与[doAdd](#doadd)的区别:**
|
||||
|
||||
add可以支持一次添加多个组件,add是通过调用[doAdd](#doadd)来最终实现添加的。
|
||||
|
||||
编辑器内部添加组件都是调用add来实现的,add除了添加操作外,还会记录历史堆栈,还会更新编辑中相关的状态,而[doAdd](#doadd)就仅仅是完成添加的行为
|
||||
:::
|
||||
|
||||
## doRemove
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} node 要删除的节点
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
删除指定的组件或者页面
|
||||
|
||||
|
||||
## remove
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[])} node 要删除的节点或节点集合
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
删除指定的组件或者页面或组件集合
|
||||
|
||||
:::tip
|
||||
**与[doRemove](#doRemove)的区别:**
|
||||
|
||||
remove可以支持一次删除多个组件,remove是通过调用[doRemove](#doRemove)来最终实现删除的。
|
||||
|
||||
编辑器内部删除组件都是调用remove来实现的,remove除了删除操作外,还会记录历史堆。
|
||||
:::
|
||||
|
||||
## doUpdate
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99))} node 新的节点
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>} 新的节点
|
||||
|
||||
- **详情:**
|
||||
|
||||
更新节点
|
||||
|
||||
:::tip
|
||||
节点中应该要有id,不然不知道要更新哪个节点
|
||||
:::
|
||||
|
||||
## update
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} node 新的节点或节点集合
|
||||
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} 新的节点或节点集合
|
||||
|
||||
- **详情:**
|
||||
|
||||
更新单个或多个节点
|
||||
|
||||
:::tip
|
||||
**与[doUpdate](#doupdate)的区别:**
|
||||
|
||||
update可以支持一次更新多个组件,update是通过调用[doUpdate](#doupdate)来最终实现更新的。
|
||||
|
||||
编辑器内部更新组件都是调用update来实现的,update除了更新操作外,还会记录历史堆,还会更新[代码块](../../guide/advanced/code-block.md)关系链。
|
||||
:::
|
||||
|
||||
## sort
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{ string | number }` id1
|
||||
- `{ string | number }` id2
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
||||
|
||||
用于流式布局下的组件拖动更新
|
||||
|
||||
## copy
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} node 需要复制的节点或节点集合
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
复制组件节点或节点集合
|
||||
|
||||
通过[storageService.setItem](./storageServiceMethods.md#setitem),将组将节点配置转化成string,然后存储到localStorage中
|
||||
|
||||
## doPaste
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
-
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
粘贴前置操作:返回分配了新id以及校准了坐标的配置
|
||||
|
||||
## paste
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[PastePosition](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L152-L163)} position 粘贴的坐标
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} 添加后的组件节点配置
|
||||
|
||||
- **详情:**
|
||||
|
||||
粘贴组件节点或节点集合
|
||||
|
||||
通过[storageService.getItem](./storageServiceMethods.md#setitem),从localStorage中获取节点,然后添加到当前容器中
|
||||
|
||||
|
||||
## doAlignCenter
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} config 需要居中的组件
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
水平居中组件节点,仅在[流式布局](../../guide/advanced/layout.md)下有效
|
||||
|
||||
:::warning
|
||||
仅是计算出left,并未更新到编辑器中
|
||||
:::
|
||||
|
||||
## alignCenter
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>} config 需要居中的组件或者组件集合
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)[]>}
|
||||
|
||||
|
||||
- **详情:**
|
||||
|
||||
水平居中组件或者组件集合,仅在[流式布局](../../guide/advanced/layout.md)下有效
|
||||
|
||||
:::tip
|
||||
**与[doAlignCenter](#doaligncentere)的区别:**
|
||||
|
||||
alignCenter可以支持一次水平居中多个组件,alignCenter是通过调用[doAlignCenter](#doaligncentere)来获取到已设置好水平居中的位置信息的节点,然后调用update更新。
|
||||
:::
|
||||
## moveLayer
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number | 'top' | 'bottom'}` offset
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
移动当前选中节点位置
|
||||
|
||||
用于实现上移一层、下移一层、置顶、置底
|
||||
|
||||
|
||||
## moveToContainer
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} config 需要移动的节点
|
||||
- `{string | number}` targetId 容器ID
|
||||
|
||||
- **返回:**
|
||||
|
||||
- Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99) | undefined>
|
||||
|
||||
- **详情:**
|
||||
|
||||
移动到指定容器中
|
||||
|
||||
## undo
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404) | null>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
撤销当前操作
|
||||
|
||||
## redo
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404) | null>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
恢复到下一步
|
||||
|
||||
## move
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number}` left
|
||||
- `{number}` top
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
更新当前选中组件位置,通常用于键盘上下左右快捷键操作
|
||||
|
||||
## resetModifiedNodeId
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置当前记录的修改过的节点id记录,通常用于保存之后
|
||||
|
||||
## resetState
|
||||
|
||||
- **详情:**
|
||||
|
||||
清空state
|
||||
|
||||
## destroy
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁editorService
|
||||
|
||||
移除所有事件监听,清空state,移除所有插件
|
||||
|
||||
## use
|
||||
|
||||
使用中间件的方式扩展方法,上述方法中标记有`扩展支持: 是`的方法都支持使用use扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService, getAddParent } from '@tmagic/editor';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
|
||||
editorService.use({
|
||||
// 添加是否删除节点确认提示
|
||||
async remove(node, next) {
|
||||
await ElMessageBox.confirm('是否删除', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
});
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
add(node, next) {
|
||||
// text组件只能添加到container中
|
||||
const parentNode = getAddParent(node);
|
||||
if (node.type === 'text' && parentNode?.type !== 'container') {
|
||||
return;
|
||||
}
|
||||
|
||||
next();
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { editorService } from '@tmagic/editor';
|
||||
|
||||
editorService.usePlugin({
|
||||
// 添加组件的时候设置一个添加时间
|
||||
beforeDoAdd: (config, parent) => {
|
||||
config.addTime = new Date().getTime();
|
||||
|
||||
return [config, parent];
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
7
docs/api/editor/events.md
Normal file
7
docs/api/editor/events.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Editor组件 events
|
||||
|
||||
## props-panel-mounted
|
||||
|
||||
- **详情:** 编辑器右侧组件属性配置加载完毕后触发
|
||||
|
||||
- **回调函数:** (formState: [FomState](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/form/src/schema.ts#L27-L39)) => void
|
||||
244
docs/api/editor/eventsServiceMethods.md
Normal file
244
docs/api/editor/eventsServiceMethods.md
Normal file
@ -0,0 +1,244 @@
|
||||
# eventsService方法
|
||||
|
||||
## init
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Record<string, { events: [EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]; methods: [EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[] }>} eventMethodList 事件方法列表配置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
初始化事件服务,设置所有组件的事件和方法列表
|
||||
|
||||
:::tip
|
||||
该方法通常由编辑器内部调用,开发者可以通过 [m-editor 的 eventMethodList prop](./props.md#eventmethodlist) 来配置
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.init({
|
||||
page: {
|
||||
events: [
|
||||
{ label: '页面加载', value: 'load' },
|
||||
{ label: '页面卸载', value: 'unload' },
|
||||
],
|
||||
methods: [
|
||||
{ label: '刷新', value: 'refresh' },
|
||||
{ label: '返回', value: 'back' },
|
||||
],
|
||||
},
|
||||
button: {
|
||||
events: [
|
||||
{ label: '点击', value: 'click' },
|
||||
],
|
||||
methods: [],
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## setEvents
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Record<string, [EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]>} events 事件配置对象
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
批量设置多个组件类型的事件列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.setEvents({
|
||||
page: [
|
||||
{ label: '页面加载', value: 'load' },
|
||||
{ label: '页面显示', value: 'show' },
|
||||
],
|
||||
text: [
|
||||
{ label: '点击', value: 'click' },
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## setEvent
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} events 事件列表
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定组件类型的事件列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.setEvent('button', [
|
||||
{ label: '点击', value: 'click' },
|
||||
{ label: '长按', value: 'longpress' },
|
||||
]);
|
||||
```
|
||||
|
||||
## getEvent
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} 事件列表
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定组件类型的事件列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
const events = eventsService.getEvent('button');
|
||||
console.log(events); // [{ label: '点击', value: 'click' }, ...]
|
||||
```
|
||||
|
||||
## setMethods
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Record<string, [EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]>} methods 方法配置对象
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
批量设置多个组件类型的方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.setMethods({
|
||||
page: [
|
||||
{ label: '刷新', value: 'refresh' },
|
||||
{ label: '滚动到顶部', value: 'scrollToTop' },
|
||||
],
|
||||
video: [
|
||||
{ label: '播放', value: 'play' },
|
||||
{ label: '暂停', value: 'pause' },
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## setMethod
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} methods 方法列表
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置指定组件类型的方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.setMethod('video', [
|
||||
{ label: '播放', value: 'play' },
|
||||
{ label: '暂停', value: 'pause' },
|
||||
{ label: '停止', value: 'stop' },
|
||||
]);
|
||||
```
|
||||
|
||||
## getMethod
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[EventOption](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/core/src/events.ts#L26-L29)[]} 方法列表
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定组件类型的方法列表
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
const methods = eventsService.getMethod('video');
|
||||
console.log(methods); // [{ label: '播放', value: 'play' }, ...]
|
||||
```
|
||||
|
||||
## resetState
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置事件服务状态,清空所有事件和方法配置
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.resetState();
|
||||
```
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁 eventsService,重置状态并移除所有事件监听和插件
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { eventsService } from '@tmagic/editor';
|
||||
|
||||
eventsService.destroy();
|
||||
```
|
||||
14
docs/api/editor/historyServiceEvents.md
Normal file
14
docs/api/editor/historyServiceEvents.md
Normal file
@ -0,0 +1,14 @@
|
||||
# historyService事件
|
||||
|
||||
## page-change
|
||||
|
||||
- **详情:** 页面切换
|
||||
|
||||
- **回调函数:** (undoRedo: [undoRedo](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/utils/undo-redo.ts)) => void
|
||||
|
||||
## change
|
||||
|
||||
- **详情:** 历史记录发生变化
|
||||
|
||||
- **回调函数:** (state: [StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404)) => void
|
||||
|
||||
62
docs/api/editor/historyServiceMethods.md
Normal file
62
docs/api/editor/historyServiceMethods.md
Normal file
@ -0,0 +1,62 @@
|
||||
# historyService方法
|
||||
|
||||
## reset
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置记录
|
||||
|
||||
## changePage
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MPage](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L61)} page
|
||||
|
||||
- **详情:**
|
||||
|
||||
按页面切换历史堆栈
|
||||
|
||||
## empty
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置记录,同[reset](#reset)
|
||||
## push
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404)} state
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404) | null}
|
||||
|
||||
- **详情:**
|
||||
|
||||
添加一条历史记录
|
||||
|
||||
## undo
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404) | null>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
撤销当前操作
|
||||
|
||||
## redo
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[StepValue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L400-L404) | null>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
恢复到下一步
|
||||
|
||||
## destroy
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁
|
||||
1282
docs/api/editor/props.md
Normal file
1282
docs/api/editor/props.md
Normal file
File diff suppressed because it is too large
Load Diff
7
docs/api/editor/propsServiceEvents.md
Normal file
7
docs/api/editor/propsServiceEvents.md
Normal file
@ -0,0 +1,7 @@
|
||||
# propsService事件
|
||||
|
||||
## props-configs-change
|
||||
|
||||
- **详情:** [propsService.setPropsConfigs()](./propsServiceMethods.md#setPropsConfigs)后触发
|
||||
|
||||
- **回调函数:** () => void
|
||||
190
docs/api/editor/propsServiceMethods.md
Normal file
190
docs/api/editor/propsServiceMethods.md
Normal file
@ -0,0 +1,190 @@
|
||||
# propsService方法
|
||||
|
||||
## fillConfig
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)} config
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
扩展属性表单配置DSL,用于为所有表单配置添加公共配置
|
||||
|
||||
## setPropsConfigs
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Record<string, [FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)>} configs
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置组件与属性表单配置DSL的对应关系
|
||||
|
||||
## setPropsConfig
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
- {[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)} config 属性表单配置DSL
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
为指定类型组件设置组件属性表单配置
|
||||
|
||||
## getPropsConfig
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指点类型的组件属性表单配置
|
||||
|
||||
## setPropsValues
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {Record<string, [MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>} values
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置组件与属性表单默认值的对应关系
|
||||
|
||||
## setPropsValue
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} value 组件初始值
|
||||
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置组件与属性表单默认值的对应关系
|
||||
|
||||
|
||||
## getPropsValue
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} value 组件默认值,可选
|
||||
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取指定类型的组件初始值
|
||||
|
||||
## createId
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {string} type 组件列席
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<string>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
生成组件id
|
||||
## setNewItemId
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- {[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)} config
|
||||
|
||||
- **返回:**
|
||||
|
||||
- {Promise<[MNode](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L99)>}
|
||||
|
||||
- **详情:**
|
||||
|
||||
将组件与组件的子元素配置中的id都设置成一个新的ID
|
||||
|
||||
## getDefaultPropsValue
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` type 组件类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取默认属性配置
|
||||
|
||||
## resetState
|
||||
|
||||
- **详情:**
|
||||
|
||||
情况所有组件的属性配置与初始值
|
||||
|
||||
## destroy
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁propsService
|
||||
|
||||
## use
|
||||
|
||||
使用中间件的方式扩展方法,上述方法中标记有`扩展支持: 是`的方法都支持使用use扩展
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
379
docs/api/editor/slots.md
Normal file
379
docs/api/editor/slots.md
Normal file
@ -0,0 +1,379 @@
|
||||
# Editor组件 slots
|
||||
|
||||
## header
|
||||
|
||||
- **详情:** 编辑器最顶部区域
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #header>
|
||||
<div class="custom-header">自定义头部内容</div>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## nav
|
||||
|
||||
- **详情:** 编辑器顶部菜单栏
|
||||
|
||||
- **默认:** [NavMenu.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/NavMenu.vue)
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
:::warning
|
||||
属性配置[menu](./props.md#menu)由默认组件接收,如设置该slot,[menu](./props.md#menu)配置将失效
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #nav="{ editorService }">
|
||||
<div class="custom-nav">
|
||||
<button @click="save">保存</button>
|
||||
</div>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## content-before
|
||||
|
||||
- **详情:** 编辑器主要内容区域之前
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
## src-code
|
||||
|
||||
- **详情:** 源码查看区域
|
||||
|
||||
- **默认:** 默认的代码编辑器
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
## sidebar
|
||||
|
||||
- **详情:** 左边栏
|
||||
|
||||
- **默认:** [Sidebar.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/sidebar/Sidebar.vue)
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
:::warning
|
||||
属性配置[sidebar](./props.md#sidebar)由默认组件接收,如设置该slot,[sidebar](./props.md#sidebar)配置将失效
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #sidebar="{ editorService }">
|
||||
<div class="custom-sidebar">
|
||||
<!-- 自定义侧边栏内容 -->
|
||||
</div>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## component-list
|
||||
|
||||
- **详情:** 左边栏中的组件列表
|
||||
|
||||
- **默认:** 默认的组件列表
|
||||
|
||||
- **插槽 Props:**
|
||||
- `componentGroupList`: 组件分组列表
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## component-list-panel-header
|
||||
|
||||
- **详情:** 左边栏中的组件列表内上方位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## component-list-item
|
||||
|
||||
- **详情:** 左边栏中的组件列表中组件item
|
||||
|
||||
- **默认:** 图片加文案
|
||||
|
||||
- **插槽 Props:**
|
||||
- `component`: 组件配置对象
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #component-list-item="{ component }">
|
||||
<div class="custom-item">
|
||||
<span>{{ component.text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## layer-panel-header
|
||||
|
||||
- **详情:** 左边栏中的已选组件(组件树)内顶部位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## layer-node-content
|
||||
|
||||
- **详情:** 左边栏中的已选组件(组件树)节点完整内容
|
||||
|
||||
- **默认:** 组件名称加id和工具按钮
|
||||
|
||||
- **插槽 Props:**
|
||||
- `data`: 节点数据
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## layer-node-label
|
||||
|
||||
- **详情:** 左边栏中的已选组件(组件树)节点标签部分
|
||||
|
||||
- **默认:** 组件名称加id
|
||||
|
||||
- **插槽 Props:**
|
||||
- `data`: 节点数据
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #layer-node-label="{ data }">
|
||||
<span>{{ data.type }} - {{ data.name }}</span>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## layer-node-tool
|
||||
|
||||
- **详情:** 左边栏中的已选组件(组件树)节点右侧工具区域
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
- **插槽 Props:**
|
||||
- `data`: 节点数据
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## code-block-panel-header
|
||||
|
||||
- **详情:** 左边栏中的代码块列表内顶部位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## code-block-panel-tool
|
||||
|
||||
- **详情:** 左边栏中的代码块列表中代码块右侧位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
- **插槽 Props:**
|
||||
- `id`: 代码块id
|
||||
- `data`: 代码块数据
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## code-block-panel-search
|
||||
|
||||
- **详情:** 左边栏中的代码块列表搜索框位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## data-source-panel-tool
|
||||
|
||||
- **详情:** 左边栏中的数据源列表中数据源右侧位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
- **插槽 Props:**
|
||||
- `data`: 数据源数据
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## data-source-panel-search
|
||||
|
||||
- **详情:** 左边栏中的数据源列表搜索框位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
:::warning
|
||||
如设置了[sidebar](#sidebar)插槽,此插槽将失效
|
||||
:::
|
||||
|
||||
## workspace
|
||||
|
||||
- **详情:** 编辑器中间区域
|
||||
|
||||
- **默认:** [Workspace.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/workspace/Workspace.vue)
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
## stage
|
||||
|
||||
- **详情:** 画布
|
||||
|
||||
- **默认:** [Stage.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/workspace/Stage.vue)
|
||||
|
||||
## workspace-content
|
||||
|
||||
- **详情:** 编辑器中间区域内,画布上方位置
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
## page-bar
|
||||
|
||||
- **详情:** 编辑器中间区域底部页面标签栏
|
||||
|
||||
- **默认:** 默认的页面标签栏
|
||||
|
||||
## page-bar-add-button
|
||||
|
||||
- **详情:** 页面标签栏中的"添加页面"按钮
|
||||
|
||||
- **默认:** 默认的添加按钮
|
||||
|
||||
## page-bar-title
|
||||
|
||||
- **详情:** 编辑器中间区域底部页面标题
|
||||
|
||||
- **默认:** 页面名称
|
||||
|
||||
- **插槽 Props:**
|
||||
- `page`: 页面配置对象
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #page-bar-title="{ page }">
|
||||
<span>{{ page.name }} - {{ page.id }}</span>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
|
||||
## page-bar-popover
|
||||
|
||||
- **详情:** 编辑器中间区域底部页面标题悬浮框内容
|
||||
|
||||
- **默认:** 页面详细信息
|
||||
|
||||
- **插槽 Props:**
|
||||
- `page`: 页面配置对象
|
||||
|
||||
## page-list-popover
|
||||
|
||||
- **详情:** 页面列表弹出框内容
|
||||
|
||||
- **默认:** 页面列表
|
||||
|
||||
- **插槽 Props:**
|
||||
- `list`: 页面列表
|
||||
|
||||
## props-panel
|
||||
|
||||
- **详情:** 编辑器右侧属性配置
|
||||
|
||||
- **默认:** [PropsPanel.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/PropsPanel.vue)
|
||||
|
||||
## props-panel-header
|
||||
|
||||
- **详情:** 编辑器右侧属性配置内顶部区域
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
## content-after
|
||||
|
||||
- **详情:** 编辑器主要内容区域之后
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
## footer
|
||||
|
||||
- **详情:** 编辑器底部区域
|
||||
|
||||
- **默认:** 无
|
||||
|
||||
## empty
|
||||
|
||||
- **详情:** 当前没有页面时,编辑器中间区域
|
||||
|
||||
- **默认:** [AddPageBox.vue](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/layouts/AddPageBox.vue)
|
||||
|
||||
- **插槽 Props:**
|
||||
- `editorService`: editorService 实例
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor>
|
||||
<template #empty="{ editorService }">
|
||||
<div class="custom-empty">
|
||||
<p>暂无页面</p>
|
||||
<button @click="createFirstPage">创建第一个页面</button>
|
||||
</div>
|
||||
</template>
|
||||
</m-editor>
|
||||
</template>
|
||||
```
|
||||
290
docs/api/editor/storageServiceMethods.md
Normal file
290
docs/api/editor/storageServiceMethods.md
Normal file
@ -0,0 +1,290 @@
|
||||
# storageService方法
|
||||
|
||||
## getStorage
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Storage}` Storage 对象
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取数据存储对象,默认返回 localStorage
|
||||
|
||||
可以通过插件机制替换为其他存储对象(如 sessionStorage)
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
const storage = storageService.getStorage();
|
||||
console.log(storage); // localStorage
|
||||
|
||||
// 通过插件替换为 sessionStorage
|
||||
storageService.usePlugin({
|
||||
afterGetStorage() {
|
||||
return window.sessionStorage;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## getNamespace
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{string}` 命名空间字符串
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取存储项的命名空间,默认为 'tmagic'
|
||||
|
||||
命名空间用于区分不同应用的存储数据
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
const namespace = storageService.getNamespace();
|
||||
console.log(namespace); // 'tmagic'
|
||||
```
|
||||
|
||||
## clear
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
清空当前存储对象中的所有数据
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
storageService.clear();
|
||||
```
|
||||
|
||||
## getItem
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` key 存储项的键名
|
||||
- `{Options}` options 可选配置
|
||||
- `namespace?: string` 自定义命名空间
|
||||
- `protocol?: Protocol` 数据协议类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{any}` 存储的值,如果不存在返回 null
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取存储项,支持多种数据类型的自动解析
|
||||
|
||||
支持的协议类型:
|
||||
- `Protocol.OBJECT`: JavaScript 对象
|
||||
- `Protocol.JSON`: JSON 格式
|
||||
- `Protocol.NUMBER`: 数字类型
|
||||
- `Protocol.BOOLEAN`: 布尔类型
|
||||
- `Protocol.STRING`: 字符串类型
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
// 获取字符串
|
||||
const str = storageService.getItem('myKey');
|
||||
|
||||
// 使用自定义命名空间
|
||||
const value = storageService.getItem('key', { namespace: 'custom' });
|
||||
|
||||
// 指定协议类型
|
||||
const num = storageService.getItem('count', { protocol: Protocol.NUMBER });
|
||||
```
|
||||
|
||||
## key
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number}` index 索引位置
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{string | null}` 指定位置的键名,不存在返回 null
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取存储对象中指定索引位置的键名
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
const firstKey = storageService.key(0);
|
||||
console.log(firstKey);
|
||||
```
|
||||
|
||||
## removeItem
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` key 存储项的键名
|
||||
- `{Options}` options 可选配置
|
||||
- `namespace?: string` 自定义命名空间
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
移除指定的存储项
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
// 移除默认命名空间下的存储项
|
||||
storageService.removeItem('myKey');
|
||||
|
||||
// 移除自定义命名空间下的存储项
|
||||
storageService.removeItem('key', { namespace: 'custom' });
|
||||
```
|
||||
|
||||
## setItem
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{string}` key 存储项的键名
|
||||
- `{any}` value 要存储的值
|
||||
- `{Options}` options 可选配置
|
||||
- `namespace?: string` 自定义命名空间
|
||||
- `protocol?: Protocol` 数据协议类型
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置存储项,自动序列化复杂数据类型
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService, Protocol } from '@tmagic/editor';
|
||||
|
||||
// 存储字符串
|
||||
storageService.setItem('name', 'tmagic');
|
||||
|
||||
// 存储对象
|
||||
storageService.setItem('config', { a: 1, b: 2 }, { protocol: Protocol.OBJECT });
|
||||
|
||||
// 存储数字
|
||||
storageService.setItem('count', 100, { protocol: Protocol.NUMBER });
|
||||
|
||||
// 使用自定义命名空间
|
||||
storageService.setItem('key', 'value', { namespace: 'custom' });
|
||||
```
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁 storageService,移除所有事件监听和插件
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
storageService.destroy();
|
||||
```
|
||||
|
||||
## use
|
||||
|
||||
使用中间件的方式扩展方法,上述方法中标记有`扩展支持: 是`的方法都支持使用use扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
storageService.use({
|
||||
getItem(key, options, next) {
|
||||
console.log('获取存储项:', key);
|
||||
return next();
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
storageService.usePlugin({
|
||||
beforeSetItem(key, value, options) {
|
||||
console.log('设置前:', key, value);
|
||||
return [key, value, options];
|
||||
},
|
||||
|
||||
afterGetItem(result, key, options) {
|
||||
console.log('获取后:', result);
|
||||
return result;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { storageService } from '@tmagic/editor';
|
||||
|
||||
storageService.removeAllPlugins();
|
||||
```
|
||||
|
||||
239
docs/api/editor/uiServiceMethods.md
Normal file
239
docs/api/editor/uiServiceMethods.md
Normal file
@ -0,0 +1,239 @@
|
||||
# uiService方法
|
||||
|
||||
## set
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{keyof UiState}` name 状态键名
|
||||
- `{any}` value 状态值
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
设置UI服务的状态
|
||||
|
||||
可用的状态键:
|
||||
- `uiSelectMode`: UI选择模式
|
||||
- `showSrc`: 是否显示源码
|
||||
- `showStylePanel`: 是否显示样式面板
|
||||
- `zoom`: 缩放比例
|
||||
- `stageContainerRect`: 画布容器尺寸
|
||||
- `stageRect`: 画布尺寸
|
||||
- `columnWidth`: 列宽度配置
|
||||
- `showGuides`: 是否显示参考线
|
||||
- `showRule`: 是否显示标尺
|
||||
- `propsPanelSize`: 属性面板尺寸
|
||||
- `showAddPageButton`: 是否显示添加页面按钮
|
||||
- `showPageListButton`: 是否显示页面列表按钮
|
||||
- `hideSlideBar`: 是否隐藏侧边栏
|
||||
- `sideBarItems`: 侧边栏项目
|
||||
- `navMenuRect`: 导航菜单尺寸
|
||||
- `frameworkRect`: 框架尺寸
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
// 设置缩放比例
|
||||
uiService.set('zoom', 1.5);
|
||||
|
||||
// 设置画布尺寸
|
||||
uiService.set('stageRect', { width: 375, height: 667 });
|
||||
|
||||
// 显示/隐藏参考线
|
||||
uiService.set('showGuides', true);
|
||||
|
||||
// 显示/隐藏标尺
|
||||
uiService.set('showRule', true);
|
||||
```
|
||||
|
||||
## get
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{keyof UiState}` name 状态键名
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{any}` 对应的状态值
|
||||
|
||||
- **详情:**
|
||||
|
||||
获取UI服务的状态值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
const zoom = uiService.get('zoom');
|
||||
console.log('当前缩放:', zoom);
|
||||
|
||||
const stageRect = uiService.get('stageRect');
|
||||
console.log('画布尺寸:', stageRect);
|
||||
```
|
||||
|
||||
## zoom
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:**
|
||||
|
||||
- `{number}` zoom 缩放增量(可以为负数)
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<void>}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
调整缩放倍数,最小为0.1
|
||||
|
||||
传入的值会被累加到当前缩放倍数上
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
// 放大0.1倍
|
||||
await uiService.zoom(0.1);
|
||||
|
||||
// 缩小0.1倍
|
||||
await uiService.zoom(-0.1);
|
||||
|
||||
// 当前缩放如果是1.0,执行zoom(0.5)后变为1.5
|
||||
await uiService.zoom(0.5);
|
||||
```
|
||||
|
||||
## calcZoom
|
||||
|
||||
- **[扩展支持](../../guide/editor-expand#行为扩展):** 是
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<number>}` 计算出的缩放倍数
|
||||
|
||||
- **详情:**
|
||||
|
||||
计算"缩放以适应"的倍数
|
||||
|
||||
根据画布容器的尺寸和画布尺寸自动计算出合适的缩放比例,使画布完全显示在容器内
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
const fitZoom = await uiService.calcZoom();
|
||||
console.log('适应缩放:', fitZoom);
|
||||
|
||||
// 应用缩放以适应
|
||||
uiService.set('zoom', fitZoom);
|
||||
```
|
||||
|
||||
## resetState
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
重置UI服务状态到初始值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
uiService.resetState();
|
||||
```
|
||||
|
||||
## destroy
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{void}`
|
||||
|
||||
- **详情:**
|
||||
|
||||
销毁 uiService,重置状态并移除所有事件监听和插件
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
uiService.destroy();
|
||||
```
|
||||
|
||||
## use
|
||||
|
||||
使用中间件的方式扩展方法,上述方法中标记有`扩展支持: 是`的方法都支持使用use扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
uiService.use({
|
||||
async zoom(value, next) {
|
||||
console.log('缩放前:', uiService.get('zoom'));
|
||||
await next();
|
||||
console.log('缩放后:', uiService.get('zoom'));
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## usePlugin
|
||||
|
||||
- **详情:**
|
||||
|
||||
相对于[use](#use), usePlugin支持更加灵活更加细致的扩展, 上述方法中标记有`扩展支持: 是`的方法都支持使用usePlugin扩展
|
||||
|
||||
每个支持扩展的方法都支持定制before、after两个hook来干预原有方法的行为,before可以用于修改传入参数,after可以用于修改返回的值
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
uiService.usePlugin({
|
||||
beforeZoom(value) {
|
||||
console.log('缩放增量:', value);
|
||||
return [value];
|
||||
},
|
||||
|
||||
afterCalcZoom(result) {
|
||||
console.log('计算的缩放:', result);
|
||||
// 可以修改返回值
|
||||
return result;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## removeAllPlugins
|
||||
|
||||
- **详情:**
|
||||
|
||||
删掉当前设置的所有扩展
|
||||
|
||||
- **示例:**
|
||||
|
||||
```js
|
||||
import { uiService } from '@tmagic/editor';
|
||||
|
||||
uiService.removeAllPlugins();
|
||||
```
|
||||
|
||||
27
docs/api/form/form-dialog-events.md
Normal file
27
docs/api/form/form-dialog-events.md
Normal file
@ -0,0 +1,27 @@
|
||||
# FormDialog组件 events
|
||||
|
||||
## close
|
||||
|
||||
- **详情:** 弹出关闭
|
||||
|
||||
- **回调函数:** () => void
|
||||
|
||||
|
||||
## submit
|
||||
|
||||
- **详情:** 调用[save()](./form-dialog-methods.md#save)
|
||||
|
||||
- **回调函数:** (values: any) => void
|
||||
|
||||
## error
|
||||
|
||||
- **详情:** 表单校验不同
|
||||
|
||||
- **回调函数:** (error: any) => void
|
||||
|
||||
## change
|
||||
|
||||
- **详情:** 表单中任何值发生变化
|
||||
|
||||
- **回调函数:** (values: any) => void
|
||||
|
||||
13
docs/api/form/form-dialog-methods.md
Normal file
13
docs/api/form/form-dialog-methods.md
Normal file
@ -0,0 +1,13 @@
|
||||
# FormDialog组件 methods
|
||||
|
||||
## cancel
|
||||
|
||||
- **详情:** 关闭弹窗
|
||||
|
||||
## save
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<any>}`
|
||||
|
||||
- **详情:** 获取表单的值
|
||||
110
docs/api/form/form-dialog-props.md
Normal file
110
docs/api/form/form-dialog-props.md
Normal file
@ -0,0 +1,110 @@
|
||||
# FormDialog组件 props
|
||||
|
||||
## config
|
||||
|
||||
- **详情:** 表单配置
|
||||
|
||||
- **默认值:** `[]`
|
||||
|
||||
- **类型:** [FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-form-dialog :config="config"></m-form-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'Vue';
|
||||
|
||||
const config = ref([
|
||||
{
|
||||
name: 'text',
|
||||
text: '文本',
|
||||
},
|
||||
{
|
||||
name: 'multiple',
|
||||
text: '多行文本',
|
||||
type: 'switch',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
```
|
||||
|
||||
## values
|
||||
|
||||
- **详情:** 表单初始化值
|
||||
|
||||
- **默认值:** `{}`
|
||||
|
||||
- **类型:** `Object`
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-form-dialog :values="values"></m-form-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'Vue';
|
||||
|
||||
const values = ref([
|
||||
text: 'text',
|
||||
multiply: true,
|
||||
]);
|
||||
</script>
|
||||
```
|
||||
|
||||
## width
|
||||
|
||||
- **详情:** 弹窗宽度
|
||||
|
||||
- **类型:** `string | number`
|
||||
|
||||
## labelWidth
|
||||
|
||||
- **详情:**
|
||||
|
||||
表单域标签的宽度,例如 '50px'。 作为 Form 直接子元素的 form-item 会继承该值。 支持 auto
|
||||
|
||||
- **默认值:** `'200px'`
|
||||
|
||||
- **类型:** `string | number`
|
||||
|
||||
## fullscreen
|
||||
|
||||
- **详情:** 弹出是否全屏
|
||||
|
||||
- **默认值:** false
|
||||
|
||||
- **类型:** boolean
|
||||
|
||||
## disabled
|
||||
|
||||
- **详情:** 是否禁用该表单内的所有组件。 若设置为 true,则表单内组件上的 disabled 属性不再生效
|
||||
|
||||
- **默认值:** false
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## title
|
||||
|
||||
- **详情:** 弹出标题
|
||||
|
||||
- **类型:** `string`
|
||||
|
||||
## size
|
||||
|
||||
- **详情:** 用于控制该表单内组件的尺寸
|
||||
|
||||
- **类型:** `'small' | 'default' | 'large'`
|
||||
|
||||
## confirmText
|
||||
|
||||
- **详情:** 提交按钮文案
|
||||
|
||||
- **默认值:** `'确定'`
|
||||
|
||||
- **类型:** `string`
|
||||
7
docs/api/form/form-events.md
Normal file
7
docs/api/form/form-events.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Form组件 events
|
||||
|
||||
## change
|
||||
|
||||
- **详情:** 表单中任何值发生变化
|
||||
|
||||
- **回调函数:** (values: any) => void
|
||||
13
docs/api/form/form-methods.md
Normal file
13
docs/api/form/form-methods.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Form组件 methods
|
||||
|
||||
## resetForm
|
||||
|
||||
- **详情:** 重置该表单项,将其值重置为初始值,并移除校验结果
|
||||
|
||||
## submitForm
|
||||
|
||||
- **返回:**
|
||||
|
||||
- `{Promise<any>}`
|
||||
|
||||
- **详情:** 提交表单,获取表单的值
|
||||
137
docs/api/form/form-props.md
Normal file
137
docs/api/form/form-props.md
Normal file
@ -0,0 +1,137 @@
|
||||
# Form组件属性 props
|
||||
|
||||
## config
|
||||
|
||||
- **详情:** 表单配置
|
||||
|
||||
- **默认值:** `[]`
|
||||
|
||||
- **类型:** [FormConfig](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/form/src/schema.ts#L706)
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-form-dialog :config="config"></m-form-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'Vue';
|
||||
|
||||
const config = ref([
|
||||
{
|
||||
name: 'text',
|
||||
text: '文本',
|
||||
},
|
||||
{
|
||||
name: 'multiple',
|
||||
text: '多行文本',
|
||||
type: 'switch',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
```
|
||||
|
||||
## initValues
|
||||
|
||||
- **详情:** 表单初始化值
|
||||
|
||||
- **默认值:** `{}`
|
||||
|
||||
- **类型:** `Object`
|
||||
|
||||
- **示例:**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-form-dialog :init-values="initValues"></m-form-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'Vue';
|
||||
|
||||
const initValues = ref([
|
||||
text: 'text',
|
||||
multiply: true,
|
||||
]);
|
||||
</script>
|
||||
```
|
||||
|
||||
## labelWidth
|
||||
|
||||
- **详情:**
|
||||
|
||||
表单域标签的宽度,例如 '50px'。 作为 Form 直接子元素的 form-item 会继承该值。 支持 auto
|
||||
|
||||
- **默认值:** `'200px'`
|
||||
|
||||
- **类型:** `string | number`
|
||||
|
||||
## disabled
|
||||
|
||||
- **详情:** 是否禁用该表单内的所有组件。 若设置为 true,则表单内组件上的 disabled 属性不再生效
|
||||
|
||||
- **默认值:** false
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## height
|
||||
|
||||
- **详情:**
|
||||
|
||||
|
||||
|
||||
- **默认值:**
|
||||
|
||||
|
||||
|
||||
- **类型:**
|
||||
|
||||
## stepActive
|
||||
|
||||
- **详情:**
|
||||
|
||||
|
||||
|
||||
- **默认值:**
|
||||
|
||||
|
||||
|
||||
- **类型:**
|
||||
|
||||
## size
|
||||
|
||||
- **详情:** 用于控制该表单内组件的尺寸
|
||||
|
||||
- **类型:** `'small' | 'default' | 'large'`
|
||||
|
||||
|
||||
## inline
|
||||
|
||||
- **详情:** 行内表单模式
|
||||
|
||||
- **默认值:** false
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## labelPosition
|
||||
|
||||
- **详情:** 表单域标签的位置, 当设置为 left 或 right 时,则也需要设置 label-width 属性
|
||||
|
||||
- **默认值:** ’right'
|
||||
|
||||
- **类型:** `'left' | 'right' | 'top`
|
||||
|
||||
## keyProp
|
||||
|
||||
- **详情:** 作为表单项的组件实例的key
|
||||
|
||||
- **默认值:** `'__key'`
|
||||
|
||||
- **类型:** `string`
|
||||
|
||||
## popperClass
|
||||
|
||||
- **详情:** tooltip弹出层的class
|
||||
|
||||
- **类型:** `string`
|
||||
21
docs/api/stage/coreEvents.md
Normal file
21
docs/api/stage/coreEvents.md
Normal file
@ -0,0 +1,21 @@
|
||||
# stage事件
|
||||
|
||||
## runtime-ready
|
||||
|
||||
## mounted
|
||||
|
||||
## highlight
|
||||
|
||||
## update
|
||||
|
||||
## select
|
||||
|
||||
## multi-select
|
||||
|
||||
## select-parent
|
||||
|
||||
## sort
|
||||
|
||||
## update
|
||||
|
||||
## change-guides
|
||||
58
docs/api/stage/coreMethods.md
Normal file
58
docs/api/stage/coreMethods.md
Normal file
@ -0,0 +1,58 @@
|
||||
# stage方法
|
||||
|
||||
## select
|
||||
|
||||
- **详情:** 单选选中元素
|
||||
|
||||
## multiSelect
|
||||
|
||||
- **详情:** 多选选中多个元素
|
||||
|
||||
## highlight
|
||||
|
||||
- **详情:** 高亮选中元素
|
||||
|
||||
## update
|
||||
|
||||
- **详情:** 更新组件
|
||||
|
||||
## add
|
||||
|
||||
- **详情:** 往画布增加一个组件
|
||||
|
||||
## remove
|
||||
|
||||
- **详情:** 从画布删除一个组件
|
||||
|
||||
## setZoom
|
||||
|
||||
- **详情:**
|
||||
|
||||
## mount
|
||||
|
||||
- **详情:** 挂载Dom节点
|
||||
|
||||
## clearGuides
|
||||
|
||||
- **详情:** 清空所有参考线
|
||||
|
||||
## clearGuides
|
||||
|
||||
- **详情:** 清空所有参考线
|
||||
|
||||
## delayedMarkContainer
|
||||
|
||||
- **详情:**
|
||||
|
||||
鼠标拖拽着元素,在容器上方悬停,延迟一段时间后,对容器进行标记,如果悬停时间够长将标记成功,悬停时间短,调用方通过返回的timeoutId取消标记
|
||||
|
||||
标记的作用:
|
||||
|
||||
1、高亮容器,给用户一个加入容器的交互感知;
|
||||
|
||||
2、释放鼠标后,通过标记的标志找到要加入的容器
|
||||
|
||||
## destroy
|
||||
|
||||
- **详情:** 销毁实例
|
||||
|
||||
110
docs/api/table/events.md
Normal file
110
docs/api/table/events.md
Normal file
@ -0,0 +1,110 @@
|
||||
# Table组件 events
|
||||
|
||||
## sort-change
|
||||
|
||||
- **参数:**
|
||||
- `{ column, prop, order }` - 排序信息对象
|
||||
- `column: Object` - 排序的列配置
|
||||
- `prop: string` - 排序的列属性名
|
||||
- `order: 'ascending' | 'descending' | null` - 排序方式
|
||||
|
||||
- **说明:** 当表格的排序条件发生变化时触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleSortChange = ({ column, prop, order }) => {
|
||||
console.log('排序变化:', prop, order);
|
||||
};
|
||||
```
|
||||
|
||||
## after-action
|
||||
|
||||
- **参数:**
|
||||
- `action: string` - 操作类型
|
||||
- `data: any` - 操作相关数据
|
||||
|
||||
- **说明:** 表格操作完成后触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleAfterAction = (action, data) => {
|
||||
console.log('操作完成:', action, data);
|
||||
};
|
||||
```
|
||||
|
||||
## select
|
||||
|
||||
- **参数:**
|
||||
- `selection: Array<any>` - 当前选中的行数据数组
|
||||
- `row: any` - 刚刚被选中的行数据
|
||||
|
||||
- **说明:** 当用户手动勾选某一行时触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleSelect = (selection, row) => {
|
||||
console.log('选中行:', row);
|
||||
console.log('当前选中:', selection);
|
||||
};
|
||||
```
|
||||
|
||||
## select-all
|
||||
|
||||
- **参数:**
|
||||
- `selection: Array<any>` - 当前选中的行数据数组
|
||||
|
||||
- **说明:** 当用户手动勾选全选 Checkbox 时触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleSelectAll = (selection) => {
|
||||
console.log('全选/取消全选:', selection.length);
|
||||
};
|
||||
```
|
||||
|
||||
## selection-change
|
||||
|
||||
- **参数:**
|
||||
- `selection: Array<any>` - 当前选中的行数据数组
|
||||
|
||||
- **说明:** 当选择项发生变化时触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleSelectionChange = (selection) => {
|
||||
console.log('选中项变化:', selection);
|
||||
};
|
||||
```
|
||||
|
||||
## expand-change
|
||||
|
||||
- **参数:**
|
||||
- `row: any` - 被展开/收起的行数据
|
||||
- `expandedRows: Array<any>` - 当前所有展开的行数据数组
|
||||
|
||||
- **说明:** 当用户展开或收起某一行时触发(用于可展开表格)
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleExpandChange = (row, expandedRows) => {
|
||||
console.log('展开状态变化:', row);
|
||||
console.log('当前展开行:', expandedRows);
|
||||
};
|
||||
```
|
||||
|
||||
## cell-click
|
||||
|
||||
- **参数:**
|
||||
- `row: any` - 行数据
|
||||
- `column: Object` - 列配置
|
||||
- `cell: HTMLElement` - 单元格 DOM 元素
|
||||
- `event: Event` - 原生事件对象
|
||||
|
||||
- **说明:** 当某个单元格被点击时触发
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
const handleCellClick = (row, column, cell, event) => {
|
||||
console.log('单元格点击:', row, column.property);
|
||||
};
|
||||
```
|
||||
41
docs/api/table/methods.md
Normal file
41
docs/api/table/methods.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Table组件 methods
|
||||
|
||||
## toggleRowSelection
|
||||
|
||||
- **参数:**
|
||||
- `row: any` - 要切换选中状态的行数据
|
||||
- `selected?: boolean` - 是否选中,不传则切换当前状态
|
||||
|
||||
- **说明:** 切换某一行的选中状态
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
tableRef.value.toggleRowSelection(row, true); // 选中
|
||||
tableRef.value.toggleRowSelection(row, false); // 取消选中
|
||||
tableRef.value.toggleRowSelection(row); // 切换状态
|
||||
```
|
||||
|
||||
## toggleRowExpansion
|
||||
|
||||
- **参数:**
|
||||
- `row: any` - 要展开/收起的行数据
|
||||
- `expanded?: boolean` - 是否展开,不传则切换当前状态
|
||||
|
||||
- **说明:** 切换某一行的展开状态(用于可展开表格)
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
tableRef.value.toggleRowExpansion(row, true); // 展开
|
||||
tableRef.value.toggleRowExpansion(row, false); // 收起
|
||||
```
|
||||
|
||||
## clearSelection
|
||||
|
||||
- **参数:** 无
|
||||
|
||||
- **说明:** 清空所有选中的行
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
tableRef.value.clearSelection();
|
||||
```
|
||||
123
docs/api/table/props.md
Normal file
123
docs/api/table/props.md
Normal file
@ -0,0 +1,123 @@
|
||||
# Table组件 props
|
||||
|
||||
## data
|
||||
|
||||
- **详情:** 表格数据,数组格式
|
||||
|
||||
- **默认值:** `[]`
|
||||
|
||||
- **类型:** `Array<any>`
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
[
|
||||
{ id: 1, name: '张三', age: 20 },
|
||||
{ id: 2, name: '李四', age: 25 }
|
||||
]
|
||||
```
|
||||
|
||||
## columns
|
||||
|
||||
- **详情:** 表格列配置
|
||||
|
||||
- **默认值:** `[]`
|
||||
|
||||
- **类型:** `Array<ColumnConfig>`
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
[
|
||||
{ prop: 'name', label: '姓名', width: 120 },
|
||||
{ prop: 'age', label: '年龄', width: 80 }
|
||||
]
|
||||
```
|
||||
|
||||
## spanMethod
|
||||
|
||||
- **详情:** 合并行或列的计算方法
|
||||
|
||||
- **默认值:** `undefined`
|
||||
|
||||
- **类型:** `Function`
|
||||
|
||||
- **参数:**
|
||||
- `{ row, column, rowIndex, columnIndex }`
|
||||
|
||||
- **返回值:** `[rowspan, colspan]` 或 `{ rowspan, colspan }`
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
({ rowIndex, columnIndex }) => {
|
||||
if (rowIndex % 2 === 0) {
|
||||
if (columnIndex === 0) {
|
||||
return [1, 2];
|
||||
} else if (columnIndex === 1) {
|
||||
return [0, 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## loading
|
||||
|
||||
- **详情:** 是否显示加载状态
|
||||
|
||||
- **默认值:** `false`
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## showHeader
|
||||
|
||||
- **详情:** 是否显示表头
|
||||
|
||||
- **默认值:** `true`
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## bodyHeight
|
||||
|
||||
- **详情:** Table 的最大高度。合法的值为数字或者单位为 px 的高度
|
||||
|
||||
- **默认值:** `undefined`
|
||||
|
||||
- **类型:** `string | number`
|
||||
|
||||
- **示例:**
|
||||
```js
|
||||
bodyHeight: 400
|
||||
bodyHeight: '400px'
|
||||
```
|
||||
|
||||
## emptyText
|
||||
|
||||
- **详情:** 空数据时显示的文本内容
|
||||
|
||||
- **默认值:** `'暂无数据'`
|
||||
|
||||
- **类型:** `string`
|
||||
|
||||
## defaultExpandAll
|
||||
|
||||
- **详情:** 是否默认展开所有行,当 Table 包含展开行存在或者为树形表格时有效
|
||||
|
||||
- **默认值:** `false`
|
||||
|
||||
- **类型:** `boolean`
|
||||
|
||||
## rowkeyName
|
||||
|
||||
- **详情:** 行数据的 Key,用来优化 Table 的渲染
|
||||
|
||||
- **默认值:** `'id'`
|
||||
|
||||
- **类型:** `string`
|
||||
|
||||
- **说明:** 在使用 reserve-selection 功能与显示树形数据时,该属性是必填的
|
||||
|
||||
## border
|
||||
|
||||
- **详情:** 是否显示边框
|
||||
|
||||
- **默认值:** `false`
|
||||
|
||||
- **类型:** `boolean`
|
||||
7
docs/form-config/compare.md
Normal file
7
docs/form-config/compare.md
Normal file
@ -0,0 +1,7 @@
|
||||
# 表单对比
|
||||
tmagic-form可以支持两个版本的表单值对比,如果有容器嵌套,将在tab标签页展示对应tab下存在的差异数,便于在复杂嵌套表单场景下直观的看到差异情况
|
||||
## 使用方法
|
||||
在初始化表单时,需要传入当前版本的表单值,上一版本的表单值,以及表单配置,具体可参见[Form Playground](https://tencent.github.io/tmagic-editor/playground/index.html#/form)的demo演示
|
||||
## 效果展示
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20230301/c626071677661813135.png" alt="表单对比"/>
|
||||
|
||||
38
docs/form-config/editor-fields/code-link.md
Normal file
38
docs/form-config/editor-fields/code-link.md
Normal file
@ -0,0 +1,38 @@
|
||||
# CodeLink 代码链接
|
||||
|
||||
通过弹窗链接的方式编辑代码内容。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code-link',
|
||||
name: 'codeLink',
|
||||
text: '代码配置'
|
||||
}
|
||||
```
|
||||
|
||||
## 自定义弹窗标题
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code-link',
|
||||
name: 'codeLink',
|
||||
text: '代码配置',
|
||||
formTitle: '编辑代码'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| formTitle | 弹窗标题 | string | — | — |
|
||||
| codeOptions | 代码编辑器配置项 | object | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
37
docs/form-config/editor-fields/code-select-col.md
Normal file
37
docs/form-config/editor-fields/code-select-col.md
Normal file
@ -0,0 +1,37 @@
|
||||
# CodeSelectCol 代码块选择列
|
||||
|
||||
代码块选择器的列组件,支持选择代码块并配置参数。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code-select-col',
|
||||
name: 'codeId',
|
||||
text: '代码块'
|
||||
}
|
||||
```
|
||||
|
||||
## 禁止编辑
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code-select-col',
|
||||
name: 'codeId',
|
||||
text: '代码块',
|
||||
notEditable: true
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| notEditable | 是否不可编辑代码块(disable控制是否可选择) | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
33
docs/form-config/editor-fields/code-select.md
Normal file
33
docs/form-config/editor-fields/code-select.md
Normal file
@ -0,0 +1,33 @@
|
||||
# CodeSelect 代码块选择器
|
||||
|
||||
用于选择代码块并配置参数的组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code-select',
|
||||
name: 'codeSelect',
|
||||
text: '代码块'
|
||||
}
|
||||
```
|
||||
|
||||
## 功能说明
|
||||
|
||||
CodeSelect 组件支持:
|
||||
- 选择代码块
|
||||
- 选择数据源方法
|
||||
- 配置代码块参数
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| className | 自定义类名 | string | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
61
docs/form-config/editor-fields/code.md
Normal file
61
docs/form-config/editor-fields/code.md
Normal file
@ -0,0 +1,61 @@
|
||||
# Code 代码编辑器
|
||||
|
||||
代码编辑器字段,用于编辑代码内容。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code',
|
||||
name: 'code',
|
||||
text: '代码'
|
||||
}
|
||||
```
|
||||
|
||||
## 指定语言
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code',
|
||||
name: 'code',
|
||||
text: '代码',
|
||||
language: 'javascript'
|
||||
}
|
||||
```
|
||||
|
||||
## 自动调整大小
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'code',
|
||||
name: 'code',
|
||||
text: '代码',
|
||||
autosize: {
|
||||
minRows: 3,
|
||||
maxRows: 10
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| language | 代码语言 | string | javascript/typescript/json等 | — |
|
||||
| height | 编辑器高度 | string | — | — |
|
||||
| parse | 是否解析代码 | boolean | — | false |
|
||||
| options | 编辑器配置项 | object | — | — |
|
||||
| autosize | 自动调整大小配置 | object | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## autosize Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| minRows | 最小行数 | number | — | — |
|
||||
| maxRows | 最大行数 | number | — | — |
|
||||
37
docs/form-config/editor-fields/cond-op-select.md
Normal file
37
docs/form-config/editor-fields/cond-op-select.md
Normal file
@ -0,0 +1,37 @@
|
||||
# CondOpSelect 条件操作选择器
|
||||
|
||||
用于选择条件操作符的选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'cond-op',
|
||||
name: 'op',
|
||||
text: '操作符'
|
||||
}
|
||||
```
|
||||
|
||||
## 指定父级字段
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'cond-op',
|
||||
name: 'op',
|
||||
text: '操作符',
|
||||
parentFields: ['field1', 'field2']
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| parentFields | 父级字段 | string[] | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
67
docs/form-config/editor-fields/data-source-field-select.md
Normal file
67
docs/form-config/editor-fields/data-source-field-select.md
Normal file
@ -0,0 +1,67 @@
|
||||
# DataSourceFieldSelect 数据源字段选择器
|
||||
|
||||
用于选择数据源字段的级联选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-field-select',
|
||||
name: 'field',
|
||||
text: '数据源字段'
|
||||
}
|
||||
```
|
||||
|
||||
## 返回字段key
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-field-select',
|
||||
name: 'field',
|
||||
text: '数据源字段',
|
||||
value: 'key'
|
||||
}
|
||||
```
|
||||
|
||||
## 限制字段类型
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-field-select',
|
||||
name: 'field',
|
||||
text: '数据源字段',
|
||||
dataSourceFieldType: ['string', 'number']
|
||||
}
|
||||
```
|
||||
|
||||
## 父子节点不关联
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-field-select',
|
||||
name: 'field',
|
||||
text: '数据源字段',
|
||||
checkStrictly: true
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| value | 返回值类型 | string | key/value | — |
|
||||
| checkStrictly | 是否严格遵守父子节点不互相关联 | boolean / Function | — | — |
|
||||
| dataSourceFieldType | 允许选择的字段类型 | DataSourceFieldType[] | — | — |
|
||||
| fieldConfig | 自定义字段配置 | ChildConfig | — | — |
|
||||
| notEditable | 是否不可编辑数据源(disable控制是否可选择) | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## value说明
|
||||
- `key`: 不编译,返回数据源id和字段name
|
||||
- `value`: 编译后返回数据源data[field]
|
||||
25
docs/form-config/editor-fields/data-source-fields.md
Normal file
25
docs/form-config/editor-fields/data-source-fields.md
Normal file
@ -0,0 +1,25 @@
|
||||
# DataSourceFields 数据源字段配置
|
||||
|
||||
用于配置数据源字段的表单组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-fields',
|
||||
name: 'fields',
|
||||
text: '字段配置'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
25
docs/form-config/editor-fields/data-source-input.md
Normal file
25
docs/form-config/editor-fields/data-source-input.md
Normal file
@ -0,0 +1,25 @@
|
||||
# DataSourceInput 数据源输入框
|
||||
|
||||
支持绑定数据源的输入框组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-input',
|
||||
name: 'input',
|
||||
text: '输入框'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
37
docs/form-config/editor-fields/data-source-method-select.md
Normal file
37
docs/form-config/editor-fields/data-source-method-select.md
Normal file
@ -0,0 +1,37 @@
|
||||
# DataSourceMethodSelect 数据源方法选择器
|
||||
|
||||
用于选择数据源方法的选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-method-select',
|
||||
name: 'method',
|
||||
text: '数据源方法'
|
||||
}
|
||||
```
|
||||
|
||||
## 禁止编辑
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-method-select',
|
||||
name: 'method',
|
||||
text: '数据源方法',
|
||||
notEditable: true
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| notEditable | 是否不可编辑数据源(disable控制是否可选择) | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
25
docs/form-config/editor-fields/data-source-methods.md
Normal file
25
docs/form-config/editor-fields/data-source-methods.md
Normal file
@ -0,0 +1,25 @@
|
||||
# DataSourceMethods 数据源方法配置
|
||||
|
||||
用于配置数据源方法的表单组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-methods',
|
||||
name: 'methods',
|
||||
text: '方法配置'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
25
docs/form-config/editor-fields/data-source-mocks.md
Normal file
25
docs/form-config/editor-fields/data-source-mocks.md
Normal file
@ -0,0 +1,25 @@
|
||||
# DataSourceMocks 数据源Mock配置
|
||||
|
||||
用于配置数据源Mock数据的表单组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-mocks',
|
||||
name: 'mocks',
|
||||
text: 'Mock配置'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
55
docs/form-config/editor-fields/data-source-select.md
Normal file
55
docs/form-config/editor-fields/data-source-select.md
Normal file
@ -0,0 +1,55 @@
|
||||
# DataSourceSelect 数据源选择器
|
||||
|
||||
用于选择数据源的下拉选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-select',
|
||||
name: 'dataSource',
|
||||
text: '数据源'
|
||||
}
|
||||
```
|
||||
|
||||
## 过滤数据源类型
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-select',
|
||||
name: 'dataSource',
|
||||
text: '数据源',
|
||||
dataSourceType: 'http'
|
||||
}
|
||||
```
|
||||
|
||||
## 返回数据源ID
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'data-source-select',
|
||||
name: 'dataSource',
|
||||
text: '数据源',
|
||||
value: 'id'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| dataSourceType | 数据源类型过滤 | string | base/http等 | — |
|
||||
| value | 返回值类型 | string | id/value | — |
|
||||
| notEditable | 是否不可编辑数据源(disable控制是否可选择) | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## value说明
|
||||
- `id`: 不编译,返回数据源id
|
||||
- `value`: 编译后返回数据源data
|
||||
38
docs/form-config/editor-fields/display-conds.md
Normal file
38
docs/form-config/editor-fields/display-conds.md
Normal file
@ -0,0 +1,38 @@
|
||||
# DisplayConds 显示条件配置
|
||||
|
||||
用于配置组件显示条件的表单组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'display-conds',
|
||||
name: 'displayConds',
|
||||
text: '显示条件'
|
||||
}
|
||||
```
|
||||
|
||||
## 带标题前缀
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'display-conds',
|
||||
name: 'displayConds',
|
||||
text: '显示条件',
|
||||
titlePrefix: '条件'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| titlePrefix | 标题前缀 | string | — | — |
|
||||
| parentFields | 父级字段 | string[] / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
49
docs/form-config/editor-fields/event-select.md
Normal file
49
docs/form-config/editor-fields/event-select.md
Normal file
@ -0,0 +1,49 @@
|
||||
# EventSelect 事件选择器
|
||||
|
||||
用于配置组件或数据源事件的选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'event-select',
|
||||
name: 'events',
|
||||
text: '事件配置',
|
||||
src: 'component'
|
||||
}
|
||||
```
|
||||
|
||||
## 数据源事件
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'event-select',
|
||||
name: 'events',
|
||||
text: '事件配置',
|
||||
src: 'datasource'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| src | 事件来源 | string | datasource/component | — |
|
||||
| labelWidth | 标签宽度 | string | — | — |
|
||||
| eventNameConfig | 事件名称表单配置 | FormItem | — | — |
|
||||
| actionTypeConfig | 动作类型配置 | FormItem | — | — |
|
||||
| targetCompConfig | 联动组件配置 | FormItem | — | — |
|
||||
| compActionConfig | 联动组件动作配置 | FormItem | — | — |
|
||||
| codeActionConfig | 联动代码配置 | FormItem | — | — |
|
||||
| dataSourceActionConfig | 联动数据源配置 | FormItem | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## src说明
|
||||
- `component`: 组件事件
|
||||
- `datasource`: 数据源事件
|
||||
39
docs/form-config/editor-fields/key-value.md
Normal file
39
docs/form-config/editor-fields/key-value.md
Normal file
@ -0,0 +1,39 @@
|
||||
# KeyValue 键值对
|
||||
|
||||
用于配置键值对数据的表单组件。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'key-value',
|
||||
name: 'params',
|
||||
text: '参数'
|
||||
}
|
||||
```
|
||||
|
||||
## 高级模式
|
||||
|
||||
设置 `advanced` 为 `true`,可切换到代码编辑模式。
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'key-value',
|
||||
name: 'params',
|
||||
text: '参数',
|
||||
advanced: true
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| advanced | 是否支持高级模式(代码编辑) | boolean | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
30
docs/form-config/editor-fields/page-fragment-select.md
Normal file
30
docs/form-config/editor-fields/page-fragment-select.md
Normal file
@ -0,0 +1,30 @@
|
||||
# PageFragmentSelect 页面片选择器
|
||||
|
||||
用于选择页面片的下拉选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'page-fragment-select',
|
||||
name: 'pageFragment',
|
||||
text: '页面片'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## 使用说明
|
||||
|
||||
1. 下拉框会自动列出当前项目中所有的页面片
|
||||
2. 选中页面片后,点击编辑图标可跳转到对应页面片进行编辑
|
||||
33
docs/form-config/editor-fields/ui-select.md
Normal file
33
docs/form-config/editor-fields/ui-select.md
Normal file
@ -0,0 +1,33 @@
|
||||
# UISelect 组件选择器
|
||||
|
||||
用于在画布中选择组件的选择器。
|
||||
|
||||
::: warning 注意
|
||||
此组件仅在编辑器环境中可用,需要配合 `@tmagic/editor` 使用。
|
||||
:::
|
||||
|
||||
## 基础用法
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'ui-select',
|
||||
name: 'targetId',
|
||||
text: '目标组件'
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## 使用说明
|
||||
|
||||
1. 点击"点击此处选择"按钮进入选择模式
|
||||
2. 在画布中点击目标组件完成选择
|
||||
3. 选择后会显示组件名称和ID
|
||||
4. 可通过清除按钮清空选择
|
||||
5. 点击组件名称可跳转到对应组件
|
||||
454
docs/form-config/fields/cascader.md
Normal file
454
docs/form-config/fields/cascader.md
Normal file
@ -0,0 +1,454 @@
|
||||
# Cascader 级联选择器
|
||||
|
||||
当一个数据集合有清晰的层级结构时,可通过级联选择器逐级查看并选择。
|
||||
|
||||
## 基础用法
|
||||
|
||||
有两种触发子菜单的方式
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}]
|
||||
}, {
|
||||
value: 'daohang',
|
||||
label: '导航',
|
||||
children: [{
|
||||
value: 'cexiangdaohang',
|
||||
label: '侧向导航'
|
||||
}, {
|
||||
value: 'dingbudaohang',
|
||||
label: '顶部导航'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}]
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form',
|
||||
children: [{
|
||||
value: 'checkbox',
|
||||
label: 'Checkbox 多选框'
|
||||
}, {
|
||||
value: 'input',
|
||||
label: 'Input 输入框'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]"><template #source><p>type为'cascader'</p></template></demo-block>
|
||||
|
||||
## 禁用选项
|
||||
|
||||
通过在数据源中设置 disabled 字段来声明该选项是禁用的
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
disabled: true,
|
||||
options: [
|
||||
]
|
||||
}, {
|
||||
type: 'cascader',
|
||||
name: 'cascader1',
|
||||
text: '选项2',
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
disabled: true,
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}]
|
||||
}, {
|
||||
value: 'daohang',
|
||||
label: '导航',
|
||||
children: [{
|
||||
value: 'cexiangdaohang',
|
||||
label: '侧向导航'
|
||||
}, {
|
||||
value: 'dingbudaohang',
|
||||
label: '顶部导航'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
disabled: true,
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}]
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form',
|
||||
children: [{
|
||||
value: 'checkbox',
|
||||
label: 'Checkbox 多选框'
|
||||
}, {
|
||||
value: 'input',
|
||||
disabled: true,
|
||||
label: 'Input 输入框'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
本例中,options 指定的数组中的第一个元素含有 disabled: true 键值对,因此是禁用的。在默认情况下,Cascader 会检查数据中每一项的 disabled 字段是否为 true ,如果你的数据中表示禁用含义的字段名不为 disabled ,可以通过 disabled 属性来指定(详见下方 API 表格)。当然, value 、 label 和 children 这三个字段名也可以通过同样的方式指定。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 多选
|
||||
|
||||
可通过 `multiple = true` 来开启多选模式
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
multiple: true,
|
||||
placeholder: '请选择',
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}]
|
||||
}, {
|
||||
value: 'daohang',
|
||||
label: '导航',
|
||||
children: [{
|
||||
value: 'cexiangdaohang',
|
||||
label: '侧向导航'
|
||||
}, {
|
||||
value: 'dingbudaohang',
|
||||
label: '顶部导航'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}]
|
||||
}, {
|
||||
value: 'form',
|
||||
label: 'Form',
|
||||
children: [{
|
||||
value: 'checkbox',
|
||||
label: 'Checkbox 多选框'
|
||||
}, {
|
||||
value: 'input',
|
||||
label: 'Input 输入框'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
在开启多选模式后,默认情况下会展示所有已选中的选项的Tag
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 任意一级可选
|
||||
|
||||
在单选模式下,你只能选择叶子节点;而在多选模式下,勾选父节点真正选中的都是叶子节点。启用该功能后,可让父子节点取消关联,选择任意一级选项。
|
||||
|
||||
可通过 `checkStrictly = true` 来设置父子节点取消选中关联,从而达到选择任意一级选项的目的。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
checkStrictly: true,
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 checkStrictly 为 true,可选择任意一级选项
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 仅返回选中节点的值
|
||||
|
||||
在选中节点改变时,默认返回由该节点所在的各级菜单的值所组成的数组。可通过 `emitPath = false` 设置仅返回该节点的值。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
emitPath: false,
|
||||
checkStrictly: true,
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}, {
|
||||
value: 'fankui',
|
||||
label: '反馈'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}, {
|
||||
value: 'color',
|
||||
label: 'Color 色彩'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 emitPath 为 false,仅返回选中节点的值,而非完整路径数组
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 值分隔符
|
||||
|
||||
当需要将选中值以字符串形式存储时,可通过 `valueSeparator` 指定分隔符,组件会自动将数组转换为字符串存储,读取时也会自动还原。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
valueSeparator: '/',
|
||||
options: [
|
||||
{
|
||||
value: 'zhinan',
|
||||
label: '指南',
|
||||
children: [{
|
||||
value: 'shejiyuanze',
|
||||
label: '设计原则',
|
||||
children: [{
|
||||
value: 'yizhi',
|
||||
label: '一致'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
value: 'zujian',
|
||||
label: '组件',
|
||||
children: [{
|
||||
value: 'basic',
|
||||
label: 'Basic',
|
||||
children: [{
|
||||
value: 'layout',
|
||||
label: 'Layout 布局'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 valueSeparator 为 '/',选中值将以 'zhinan/shejiyuanze/yizhi' 的字符串形式存储
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 远程选项
|
||||
|
||||
通过接口请求获取选项列表
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
placeholder: '请选择',
|
||||
remote: true,
|
||||
option: {
|
||||
url: 'cascader/remote',
|
||||
root: 'data',
|
||||
cache: true,
|
||||
timeout: 5000,
|
||||
body: { query: '' },
|
||||
item: (data) => data
|
||||
}
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 remote 为 true,然后配置 option 对象,而不是 options 数组
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
同时在 `src/main.ts` 中需要自定义实现请求:
|
||||
|
||||
```typescript
|
||||
app.use(MagicForm, {
|
||||
request: async (options: any) => {
|
||||
// 自定义请求实现
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## 动态选项
|
||||
|
||||
options 支持传入函数,可根据表单其他字段动态生成选项列表
|
||||
|
||||
```typescript
|
||||
{
|
||||
type: 'cascader',
|
||||
name: 'cascader',
|
||||
text: '选项',
|
||||
options: (mForm, { model, formValue }) => {
|
||||
// 根据表单值动态返回选项
|
||||
return [
|
||||
{ value: 'a', label: '选项A', children: [] }
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Cascader Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | false |
|
||||
| multiple | 是否多选 | boolean | — | false |
|
||||
| emitPath | 在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false,则只返回该节点的值 | boolean | — | true |
|
||||
| checkStrictly | 是否严格的遵守父子节点不互相关联 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | false |
|
||||
| valueSeparator | 合并成字符串时的分隔符 | string / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
| popperClass | 弹出内容的自定义类名 | string | — | — |
|
||||
| remote | 是否为远程搜索 | boolean | — | false |
|
||||
| options | 选项数据源 | Array / Function | — | — |
|
||||
| option | 远程选项配置 | Object | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
|
||||
## options item
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| value | 选项的值 | any | — | — |
|
||||
| label | 选项的标签 | string | — | — |
|
||||
| children | 子选项 | Array | — | — |
|
||||
|
||||
## option(远程配置)
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| url | 请求地址 | string | — | — |
|
||||
| root | 响应数据的根路径 | string | — | — |
|
||||
| cache | 是否缓存请求结果 | boolean | — | false |
|
||||
| timeout | 请求超时时间(毫秒) | number | — | — |
|
||||
| body | 请求体 | Object / Function | — | — |
|
||||
| item | 数据转换函数,将响应数据转换为选项格式 | Function | — | — |
|
||||
180
docs/form-config/fields/checkbox.md
Normal file
180
docs/form-config/fields/checkbox.md
Normal file
@ -0,0 +1,180 @@
|
||||
# Checkbox 多选框
|
||||
|
||||
一组备选项中进行多选
|
||||
|
||||
## 基础用法
|
||||
|
||||
单独使用可以表示两种状态之间的切换。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox',
|
||||
name: 'checkbox',
|
||||
text: '选项'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
要使用 Checkbox 组件,只需要配置 type: 'checkbox',选中意味着变量的值为 true。默认绑定变量的值会是 Boolean,选中为 true。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 禁用状态
|
||||
|
||||
多选框不可用状态。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
disabled: () => true
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
设置 disabled 属性即可,它接受一个 Boolean,true 为禁用,也可以接受一个返回 Boolean 的函数。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 自定义选中值
|
||||
|
||||
通过 `activeValue` 和 `inactiveValue` 自定义选中和未选中时的值。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
activeValue: 'yes',
|
||||
inactiveValue: 'no'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
设置 activeValue 为选中时的值,inactiveValue 为未选中时的值。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 数值类型
|
||||
|
||||
当需要绑定数值类型时,可以使用 `filter: 'number'` 配合默认的 activeValue/inactiveValue。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
filter: 'number'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 filter 为 'number' 时,默认 activeValue 为 1,inactiveValue 为 0。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 使用 Label 显示
|
||||
|
||||
通过 `useLabel` 属性控制是否使用 label 作为显示内容。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
useLabel: true
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
设置 useLabel 为 true 时,不显示 text 内容,由外部 label 控制显示。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 多选框组
|
||||
|
||||
适用于多个勾选框绑定到同一个数组的情景,通过是否勾选来表示这一组选项中选中的项。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox-group',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
options: [
|
||||
{ text: '选项1', value: 1 },
|
||||
{ text: '选项2', value: 2 },
|
||||
{ text: '选项3', value: 3 }
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
checkbox-group 元素能把多个 checkbox 管理为一组,绑定值为数组类型。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 多选框组禁用选项
|
||||
|
||||
在选项中设置 `disabled` 可禁用单个选项。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'checkbox-group',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
options: [
|
||||
{ text: '选项1', value: 1 },
|
||||
{ text: '选项2', value: 2, disabled: true },
|
||||
{ text: '选项3', value: 3 }
|
||||
]
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
在 options 中设置 disabled: true 可禁用该选项。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 动态选项
|
||||
|
||||
options 支持函数形式,可根据表单状态动态生成选项。
|
||||
|
||||
```typescript
|
||||
{
|
||||
type: 'checkbox-group',
|
||||
name: 'checkbox',
|
||||
text: '选项',
|
||||
options: (mForm, { model, formValue }) => {
|
||||
// 根据表单值动态返回选项
|
||||
return [
|
||||
{ text: '选项A', value: 'a' },
|
||||
{ text: '选项B', value: 'b' }
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Checkbox Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | false |
|
||||
| activeValue | 选中时的值 | string / number | — | true(filter 为 'number' 时默认 1) |
|
||||
| inactiveValue | 未选中时的值 | string / number | — | false(filter 为 'number' 时默认 0) |
|
||||
| useLabel | 是否使用外部 label 显示 | boolean | — | false |
|
||||
| filter | 值过滤器 | 'number' / Function | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
|
||||
## CheckboxGroup Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | false |
|
||||
| options | 选项列表 | Array / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
|
||||
## options item
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| value | 选项的值 | any | — | — |
|
||||
| text | 选项的标签 | string | — | — |
|
||||
| disabled | 是否禁用该选项 | boolean | — | false |
|
||||
86
docs/form-config/fields/color-picker.md
Normal file
86
docs/form-config/fields/color-picker.md
Normal file
@ -0,0 +1,86 @@
|
||||
# ColorPicker 颜色选择器
|
||||
|
||||
用于颜色选择,支持多种颜色格式,包括透明度设置。
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
text: '颜色选择器',
|
||||
type: 'colorPicker',
|
||||
name: 'color'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
type 为 'colorPicker',默认支持透明度选择(showAlpha: true)。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 禁用状态
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
text: '颜色选择器',
|
||||
type: 'colorPicker',
|
||||
name: 'color',
|
||||
disabled: true
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
设置 disabled 属性可禁用颜色选择器。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 设置默认值
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
text: '颜色选择器',
|
||||
type: 'colorPicker',
|
||||
name: 'color',
|
||||
defaultValue: '#409EFF'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过 defaultValue 设置默认颜色值。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 带透明度的颜色
|
||||
|
||||
颜色选择器默认开启透明度选择,返回值为 rgba 格式。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
text: '颜色选择器',
|
||||
type: 'colorPicker',
|
||||
name: 'color',
|
||||
defaultValue: 'rgba(64, 158, 255, 0.5)'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
支持 rgba 格式的颜色值,可以设置透明度。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## ColorPicker Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|------|------|------|--------|--------|
|
||||
| name | 绑定值 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | false |
|
||||
| defaultValue | 默认颜色值 | string | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form-schema/src/base.ts) | — | — |
|
||||
|
||||
## 颜色格式说明
|
||||
|
||||
支持以下颜色格式:
|
||||
|
||||
| 格式 | 示例 | 说明 |
|
||||
|------|------|------|
|
||||
| HEX | #409EFF | 十六进制颜色值 |
|
||||
| RGB | rgb(64, 158, 255) | RGB 颜色值 |
|
||||
| RGBA | rgba(64, 158, 255, 0.5) | 带透明度的 RGBA 颜色值 |
|
||||
| HSL | hsl(210, 100%, 63%) | HSL 颜色值 |
|
||||
| HSLA | hsla(210, 100%, 63%, 0.5) | 带透明度的 HSLA 颜色值 |
|
||||
112
docs/form-config/fields/date-picker.md
Normal file
112
docs/form-config/fields/date-picker.md
Normal file
@ -0,0 +1,112 @@
|
||||
# DatePicker 日期选择器
|
||||
|
||||
用于选择或输入日期
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'date',
|
||||
name: 'date',
|
||||
text: '日期选择器'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
以日期为基本单位,基础的日期选择控件
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 禁用状态
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'date',
|
||||
name: 'date',
|
||||
text: '日期选择器',
|
||||
disabled: () => true
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过 <code>disabled</code> 属性禁用日期选择器
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 占位符
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'date',
|
||||
name: 'date',
|
||||
text: '日期选择器',
|
||||
placeholder: '请选择日期'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过 <code>placeholder</code> 属性设置输入框占位文本
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 日期格式
|
||||
|
||||
使用`format`指定输入框的格式;使用`valueFormat`指定绑定值的格式。
|
||||
|
||||
默认情况下,组件的 `format` 默认值为 `YYYY/MM/DD`,`valueFormat` 默认值为 `YYYY/MM/DD`。以下为可用的格式化字串,以 UTC 2017年1月2日 03:04:05 为例:
|
||||
|
||||
:::warning
|
||||
请注意大小写
|
||||
:::
|
||||
|
||||
| 格式 | 含义 | 备注 | 举例 |
|
||||
|------|------|------|------|
|
||||
| `YYYY` | 年 | | 2017 |
|
||||
| `M` | 月 | 不补0 | 1 |
|
||||
| `MM` | 月 | | 01 |
|
||||
| `D` | 日 | 不补0 | 2 |
|
||||
| `DD` | 日 | | 02 |
|
||||
| `H` | 小时 | 24小时制;不补0 | 3 |
|
||||
| `HH` | 小时 | 24小时制 | 03 |
|
||||
| `h` | 小时 | 12小时制,须和 `A` 或 `a` 使用;不补0 | 3 |
|
||||
| `hh` | 小时 | 12小时制,须和 `A` 或 `a` 使用 | 03 |
|
||||
| `m` | 分钟 | 不补0 | 4 |
|
||||
| `mm` | 分钟 | | 04 |
|
||||
| `s` | 秒 | 不补0 | 5 |
|
||||
| `ss` | 秒 | | 05 |
|
||||
| `x` | JS时间戳 | 组件绑定值为`number`类型 | 1483326245000 |
|
||||
| `[MM]` | 不需要格式化字符 | 使用方括号标识不需要格式化的字符 (如 [A] [MM]) | MM |
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'date',
|
||||
name: 'date',
|
||||
text: '日期选择器',
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'x'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
设置 <code>valueFormat</code> 为 <code>timestamp</code>,绑定值将返回时间戳格式
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| name | 绑定值的字段名 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| format | 显示在输入框中的格式 | string | 见[日期格式](#日期格式) | YYYY/MM/DD |
|
||||
| valueFormat | 绑定值的格式。不指定则绑定值为 Date 对象 | string | 见[日期格式](#日期格式) | YYYY/MM/DD |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | — |
|
||||
|
||||
## TypeScript 定义
|
||||
|
||||
```typescript
|
||||
interface DateConfig extends FormItem, Input {
|
||||
type: 'date';
|
||||
format?: 'YYYY-MM-dd HH:mm:ss' | string;
|
||||
valueFormat?: 'YYYY-MM-dd HH:mm:ss' | string;
|
||||
}
|
||||
```
|
||||
|
||||
46
docs/form-config/fields/daterange-picker.md
Normal file
46
docs/form-config/fields/daterange-picker.md
Normal file
@ -0,0 +1,46 @@
|
||||
# DateRangePicker 日期范围选择器
|
||||
|
||||
用于选择或输入日期范围
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'daterange',
|
||||
name: 'daterange',
|
||||
text: '日期范围'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
type为'daterange'
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 绑定多个字段
|
||||
|
||||
可以通过配置 `names` 来将日期范围绑定到两个不同的字段上。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'daterange',
|
||||
names: ['startTime', 'endTime'],
|
||||
text: '日期范围'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 names 属性,将开始时间和结束时间分别绑定到 startTime 和 endTime 字段。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| name | 绑定值(数组形式) | string | — | — |
|
||||
| names | 绑定值(拆分为两个字段) | string[] | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| dateFormat | 日期格式 | string | — | YYYY/MM/DD |
|
||||
| timeFormat | 时间格式 | string | — | HH:mm:ss |
|
||||
| valueFormat | 绑定值的格式 | string | — | YYYY/MM/DD HH:mm:ss |
|
||||
| defaultTime | 默认时间 | Date[] | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
104
docs/form-config/fields/datetime-picker.md
Normal file
104
docs/form-config/fields/datetime-picker.md
Normal file
@ -0,0 +1,104 @@
|
||||
# DateTimePicker 日期时间选择器
|
||||
|
||||
在同一个选择器里选择日期和时间
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'datetime',
|
||||
name: 'dateTime',
|
||||
text: '日期时间选择器'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过设置 <code>type: 'datetime'</code> 使用日期时间选择器,可以同时选择日期和时间。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 带占位符
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'datetime',
|
||||
name: 'dateTime',
|
||||
text: '日期时间选择器',
|
||||
placeholder: '请选择日期时间'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过 <code>placeholder</code> 属性设置输入框的占位文本。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 禁用状态
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'datetime',
|
||||
name: 'dateTime',
|
||||
text: '日期时间选择器',
|
||||
disabled: () => true
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
通过 <code>disabled</code> 属性禁用日期时间选择器,支持布尔值或函数。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 日期格式
|
||||
|
||||
使用 `format` 指定输入框的格式;使用 `valueFormat` 指定绑定值的格式。
|
||||
|
||||
默认情况下,组件接受并返回格式化后的字符串。以下为可用的格式化字串,以 UTC 2017年1月2日 03:04:05 为例:
|
||||
|
||||
:::warning
|
||||
请注意大小写
|
||||
:::
|
||||
|
||||
| 格式 | 含义 | 备注 | 举例 |
|
||||
|------|------|------|------|
|
||||
| `YYYY` | 年 | | 2017 |
|
||||
| `M` | 月 | 不补0 | 1 |
|
||||
| `MM` | 月 | | 01 |
|
||||
| `D` | 日 | 不补0 | 2 |
|
||||
| `DD` | 日 | | 02 |
|
||||
| `H` | 小时 | 24小时制;不补0 | 3 |
|
||||
| `HH` | 小时 | 24小时制 | 03 |
|
||||
| `h` | 小时 | 12小时制,须和 `A` 或 `a` 使用;不补0 | 3 |
|
||||
| `hh` | 小时 | 12小时制,须和 `A` 或 `a` 使用 | 03 |
|
||||
| `m` | 分钟 | 不补0 | 4 |
|
||||
| `mm` | 分钟 | | 04 |
|
||||
| `s` | 秒 | 不补0 | 5 |
|
||||
| `ss` | 秒 | | 05 |
|
||||
| `A` | AM/PM | 仅 `format` 可用,大写 | AM |
|
||||
| `a` | am/pm | 仅 `format` 可用,小写 | am |
|
||||
| `x` | JS时间戳(毫秒) | 仅 `valueFormat` 可用 | 1483326245000 |
|
||||
| `X` | Unix时间戳(秒) | 仅 `valueFormat` 可用 | 1483326245 |
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'datetime',
|
||||
name: 'dateTime',
|
||||
text: '日期时间选择器',
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
valueFormat: 'x'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
自定义格式化:显示格式为 <code>YYYY-MM-DD HH:mm</code>,绑定值格式为时间戳。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## Attributes
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| name | 绑定值的字段名 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| format | 显示在输入框中的格式 | string | 见[日期格式](#日期格式) | YYYY/MM/DD HH:mm:ss |
|
||||
| valueFormat | 绑定值的格式 | string | 见[日期格式](#日期格式) | YYYY/MM/DD HH:mm:ss |
|
||||
| defaultTime | 选择日期后的默认时间值 | Date | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | — |
|
||||
52
docs/form-config/fields/dynamic-field.md
Normal file
52
docs/form-config/fields/dynamic-field.md
Normal file
@ -0,0 +1,52 @@
|
||||
# DynamicField 动态表单
|
||||
|
||||
根据模型中某个字段的值,动态生成一组表单字段。
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'select',
|
||||
name: 'type',
|
||||
text: '类型',
|
||||
options: [
|
||||
{ label: '类型A', value: 'a' },
|
||||
{ label: '类型B', value: 'b' }
|
||||
]
|
||||
}, {
|
||||
type: 'dynamic-field',
|
||||
text: '动态字段',
|
||||
dynamicKey: 'type',
|
||||
returnFields: async (config, model, request) => {
|
||||
if (model.type === 'a') {
|
||||
return [{ name: 'fieldA', label: '字段A', defaultValue: 'valueA' }];
|
||||
} else if (model.type === 'b') {
|
||||
return [{ name: 'fieldB', label: '字段B', defaultValue: 'valueB' }];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
当“类型”发生变化时,“动态字段”会根据 `returnFields` 返回的配置生成不同的输入框。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
:::warning
|
||||
特别注意:`dynamic-field` 的上一级配置必须设置 `extensible: true`,才能保存未在 schema 中声明的动态字段。
|
||||
:::
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| type | 组件类型 | string | dynamic-field | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| dynamicKey | 监听的字段名。当该字段值变化时,触发 `returnFields` 重新计算 | string | — | — |
|
||||
| returnFields | 返回字段列表的函数 | (config, model, request) => Promise<Field[]> | — | — |
|
||||
|
||||
### Field 对象结构
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------- |
|
||||
| name | 字段名 | string | — |
|
||||
| label | 标签名 | string | — |
|
||||
| defaultValue | 默认值 | any | — |
|
||||
26
docs/form-config/fields/number-range.md
Normal file
26
docs/form-config/fields/number-range.md
Normal file
@ -0,0 +1,26 @@
|
||||
# NumberRange 数字范围输入框
|
||||
|
||||
用于输入数字范围
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'number-range',
|
||||
name: 'numberRange',
|
||||
text: '数字范围'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
type为'number-range'
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| name | 绑定值(数组形式 [min, max]) | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| clearable | 是否可清空 | boolean | — | true |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
@ -53,10 +53,11 @@
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|----------|-------------- |----------|-------------------------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| min | 设置计数器允许的最小值 | number | — | -Infinity |
|
||||
| max | 设置计数器允许的最大值 | number | — | Infinity |
|
||||
| step | 计数器步长 | number | — | 1 |
|
||||
| tooltip | 输入框提示信息 | string | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
@ -5,8 +5,8 @@
|
||||
## TS 定义
|
||||
|
||||
```typescript
|
||||
interface RedioGroup extends FormItem {
|
||||
type: 'redioGroup';
|
||||
interface RadioGroup extends FormItem {
|
||||
type: 'radio-group';
|
||||
options: {
|
||||
value: any;
|
||||
text: string;
|
||||
@ -144,7 +144,7 @@
|
||||
placeholder: '请选择',
|
||||
remote: true,
|
||||
option: {
|
||||
url: 'xxx',
|
||||
url: 'select/remote',
|
||||
root: 'data',
|
||||
method: 'post',
|
||||
mode: 'cors',
|
||||
@ -162,6 +162,15 @@
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
同时在 `src/main.ts` 中需要自定义实现请求
|
||||
```typescript
|
||||
app.use(MagicForm, {
|
||||
request: async (options: any) => {
|
||||
// 自定义请求实现
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
:::tip
|
||||
如果 Select 的绑定值为对象类型,请务必指定 valueKey 作为它的唯一性标识。
|
||||
:::
|
||||
@ -110,15 +110,16 @@
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| name | 绑定值 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| tooltip | 输入时显示内容 | boolean | — | false |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| clearable | 是否可清空 | boolean | — | true |
|
||||
| tooltip | 输入时显示内容 | string | — | — |
|
||||
| trim | 是否去掉首尾空格 | boolean | — | false |
|
||||
| filter | 过滤值 | string / Function | number | - |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler ](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
| prepend | 前置内容 | string | — | - |
|
||||
| append | 后置内容 | string / Object | — | - |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
|
||||
## append Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
45
docs/form-config/fields/timerange-picker.md
Normal file
45
docs/form-config/fields/timerange-picker.md
Normal file
@ -0,0 +1,45 @@
|
||||
# TimeRangePicker 时间范围选择器
|
||||
|
||||
用于选择或输入时间范围
|
||||
|
||||
## 基础用法
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'timerange',
|
||||
name: 'timerange',
|
||||
text: '时间范围'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
type为'timerange'
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## 绑定多个字段
|
||||
|
||||
可以通过配置 `names` 来将时间范围绑定到两个不同的字段上。
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'timerange',
|
||||
names: ['startTime', 'endTime'],
|
||||
text: '时间范围'
|
||||
}]">
|
||||
<template #source>
|
||||
<p>
|
||||
配置 names 属性,将开始时间和结束时间分别绑定到 startTime 和 endTime 字段。
|
||||
</p>
|
||||
</template>
|
||||
</demo-block>
|
||||
|
||||
## Attributes
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||
| name | 绑定值(数组形式) | string | — | — |
|
||||
| names | 绑定值(拆分为两个字段) | string[] | — | — |
|
||||
| text | 表单标签 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean / [FilterFunction](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | false |
|
||||
| format | 显示格式 | string | — | HH:mm:ss |
|
||||
| valueFormat | 绑定值的格式 | string | — | HH:mm:ss |
|
||||
| defaultTime | 默认时间 | Date[] | — | — |
|
||||
| onChange | 值变化时触发的函数 | [OnChangeHandler](https://github.com/Tencent/tmagic-editor/blob/master/packages/form/src/schema.ts) | — | - |
|
||||
@ -19,7 +19,8 @@
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'row',
|
||||
labelWidth: 100,
|
||||
labelWidth: '100px',
|
||||
span: 8,
|
||||
items: [{
|
||||
name: 'text',
|
||||
text: '配置1',
|
||||
@ -33,7 +34,7 @@
|
||||
}, {
|
||||
type: 'row',
|
||||
span: 12,
|
||||
labelWidth: 100,
|
||||
labelWidth: '100px',
|
||||
items: [{
|
||||
name: 'text4',
|
||||
text: '配置1',
|
||||
@ -50,11 +51,11 @@
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
name: 'text0',
|
||||
labelWidth: 100,
|
||||
labelWidth: '100px',
|
||||
text: '配置0',
|
||||
}, {
|
||||
type: 'row',
|
||||
labelWidth: 100,
|
||||
labelWidth: '100px',
|
||||
items: [{
|
||||
name: 'text',
|
||||
text: '配置1',
|
||||
@ -86,7 +87,7 @@
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'fieldset',
|
||||
labelWidth: 100,
|
||||
labelWidth: '100px',
|
||||
legend: 'fieldset',
|
||||
items: [{
|
||||
name: 'text',
|
||||
@ -177,3 +178,38 @@
|
||||
label: '配置1',
|
||||
}]
|
||||
}]"></demo-block>
|
||||
|
||||
### step
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'step',
|
||||
items: [{
|
||||
title: '步骤1',
|
||||
items: [{
|
||||
name: 'text',
|
||||
text: '配置1',
|
||||
}]
|
||||
}, {
|
||||
title: '步骤2',
|
||||
items: [{
|
||||
name: 'text2',
|
||||
text: '配置2',
|
||||
}]
|
||||
}]
|
||||
}]"></demo-block>
|
||||
|
||||
### flex-layout
|
||||
|
||||
<demo-block type="form" :config="[{
|
||||
type: 'flex-layout',
|
||||
gap: '20px',
|
||||
items: [{
|
||||
name: 'text',
|
||||
text: '配置1',
|
||||
span: 12
|
||||
}, {
|
||||
name: 'text2',
|
||||
text: '配置2',
|
||||
span: 12
|
||||
}]
|
||||
}]"></demo-block>
|
||||
@ -17,12 +17,16 @@
|
||||
<demo-block type="form" :config="[{
|
||||
name: 'firstName',
|
||||
text: '名',
|
||||
onChange: (state, v, { model }) => model.fullName = `${model.lastName}${model.firstName}`,
|
||||
onChange: (state, v, { model }) => {
|
||||
model.fullName = `${model.lastName}${model.firstName}`
|
||||
},
|
||||
defaultValue: '三'
|
||||
}, {
|
||||
name: 'lastName',
|
||||
text: '姓',
|
||||
onChange: (state, v, { model }) => model.fullName = `${model.lastName}${model.firstName}`,
|
||||
onChange: (state, v, { model }) => {
|
||||
model.fullName = `${model.lastName}${model.firstName}`
|
||||
},
|
||||
defaultValue: '张'
|
||||
}, {
|
||||
name: 'fullName',
|
||||
92
docs/guide/advanced/code-block.md
Normal file
92
docs/guide/advanced/code-block.md
Normal file
@ -0,0 +1,92 @@
|
||||
# 代码块
|
||||
代码块是一种低代码能力,tmagic-editor中对组件的逻辑干预主要通过代码块来进行支持
|
||||
|
||||
## 能力展示
|
||||
代码块支持的能力有
|
||||
- 1、在线编辑
|
||||
- 2、参数定义,包括:参数类型定义
|
||||
- 3、自动保存草稿
|
||||
- 4、参数注释
|
||||
下面将主要介绍代码块的实现原理,包含dsl结构定义,以及代码块挂载执行时机等
|
||||
## 协议描述
|
||||
我们将在线编写的代码内容保存在[DSL](../advanced/js-schema.md)中,与app同一层级,这样的好处是代码块可以在同一活动,不同页面中实现灵活编排。
|
||||
类型定义参见[CodeBlockDsl](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/schema/src/index.ts#L75)。
|
||||
|
||||
```javascript
|
||||
[{
|
||||
id: 123456,
|
||||
type: 'app',
|
||||
items: [{
|
||||
id: 222222,
|
||||
type: 'page',
|
||||
items: [{
|
||||
id: 333,
|
||||
type: 'comp-A'
|
||||
}]
|
||||
}],
|
||||
codeBlocks: {
|
||||
code_123: {
|
||||
name: '代码块名称',
|
||||
content: ()=>{},
|
||||
params: [{
|
||||
name: '参数1'
|
||||
}]
|
||||
}
|
||||
}
|
||||
}]
|
||||
```
|
||||
|
||||
在页面中创建代码块也就是会将新的代码内容添加到DSL中的codeBlocks数组并保存下来,这里涉及的逻辑可以参见CodeBlock类中的[setCodeDslById](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/editor/src/services/codeBlock.ts#L107)方法。
|
||||
并且可以在编辑器左侧的“代码块”tab下看到当前活动的代码块列表
|
||||
<img src="/code-block.png" alt="代码块列表">
|
||||
|
||||
## 组件绑定
|
||||
代码块的初衷是为了实现对组件逻辑的在线干预(代码执行的时机平台提供了组件created, mounted两个钩子),因此我们需要将创建的代码与组件进行关联。
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20230228/4a34a11677585505930.png" alt="组件绑定代码块">
|
||||
选中组件之后,在组件配置-高级tab下需要支持下拉选择代码块,以及代码参数的输入。由于每一个组件绑定代码块的需求都是相同的,因此这一部分我们可以抽出为公共的表单配置,相关的逻辑处理在[prop文件](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/editor/src/utils/props.ts#L223)中,我们在高级tab下统一添加了名为created和mounted两个配置项,表单组件使用了自定义的'code-select'。前面已经提过,表单组件会按照type字段来进行渲染,即 :is="${type}",[CodeSelect](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/editor/src/fields/CodeSelect.vue)组件是在editor中自定义的
|
||||
|
||||
完成绑定的动作实质就是在组件配置中增加与代码块的映射关系
|
||||
```javascript
|
||||
[
|
||||
{
|
||||
id: '111',
|
||||
type: 'comp_A',
|
||||
created: {
|
||||
hookType: 'code',
|
||||
hookData: [
|
||||
{
|
||||
codeId: 'code_123',
|
||||
params: {
|
||||
age: 12,
|
||||
studentName: 'lisa'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## 代码内容注入与执行
|
||||
在实现代码块创建和绑定操作之后,DSL已经包含了代码块执行所需的所有信息,接下来我们在页面加载时对代码块进行解析,并在适当的时机运行。
|
||||
|
||||
由于代码块的执行时机为组件created,mounted,因此触发执行的动作需要在runtime中完成,对于VUE3来说,我们在组件对应的生命周期去触发就可以了,react则需要在类似的时间点去触发,详细请参见[ui](https://github.com/Tencent/tmagic-editor/blob/master/packages/ui/src/useApp.ts#L29)
|
||||
|
||||
接收事件的动作是在[Core](https://github.com/Tencent/tmagic-editor/blob/c143a5f7670ae61d80c1a2cfcc780cfb5259849d/packages/core/src/Node.ts)中完成的,请记得前面提到过Core主要负责对组件进行跨框架管理与一些通用复杂逻辑的实现,触发时机各个框架不同,但接收事件并执行代码块的逻辑与框架无关。[Core/Node](https://github.com/Tencent/tmagic-editor/blob/master/packages/core/src/Node.ts#L56)会对生命周期事件进行监听,并根据组件绑定的代码块ID拿到具体的代码内容,然后执行。在执行调用时我们以{ app, params }的形式传入了两个参数,其中app包含了全局的变量,params为组件绑定时针对代码块传入的参数。
|
||||
|
||||
至此,我们就完成了代码块创建-绑定-注入-运行。与代码块功能相关的UI界面中我们也提供了丰富的插槽供开发者扩展,相关源码请见[sidebar/codeBlock](https://github.com/Tencent/tmagic-editor/tree/master/packages/editor/src/layouts/sidebar/code-block)。
|
||||
|
||||
## 代码块界面展示
|
||||
侧边栏的代码块列表可以查看当前创建的代码块,以及每个代码块绑定的组件,点击代码块下方展示的组件icon可以在画布中选中该组件
|
||||
<img src="/code-block-list.png" alt="代码块列表">
|
||||
|
||||
代码块编辑面板,可以在这里编写代码内容,申明参数
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20230228/1fd2e11677637006239.png" alt="代码块编辑面板">
|
||||
|
||||
组件高级tab下绑定代码块,可以输入参数值,查看注释,打开代码编辑面板
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20230301/b2c8431677637119126.png" alt="绑定代码块">
|
||||
|
||||
保存后点击预览,可以看到在控制台打出了我们打印的日志内容
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20230301/672f8a1677637682103.png" alt="预览">
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ tmagic-editor的联动,指这两种情况:
|
||||
- 页面中的组件之间,需要联动触发行为。
|
||||
|
||||
## 表单联动
|
||||
表单的详细内容,可以参考[@tmagic/form](../advanced/magic-form)。我们通过 [JS Schema](../advanced/js-schema) 描述的表单配置,实现联动的方式,就是写一个简单 js 函数。
|
||||
表单的详细内容,可以参考[@tmagic/form](./tmagic-form)。我们通过 [JS Schema](./js-schema) 描述的表单配置,实现联动的方式,就是写一个简单 js 函数。
|
||||
|
||||
比如下面的例子,我们希望改变选项时,同时改变文本框的内容。
|
||||
|
||||
@ -27,7 +27,7 @@ tmagic-editor的联动,指这两种情况:
|
||||
|
||||
在经过表单渲染器时,所有指出函数 API 都会传入当前渲染的**表单组件实例(vm)**,**当前项目(value)**,**当前表单model**,**表单值formValue**,model 即 vue 的[表单输入绑定](https://v3.cn.vuejs.org/guide/forms.html#%E5%9F%BA%E7%A1%80%E7%94%A8%E6%B3%95),可以通过修改他来实现值联动。
|
||||
|
||||
当然我们也可以通过上述的参数传入,以及其他函数 API 实现更多灵活的表单联动,具体参考[表单 API](../../api/base-config)。
|
||||
当然我们也可以通过上述的参数传入,以及其他函数 API 实现更多灵活的表单联动,具体参考[表单 API](../../form-config/relate)。
|
||||
|
||||
## 组件联动
|
||||
tmagic-editor在 @tmagic/core 中,实现了组件的事件绑定/分发机制。在组件渲染时,每个组件在 @tmagic/ui 中经过基础组件渲染时,会被基础组件注入公共方法的实现。如下对按钮配置了**点击使文本隐藏**的联动事件,那么在对应按钮被点击时,将会触发对应绑定文本的隐藏。
|
||||
@ -35,7 +35,7 @@ tmagic-editor在 @tmagic/core 中,实现了组件的事件绑定/分发机制
|
||||
<img src="https://image.video.qpic.cn/oa_88b7d-10_2117738923_1637238863127559">
|
||||
|
||||
### 添加组件自定义事件
|
||||
如何开发一个完整组件可以参考[组件开发](../../component/introduction),这一节我们主要讲述如何配置定义事件。
|
||||
如何开发一个完整组件可以参考[组件开发](../component),这一节我们主要讲述如何配置定义事件。
|
||||
|
||||
在组件开发过程中,我们可以通过声明组件中的 event 文件,在文件中描述当前组件可以配置的事件名,和可以被触发的动作。
|
||||
```javascript
|
||||
@ -56,7 +56,7 @@ export default {
|
||||
};
|
||||
|
||||
```
|
||||
其中,events 的 value 是个事件名,是 `string` 类型,未了避免和其他组件事件名重复,应该添加上一些前缀。
|
||||
其中,events 的 value 是个事件名,是 `string` 类型,为了避免和其他组件事件名重复,应该添加上一些前缀。
|
||||
|
||||
而 methods 中的 value 则是一个挂载在组件上的可执行函数。我们会在事件触发时,分发到对应组件上,并执行对应组件实例上的方法。
|
||||
|
||||
@ -82,40 +82,34 @@ export default {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, inject } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { type ComponentProps, registerNodeHooks, useApp } from '@tmagic/vue-runtime-help';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'magic-ui-test',
|
||||
const props = defineProps<ComponentProps>()
|
||||
|
||||
setup(props) {
|
||||
const app: Core | undefined = inject('app');
|
||||
const hoc = inject('hoc');
|
||||
const { app, node } = useApp(props);
|
||||
|
||||
// 此处实现事件动作
|
||||
// 由于组件在 @tmagic/ui 中通过基础组件 Component 来封装,即每个组件其实都被 Component 包裹
|
||||
// 实际触发时,会触发到当前组件的直属父组件 Component 上,我们会 provide 这个父组件为高阶组件 hoc
|
||||
// 所以将 toast 方法挂载到当前组件的父组件上
|
||||
hoc.toast = (/*接收触发事件组件传进来的参数*/) => {
|
||||
toast('测试 vue3')
|
||||
};
|
||||
|
||||
return {
|
||||
// 此处实现触发事件
|
||||
onClick: () => {
|
||||
const onClick = () => {
|
||||
// app.emit 第一个参数为事件名,其余参数为你要传给接受事件组件的参数
|
||||
app?.emit("yourComponent:finishSomething", /*可以传参给接收方*/);
|
||||
},
|
||||
};
|
||||
},
|
||||
app.emit("yourComponent:finishSomething", node, /*可以传参给接收方*/);
|
||||
};
|
||||
|
||||
// 此处实现事件动作
|
||||
const toast = () => {
|
||||
toast('测试 vue3')
|
||||
};
|
||||
|
||||
// 实际触发时是调用node上的方法,所以需要将改方法暴露到node上
|
||||
registerNodeHooks(node, {
|
||||
toast,
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
toast,
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
::: tip
|
||||
在用 vue 实现的 组件中,我们通过 inject 方式来提供核心 app 和高阶组件 hoc。调用联动事件方法时,tmagic-editor是通过组件的 ref,并直接调用当前组件的方法。
|
||||
:::
|
||||
|
||||
#### react 版本实现
|
||||
在 react 的实现中,由于tmagic-editor提供的 @tmagic/ui-react 版本是用 hook 实现的。所以组件开发我们也相应的需要使用 hook 方式。
|
||||
|
||||
@ -125,10 +119,8 @@ import React from 'react';
|
||||
import { useApp } from '@tmagic/ui-react';
|
||||
|
||||
function Test({ config }) {
|
||||
// react 和 vue 实现不同,我们通过 useApp 这个 hook 来提供 app, ref 等核心内容
|
||||
// 其中 ref 需要绑定到你的组件上作为 ref。因为一些公共事件会需要使用到你的组件 dom
|
||||
// 同时这个 ref 也会在tmagic-editor的高级函数钩子中,将你的组件 dom 作为参数提供给自定义钩子
|
||||
const { app, ref } = useApp({
|
||||
// react 和 vue 实现不同,我们通过 useApp 这个 hook 来提供 app 等核心内容
|
||||
const { app } = useApp({
|
||||
config,
|
||||
// 此处实现事件动作
|
||||
// 通过向 useApp 这个 hook 提供 methods 方法
|
||||
@ -147,7 +139,6 @@ function Test({ config }) {
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
id={config.id}
|
||||
style={app.transformStyle(config.style || {})}
|
||||
onClick={onClick}
|
||||
@ -159,13 +150,3 @@ function Test({ config }) {
|
||||
|
||||
export default Test;
|
||||
```
|
||||
|
||||
::: tip
|
||||
react 的实现方式需要开发者通过 useApp 来获得我们提供的核心 app 和一个 ref,这个 ref 是需要开发者绑定到组件上的。和 vue 不同,react 的 dom 实例需要用户指定。
|
||||
|
||||
而需要这个 ref 的原因,是在公共事件执行时,可能会需要 dom 实例来进行操作;或者用户使用高级函数时,我们会向用户传入组件的 dom 实例给开发者使用。
|
||||
:::
|
||||
|
||||
按照上述实现触发事件和事件动作,就可以完成组件的联动事件分发响应。
|
||||
|
||||
|
||||
105
docs/guide/advanced/data-source.md
Normal file
105
docs/guide/advanced/data-source.md
Normal file
@ -0,0 +1,105 @@
|
||||
# 数据源
|
||||
|
||||
## 使用数据源
|
||||
|
||||
### 添加数据源
|
||||
|
||||
在编辑器左侧边栏中选中数据源,在数据源面板右上角添加中选择对应的数据源类型(默认提供了两种基础的数据源)
|
||||
|
||||
[](/data-source.png){target="_blank"}
|
||||
|
||||
### 配置属性字段
|
||||
|
||||
[](/create-data-source.png){target="_blank"}
|
||||
|
||||
#### 基础数据源
|
||||
|
||||
静态数据,不会自动更新,可以通过配置方法,在方法中更新数据源
|
||||
|
||||
```js
|
||||
({ dataSource, app }) => {
|
||||
dataSource.setData({
|
||||
// 数据
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
然后再组件的事件联动中关联此方法,来触发数据源更新
|
||||
|
||||
#### HTTP数据源
|
||||
|
||||
通过配置HTTP相关参数(url, query, body, header等)通过网络api获取数据,该数据源拥有request方法,可通过此方法来刷新数据源
|
||||
|
||||
```js
|
||||
({ dataSource, app }) => {
|
||||
dataSource.request();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 在组件中使用
|
||||
|
||||
|
||||
#### 数据源模板输入框(data-source-input)
|
||||
|
||||
formConfig.js
|
||||
```js
|
||||
[
|
||||
{
|
||||
type: 'data-source-input'
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
[](/data-source-input.png){target="_blank"}
|
||||
|
||||
#### 数据源字段选择器输入框(data-source-field-select)
|
||||
|
||||
formConfig.js
|
||||
```js
|
||||
[
|
||||
{
|
||||
type: 'data-source-filed-select'
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### 数据源选择器(data-source-select)
|
||||
|
||||
|
||||
formConfig.js
|
||||
```js
|
||||
[
|
||||
{
|
||||
type: 'data-source-select'
|
||||
}
|
||||
]
|
||||
```
|
||||
#### 数据源方法选择器(data-source-method-select)
|
||||
|
||||
formConfig.js
|
||||
```js
|
||||
[
|
||||
{
|
||||
type: 'data-source-method-select'
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### 显示条件
|
||||
|
||||
当配置的条件成立时显示,反之隐藏
|
||||
|
||||
[](/display-cond.png){target="_blank"}
|
||||
|
||||
## 数据源开发
|
||||
|
||||
### 数据源规范
|
||||
|
||||
数据源的基础形式,需要有四个文件
|
||||
- index 入口文件,引入下面几个文件
|
||||
- formConfig 表单配置描述
|
||||
- initValue 表单初始值
|
||||
- event 定义联动事件,具体可以参考[组件联动](./coupling.html#组件联动)
|
||||
- dataSource 数据源逻辑代码
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# JS Schema
|
||||
tmagic-editor的业务组件需要有表单配置能力,我们通过一份配置来描述表单,我们采用的描述方案是 JS schema。当我们在编辑器中配置一个页面时,页面的基本信息和页面包含的组件信息,也是采用 JS schema 描述的。JS schema 描述方案,也是我们提供[高级函数](../advanced/high-level-function)功能的基础。
|
||||
tmagic-editor的业务组件需要有表单配置能力,我们通过一份配置来描述表单,我们采用的描述方案是 JS schema。当我们在编辑器中配置一个页面时,页面的基本信息和页面包含的组件信息,也是采用 JS schema 描述的。JS schema 描述方案,也是我们提供[代码块](../advanced/code-block)功能的基础。
|
||||
|
||||
组件的**配置描述**,参考[示例](../advanced/magic-form.html#示例),是由开发者在开发组件时,通过 [@tmagic/form](../advanced/magic-form) 支持的表单项来提供的。
|
||||
组件的**配置描述**,参考[示例](./tmagic-form.html#示例),是由开发者在开发组件时,通过 [@tmagic/form](./tmagic-form) 支持的表单项来提供的。
|
||||
|
||||
在编辑器中对页面进行编辑,保存得到的是一份关于页面基本信息、页面所包含组件以及组件配置信息的配置,我们称为 **DSL**,这份配置是最终页面渲染需要的描述信息。
|
||||
|
||||
@ -60,6 +60,5 @@ export default defineComponent({
|
||||
|
||||
## 渲染器示例
|
||||
在tmagic-editor的示例项目中,我们提供了三个版本的 @tmagic/ui。可以参考对应前端框架的渲染器实现。
|
||||
- [vue3 渲染器](https://github.com/Tencent/tmagic-editor/blob/master/packages/ui/src/container/src/Container.vue)
|
||||
- [vue2 渲染器](https://github.com/Tencent/tmagic-editor/blob/master/packages/ui-vue2/src/container/Container.vue)
|
||||
- [react 渲染器](https://github.com/Tencent/tmagic-editor/blob/master/packages/ui-react/src/container/Container.tsx)
|
||||
- [vue 渲染器](https://github.com/Tencent/tmagic-editor/blob/master/vue-components/container/src/Container.vue)
|
||||
- [react 渲染器](https://github.com/Tencent/tmagic-editor/blob/master/react-components/container/src/Container.tsx)
|
||||
@ -2,17 +2,17 @@
|
||||
|
||||
tmagic-editor的表单配置,核心就是使用了 @tmagic/form 来作为渲染器。@tmagic/form 是一个 npm 包,可以安装它,在你想使用的地方单独使用。
|
||||
|
||||
@tmagic/form 接受一个表单配置,详细配置可参考[表单 api](../../api/form.md)。
|
||||
@tmagic/form 接受一个表单配置,详细配置可参考[表单 api](../../api/form/form-props.md)。
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
# 最新稳定版
|
||||
$ npm install @tmagic/form@latest
|
||||
$ npm install @tmagic/form
|
||||
```
|
||||
|
||||
```bash
|
||||
$ npm install element-plus
|
||||
$ npm install @tmagic/element-plus-adapter @tmagic/design element-plus -S
|
||||
```
|
||||
|
||||
## 快速上手
|
||||
@ -26,20 +26,26 @@ MagicForm 使用了 element-ui 库
|
||||
在 main.js 中写入以下内容:
|
||||
|
||||
```javascript
|
||||
import { createApp } from "vue";
|
||||
import ElementPlus from "element-plus";
|
||||
import MagicForm from "@tmagic/form";
|
||||
import { createApp } from 'vue';
|
||||
import ElementPlus from 'element-plus';
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
|
||||
import "element-plus/dist/index.css";
|
||||
import TMagicDesign from '@tmagic/design';
|
||||
import MagicElementPlusAdapter from '@tmagic/element-plus-adapter';
|
||||
import MagicForm from '@tmagic/form';
|
||||
|
||||
import App from "./App.vue";
|
||||
import App from './App.vue';
|
||||
|
||||
const app = createApp(App);
|
||||
app.use(ElementUI);
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn,
|
||||
});
|
||||
app.use(TMagicDesign, MagicElementPlusAdapter);
|
||||
app.use(MagicForm);
|
||||
app.mount("#app");
|
||||
```
|
||||
|
||||
|
||||
以上代码便完成了 @tmagic/form 的引入。需要注意的是,ElementUI 的样式文件需要单独引入。
|
||||
|
||||
在 App.Vue 中写入以下内容:
|
||||
23
docs/guide/advanced/tmagic-ui.md
Normal file
23
docs/guide/advanced/tmagic-ui.md
Normal file
@ -0,0 +1,23 @@
|
||||
# @tmagic/ui
|
||||
在前面[页面渲染](../advanced/page)中提到的 UI 渲染器,就是包含在 @tmagic/ui 中的渲染器组件。
|
||||
|
||||
tmagic-editor的设计是希望发布的页面支持多个前端框架,即各个业务方可以根据自己熟悉的语言来开发组件、发布页面。也可以通过 [实现一个 runtime](../runtime.html) 的方式,来实现一个自己的 @tmagic/ui。
|
||||
|
||||
所以tmagic-editor的设计中,针对每个前端框架,都需要有一个对应的 @tmagic/ui 来承担渲染器职责。同时,也需要一个使用和 @tmagic/ui 相同前端框架的 runtime 来 @tmagic/ui 和业务组件的,具体 runtime 概念,可以参考[页面发布](../publish)。
|
||||
|
||||
我们以项目代码中提供的 vue 版本的 [vue-components](https://tencent.github.io/tmagic-editor/vue-components) 作为示例介绍其中包含的内容。
|
||||
|
||||
## 渲染器
|
||||
在 vue 中,实现渲染器的具体形式参考[页面渲染](../advanced/page)中描述的[容器渲染](../advanced/page.html#容器渲染)和[组件渲染](../advanced/page.html#容器渲染)。
|
||||
|
||||
## 基础组件
|
||||
在 [vue-components](https://tencent.github.io/tmagic-editor/vue-components) 中,我们提供了几个基础组件,可以在项目源码中找到对应内容。
|
||||
|
||||
- page tmagic-editor的页面基础
|
||||
- container tmagic-editor的容器渲染器
|
||||
- Component.vue tmagic-editor的组件渲染器
|
||||
- button/text 基础组件示例
|
||||
|
||||
其中 page/container/Component 是 UI 的基础,是每个框架的 UI 都应该实现的。
|
||||
|
||||
button/text 其实就是一个组件开发的示例,具体组件开发相关规范可以参考[组件开发](../component)。
|
||||
220
docs/guide/component.md
Normal file
220
docs/guide/component.md
Normal file
@ -0,0 +1,220 @@
|
||||
# 如何开发一个组件
|
||||
tmagic-editor支持业务方进行自定义组件开发。在tmagic-editor中,组件是以 npm 包形式存在的,组件和插件只要按照规范开发,就可以在tmagic-editor的 runtime 中被加入并正确渲染组件。
|
||||
|
||||
### 组件规范
|
||||
组件的基础形式,需要有四个文件
|
||||
- index 入口文件,引入下面几个文件
|
||||
- form-config 表单配置描述
|
||||
- init-value 表单初始值
|
||||
- event 定义联动事件,具体可以参考[组件联动](../guide/advanced/coupling.html#组件联动)
|
||||
- component.{vue,jsx} 组件样式、逻辑代码
|
||||
|
||||
### 1. 创建组件
|
||||
|
||||
可以使用`npm create tmagic` 选择 `components:组件库(组件/插件/数据源)` 来快速创建一个组件库。
|
||||
|
||||
然后继续使用`npm create tmagic` 选择 `component:组件` 来快速创建一个组件。
|
||||
|
||||
:::tip
|
||||
|
||||
组件库并不是必须,组件如何管理可以根据具体情况来选择。直接放到 runtime 目录中也是一个不错的选择,如果选择放到runtime中可以在runtime中的package.json添加
|
||||
```json
|
||||
{
|
||||
"createTmagic": {
|
||||
"componentsPath": "./components",
|
||||
"pluginsPath": "./plugins",
|
||||
"dataSourcesPath": "./dataSources"
|
||||
}
|
||||
}
|
||||
```
|
||||
来指定组件库的路径。这样在使用`npm create tmagic` 来创建组件时,会自动将组件添加到组件库中。
|
||||
:::
|
||||
|
||||
:::tip
|
||||
如需为组件添加npm scope name,可以在runtime中的package.json中添加
|
||||
```json
|
||||
{
|
||||
"createTmagic": {
|
||||
"npmScopeName": "@tmagic"
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
|
||||
手动创建组件,可以在项目中,如 runtime 目录中,创建一个名为 test-component 的组件目录,其中包含上面四个规范文件。
|
||||
```javascript
|
||||
// index.js
|
||||
// vue
|
||||
import Test from './Test.vue';
|
||||
// react
|
||||
import Test from './Test.tsx';
|
||||
|
||||
export { default as config } from './form-config';
|
||||
export { default as value } from './init-value';
|
||||
|
||||
export default Test;
|
||||
```
|
||||
|
||||
:::tip
|
||||
如果在runtime中使用了@tmagic/cli,则必须保持此规范;不使用则可以自由书写。
|
||||
:::
|
||||
|
||||
```javascript
|
||||
// form-config.js
|
||||
export default [
|
||||
{
|
||||
type: 'select',
|
||||
text: '字体颜色',
|
||||
name: 'color',
|
||||
options: [
|
||||
{
|
||||
text: '红色字体',
|
||||
value: 'red',
|
||||
},
|
||||
{
|
||||
text: '蓝色字体',
|
||||
value: 'blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'text',
|
||||
text: '配置文案',
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
:::tip
|
||||
配置内容必须是一个数组,每个元素是一个对象,包含 type、text、name 等属性,每个对象代表一个表单项。
|
||||
|
||||
type 是表单项的类型
|
||||
|
||||
text 是表单项的文本
|
||||
|
||||
name 是表单项值的key。
|
||||
|
||||
上述实例对应生成的值为
|
||||
```json
|
||||
{
|
||||
"color": "red",
|
||||
"text": "一段文字",
|
||||
}
|
||||
```
|
||||
|
||||
type 在@tmagic/form 和 @tmagic/editor 中默认提供了一些,@tmagic/form提供的可以前往[表单配置](/form-config/fields/text.html)查看。
|
||||
:::
|
||||
|
||||
|
||||
```javascript
|
||||
// init-value.js
|
||||
export default {
|
||||
color: 'red',
|
||||
text: '一段文字',
|
||||
};
|
||||
```
|
||||
|
||||
:::tip
|
||||
在编辑器中添加组件时使用,作为初始值。
|
||||
:::
|
||||
|
||||
Vue版本的组件代码示例
|
||||
```vue
|
||||
<!-- Test.vue -->
|
||||
<template>
|
||||
<div>
|
||||
<span>this is a Test component:</span>
|
||||
<span :style="{ color: config.color }">{{ config.text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineOptions({
|
||||
name: 'magic-ui-test',
|
||||
});
|
||||
|
||||
defineProps({
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
}):
|
||||
</script>
|
||||
```
|
||||
|
||||
:::tip
|
||||
编辑器中配置的 config 对象,会作为 props 传入组件中。
|
||||
:::
|
||||
|
||||
react 版本组件代码示例
|
||||
```javascript
|
||||
// Test.tsx
|
||||
import React, { useContext } from 'react';
|
||||
|
||||
import Core from '@tmagic/core';
|
||||
import { AppContent } from '@tmagic/ui-react';
|
||||
|
||||
function Test({ config }: { config: any }) {
|
||||
const app = useContext<Core | undefined>(AppContent);
|
||||
console.log(app)
|
||||
|
||||
return (<div id={config.id}
|
||||
style={app.transformStyle(config.style || {})}>
|
||||
<span>this is a Test component:</span>
|
||||
<span style={ { color: config.color }}>{ config.text }</span>
|
||||
</div>);
|
||||
}
|
||||
|
||||
export default Test;
|
||||
|
||||
```
|
||||
|
||||
## 插件开发
|
||||
插件开发和组件开发形式类似,但是插件开发不需要有组件的规范。
|
||||
|
||||
我们只需要在插件中提供一个入口文件。插件需要提供一个 install 方法。
|
||||
|
||||
```javascript
|
||||
// 在Vue的runtime中
|
||||
export default {
|
||||
install(vueApp, { app: tmagicApp }) {}
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
// 在React的runtime中
|
||||
export default {
|
||||
install({ app: tmagicApp }) {}
|
||||
}
|
||||
```
|
||||
|
||||
在插件中开发者可以自由实现需要的业务逻辑。
|
||||
|
||||
## 集成到runtime中
|
||||
|
||||
### 使用@tmagic/cli
|
||||
|
||||
在使用`npm create tmagic` 创建的runtime中,自动集成了@tmagic/cli,将组件集成到此runtime中只需要在`tmagic.config.ts`中的packages字段中添加
|
||||
```javascript
|
||||
import { defineConfig } from '@tmagic/cli';
|
||||
|
||||
export default defineConfig({
|
||||
// other config
|
||||
packages: [
|
||||
{
|
||||
'组件type': '组件目录或者npm包名',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
:::tip
|
||||
组件type需要与[componentGroupList](../api/editor/props.html#componentgrouplist)中的type对应。
|
||||
:::
|
||||
|
||||
|
||||
配置到packages字段中后,执行`npm run tmagic`来创建组件库的入口文件。
|
||||
|
||||
然后使用`npm run build:libs`命令来构建用于编辑器中的组件配置、组件初始值、组件事件联动的资源文件。
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# 基础概念
|
||||
我们通过讲述tmagic-editor的一些基础概念。帮助开发者可以了解tmagic-editor是如何运行以及如何在基础项目之上开发、使用它。
|
||||
|
||||
[](/flow.png){target="_blank"}
|
||||
|
||||
## 编辑器
|
||||
编辑器基础布局上分为:左面板、工作区、右面板、工具栏,如下图。
|
||||
- **左面板**,包含了组件库的展示,以及工作区中已添加组件的组件树展示。
|
||||
@ -16,7 +18,7 @@
|
||||
- 拓展描述,这部分内容目前还未有严格定义,但是我们保留这个扩展能力。
|
||||
- 组件 `type`, 是组件的类型,这是用来告诉编辑器,我们要渲染的是什么组件。每个组件在开发时就应该确定这样一个唯一、不和其他组件冲突的组件 `type`。
|
||||
|
||||
```
|
||||
```js
|
||||
[
|
||||
{
|
||||
text: '文本',
|
||||
@ -56,12 +58,7 @@ DSL 是编辑器搭建页面的最终产物(描述文件),其中包含了
|
||||
页面是tmagic-editor作为一个可视化编辑器经过配置后,最终得到的呈现结果。搭建后的页面会被发布上线,供用户访问。
|
||||
|
||||
### runtime
|
||||
我们把页面统一称为 runtime,更具体的 runtime 概念可以查看[页面发布](../page/introduction.html#runtime)。**runtime 是承载tmagic-editor项目页面的运行环境**。编辑器的工作区是 runtime 的一个具体实例,另一个就是我们发布上线后,用户访问的真实项目页面。
|
||||
|
||||
### @tmagic/ui
|
||||
@tmagic/ui 包含了tmagic-editor的基础组件库,提供了容器、文本、按钮这样的基础组件。我们提供了不同语言框架的 @tmagic/ui,如 vue2 和 vue3。
|
||||
|
||||
@tmagic/ui 和 runtime 是配套出现的,runtime 必须基于 @tmagic/ui 才可以实现渲染。因为 @tmagic/ui 需要提供 runtime 所需要的渲染器。
|
||||
我们把页面统一称为 runtime,更具体的 runtime 概念可以查看[页面发布](./publish.html#runtime)。**runtime 是承载tmagic-editor项目页面的运行环境**。编辑器的工作区是 runtime 的一个具体实例,另一个就是我们发布上线后,用户访问的真实项目页面。
|
||||
|
||||
## 联动
|
||||
页面搭建过程中,会涉及到两种联动形式
|
||||
@ -73,7 +70,4 @@ DSL 是编辑器搭建页面的最终产物(描述文件),其中包含了
|
||||
|
||||
### 组件联动
|
||||
组件 A 在完成点击事件后,希望组件 B 可以展示一个弹窗,就是组件联动的一个示例。tmagic-editor通过事件绑定方式,可以为组件 A 和 B 配置事件关联,实现上述的组件联动。
|
||||
<img src="https://image.video.qpic.cn/oa_88b7d-37_723692309_1636032154483681" alt="组件联动">
|
||||
|
||||
|
||||
|
||||
<img src="https://vip.image.video.qpic.cn/vupload/20231027/3e02d31698914788006.png" alt="组件联动">
|
||||
220
docs/guide/editor-expand.md
Normal file
220
docs/guide/editor-expand.md
Normal file
@ -0,0 +1,220 @@
|
||||
# 编辑器扩展
|
||||
|
||||
编辑器布局组成部分名称如下图,后续将直接使用图中名称指代其部分
|
||||
|
||||
<img src="/layout.png" width="100%">
|
||||
|
||||
## UI扩展
|
||||
|
||||
### 一、顶部菜单栏定制
|
||||
|
||||
通常使用 `m-editor` 组件的 [menu](/api/editor/props.html#menu) `prop` 来对齐进行设置;
|
||||
|
||||
顶部菜单栏分为`左` `中` `右`三个部分组成,所以 [menu](/api/editor/props.html#menu) `prop`的数据格式如下:
|
||||
|
||||
```js
|
||||
{ left: [], center: [], right: [] }
|
||||
```
|
||||
|
||||
数组的内容可以有三种种形式:`内部定义好的字符串`、`其他字符串`、`MenuButton 或者 MenuComponent 对象`
|
||||
|
||||
#### 1. 内部定义好的字符串:
|
||||
```ts
|
||||
'/' | 'delete' | 'undo' | 'redo' | 'zoom' | 'zoom-in' | 'zoom-out' | 'guides' | 'rule' | 'scale-to-original' | 'scale-to-fit'
|
||||
```
|
||||
|
||||
是组件内部定义的可直接使用的内置功能,具体含义可以查看 [menu](/api/editor/props.html#menu)
|
||||
|
||||
#### 2. 其他字符串
|
||||
|
||||
除去[内部定好的字符串](#内部定义好的字符串)的其他字符串,则会被当成普通文本直接显示
|
||||
|
||||
|
||||
#### 3. `MenuButton` 或者 `MenuComponent` 对象
|
||||
|
||||
MenuButton 的[定义](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L168)
|
||||
|
||||
用于自定义一个按钮,例如定义一个返回按钮可以由如下配置实现
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'buuton',
|
||||
text: '返回',
|
||||
handler: () => window.history.back(),
|
||||
}
|
||||
```
|
||||
|
||||
如果需要更复杂的功能则可以使用 `MenuComponent`, 可以用于实现渲染任意一个Vue组件
|
||||
|
||||
`MenuComponent` 的[定义](https://github.com/Tencent/tmagic-editor/blob/239b5d3efeae916a8cf3e3566d88063ecccc0553/packages/editor/src/type.ts#L197C18-L197C32)
|
||||
|
||||
:::tip
|
||||
如果对内置的顶部菜单栏实现不满意还可以使用自定义的实现完全替换掉
|
||||
|
||||
```html
|
||||
<m-editor>
|
||||
<template #nav>
|
||||
<your-nav></your-nav>
|
||||
</template>
|
||||
</m-editor>
|
||||
```
|
||||
:::
|
||||
|
||||
### 二、左侧菜单栏
|
||||
|
||||
左侧菜单栏主要展示组件列表、组件树、代码块、数据源等内容。可以通过 `m-editor` 组件的 [sidebar](/api/editor/props.html#sidebar) `prop` 来进行配置。
|
||||
|
||||
#### 1. 自定义左侧面板
|
||||
|
||||
可以使用 `sidebar` slot 来完全自定义左侧面板:
|
||||
|
||||
```html
|
||||
<m-editor>
|
||||
<template #sidebar>
|
||||
<your-sidebar></your-sidebar>
|
||||
</template>
|
||||
</m-editor>
|
||||
```
|
||||
|
||||
#### 2. 扩展组件列表
|
||||
|
||||
通过 [componentGroupList](/api/editor/props.html#componentgrouplist) prop 配置组件分组和列表:
|
||||
|
||||
```js
|
||||
const componentGroupList = [
|
||||
{
|
||||
title: '基础组件',
|
||||
items: [
|
||||
{
|
||||
text: '文本',
|
||||
type: 'text',
|
||||
icon: 'text-icon'
|
||||
},
|
||||
{
|
||||
text: '按钮',
|
||||
type: 'button',
|
||||
icon: 'button-icon'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '业务组件',
|
||||
items: [
|
||||
// 自定义业务组件
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### 3. 组件树扩展
|
||||
|
||||
组件树会自动根据页面配置生成,可以通过 `editorService` 监听组件树相关事件:
|
||||
|
||||
```js
|
||||
editorService.on('select', (node) => {
|
||||
console.log('选中组件:', node);
|
||||
});
|
||||
```
|
||||
|
||||
### 三、右侧属性配置栏
|
||||
|
||||
默认的属性配置栏会分为属性、样式、事件、高级4个tab分页,其中只有属性是在组件中的`formConfig`文件中定义,其他三个分页都是自动生成的,所有组件都是一样的。
|
||||
|
||||
默认的属性读取流程如下:
|
||||
|
||||
组件中定义`formConfig` -> 通过`tamgic-cli`构建成 `runtime` 中 `/config/index.umd.cjs` -> `m-editor`中加载然后配置到[propsConfig](/api/editor/props.html#propsconfigs) prop中 -> `m-editor`保存到`propsService`中 -> 选中组件时`editorService`会去`propsService`调用`getPropsConfig`中读取
|
||||
|
||||
`propsService.getPropsConfig`会调取`propsService.fillConfig`添加样式、事件、高级3个tab分页
|
||||
|
||||
#### 1. 定制属性配置栏中顶部的属性、样式、事件、高级 tab分页
|
||||
|
||||
可以通过干预`propsService.fillConfig`来实现自定义。例如:
|
||||
|
||||
实现去掉样式、事件、高级3个tab分页,直接显示组件内定义好的配置
|
||||
```js
|
||||
propsService.usePlugin({
|
||||
/**
|
||||
* result为生成好的默认配置
|
||||
* config为组件中定义好的配置
|
||||
*/
|
||||
afterFillConfig(result, config) {
|
||||
return config
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### 2. 定制属性配置栏中配置的来源
|
||||
|
||||
如果觉得上述属性读取流程不满足需要,可以通过干预`propsService.getPropsConfig`来实现自定义的流程
|
||||
|
||||
```js
|
||||
propsService.usePlugin({
|
||||
/**
|
||||
* result为生成好的默认配置
|
||||
* config为组件中定义好的配置
|
||||
*/
|
||||
afterGetPropsConfig(result, type) {
|
||||
// 返回配置DSL即可
|
||||
return []
|
||||
}
|
||||
});
|
||||
```
|
||||
#### 3. 自定义属性配置栏
|
||||
|
||||
默认属性配置栏是是使用`@tmagic/form`来实现的,如果需要使用其他组件来实现可以使用`props-panel`slot来将其替换掉
|
||||
|
||||
```html
|
||||
<m-editor>
|
||||
<template #props-panel>
|
||||
<your-props-panel></your-props-panel>
|
||||
</template>
|
||||
</m-editor>
|
||||
```
|
||||
|
||||
## 行为扩展
|
||||
|
||||
### 二、服务扩展
|
||||
|
||||
可以通过监听事件和使用插件来扩展 EditorService:
|
||||
|
||||
```js
|
||||
// 监听编辑器事件
|
||||
editorService.on('add', (node) => {
|
||||
console.log('添加组件:', node);
|
||||
});
|
||||
|
||||
// 使用插件扩展
|
||||
editorService.usePlugin({
|
||||
beforeAdd(node) {
|
||||
// 在添加组件前执行
|
||||
return node;
|
||||
},
|
||||
afterAdd(node) {
|
||||
// 在添加组件后执行
|
||||
return node;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### 2. PropsService 扩展
|
||||
|
||||
自定义属性配置的处理逻辑:
|
||||
|
||||
```js
|
||||
propsService.usePlugin({
|
||||
// 修改属性配置
|
||||
beforeGetPropsConfig(type) {
|
||||
console.log('获取配置前:', type);
|
||||
},
|
||||
|
||||
afterGetPropsConfig(config, type) {
|
||||
// 添加自定义配置
|
||||
return config;
|
||||
},
|
||||
|
||||
// 自定义配置填充逻辑
|
||||
afterFillConfig(config, type) {
|
||||
return config;
|
||||
}
|
||||
});
|
||||
```
|
||||
231
docs/guide/index.md
Normal file
231
docs/guide/index.md
Normal file
@ -0,0 +1,231 @@
|
||||
# 快速开始
|
||||
|
||||
tmagic-editor的编辑器我们已经封装成一个 npm 包,可以直接安装使用。编辑器是使用 vue3 开发的(仅支持vue3),但使用编辑器的业务(runtime)可以不限框架,可以用 vue2、react 等开发业务组件。
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [npm]
|
||||
$ npm create tmagic@latest
|
||||
```
|
||||
|
||||
```bash [pnpm]
|
||||
$ pnpm create tmagic
|
||||
```
|
||||
:::
|
||||
|
||||
按照提示操作可以创建`6`中项目:
|
||||
|
||||
* runtime:运行时(DSL渲染)
|
||||
* admin-client:管理端(编辑器)
|
||||
* components:组件库(组件/插件/数据源)
|
||||
* component:组件
|
||||
* data-source:数据源
|
||||
* plugin:插件
|
||||
|
||||
至少需要一个runtime与admin-client后,就可以运行起一个最简单的项目了。
|
||||
|
||||
后续还需要新增组件、插件、数据源等,可以继续添加后面几种类型的项目。
|
||||
|
||||
新增好一个组件/插件/数据源后可以到runtime/tmagic.config.ts中配置到packages中
|
||||
|
||||
## 手动安装
|
||||
|
||||
node.js >= 18
|
||||
|
||||
可以通过[Vite](https://cn.vitejs.dev/) 或 [Vue CLI](https://cli.vuejs.org/zh/)快速创建项目。
|
||||
|
||||
> 使用Vue CLI生成的项目需要在vue.config.js中加上配置:transpileDependencies: [/@tmagic/]
|
||||
|
||||
```bash
|
||||
$ npm install @tmagic/editor -S
|
||||
```
|
||||
|
||||
由于在实际应用中项目常常会用到例如[element-plus](https://element-plus.org/)、[tdesign-vue-next](https://tdesign.tencent.com/vue-next/overview)等UI组件库。为了能让使用者能够选择不同UI库,[@tmagic/editor](https://github.com/Tencent/tmagic-editor/tree/master/packages/editor)将其中使用到的UI组件封装到[@tmagic/design](https://github.com/Tencent/tmagic-editor/tree/master/packages/design)中,然后通过不同的adapter来指定使用具体的对应的UI库,我们提供了[@tmagic/element-plus-adapter](https://github.com/Tencent/tmagic-editor/tree/master/packages/element-plus-adapter)来支持[element-plus](https://element-plus.org/),所以还需要安装相关的依赖。
|
||||
|
||||
```bash
|
||||
$ npm install @tmagic/element-plus-adapter element-plus -S
|
||||
```
|
||||
|
||||
editor 中还包含了[monaco-editor](https://microsoft.github.io/monaco-editor/),所以还需安装monaco-editor,可以参考 monaco-editor 的[配置指引](https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md)。
|
||||
|
||||
```bash
|
||||
$ npm install monaco-editor -S
|
||||
```
|
||||
|
||||
## 快速上手
|
||||
|
||||
## 引入 @tmagic/editor
|
||||
|
||||
在 main.js 中写入以下内容:
|
||||
|
||||
```js
|
||||
import { createApp } from 'vue';
|
||||
import ElementPlus from 'element-plus';
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
|
||||
import editorPlugin from '@tmagic/editor';
|
||||
import MagicElementPlusAdapter from '@tmagic/element-plus-adapter';
|
||||
|
||||
import App from './App.vue';
|
||||
|
||||
import 'element-plus/dist/index.css';
|
||||
import '@tmagic/editor/dist/style.css';
|
||||
|
||||
const app = createApp(App);
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn,
|
||||
});
|
||||
app.use(router);
|
||||
app.use(editorPlugin, MagicElementPlusAdapter);
|
||||
app.mount('#app');
|
||||
```
|
||||
|
||||
以上代码便完成了 @tmagic/editor 的引入。需要注意的是,样式文件需要单独引入。
|
||||
|
||||
可以参考我们提供的[Playground](https://github.com/Tencent/tmagic-editor/blob/master/playground/src/main.ts)示例实现代码
|
||||
|
||||
## 使用 m-editor 组件
|
||||
|
||||
在 App.vue 中写入以下内容:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<m-editor
|
||||
v-model="dsl"
|
||||
:menu="menu"
|
||||
:runtime-url="runtimeUrl"
|
||||
:props-configs="propsConfigs"
|
||||
:props-values="propsValues"
|
||||
:component-group-list="componentGroupList"
|
||||
>
|
||||
</m-editor>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "App",
|
||||
|
||||
setup() {
|
||||
return {
|
||||
menu: ref({
|
||||
left: [
|
||||
// 顶部左侧菜单按钮
|
||||
],
|
||||
center: [
|
||||
// 顶部中间菜单按钮
|
||||
],
|
||||
right: [
|
||||
// 顶部右侧菜单按钮
|
||||
],
|
||||
}),
|
||||
|
||||
dsl: ref({
|
||||
// 初始化页面数据
|
||||
}),
|
||||
|
||||
runtimeUrl: "/runtime/vue/playground/index.html",
|
||||
|
||||
propsConfigs: [
|
||||
// 组件属性列表
|
||||
],
|
||||
propsValues: [
|
||||
// 组件默认值
|
||||
],
|
||||
|
||||
componentGroupList: ref([
|
||||
// 组件列表
|
||||
]),
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.m-editor {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
关于 [@tmagic/editor](https://github.com/Tencent/tmagic-editor/tree/master/packages/editor) 组件,更多的属性配置详情请参考[编辑器 API](../api/editor/props.md)。
|
||||
|
||||
其中,**有四个需要注意的属性配置项**:`runtimeUrl` `values` `configs` `componentGroupList`。这是能让我们的编辑器正常运行的关键。
|
||||
|
||||
:::tip
|
||||
如果出现```Preprocessor dependency "sass" not found. Did you install it?```,那么需要install sass
|
||||
|
||||
```bash
|
||||
npm install sass -D
|
||||
```
|
||||
:::
|
||||
|
||||
:::tip
|
||||
如果是使用vite构建工具,如果出现 ```Uncaught ReferenceError: global is not defined```,那么需要再vite.config.js中添加如下配置:
|
||||
|
||||
```js
|
||||
{
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
## runtimeUrl
|
||||
|
||||
该配置涉及到 [runtime 概念](runtime.md),tmagic-editor编辑器中心的模拟器画布,是一个 iframe(这里的 `runtimeUrl` 配置的,就是你提供的 iframe 的 url),其中渲染了一个 runtime,用来响应编辑器中的组件增删改等操作。
|
||||
:::tip
|
||||
可以使用`npm create tmagic` 来快速创建一个runtime项目。
|
||||
:::
|
||||
|
||||
## componentGroupList
|
||||
|
||||
`componentGroupList` 是指定左侧组件库内容的配置。此处定义了在编辑器组件库中有什么组件。在添加的时候通过组件 `type` 来确定 runtime 中要渲染什么组件。可以参考 [componentGroupList 配置](../api/editor/props.html#componentgrouplist)。
|
||||
|
||||
## propsConfigs/propsValues
|
||||
|
||||
`propsConfigs` `propsValues` 和 `componentGroupList` 中声明的组件是一一对应的,通过 `type` 来识别属于哪个组件,该配置涉及的内容,就是组件的表单配置描述,在[组件开发中](./component.md)会通过 formConfig 配置来声明这份内容。
|
||||
|
||||
`configs` 既可以通过 hardcode 方式写上每个组件的表单配置,也可以通过组件打包方式得到对应内容,然后通过异步加载来载入。比如:
|
||||
|
||||
```javascript
|
||||
setup() {
|
||||
asyncLoadJs(`/runtime/vue/assets/config.js`).then(() => {
|
||||
propsConfigs.value = window.magicPresetConfigs;
|
||||
});
|
||||
asyncLoadJs(`/runtime/vue/assets/value.js`).then(() => {
|
||||
propsValues.value = window.magicPresetValues;
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
::: tip 如何快速得到一个 configs/values
|
||||
上述的 runtime 产物中,dist 目录中即包含一个 entry 文件夹,在你的项目组件初始化之后,分别异步加载里面的config/index.umd.js、value/index.umd.js。并如上面代码中,赋值给 configs/values 即可。
|
||||
:::
|
||||
|
||||
## 更多
|
||||
|
||||
通过上述步骤,可以快速得到一个初始化的简单编辑器。
|
||||
|
||||
除了上述内容外,文档的其他章节中,也会更深入的描述整个tmagic-editor的设计理念和实现细节。同时你也可以查看我们的[项目源码](https://github.com/Tencent/tmagic-editor),从源码提供的 playground 和 runtime 示例来开发和理解tmagic-editor。
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
tmagic-editor可视化开源项目是从魔方平台演化而来的开源项目,意在提供一个供开发者快速搭建可视化搭建平台的解决方案。
|
||||
|
||||
<img src="https://image.video.qpic.cn/oa_88b7d-32_509802977_1635842258505918" alt="魔方demo图">
|
||||
<img src="/tmagic.png" alt="魔方demo图">
|
||||
|
||||
## 特性
|
||||
|
||||
@ -22,26 +22,27 @@ tmagic-editor可视化开源项目是从魔方平台演化而来的开源项目
|
||||
- **模拟器**,居中位置渲染了当前页面配置的组件内容,模拟真实页面的展示内容。
|
||||
- **组件库**,左侧展示当前业务下的相关组件内容,包含tmagic-editor提供的基础组件和业务自定义组件。
|
||||
- **组件树**,左侧展示当前页面添加的组件内容,以树状结构展示。
|
||||
- **[代码块](./advanced/code-block.md)**,左侧展示添加的函数,可供组件事件中联动所用,或者组件声明周期中调用。
|
||||
- **[数据源](./advanced/data-source.md)**,左侧展示添加的数据源,用于组件中的各项配置。
|
||||
- **表单配置**,右侧表单项目,展示由组件内提供的配置描述,提供修改组件行为的配置项。
|
||||
- **DSL 源码**,右上角的 📄 图标可以展示当前页面,各个组件配置,页面基础配置组合而成的配置源码。
|
||||
|
||||
通过编辑器,可以创建、编辑、保存一个项目页面。同时,tmagic-editor开源项目提供了一个页面搭建管理平台的示例:magic-admin,可以用于快速构建一个完整的页面可视化搭建系统。
|
||||
通过编辑器,可以创建、编辑、保存一个项目页面。
|
||||
|
||||
## 核心库
|
||||
|
||||
- **@tmagic/editor** 实现一个可视化编辑器。
|
||||
- **@tmagic/form** 实现组件在编辑器中自定义表单配置。
|
||||
- **@tmagic/core** 实现对组件进行跨框架管理与一些通用复杂逻辑的实现。
|
||||
- **@tmagic/data-source** 实现数据源的管理与编译。
|
||||
- **@tmagic/stage** 实现在编辑器中对组件的位置拖动与大小拖拉。
|
||||
- **@tmagic/ui** 提供一些vue3基础组件。
|
||||
- **@tmagic/ui-vue2** 提供一些vue2基础组件。
|
||||
- **@tmagic/ui-react** 提供一些react基础组件。
|
||||
- **runtime** 实现在编辑器中对使用不同框架的组件的渲染。
|
||||
- **page** 项目提供最终页面发布的执行环境与组件构建。
|
||||
|
||||
可以查阅 Magic 的[源代码](https://github.com/Tencent/tmagic-editor),与文档描述内容可以逐一对应上,希望文档内容可以为开发者带来比较好的开发体验。
|
||||
可以查阅 tmagic 的[源代码](https://github.com/Tencent/tmagic-editor),与文档描述内容可以逐一对应上,希望文档内容可以为开发者带来比较好的开发体验。
|
||||
|
||||
## 谁在使用
|
||||
|
||||
- 腾讯视频:视频会员,体育会员,WETV 国际版,TV,doki 商城,小企鹅,小说,漫画
|
||||
- 腾讯会议
|
||||
- 腾讯新闻
|
||||
- 58同城本地生活服务
|
||||
89
docs/guide/migration.md
Normal file
89
docs/guide/migration.md
Normal file
@ -0,0 +1,89 @@
|
||||
# 升级到1.5.x
|
||||
|
||||
## ui npm包的变化
|
||||
|
||||
ui中包含的组件被移除,这些组件由单独的npm包提供。1.5.0以后ui包将变得不重要,只是为了兼容而保留,后续将变废弃。
|
||||
|
||||
建议将runtime中的tmagic.config中的packages配置的ui包改成:
|
||||
|
||||
```js
|
||||
{
|
||||
packages: [
|
||||
{ button: '@tmagic/vue-button',
|
||||
{ container: '@tmagic/vue-container' },
|
||||
{ img: '@tmagic/vue-img' },
|
||||
{ 'iterator-container': '@tmagic/vue-iterator-container' },
|
||||
{ page: '@tmagic/vue-page' },
|
||||
{ 'page-fragment': '@tmagic/vue-page-fragment' },
|
||||
{ 'page-fragment-container': '@tmagic/vue-page-fragment-container' },
|
||||
{ text: '@tmagic/vue-text' },
|
||||
{ overlay: '@tmagic/vue-overlay' },
|
||||
{ qrcode: '@tmagic/vue-qrcode' },
|
||||
],
|
||||
}
|
||||
```
|
||||
:::tip
|
||||
react的也是类似上面的修改
|
||||
:::
|
||||
|
||||
:::tip
|
||||
上述这些组件中只有container是最重要的,不可缺少的,其他都可以换成自己实现的版本。
|
||||
iterator-container/page/page-fragment/page-fragment-container这几个组件编辑中是有做特殊识别的,所以如果希望有完整的功能,也尽量保留
|
||||
:::
|
||||
|
||||
## 对编辑画布中组件的识别
|
||||
|
||||
1.5.0之前是通过识别dom中是否拥有id属性是判断该dom是不是组件的根节点,之后默认会变成识别是否拥有data-tmagic-id
|
||||
|
||||
:::tip
|
||||
此变化是通过container组件来实现的,之前vue是`@tmagic/ui`或者`tmagic/ui-vue2`中的Component组件来实现,`tmagic/ui-react`则是各个组件自己实现,之后vue是由`@tmagic/vue-container`实现,react依然由各个组件自己实现。
|
||||
:::
|
||||
|
||||
如果希望依然保留对id属性的识别,我们也提供方法
|
||||
|
||||
```ts
|
||||
import { setDslDomRelateConfig } from '@tmagic/editor';
|
||||
|
||||
setDslDomRelateConfig('getIdFromEl', (el?: HTMLElement | SVGElement | null) => el?.id);
|
||||
setDslDomRelateConfig(
|
||||
'getElById',
|
||||
(doc?: Document, id?: string | number) => doc?.querySelector(`[id="${id}"]`) as HTMLElement,
|
||||
);
|
||||
setDslDomRelateConfig('setIdToEl', (el: HTMLElement | SVGElement, id: string | number) => {
|
||||
el.id = `${id}`;
|
||||
});
|
||||
```
|
||||
|
||||
:::tip
|
||||
与此相关的`m-editor`组件的[canSelect](/api/editor/props.html#canselect)/[isContainer](/api/editor/props.html#iscontainer)这里配置
|
||||
:::
|
||||
|
||||
## 组件对迭代器容器的支持
|
||||
|
||||
迭代器容器是通过绑定一个数据源的数组字段,然后会去迭代这个数组来渲染容器中的内容,这个是同一个配置的组件将会被渲染多次,这个时候组件配置的事件或者代码块中将无法准确获取中组件,所以需要将迭代的信息提供出来。
|
||||
|
||||
已vue组件为例,需要添加iteratorIndex和iteratorContainerId两个prop
|
||||
|
||||
```ts
|
||||
{
|
||||
props: {
|
||||
// other props
|
||||
iteratorIndex: Array as PropType<number[]>,
|
||||
iteratorContainerId: Array as PropType<Id[]>,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
然后传个useApp
|
||||
|
||||
```ts
|
||||
useApp({
|
||||
// other args
|
||||
iteratorContainerId: props.iteratorContainerId,
|
||||
iteratorIndex: props.iteratorIndex,
|
||||
})
|
||||
```
|
||||
|
||||
:::tip
|
||||
如果对迭代器容器没有需求的,可以不用
|
||||
:::
|
||||
@ -2,7 +2,7 @@
|
||||
本章主要介绍tmagic-editor页面打包、发布相关的基础概念,打包原理,打包方案实现。使用了tmagic-editor开源代码的业务方可以自由定制页面的打包构建方案。
|
||||
|
||||
## 编辑器产物 DSL
|
||||
编辑器中最终保存得到的配置结果,同时也是tmagic-editor页面最终渲染的描述文件,就是一份 JS schema 形式的 DSL。其具体形式就是在 [JS Schema](/docs/guide/advanced/js-schema.html#DSL) 我们示例中提到的内容。
|
||||
编辑器中最终保存得到的配置结果,同时也是tmagic-editor页面最终渲染的描述文件,就是一份 JS schema 形式的 DSL。其具体形式就是在 [JS Schema](./advanced/js-schema.html#DSL) 我们示例中提到的内容。
|
||||
|
||||
在tmagic-editor编辑器中,所有的操作和配置信息,最终都保存成这一份 DSL。这份配置在tmagic-editor runtime 中被加载和渲染,最终呈现出tmagic-editor项目页。
|
||||
|
||||
@ -13,7 +13,7 @@ runtime 的概念,是理解tmagic-editor项目页运行的重要概念,runti
|
||||
|
||||
所以更深入描述,runtime 是tmagic-editor页面的渲染环境,提供不同场景下的能力封装。如果理解了tmagic-editor的设计,阅读了tmagic-editor的源码,可以发现,runtime 只是对tmagic-editor的渲染器做了一层包装,在不同 runtime 中,tmagic-editor的渲染逻辑和组件代码都是相同的。
|
||||
|
||||
并且,由于tmagic-editor在编辑器中的模拟器是通过 iframe 渲染的,和tmagic-editor平台本身可以做到框架解耦,所以 runtime 也可以用不同框架开发。目前tmagic-editor提供了 vue2/vue3 和 react 的 runtime 示例。
|
||||
并且,由于tmagic-editor在编辑器中的模拟器是通过 iframe 渲染的,和tmagic-editor平台本身可以做到框架解耦,所以 runtime 也可以用不同框架开发。目前tmagic-editor提供了 vue 和 react 的 runtime 示例。
|
||||
|
||||
各个 runtime 的作用除了作为不同场景下的渲染环境,同时也是不同环境的打包构建载体。tmagic-editor示例代码中的打包就是基于 runtime 进行的。
|
||||
|
||||
@ -21,8 +21,7 @@ runtime 的概念,是理解tmagic-editor项目页运行的重要概念,runti
|
||||
由于 runtime 是页面渲染的承载环境,其中会加载 @tmagic/ui 以及各个业务组件,业务发布项目页也是基于 runtime,所以在 runtime 中实现业务方的自定义逻辑是最合适的。runtime 可以提供一些全局 API,供业务组件调用。我们可以把下面的模拟器中的 runtime 视为一个业务方runtime。
|
||||
|
||||
tmagic-editor提供了三个版本的 runtime 示例,可以参考:
|
||||
- [vue3 runtime](https://github.com/Tencent/tmagic-editor/blob/master/runtime/vue3)
|
||||
- [vue2 runtime](https://github.com/Tencent/tmagic-editor/blob/master/runtime/vue2)
|
||||
- [vue runtime](https://github.com/Tencent/tmagic-editor/blob/master/runtime/vue)
|
||||
- [react runtime](https://github.com/Tencent/tmagic-editor/blob/master/runtime/react)
|
||||
|
||||
### 真实页面渲染(Page)
|
||||
@ -37,16 +36,68 @@ tmagic-editor提供了三个版本的 runtime 示例,可以参考:
|
||||
响应用户配置修改的操作代码并不需要在用户打开的页面被使用到,这是两个 runtime 的主要差异。
|
||||
<img src="https://image.video.qpic.cn/oa_88b7d-32_528694230_1633762153731370" width="100%" alt="tmagic-editor runtime playground 示意图">
|
||||
|
||||
## 打包脚本
|
||||
在tmagic-editor各个框架的 runtime 目录中,有对应的 scripts 打包脚本目录。由于各个框架的 runtime 间有可能有不同的打包方式,所以为了架构职责明确,我们将示例打包代码分别放入对应 runtime 的 scripts 目录中。
|
||||
## @tmagic/cli
|
||||
|
||||
详细的打包脚本,可以参考调用[tmagic-editor打包脚本 generateEntry](https://github.com/Tencent/tmagic-editor/blob/master/runtime/scripts/generateEntry.js)。
|
||||
在[组件开发](./component.md)中可以知道,一个组件是由组件(component)、表单配置(formConfig)、初始值(initValue)三个部分组成,其中表单配置跟初始值是提供给@tmagic/editor使用的,组件则是提供给runtime使用的。所以提供了@tmagic/cli来生成这几个部分的入口文件,处理以上提到的三个部分,还有组件的事件配置列表(@tmagic/editor中使用),插件列表(runtime中使用),总共5个入口文件。
|
||||
|
||||
### 使用方法
|
||||
|
||||
1、在runtime中安装@tmagic/cli
|
||||
```bash
|
||||
npm install @tmagic/cli -D
|
||||
```
|
||||
|
||||
2、在package.json 中的scripts中加入 tmagic entry
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"entry": "tmagic entry"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3、在runtime目录下添加tmagic.config.ts
|
||||
|
||||
```ts
|
||||
import path from 'path';
|
||||
|
||||
import { defineConfig } from '@tmagic/cli';
|
||||
|
||||
export default defineConfig({
|
||||
/** 组件目录或者npm包名 */
|
||||
packages: [path.join(__dirname, '../../packages/ui')],
|
||||
/** 组件文件后缀名,例如vue文件为.vue,tsx文件为.tsx,普通js文件则为.js */
|
||||
componentFileAffix: '.vue',
|
||||
/** npm 配置,用于当packages配置有npm包名时,可以自动安装npm包 */
|
||||
npmConfig: {
|
||||
/** pnpm | npm | yarn */
|
||||
client: 'npm',
|
||||
/** npm镜像代理 */
|
||||
registry: 'https://registry.npmjs.org/'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
4、结果
|
||||
|
||||
执行
|
||||
|
||||
```bash
|
||||
npm run entry
|
||||
```
|
||||
|
||||
会在根目录下生成.tmagic文件夹
|
||||
|
||||
```
|
||||
└─.tmagic
|
||||
└─ comp-entry.ts // 组件
|
||||
└─ config-entry.ts // 组件属性表单配置
|
||||
└─ event-entry.ts // 组件事件列表
|
||||
└─ plugin-entry.ts // 插件
|
||||
└─ value-entry.ts // 组件初始值
|
||||
```
|
||||
|
||||
在 runtime 中,我们通过 vite.config.ts 定义了打包入口文件,在 package.json 中声明了打包命令。你可以进入对应的 runtime 目录中尝试执行
|
||||
```bash
|
||||
npm i
|
||||
npm run build
|
||||
```
|
||||
|
||||
我们就可以得到打包产物 dist 目录。其中有我们在线上项目页面使用的 page.html 和编辑器模拟器使用的 playground.html 两个 runtime 页面框架。
|
||||
|
||||
@ -55,6 +106,7 @@ tmagic-editor的页面发布,目前使用的是静态资源发布。而所有
|
||||
|
||||
原始的 page.html 页面框架
|
||||
```html
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -104,3 +156,10 @@ tmagic-editor的页面发布,目前使用的是静态资源发布。而所有
|
||||
|
||||
```
|
||||
|
||||
其中DSL.js文件为:
|
||||
|
||||
```
|
||||
window.magicDSL = [
|
||||
// DSL
|
||||
]
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user