@giteeteam/apps-team-components 1.1.5 → 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.
- package/dist/components/fields/actors/BaseField.d.ts +8 -1
- package/dist/components/fields/actors/BaseField.js +1 -1
- package/dist/components/fields/data-quote/ReadView.js +2 -1
- package/dist/components/fields/data-quote/utils.d.ts +2 -0
- package/dist/components/fields/data-quote/utils.js +27 -23
- package/dist/components/fields/dropdown/BaseField.d.ts +1 -0
- package/dist/components/fields/user/ReadView.js +2 -2
- package/dist/lib/array.d.ts +1 -1
- package/dist/lib/array.js +1 -1
- package/dist/lib/hooks/useI18n.d.ts +2 -3
- package/package.json +1 -1
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
|
3
|
-
const
|
|
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
|
};
|
|
@@ -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(
|
|
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;
|
package/dist/lib/array.d.ts
CHANGED
|
@@ -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:
|
|
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); };
|