@hi-ui/schema-action-trigger 4.0.0-experimental.1

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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `@hi-ui/schema-action-trigger`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const actionTrigger = require('@hi-ui/schema-action-trigger');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,23 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+ var schemaUtils = require('@hi-ui/schema-utils');
16
+ var actionBarClsPrefix = 'actions-bar';
17
+ var actionBarCls = schemaUtils.createPrefixClassnames(actionBarClsPrefix);
18
+ var unifiedActionsClsPrefix = 'unified-actions';
19
+ var unifiedActionsCls = schemaUtils.createPrefixClassnames(unifiedActionsClsPrefix);
20
+ exports.actionBarCls = actionBarCls;
21
+ exports.actionBarClsPrefix = actionBarClsPrefix;
22
+ exports.unifiedActionsCls = unifiedActionsCls;
23
+ exports.unifiedActionsClsPrefix = unifiedActionsClsPrefix;
@@ -0,0 +1,121 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var reactIs = require('react-is');
18
+ var classname = require('@hi-ui/classname');
19
+ var space = require('@hi-ui/space');
20
+ var trigger = require('./trigger.js');
21
+ var more = require('./more.js');
22
+ var _utils = require('./_utils.js');
23
+ require('./index.scss.js');
24
+ function _interopDefaultCompat(e) {
25
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
26
+ 'default': e
27
+ };
28
+ }
29
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
30
+ var primitiveTypeEnum = new Set([
31
+ // primitive
32
+ 'string', 'number', 'boolean', 'bigint', 'symbol']);
33
+ function Actions(props) {
34
+ var data = props.data,
35
+ ctx = props.ctx;
36
+ var className = classname.cx(_utils.unifiedActionsCls, props.className);
37
+ var actionEls = props.actions.map(function (action, index) {
38
+ if (!action) return null;
39
+ // 可以是【JSX 元素】
40
+ if ( /*#__PURE__*/React__default["default"].isValidElement(action)) {
41
+ return {
42
+ type: 'jsx',
43
+ jsx: action
44
+ };
45
+ }
46
+ // 可以是【自定义组件】
47
+ if (reactIs.isValidElementType(action)) {
48
+ var ActionComponent = action;
49
+ var _el = /*#__PURE__*/React__default["default"].createElement(ActionComponent
50
+ // ActionComponent
51
+ , {
52
+ // ActionComponent
53
+ key: ActionComponent.name || index,
54
+ data: data,
55
+ ctx: ctx
56
+ });
57
+ return {
58
+ type: 'component',
59
+ jsx: _el
60
+ };
61
+ }
62
+ // 可以是其他【原始值】
63
+ // 这段其实大可不必,留着为了防刁钻的测试用例
64
+ if (primitiveTypeEnum.has(_typeof(action))) {
65
+ var str = (action === null || action === void 0 ? void 0 : action.toString()) || '';
66
+ var _el2 = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
67
+ key: str
68
+ }, str);
69
+ return {
70
+ type: 'primitive',
71
+ jsx: _el2
72
+ };
73
+ }
74
+ // 保底是【操作配置对象】
75
+ var actionConfig = action;
76
+ // JSX 写法无法判断 ActionTrigger 返回是否为 null,因此使用函数写法
77
+ var el = trigger.ActionTrigger(Object.assign(Object.assign({}, actionConfig), {
78
+ data: data,
79
+ ctx: ctx
80
+ }));
81
+ if (!el) return null;else return {
82
+ type: 'config',
83
+ jsx: el
84
+ };
85
+ }).filter(function (action) {
86
+ return !!action;
87
+ });
88
+ var _props$maxCount = props.maxCount,
89
+ sliceStart = _props$maxCount === void 0 ? Infinity : _props$maxCount;
90
+ var startEls = actionEls.slice(0, sliceStart);
91
+ var moreEls = actionEls.slice(sliceStart);
92
+ if (moreEls.length > 0) {
93
+ startEls.push({
94
+ type: 'more',
95
+ jsx: /*#__PURE__*/React__default["default"].createElement(more.MoreActionTrigger, {
96
+ key: "more",
97
+ els: moreEls
98
+ })
99
+ });
100
+ }
101
+ return /*#__PURE__*/React__default["default"].createElement(space.Space, {
102
+ direction: props.direction,
103
+ className: className
104
+ }, startEls.map(function (_ref) {
105
+ var jsx = _ref.jsx;
106
+ return jsx;
107
+ }));
108
+ }
109
+ // TODO 此处暂时留一个占位,等待后续扩展
110
+ // type DynamicCountWrapperProps = {
111
+ // wrapperEl: React.RefObject<HTMLElement>
112
+ // children: React.ReactElement
113
+ // }
114
+ // export function DynamicCountWrapper(props: DynamicCountWrapperProps) {
115
+ // // TODO 此处根据 wrapperEl 的宽度计算 maxCount
116
+ // return React.cloneElement(props.children, {
117
+ // maxCount: 2,
118
+ // })
119
+ // }
120
+
121
+ exports.Actions = Actions;
package/lib/cjs/bar.js ADDED
@@ -0,0 +1,48 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var classname = require('@hi-ui/classname');
18
+ var actions = require('./actions.js');
19
+ var _utils = require('./_utils.js');
20
+ require('./index.scss.js');
21
+ function _interopDefaultCompat(e) {
22
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
23
+ 'default': e
24
+ };
25
+ }
26
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
27
+ function ActionsBar(props) {
28
+ var data = props.data,
29
+ ctx = props.ctx;
30
+ return /*#__PURE__*/React__default["default"].createElement("div", {
31
+ className: classname.cx(_utils.actionBarClsPrefix, props.className)
32
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
33
+ className: _utils.actionBarCls('left')
34
+ }, props.left ? ( /*#__PURE__*/React__default["default"].createElement(actions.Actions, {
35
+ actions: props.left,
36
+ className: props.leftClassName,
37
+ data: data,
38
+ ctx: ctx
39
+ })) : null), /*#__PURE__*/React__default["default"].createElement("div", {
40
+ className: _utils.actionBarCls('right')
41
+ }, props.right ? ( /*#__PURE__*/React__default["default"].createElement(actions.Actions, {
42
+ actions: props.right,
43
+ className: props.rightClassName,
44
+ data: data,
45
+ ctx: ctx
46
+ })) : null));
47
+ }
48
+ exports.ActionsBar = ActionsBar;
@@ -0,0 +1,40 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var ahooks = require('ahooks');
18
+ var icons = require('@hi-ui/icons');
19
+ function _interopDefaultCompat(e) {
20
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
21
+ 'default': e
22
+ };
23
+ }
24
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
25
+ function Fullscreen(props) {
26
+ var _useFullscreen = ahooks.useFullscreen(props.elRef),
27
+ fullscreen = _useFullscreen[0],
28
+ toggleFullscreen = _useFullscreen[1].toggleFullscreen;
29
+ React.useEffect(function () {
30
+ if (props.elRef.current) {
31
+ props.elRef.current.dataset.fullscreen = fullscreen.toString();
32
+ }
33
+ }, [fullscreen, props.elRef]);
34
+ return fullscreen ? ( /*#__PURE__*/React__default["default"].createElement(icons.FullscreenExitOutlined, {
35
+ onClick: toggleFullscreen
36
+ })) : ( /*#__PURE__*/React__default["default"].createElement(icons.FullscreenOutlined, {
37
+ onClick: toggleFullscreen
38
+ }));
39
+ }
40
+ exports.Fullscreen = Fullscreen;
@@ -0,0 +1,42 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var icons = require('@hi-ui/icons');
18
+ var schemaTableExtensions = require('@hi-ui/schema-table-extensions');
19
+ function _interopDefaultCompat(e) {
20
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
21
+ 'default': e
22
+ };
23
+ }
24
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
25
+
26
+ // TODO 待实现
27
+ var useTableSetting = function useTableSetting(args) {
28
+ return {
29
+ columns: args ? [] : []
30
+ };
31
+ };
32
+ function Setting(props) {
33
+ var settingProps = useTableSetting({
34
+ fields: props.fields,
35
+ tableRef: props.tableRef,
36
+ storageKey: props.storageKey
37
+ });
38
+ return /*#__PURE__*/React__default["default"].createElement(schemaTableExtensions.TableSetting, Object.assign({}, settingProps, {
39
+ trigger: /*#__PURE__*/React__default["default"].createElement(icons.SettingOutlined, null)
40
+ }));
41
+ }
42
+ exports.Setting = Setting;
@@ -0,0 +1,29 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+ require('@hi-ui/schema-types');
16
+ var actions = require('./actions.js');
17
+ var bar = require('./bar.js');
18
+ var more = require('./more.js');
19
+ var trigger = require('./trigger.js');
20
+ var fullscreen = require('./builtin/fullscreen.js');
21
+ var setting = require('./builtin/setting.js');
22
+ var table = require('./toolbar/table.js');
23
+ exports.Actions = actions.Actions;
24
+ exports.ActionsBar = bar.ActionsBar;
25
+ exports.MoreActionTrigger = more.MoreActionTrigger;
26
+ exports.ActionTrigger = trigger.ActionTrigger;
27
+ exports.Fullscreen = fullscreen.Fullscreen;
28
+ exports.Setting = setting.Setting;
29
+ exports.TableToolbar = table.TableToolbar;
@@ -0,0 +1,18 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+ var css_248z = ".unified-actions__more-trigger {font-size: 18px;color: #5f6a7a;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger {padding: 0;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > button {padding: 7px 8px;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > span {padding: 8px;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > button, .unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > span {width: 100%;text-align: start;}.actions-bar {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 12px 0;}.actions-bar svg {color: #5f6a7a;cursor: pointer;}";
16
+ var __styleInject__ = require('@hi-ui/style-inject')["default"];
17
+ __styleInject__(css_248z);
18
+ exports["default"] = css_248z;
@@ -0,0 +1,52 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var dropdown = require('@hi-ui/dropdown');
18
+ var icons = require('@hi-ui/icons');
19
+ var _utils = require('./_utils.js');
20
+ function _interopDefaultCompat(e) {
21
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
22
+ 'default': e
23
+ };
24
+ }
25
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
26
+ function MoreActionTrigger(props) {
27
+ var data = props.els.map(function (el, id) {
28
+ if (el.type === 'config') {
29
+ return {
30
+ id: id,
31
+ title: /*#__PURE__*/React__default["default"].cloneElement(el.jsx, {
32
+ appearance: 'link'
33
+ })
34
+ };
35
+ }
36
+ return {
37
+ id: id,
38
+ title: /*#__PURE__*/React__default["default"].createElement("span", null, el.jsx)
39
+ };
40
+ });
41
+ if (data.length === 0) return null;
42
+ return /*#__PURE__*/React__default["default"].createElement(dropdown.Dropdown, {
43
+ trigger: "click",
44
+ data: data,
45
+ className: _utils.unifiedActionsCls('more-trigger'),
46
+ overlay: {
47
+ className: _utils.unifiedActionsCls('more-overlay'),
48
+ arrow: true
49
+ }
50
+ }, /*#__PURE__*/React__default["default"].createElement(icons.EllipsisOutlined, null));
51
+ }
52
+ exports.MoreActionTrigger = MoreActionTrigger;
@@ -0,0 +1,76 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var tslib = require('tslib');
17
+ var React = require('react');
18
+ var classname = require('@hi-ui/classname');
19
+ var schemaUtils = require('@hi-ui/schema-utils');
20
+ var bar = require('../bar.js');
21
+ var fullscreen = require('../builtin/fullscreen.js');
22
+ var setting = require('../builtin/setting.js');
23
+ function _interopDefaultCompat(e) {
24
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
25
+ 'default': e
26
+ };
27
+ }
28
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
29
+ var BuiltinActions = {
30
+ Setting: setting.Setting,
31
+ Fullscreen: fullscreen.Fullscreen
32
+ };
33
+ function TableToolbar(props) {
34
+ var ctx = props.ctx,
35
+ getLeft = props.left,
36
+ getRight = props.right,
37
+ restProps = tslib.__rest(props, ["ctx", "left", "right"]);
38
+ var builtin = {
39
+ setting: ( /*#__PURE__*/React__default["default"].createElement(BuiltinActions.Setting
40
+ // Setting
41
+ , {
42
+ // Setting
43
+ key: "setting",
44
+ fields: ctx.tableFields,
45
+ tableRef: ctx.tableCtxRef
46
+ })),
47
+ fullscreen: ( /*#__PURE__*/React__default["default"].createElement(BuiltinActions.Fullscreen
48
+ // Fullscreen
49
+ , {
50
+ // Fullscreen
51
+ key: "fullscreen",
52
+ elRef: ctx.fullscreenElRef
53
+ }))
54
+ };
55
+ var dftLeft = [
56
+ // left
57
+ builtin.setting, builtin.fullscreen];
58
+ var left = schemaUtils.getGetterValue(getLeft, dftLeft, [Object.assign(Object.assign({}, ctx), {
59
+ builtin: builtin
60
+ })]);
61
+ var right = schemaUtils.getGetterValue(getRight, [], [ctx]);
62
+ var className = classname.cx('table-toolbar', props.className);
63
+ return /*#__PURE__*/React__default["default"].createElement(bar.ActionsBar, Object.assign({
64
+ left: left,
65
+ right: right
66
+ }, restProps, {
67
+ className: className,
68
+ // 此处 data 的空数组是为了避开必填检验
69
+ // 详细原因是:类型标注为表格的行数据
70
+ // 但若从 tabCtx 上获取,会丢失实时性
71
+ // 因此如需行数据信息,需自行从 ctx 上获取
72
+ data: [],
73
+ ctx: ctx
74
+ }));
75
+ }
76
+ exports.TableToolbar = TableToolbar;
@@ -0,0 +1,49 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+ Object.defineProperty(exports, '__esModule', {
14
+ value: true
15
+ });
16
+ var React = require('react');
17
+ var button = require('@hi-ui/button');
18
+ var schemaUtils = require('@hi-ui/schema-utils');
19
+ function _interopDefaultCompat(e) {
20
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
21
+ 'default': e
22
+ };
23
+ }
24
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
25
+ function ActionTrigger(props) {
26
+ var text = props.text,
27
+ _onClick = props.onClick,
28
+ disabled = props.disabled,
29
+ visible = props.visible,
30
+ type = props.type;
31
+ var data = props.data,
32
+ ctx = props.ctx;
33
+ // 检查按钮是否可见
34
+ var isVisible = schemaUtils.getBoolGetterValue(visible, true, [data, ctx]);
35
+ if (!isVisible) return null;
36
+ // 检查按钮是否禁用
37
+ var isDisabled = schemaUtils.getBoolGetterValue(disabled, false, [data, ctx]);
38
+ return /*#__PURE__*/React__default["default"].createElement(button.Button, {
39
+ key: text,
40
+ icon: props.icon,
41
+ appearance: props.appearance,
42
+ disabled: isDisabled,
43
+ type: type || 'primary',
44
+ onClick: function onClick() {
45
+ return _onClick(data, ctx);
46
+ }
47
+ }, text);
48
+ }
49
+ exports.ActionTrigger = ActionTrigger;
@@ -0,0 +1,15 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 { createPrefixClassnames } from '@hi-ui/schema-utils';
11
+ var actionBarClsPrefix = 'actions-bar';
12
+ var actionBarCls = createPrefixClassnames(actionBarClsPrefix);
13
+ var unifiedActionsClsPrefix = 'unified-actions';
14
+ var unifiedActionsCls = createPrefixClassnames(unifiedActionsClsPrefix);
15
+ export { actionBarCls, actionBarClsPrefix, unifiedActionsCls, unifiedActionsClsPrefix };
@@ -0,0 +1,110 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ /** @LICENSE
3
+ * @hi-ui/schema-action-trigger
4
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#readme
5
+ *
6
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ import React from 'react';
12
+ import { isValidElementType } from 'react-is';
13
+ import { cx } from '@hi-ui/classname';
14
+ import { Space } from '@hi-ui/space';
15
+ import { ActionTrigger } from './trigger.js';
16
+ import { MoreActionTrigger } from './more.js';
17
+ import { unifiedActionsCls } from './_utils.js';
18
+ import './index.scss.js';
19
+ var primitiveTypeEnum = new Set([
20
+ // primitive
21
+ 'string', 'number', 'boolean', 'bigint', 'symbol']);
22
+ function Actions(props) {
23
+ var data = props.data,
24
+ ctx = props.ctx;
25
+ var className = cx(unifiedActionsCls, props.className);
26
+ var actionEls = props.actions.map(function (action, index) {
27
+ if (!action) return null;
28
+ // 可以是【JSX 元素】
29
+ if ( /*#__PURE__*/React.isValidElement(action)) {
30
+ return {
31
+ type: 'jsx',
32
+ jsx: action
33
+ };
34
+ }
35
+ // 可以是【自定义组件】
36
+ if (isValidElementType(action)) {
37
+ var ActionComponent = action;
38
+ var _el = /*#__PURE__*/React.createElement(ActionComponent
39
+ // ActionComponent
40
+ , {
41
+ // ActionComponent
42
+ key: ActionComponent.name || index,
43
+ data: data,
44
+ ctx: ctx
45
+ });
46
+ return {
47
+ type: 'component',
48
+ jsx: _el
49
+ };
50
+ }
51
+ // 可以是其他【原始值】
52
+ // 这段其实大可不必,留着为了防刁钻的测试用例
53
+ if (primitiveTypeEnum.has(_typeof(action))) {
54
+ var str = (action === null || action === void 0 ? void 0 : action.toString()) || '';
55
+ var _el2 = /*#__PURE__*/React.createElement(React.Fragment, {
56
+ key: str
57
+ }, str);
58
+ return {
59
+ type: 'primitive',
60
+ jsx: _el2
61
+ };
62
+ }
63
+ // 保底是【操作配置对象】
64
+ var actionConfig = action;
65
+ // JSX 写法无法判断 ActionTrigger 返回是否为 null,因此使用函数写法
66
+ var el = ActionTrigger(Object.assign(Object.assign({}, actionConfig), {
67
+ data: data,
68
+ ctx: ctx
69
+ }));
70
+ if (!el) return null;else return {
71
+ type: 'config',
72
+ jsx: el
73
+ };
74
+ }).filter(function (action) {
75
+ return !!action;
76
+ });
77
+ var _props$maxCount = props.maxCount,
78
+ sliceStart = _props$maxCount === void 0 ? Infinity : _props$maxCount;
79
+ var startEls = actionEls.slice(0, sliceStart);
80
+ var moreEls = actionEls.slice(sliceStart);
81
+ if (moreEls.length > 0) {
82
+ startEls.push({
83
+ type: 'more',
84
+ jsx: /*#__PURE__*/React.createElement(MoreActionTrigger, {
85
+ key: "more",
86
+ els: moreEls
87
+ })
88
+ });
89
+ }
90
+ return /*#__PURE__*/React.createElement(Space, {
91
+ direction: props.direction,
92
+ className: className
93
+ }, startEls.map(function (_ref) {
94
+ var jsx = _ref.jsx;
95
+ return jsx;
96
+ }));
97
+ }
98
+ // TODO 此处暂时留一个占位,等待后续扩展
99
+ // type DynamicCountWrapperProps = {
100
+ // wrapperEl: React.RefObject<HTMLElement>
101
+ // children: React.ReactElement
102
+ // }
103
+ // export function DynamicCountWrapper(props: DynamicCountWrapperProps) {
104
+ // // TODO 此处根据 wrapperEl 的宽度计算 maxCount
105
+ // return React.cloneElement(props.children, {
106
+ // maxCount: 2,
107
+ // })
108
+ // }
109
+
110
+ export { Actions };
package/lib/esm/bar.js ADDED
@@ -0,0 +1,36 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React from 'react';
11
+ import { cx } from '@hi-ui/classname';
12
+ import { Actions } from './actions.js';
13
+ import { actionBarClsPrefix, actionBarCls } from './_utils.js';
14
+ import './index.scss.js';
15
+ function ActionsBar(props) {
16
+ var data = props.data,
17
+ ctx = props.ctx;
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: cx(actionBarClsPrefix, props.className)
20
+ }, /*#__PURE__*/React.createElement("div", {
21
+ className: actionBarCls('left')
22
+ }, props.left ? ( /*#__PURE__*/React.createElement(Actions, {
23
+ actions: props.left,
24
+ className: props.leftClassName,
25
+ data: data,
26
+ ctx: ctx
27
+ })) : null), /*#__PURE__*/React.createElement("div", {
28
+ className: actionBarCls('right')
29
+ }, props.right ? ( /*#__PURE__*/React.createElement(Actions, {
30
+ actions: props.right,
31
+ className: props.rightClassName,
32
+ data: data,
33
+ ctx: ctx
34
+ })) : null));
35
+ }
36
+ export { ActionsBar };
@@ -0,0 +1,28 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React, { useEffect } from 'react';
11
+ import { useFullscreen } from 'ahooks';
12
+ import { FullscreenExitOutlined, FullscreenOutlined } from '@hi-ui/icons';
13
+ function Fullscreen(props) {
14
+ var _useFullscreen = useFullscreen(props.elRef),
15
+ fullscreen = _useFullscreen[0],
16
+ toggleFullscreen = _useFullscreen[1].toggleFullscreen;
17
+ useEffect(function () {
18
+ if (props.elRef.current) {
19
+ props.elRef.current.dataset.fullscreen = fullscreen.toString();
20
+ }
21
+ }, [fullscreen, props.elRef]);
22
+ return fullscreen ? ( /*#__PURE__*/React.createElement(FullscreenExitOutlined, {
23
+ onClick: toggleFullscreen
24
+ })) : ( /*#__PURE__*/React.createElement(FullscreenOutlined, {
25
+ onClick: toggleFullscreen
26
+ }));
27
+ }
28
+ export { Fullscreen };
@@ -0,0 +1,30 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React from 'react';
11
+ import { SettingOutlined } from '@hi-ui/icons';
12
+ import { TableSetting } from '@hi-ui/schema-table-extensions';
13
+
14
+ // TODO 待实现
15
+ var useTableSetting = function useTableSetting(args) {
16
+ return {
17
+ columns: args ? [] : []
18
+ };
19
+ };
20
+ function Setting(props) {
21
+ var settingProps = useTableSetting({
22
+ fields: props.fields,
23
+ tableRef: props.tableRef,
24
+ storageKey: props.storageKey
25
+ });
26
+ return /*#__PURE__*/React.createElement(TableSetting, Object.assign({}, settingProps, {
27
+ trigger: /*#__PURE__*/React.createElement(SettingOutlined, null)
28
+ }));
29
+ }
30
+ export { Setting };
@@ -0,0 +1,17 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 '@hi-ui/schema-types';
11
+ export { Actions } from './actions.js';
12
+ export { ActionsBar } from './bar.js';
13
+ export { MoreActionTrigger } from './more.js';
14
+ export { ActionTrigger } from './trigger.js';
15
+ export { Fullscreen } from './builtin/fullscreen.js';
16
+ export { Setting } from './builtin/setting.js';
17
+ export { TableToolbar } from './toolbar/table.js';
@@ -0,0 +1,13 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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
+ var css_248z = ".unified-actions__more-trigger {font-size: 18px;color: #5f6a7a;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger {padding: 0;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > button {padding: 7px 8px;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > span {padding: 8px;}.unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > button, .unified-actions__more-overlay .hi-v5-dropdown-menu-item__trigger > span {width: 100%;text-align: start;}.actions-bar {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 12px 0;}.actions-bar svg {color: #5f6a7a;cursor: pointer;}";
12
+ __styleInject__(css_248z);
13
+ export { css_248z as default };
@@ -0,0 +1,40 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React from 'react';
11
+ import { Dropdown } from '@hi-ui/dropdown';
12
+ import { EllipsisOutlined } from '@hi-ui/icons';
13
+ import { unifiedActionsCls } from './_utils.js';
14
+ function MoreActionTrigger(props) {
15
+ var data = props.els.map(function (el, id) {
16
+ if (el.type === 'config') {
17
+ return {
18
+ id: id,
19
+ title: /*#__PURE__*/React.cloneElement(el.jsx, {
20
+ appearance: 'link'
21
+ })
22
+ };
23
+ }
24
+ return {
25
+ id: id,
26
+ title: /*#__PURE__*/React.createElement("span", null, el.jsx)
27
+ };
28
+ });
29
+ if (data.length === 0) return null;
30
+ return /*#__PURE__*/React.createElement(Dropdown, {
31
+ trigger: "click",
32
+ data: data,
33
+ className: unifiedActionsCls('more-trigger'),
34
+ overlay: {
35
+ className: unifiedActionsCls('more-overlay'),
36
+ arrow: true
37
+ }
38
+ }, /*#__PURE__*/React.createElement(EllipsisOutlined, null));
39
+ }
40
+ export { MoreActionTrigger };
@@ -0,0 +1,64 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React from 'react';
12
+ import { cx } from '@hi-ui/classname';
13
+ import { getGetterValue } from '@hi-ui/schema-utils';
14
+ import { ActionsBar } from '../bar.js';
15
+ import { Fullscreen } from '../builtin/fullscreen.js';
16
+ import { Setting } from '../builtin/setting.js';
17
+ var BuiltinActions = {
18
+ Setting: Setting,
19
+ Fullscreen: Fullscreen
20
+ };
21
+ function TableToolbar(props) {
22
+ var ctx = props.ctx,
23
+ getLeft = props.left,
24
+ getRight = props.right,
25
+ restProps = __rest(props, ["ctx", "left", "right"]);
26
+ var builtin = {
27
+ setting: ( /*#__PURE__*/React.createElement(BuiltinActions.Setting
28
+ // Setting
29
+ , {
30
+ // Setting
31
+ key: "setting",
32
+ fields: ctx.tableFields,
33
+ tableRef: ctx.tableCtxRef
34
+ })),
35
+ fullscreen: ( /*#__PURE__*/React.createElement(BuiltinActions.Fullscreen
36
+ // Fullscreen
37
+ , {
38
+ // Fullscreen
39
+ key: "fullscreen",
40
+ elRef: ctx.fullscreenElRef
41
+ }))
42
+ };
43
+ var dftLeft = [
44
+ // left
45
+ builtin.setting, builtin.fullscreen];
46
+ var left = getGetterValue(getLeft, dftLeft, [Object.assign(Object.assign({}, ctx), {
47
+ builtin: builtin
48
+ })]);
49
+ var right = getGetterValue(getRight, [], [ctx]);
50
+ var className = cx('table-toolbar', props.className);
51
+ return /*#__PURE__*/React.createElement(ActionsBar, Object.assign({
52
+ left: left,
53
+ right: right
54
+ }, restProps, {
55
+ className: className,
56
+ // 此处 data 的空数组是为了避开必填检验
57
+ // 详细原因是:类型标注为表格的行数据
58
+ // 但若从 tabCtx 上获取,会丢失实时性
59
+ // 因此如需行数据信息,需自行从 ctx 上获取
60
+ data: [],
61
+ ctx: ctx
62
+ }));
63
+ }
64
+ export { TableToolbar };
@@ -0,0 +1,37 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-action-trigger
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#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 React from 'react';
11
+ import { Button } from '@hi-ui/button';
12
+ import { getBoolGetterValue } from '@hi-ui/schema-utils';
13
+ function ActionTrigger(props) {
14
+ var text = props.text,
15
+ _onClick = props.onClick,
16
+ disabled = props.disabled,
17
+ visible = props.visible,
18
+ type = props.type;
19
+ var data = props.data,
20
+ ctx = props.ctx;
21
+ // 检查按钮是否可见
22
+ var isVisible = getBoolGetterValue(visible, true, [data, ctx]);
23
+ if (!isVisible) return null;
24
+ // 检查按钮是否禁用
25
+ var isDisabled = getBoolGetterValue(disabled, false, [data, ctx]);
26
+ return /*#__PURE__*/React.createElement(Button, {
27
+ key: text,
28
+ icon: props.icon,
29
+ appearance: props.appearance,
30
+ disabled: isDisabled,
31
+ type: type || 'primary',
32
+ onClick: function onClick() {
33
+ return _onClick(data, ctx);
34
+ }
35
+ }, text);
36
+ }
37
+ export { ActionTrigger };
@@ -0,0 +1,8 @@
1
+ export declare const actionBarClsPrefix = "actions-bar";
2
+ export declare const actionBarCls: (...args: ((string | false | null | undefined) | {
3
+ [x: string]: boolean | null | undefined;
4
+ })[]) => string;
5
+ export declare const unifiedActionsClsPrefix = "unified-actions";
6
+ export declare const unifiedActionsCls: (...args: ((string | false | null | undefined) | {
7
+ [x: string]: boolean | null | undefined;
8
+ })[]) => string;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { type SpaceProps } from '@hi-ui/space';
3
+ import type { ActionTriggerProps, WithActionCtx } from './trigger';
4
+ import './index.scss';
5
+ export type ActionElEnumType = 'primitive' | 'jsx' | 'component' | 'config' | 'more';
6
+ export type ActionElType = {
7
+ type: ActionElEnumType;
8
+ jsx: React.ReactElement;
9
+ };
10
+ export type ActionComponentType<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject> = React.ComponentType<{
11
+ data: TData;
12
+ ctx: TCtx;
13
+ }>;
14
+ export type ActionsProps<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject> = WithActionCtx<{
15
+ /** 按钮配置 */
16
+ actions: (ActionTriggerProps<TData, TCtx> | ActionComponentType<TData, TCtx> | React.ReactNode)[];
17
+ /**
18
+ * 最大显示数量
19
+ * @desc 超过最大数量时,会显示【更多】按钮
20
+ * @desc 默认显示全部,相当于 maxCount 为 Infinity
21
+ */
22
+ maxCount?: number;
23
+ className?: string;
24
+ direction?: SpaceProps['direction'];
25
+ }, TData, TCtx>;
26
+ export declare function Actions<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject>(props: ActionsProps<TData, TCtx>): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ActionsProps } from './actions';
2
+ import type { WithActionCtx } from './trigger';
3
+ import './index.scss';
4
+ export type ActionsBarProps<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject> = WithActionCtx<{
5
+ left?: ActionsProps<TData, TCtx>['actions'];
6
+ right?: ActionsProps<TData, TCtx>['actions'];
7
+ className?: string;
8
+ leftClassName?: string;
9
+ rightClassName?: string;
10
+ }, TData, TCtx>;
11
+ export declare function ActionsBar<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject>(props: ActionsBarProps<TData, TCtx>): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export type FullscreenProps = {
3
+ elRef: React.RefObject<HTMLElement>;
4
+ };
5
+ export declare function Fullscreen(props: FullscreenProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './fullscreen';
2
+ export * from './setting';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { FieldConfigType } from '@hi-ui/schema-core';
3
+ export type SettingProps = {
4
+ fields: FieldConfigType[];
5
+ tableRef: React.RefObject<AnyObject>;
6
+ storageKey?: string;
7
+ };
8
+ export declare function Setting(props: SettingProps): JSX.Element;
@@ -0,0 +1,7 @@
1
+ import '@hi-ui/schema-types';
2
+ export * from './actions';
3
+ export * from './bar';
4
+ export * from './more';
5
+ export * from './trigger';
6
+ export * from './builtin';
7
+ export * from './toolbar/table';
@@ -0,0 +1,6 @@
1
+ import type { ActionElType } from './actions';
2
+ type MoreActionTriggerProps = {
3
+ els: ActionElType[];
4
+ };
5
+ export declare function MoreActionTrigger(props: MoreActionTriggerProps): JSX.Element | null;
6
+ export {};
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import type { SchemaFormProps } from '@hi-ui/schema-core';
3
+ import type { ActionsProps } from '../actions';
4
+ import type * as BuiltinActionsType from '../builtin';
5
+ type ToolbarActionsType = ActionsProps<AnyObject[], TableToolbarCtxType>['actions'];
6
+ export type ToolbarConfigType = {
7
+ left?: AnyGetter<CustomLeftActionRenderType>;
8
+ right?: AnyGetter<CustomRightActionRenderType>;
9
+ };
10
+ type BuiltinLeftActionType = {
11
+ setting: React.ReactElement;
12
+ fullscreen: React.ReactElement;
13
+ };
14
+ type CustomLeftActionRenderType = (ctx: TableToolbarCtxType & AnyObject & {
15
+ builtin: BuiltinLeftActionType;
16
+ }) => ToolbarActionsType;
17
+ type CustomRightActionRenderType = (ctx: TableToolbarCtxType & AnyObject) => ToolbarActionsType;
18
+ export type TableToolbarCtxType = {
19
+ tableFields: BuiltinActionsType.SettingProps['fields'];
20
+ tableCtxRef: BuiltinActionsType.SettingProps['tableRef'];
21
+ fullscreenElRef: BuiltinActionsType.FullscreenProps['elRef'];
22
+ formRef?: SchemaFormProps['formRef'];
23
+ };
24
+ export type TableToolbarProps = ToolbarConfigType & {
25
+ className?: string;
26
+ ctx: TableToolbarCtxType;
27
+ };
28
+ export declare function TableToolbar(props: TableToolbarProps): JSX.Element;
29
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { ActionFnParams, ActionConfigType } from '@hi-ui/schema-core';
2
+ export type { ActionFnParams, ActionConfigType };
3
+ export type WithActionCtx<T, TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject> = T & {
4
+ /** 数据 */
5
+ data: TData;
6
+ /** 上下文 */
7
+ ctx: TCtx;
8
+ };
9
+ /** 【操作按钮】组件的配置选项类型 */
10
+ export type ActionTriggerProps<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject> = WithActionCtx<ActionConfigType<TData, TCtx>, TData, TCtx>;
11
+ export declare function ActionTrigger<TData extends AnyObject = AnyObject, TCtx extends AnyObject = AnyObject>(props: ActionTriggerProps<TData, TCtx>): JSX.Element | null;
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@hi-ui/schema-action-trigger",
3
+ "version": "4.0.0-experimental.1",
4
+ "description": "A sub-package for @hi-ui/schema.",
5
+ "keywords": [],
6
+ "author": "HiUI <mi-hiui@xiaomi.com>",
7
+ "homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-action-trigger#readme",
8
+ "license": "MIT",
9
+ "directories": {
10
+ "lib": "lib",
11
+ "test": "__tests__"
12
+ },
13
+ "files": [
14
+ "lib"
15
+ ],
16
+ "main": "lib/cjs/index.js",
17
+ "module": "lib/esm/index.js",
18
+ "types": "lib/types/index.d.ts",
19
+ "typings": "lib/types/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "require": "./lib/cjs/index.js",
23
+ "default": "./lib/esm/index.js"
24
+ }
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/XiaoMi/hiui.git"
32
+ },
33
+ "scripts": {
34
+ "test": "jest",
35
+ "clean": "rimraf lib",
36
+ "prebuild": "yarn clean",
37
+ "build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm",
38
+ "build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs",
39
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
40
+ "build": "concurrently yarn:build:*"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/XiaoMi/hiui/issues"
44
+ },
45
+ "dependencies": {
46
+ "@hi-ui/button": ">=5.0.0-experimental.0",
47
+ "@hi-ui/classname": ">=5.0.0-experimental.0",
48
+ "@hi-ui/dropdown": ">=5.0.0-experimental.0",
49
+ "@hi-ui/icons": ">=5.0.0-experimental.0",
50
+ "@hi-ui/schema-core": ">=4.0.0-experimental.1",
51
+ "@hi-ui/schema-utils": ">=4.0.0-experimental.1",
52
+ "@hi-ui/space": ">=5.0.0-experimental.0",
53
+ "@hi-ui/schema-table-extensions": ">=4.0.0-experimental.1",
54
+ "react-is": "^17.0.2"
55
+ },
56
+ "peerDependencies": {
57
+ "@hi-ui/schema-types": ">=4.0.0-experimental.1",
58
+ "@hi-ui/utility-types": ">=4.0.0-experimental.1",
59
+ "ahooks": "^3.9.6",
60
+ "react": ">=16.8.6"
61
+ },
62
+ "devDependencies": {
63
+ "@hi-ui/schema-types": ">=4.0.0-experimental.1",
64
+ "@hi-ui/utility-types": ">=4.0.0-experimental.1",
65
+ "react": "^17.0.2"
66
+ },
67
+ "volta": {
68
+ "node": "14.21.3"
69
+ }
70
+ }