@aloudata/aloudata-design 1.10.10 → 1.10.11
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/ConfigProvider/getUserList.d.ts +3 -1
- package/dist/MemberPicker/index.js +4 -4
- package/dist/MemberPicker/interface.d.ts +5 -2
- package/dist/MemberPicker/utils/getUsersWithUserId.js +2 -2
- package/dist/_utils/type.d.ts +3 -0
- package/dist/_utils/type.js +3 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { TUserGroupValue, TUserValue } from '../MemberPicker/interface';
|
|
2
3
|
export declare enum EUserType {
|
|
3
4
|
USER = "USER",
|
|
4
5
|
USER_GROUP = "USER_GROUP"
|
|
@@ -24,7 +25,8 @@ export interface IGetUserListParams {
|
|
|
24
25
|
name?: string;
|
|
25
26
|
id?: string;
|
|
26
27
|
}
|
|
27
|
-
export type
|
|
28
|
+
export type { TUserValue, TUserGroupValue };
|
|
29
|
+
export type getUsersByIdsType = ((params: Array<TUserValue | TUserGroupValue>) => Promise<TUser>) | undefined;
|
|
28
30
|
export type getUsersByKeywordsType = ((params: string) => Promise<TUser>) | undefined;
|
|
29
31
|
export type getUserListType = {
|
|
30
32
|
getUsersByIds?: getUsersByIdsType;
|
|
@@ -121,18 +121,18 @@ var Component = function Component(_ref) {
|
|
|
121
121
|
} else if (isUser(value) || isUserGroup(value)) {
|
|
122
122
|
setSelectedUserList([value]);
|
|
123
123
|
} else {
|
|
124
|
-
var
|
|
124
|
+
var param = [];
|
|
125
125
|
if (!value) return;
|
|
126
126
|
if (Array.isArray(value) && value.length === 0) {
|
|
127
127
|
setSelectedUserList([]);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
if (!Array.isArray(value)) {
|
|
131
|
-
|
|
131
|
+
param = [value];
|
|
132
132
|
} else {
|
|
133
|
-
|
|
133
|
+
param = value;
|
|
134
134
|
}
|
|
135
|
-
queryByIds(
|
|
135
|
+
queryByIds(param).then(function (result) {
|
|
136
136
|
setSelectedUserList(result);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { IUser, IUserGroup, TUser } from '../ConfigProvider/getUserList';
|
|
2
2
|
import { ISelectProps } from '../Select';
|
|
3
|
-
|
|
3
|
+
import { RequiredProperties } from '../_utils/type';
|
|
4
|
+
export type TUserValue = RequiredProperties<IUser, 'type' | 'userId'>;
|
|
5
|
+
export type TUserGroupValue = RequiredProperties<IUserGroup, 'type' | 'groupId'>;
|
|
6
|
+
export type TMemberPickerValue = TUserValue | TUserGroupValue | Array<TUserValue | TUserGroupValue>;
|
|
4
7
|
export declare enum EMemberPicker {
|
|
5
8
|
GROUP = "GROUP",
|
|
6
9
|
USER = "USER",
|
|
7
10
|
BOTH = "BOTH"
|
|
8
11
|
}
|
|
9
12
|
export interface IBaseMemberSelectorProps extends Pick<ISelectProps, 'allowClear' | 'disabled' | 'prefix' | 'placeholder' | 'className' | 'size' | 'onClear' | 'prefixWidth'> {
|
|
10
|
-
value?:
|
|
13
|
+
value?: TMemberPickerValue;
|
|
11
14
|
dropdownWidth?: number;
|
|
12
15
|
open?: boolean;
|
|
13
16
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
3
3
|
export function isUser(value) {
|
|
4
|
-
return value && _typeof(value) === 'object' && value.type === EUserType.USER;
|
|
4
|
+
return value && _typeof(value) === 'object' && value.type === EUserType.USER && (value.nickname || value.name);
|
|
5
5
|
}
|
|
6
6
|
export function isUserGroup(value) {
|
|
7
|
-
return value && _typeof(value) === 'object' && value.type === EUserType.USER_GROUP;
|
|
7
|
+
return value && _typeof(value) === 'object' && value.type === EUserType.USER_GROUP && value.name;
|
|
8
8
|
}
|
|
9
9
|
function getUsersWithUserId(obj) {
|
|
10
10
|
var users = [];
|
package/dist/_utils/type.d.ts
CHANGED
|
@@ -7,3 +7,6 @@ export declare const tupleNum: <T extends number[]>(...args: T) => T;
|
|
|
7
7
|
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;
|
|
8
8
|
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
|
9
9
|
export type LiteralUnion<T extends U, U> = T | (U & object);
|
|
10
|
+
export type RequiredProperties<T, K extends keyof T> = {
|
|
11
|
+
[P in K]-?: T[P];
|
|
12
|
+
} & Partial<T>;
|
package/dist/_utils/type.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export type { IInputNumberProps as InputNumberProps } from './InputNumber';
|
|
|
45
45
|
export { default as Layout } from './Layout';
|
|
46
46
|
export type { LayoutProps } from './Layout';
|
|
47
47
|
export { default as MemberPicker } from './MemberPicker';
|
|
48
|
-
export type { IUser, IMemberPickerProps as MemberPickerProps, MemberPickerValue, } from './MemberPicker/interface';
|
|
48
|
+
export type { IUser, IMemberPickerProps as MemberPickerProps, TMemberPickerValue as MemberPickerValue, } from './MemberPicker/interface';
|
|
49
49
|
export { default as Menu } from './Menu';
|
|
50
50
|
export type { ItemType, IMenuProps as MenuProps } from './Menu';
|
|
51
51
|
export { default as Modal } from './Modal';
|