@giteeteam/apps-team-components 1.1.4 → 1.1.6

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.
@@ -1 +1,8 @@
1
- export declare const formatUserOption: (actorData: any) => any;
1
+ import type { ObjectId, User as UserTyped } from '../../../lib/types/models';
2
+ type UserOption = {
3
+ label: string;
4
+ value: ObjectId;
5
+ key: string;
6
+ };
7
+ export declare const formatUserOption: (actorData: UserTyped) => UserOption;
8
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { userOptionAdapter } from '../../../lib/users';
2
- export const formatUserOption = actorData => {
2
+ export const formatUserOption = (actorData) => {
3
3
  const isUserData = !!(actorData === null || actorData === void 0 ? void 0 : actorData.username) && (actorData === null || actorData === void 0 ? void 0 : actorData.enabled);
4
4
  if (isUserData)
5
5
  return userOptionAdapter(actorData);
@@ -17,7 +17,8 @@ const DataQuoteReadView = ({ value, userData }) => {
17
17
  }
18
18
  }, [dataQuoteList, userData === null || userData === void 0 ? void 0 : userData.display, value, currentDeleteItem]);
19
19
  const cellDisplay = (dataList === null || dataList === void 0 ? void 0 : dataList.length) ? (dataList.map((item, index) => (_jsxs("span", { children: [item.label, " ", index === dataList.length - 1 ? '' : '、'] }, item.value)))) : (_jsx(EmptyField, { readonly: true }));
20
- return (_jsx("div", { css: css(fieldValueOverlayStyle), children: _jsx(BaseOverflowTooltip, { maxline: 1, children: cellDisplay }) }));
20
+ const showValue = (dataList === null || dataList === void 0 ? void 0 : dataList.length) ? dataList.map(item => item.label).join('、') : '';
21
+ return (_jsx("div", { css: css(fieldValueOverlayStyle), children: _jsx(BaseOverflowTooltip, { title: showValue, maxline: 1, children: cellDisplay }) }));
21
22
  };
22
23
  DataQuoteReadView.displayName = 'DataQuoteReadView';
23
24
  export default DataQuoteReadView;
@@ -1,3 +1,5 @@
1
1
  import { Item } from '../../../lib/types/models';
2
2
  import { selectValue as selectValueProps } from '../dropdown/BaseField';
3
+ export declare const DATA_QUOTE_OPTION_FORMAT_REG: RegExp;
4
+ export declare const dataQuoteOptionFormat: (data: Item, display?: string) => selectValueProps;
3
5
  export declare const dataQuoteInit: (dates: Item[], value: string[], display?: string) => selectValueProps[];
@@ -1,26 +1,30 @@
1
+ export const DATA_QUOTE_OPTION_FORMAT_REG = /{(\S+?)}/g;
2
+ export const dataQuoteOptionFormat = (data, display) => {
3
+ var _a, _b, _c;
4
+ if (!data)
5
+ return undefined;
6
+ const dataCopy = {
7
+ ...data,
8
+ status: (_a = data.status) === null || _a === void 0 ? void 0 : _a.name,
9
+ itemType: (_b = data.itemType) === null || _b === void 0 ? void 0 : _b.name,
10
+ };
11
+ return {
12
+ label: display
13
+ ? display.replace(DATA_QUOTE_OPTION_FORMAT_REG, function (itemKey) {
14
+ const key = itemKey.slice(1, itemKey.length - 1);
15
+ return dataCopy[key] || (data.values && data.values[key]) || '';
16
+ })
17
+ : data.name,
18
+ value: data.objectId,
19
+ name: data.name,
20
+ key: data.key,
21
+ itemType: data.itemType,
22
+ icon: (_c = data === null || data === void 0 ? void 0 : data.itemType) === null || _c === void 0 ? void 0 : _c.icon,
23
+ values: data.values,
24
+ };
25
+ };
1
26
  export const dataQuoteInit = (dates, value, display) => {
2
- const regex = /({\S+?})/g;
3
- const existedDatas = dates === null || dates === void 0 ? void 0 : dates.filter(data => value === null || value === void 0 ? void 0 : value.includes(data.objectId));
4
- const dataInit = existedDatas === null || existedDatas === void 0 ? void 0 : existedDatas.map(existedData => {
5
- var _a, _b, _c;
6
- const dataCopy = {
7
- ...existedData,
8
- status: (_a = existedData.status) === null || _a === void 0 ? void 0 : _a.name,
9
- itemType: (_b = existedData.itemType) === null || _b === void 0 ? void 0 : _b.name,
10
- };
11
- const values = existedData.values || {};
12
- return {
13
- label: display
14
- ? display.replace(regex, function (itemKey) {
15
- const key = itemKey.slice(1, itemKey.length - 1);
16
- return dataCopy[key] || values[key] || '';
17
- })
18
- : existedData.name,
19
- value: existedData.objectId,
20
- itemType: existedData.itemType,
21
- icon: (_c = existedData === null || existedData === void 0 ? void 0 : existedData.itemType) === null || _c === void 0 ? void 0 : _c.icon,
22
- values: existedData.values,
23
- };
24
- });
27
+ const existedDataList = dates === null || dates === void 0 ? void 0 : dates.filter(data => value === null || value === void 0 ? void 0 : value.includes(data.objectId));
28
+ const dataInit = existedDataList === null || existedDataList === void 0 ? void 0 : existedDataList.map(existedData => dataQuoteOptionFormat(existedData, display));
25
29
  return dataInit;
26
30
  };
@@ -2,5 +2,6 @@
2
2
  export interface selectValue {
3
3
  label: React.ReactNode;
4
4
  value: string | number;
5
+ [key: string]: any;
5
6
  }
6
7
  export declare const handleValue: (value: selectValue | string | number) => string | number;
@@ -31,9 +31,13 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
31
31
  const [fetching, setFetching] = useState(true);
32
32
  const [approval, setApproval] = useState(cloneDeep(DEFAULT_APPROVAL_DATA));
33
33
  const [checkIn, setCheckIn] = useState(cloneDeep(DEFAULT_CHECK_IN_DATA));
34
+ const newItem = useRef(itemId);
34
35
  useEffect(() => {
35
36
  setStatusId(objectId);
36
- }, [objectId]);
37
+ return () => {
38
+ newItem.current = itemId;
39
+ };
40
+ }, [itemId, objectId]);
37
41
  const { checkTransitionScript, getWorkflowData, getItemStatus, runTransition } = useWorkflowConfig();
38
42
  const { currentUser } = useCurrentUser();
39
43
  const [groupIds, roleIds, workspaceRoleIds] = useWorkflowPermission((_a = itemData === null || itemData === void 0 ? void 0 : itemData.workspace) === null || _a === void 0 ? void 0 : _a.objectId);
@@ -95,14 +99,17 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
95
99
  logger('updateWorkflowMessage', statusId);
96
100
  updateWorkflowMessage(workflowData, statusId);
97
101
  }, [statusId]);
98
- const refreshItem = (status) => {
102
+ const refreshItem = useCallback((status) => {
103
+ if (newItem.current !== itemId) {
104
+ return;
105
+ }
99
106
  setStatusId(status.objectId);
100
107
  onTransitionSuccess === null || onTransitionSuccess === void 0 ? void 0 : onTransitionSuccess(status);
101
108
  itemMutate();
102
109
  proximaSdk.execute('updateStatusLog');
103
110
  proximaSdk.execute('updateApprovalInfo', status.objectId);
104
111
  proximaSdk.execute('updateCheckInInfo', status.objectId);
105
- };
112
+ }, [itemId, itemMutate, onTransitionSuccess]);
106
113
  const submitHandle = useCallback(async (transitionText, itemDetail = null) => {
107
114
  const params = {
108
115
  workflowId: workflowData.objectId,
@@ -14,7 +14,7 @@ const UserReadView = memo(({ value, readonly }) => {
14
14
  })) || EMPTY_ARRAY);
15
15
  }, [value]);
16
16
  const tooltipValues = useMemo(() => {
17
- return value === null || value === void 0 ? void 0 : value.map((val) => {
17
+ return value === null || value === void 0 ? void 0 : value.map(val => {
18
18
  const item = userDataFormat(val);
19
19
  return generateUserDisplayName(item);
20
20
  });
@@ -22,7 +22,7 @@ const UserReadView = memo(({ value, readonly }) => {
22
22
  if (!displayValues.length) {
23
23
  return _jsx(EmptyField, { readonly: readonly, isUser: true });
24
24
  }
25
- return _jsx(BaseOverflowTooltip, { title: tooltipValues.join(','), maxline: 1, children: displayValues });
25
+ return (_jsx(BaseOverflowTooltip, { title: tooltipValues.join(','), maxline: 1, children: displayValues }));
26
26
  });
27
27
  UserReadView.displayName = 'UserReadView';
28
28
  export default UserReadView;
@@ -6,5 +6,5 @@ export declare const arrayDiff: (origin: Array<any>, target: Array<any>) => IDif
6
6
  export declare const serializationArrayByKey: (list: any[], keyPath: string) => Record<string, any> | null;
7
7
  export declare const createHash: () => number;
8
8
  export declare function parseArray(str: string): string[];
9
- export declare const getArrayValue: (value: any) => any[];
9
+ export declare const getArrayValue: <T = any>(value: T) => T[];
10
10
  export {};
package/dist/lib/array.js CHANGED
@@ -41,4 +41,4 @@ export function parseArray(str) {
41
41
  }
42
42
  return [];
43
43
  }
44
- export const getArrayValue = (value) => { var _a; return (_a = (isArray(value) ? value : [value])) === null || _a === void 0 ? void 0 : _a.filter(Boolean); };
44
+ export const getArrayValue = (value) => { var _a; return (_a = ((isArray(value) ? value : [value]))) === null || _a === void 0 ? void 0 : _a.filter(Boolean); };
@@ -1,4 +1,3 @@
1
- declare const useI18n: () => {
2
- t: (key: string, opts?: Record<string, any>) => string;
3
- };
1
+ import { i18n } from '../i18n';
2
+ declare const useI18n: () => Pick<typeof i18n, 't'>;
4
3
  export default useI18n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",