@tachybase/plugin-icon-pickerv2 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/IconPickerV2/IconPicker.style.d.ts +3 -0
- package/dist/client/IconPickerV2/IconPickerContentV2.d.ts +1 -0
- package/dist/client/IconPickerV2/IconPickerContentV2.style.d.ts +3 -0
- package/dist/client/IconPickerV2/IconPickerV2.d.ts +3 -0
- package/dist/client/IconPickerV2/components/IconContainer.d.ts +1 -0
- package/dist/client/IconPickerV2/components/IconItem.d.ts +1 -0
- package/dist/client/IconPickerV2/components/SearchInput.d.ts +1 -0
- package/dist/client/IconPickerV2/components/SearchInput.style.d.ts +3 -0
- package/dist/client/IconPickerV2/components/SelectIconList.style.d.ts +1 -0
- package/dist/client/IconPickerV2/components/SystemIcon.d.ts +1 -0
- package/dist/client/IconPickerV2/components/SystemIcon.style.d.ts +4 -0
- package/dist/client/IconPickerV2/components/UploadConfigIcon.d.ts +2 -0
- package/dist/client/IconPickerV2/components/UploadConfigIcon.style.d.ts +3 -0
- package/dist/client/IconPickerV2/index.d.ts +1 -0
- package/dist/client/constant.d.ts +39 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +179 -0
- package/dist/client/interfaces/iconv2.d.ts +40 -0
- package/dist/client/locale.d.ts +5 -0
- package/dist/client/plugin.d.ts +7 -0
- package/dist/externalVersion.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +17 -0
- package/dist/locale/zh-CN.json +17 -0
- package/dist/server/actions/IconPickerV2Controller.d.ts +4 -0
- package/dist/server/actions/IconPickerV2Controller.js +104 -0
- package/dist/server/collections/iconStorage.d.ts +3 -0
- package/dist/server/collections/iconStorage.js +44 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +99 -0
- package/package.json +23 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2023-2025] [Tego team]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @tachybase/plugin-icon-pickerv2
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IconPickerContentV2: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IconContainer: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IconItem: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SearchInput: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SystemIcon: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './IconPickerV2';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const NAMESPACE = "icon-pickerv2";
|
|
2
|
+
export declare const iconSize: {
|
|
3
|
+
rounded: {
|
|
4
|
+
borderRadius: string;
|
|
5
|
+
};
|
|
6
|
+
smallRounded: {
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
};
|
|
9
|
+
largeRounded: {
|
|
10
|
+
borderRadius: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const styleBackgroudColor: {
|
|
14
|
+
background: string;
|
|
15
|
+
}[];
|
|
16
|
+
export declare const iconArrow: {
|
|
17
|
+
type: string;
|
|
18
|
+
list: string[];
|
|
19
|
+
};
|
|
20
|
+
export declare const iconEdit: {
|
|
21
|
+
type: string;
|
|
22
|
+
list: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare const iconAlert: {
|
|
25
|
+
type: string;
|
|
26
|
+
list: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare const iconNav: {
|
|
29
|
+
type: string;
|
|
30
|
+
list: string[];
|
|
31
|
+
};
|
|
32
|
+
export declare const iconFile: {
|
|
33
|
+
type: string;
|
|
34
|
+
list: string[];
|
|
35
|
+
};
|
|
36
|
+
export declare const iconStatus: {
|
|
37
|
+
type: string;
|
|
38
|
+
list: string[];
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
(function(r,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("@tego/client"),require("@ant-design/icons"),require("antd"),require("antd-style"),require("lodash")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@tachybase/schema","@tego/client","@ant-design/icons","antd","antd-style","lodash"],i):(r=typeof globalThis!="undefined"?globalThis:r||self,i(r["@tachybase/plugin-icon-pickerv2"]={},r["@tachybase/client"],r.jsxRuntime,r.react,r["@tachybase/schema"],r["@tego/client"],r["@ant-design/icons"],r.antd,r["antd-style"],r.lodash))})(this,function(r,i,e,u,v,K,D,b,h,F){"use strict";var se=Object.defineProperty,ie=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;var O=(r,i,e)=>i in r?se(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e,x=(r,i)=>{for(var e in i||(i={}))ce.call(i,e)&&O(r,e,i[e]);if(M)for(var e of M(i))ae.call(i,e)&&O(r,e,i[e]);return r},E=(r,i)=>ie(r,re(i));var B=(r,i,e)=>new Promise((u,v)=>{var K=h=>{try{b(e.next(h))}catch(F){v(F)}},D=h=>{try{b(e.throw(h))}catch(F){v(F)}},b=h=>h.done?u(h.value):Promise.resolve(h.value).then(K,D);b((e=e.apply(r,i)).next())});const T="icon-pickerv2",P={rounded:{borderRadius:"50px"},smallRounded:{borderRadius:"8px"},largeRounded:{borderRadius:"11px"}},j=[{background:"linear-gradient( 138deg, #FFCBCB 21%, #FF7575 100%)"},{background:"linear-gradient( 136deg, #FFD07D 0%, #F4A94D 57%, #FB9EB1 92%)"},{background:"linear-gradient( 135deg, #9EC56F 32%, #77D19A 88%)"},{background:"linear-gradient( 136deg, #62D4C3 50%, #66CCE0 91%)"},{background:"linear-gradient( 136deg, #9FCAFF 0%, #606CFF 72%, #705DFF 100%)"},{background:"linear-gradient( 135deg, #8895F6 0%, #828FF4 27%, #956CF5 100%)"},{background:"conic-gradient( from 179.99999762840656deg at 85.99999248981476% 86.00000143051147%, #7796FD 1%, #FBCAFD 14%, #C2FCFF 31%, #7C90FF 50%, #A1A5F4 70%, #BDF1FF 87%)"}];function $(){return i.useTranslation([T,"core"],{nsMode:"fallback"})}const H=(o,t={ns:T})=>i.tval(o,t),L=h.createStyles(({css:o,token:t})=>({systemIcon:o`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 10px;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
background-color: #f8f8f8;
|
|
7
|
+
height: 100%;
|
|
8
|
+
.system-icon-top {
|
|
9
|
+
background-color: #ffffff;
|
|
10
|
+
.system-icon-size {
|
|
11
|
+
display: flex;
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
padding: 5px 15px 15px 15px;
|
|
15
|
+
border-radius: 0 0 8px 8px;
|
|
16
|
+
.system-icon-radius {
|
|
17
|
+
display: flex;
|
|
18
|
+
ul {
|
|
19
|
+
background-color: #f5f8fe;
|
|
20
|
+
display: flex;
|
|
21
|
+
list-style: none;
|
|
22
|
+
justify-content: space-evenly;
|
|
23
|
+
padding: 0 5px;
|
|
24
|
+
margin: 0;
|
|
25
|
+
margin-left: 10px;
|
|
26
|
+
border-radius: 999px;
|
|
27
|
+
li {
|
|
28
|
+
padding: 3px 8px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
.syste-icon-checkout {
|
|
32
|
+
border-radius: 999px;
|
|
33
|
+
background-color: ${`${t.colorPrimaryHover}`};
|
|
34
|
+
color: white;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.system-icon-style {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-evenly;
|
|
42
|
+
list-style: none;
|
|
43
|
+
padding: 0;
|
|
44
|
+
li,
|
|
45
|
+
.ant-color-picker-trigger {
|
|
46
|
+
width: 30px;
|
|
47
|
+
height: 30px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
padding: 0;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
border-radius: ${`${t.borderRadius}px`};
|
|
52
|
+
.ant-color-picker-clear {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
57
|
+
.ant-color-picker-clear::after {
|
|
58
|
+
background: #f5222200;
|
|
59
|
+
border: 0;
|
|
60
|
+
}
|
|
61
|
+
.ant-color-picker-color-block {
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
.ant-color-picker-trigger:hover {
|
|
67
|
+
border: 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.system-icon-middle {
|
|
72
|
+
flex: 1;
|
|
73
|
+
padding: 5px 15px;
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
height: 18dvw;
|
|
76
|
+
overflow-y: scroll;
|
|
77
|
+
.system-icon-category {
|
|
78
|
+
background-color: #ffffff;
|
|
79
|
+
border-radius: 6px;
|
|
80
|
+
margin-top: 10px;
|
|
81
|
+
.title {
|
|
82
|
+
padding: 10px;
|
|
83
|
+
color: #555555;
|
|
84
|
+
}
|
|
85
|
+
.icon {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-wrap: wrap;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
.system-icon-bottom {
|
|
92
|
+
background-color: ${`${t.colorPrimaryBg}`};
|
|
93
|
+
height: 2.5dvw;
|
|
94
|
+
min-height: 30px;
|
|
95
|
+
width: 100%;
|
|
96
|
+
position: sticky;
|
|
97
|
+
bottom: 0;
|
|
98
|
+
box-shadow: 0px -4px 5px rgba(0, 0, 0, 0.1);
|
|
99
|
+
ul {
|
|
100
|
+
display: flex;
|
|
101
|
+
justify-content: space-evenly;
|
|
102
|
+
align-items: center;
|
|
103
|
+
list-style: none;
|
|
104
|
+
padding: 0;
|
|
105
|
+
margin: 0;
|
|
106
|
+
height: 100%;
|
|
107
|
+
li {
|
|
108
|
+
width: 40px !important;
|
|
109
|
+
height: 40px !important;
|
|
110
|
+
.anticon {
|
|
111
|
+
padding: 8px 10px !important;
|
|
112
|
+
svg {
|
|
113
|
+
width: 22px !important;
|
|
114
|
+
height: 22px !important;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.system-icon-bottom-li-active {
|
|
119
|
+
background-color: ${`${t.colorPrimaryHover}`};
|
|
120
|
+
border-radius: ${`${t.borderRadius}px`};
|
|
121
|
+
color: white;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`,iconItem:o`
|
|
126
|
+
height: 30px;
|
|
127
|
+
width: 30px;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
margin: 5px;
|
|
132
|
+
border-radius: ${`${t.borderRadius}px`};
|
|
133
|
+
svg {
|
|
134
|
+
width: 15px !important;
|
|
135
|
+
height: 15px !important;
|
|
136
|
+
}
|
|
137
|
+
`})),N=o=>{const{iconKey:t,selected:a,size:s,color:c,onClick:n=()=>{}}=o,{styles:l}=L(),g=a?{borderRadius:s==null?void 0:s.borderRadius,background:c,color:c?"white":void 0,border:"1px solid #D4D4D4 "}:{};return e.jsx("div",{className:l.iconItem,style:g,onClick:()=>n(t),children:e.jsx(i.Icon,{type:t})})},_=h.createStyles(({css:o})=>({popoverStyles:o`
|
|
138
|
+
.ant-popover-inner {
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
padding: 0 !important;
|
|
141
|
+
}
|
|
142
|
+
`})),G=h.createStyles(({css:o,token:t})=>({searchInput:o`
|
|
143
|
+
border-radius: 999px;
|
|
144
|
+
background-color: #f5f8fe;
|
|
145
|
+
border: 0;
|
|
146
|
+
.ant-tabs-extra-content,
|
|
147
|
+
.ant-input-affix-wrapper,
|
|
148
|
+
.ant-input-affix-wrapper-focused,
|
|
149
|
+
.ant-input-outlined:focus-within {
|
|
150
|
+
border: none;
|
|
151
|
+
box-shadow: none;
|
|
152
|
+
}
|
|
153
|
+
`})),J=o=>{const{changeFilterKey:t}=o,{styles:a}=G(),{t:s}=$(),c=F.debounce(n=>{const l=n.target.value.trim();t(l)},500);return e.jsx(b.Input,{className:a.searchInput,allowClear:!0,placeholder:s(""),prefix:e.jsx(i.Icon,{type:"SearchOutlined"}),onChange:c})},Q=o=>{const{size:t,setSize:a,color:s,setColor:c}=o,{styles:n}=L(),[l,g]=u.useState("Directional"),C=u.useRef(null),y=E(x({},o),{size:t,setSize:a,color:s,setColor:c,activeSection:l,setActiveSection:g,containerRef:C});return e.jsxs("div",{className:n.systemIcon,children:[e.jsx(U,x({},y)),e.jsx(W,x({},y)),e.jsx(X,x({},y))]})},U=o=>{const{size:t,setSize:a,color:s,setColor:c}=o,{t:n}=$();return e.jsxs("div",{className:"system-icon-top",children:[e.jsxs("div",{className:"system-icon-size",children:[`${n("Select base color")}`,e.jsxs("div",{className:"system-icon-radius",children:[e.jsx(i.Icon,{type:"clearoutlined",onClick:()=>{c(""),a("")}}),e.jsxs("ul",{children:[e.jsx("li",{className:`${t==="rounded"?"syste-icon-checkout":""}`,onClick:()=>{a("rounded")},children:n("Rotundity")}),e.jsx("li",{className:`${t==="smallRounded"?"syste-icon-checkout":""}`,onClick:()=>{a("smallRounded")},children:n("Small Rounded")}),e.jsx("li",{className:`${t==="largeRounded"?"syste-icon-checkout":""}`,onClick:()=>{a("largeRounded")},children:n("Large Rounded")})]})]})]}),e.jsx("ul",{className:"system-icon-style",children:j.map((l,g)=>{var k;const C=s===l.background,y=E(x({},l),{borderRadius:(k=P[t])==null?void 0:k.borderRadius,border:C?"2px solid #1890ff":"1px solid #d4d4d4",boxSizing:"border-box",cursor:"pointer"});if(g+1===j.length){const S=j.find(d=>d.background===s);return e.jsx(b.ColorPicker,{style:y,value:S?"":s,onChange:d=>{c(d.toCssString())}})}return e.jsx("li",{style:y,onClick:()=>{c(l.background)}})})})]})},W=o=>{const{filterKey:t,onChange:a,size:s,color:c,value:n,setActiveSection:l,containerRef:g,setIconName:C}=o,[y,k]=u.useState(),{t:S}=$(),d=Y(t,i.icons);u.useEffect(()=>{const p=()=>{const w=document.querySelectorAll(".system-icon-category"),I=document.getElementById("system-icon-middle").getBoundingClientRect();let z="Application";w.forEach(m=>{m.getBoundingClientRect().top-I.top<=70&&(z=m.id)}),l(z)},f=g.current;return f&&f.addEventListener("scroll",p),()=>f==null?void 0:f.removeEventListener("scroll",p)},[l]);const A=p=>{C(p),k(p)};return e.jsxs("div",{className:"system-icon-middle",ref:g,id:"system-icon-middle",children:[S("Select Icon"),Object.keys(d).map(p=>d[p].length?e.jsxs("div",{className:"system-icon-category",id:p,children:[e.jsx("div",{className:"title",children:S(p)}),e.jsx("div",{className:"icon",children:d[p].map(f=>e.jsx(N,{iconKey:f,selected:f===y,size:P[s],color:c,onClick:A},f))})]}):null)]})},X=o=>{const{activeSection:t,containerRef:a}=o,s=n=>{const l=document.getElementById(n);l&&a.current&&a.current.scrollTo({top:l.offsetTop-a.current.offsetTop,behavior:"smooth"})},c=[{id:"Directional",icon:"rightcircleoutlined"},{id:"Suggested",icon:"exclamationcircleoutlined"},{id:"EditIcon",icon:"editoutlined"},{id:"DataIcon",icon:"pieChartoutlined"},{id:"Brand",icon:"globaloutlined"},{id:"Application",icon:"appstoreoutlined"}];return e.jsx("div",{className:"system-icon-bottom",children:e.jsx("ul",{children:c.map(n=>e.jsx("li",{className:`system-icon-bottom-li ${t===n.id?"system-icon-bottom-li-active":""}`,onClick:()=>{s(n.id)},children:e.jsx(i.Icon,{type:n.icon})}))})})},Y=(o,t)=>u.useMemo(()=>{const s={Directional:[],Suggested:[],EditIcon:[],DataIcon:[],Brand:[],Application:[]},c=[];return o?t.keys().forEach(n=>{n.toLowerCase().includes(o.toLowerCase())&&c.push(n)}):c.push(...t.keys()),c.forEach(n=>{/up|down|left|right|arrow|expand|shrink/.test(n)?s.Directional.push(n):/check|info|exclamation|close/.test(n)?s.Suggested.push(n):/edit|delete|copy|save/.test(n)?s.EditIcon.push(n):/chart|database|table/.test(n)?s.DataIcon.push(n):/alibaba|antDesign|alipay|taobao|weibo|qq|wechat|github/.test(n)?s.Brand.push(n):s.Application.push(n)}),s},[o]),Z=h.createStyles(({css:o,token:t})=>({iconPickerContent:o`
|
|
154
|
+
width: 25dvw;
|
|
155
|
+
min-width: 250px;
|
|
156
|
+
height: 60vh;
|
|
157
|
+
min-height: 300px;
|
|
158
|
+
position: relative;
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
.ant-tabs {
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
.ant-tabs-nav {
|
|
164
|
+
padding: 5px 15px 0 15px;
|
|
165
|
+
margin-bottom: 5px;
|
|
166
|
+
}
|
|
167
|
+
.ant-tabs-content-holder {
|
|
168
|
+
.ant-tabs-content {
|
|
169
|
+
height: 100%;
|
|
170
|
+
.ant-tabs-tabpane {
|
|
171
|
+
height: 100%;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
.ant-tabs-extra-content {
|
|
177
|
+
width: 30%;
|
|
178
|
+
}
|
|
179
|
+
`})),R=o=>{const{value:t,onChange:a,setFilterKey:s,filterKey:c,setVisible:n}=o,{styles:l}=Z(),g=u.useMemo(()=>[{key:"icon",label:"图标",children:e.jsx(Q,x({},o))}],[o]);return e.jsx("div",{className:l.iconPickerContent,children:e.jsx(b.Tabs,{tabBarExtraContent:e.jsx(J,{changeFilterKey:s}),defaultActiveKey:"icon",items:g,onChange:a})})};function ee(o){const t=i.useAPIClient(),{value:a,onChange:s,disabled:c}=o,{t:n}=$(),l=K.useFormLayout(),{styles:g}=_(),[C,y]=u.useState(!1),[k,S]=u.useState(""),[d,A]=u.useState(""),[p,f]=u.useState(""),[w,V]=u.useState("");return e.jsx("div",{children:e.jsxs(b.Space.Compact,{children:[e.jsx(b.Popover,{overlayClassName:g.popoverStyles,placement:"bottom",open:C,arrow:!1,onOpenChange:I=>B(null,null,function*(){var z;if(!c){if(I===!1){if(!d||typeof d!="string"||d.trim()===""){y(I);return}try{const m=yield t.resource("iconStorage").findOrCreate({name:d,color:w||"",size:p||""}),q=(z=m==null?void 0:m.data)==null?void 0:z.data;q?s(q):console.warn(n("iconStorage did not return an id"))}catch(m){console.error(n("Failed to save iconStorage:"),m)}}y(I)}}),content:e.jsx(R,{value:a,onChange:s,setFilterKey:S,filterKey:k,setVisible:y,setIconName:A,setSize:f,setColor:V,size:p,color:w,iconName:d}),trigger:"hover",children:e.jsx(b.Button,{size:l.size,disabled:c,children:d?e.jsx(N,{iconKey:d,selected:!0,size:P[p],color:w},d):n("Select icon")})}),d&&!c&&e.jsx(b.Button,{size:l.size,icon:e.jsx(D.CloseOutlined,{}),onClick:()=>{A(""),V(""),f(""),s(null)}})]})})}const te=v.connect(ee,v.mapProps((o,t)=>E(x({},o),{suffix:e.jsx("span",{children:t!=null&&t.loading||t!=null&&t.validating?e.jsx(D.LoadingOutlined,{}):o.suffix})})),v.mapReadPretty(o=>{if(!v.isValid(o.value))return e.jsx("div",{});const{name:t,color:a,size:s}=o.value||{};return t?e.jsx(N,{iconKey:t,selected:!0,size:P[s],color:a},t):e.jsx("div",{})}));class oe extends i.CollectionFieldInterface{constructor(){super(...arguments),this.name="iconv2",this.type="object",this.group="basic",this.order=11,this.title=H("IconV2"),this.icon="FieldNumberOutlined",this.default={type:"belongsTo",interface:"object",target:"iconStorage",targetKey:"id",uiSchema:{type:"string","x-component":"IconPickerV2"}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties=x({},i.defaultProps)}}class ne extends i.Plugin{afterAdd(){return B(this,null,function*(){})}beforeLoad(){return B(this,null,function*(){})}load(){return B(this,null,function*(){this.app.addComponents({IconPickerV2:te}),this.app.dataSourceManager.addFieldInterfaces([oe])})}}r.default=ne,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CollectionFieldInterface } from '@tachybase/client';
|
|
2
|
+
export declare class IconV2FieldInterface extends CollectionFieldInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
group: string;
|
|
6
|
+
order: number;
|
|
7
|
+
title: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
default: {
|
|
10
|
+
type: string;
|
|
11
|
+
interface: string;
|
|
12
|
+
target: string;
|
|
13
|
+
targetKey: string;
|
|
14
|
+
uiSchema: {
|
|
15
|
+
type: string;
|
|
16
|
+
'x-component': string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
availableTypes: string[];
|
|
20
|
+
hasDefaultValue: boolean;
|
|
21
|
+
properties: {
|
|
22
|
+
'uiSchema.title': {
|
|
23
|
+
type: string;
|
|
24
|
+
title: string;
|
|
25
|
+
required: boolean;
|
|
26
|
+
"x-decorator": string;
|
|
27
|
+
"x-component": string;
|
|
28
|
+
};
|
|
29
|
+
name: {
|
|
30
|
+
type: string;
|
|
31
|
+
title: string;
|
|
32
|
+
required: boolean;
|
|
33
|
+
"x-disabled": string;
|
|
34
|
+
"x-decorator": string;
|
|
35
|
+
"x-component": string;
|
|
36
|
+
"x-validator": string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useTranslation(): import("react-i18next").UseTranslationResponse<readonly ["icon-pickerv2", "core"], undefined>;
|
|
2
|
+
export declare function lang(key: string, options?: {}): string;
|
|
3
|
+
export declare const tval: (key: string, options?: {
|
|
4
|
+
ns: string;
|
|
5
|
+
}) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"@tachybase/client": "1.4.0",
|
|
3
|
+
"@tego/server": "1.3.52",
|
|
4
|
+
"antd-style": "3.7.1",
|
|
5
|
+
"react": "18.3.1",
|
|
6
|
+
"antd": "5.22.5",
|
|
7
|
+
"@tachybase/schema": "1.3.52",
|
|
8
|
+
"@tego/client": "1.3.52",
|
|
9
|
+
"@ant-design/icons": "5.6.1",
|
|
10
|
+
"lodash": "4.17.21"
|
|
11
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
__reExport(index_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Application": "Application",
|
|
3
|
+
"Brand": "Brand & Logo",
|
|
4
|
+
"DataIcon": "Data Icon",
|
|
5
|
+
"Directional": "Directional Icon",
|
|
6
|
+
"EditIcon": "Edit Icon",
|
|
7
|
+
"Failed to save iconStorage:": "Failed to save iconStorage",
|
|
8
|
+
"IconV2": "Icon V2",
|
|
9
|
+
"Large Rounded": "Large Rounded",
|
|
10
|
+
"Rotundity": "Round",
|
|
11
|
+
"Select Icon": "Select Icon",
|
|
12
|
+
"Select base color": "Select Base Color",
|
|
13
|
+
"Small Rounded": "Small Rounded",
|
|
14
|
+
"Suggested": "Suggested Icons",
|
|
15
|
+
"The key in Antd, such as 'ApiOutlined', ignoring case": "The key in Antd, e.g., 'ApiOutlined', ignoring case",
|
|
16
|
+
"iconStorage did not return an id": "iconStorage did not return an ID"
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Application": "应用程序图标",
|
|
3
|
+
"Brand": "品牌与LOGO",
|
|
4
|
+
"DataIcon": "数据图标",
|
|
5
|
+
"Directional": "定向图标",
|
|
6
|
+
"EditIcon": "编辑图标",
|
|
7
|
+
"Failed to save iconStorage:": "存储图标失败",
|
|
8
|
+
"IconV2": "图标V2",
|
|
9
|
+
"Large Rounded": "大圆角",
|
|
10
|
+
"Rotundity": "圆形",
|
|
11
|
+
"Select Icon": "选择图标",
|
|
12
|
+
"Select base color": "选择底色",
|
|
13
|
+
"Small Rounded": "小圆角",
|
|
14
|
+
"Suggested": "展示图标",
|
|
15
|
+
"The key in Antd, such as 'ApiOutlined', ignoring case": "Antd的key,例如'ApiOutlined',忽略大小写",
|
|
16
|
+
"iconStorage did not return an id": "图标库未返回id"
|
|
17
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
26
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
27
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
28
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
29
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
30
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
31
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
35
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
36
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
37
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
38
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
39
|
+
return __privateGet(this, extra);
|
|
40
|
+
}, set [name](x) {
|
|
41
|
+
return __privateSet(this, extra, x);
|
|
42
|
+
} }, name));
|
|
43
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
44
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
45
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
46
|
+
if (k) {
|
|
47
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
48
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
49
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
50
|
+
}
|
|
51
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
52
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
53
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
54
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
55
|
+
}
|
|
56
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
57
|
+
};
|
|
58
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
59
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
60
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
61
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
62
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
63
|
+
var IconPickerV2Controller_exports = {};
|
|
64
|
+
__export(IconPickerV2Controller_exports, {
|
|
65
|
+
IconPickerV2Controller: () => IconPickerV2Controller
|
|
66
|
+
});
|
|
67
|
+
module.exports = __toCommonJS(IconPickerV2Controller_exports);
|
|
68
|
+
var import_server = require("@tego/server");
|
|
69
|
+
var _findOrCreate_dec, _IconPickerV2Controller_decorators, _init;
|
|
70
|
+
_IconPickerV2Controller_decorators = [(0, import_server.Controller)("iconStorage")], _findOrCreate_dec = [(0, import_server.Action)("findOrCreate", { acl: "loggedIn" })];
|
|
71
|
+
class IconPickerV2Controller {
|
|
72
|
+
constructor() {
|
|
73
|
+
__runInitializers(_init, 5, this);
|
|
74
|
+
}
|
|
75
|
+
async findOrCreate(ctx, next) {
|
|
76
|
+
var _a;
|
|
77
|
+
try {
|
|
78
|
+
const { name, size = "", color = "" } = ctx.action.params || {};
|
|
79
|
+
if (!name) {
|
|
80
|
+
ctx.body = null;
|
|
81
|
+
return await next();
|
|
82
|
+
}
|
|
83
|
+
const repo = ctx.db.getRepository("iconStorage");
|
|
84
|
+
let iconData = await repo.findOne({ filter: { name, color, size } });
|
|
85
|
+
if (!iconData) {
|
|
86
|
+
iconData = await repo.create({ values: { name, color, size } });
|
|
87
|
+
}
|
|
88
|
+
const iconId = ((_a = iconData == null ? void 0 : iconData.dataValues) == null ? void 0 : _a.id) ?? null;
|
|
89
|
+
ctx.body = iconId;
|
|
90
|
+
} catch (err) {
|
|
91
|
+
console.error("IconPickerV2Controller findOrCreate error:", err);
|
|
92
|
+
ctx.body = null;
|
|
93
|
+
}
|
|
94
|
+
await next();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_init = __decoratorStart(null);
|
|
98
|
+
__decorateElement(_init, 1, "findOrCreate", _findOrCreate_dec, IconPickerV2Controller);
|
|
99
|
+
IconPickerV2Controller = __decorateElement(_init, 0, "IconPickerV2Controller", _IconPickerV2Controller_decorators, IconPickerV2Controller);
|
|
100
|
+
__runInitializers(_init, 1, IconPickerV2Controller);
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
IconPickerV2Controller
|
|
104
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var iconStorage_exports = {};
|
|
19
|
+
__export(iconStorage_exports, {
|
|
20
|
+
default: () => iconStorage_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(iconStorage_exports);
|
|
23
|
+
var iconStorage_default = {
|
|
24
|
+
name: "iconStorage",
|
|
25
|
+
shared: true,
|
|
26
|
+
createdAt: false,
|
|
27
|
+
updatedAt: false,
|
|
28
|
+
createdBy: false,
|
|
29
|
+
updatedBy: false,
|
|
30
|
+
fields: [
|
|
31
|
+
{
|
|
32
|
+
type: "string",
|
|
33
|
+
name: "name"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "string",
|
|
37
|
+
name: "color"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "string",
|
|
41
|
+
name: "size"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_plugin.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from '@tego/server';
|
|
2
|
+
export declare class PluginIconPickerV2 extends Plugin {
|
|
3
|
+
afterAdd(): Promise<void>;
|
|
4
|
+
beforeLoad(): Promise<void>;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
install(): Promise<void>;
|
|
7
|
+
afterEnable(): Promise<void>;
|
|
8
|
+
afterDisable(): Promise<void>;
|
|
9
|
+
remove(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default PluginIconPickerV2;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
26
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
27
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
28
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
29
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
30
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
31
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
35
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
36
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
37
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
38
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
39
|
+
return __privateGet(this, extra);
|
|
40
|
+
}, set [name](x) {
|
|
41
|
+
return __privateSet(this, extra, x);
|
|
42
|
+
} }, name));
|
|
43
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
44
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
45
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
46
|
+
if (k) {
|
|
47
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
48
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
49
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
50
|
+
}
|
|
51
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
52
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
53
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
54
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
55
|
+
}
|
|
56
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
57
|
+
};
|
|
58
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
59
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
60
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
61
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
62
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
63
|
+
var plugin_exports = {};
|
|
64
|
+
__export(plugin_exports, {
|
|
65
|
+
PluginIconPickerV2: () => PluginIconPickerV2,
|
|
66
|
+
default: () => plugin_default
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
69
|
+
var import_server = require("@tego/server");
|
|
70
|
+
var import_IconPickerV2Controller = require("./actions/IconPickerV2Controller");
|
|
71
|
+
var _PluginIconPickerV2_decorators, _init, _a;
|
|
72
|
+
_PluginIconPickerV2_decorators = [(0, import_server.InjectedPlugin)({
|
|
73
|
+
Controllers: [import_IconPickerV2Controller.IconPickerV2Controller]
|
|
74
|
+
})];
|
|
75
|
+
class PluginIconPickerV2 extends (_a = import_server.Plugin) {
|
|
76
|
+
async afterAdd() {
|
|
77
|
+
}
|
|
78
|
+
async beforeLoad() {
|
|
79
|
+
}
|
|
80
|
+
async load() {
|
|
81
|
+
this.app.acl.allow("iconStorage", "*", "loggedIn");
|
|
82
|
+
}
|
|
83
|
+
async install() {
|
|
84
|
+
}
|
|
85
|
+
async afterEnable() {
|
|
86
|
+
}
|
|
87
|
+
async afterDisable() {
|
|
88
|
+
}
|
|
89
|
+
async remove() {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
_init = __decoratorStart(_a);
|
|
93
|
+
PluginIconPickerV2 = __decorateElement(_init, 0, "PluginIconPickerV2", _PluginIconPickerV2_decorators, PluginIconPickerV2);
|
|
94
|
+
__runInitializers(_init, 1, PluginIconPickerV2);
|
|
95
|
+
var plugin_default = PluginIconPickerV2;
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
PluginIconPickerV2
|
|
99
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/plugin-icon-pickerv2",
|
|
3
|
+
"displayName": "Icon Picker V2",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"description": "A versatile icon picker plugin for Tachybase, providing easy integration and customizable icon selection.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Collection fields"
|
|
8
|
+
],
|
|
9
|
+
"main": "dist/server/index.js",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@ant-design/icons": "^5.6.1",
|
|
12
|
+
"@tachybase/schema": "*",
|
|
13
|
+
"@tachybase/test": "1.3.52",
|
|
14
|
+
"@tego/client": "1.3.52",
|
|
15
|
+
"@tego/server": "1.3.52",
|
|
16
|
+
"antd": "5.22.5",
|
|
17
|
+
"antd-style": "3.7.1",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"@tachybase/client": "1.4.0"
|
|
20
|
+
},
|
|
21
|
+
"description.zh-CN": "一个灵活的图标选择插件,为 Tachybase 提供简单集成和可定制的图标选择功能。",
|
|
22
|
+
"displayName.zh-CN": "图标选择器 V2"
|
|
23
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|