@lark-apaas/client-toolkit 1.1.13-userprofile-test.1 → 1.1.13-userprofile-test.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.
@@ -6,7 +6,7 @@ export interface UserSelectProps {
6
6
  * 或仅传入用户 ID(string)/ 列表(string[])。
7
7
  */
8
8
  value?: IUserProfile | IUserProfile[] | string | string[];
9
- onChange?: (value: IUserProfile | IUserProfile[] | string | string[]) => void;
9
+ onChange?: (value: IUserProfile | IUserProfile[] | undefined) => void;
10
10
  defaultValue?: IUserProfile | IUserProfile[] | string | string[];
11
11
  mode?: 'single' | 'multiple';
12
12
  placeholder?: string;
@@ -159,14 +159,14 @@ const UserSelect = ({ mode = 'single', defaultValue, value, onChange, placeholde
159
159
  value: uiValue,
160
160
  onChange: (next)=>{
161
161
  if (!onChange) return;
162
- const nextArray = Array.isArray(next) ? next : next ? [
163
- next
164
- ] : [];
165
- const isIdInput = 'string' == typeof (value ?? defaultValue) || Array.isArray(value ?? defaultValue) && 'string' == typeof (value ?? defaultValue)?.[0];
166
- if ('multiple' === selectMode) onChange(isIdInput ? nextArray.map((u)=>u.user_id) : nextArray);
167
- else {
168
- const single = nextArray[0];
169
- onChange(isIdInput ? single ? single.user_id : '' : single ?? void 0);
162
+ if ('multiple' === selectMode) {
163
+ const arr = Array.isArray(next) ? next ?? [] : next ? [
164
+ next
165
+ ] : [];
166
+ onChange(arr);
167
+ } else {
168
+ const single = Array.isArray(next) ? next[0] ?? void 0 : next ?? void 0;
169
+ onChange(single);
170
170
  }
171
171
  }
172
172
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.1.13-userprofile-test.1",
3
+ "version": "1.1.13-userprofile-test.2",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [