@teamix/pro 1.5.18 → 1.5.19
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/dist/pro.all.min.css +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +1283 -129
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.xconsole.min.css +1 -1
- package/es/form/Filter/index.scss +1 -0
- package/es/form/Filter/index2.scss +1 -0
- package/es/image/index.d.ts +21 -0
- package/es/image/index.js +72 -0
- package/es/image/index.scss +3 -0
- package/es/index.d.ts +4 -2
- package/es/index.js +4 -2
- package/es/sidebar/utils/index.d.ts +1 -1
- package/es/sidebar/utils/index.js +7 -0
- package/es/table/components/CardView/index.js +6 -11
- package/es/table/components/ToolBar/index.js +10 -7
- package/es/table/index.js +3 -1
- package/es/table/typing.d.ts +4 -0
- package/es/xconsole.scss +23 -0
- package/lib/form/Filter/index.scss +1 -0
- package/lib/form/Filter/index2.scss +1 -0
- package/lib/image/index.d.ts +21 -0
- package/lib/image/index.js +82 -0
- package/lib/image/index.scss +3 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +20 -1
- package/lib/sidebar/utils/index.d.ts +1 -1
- package/lib/sidebar/utils/index.js +7 -0
- package/lib/table/components/CardView/index.js +5 -10
- package/lib/table/components/ToolBar/index.js +10 -7
- package/lib/table/index.js +3 -1
- package/lib/table/typing.d.ts +4 -0
- package/lib/xconsole.scss +23 -0
- package/package.json +1 -1
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare type ProImageProps = {
|
2
|
+
src: {
|
3
|
+
/** 中文亮色图片地址,默认 url */
|
4
|
+
'cn-light': string;
|
5
|
+
/** 英文文亮色图片地址 */
|
6
|
+
'en-light'?: string;
|
7
|
+
/** 繁体亮色图片地址 */
|
8
|
+
'tw-light'?: string;
|
9
|
+
/** 中文暗色图片地址 */
|
10
|
+
'cn-dark'?: string;
|
11
|
+
/** 英文暗色图片地址 */
|
12
|
+
'en-dark'?: string;
|
13
|
+
/** 繁体暗色图片地址 */
|
14
|
+
'tw-dark'?: string;
|
15
|
+
} & Record<string, string>;
|
16
|
+
theme?: 'dark' | 'light';
|
17
|
+
/** 自定义改造 url 的函数 */
|
18
|
+
transformUrl?: (value: string) => string;
|
19
|
+
};
|
20
|
+
declare const _default: (props: ProImageProps) => JSX.Element | null;
|
21
|
+
export default _default;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
var _excluded = ["src", "transformUrl"];
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
12
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
13
|
+
import { getLanguage } from '@teamix/utils';
|
14
|
+
import React, { useState } from 'react';
|
15
|
+
import { useMutationObserver } from 'ahooks';
|
16
|
+
var localeMap = {
|
17
|
+
'en-us': 'en',
|
18
|
+
'zh-cn': 'cn',
|
19
|
+
'zh-tW': 'tw'
|
20
|
+
};
|
21
|
+
export default (function (props) {
|
22
|
+
var src = props.src,
|
23
|
+
transformUrl = props.transformUrl,
|
24
|
+
extra = _objectWithoutProperties(props, _excluded);
|
25
|
+
var _useState = useState(props.theme || 'light'),
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
27
|
+
theme = _useState2[0],
|
28
|
+
setTheme = _useState2[1];
|
29
|
+
var targetSrc = src ? src['cn-light'] : '';
|
30
|
+
var lan = localeMap[getLanguage().toLowerCase()] || 'cn';
|
31
|
+
function getTheme() {
|
32
|
+
var _window$getComputedSt, _window;
|
33
|
+
var cssTheme = (_window$getComputedSt = (_window = window).getComputedStyle) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.call(_window, window.document.body).getPropertyValue('--alicloudfe-components-theme').trim();
|
34
|
+
if (cssTheme.indexOf('-dark') !== -1) {
|
35
|
+
return 'dark';
|
36
|
+
} else {
|
37
|
+
return 'light';
|
38
|
+
}
|
39
|
+
}
|
40
|
+
function setImgTheme() {
|
41
|
+
setTheme(props.theme || getTheme());
|
42
|
+
}
|
43
|
+
useMutationObserver(function (mutationsList) {
|
44
|
+
mutationsList.forEach(function (mutation) {
|
45
|
+
if (mutation.attributeName === 'class') {
|
46
|
+
setImgTheme();
|
47
|
+
}
|
48
|
+
});
|
49
|
+
}, document.querySelector('html'), {
|
50
|
+
attributes: true
|
51
|
+
});
|
52
|
+
useMutationObserver(function (mutationsList) {
|
53
|
+
mutationsList.forEach(function (mutation) {
|
54
|
+
if (mutation.attributeName === 'class') {
|
55
|
+
setImgTheme();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
}, document.body, {
|
59
|
+
attributes: true
|
60
|
+
});
|
61
|
+
// const theme = props.theme || getTheme() || 'light';
|
62
|
+
targetSrc = src["".concat(lan, "-").concat(theme)] || src["".concat(lan, "-light")] || src["cn-".concat(theme)] || src['cn-light'];
|
63
|
+
if (targetSrc && transformUrl) {
|
64
|
+
targetSrc = transformUrl(targetSrc);
|
65
|
+
}
|
66
|
+
if (!targetSrc) {
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
return /*#__PURE__*/React.createElement("img", _objectSpread({
|
70
|
+
src: targetSrc
|
71
|
+
}, extra));
|
72
|
+
});
|
package/es/index.d.ts
CHANGED
@@ -11,6 +11,7 @@ import ProSkeleton from './skeleton';
|
|
11
11
|
import utils from './utils';
|
12
12
|
import ProSidebar from './sidebar';
|
13
13
|
import { ProTimeline } from './timeline';
|
14
|
+
import ProImage from './image';
|
14
15
|
import * as nocode from './nocode';
|
15
16
|
import * as templates from './templates';
|
16
17
|
import TeamixIcon from '@teamix/icon';
|
@@ -28,5 +29,6 @@ export * from './table';
|
|
28
29
|
export * from './sidebar';
|
29
30
|
export * from './utils';
|
30
31
|
export * from './timeline';
|
31
|
-
|
32
|
-
|
32
|
+
export * from './image';
|
33
|
+
declare const version = "1.5.19";
|
34
|
+
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -13,6 +13,7 @@ import ProSkeleton from './skeleton';
|
|
13
13
|
import utils from './utils';
|
14
14
|
import ProSidebar from './sidebar';
|
15
15
|
import { ProTimeline } from './timeline';
|
16
|
+
import ProImage from './image';
|
16
17
|
import * as nocode from './nocode';
|
17
18
|
import * as templates from './templates';
|
18
19
|
import TeamixIcon from '@teamix/icon';
|
@@ -35,7 +36,8 @@ export * from './table';
|
|
35
36
|
export * from './sidebar';
|
36
37
|
export * from './utils';
|
37
38
|
export * from './timeline';
|
38
|
-
|
39
|
+
export * from './image';
|
40
|
+
var version = '1.5.19';
|
39
41
|
// By TeamixTest
|
40
42
|
window.postMessage({
|
41
43
|
source: 'teamix-test-devtools',
|
@@ -48,4 +50,4 @@ window.postMessage({
|
|
48
50
|
}, '*');
|
49
51
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo,
|
50
52
|
// ProLayout,
|
51
|
-
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
53
|
+
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils };
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ProSidebarDataSourceItem } from '../typing';
|
1
2
|
/**
|
2
3
|
* 深度遍历节点
|
3
4
|
* @param data 数据
|
@@ -5,7 +6,6 @@
|
|
5
6
|
* @param aliasMap 标识
|
6
7
|
* @param level 深度
|
7
8
|
*/
|
8
|
-
import { ProSidebarDataSourceItem } from '../typing';
|
9
9
|
export declare function loop<T>(data: T[], func: any, aliasMap?: {
|
10
10
|
children: string;
|
11
11
|
}, level?: number): void;
|
@@ -17,6 +17,13 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
17
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
18
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
20
|
+
/**
|
21
|
+
* 深度遍历节点
|
22
|
+
* @param data 数据
|
23
|
+
* @param func 处理方法
|
24
|
+
* @param aliasMap 标识
|
25
|
+
* @param level 深度
|
26
|
+
*/
|
20
27
|
export function loop(data, func, aliasMap) {
|
21
28
|
var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
22
29
|
var _ref = aliasMap !== null && aliasMap !== void 0 ? aliasMap : {},
|
@@ -10,13 +10,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
11
|
import React, { isValidElement, useEffect, useMemo, useState } from 'react';
|
12
12
|
import { Grid, Loading } from '@alicloudfe/components';
|
13
|
-
import { getDeepValue,
|
13
|
+
import { getDeepValue, ProCard, ProInfo } from '../../../';
|
14
14
|
import { ProSkeletonRaw } from '../../../skeleton';
|
15
15
|
import { usePrefixCls } from '@teamix/utils';
|
16
16
|
import './index.scss';
|
17
17
|
import { renderCell } from '../../utils/columnRender';
|
18
18
|
import LoadMore from '../LoadMore';
|
19
|
-
import
|
19
|
+
import { EmptyContent } from '@teamix/pro-field';
|
20
20
|
var Row = Grid.Row,
|
21
21
|
Col = Grid.Col;
|
22
22
|
var cls = usePrefixCls('teamix-pro-table-card-view');
|
@@ -35,7 +35,9 @@ var CardView = function CardView(props) {
|
|
35
35
|
context = props.context,
|
36
36
|
scrollHeight = props.scrollHeight,
|
37
37
|
_props$showSkeleton = props.showSkeleton,
|
38
|
-
showSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton
|
38
|
+
showSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton,
|
39
|
+
emptyProps = props.emptyProps,
|
40
|
+
emptyContent = props.emptyContent;
|
39
41
|
// 加载状态
|
40
42
|
var _useState = useState('none'),
|
41
43
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -358,14 +360,7 @@ var CardView = function CardView(props) {
|
|
358
360
|
};
|
359
361
|
// 渲染卡片主体
|
360
362
|
var renderCardBox = function renderCardBox() {
|
361
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, skeletonVisible && /*#__PURE__*/React.createElement(ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && /*#__PURE__*/React.createElement(
|
362
|
-
theme: "hybridcloud-container",
|
363
|
-
img: "noData",
|
364
|
-
title: getMessage('noData'),
|
365
|
-
style: {
|
366
|
-
padding: '50px 0 60px'
|
367
|
-
}
|
368
|
-
}), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/React.createElement(Row, {
|
363
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, skeletonVisible && /*#__PURE__*/React.createElement(ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && !emptyContent && /*#__PURE__*/React.createElement(EmptyContent, _objectSpread({}, emptyProps)), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && emptyContent && /*#__PURE__*/React.createElement("div", null, emptyContent), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/React.createElement(Row, {
|
369
364
|
gutter: 16,
|
370
365
|
wrap: true,
|
371
366
|
style: {
|
@@ -73,11 +73,11 @@ var ToolBar = function ToolBar(props) {
|
|
73
73
|
useEffect(debounce(function () {
|
74
74
|
if ((layoutInlineSize === null || layoutInlineSize === void 0 ? void 0 : layoutInlineSize.width) && leftWidth && toolBarContentRef.current && toolBarAutoWidth) {
|
75
75
|
var _toolBarContentRef$cu;
|
76
|
-
var width = layoutInlineSize.width
|
77
|
-
|
78
|
-
if (width - leftWidth <= ((_toolBarContentRef$cu = toolBarContentRef.current) === null || _toolBarContentRef$cu === void 0 ? void 0 : _toolBarContentRef$cu.clientWidth) + 8
|
76
|
+
var width = layoutInlineSize.width;
|
77
|
+
// 60 为容错
|
78
|
+
if (width - leftWidth - 60 <= ((_toolBarContentRef$cu = toolBarContentRef.current) === null || _toolBarContentRef$cu === void 0 ? void 0 : _toolBarContentRef$cu.clientWidth) + 8) {
|
79
79
|
setFlat(false);
|
80
|
-
} else
|
80
|
+
} else {
|
81
81
|
setFlat(true);
|
82
82
|
}
|
83
83
|
}
|
@@ -142,9 +142,12 @@ var ToolBar = function ToolBar(props) {
|
|
142
142
|
})
|
143
143
|
}, Component));
|
144
144
|
}));
|
145
|
-
}, [toolBarList]);
|
145
|
+
}, [toolBarList, props.columns]);
|
146
146
|
var renderUnFlatShape = function renderUnFlatShape() {
|
147
|
-
|
147
|
+
if (toolBar === false) {
|
148
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
149
|
+
}
|
150
|
+
return /*#__PURE__*/React.createElement(Balloon.Tooltip, {
|
148
151
|
triggerType: ['click'],
|
149
152
|
popupProps: {
|
150
153
|
cache: true
|
@@ -156,7 +159,7 @@ var ToolBar = function ToolBar(props) {
|
|
156
159
|
type: "more-line"
|
157
160
|
})),
|
158
161
|
align: "tr"
|
159
|
-
}, renderFlatShape)
|
162
|
+
}, renderFlatShape);
|
160
163
|
};
|
161
164
|
return /*#__PURE__*/React.createElement("div", {
|
162
165
|
className: cls('', {
|
package/es/table/index.js
CHANGED
@@ -968,7 +968,9 @@ var ProTable = function ProTable(props) {
|
|
968
968
|
scrollHeight: fullscreenState || fixedTableBody ? "calc(100vh - ".concat(headerHeight, "px)") : undefined,
|
969
969
|
actionRef: actionRef,
|
970
970
|
context: context,
|
971
|
-
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context)
|
971
|
+
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context),
|
972
|
+
emptyProps: emptyProps,
|
973
|
+
emptyContent: otherProps === null || otherProps === void 0 ? void 0 : otherProps.emptyContent
|
972
974
|
}));
|
973
975
|
} else {
|
974
976
|
// 不传 columns 直接返回原始 Table
|
package/es/table/typing.d.ts
CHANGED
@@ -406,6 +406,10 @@ export declare type ProTableCardViewProps = {
|
|
406
406
|
cardProps?: ProTableCardProps['cardProps'];
|
407
407
|
/** 表格分页器参数 **/
|
408
408
|
tablePaginationProps?: PaginationProps;
|
409
|
+
/** 空数据配置 **/
|
410
|
+
emptyProps?: ProTableProps['emptyProps'];
|
411
|
+
/** 自定义渲染空数据 **/
|
412
|
+
emptyContent?: ProTableProps['emptyContent'];
|
409
413
|
};
|
410
414
|
export declare type ProTableBindUrlProps = {
|
411
415
|
/** 翻页器区域 **/
|
package/es/xconsole.scss
CHANGED
@@ -500,4 +500,27 @@
|
|
500
500
|
border: 0 solid #d9d9d9;
|
501
501
|
border: var(--colortag-border-width,0) solid var(--color-line1-2,#d9d9d9);
|
502
502
|
}
|
503
|
+
.teamix-pro-table-toolbar-filter-column-all-select {
|
504
|
+
.next-menu-item-inner {
|
505
|
+
display: flex;
|
506
|
+
}
|
507
|
+
}
|
508
|
+
.next-dialog-centered {
|
509
|
+
text-align: center;
|
510
|
+
}
|
511
|
+
.next-dialog-wrapper {
|
512
|
+
position: fixed;
|
513
|
+
left: 0;
|
514
|
+
top: 0;
|
515
|
+
right: 0;
|
516
|
+
bottom: 0;
|
517
|
+
|
518
|
+
.next-dialog-v2 {
|
519
|
+
margin: 40px 0;
|
520
|
+
display: inline-block;
|
521
|
+
text-align: left;
|
522
|
+
vertical-align: middle;
|
523
|
+
position: relative;
|
524
|
+
}
|
525
|
+
}
|
503
526
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare type ProImageProps = {
|
2
|
+
src: {
|
3
|
+
/** 中文亮色图片地址,默认 url */
|
4
|
+
'cn-light': string;
|
5
|
+
/** 英文文亮色图片地址 */
|
6
|
+
'en-light'?: string;
|
7
|
+
/** 繁体亮色图片地址 */
|
8
|
+
'tw-light'?: string;
|
9
|
+
/** 中文暗色图片地址 */
|
10
|
+
'cn-dark'?: string;
|
11
|
+
/** 英文暗色图片地址 */
|
12
|
+
'en-dark'?: string;
|
13
|
+
/** 繁体暗色图片地址 */
|
14
|
+
'tw-dark'?: string;
|
15
|
+
} & Record<string, string>;
|
16
|
+
theme?: 'dark' | 'light';
|
17
|
+
/** 自定义改造 url 的函数 */
|
18
|
+
transformUrl?: (value: string) => string;
|
19
|
+
};
|
20
|
+
declare const _default: (props: ProImageProps) => JSX.Element | null;
|
21
|
+
export default _default;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.default = void 0;
|
8
|
+
var _utils = require("@teamix/utils");
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
10
|
+
var _ahooks = require("ahooks");
|
11
|
+
var _excluded = ["src", "transformUrl"];
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
23
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
25
|
+
var localeMap = {
|
26
|
+
'en-us': 'en',
|
27
|
+
'zh-cn': 'cn',
|
28
|
+
'zh-tW': 'tw'
|
29
|
+
};
|
30
|
+
var _default = function _default(props) {
|
31
|
+
var src = props.src,
|
32
|
+
transformUrl = props.transformUrl,
|
33
|
+
extra = _objectWithoutProperties(props, _excluded);
|
34
|
+
var _useState = (0, _react.useState)(props.theme || 'light'),
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
36
|
+
theme = _useState2[0],
|
37
|
+
setTheme = _useState2[1];
|
38
|
+
var targetSrc = src ? src['cn-light'] : '';
|
39
|
+
var lan = localeMap[(0, _utils.getLanguage)().toLowerCase()] || 'cn';
|
40
|
+
function getTheme() {
|
41
|
+
var _window$getComputedSt, _window;
|
42
|
+
var cssTheme = (_window$getComputedSt = (_window = window).getComputedStyle) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.call(_window, window.document.body).getPropertyValue('--alicloudfe-components-theme').trim();
|
43
|
+
if (cssTheme.indexOf('-dark') !== -1) {
|
44
|
+
return 'dark';
|
45
|
+
} else {
|
46
|
+
return 'light';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
function setImgTheme() {
|
50
|
+
setTheme(props.theme || getTheme());
|
51
|
+
}
|
52
|
+
(0, _ahooks.useMutationObserver)(function (mutationsList) {
|
53
|
+
mutationsList.forEach(function (mutation) {
|
54
|
+
if (mutation.attributeName === 'class') {
|
55
|
+
setImgTheme();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
}, document.querySelector('html'), {
|
59
|
+
attributes: true
|
60
|
+
});
|
61
|
+
(0, _ahooks.useMutationObserver)(function (mutationsList) {
|
62
|
+
mutationsList.forEach(function (mutation) {
|
63
|
+
if (mutation.attributeName === 'class') {
|
64
|
+
setImgTheme();
|
65
|
+
}
|
66
|
+
});
|
67
|
+
}, document.body, {
|
68
|
+
attributes: true
|
69
|
+
});
|
70
|
+
// const theme = props.theme || getTheme() || 'light';
|
71
|
+
targetSrc = src["".concat(lan, "-").concat(theme)] || src["".concat(lan, "-light")] || src["cn-".concat(theme)] || src['cn-light'];
|
72
|
+
if (targetSrc && transformUrl) {
|
73
|
+
targetSrc = transformUrl(targetSrc);
|
74
|
+
}
|
75
|
+
if (!targetSrc) {
|
76
|
+
return null;
|
77
|
+
}
|
78
|
+
return /*#__PURE__*/_react.default.createElement("img", _objectSpread({
|
79
|
+
src: targetSrc
|
80
|
+
}, extra));
|
81
|
+
};
|
82
|
+
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
@@ -11,6 +11,7 @@ import ProSkeleton from './skeleton';
|
|
11
11
|
import utils from './utils';
|
12
12
|
import ProSidebar from './sidebar';
|
13
13
|
import { ProTimeline } from './timeline';
|
14
|
+
import ProImage from './image';
|
14
15
|
import * as nocode from './nocode';
|
15
16
|
import * as templates from './templates';
|
16
17
|
import TeamixIcon from '@teamix/icon';
|
@@ -28,5 +29,6 @@ export * from './table';
|
|
28
29
|
export * from './sidebar';
|
29
30
|
export * from './utils';
|
30
31
|
export * from './timeline';
|
31
|
-
|
32
|
-
|
32
|
+
export * from './image';
|
33
|
+
declare const version = "1.5.19";
|
34
|
+
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -19,6 +19,7 @@ var _exportNames = {
|
|
19
19
|
utils: true,
|
20
20
|
ProSidebar: true,
|
21
21
|
ProTimeline: true,
|
22
|
+
ProImage: true,
|
22
23
|
nocode: true,
|
23
24
|
templates: true,
|
24
25
|
TeamixIcon: true
|
@@ -47,6 +48,12 @@ Object.defineProperty(exports, "ProForm", {
|
|
47
48
|
return _form.default;
|
48
49
|
}
|
49
50
|
});
|
51
|
+
Object.defineProperty(exports, "ProImage", {
|
52
|
+
enumerable: true,
|
53
|
+
get: function get() {
|
54
|
+
return _image.default;
|
55
|
+
}
|
56
|
+
});
|
50
57
|
Object.defineProperty(exports, "ProInfo", {
|
51
58
|
enumerable: true,
|
52
59
|
get: function get() {
|
@@ -254,6 +261,18 @@ Object.keys(_timeline).forEach(function (key) {
|
|
254
261
|
}
|
255
262
|
});
|
256
263
|
});
|
264
|
+
var _image = _interopRequireWildcard(require("./image"));
|
265
|
+
Object.keys(_image).forEach(function (key) {
|
266
|
+
if (key === "default" || key === "__esModule") return;
|
267
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
268
|
+
if (key in exports && exports[key] === _image[key]) return;
|
269
|
+
Object.defineProperty(exports, key, {
|
270
|
+
enumerable: true,
|
271
|
+
get: function get() {
|
272
|
+
return _image[key];
|
273
|
+
}
|
274
|
+
});
|
275
|
+
});
|
257
276
|
var nocode = _interopRequireWildcard(require("./nocode"));
|
258
277
|
exports.nocode = nocode;
|
259
278
|
Object.keys(nocode).forEach(function (key) {
|
@@ -280,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
280
299
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
281
300
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
282
301
|
}
|
283
|
-
var version = '1.5.
|
302
|
+
var version = '1.5.19';
|
284
303
|
// By TeamixTest
|
285
304
|
exports.version = version;
|
286
305
|
window.postMessage({
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ProSidebarDataSourceItem } from '../typing';
|
1
2
|
/**
|
2
3
|
* 深度遍历节点
|
3
4
|
* @param data 数据
|
@@ -5,7 +6,6 @@
|
|
5
6
|
* @param aliasMap 标识
|
6
7
|
* @param level 深度
|
7
8
|
*/
|
8
|
-
import { ProSidebarDataSourceItem } from '../typing';
|
9
9
|
export declare function loop<T>(data: T[], func: any, aliasMap?: {
|
10
10
|
children: string;
|
11
11
|
}, level?: number): void;
|
@@ -31,6 +31,13 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
31
31
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
32
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
33
33
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
34
|
+
/**
|
35
|
+
* 深度遍历节点
|
36
|
+
* @param data 数据
|
37
|
+
* @param func 处理方法
|
38
|
+
* @param aliasMap 标识
|
39
|
+
* @param level 深度
|
40
|
+
*/
|
34
41
|
function loop(data, func, aliasMap) {
|
35
42
|
var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
36
43
|
var _ref = aliasMap !== null && aliasMap !== void 0 ? aliasMap : {},
|
@@ -12,7 +12,7 @@ var _utils = require("@teamix/utils");
|
|
12
12
|
require("./index.scss");
|
13
13
|
var _columnRender = require("../../utils/columnRender");
|
14
14
|
var _LoadMore = _interopRequireDefault(require("../LoadMore"));
|
15
|
-
var
|
15
|
+
var _proField = require("@teamix/pro-field");
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -44,7 +44,9 @@ var CardView = function CardView(props) {
|
|
44
44
|
context = props.context,
|
45
45
|
scrollHeight = props.scrollHeight,
|
46
46
|
_props$showSkeleton = props.showSkeleton,
|
47
|
-
showSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton
|
47
|
+
showSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton,
|
48
|
+
emptyProps = props.emptyProps,
|
49
|
+
emptyContent = props.emptyContent;
|
48
50
|
// 加载状态
|
49
51
|
var _useState = (0, _react.useState)('none'),
|
50
52
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -367,14 +369,7 @@ var CardView = function CardView(props) {
|
|
367
369
|
};
|
368
370
|
// 渲染卡片主体
|
369
371
|
var renderCardBox = function renderCardBox() {
|
370
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, skeletonVisible && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && /*#__PURE__*/_react.default.createElement(
|
371
|
-
theme: "hybridcloud-container",
|
372
|
-
img: "noData",
|
373
|
-
title: (0, _.getMessage)('noData'),
|
374
|
-
style: {
|
375
|
-
padding: '50px 0 60px'
|
376
|
-
}
|
377
|
-
}), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/_react.default.createElement(Row, {
|
372
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, skeletonVisible && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && !emptyContent && /*#__PURE__*/_react.default.createElement(_proField.EmptyContent, _objectSpread({}, emptyProps)), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && emptyContent && /*#__PURE__*/_react.default.createElement("div", null, emptyContent), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/_react.default.createElement(Row, {
|
378
373
|
gutter: 16,
|
379
374
|
wrap: true,
|
380
375
|
style: {
|
@@ -83,11 +83,11 @@ var ToolBar = function ToolBar(props) {
|
|
83
83
|
(0, _react.useEffect)((0, _lodash.default)(function () {
|
84
84
|
if ((layoutInlineSize === null || layoutInlineSize === void 0 ? void 0 : layoutInlineSize.width) && leftWidth && toolBarContentRef.current && toolBarAutoWidth) {
|
85
85
|
var _toolBarContentRef$cu;
|
86
|
-
var width = layoutInlineSize.width
|
87
|
-
|
88
|
-
if (width - leftWidth <= ((_toolBarContentRef$cu = toolBarContentRef.current) === null || _toolBarContentRef$cu === void 0 ? void 0 : _toolBarContentRef$cu.clientWidth) + 8
|
86
|
+
var width = layoutInlineSize.width;
|
87
|
+
// 60 为容错
|
88
|
+
if (width - leftWidth - 60 <= ((_toolBarContentRef$cu = toolBarContentRef.current) === null || _toolBarContentRef$cu === void 0 ? void 0 : _toolBarContentRef$cu.clientWidth) + 8) {
|
89
89
|
setFlat(false);
|
90
|
-
} else
|
90
|
+
} else {
|
91
91
|
setFlat(true);
|
92
92
|
}
|
93
93
|
}
|
@@ -152,9 +152,12 @@ var ToolBar = function ToolBar(props) {
|
|
152
152
|
})
|
153
153
|
}, Component));
|
154
154
|
}));
|
155
|
-
}, [toolBarList]);
|
155
|
+
}, [toolBarList, props.columns]);
|
156
156
|
var renderUnFlatShape = function renderUnFlatShape() {
|
157
|
-
|
157
|
+
if (toolBar === false) {
|
158
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
159
|
+
}
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_components.Balloon.Tooltip, {
|
158
161
|
triggerType: ['click'],
|
159
162
|
popupProps: {
|
160
163
|
cache: true
|
@@ -166,7 +169,7 @@ var ToolBar = function ToolBar(props) {
|
|
166
169
|
type: "more-line"
|
167
170
|
})),
|
168
171
|
align: "tr"
|
169
|
-
}, renderFlatShape)
|
172
|
+
}, renderFlatShape);
|
170
173
|
};
|
171
174
|
return /*#__PURE__*/_react.default.createElement("div", {
|
172
175
|
className: cls('', {
|