@hi-ui/table 4.10.0-alpha.0 → 4.11.0
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/CHANGELOG.md +20 -0
- package/lib/cjs/Table.js +3 -2
- package/lib/cjs/TableBody.js +4 -2
- package/lib/cjs/TableRow.js +1 -0
- package/lib/cjs/hooks/use-col-width.js +24 -22
- package/lib/cjs/use-table.js +11 -1
- package/lib/cjs/utils/index.js +11 -4
- package/lib/esm/Table.js +1 -1
- package/lib/esm/TableBody.js +4 -2
- package/lib/esm/TableRow.js +1 -0
- package/lib/esm/hooks/use-col-width.js +22 -20
- package/lib/esm/use-table.js +11 -1
- package/lib/esm/utils/index.js +11 -4
- package/lib/types/types.d.ts +5 -1
- package/lib/types/utils/index.d.ts +4 -1
- package/package.json +2 -1
- package/lib/cjs/packages/ui/radio/lib/esm/Radio.js +0 -100
- package/lib/cjs/packages/ui/radio/lib/esm/RadioGroup.js +0 -104
- package/lib/cjs/packages/ui/radio/lib/esm/context.js +0 -37
- package/lib/cjs/packages/ui/radio/lib/esm/index.js +0 -33
- package/lib/cjs/packages/ui/radio/lib/esm/styles/index.scss.js +0 -35
- package/lib/cjs/packages/ui/radio/lib/esm/types.js +0 -34
- package/lib/cjs/packages/ui/radio/lib/esm/use-radio-group.js +0 -61
- package/lib/cjs/packages/ui/radio/lib/esm/use-radio.js +0 -88
- package/lib/esm/packages/ui/radio/lib/esm/Radio.js +0 -88
- package/lib/esm/packages/ui/radio/lib/esm/RadioGroup.js +0 -92
- package/lib/esm/packages/ui/radio/lib/esm/context.js +0 -31
- package/lib/esm/packages/ui/radio/lib/esm/index.js +0 -26
- package/lib/esm/packages/ui/radio/lib/esm/styles/index.scss.js +0 -23
- package/lib/esm/packages/ui/radio/lib/esm/types.js +0 -27
- package/lib/esm/packages/ui/radio/lib/esm/use-radio-group.js +0 -56
- package/lib/esm/packages/ui/radio/lib/esm/use-radio.js +0 -83
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @LICENSE
|
|
2
|
-
* @hi-ui/table
|
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
import __styleInject__ from '@hi-ui/style-inject';
|
|
11
|
-
|
|
12
|
-
/** @LICENSE
|
|
13
|
-
* @hi-ui/radio
|
|
14
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
15
|
-
*
|
|
16
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/
|
|
21
|
-
var css_248z = ".hi-v4-radio {overflow-wrap: break-word;font-size: var(--hi-v4-text-size-md, 0.875rem);line-height: var(--hi-v4-text-lineheight-md, 1.375rem);position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: pointer;display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;vertical-align: middle;}.hi-v4-radio--type-button {height: 32px;padding: 0 12px;color: var(--hi-v4-color-gray-600, #5f6a7a);background: var(--hi-v4-color-gray-100, #f2f4f7);cursor: pointer;-webkit-transition: all var(--hi-v4-motion-duration-normal, 200ms);transition: all var(--hi-v4-motion-duration-normal, 200ms);}.hi-v4-radio--type-button .hi-v4-radio__input {display: none;}.hi-v4-radio--type-button .hi-v4-radio__input:focus + .hi-v4-radio__label {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-radio--type-button .hi-v4-radio__controller {display: none;}.hi-v4-radio--type-button:hover, .hi-v4-radio--type-button[data-checked] {background: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-radio--type-button[data-disabled] {cursor: not-allowed;background: var(--hi-v4-color-gray-200, #ebedf0);color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-radio--type-button[data-checked].hi-v4-radio--type-button[data-disabled] {background: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));color: var(--hi-v4-color-primary-300, var(--hi-v4-color-brandblue-300, #70b8ff));}.hi-v4-radio--type-default .hi-v4-radio__input:focus + .hi-v4-radio__controller {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));-webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));}.hi-v4-radio--type-default .hi-v4-radio__controller {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;width: 16px;height: 16px;border: 1px solid var(--hi-v4-color-gray-300, #dfe2e8);border-radius: var(--hi-v4-border-radius-full, 9999px);-webkit-transition: all var(--hi-v4-motion-duration-normal, 200ms);transition: all var(--hi-v4-motion-duration-normal, 200ms);-webkit-box-flex: 0;-ms-flex: none;flex: none;}.hi-v4-radio--type-default .hi-v4-radio__controller::after {position: absolute;top: 0;left: 0;-webkit-box-sizing: border-box;box-sizing: border-box;display: inline-block;width: 14px;height: 14px;content: \"\";background: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: var(--hi-v4-border-radius-full, 9999px);opacity: 0;-webkit-transition: all var(--hi-v4-motion-duration-normal, 200ms);transition: all var(--hi-v4-motion-duration-normal, 200ms);-webkit-transform: scale(0);transform: scale(0);}.hi-v4-radio--type-default .hi-v4-radio__label {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-margin-start: var(--hi-v4-spacing-4, 8px);margin-inline-start: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);}.hi-v4-radio--type-default:hover .hi-v4-radio__controller {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-radio--type-default[data-checked] .hi-v4-radio__controller {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-radio--type-default[data-checked] .hi-v4-radio__controller::after {opacity: 1;-webkit-transform: scale(0.3);transform: scale(0.3);background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-radio--type-default[data-checked].hi-v4-radio--type-default[data-disabled] .hi-v4-radio__controller {border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));opacity: 0.4;}.hi-v4-radio--type-default[data-checked].hi-v4-radio--type-default[data-disabled] .hi-v4-radio__controller::after {opacity: 1;-webkit-transform: scale(0.3);transform: scale(0.3);background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-radio--type-default[data-disabled] {cursor: not-allowed;}.hi-v4-radio--type-default[data-disabled] .hi-v4-radio__controller {border-color: var(--hi-v4-color-gray-300, #dfe2e8);background: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-radio--type-default[data-disabled] .hi-v4-radio__controller::after {background: var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-radio--type-default[data-disabled] .hi-v4-radio__label {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-radio-group {position: relative;}.hi-v4-radio-group--data-wrap {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;z-index: var(--hi-v4-zindex-normal, 0);}.hi-v4-radio-group--type-button {border-radius: var(--hi-v4-border-radius-md, 4px);overflow: hidden;}.hi-v4-radio-group--type-default.hi-v4-radio-group--data-wrap {gap: var(--hi-v4-spacing-8, 16px);}.hi-v4-radio-group--placement-horizontal.hi-v4-radio-group--data-wrap {-webkit-box-align: center;-ms-flex-align: center;align-items: center;}.hi-v4-radio-group--placement-horizontal.hi-v4-radio-group--auto-width {display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v4-radio-group--placement-horizontal.hi-v4-radio-group--auto-width .hi-v4-radio--type-button {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-radio-group--placement-horizontal .hi-v4-radio--type-button::after {content: \"\";background: var(--hi-v4-color-gray-300, #dfe2e8);width: 1px;left: 100%;top: 8px;bottom: 8px;position: absolute;z-index: var(--hi-v4-zindex-absolute, 1);}.hi-v4-radio-group--placement-vertical {-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;}.hi-v4-radio-group--placement-vertical .hi-v4-radio--type-button::after {content: \"\";background: var(--hi-v4-color-gray-300, #dfe2e8);height: 1px;left: 8px;right: 8px;top: 100%;position: absolute;z-index: var(--hi-v4-zindex-absolute, 1);}";
|
|
22
|
-
__styleInject__(css_248z);
|
|
23
|
-
export { css_248z as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @LICENSE
|
|
2
|
-
* @hi-ui/table
|
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
/** @LICENSE
|
|
11
|
-
* @hi-ui/radio
|
|
12
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/
|
|
19
|
-
var RadioGroupPlacementEnum = {
|
|
20
|
-
VERTICAL: 'vertical',
|
|
21
|
-
HORIZONTAL: 'horizontal'
|
|
22
|
-
};
|
|
23
|
-
var RadioGroupTypeEnum = {
|
|
24
|
-
DEFAULT: 'default',
|
|
25
|
-
BUTTON: 'button'
|
|
26
|
-
};
|
|
27
|
-
export { RadioGroupPlacementEnum, RadioGroupTypeEnum };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/** @LICENSE
|
|
2
|
-
* @hi-ui/table
|
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
import { __rest } from 'tslib';
|
|
11
|
-
import { useCallback } from 'react';
|
|
12
|
-
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
|
13
|
-
|
|
14
|
-
/** @LICENSE
|
|
15
|
-
* @hi-ui/radio
|
|
16
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/
|
|
23
|
-
var useRadioGroup = function useRadioGroup(_a) {
|
|
24
|
-
var name = _a.name,
|
|
25
|
-
valueProp = _a.value,
|
|
26
|
-
onChange = _a.onChange,
|
|
27
|
-
_a$defaultValue = _a.defaultValue,
|
|
28
|
-
defaultValue = _a$defaultValue === void 0 ? '' : _a$defaultValue,
|
|
29
|
-
_a$disabled = _a.disabled,
|
|
30
|
-
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
|
31
|
-
rest = __rest(_a, ["name", "value", "onChange", "defaultValue", "disabled"]);
|
|
32
|
-
var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange),
|
|
33
|
-
value = _useUncontrolledState[0],
|
|
34
|
-
tryChangeValue = _useUncontrolledState[1];
|
|
35
|
-
var handleChange = useCallback(function (value) {
|
|
36
|
-
if (disabled) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
tryChangeValue(value);
|
|
40
|
-
}, [disabled, tryChangeValue]);
|
|
41
|
-
var isChecked = useCallback(function (valueArg) {
|
|
42
|
-
return valueArg === value;
|
|
43
|
-
}, [value]);
|
|
44
|
-
var rootProps = Object.assign(Object.assign({}, rest), {
|
|
45
|
-
role: 'radiogroup'
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
rootProps: rootProps,
|
|
49
|
-
value: value,
|
|
50
|
-
onChange: handleChange,
|
|
51
|
-
name: name,
|
|
52
|
-
isChecked: isChecked,
|
|
53
|
-
disabled: disabled
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export { useRadioGroup };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/** @LICENSE
|
|
2
|
-
* @hi-ui/table
|
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
import { __rest } from 'tslib';
|
|
11
|
-
import { useCallback, useMemo } from 'react';
|
|
12
|
-
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
|
13
|
-
import { hiddenStyle, setAttrStatus } from '@hi-ui/dom-utils';
|
|
14
|
-
|
|
15
|
-
/** @LICENSE
|
|
16
|
-
* @hi-ui/radio
|
|
17
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
18
|
-
*
|
|
19
|
-
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the MIT license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/
|
|
24
|
-
var useRadio = function useRadio(_a) {
|
|
25
|
-
var nameProp = _a.name,
|
|
26
|
-
valueProp = _a.value,
|
|
27
|
-
_a$autoFocus = _a.autoFocus,
|
|
28
|
-
autoFocus = _a$autoFocus === void 0 ? false : _a$autoFocus,
|
|
29
|
-
_a$defaultChecked = _a.defaultChecked,
|
|
30
|
-
defaultChecked = _a$defaultChecked === void 0 ? false : _a$defaultChecked,
|
|
31
|
-
onChange = _a.onChange,
|
|
32
|
-
checkedProp = _a.checked,
|
|
33
|
-
_a$readOnly = _a.readOnly,
|
|
34
|
-
readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
|
|
35
|
-
_a$disabled = _a.disabled,
|
|
36
|
-
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
|
37
|
-
rest = __rest(_a, ["name", "value", "autoFocus", "defaultChecked", "onChange", "checked", "readOnly", "disabled"]);
|
|
38
|
-
var _useUncontrolledState = useUncontrolledState(defaultChecked, checkedProp, function (_, evt) {
|
|
39
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(evt);
|
|
40
|
-
}),
|
|
41
|
-
checked = _useUncontrolledState[0],
|
|
42
|
-
tryChangeChecked = _useUncontrolledState[1];
|
|
43
|
-
var nonInteractive = disabled || readOnly;
|
|
44
|
-
var handleChange = useCallback(function (evt) {
|
|
45
|
-
if (nonInteractive) {
|
|
46
|
-
// 不可交互,不触发事件的任何默认行为
|
|
47
|
-
evt.preventDefault();
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
tryChangeChecked(evt.target.checked, evt);
|
|
51
|
-
}, [nonInteractive, tryChangeChecked]);
|
|
52
|
-
var getInputProps = useCallback(function () {
|
|
53
|
-
return {
|
|
54
|
-
style: hiddenStyle,
|
|
55
|
-
type: 'radio',
|
|
56
|
-
checked: checked,
|
|
57
|
-
disabled: disabled,
|
|
58
|
-
readOnly: readOnly,
|
|
59
|
-
onChange: handleChange,
|
|
60
|
-
autoFocus: autoFocus,
|
|
61
|
-
name: nameProp,
|
|
62
|
-
value: valueProp
|
|
63
|
-
};
|
|
64
|
-
}, [nameProp, handleChange, checked, disabled, readOnly, autoFocus, valueProp]);
|
|
65
|
-
var state = useMemo(function () {
|
|
66
|
-
return {
|
|
67
|
-
disabled: disabled,
|
|
68
|
-
checked: checked,
|
|
69
|
-
readOnly: readOnly
|
|
70
|
-
};
|
|
71
|
-
}, [disabled, checked, readOnly]);
|
|
72
|
-
var rootProps = Object.assign(Object.assign({}, rest), {
|
|
73
|
-
'data-disabled': setAttrStatus(disabled),
|
|
74
|
-
'data-checked': setAttrStatus(checked),
|
|
75
|
-
'data-readonly': setAttrStatus(readOnly)
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
state: state,
|
|
79
|
-
rootProps: rootProps,
|
|
80
|
-
getInputProps: getInputProps
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export { useRadio };
|