@alifd/chat 0.3.29-beta.0 → 0.3.29-beta.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.
package/es/index.js CHANGED
@@ -31,4 +31,4 @@ export { default as RadioGroup } from './radio-group';
31
31
  export { default as CheckboxGroup } from './checkbox-group';
32
32
  export { default as Select } from './select';
33
33
  export { default as Flip } from './flip';
34
- export const version = '0.3.29-beta.0';
34
+ export const version = '0.3.29-beta.2';
@@ -33,16 +33,25 @@ const Select = forwardRef((_a, ref) => {
33
33
  else if (typeof selected === 'object' && 'value' in selected && selected.value === value) {
34
34
  status = 'selected';
35
35
  }
36
+ //
37
+ let isDisabled = disabled;
38
+ // 单选模式下,已有选中项,并且不是选中的按钮
39
+ if (selected && mode === 'single' && status === 'normal') {
40
+ isDisabled = true;
41
+ }
36
42
  return (React.createElement(Button, { onClick: () => {
37
43
  if (mode === 'multiple') {
38
44
  if (Array.isArray(selected)) {
39
45
  onChange === null || onChange === void 0 ? void 0 : onChange(status === 'normal' ? [...selected, value] : selected.filter((v) => v !== value), 'itemClick');
40
46
  }
47
+ else {
48
+ onChange === null || onChange === void 0 ? void 0 : onChange([value], 'itemClick');
49
+ }
41
50
  }
42
51
  if (mode === 'single') {
43
52
  onChange === null || onChange === void 0 ? void 0 : onChange(status === 'normal' ? item : undefined, 'itemClick');
44
53
  }
45
- }, type: 'normal', key: `select_${index}`, disabled: disabled, className: `select-item ${status} row${buttonCols}` }, label));
54
+ }, type: 'normal', key: `select_${index}`, disabled: isDisabled, className: `select-item ${status} row${buttonCols}` }, label));
46
55
  });
47
56
  };
48
57
  const rows = Math.ceil(((dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0) / buttonCols);
@@ -1,5 +1,6 @@
1
- import type { SelectProps as FusionSelectProps } from '@alifd/next/types/select/types';
1
+ import type { SelectProps as FusionSelectProps, DataSourceItem } from '@alifd/next/types/select/types';
2
2
  export interface SelectProps extends FusionSelectProps {
3
3
  display: 'button' | 'select';
4
4
  buttonCols?: number;
5
5
  }
6
+ export type { DataSourceItem };
package/lib/index.js CHANGED
@@ -68,4 +68,4 @@ var select_1 = require("./select");
68
68
  Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return tslib_1.__importDefault(select_1).default; } });
69
69
  var flip_1 = require("./flip");
70
70
  Object.defineProperty(exports, "Flip", { enumerable: true, get: function () { return tslib_1.__importDefault(flip_1).default; } });
71
- exports.version = '0.3.29-beta.0';
71
+ exports.version = '0.3.29-beta.2';
@@ -35,16 +35,25 @@ const Select = (0, react_1.forwardRef)((_a, ref) => {
35
35
  else if (typeof selected === 'object' && 'value' in selected && selected.value === value) {
36
36
  status = 'selected';
37
37
  }
38
+ //
39
+ let isDisabled = disabled;
40
+ // 单选模式下,已有选中项,并且不是选中的按钮
41
+ if (selected && mode === 'single' && status === 'normal') {
42
+ isDisabled = true;
43
+ }
38
44
  return (react_1.default.createElement(next_1.Button, { onClick: () => {
39
45
  if (mode === 'multiple') {
40
46
  if (Array.isArray(selected)) {
41
47
  onChange === null || onChange === void 0 ? void 0 : onChange(status === 'normal' ? [...selected, value] : selected.filter((v) => v !== value), 'itemClick');
42
48
  }
49
+ else {
50
+ onChange === null || onChange === void 0 ? void 0 : onChange([value], 'itemClick');
51
+ }
43
52
  }
44
53
  if (mode === 'single') {
45
54
  onChange === null || onChange === void 0 ? void 0 : onChange(status === 'normal' ? item : undefined, 'itemClick');
46
55
  }
47
- }, type: 'normal', key: `select_${index}`, disabled: disabled, className: `select-item ${status} row${buttonCols}` }, label));
56
+ }, type: 'normal', key: `select_${index}`, disabled: isDisabled, className: `select-item ${status} row${buttonCols}` }, label));
48
57
  });
49
58
  };
50
59
  const rows = Math.ceil(((dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0) / buttonCols);
@@ -1,5 +1,6 @@
1
- import type { SelectProps as FusionSelectProps } from '@alifd/next/types/select/types';
1
+ import type { SelectProps as FusionSelectProps, DataSourceItem } from '@alifd/next/types/select/types';
2
2
  export interface SelectProps extends FusionSelectProps {
3
3
  display: 'button' | 'select';
4
4
  buttonCols?: number;
5
5
  }
6
+ export type { DataSourceItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.3.29-beta.0",
3
+ "version": "0.3.29-beta.2",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",