@douyinfe/semi-ui 2.19.0-alpha.1 → 2.19.0-alpha.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/checkbox/checkboxGroup.tsx +9 -2
- package/dist/umd/semi-ui.js +49 -7
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/checkbox/checkboxGroup.js +27 -6
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/radio/radioGroup.js +30 -5
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/checkbox/checkboxGroup.js +23 -4
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/radio/radioGroup.js +26 -3
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +7 -7
- package/radio/radioGroup.tsx +13 -4
|
@@ -6,7 +6,7 @@ import { checkboxGroupClasses as css, strings } from '@douyinfe/semi-foundation/
|
|
|
6
6
|
import CheckboxGroupFoundation, { CheckboxGroupAdapter } from '@douyinfe/semi-foundation/checkbox/checkboxGroupFoundation';
|
|
7
7
|
import BaseComponent from '../_base/baseComponent';
|
|
8
8
|
import { Context } from './context';
|
|
9
|
-
import { isEqual } from 'lodash';
|
|
9
|
+
import { get, isEqual } from 'lodash';
|
|
10
10
|
import Checkbox, { CheckboxEvent } from './checkbox';
|
|
11
11
|
|
|
12
12
|
export type CheckboxDirection = 'horizontal' | 'vertical';
|
|
@@ -161,7 +161,14 @@ class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGroupState
|
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
} else if (children) {
|
|
164
|
-
inner = (React.Children.toArray(children) as React.ReactElement[]).map((itm, index) =>
|
|
164
|
+
inner = (React.Children.toArray(children) as React.ReactElement[]).map((itm, index) => {
|
|
165
|
+
const props: Record<string, any> = { key: index, role: 'listitem' };
|
|
166
|
+
const isCheckboxComp = ['Checkbox', 'CheckboxWithGroup'].some(comp => [get(itm, 'type.displayName'), get(itm, 'type.name')].includes(comp));
|
|
167
|
+
if (isCheckboxComp) {
|
|
168
|
+
props.type = type;
|
|
169
|
+
}
|
|
170
|
+
return React.cloneElement(itm, props);
|
|
171
|
+
});
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
return (
|
package/dist/umd/semi-ui.js
CHANGED
|
@@ -49240,6 +49240,9 @@ class checkboxGroupFoundation_CheckboxGroupFoundation extends foundation {
|
|
|
49240
49240
|
|
|
49241
49241
|
|
|
49242
49242
|
|
|
49243
|
+
|
|
49244
|
+
|
|
49245
|
+
|
|
49243
49246
|
/* eslint-disable max-len */
|
|
49244
49247
|
|
|
49245
49248
|
|
|
@@ -49352,10 +49355,26 @@ class checkboxGroup_CheckboxGroup extends baseComponent_BaseComponent {
|
|
|
49352
49355
|
} else if (children) {
|
|
49353
49356
|
var _context6;
|
|
49354
49357
|
|
|
49355
|
-
inner = map_default()(_context6 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(children)).call(_context6, (itm, index) =>
|
|
49356
|
-
|
|
49357
|
-
|
|
49358
|
-
|
|
49358
|
+
inner = map_default()(_context6 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(children)).call(_context6, (itm, index) => {
|
|
49359
|
+
var _context7;
|
|
49360
|
+
|
|
49361
|
+
const props = {
|
|
49362
|
+
key: index,
|
|
49363
|
+
role: 'listitem'
|
|
49364
|
+
};
|
|
49365
|
+
|
|
49366
|
+
const isCheckboxComp = some_default()(_context7 = ['Checkbox', 'CheckboxWithGroup']).call(_context7, comp => {
|
|
49367
|
+
var _context8;
|
|
49368
|
+
|
|
49369
|
+
return includes_default()(_context8 = [get_default()(itm, 'type.displayName'), get_default()(itm, 'type.name')]).call(_context8, comp);
|
|
49370
|
+
});
|
|
49371
|
+
|
|
49372
|
+
if (isCheckboxComp) {
|
|
49373
|
+
props.type = type;
|
|
49374
|
+
}
|
|
49375
|
+
|
|
49376
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(itm, props);
|
|
49377
|
+
});
|
|
49359
49378
|
}
|
|
49360
49379
|
|
|
49361
49380
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
@@ -84246,6 +84265,9 @@ radio_Radio.defaultProps = {
|
|
|
84246
84265
|
|
|
84247
84266
|
|
|
84248
84267
|
|
|
84268
|
+
|
|
84269
|
+
|
|
84270
|
+
|
|
84249
84271
|
class radioGroup_RadioGroup extends baseComponent_BaseComponent {
|
|
84250
84272
|
constructor(props) {
|
|
84251
84273
|
super(props);
|
|
@@ -84354,9 +84376,29 @@ class radioGroup_RadioGroup extends baseComponent_BaseComponent {
|
|
|
84354
84376
|
} else if (children) {
|
|
84355
84377
|
var _context5;
|
|
84356
84378
|
|
|
84357
|
-
inner = map_default()(_context5 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children).call(_context5, children, (itm, index) =>
|
|
84358
|
-
|
|
84359
|
-
|
|
84379
|
+
inner = map_default()(_context5 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children).call(_context5, children, (itm, index) => {
|
|
84380
|
+
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.isValidElement(itm)) {
|
|
84381
|
+
var _context6;
|
|
84382
|
+
|
|
84383
|
+
const props = {
|
|
84384
|
+
key: index
|
|
84385
|
+
};
|
|
84386
|
+
|
|
84387
|
+
const isRadioComp = some_default()(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
|
|
84388
|
+
var _context7;
|
|
84389
|
+
|
|
84390
|
+
return includes_default()(_context7 = [get_default()(itm, 'type.displayName'), get_default()(itm, 'type.name')]).call(_context7, comp);
|
|
84391
|
+
});
|
|
84392
|
+
|
|
84393
|
+
if (isRadioComp) {
|
|
84394
|
+
props.type = type;
|
|
84395
|
+
}
|
|
84396
|
+
|
|
84397
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(itm, props);
|
|
84398
|
+
} else {
|
|
84399
|
+
return null;
|
|
84400
|
+
}
|
|
84401
|
+
});
|
|
84360
84402
|
}
|
|
84361
84403
|
|
|
84362
84404
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|