@whitesev/pops 2.0.9 → 2.0.10

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.
@@ -233,40 +233,66 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
233
233
  value: "select-1",
234
234
  text: "单选1",
235
235
  isHTML: false,
236
- disable() {
237
- return false;
236
+ disable(value, allSelectedInfo) {
237
+ return (
238
+ allSelectedInfo.findIndex((it) =>
239
+ ["select-5"].includes(it.value)
240
+ ) !== -1
241
+ );
238
242
  },
239
243
  },
240
244
  {
241
245
  value: "select-2",
242
246
  text: "单选2",
243
247
  isHTML: false,
244
- disable() {
245
- return false;
248
+ disable(value, allSelectedInfo) {
249
+ return (
250
+ allSelectedInfo.findIndex((it) =>
251
+ ["select-5"].includes(it.value)
252
+ ) !== -1
253
+ );
246
254
  },
247
255
  },
248
256
  {
249
257
  value: "select-3",
250
258
  text: "单选3",
251
259
  isHTML: false,
252
- disable() {
253
- return false;
260
+ disable(value, allSelectedInfo) {
261
+ return (
262
+ allSelectedInfo.findIndex((it) =>
263
+ ["select-2", "select-5"].includes(it.value)
264
+ ) !== -1
265
+ );
254
266
  },
255
267
  },
256
268
  {
257
269
  value: "select-4",
258
270
  text: "单选4",
259
271
  isHTML: false,
260
- disable() {
261
- return false;
272
+ disable(value, allSelectedInfo) {
273
+ return (
274
+ allSelectedInfo.findIndex((it) =>
275
+ ["select-3", "select-5"].includes(it.value)
276
+ ) !== -1
277
+ );
262
278
  },
263
279
  },
264
280
  {
265
281
  value: "select-5",
266
- text: "单选5",
282
+ text(value, allSelectedInfo) {
283
+ return allSelectedInfo.findIndex((it) =>
284
+ ["select-4"].includes(it.value)
285
+ ) !== -1
286
+ ? "单选5-禁用"
287
+ : "单选5";
288
+ },
267
289
  isHTML: false,
268
- disable() {
269
- return false;
290
+ disable(value, allSelectedInfo) {
291
+ return (
292
+ allSelectedInfo.findIndex((it) =>
293
+ ["select-4"].includes(it.value)
294
+ ) !== -1
295
+ );
270
296
  },
271
297
  },
272
298
  ],
@@ -9,9 +9,17 @@ export interface PopsPanelSelectMultipleDataOption<T> {
9
9
  /**
10
10
  * 显示的文字
11
11
  */
12
- text: string;
12
+ text:
13
+ | string
14
+ | ((
15
+ /** 当前的值 */
16
+ value: T,
17
+ /** 所有选中的配置信息 */
18
+ allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
19
+ ) => string);
13
20
  /**
14
21
  * 显示的文字是否是html
22
+ * @default false
15
23
  */
16
24
  isHTML?: boolean;
17
25
  /**
@@ -19,8 +27,13 @@ export interface PopsPanelSelectMultipleDataOption<T> {
19
27
  * 触发条件:
20
28
  * + 点击select元素
21
29
  * + select元素触发change事件
30
+ * @param value 当前的值
31
+ * @param allSelectedInfo 所有选中的配置信息
22
32
  */
23
- disable?(value: T): boolean;
33
+ disable?(
34
+ value: T,
35
+ allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
36
+ ): boolean;
24
37
  }
25
38
  /**
26
39
  * pops.panel的 select
@@ -79,12 +92,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
79
92
  */
80
93
  callback?(
81
94
  /** 当前已选中的信息 */
82
- isSelectedInfo: {
83
- /** 值 */
84
- value: T;
85
- /** 显示的文字 */
86
- text: string;
87
- }[]
95
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
88
96
  ): void;
89
97
  /**
90
98
  * 点击某个项的元素触发该回调
@@ -95,12 +103,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
95
103
  clickCallBack?(
96
104
  event: PointerEvent | MouseEvent,
97
105
  /** 当前已选中的信息 */
98
- isSelectedInfo: {
99
- /** 值 */
100
- value: T;
101
- /** 显示的文字 */
102
- text: string;
103
- }[]
106
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
104
107
  ): void | boolean;
105
108
  /**
106
109
  * 点击标签tag的关闭图标触发该回调
@@ -116,7 +119,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
116
119
  /** 值 */
117
120
  value: T;
118
121
  /** 显示的文字 */
119
- text: string;
122
+ text: PopsPanelSelectMultipleDataOption<T>["text"];
120
123
  }
121
124
  ) => void | boolean;
122
125
  /**