@giteeteam/apps-team-components 1.2.2 → 1.2.3-alpha.2
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/README.md +28 -28
- package/dist/components/common/PriceTag.js +18 -18
- package/dist/components/common/overflow-tooltip/style/index.js +13 -13
- package/dist/components/common/style/global.js +2 -2
- package/dist/components/common/user-field/style/index.js +21 -21
- package/dist/components/fields/bind-workspace/style/index.js +3 -3
- package/dist/components/fields/hyper-link/style/index.js +14 -14
- package/dist/components/fields/long-text/style/index.js +5 -5
- package/dist/components/fields/priority/style/index.js +50 -50
- package/dist/components/fields/status/SelectTransition.js +105 -5
- package/dist/components/fields/status/TransitionButton.d.ts +5 -21
- package/dist/components/fields/status/TransitionButton.js +8 -99
- package/dist/components/fields/status/style/index.js +323 -323
- package/dist/components/fields/tag/style/index.js +5 -5
- package/dist/components/fields/team/style/index.js +2 -2
- package/dist/components/fields/user/style/index.js +8 -8
- package/dist/components/table-components/style/index.js +5 -5
- package/dist/icons/svg/DottedCircle.svg +7 -7
- package/dist/icons/svg/HollowCircle.svg +6 -6
- package/dist/icons/svg/Workflow.svg +12 -12
- package/dist/lib/contexts/workflowConfig.d.ts +2 -0
- package/dist/lib/workflow.d.ts +1 -0
- package/dist/lib/workflow.js +104 -19
- package/package.json +69 -69
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg t="1702526505381" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
p-id="14633" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
4
|
-
<path
|
|
5
|
-
d="M681.919574 995.136018l-33.919979-96.63994a408.447745 408.447745 0 0 1-130.239919 23.039986l-6.911995 0.064h-4.159998l-1.279999 102.399936H511.99968c59.519963 0 116.735927-10.175994 169.919894-28.863982zM243.839848 821.632126l-67.071958 77.375952a511.74368 511.74368 0 0 0 153.151904 91.647943l36.479977-95.67994a409.343744 409.343744 0 0 1-122.559923-73.343955z m709.503556-49.919968l-88.191945-52.031968a412.159742 412.159742 0 0 1-92.927942 108.671932l65.15196 78.975951a514.559678 514.559678 0 0 0 115.967927-135.679915zM107.391933 576.00028l-101.183937 15.87199c9.471994 60.415962 29.439982 117.311927 58.111964 168.767895l89.471944-49.855969a406.079746 406.079746 0 0 1-46.399971-134.783916zM1023.99936 512.00032c0-29.439982-2.495998-58.239964-7.231995-86.207946l-100.927937 17.087989a412.991742 412.991742 0 0 1-0.896 143.359911l100.735937 18.303988c5.439997-30.015981 8.319995-60.927962 8.319995-92.543942zM74.175954 246.400486a508.799682 508.799682 0 0 0-64.63996 166.399896l100.543937 19.775988a406.399746 406.399746 0 0 1 51.583968-132.927917L74.239954 246.400486z m882.303448 11.327993a514.431678 514.431678 0 0 0-114.303928-137.087914l-66.111959 78.271951a412.031742 412.031742 0 0 1 91.583943 109.759931l88.831944-50.943968z m-607.99962-231.039856A510.975681 510.975681 0 0 0 191.99988 112.38457l63.99996 79.87195a408.575745 408.575745 0 0 1 125.247922-68.543957L348.543782 26.688623zM511.99968 0.00064v102.399936c48.63997 0 95.99994 8.447995 140.607912 24.767985l35.199978-96.19194A511.039681 511.039681 0 0 0 511.99968 0.00064z"
|
|
6
|
-
p-id="14634"></path>
|
|
7
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg t="1702526505381" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
p-id="14633" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
4
|
+
<path
|
|
5
|
+
d="M681.919574 995.136018l-33.919979-96.63994a408.447745 408.447745 0 0 1-130.239919 23.039986l-6.911995 0.064h-4.159998l-1.279999 102.399936H511.99968c59.519963 0 116.735927-10.175994 169.919894-28.863982zM243.839848 821.632126l-67.071958 77.375952a511.74368 511.74368 0 0 0 153.151904 91.647943l36.479977-95.67994a409.343744 409.343744 0 0 1-122.559923-73.343955z m709.503556-49.919968l-88.191945-52.031968a412.159742 412.159742 0 0 1-92.927942 108.671932l65.15196 78.975951a514.559678 514.559678 0 0 0 115.967927-135.679915zM107.391933 576.00028l-101.183937 15.87199c9.471994 60.415962 29.439982 117.311927 58.111964 168.767895l89.471944-49.855969a406.079746 406.079746 0 0 1-46.399971-134.783916zM1023.99936 512.00032c0-29.439982-2.495998-58.239964-7.231995-86.207946l-100.927937 17.087989a412.991742 412.991742 0 0 1-0.896 143.359911l100.735937 18.303988c5.439997-30.015981 8.319995-60.927962 8.319995-92.543942zM74.175954 246.400486a508.799682 508.799682 0 0 0-64.63996 166.399896l100.543937 19.775988a406.399746 406.399746 0 0 1 51.583968-132.927917L74.239954 246.400486z m882.303448 11.327993a514.431678 514.431678 0 0 0-114.303928-137.087914l-66.111959 78.271951a412.031742 412.031742 0 0 1 91.583943 109.759931l88.831944-50.943968z m-607.99962-231.039856A510.975681 510.975681 0 0 0 191.99988 112.38457l63.99996 79.87195a408.575745 408.575745 0 0 1 125.247922-68.543957L348.543782 26.688623zM511.99968 0.00064v102.399936c48.63997 0 95.99994 8.447995 140.607912 24.767985l35.199978-96.19194A511.039681 511.039681 0 0 0 511.99968 0.00064z"
|
|
6
|
+
p-id="14634"></path>
|
|
7
|
+
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 25.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
-
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
-
viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
|
|
5
|
-
<path d="M5,0C2.2,0,0,2.2,0,5s2.2,5,5,5s5-2.2,5-5S7.8,0,5,0z M5,8C3.3,8,2,6.7,2,5s1.3-3,3-3s3,1.3,3,3S6.7,8,5,8z"/>
|
|
6
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 25.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
|
|
5
|
+
<path d="M5,0C2.2,0,0,2.2,0,5s2.2,5,5,5s5-2.2,5-5S7.8,0,5,0z M5,8C3.3,8,2,6.7,2,5s1.3-3,3-3s3,1.3,3,3S6.7,8,5,8z"/>
|
|
6
|
+
</svg>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 25.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
-
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
-
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
|
|
5
|
-
<path d="M111.4,88.1c-7.5,0-14.46,4.82-16.61,11.79H38.03c-8.57,0-15.53-6.97-15.53-15.53
|
|
6
|
-
c0-8.57,6.97-14.99,15.53-14.99h52.49c14.46,0,26.25-11.79,26.25-26.25s-11.79-26.25-26.25-26.25H33.75
|
|
7
|
-
C31.61,9.91,25.18,5.09,17.14,5.09C8.04,5.09,0,13.12,0,22.23s8.04,17.14,17.14,17.14c7.5,0,14.46-4.82,16.61-11.79h56.23
|
|
8
|
-
c8.57,0,15.53,6.97,15.53,15.53s-6.42,15.53-14.99,15.53h-52.5c-14.46,0-26.25,11.79-26.25,26.25s11.79,26.25,26.25,26.25h56.23
|
|
9
|
-
c2.14,6.97,8.57,11.79,16.61,11.79c9.64,0,17.14-8.04,17.14-17.14S120.51,88.1,111.4,88.1z M17.15,29.18
|
|
10
|
-
c-3.22,0-6.42-3.22-6.42-6.97s3.22-6.42,6.42-6.42s6.42,3.22,6.42,6.42S20.9,29.18,17.15,29.18z M111.4,112.21
|
|
11
|
-
c-3.75,0-6.42-3.22-6.42-6.42c0-3.21,3.22-6.42,6.42-6.42c3.21,0,6.42,3.22,6.42,6.42C117.83,108.99,114.62,112.21,111.4,112.21z"/>
|
|
12
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 25.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
|
|
5
|
+
<path d="M111.4,88.1c-7.5,0-14.46,4.82-16.61,11.79H38.03c-8.57,0-15.53-6.97-15.53-15.53
|
|
6
|
+
c0-8.57,6.97-14.99,15.53-14.99h52.49c14.46,0,26.25-11.79,26.25-26.25s-11.79-26.25-26.25-26.25H33.75
|
|
7
|
+
C31.61,9.91,25.18,5.09,17.14,5.09C8.04,5.09,0,13.12,0,22.23s8.04,17.14,17.14,17.14c7.5,0,14.46-4.82,16.61-11.79h56.23
|
|
8
|
+
c8.57,0,15.53,6.97,15.53,15.53s-6.42,15.53-14.99,15.53h-52.5c-14.46,0-26.25,11.79-26.25,26.25s11.79,26.25,26.25,26.25h56.23
|
|
9
|
+
c2.14,6.97,8.57,11.79,16.61,11.79c9.64,0,17.14-8.04,17.14-17.14S120.51,88.1,111.4,88.1z M17.15,29.18
|
|
10
|
+
c-3.22,0-6.42-3.22-6.42-6.97s3.22-6.42,6.42-6.42s6.42,3.22,6.42,6.42S20.9,29.18,17.15,29.18z M111.4,112.21
|
|
11
|
+
c-3.75,0-6.42-3.22-6.42-6.42c0-3.21,3.22-6.42,6.42-6.42c3.21,0,6.42,3.22,6.42,6.42C117.83,108.99,114.62,112.21,111.4,112.21z"/>
|
|
12
|
+
</svg>
|
|
@@ -5,6 +5,8 @@ export interface IWorkflowConfig {
|
|
|
5
5
|
getWorkflowData?: (itemId: string) => Promise<any>;
|
|
6
6
|
runTransition?: (params: Record<string, any>) => Promise<any>;
|
|
7
7
|
getItemStatus?: (itemId: string) => Promise<any>;
|
|
8
|
+
postCheckTransitions?: (params: Record<string, any>[]) => Promise<any>;
|
|
9
|
+
hideDisabledStatusTransition?: string;
|
|
8
10
|
}
|
|
9
11
|
export interface IWorkflowConfigContext {
|
|
10
12
|
workflow?: IWorkflowConfig;
|
package/dist/lib/workflow.d.ts
CHANGED
|
@@ -107,5 +107,6 @@ interface CheckUserPermissionParams {
|
|
|
107
107
|
export declare function checkUserPermission({ transition, userId, roleIds, groupIds, item, workspaceRoleIds, }: CheckUserPermissionParams): ResultType;
|
|
108
108
|
export declare function checkItemCondition(transition: TransitionProps, item: ItemResultProps): ResultType;
|
|
109
109
|
export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, permissions: WorkflowPermissionType, flowHandlerActive?: boolean): ResultType;
|
|
110
|
+
export declare function checkFlowHandler(item: ItemResultProps, permissions: WorkflowPermissionType, flowHandlerActive?: boolean): ResultType;
|
|
110
111
|
export declare const useWorkflowPermission: (workspaceId: ObjectId) => [ObjectId[], ObjectId[], ObjectId[]];
|
|
111
112
|
export {};
|
package/dist/lib/workflow.js
CHANGED
|
@@ -118,7 +118,7 @@ function listToCompare(list1, list2, compareString) {
|
|
|
118
118
|
export function checkUserPermission({ transition, userId, roleIds, groupIds, item, workspaceRoleIds, }) {
|
|
119
119
|
var _a, _b, _c;
|
|
120
120
|
const values = (item === null || item === void 0 ? void 0 : item.values) || {};
|
|
121
|
-
const { users: authUsers, roles: authRoles, groups: authGroups, customFields: authUserFields, workspaceRoles: authWorkspaceRoles, creatorAuth, } = ((_a = transition.parameters) === null || _a === void 0 ? void 0 : _a.permissionType) || {};
|
|
121
|
+
const { users: authUsers, roles: authRoles, groups: authGroups, customFields: authUserFields, workspaceRoles: authWorkspaceRoles, creatorAuth, conditionKey, } = ((_a = transition.parameters) === null || _a === void 0 ? void 0 : _a.permissionType) || {};
|
|
122
122
|
const hasUsers = (authUsers === null || authUsers === void 0 ? void 0 : authUsers.length) > 0;
|
|
123
123
|
const hasRoles = (authRoles === null || authRoles === void 0 ? void 0 : authRoles.length) > 0;
|
|
124
124
|
const hasGroups = (authGroups === null || authGroups === void 0 ? void 0 : authGroups.length) > 0;
|
|
@@ -126,14 +126,18 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
126
126
|
const hasWorkspaceRoles = (authWorkspaceRoles === null || authWorkspaceRoles === void 0 ? void 0 : authWorkspaceRoles.length) > 0;
|
|
127
127
|
const tipText = [];
|
|
128
128
|
if (!hasUsers && !hasRoles && !hasGroups && !hasUserFields && !hasWorkspaceRoles && !creatorAuth) {
|
|
129
|
-
return { result: true };
|
|
129
|
+
return { result: true, isEmpty: true };
|
|
130
130
|
}
|
|
131
|
+
const defaultConditionKey = conditionKey || 'any';
|
|
132
|
+
const isAny = defaultConditionKey === 'any';
|
|
131
133
|
if (creatorAuth) {
|
|
132
134
|
if (![(_b = item.createdBy) === null || _b === void 0 ? void 0 : _b.objectId, (_c = item.createdBy) === null || _c === void 0 ? void 0 : _c.id].includes(userId)) {
|
|
133
135
|
tipText.push(i18n.t('pages.workflow.default.userType.creatorAuth'));
|
|
134
136
|
}
|
|
135
137
|
else {
|
|
136
|
-
|
|
138
|
+
if (isAny) {
|
|
139
|
+
return { result: true };
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
if (hasUsers) {
|
|
@@ -143,7 +147,9 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
143
147
|
tipText.push(`${i18n.t('libs.workflow.user')}:${tipUsers}`);
|
|
144
148
|
}
|
|
145
149
|
else {
|
|
146
|
-
|
|
150
|
+
if (isAny) {
|
|
151
|
+
return { result: true };
|
|
152
|
+
}
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
if (hasRoles) {
|
|
@@ -153,7 +159,9 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
153
159
|
tipText.push(`${i18n.t('libs.workflow.role')}:${tipRoles}`);
|
|
154
160
|
}
|
|
155
161
|
else {
|
|
156
|
-
|
|
162
|
+
if (isAny) {
|
|
163
|
+
return { result: true };
|
|
164
|
+
}
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
if (hasGroups) {
|
|
@@ -163,7 +171,9 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
163
171
|
tipText.push(`${i18n.t('libs.workflow.group')}:${tipGroup}`);
|
|
164
172
|
}
|
|
165
173
|
else {
|
|
166
|
-
|
|
174
|
+
if (isAny) {
|
|
175
|
+
return { result: true };
|
|
176
|
+
}
|
|
167
177
|
}
|
|
168
178
|
}
|
|
169
179
|
if (hasUserFields) {
|
|
@@ -194,7 +204,9 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
194
204
|
tipText.push(`${i18n.t('libs.workflow.userFields')}:${tipRoles}`);
|
|
195
205
|
}
|
|
196
206
|
else {
|
|
197
|
-
|
|
207
|
+
if (isAny) {
|
|
208
|
+
return { result: true };
|
|
209
|
+
}
|
|
198
210
|
}
|
|
199
211
|
}
|
|
200
212
|
if (hasWorkspaceRoles) {
|
|
@@ -206,7 +218,9 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
206
218
|
tipText.push(`${i18n.t('libs.workflow.workspaceRoles')}:${tipWorkspaceRoles}`);
|
|
207
219
|
}
|
|
208
220
|
else {
|
|
209
|
-
|
|
221
|
+
if (isAny) {
|
|
222
|
+
return { result: true };
|
|
223
|
+
}
|
|
210
224
|
}
|
|
211
225
|
}
|
|
212
226
|
if (tipText.length) {
|
|
@@ -215,8 +229,13 @@ export function checkUserPermission({ transition, userId, roleIds, groupIds, ite
|
|
|
215
229
|
return { result: true };
|
|
216
230
|
}
|
|
217
231
|
export function checkItemCondition(transition, item) {
|
|
218
|
-
var _a, _b;
|
|
219
|
-
const
|
|
232
|
+
var _a, _b, _c;
|
|
233
|
+
const defaultConditionKey = ((_a = transition === null || transition === void 0 ? void 0 : transition.parameters) === null || _a === void 0 ? void 0 : _a.fieldTypeConditionKey) || 'all';
|
|
234
|
+
const conditions = ((_b = transition.parameters) === null || _b === void 0 ? void 0 : _b.fieldType) || [];
|
|
235
|
+
const isAny = defaultConditionKey === 'any';
|
|
236
|
+
if (!conditions.length) {
|
|
237
|
+
return { result: true, isEmpty: true };
|
|
238
|
+
}
|
|
220
239
|
for (const i in conditions) {
|
|
221
240
|
const { comparedValue, numberCompare, stringCompare, dropDownCompare, field, pickerType } = conditions[i];
|
|
222
241
|
let fieldValue;
|
|
@@ -231,7 +250,7 @@ export function checkItemCondition(transition, item) {
|
|
|
231
250
|
fieldValue = item[field.key].objectId;
|
|
232
251
|
}
|
|
233
252
|
else {
|
|
234
|
-
fieldValue = (
|
|
253
|
+
fieldValue = (_c = item.values) === null || _c === void 0 ? void 0 : _c[field.key];
|
|
235
254
|
}
|
|
236
255
|
let sourceValue = null, targetValue = null;
|
|
237
256
|
switch (field.componentType) {
|
|
@@ -251,6 +270,13 @@ export function checkItemCondition(transition, item) {
|
|
|
251
270
|
}),
|
|
252
271
|
};
|
|
253
272
|
}
|
|
273
|
+
else {
|
|
274
|
+
if (isAny) {
|
|
275
|
+
return {
|
|
276
|
+
result: true,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
254
280
|
}
|
|
255
281
|
else if (!numberToCompare(fieldValue, Number(targetValue), numberCompare)) {
|
|
256
282
|
if (isEmptyCondition(numberCompare)) {
|
|
@@ -264,7 +290,7 @@ export function checkItemCondition(transition, item) {
|
|
|
264
290
|
}
|
|
265
291
|
let showValue = comparedValue;
|
|
266
292
|
if (field.componentType === CustomFieldComponentTypes.Date) {
|
|
267
|
-
showValue = getFormat(comparedValue, getDateType(
|
|
293
|
+
showValue = getFormat(comparedValue, getDateType(pickerType));
|
|
268
294
|
}
|
|
269
295
|
return {
|
|
270
296
|
result: false,
|
|
@@ -275,6 +301,13 @@ export function checkItemCondition(transition, item) {
|
|
|
275
301
|
}),
|
|
276
302
|
};
|
|
277
303
|
}
|
|
304
|
+
else {
|
|
305
|
+
if (isAny) {
|
|
306
|
+
return {
|
|
307
|
+
result: true,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
278
311
|
break;
|
|
279
312
|
case CustomFieldComponentTypes.Text:
|
|
280
313
|
case CustomFieldComponentTypes.LongText:
|
|
@@ -299,6 +332,13 @@ export function checkItemCondition(transition, item) {
|
|
|
299
332
|
message,
|
|
300
333
|
};
|
|
301
334
|
}
|
|
335
|
+
else {
|
|
336
|
+
if (isAny) {
|
|
337
|
+
return {
|
|
338
|
+
result: true,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
302
342
|
break;
|
|
303
343
|
case CustomFieldComponentTypes.User:
|
|
304
344
|
case CustomFieldComponentTypes.Dropdown:
|
|
@@ -337,8 +377,13 @@ export function checkItemCondition(transition, item) {
|
|
|
337
377
|
}),
|
|
338
378
|
};
|
|
339
379
|
}
|
|
340
|
-
|
|
341
|
-
|
|
380
|
+
else {
|
|
381
|
+
if (isAny) {
|
|
382
|
+
return {
|
|
383
|
+
result: true,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
342
387
|
break;
|
|
343
388
|
}
|
|
344
389
|
}
|
|
@@ -348,6 +393,8 @@ export function checkTransition(item, transition, permissions, flowHandlerActive
|
|
|
348
393
|
var _a, _b;
|
|
349
394
|
if (!item || !transition)
|
|
350
395
|
return { result: false };
|
|
396
|
+
const defaultConditionKey = (transition === null || transition === void 0 ? void 0 : transition.conditionKey) || 'all';
|
|
397
|
+
const isAll = defaultConditionKey === 'all';
|
|
351
398
|
if (flowHandlerActive && ((_b = (_a = item === null || item === void 0 ? void 0 : item.values) === null || _a === void 0 ? void 0 : _a.flowHandler) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
352
399
|
const flowHandler = item.values.flowHandler;
|
|
353
400
|
const flowUser = flowHandler.find(user => user.value === permissions.userId);
|
|
@@ -367,12 +414,50 @@ export function checkTransition(item, transition, permissions, flowHandlerActive
|
|
|
367
414
|
item,
|
|
368
415
|
...permissions,
|
|
369
416
|
});
|
|
370
|
-
if (!roleCheck.result)
|
|
371
|
-
return roleCheck;
|
|
372
417
|
const conditionCheck = checkItemCondition(transition, item);
|
|
373
|
-
if (
|
|
374
|
-
|
|
375
|
-
|
|
418
|
+
if (isAll) {
|
|
419
|
+
if (!roleCheck.result)
|
|
420
|
+
return roleCheck;
|
|
421
|
+
if (!conditionCheck.result)
|
|
422
|
+
return conditionCheck;
|
|
423
|
+
return { result: true };
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
const conditionList = [roleCheck, conditionCheck];
|
|
427
|
+
const notEmpty = conditionList.filter(item => !item.isEmpty);
|
|
428
|
+
if ((notEmpty === null || notEmpty === void 0 ? void 0 : notEmpty.length) > 0) {
|
|
429
|
+
const hasPass = notEmpty.find(item => item.result);
|
|
430
|
+
if (hasPass) {
|
|
431
|
+
return { result: true };
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
const notPass = notEmpty.find(item => !item.result);
|
|
435
|
+
return notPass;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
return { result: true };
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
export function checkFlowHandler(item, permissions, flowHandlerActive) {
|
|
444
|
+
var _a, _b;
|
|
445
|
+
if (!item)
|
|
446
|
+
return { result: false };
|
|
447
|
+
if (flowHandlerActive && ((_b = (_a = item === null || item === void 0 ? void 0 : item.values) === null || _a === void 0 ? void 0 : _a.flowHandler) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
448
|
+
const flowHandler = item.values.flowHandler;
|
|
449
|
+
const flowUser = flowHandler.find(user => user.value === permissions.userId);
|
|
450
|
+
if (flowUser) {
|
|
451
|
+
return { result: true };
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
const tipUsers = flowHandler.map(user => user.label).join('、');
|
|
455
|
+
return {
|
|
456
|
+
result: false,
|
|
457
|
+
message: i18n.t('libs.default.tipText', { text: `${i18n.t('libs.workflow.flowHandler')}:${tipUsers}` }),
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
}
|
|
376
461
|
}
|
|
377
462
|
export const useWorkflowPermission = (workspaceId) => {
|
|
378
463
|
const [roles, setRoles] = useState([]);
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@giteeteam/apps-team-components",
|
|
3
|
-
"version": "1.2.2",
|
|
4
|
-
"description": "Gitee team components",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"prepare": "husky install && pnpm build",
|
|
9
|
-
"build": "rm -rf dist && tsc && cp -r src/icons/svg dist/icons/svg",
|
|
10
|
-
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
-
"prepack": "pnpm build",
|
|
12
|
-
"prepublish": "pnpm build",
|
|
13
|
-
"prepublishOnly": "pnpm build",
|
|
14
|
-
"lint": "eslint . --ext ts --ext tsx --ext js --ext json",
|
|
15
|
-
"pre-commit": "lint-staged",
|
|
16
|
-
"husky": "husky"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist"
|
|
20
|
-
],
|
|
21
|
-
"lint-staged": {
|
|
22
|
-
"*.@(js|ts|tsx|json)": [
|
|
23
|
-
"prettier --write",
|
|
24
|
-
"pnpm lint --fix --quiet"
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"publishConfig": {
|
|
28
|
-
"conventionalCommits": true,
|
|
29
|
-
"access": "public",
|
|
30
|
-
"registry": "https://registry.npmjs.org/"
|
|
31
|
-
},
|
|
32
|
-
"sideEffects": false,
|
|
33
|
-
"author": "",
|
|
34
|
-
"license": "ISC",
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@types/node": "18",
|
|
37
|
-
"@types/react": "18.2.23",
|
|
38
|
-
"@types/react-dom": "^18.2.14",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
40
|
-
"@typescript-eslint/parser": "^6.4.1",
|
|
41
|
-
"eslint": "^8.55.0",
|
|
42
|
-
"eslint-config-prettier": "^9.0.0",
|
|
43
|
-
"eslint-plugin-import": "^2.28.1",
|
|
44
|
-
"eslint-plugin-prettier": "^5.0.0",
|
|
45
|
-
"eslint-plugin-react": "^7.33.2",
|
|
46
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
47
|
-
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
48
|
-
"husky": "^8.0.3",
|
|
49
|
-
"lint-staged": "^15.2.0",
|
|
50
|
-
"prettier": "^3.0.3",
|
|
51
|
-
"typescript": "^5.2.2"
|
|
52
|
-
},
|
|
53
|
-
"peerDependencies": {
|
|
54
|
-
"@ant-design/icons": "^5.2.6",
|
|
55
|
-
"@giteeteam/proxima-sdk-js": "^0.7.1",
|
|
56
|
-
"antd": "^5.7.3",
|
|
57
|
-
"dayjs": "^1.11.10",
|
|
58
|
-
"react": "^17.0.2 || ^18.2.0",
|
|
59
|
-
"react-dom": "^17.0.2 || ^18.2.0",
|
|
60
|
-
"recoil": "^0.7.7",
|
|
61
|
-
"swr": "^1.1.0"
|
|
62
|
-
},
|
|
63
|
-
"dependencies": {
|
|
64
|
-
"@emotion/cache": "^11.11.0",
|
|
65
|
-
"@emotion/react": "^11.11.1",
|
|
66
|
-
"debug": "^4.3.4",
|
|
67
|
-
"lodash-es": "^4.17.21"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@giteeteam/apps-team-components",
|
|
3
|
+
"version": "1.2.3-alpha.2",
|
|
4
|
+
"description": "Gitee team components",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"prepare": "husky install && pnpm build",
|
|
9
|
+
"build": "rm -rf dist && tsc && cp -r src/icons/svg dist/icons/svg",
|
|
10
|
+
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
+
"prepack": "pnpm build",
|
|
12
|
+
"prepublish": "pnpm build",
|
|
13
|
+
"prepublishOnly": "pnpm build",
|
|
14
|
+
"lint": "eslint . --ext ts --ext tsx --ext js --ext json",
|
|
15
|
+
"pre-commit": "lint-staged",
|
|
16
|
+
"husky": "husky"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"lint-staged": {
|
|
22
|
+
"*.@(js|ts|tsx|json)": [
|
|
23
|
+
"prettier --write",
|
|
24
|
+
"pnpm lint --fix --quiet"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"conventionalCommits": true,
|
|
29
|
+
"access": "public",
|
|
30
|
+
"registry": "https://registry.npmjs.org/"
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"author": "",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "18",
|
|
37
|
+
"@types/react": "18.2.23",
|
|
38
|
+
"@types/react-dom": "^18.2.14",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
40
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
41
|
+
"eslint": "^8.55.0",
|
|
42
|
+
"eslint-config-prettier": "^9.0.0",
|
|
43
|
+
"eslint-plugin-import": "^2.28.1",
|
|
44
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
45
|
+
"eslint-plugin-react": "^7.33.2",
|
|
46
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
47
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
48
|
+
"husky": "^8.0.3",
|
|
49
|
+
"lint-staged": "^15.2.0",
|
|
50
|
+
"prettier": "^3.0.3",
|
|
51
|
+
"typescript": "^5.2.2"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@ant-design/icons": "^5.2.6",
|
|
55
|
+
"@giteeteam/proxima-sdk-js": "^0.7.1",
|
|
56
|
+
"antd": "^5.7.3",
|
|
57
|
+
"dayjs": "^1.11.10",
|
|
58
|
+
"react": "^17.0.2 || ^18.2.0",
|
|
59
|
+
"react-dom": "^17.0.2 || ^18.2.0",
|
|
60
|
+
"recoil": "^0.7.7",
|
|
61
|
+
"swr": "^1.1.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@emotion/cache": "^11.11.0",
|
|
65
|
+
"@emotion/react": "^11.11.1",
|
|
66
|
+
"debug": "^4.3.4",
|
|
67
|
+
"lodash-es": "^4.17.21"
|
|
68
|
+
}
|
|
69
|
+
}
|