@hi-ui/layout 4.0.0 → 5.0.0-alpha.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 +51 -0
- package/lib/cjs/AppList.js +163 -0
- package/lib/cjs/CollapseIcon.js +56 -0
- package/lib/cjs/Content.js +1 -4
- package/lib/cjs/FloatMenuContainer.js +93 -0
- package/lib/cjs/Footer.js +45 -0
- package/lib/cjs/Header.js +45 -0
- package/lib/cjs/Layout.js +4 -2
- package/lib/cjs/Profile.js +165 -0
- package/lib/cjs/SearchTrigger.js +71 -8
- package/lib/cjs/Sider.js +32 -18
- package/lib/cjs/index.js +26 -3
- package/lib/cjs/packages/hooks/use-id/lib/esm/index.js +51 -0
- package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +16 -0
- package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +33 -0
- package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +41 -0
- package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +33 -0
- package/lib/cjs/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +19 -0
- package/lib/cjs/packages/hooks/use-latest/lib/esm/index.js +56 -0
- package/lib/cjs/packages/hooks/use-timeout/lib/esm/index.js +50 -0
- package/lib/cjs/packages/hooks/use-toggle/lib/esm/index.js +71 -0
- package/lib/cjs/packages/hooks/use-unmount-effect/lib/esm/index.js +44 -0
- package/lib/cjs/packages/icons/lib/esm/components/alert/check-outlined.js +65 -0
- package/lib/cjs/packages/icons/lib/esm/components/direction/right-outlined.js +65 -0
- package/lib/cjs/packages/ui/popover/lib/esm/Popover.js +111 -0
- package/lib/cjs/packages/ui/popover/lib/esm/index.js +31 -0
- package/lib/cjs/packages/ui/popover/lib/esm/styles/index.scss.js +35 -0
- package/lib/cjs/packages/ui/popover/lib/esm/types.js +31 -0
- package/lib/cjs/packages/ui/popover/lib/esm/use-popover.js +187 -0
- package/lib/cjs/packages/ui/popover/lib/esm/utils/container/lib/esm/index.js +67 -0
- package/lib/cjs/packages/ui/popover/lib/esm/with-api.js +84 -0
- package/lib/cjs/packages/utils/array-utils/lib/esm/index.js +33 -0
- package/lib/cjs/packages/utils/dom-utils/lib/esm/index.js +47 -0
- package/lib/cjs/packages/utils/react-utils/lib/esm/index.js +72 -0
- package/lib/cjs/packages/utils/type-assertion/lib/esm/index.js +36 -0
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/esm/AppList.js +149 -0
- package/lib/esm/CollapseIcon.js +44 -0
- package/lib/esm/Content.js +1 -4
- package/lib/esm/FloatMenuContainer.js +81 -0
- package/lib/esm/Footer.js +33 -0
- package/lib/esm/Header.js +33 -0
- package/lib/esm/Layout.js +4 -2
- package/lib/esm/Profile.js +152 -0
- package/lib/esm/SearchTrigger.js +70 -8
- package/lib/esm/Sider.js +32 -18
- package/lib/esm/index.js +22 -4
- package/lib/esm/packages/hooks/use-id/lib/esm/index.js +45 -0
- package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +11 -0
- package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +27 -0
- package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +36 -0
- package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +28 -0
- package/lib/esm/packages/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +14 -0
- package/lib/esm/packages/hooks/use-latest/lib/esm/index.js +50 -0
- package/lib/esm/packages/hooks/use-timeout/lib/esm/index.js +45 -0
- package/lib/esm/packages/hooks/use-toggle/lib/esm/index.js +66 -0
- package/lib/esm/packages/hooks/use-unmount-effect/lib/esm/index.js +39 -0
- package/lib/esm/packages/icons/lib/esm/components/alert/check-outlined.js +53 -0
- package/lib/esm/packages/icons/lib/esm/components/direction/right-outlined.js +53 -0
- package/lib/esm/packages/ui/popover/lib/esm/Popover.js +97 -0
- package/lib/esm/packages/ui/popover/lib/esm/index.js +25 -0
- package/lib/esm/packages/ui/popover/lib/esm/styles/index.scss.js +23 -0
- package/lib/esm/packages/ui/popover/lib/esm/types.js +25 -0
- package/lib/esm/packages/ui/popover/lib/esm/use-popover.js +175 -0
- package/lib/esm/packages/ui/popover/lib/esm/utils/container/lib/esm/index.js +60 -0
- package/lib/esm/packages/ui/popover/lib/esm/with-api.js +79 -0
- package/lib/esm/packages/utils/array-utils/lib/esm/index.js +28 -0
- package/lib/esm/packages/utils/dom-utils/lib/esm/index.js +42 -0
- package/lib/esm/packages/utils/react-utils/lib/esm/index.js +65 -0
- package/lib/esm/packages/utils/type-assertion/lib/esm/index.js +29 -0
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/types/AppList.d.ts +71 -0
- package/lib/types/CollapseIcon.d.ts +1 -0
- package/lib/types/Content.d.ts +0 -3
- package/lib/types/FloatMenuContainer.d.ts +28 -0
- package/lib/types/Footer.d.ts +5 -0
- package/lib/types/Header.d.ts +5 -0
- package/lib/types/Layout.d.ts +4 -0
- package/lib/types/Profile.d.ts +24 -0
- package/lib/types/SearchTrigger.d.ts +11 -0
- package/lib/types/Sider.d.ts +21 -0
- package/lib/types/index.d.ts +17 -1
- package/package.json +9 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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 index = require('../../../type-assertion/lib/esm/index.js');
|
|
16
|
+
|
|
17
|
+
/** @LICENSE
|
|
18
|
+
* @hi-ui/array-utils
|
|
19
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/utils/array-utils#readme
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* 抹平结构为数组
|
|
28
|
+
*/
|
|
29
|
+
var normalizeArray = function normalizeArray(arg) {
|
|
30
|
+
if (index.isNullish(arg)) return [];
|
|
31
|
+
return index.isArray(arg) ? arg : [arg];
|
|
32
|
+
};
|
|
33
|
+
exports.normalizeArray = normalizeArray;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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/env');
|
|
16
|
+
|
|
17
|
+
/** @LICENSE
|
|
18
|
+
* @hi-ui/dom-utils
|
|
19
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/utils/dom-utils#readme
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* 模拟事件默认事件处理机制,以此执行传入的事件处理器
|
|
28
|
+
*
|
|
29
|
+
* @param handlers
|
|
30
|
+
* @returns
|
|
31
|
+
* @ref https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
|
|
32
|
+
*/
|
|
33
|
+
function mockDefaultHandlers() {
|
|
34
|
+
for (var _len = arguments.length, handlers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
|
+
handlers[_key] = arguments[_key];
|
|
36
|
+
}
|
|
37
|
+
return function mockedDefaultHandler(event) {
|
|
38
|
+
handlers.some(function (handler) {
|
|
39
|
+
if (handler) {
|
|
40
|
+
// handler 执行中,可以阻止默认行为,即将 `defaultPrevented` 置为 `true`
|
|
41
|
+
handler(event);
|
|
42
|
+
}
|
|
43
|
+
return event.defaultPrevented;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.mockDefaultHandlers = mockDefaultHandlers;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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('react');
|
|
16
|
+
require('@babel/runtime/helpers/esm/typeof');
|
|
17
|
+
require('@hi-ui/env');
|
|
18
|
+
|
|
19
|
+
/** @LICENSE
|
|
20
|
+
* @hi-ui/react-utils
|
|
21
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/utils/react-utils#readme
|
|
22
|
+
*
|
|
23
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the MIT license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Merge defaultProps into props
|
|
30
|
+
*/
|
|
31
|
+
var withDefaultProps = function withDefaultProps(props, defaultProps) {
|
|
32
|
+
if (!defaultProps) return props || {};
|
|
33
|
+
var mergedProps = Object.assign({}, props);
|
|
34
|
+
var propName;
|
|
35
|
+
for (propName in defaultProps) {
|
|
36
|
+
if (mergedProps[propName] === undefined) {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
mergedProps[propName] = defaultProps[propName];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return mergedProps;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Set ref into a React element.
|
|
45
|
+
*/
|
|
46
|
+
function setRef(ref, value) {
|
|
47
|
+
if (typeof ref === 'function') {
|
|
48
|
+
ref(value);
|
|
49
|
+
} else if (ref) {
|
|
50
|
+
ref.current = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Merges multiple refs into a single function ref.
|
|
55
|
+
*/
|
|
56
|
+
var mergeRefs = function mergeRefs() {
|
|
57
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
|
+
refs[_key] = arguments[_key];
|
|
59
|
+
}
|
|
60
|
+
// Empty check
|
|
61
|
+
if (refs.some(function (ref) {
|
|
62
|
+
return ref;
|
|
63
|
+
}) === false) return null;
|
|
64
|
+
return function (value) {
|
|
65
|
+
refs.forEach(function (ref) {
|
|
66
|
+
setRef(ref, value);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.mergeRefs = mergeRefs;
|
|
71
|
+
exports.setRef = setRef;
|
|
72
|
+
exports.withDefaultProps = withDefaultProps;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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('@babel/runtime/helpers/esm/typeof');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Assert is Nullish
|
|
19
|
+
*/
|
|
20
|
+
var isNullish = function isNullish(arg) {
|
|
21
|
+
return arg === null || arg === undefined;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Assert is an array
|
|
25
|
+
*/
|
|
26
|
+
var isArray = Array.isArray;
|
|
27
|
+
var toString = Object.prototype.toString;
|
|
28
|
+
/**
|
|
29
|
+
* Assert is string
|
|
30
|
+
*/
|
|
31
|
+
var isString = function isString(arg) {
|
|
32
|
+
return toString.call(arg) === '[object String]';
|
|
33
|
+
};
|
|
34
|
+
exports.isArray = isArray;
|
|
35
|
+
exports.isNullish = isNullish;
|
|
36
|
+
exports.isString = isString;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
var css_248z = ".hi-v5-layout {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;min-width: 0;min-height: 0;}.hi-v5-sider {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: relative;width: auto;height: 100%;overflow: auto;}.hi-v5-sider--collapsed {-webkit-transition: width 0.4s;transition: width 0.4s;}.hi-v5-sider__resizable-handler {position: absolute;z-index: 9;top: 0;right: 0;width: 2px;height: 100%;border-left: 2px solid transparent;border-right: 2px solid transparent;cursor: col-resize;background-color: #2b64ff;background-clip: content-box;opacity: 0;-webkit-transition: opacity 0.2s;transition: opacity 0.2s;}.hi-v5-sider__resizable-handler:hover {opacity: 1;}.hi-v5-sider .hi-v5-scrollbar__wrapper {width: auto;}.hi-v5-sider .hi-v5-menu {width: auto;height: auto;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner {margin-bottom: var(--hi-v5-spacing-4, 8px) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner:not(.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active):hover {background-color: rgba(124, 135, 166, 0.15);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active {background-color: #fff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__icon {color: #7c87a6;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__arrow {color: #60636b;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-submenu .hi-v5-menu-item__inner {margin-bottom: 0 !important;}.hi-v5-menu-popmenu {width: 160px !important;}.hi-v5-content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: 0 16px;overflow: auto;}.hi-v5-search-trigger {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;height: 32px;margin: 0 8px 12px;font-size: 16px;color: var(--hi-v5-color-gray-500, #91959e);background-color: rgba(113, 126, 163, 0.1);cursor: pointer;border-radius: 9999px;}.hi-v5-search-trigger:not(.hi-v5-search-trigger--mini) {padding: 0 12px;}.hi-v5-search-trigger--mini {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;width: 32px;margin-left: auto;margin-right: auto;}.hi-v5-search-trigger__placeholder {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}";
|
|
15
|
+
var css_248z = ".hi-v5-layout {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;position: relative;min-width: 0;min-height: 0;}.hi-v5-layout--direction-row {-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;}.hi-v5-layout--direction-column {-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;}.hi-v5-header {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 0;-ms-flex: 0 0 auto;flex: 0 0 auto;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-sider {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: relative;width: auto;height: 100%;overflow: hidden;-webkit-box-shadow: 1px 0 0 0 var(--hi-v5-color-gray-200, #e6e8eb);box-shadow: 1px 0 0 0 var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-sider--collapsed {-webkit-transition: width 0.4s;transition: width 0.4s;}.hi-v5-sider__resizable-handler {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;z-index: 9;top: 0;right: -2px;width: 2px;height: 100%;border-left: 2px solid transparent;border-right: 2px solid transparent;cursor: col-resize;background-color: #2b64ff;background-clip: content-box;opacity: 0;-webkit-transition: opacity 0.2s;transition: opacity 0.2s;}.hi-v5-sider__resizable-handler:hover {opacity: 1;}.hi-v5-sider .hi-v5-scrollbar__wrapper {width: auto;}.hi-v5-sider .hi-v5-menu {width: auto;height: auto;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner {margin-bottom: var(--hi-v5-spacing-4, 8px) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner:not(.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active):hover {background-color: rgba(124, 135, 166, 0.15);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active {background-color: #fff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p {background-color: var(--hi-v5-color-static-white, #fff);}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p-p .hi-v5-menu-item__icon {color: #2b64ff;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__inner--mini .hi-v5-menu-item__inner--active-p:hover {background-color: var(--hi-v5-color-static-white, #fff) !important;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__icon {color: #7c87a6;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-item__arrow {color: #60636b;}.hi-v5-sider .hi-v5-menu--vertical .hi-v5-menu-submenu .hi-v5-menu-item__inner {margin-bottom: 0 !important;}.hi-v5-menu-popmenu {width: 160px !important;}.hi-v5-content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: 0 16px;overflow: auto;}.hi-v5-footer {-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-box-flex: 0;-ms-flex: 0 0 auto;flex: 0 0 auto;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-search-trigger {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;height: 32px;margin: 0 8px 12px;font-size: 16px;color: var(--hi-v5-color-gray-500, #91959e);background-color: rgba(113, 126, 163, 0.1);cursor: pointer;border-radius: 9999px;}.hi-v5-search-trigger:not(.hi-v5-search-trigger--mini) {padding: 0 12px;}.hi-v5-search-trigger--mini {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;width: 32px;margin-left: auto;margin-right: auto;}.hi-v5-search-trigger__placeholder {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-search-trigger__popper-container {border-radius: var(--hi-v5-border-radius-xl, 8px) !important;border: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-100, #edeff2);}.hi-v5-float-menu-container {-webkit-box-sizing: border-box;box-sizing: border-box;position: relative;width: 0;height: 100%;background: transparent;}.hi-v5-float-menu-container-content {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;position: absolute;top: 0;left: 0;height: 100%;padding: var(--hi-v5-spacing-6, 12px) 0;background-color: #f5f8fc;opacity: 0;-webkit-transition: opacity 0.3s;transition: opacity 0.3s;}.hi-v5-float-menu-container-content-wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto;}.hi-v5-float-menu-container-content--show {opacity: 1;}.hi-v5-float-menu-container-content--collapsed {z-index: 2000;border-top-right-radius: 12px;border-bottom-right-radius: 12px;-webkit-box-shadow: 6px 0 18px 6px rgba(26, 29, 38, 0.03), 4px 0 4px 0 rgba(26, 29, 38, 0.03);box-shadow: 6px 0 18px 6px rgba(26, 29, 38, 0.03), 4px 0 4px 0 rgba(26, 29, 38, 0.03);}.hi-v5-float-menu-container-content--collapsed .hi-v5-float-menu-container-collapse-icon {-webkit-transform: scaleX(-1);transform: scaleX(-1);}.hi-v5-float-menu-container-collapse {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: var(--hi-v5-height-6, 24px);padding: 0 var(--hi-v5-spacing-4, 8px);color: var(--hi-v5-color-gray-600, #60636b);cursor: pointer;white-space: nowrap;}.hi-v5-float-menu-container-collapse:hover {border-radius: var(--hi-v5-border-radius-lg, 6px);color: #565a66;background-color: var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-float-menu-container-collapse-wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;padding: var(--hi-v5-spacing-4, 8px) var(--hi-v5-spacing-8, 16px);}.hi-v5-float-menu-container-collapse-icon {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;font-size: var(--hi-v5-text-size-lg, 1rem);}.hi-v5-float-menu-container-collapse-text {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);margin-left: var(--hi-v5-spacing-2, 4px);}.hi-v5-app-list-wrapper {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;gap: 8px;}.hi-v5-app-list-item {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-ms-flex-negative: 0;flex-shrink: 0;gap: 8px;width: 256px;height: var(--hi-v5-height-12, 48px);padding: 0 var(--hi-v5-spacing-6, 12px);border: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-100, #edeff2);border-radius: var(--hi-v5-border-radius-lg, 6px);overflow: hidden;cursor: pointer;}.hi-v5-app-list-item:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-app-list-item__icon {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;overflow: hidden;width: var(--hi-v5-height-6, 24px);height: var(--hi-v5-height-6, 24px);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);border-radius: var(--hi-v5-border-radius-lg, 6px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-medium, 500);color: var(--hi-v5-color-static-white, #fff);background-color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-app-list-item__title {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-app-list-item__checked {display: none;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-app-list-item--active .hi-v5-app-list-item__title {font-weight: var(--hi-v5-text-weight-medium, 500);}.hi-v5-app-list-item--active .hi-v5-app-list-item__checked {display: block;}.hi-v5-profile {width: 240px;}.hi-v5-profile__header {padding: var(--hi-v5-spacing-8, 16px) var(--hi-v5-spacing-8, 16px) var(--hi-v5-spacing-4, 8px);font-size: var(--hi-v5-text-size-lg, 1rem);line-height: var(--hi-v5-text-lineheight-lg, 1.5rem);font-weight: var(--hi-v5-text-weight-medium, 500);}.hi-v5-profile__settings {padding: var(--hi-v5-spacing-4, 8px);}.hi-v5-profile__settings-item {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: start;-ms-flex-align: start;align-items: flex-start;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-lg, 6px);cursor: pointer;}.hi-v5-profile__settings-item:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-profile__settings-item__title {font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__settings-item__subtitle {font-size: var(--hi-v5-text-size-sm, 0.75rem);line-height: var(--hi-v5-text-lineheight-sm, 1.25rem);font-weight: var(--hi-v5-text-weight-medium, 500);color: var(--hi-v5-color-gray-500, #91959e);}.hi-v5-profile__settings-item__arrow {font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-500, #91959e);}.hi-v5-profile__settings-item-leaf {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;height: 40px;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-md, 4px);cursor: pointer;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__settings-item-leaf:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}.hi-v5-profile__settings-item-leaf--checked {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-profile__footer {padding: var(--hi-v5-spacing-4, 8px);border-top: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-200, #e6e8eb);}.hi-v5-profile__footer__content {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: var(--hi-v5-spacing-4, 8px);border-radius: var(--hi-v5-border-radius-lg, 6px);cursor: pointer;font-size: var(--hi-v5-text-size-md, 0.875rem);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);}.hi-v5-profile__footer__content:hover {background-color: var(--hi-v5-color-gray-50, #f2f4f7);}";
|
|
16
16
|
var __styleInject__ = require('@hi-ui/style-inject')["default"];
|
|
17
17
|
__styleInject__(css_248z);
|
|
18
18
|
exports["default"] = css_248z;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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, { forwardRef, useCallback } from 'react';
|
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
+
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
|
15
|
+
import { useUncontrolledToggle } from './packages/hooks/use-toggle/lib/esm/index.js';
|
|
16
|
+
import { Popover } from './packages/ui/popover/lib/esm/index.js';
|
|
17
|
+
import './packages/icons/lib/esm/styles/index.scss.js';
|
|
18
|
+
import { CheckOutlined } from './packages/icons/lib/esm/components/alert/check-outlined.js';
|
|
19
|
+
var APP_LIST_PREFIX = getPrefixCls('app-list');
|
|
20
|
+
/**
|
|
21
|
+
* 应用列表组件
|
|
22
|
+
*/
|
|
23
|
+
var AppList = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
24
|
+
var _a$prefixCls = _a.prefixCls,
|
|
25
|
+
prefixCls = _a$prefixCls === void 0 ? APP_LIST_PREFIX : _a$prefixCls,
|
|
26
|
+
_a$role = _a.role,
|
|
27
|
+
role = _a$role === void 0 ? 'app-list' : _a$role,
|
|
28
|
+
className = _a.className,
|
|
29
|
+
data = _a.data,
|
|
30
|
+
activeIdProp = _a.activeId,
|
|
31
|
+
defaultActiveId = _a.defaultActiveId,
|
|
32
|
+
titleRender = _a.titleRender,
|
|
33
|
+
onItemClick = _a.onItemClick,
|
|
34
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "data", "activeId", "defaultActiveId", "titleRender", "onItemClick"]);
|
|
35
|
+
var cls = cx(prefixCls, className);
|
|
36
|
+
var _useUncontrolledState = useUncontrolledState(defaultActiveId, activeIdProp),
|
|
37
|
+
activeId = _useUncontrolledState[0],
|
|
38
|
+
tryChangeActiveId = _useUncontrolledState[1];
|
|
39
|
+
var handleItemClick = useCallback(function (item, event) {
|
|
40
|
+
tryChangeActiveId(item.id);
|
|
41
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, event);
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
}, [tryChangeActiveId, onItemClick]);
|
|
44
|
+
var renderIcon = useCallback(function (item) {
|
|
45
|
+
var icon = item.icon,
|
|
46
|
+
title = item.title;
|
|
47
|
+
if (!icon) {
|
|
48
|
+
if (typeof title === 'string') {
|
|
49
|
+
return title.slice(0, 1);
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return icon;
|
|
54
|
+
}, []);
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
56
|
+
ref: ref,
|
|
57
|
+
role: role,
|
|
58
|
+
className: cls
|
|
59
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: prefixCls + "-wrapper"
|
|
61
|
+
}, data === null || data === void 0 ? void 0 : data.map(function (item) {
|
|
62
|
+
var _cx;
|
|
63
|
+
var id = item.id,
|
|
64
|
+
title = item.title,
|
|
65
|
+
iconBgColor = item.iconBgColor;
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: cx(prefixCls + "-item", (_cx = {}, _cx[prefixCls + "-item--active"] = activeId === id, _cx)),
|
|
68
|
+
key: id,
|
|
69
|
+
onClick: function onClick(event) {
|
|
70
|
+
return handleItemClick(item, event);
|
|
71
|
+
}
|
|
72
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: cx(prefixCls + "-item__icon"),
|
|
74
|
+
style: {
|
|
75
|
+
backgroundColor: iconBgColor ? IconBgColorMap[iconBgColor] : undefined
|
|
76
|
+
}
|
|
77
|
+
}, renderIcon(item)), /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: prefixCls + "-item__title"
|
|
79
|
+
}, (titleRender === null || titleRender === void 0 ? void 0 : titleRender(item)) || title), /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: prefixCls + "-item__checked"
|
|
81
|
+
}, /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
82
|
+
})));
|
|
83
|
+
});
|
|
84
|
+
var IconBgColorMap = {
|
|
85
|
+
// 深蓝色、浅蓝色、青色、绿色、紫色、黄色、橙色
|
|
86
|
+
BLUE: '#2660ff',
|
|
87
|
+
SKYBLUE: '#0aadff',
|
|
88
|
+
CYAN: '#04c2ac',
|
|
89
|
+
GREEN: '#24b237',
|
|
90
|
+
PURPLE: '#7f3df2',
|
|
91
|
+
YELLOW: '#ffbe0a',
|
|
92
|
+
ORANGE: '#ff7700'
|
|
93
|
+
};
|
|
94
|
+
if (__DEV__) {
|
|
95
|
+
AppList.displayName = 'AppList';
|
|
96
|
+
}
|
|
97
|
+
var AppListPopover = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
98
|
+
var onOpen = _a.onOpen,
|
|
99
|
+
onClose = _a.onClose,
|
|
100
|
+
visibleProp = _a.visible,
|
|
101
|
+
children = _a.children,
|
|
102
|
+
data = _a.data,
|
|
103
|
+
defaultActiveId = _a.defaultActiveId,
|
|
104
|
+
activeId = _a.activeId,
|
|
105
|
+
titleRender = _a.titleRender,
|
|
106
|
+
onItemClick = _a.onItemClick,
|
|
107
|
+
restProps = __rest(_a, ["onOpen", "onClose", "visible", "children", "data", "defaultActiveId", "activeId", "titleRender", "onItemClick"]);
|
|
108
|
+
var _useUncontrolledToggl = useUncontrolledToggle({
|
|
109
|
+
defaultVisible: false,
|
|
110
|
+
visible: visibleProp
|
|
111
|
+
}),
|
|
112
|
+
visible = _useUncontrolledToggl[0],
|
|
113
|
+
visibleAction = _useUncontrolledToggl[1];
|
|
114
|
+
var handleOpen = useCallback(function () {
|
|
115
|
+
visibleAction.on();
|
|
116
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
117
|
+
}, [onOpen, visibleAction]);
|
|
118
|
+
var handleClose = useCallback(function () {
|
|
119
|
+
visibleAction.off();
|
|
120
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
121
|
+
}, [onClose, visibleAction]);
|
|
122
|
+
return /*#__PURE__*/React.createElement(Popover, Object.assign({
|
|
123
|
+
style: {
|
|
124
|
+
boxSizing: 'border-box',
|
|
125
|
+
paddingLeft: 12,
|
|
126
|
+
paddingRight: 12,
|
|
127
|
+
maxHeight: 408,
|
|
128
|
+
overflow: 'auto'
|
|
129
|
+
},
|
|
130
|
+
visible: visible,
|
|
131
|
+
arrow: false,
|
|
132
|
+
placement: "right-start",
|
|
133
|
+
gutterGap: 4,
|
|
134
|
+
content: /*#__PURE__*/React.createElement(AppList, {
|
|
135
|
+
ref: ref,
|
|
136
|
+
data: data,
|
|
137
|
+
defaultActiveId: defaultActiveId,
|
|
138
|
+
activeId: activeId,
|
|
139
|
+
titleRender: titleRender,
|
|
140
|
+
onItemClick: onItemClick
|
|
141
|
+
}),
|
|
142
|
+
onOpen: handleOpen,
|
|
143
|
+
onClose: handleClose
|
|
144
|
+
}, restProps), children);
|
|
145
|
+
});
|
|
146
|
+
if (__DEV__) {
|
|
147
|
+
AppListPopover.displayName = 'AppListPopover';
|
|
148
|
+
}
|
|
149
|
+
export { AppList, AppListPopover, IconBgColorMap };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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
|
+
var CollapseIcon = function CollapseIcon() {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
13
|
+
width: "16",
|
|
14
|
+
height: "16",
|
|
15
|
+
viewBox: "0 0 16 16",
|
|
16
|
+
fill: "none",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
18
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
d: "M10 3L13 3",
|
|
20
|
+
stroke: "#60636B",
|
|
21
|
+
strokeWidth: "1.4",
|
|
22
|
+
strokeLinecap: "round",
|
|
23
|
+
strokeLinejoin: "round"
|
|
24
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
d: "M10 8L13 8",
|
|
26
|
+
stroke: "#60636B",
|
|
27
|
+
strokeWidth: "1.4",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
+
d: "M3 13L13 13",
|
|
32
|
+
stroke: "#60636B",
|
|
33
|
+
strokeWidth: "1.4",
|
|
34
|
+
strokeLinecap: "round",
|
|
35
|
+
strokeLinejoin: "round"
|
|
36
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M6 8L3 5.5L6 3",
|
|
38
|
+
stroke: "#60636B",
|
|
39
|
+
strokeWidth: "1.4",
|
|
40
|
+
strokeLinecap: "round",
|
|
41
|
+
strokeLinejoin: "round"
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
export { CollapseIcon };
|
package/lib/esm/Content.js
CHANGED
|
@@ -12,9 +12,6 @@ import React, { forwardRef } from 'react';
|
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
14
|
var CONTENT_PREFIX = getPrefixCls('content');
|
|
15
|
-
/**
|
|
16
|
-
* 内容区域组件
|
|
17
|
-
*/
|
|
18
15
|
var Content = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
19
16
|
var _a$prefixCls = _a.prefixCls,
|
|
20
17
|
prefixCls = _a$prefixCls === void 0 ? CONTENT_PREFIX : _a$prefixCls,
|
|
@@ -24,7 +21,7 @@ var Content = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
24
21
|
children = _a.children,
|
|
25
22
|
rest = __rest(_a, ["prefixCls", "role", "className", "children"]);
|
|
26
23
|
var cls = cx(prefixCls, className);
|
|
27
|
-
return /*#__PURE__*/React.createElement("
|
|
24
|
+
return /*#__PURE__*/React.createElement("main", Object.assign({
|
|
28
25
|
ref: ref,
|
|
29
26
|
role: role,
|
|
30
27
|
className: cls
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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, { forwardRef } from 'react';
|
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
+
import { useLocaleContext } from '@hi-ui/core';
|
|
15
|
+
import { CollapseIcon } from './CollapseIcon.js';
|
|
16
|
+
var FLOAT_MENU_CONTAINER_PREFIX = getPrefixCls('float-menu-container');
|
|
17
|
+
/**
|
|
18
|
+
* 浮动菜单容器组件
|
|
19
|
+
*/
|
|
20
|
+
var FloatMenuContainer = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
21
|
+
var _cx;
|
|
22
|
+
var _a$prefixCls = _a.prefixCls,
|
|
23
|
+
prefixCls = _a$prefixCls === void 0 ? FLOAT_MENU_CONTAINER_PREFIX : _a$prefixCls,
|
|
24
|
+
_a$role = _a.role,
|
|
25
|
+
role = _a$role === void 0 ? 'float-menu-container' : _a$role,
|
|
26
|
+
className = _a.className,
|
|
27
|
+
children = _a.children,
|
|
28
|
+
visibleProp = _a.visible,
|
|
29
|
+
width = _a.width,
|
|
30
|
+
_a$collapsed = _a.collapsed,
|
|
31
|
+
collapsedProp = _a$collapsed === void 0 ? true : _a$collapsed,
|
|
32
|
+
onCollapse = _a.onCollapse,
|
|
33
|
+
zIndex = _a.zIndex,
|
|
34
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "children", "visible", "width", "collapsed", "onCollapse", "zIndex"]);
|
|
35
|
+
var cls = cx(prefixCls, className);
|
|
36
|
+
var i18n = useLocaleContext();
|
|
37
|
+
var _React$useState = React.useState(collapsedProp),
|
|
38
|
+
collapsed = _React$useState[0],
|
|
39
|
+
setCollapsed = _React$useState[1];
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
setCollapsed(collapsedProp);
|
|
42
|
+
}, [collapsedProp]);
|
|
43
|
+
var visible = React.useMemo(function () {
|
|
44
|
+
return collapsed ? visibleProp : true;
|
|
45
|
+
}, [collapsed, visibleProp]);
|
|
46
|
+
var handleCollapse = function handleCollapse() {
|
|
47
|
+
var newCollapsed = !collapsed;
|
|
48
|
+
setCollapsed(newCollapsed);
|
|
49
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse(newCollapsed);
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
52
|
+
ref: ref,
|
|
53
|
+
role: role,
|
|
54
|
+
className: cls
|
|
55
|
+
}, rest, {
|
|
56
|
+
style: visible ? {
|
|
57
|
+
width: collapsed ? 0 : width
|
|
58
|
+
} : {}
|
|
59
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: cx(prefixCls + "-content", (_cx = {}, _cx[prefixCls + "-content--show"] = visible, _cx[prefixCls + "-content--collapsed"] = collapsed, _cx)),
|
|
61
|
+
style: {
|
|
62
|
+
zIndex: zIndex,
|
|
63
|
+
width: visible ? width : 0
|
|
64
|
+
}
|
|
65
|
+
}, visible && ( /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: cx(prefixCls + "-collapse-wrapper")
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: cx(prefixCls + "-collapse"),
|
|
69
|
+
onClick: handleCollapse
|
|
70
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: cx(prefixCls + "-collapse-icon")
|
|
72
|
+
}, /*#__PURE__*/React.createElement(CollapseIcon, null)), /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
className: cx(prefixCls + "-collapse-text")
|
|
74
|
+
}, collapsed ? i18n.timeline.expand : i18n.timeline.collapse)))), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: cx(prefixCls + "-content-wrapper")
|
|
76
|
+
}, children)));
|
|
77
|
+
});
|
|
78
|
+
if (__DEV__) {
|
|
79
|
+
FloatMenuContainer.displayName = 'FloatMenuContainer';
|
|
80
|
+
}
|
|
81
|
+
export { FloatMenuContainer };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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, { forwardRef } from 'react';
|
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
+
var HEADER_PREFIX = getPrefixCls('footer');
|
|
15
|
+
var Footer = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
16
|
+
var _a$prefixCls = _a.prefixCls,
|
|
17
|
+
prefixCls = _a$prefixCls === void 0 ? HEADER_PREFIX : _a$prefixCls,
|
|
18
|
+
_a$role = _a.role,
|
|
19
|
+
role = _a$role === void 0 ? 'footer' : _a$role,
|
|
20
|
+
className = _a.className,
|
|
21
|
+
children = _a.children,
|
|
22
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "children"]);
|
|
23
|
+
var cls = cx(prefixCls, className);
|
|
24
|
+
return /*#__PURE__*/React.createElement("footer", Object.assign({
|
|
25
|
+
ref: ref,
|
|
26
|
+
role: role,
|
|
27
|
+
className: cls
|
|
28
|
+
}, rest), children);
|
|
29
|
+
});
|
|
30
|
+
if (__DEV__) {
|
|
31
|
+
Footer.displayName = 'Footer';
|
|
32
|
+
}
|
|
33
|
+
export { Footer };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/layout
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/layout#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, { forwardRef } from 'react';
|
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
|
+
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
+
var HEADER_PREFIX = getPrefixCls('header');
|
|
15
|
+
var Header = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
16
|
+
var _a$prefixCls = _a.prefixCls,
|
|
17
|
+
prefixCls = _a$prefixCls === void 0 ? HEADER_PREFIX : _a$prefixCls,
|
|
18
|
+
_a$role = _a.role,
|
|
19
|
+
role = _a$role === void 0 ? 'header' : _a$role,
|
|
20
|
+
className = _a.className,
|
|
21
|
+
children = _a.children,
|
|
22
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "children"]);
|
|
23
|
+
var cls = cx(prefixCls, className);
|
|
24
|
+
return /*#__PURE__*/React.createElement("header", Object.assign({
|
|
25
|
+
ref: ref,
|
|
26
|
+
role: role,
|
|
27
|
+
className: cls
|
|
28
|
+
}, rest), children);
|
|
29
|
+
});
|
|
30
|
+
if (__DEV__) {
|
|
31
|
+
Header.displayName = 'Header';
|
|
32
|
+
}
|
|
33
|
+
export { Header };
|
package/lib/esm/Layout.js
CHANGED
|
@@ -22,8 +22,10 @@ var Layout = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
22
22
|
role = _a$role === void 0 ? 'layout' : _a$role,
|
|
23
23
|
className = _a.className,
|
|
24
24
|
children = _a.children,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
_a$direction = _a.direction,
|
|
26
|
+
direction = _a$direction === void 0 ? 'row' : _a$direction,
|
|
27
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "children", "direction"]);
|
|
28
|
+
var cls = cx(prefixCls, className, prefixCls + "--direction-" + direction);
|
|
27
29
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
28
30
|
ref: ref,
|
|
29
31
|
role: role,
|