tntd 2.8.0-beta.14 → 2.8.0-beta.16
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/es/descriptions/descriptions.js +83 -40
- package/es/descriptions/descriptions.js.map +1 -1
- package/es/descriptions/descriptions.less +57 -60
- package/es/handle-icon/index.js +35 -17
- package/es/handle-icon/index.js.map +1 -1
- package/es/handle-icon/index.less +28 -15
- package/es/modal/style/modal.less +1 -1
- package/es/table/style/index.less +47 -23
- package/es/table/style_/index.js +10 -0
- package/es/table/style_/index.js.map +1 -0
- package/es/table/style_antd/index.js +10 -0
- package/es/table/style_antd/index.js.map +1 -0
- package/es/table/table.less +5 -5
- package/es/table/table.stories.js +413 -2
- package/es/table/table.stories.js.map +1 -1
- package/es/table-container/index.less +10 -10
- package/lib/descriptions/descriptions.d.ts +11 -6
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +84 -41
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/descriptions.less +57 -60
- package/lib/handle-icon/index.d.ts.map +1 -1
- package/lib/handle-icon/index.js +29 -10
- package/lib/handle-icon/index.js.map +1 -1
- package/lib/handle-icon/index.less +28 -15
- package/lib/modal/style/modal.less +1 -1
- package/lib/table/style/index.less +47 -23
- package/lib/table/style_/index.d.ts +9 -0
- package/lib/table/style_/index.d.ts.map +1 -0
- package/lib/table/style_/index.js +10 -0
- package/lib/table/style_/index.js.map +1 -0
- package/lib/table/style_antd/index.d.ts +9 -0
- package/lib/table/style_antd/index.d.ts.map +1 -0
- package/lib/table/style_antd/index.js +10 -0
- package/lib/table/style_antd/index.js.map +1 -0
- package/lib/table/table.less +5 -5
- package/lib/table/table.stories.d.ts +106 -29
- package/lib/table/table.stories.d.ts.map +1 -1
- package/lib/table/table.stories.js +426 -3
- package/lib/table/table.stories.js.map +1 -1
- package/lib/table-container/index.less +10 -10
- package/package.json +2 -2
package/lib/handle-icon/index.js
CHANGED
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _LocaleReceiver = _interopRequireDefault(require("antd/lib/locale-provider/LocaleReceiver"));
|
|
9
|
+
var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray"));
|
|
9
10
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
11
|
+
var _popconfirm = _interopRequireDefault(require("../popconfirm"));
|
|
10
12
|
var _divider = _interopRequireDefault(require("../divider"));
|
|
11
13
|
var _dropdown = _interopRequireDefault(require("../dropdown"));
|
|
12
14
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
@@ -29,12 +31,14 @@ var HandleIcon = function HandleIcon(props) {
|
|
|
29
31
|
_a$children = _a.children,
|
|
30
32
|
children = _a$children === void 0 ? [] : _a$children,
|
|
31
33
|
_a$num = _a.num,
|
|
32
|
-
num = _a$num === void 0 ?
|
|
34
|
+
num = _a$num === void 0 ? 5 : _a$num,
|
|
33
35
|
_a$divider = _a.divider,
|
|
34
36
|
divider = _a$divider === void 0 ? false : _a$divider,
|
|
35
37
|
_a$stopPropagation = _a.stopPropagation,
|
|
36
38
|
stopPropagation = _a$stopPropagation === void 0 ? true : _a$stopPropagation,
|
|
37
|
-
|
|
39
|
+
_a$size = _a.size,
|
|
40
|
+
size = _a$size === void 0 ? 'large' : _a$size,
|
|
41
|
+
rest = __rest(_a, ["children", "num", "divider", "stopPropagation", "size"]);
|
|
38
42
|
var newChildren = [];
|
|
39
43
|
if (Array.isArray(children)) {
|
|
40
44
|
newChildren = (children === null || children === void 0 ? void 0 : children.filter(function (item) {
|
|
@@ -43,6 +47,20 @@ var HandleIcon = function HandleIcon(props) {
|
|
|
43
47
|
} else if (children) {
|
|
44
48
|
newChildren.push(children);
|
|
45
49
|
}
|
|
50
|
+
var flattenChildren = function flattenChildren(children) {
|
|
51
|
+
if (!children) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
return (0, _toArray["default"])(children).reduce(function (flatChildren, child) {
|
|
55
|
+
if (child && child.type === _react["default"].Fragment) {
|
|
56
|
+
return flatChildren.concat(flattenChildren(child.props.children));
|
|
57
|
+
}
|
|
58
|
+
flatChildren.push(child);
|
|
59
|
+
return flatChildren;
|
|
60
|
+
}, []);
|
|
61
|
+
};
|
|
62
|
+
// 解决需要Fragment包的场景
|
|
63
|
+
newChildren = flattenChildren(newChildren);
|
|
46
64
|
var preChildPart = newChildren,
|
|
47
65
|
lastChildPart = null;
|
|
48
66
|
// 只有1个时不适配
|
|
@@ -64,7 +82,7 @@ var HandleIcon = function HandleIcon(props) {
|
|
|
64
82
|
if (_react["default"].isValidElement(element)) {
|
|
65
83
|
var type = element.type,
|
|
66
84
|
_props = element.props;
|
|
67
|
-
if (type
|
|
85
|
+
if (type === _popconfirm["default"]) {
|
|
68
86
|
var placement = {
|
|
69
87
|
placement: 'left'
|
|
70
88
|
};
|
|
@@ -112,7 +130,7 @@ var HandleIcon = function HandleIcon(props) {
|
|
|
112
130
|
}
|
|
113
131
|
var menu = function menu(childArr) {
|
|
114
132
|
return _react["default"].createElement(_menu["default"], {
|
|
115
|
-
className: "menu-handle-icon-more"
|
|
133
|
+
className: "menu-handle-icon-more tnt-handle-icon-".concat(size)
|
|
116
134
|
}, childArr === null || childArr === void 0 ? void 0 : childArr.map(function (child, i) {
|
|
117
135
|
return _react["default"].createElement(_menu["default"].Item, {
|
|
118
136
|
key: i
|
|
@@ -126,7 +144,7 @@ var HandleIcon = function HandleIcon(props) {
|
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
146
|
}, rest, {
|
|
129
|
-
className: "tnt-handle-icon-wrap ".concat((rest === null || rest === void 0 ? void 0 : rest.className) || '')
|
|
147
|
+
className: "tnt-handle-icon-wrap tnt-handle-icon-".concat(size, " ").concat((rest === null || rest === void 0 ? void 0 : rest.className) || '')
|
|
130
148
|
}), preChildPart, !!(lastChildPart === null || lastChildPart === void 0 ? void 0 : lastChildPart.length) && _react["default"].createElement(_dropdown["default"], {
|
|
131
149
|
overlay: menu(lastChildPart || []),
|
|
132
150
|
arrow: true,
|
|
@@ -146,7 +164,8 @@ HandleIcon.Item = function (props) {
|
|
|
146
164
|
_props$tooltip = props.tooltip,
|
|
147
165
|
tooltip = _props$tooltip === void 0 ? true : _props$tooltip,
|
|
148
166
|
inMore = props.inMore,
|
|
149
|
-
disabled = props.disabled
|
|
167
|
+
disabled = props.disabled,
|
|
168
|
+
rest = __rest(props, ["children", "title", "desc", "tooltip", "inMore", "disabled"]);
|
|
150
169
|
var replaceIconWithText = function replaceIconWithText(element) {
|
|
151
170
|
if (_react["default"].isValidElement(element)) {
|
|
152
171
|
var type = element.type,
|
|
@@ -160,12 +179,12 @@ HandleIcon.Item = function (props) {
|
|
|
160
179
|
};
|
|
161
180
|
}
|
|
162
181
|
// 如果是更多需要替换文字
|
|
163
|
-
if (type
|
|
182
|
+
if (type === _icon["default"] || type === 'img') {
|
|
164
183
|
if (inMore) {
|
|
165
184
|
return _react["default"].createElement("a", Object.assign({}, eleProps, disabledProps), title);
|
|
166
185
|
}
|
|
167
186
|
}
|
|
168
|
-
if (disabled && type
|
|
187
|
+
if (disabled && (type === _icon["default"] || ['img', 'a'].includes(type))) {
|
|
169
188
|
return _react["default"].cloneElement(element, Object.assign(Object.assign({}, (element === null || element === void 0 ? void 0 : element.props) || {}), disabledProps || {}));
|
|
170
189
|
}
|
|
171
190
|
if (eleProps && eleProps.children) {
|
|
@@ -186,9 +205,9 @@ HandleIcon.Item = function (props) {
|
|
|
186
205
|
newChildren = replaceIconWithText(children);
|
|
187
206
|
}
|
|
188
207
|
if ((inMore && desc || !inMore) && tooltip) {
|
|
189
|
-
return _react["default"].createElement(_tooltip["default"], {
|
|
208
|
+
return _react["default"].createElement(_tooltip["default"], Object.assign({
|
|
190
209
|
title: desc || title
|
|
191
|
-
}, newChildren);
|
|
210
|
+
}, rest || {}), newChildren);
|
|
192
211
|
}
|
|
193
212
|
return newChildren;
|
|
194
213
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle-icon/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,4FAAmE;AACnE,mDAA0B;AAC1B,yDAAgC;AAChC,2DAAkC;AAClC,yDAAgC;AAChC,mDAA0B;AAC1B,wBAAqB;AAErB,MAAM,UAAU,GAAI,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CACL,8BAAC,wBAAc,IAAC,aAAa,EAAC,YAAY,IACvC,GAAG,EAAE;QACJ,MAAM,KAMF,KAAK,IAAI,EAAE,EANT,EACF,QAAQ,GAAG,EAAE,EACb,GAAG,GAAG,CAAC,EACP,OAAO,GAAG,KAAK,EACf,eAAe,GAAC,IAAI,OAET,EADR,IAAI,cALL,iDAML,CAAc,CAAA;QAGf,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,WAAW,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAI,EAAE,CAAA;SACvD;aAAM,IAAI,QAAQ,EAAE;YACnB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC3B;QAED,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAExD,WAAW;QACX,IAAI,WAAW,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE;YAClC,YAAY,GAAG,WAAW,CAAA;SAC3B;aAAM,IAAI,WAAW,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,MAAM,GAAG,GAAG,EAAE;YACxE,YAAY,GAAG,WAAW,CA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AQ,CAAC;IAC3B,IAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAC;QAC1B,WAAW,GAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,KAAK,CAAA,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAA;KACjE;SAAI;QACD,WAAW,GAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;KAC7C;IAED,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,EAAC;QACxC,OAAO,CACH,8BAAC,iBAAO,IAAC,KAAK,EAAE,IAAI,IAAE,KAAK,IACtB,WAAW,CACN,CACb,CAAA;KACJ;IAED,OAAO,WAAW,CAAA;AAEtB,CAAC,CAAA;AACD,kBAAe,UAAU,CAAA","sourcesContent":["import React from 'react'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport Icon from '../icon'\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Tooltip from '../tooltip'\nimport Menu from '../menu'\nimport './index.less'\n\nconst HandleIcon = (props) => {\n return (\n <LocaleReceiver componentName=\"HandleIcon\">\n {() => {\n const {\n children = [],\n num = 6,\n divider = false,\n stopPropagation=true,\n ...rest\n } = props || {}\n\n \n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n let [preChildPart, lastChildPart] = [newChildren, null];\n \n // 只有1个时不适配\n if (newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n \n if (divider && preChildPart) {\n preChildPart = preChildPart?.map((dom, i) => (\n <>\n {dom}\n {!(\n (i === preChildPart?.length - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </>\n ))\n }\n\n const decoratePopconfirm = (element, parentElement) => {\n if (React.isValidElement(element)) {\n const { type, props } = element;\n if (type.name === 'Popconfirm'||(props.hasOwnProperty('onConfirm') && typeof props?.onConfirm === 'function') ) {\n const placement = { placement: 'left' }\n const {disabled} = parentElement?.props||{}\n let disableProps={};\n if(disabled){\n disableProps={\n disabled,\n onConfirm:()=>{}\n };\n }\n return React.cloneElement(element, {\n overlayStyle: { width: 180 },\n ...(props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n ...disableProps||{}\n })\n }\n if (props && props.children) {\n const modifiedChildren = React.Children.map(props.children, (child) => {\n return decoratePopconfirm(child,element);\n });\n return React.cloneElement(element, props, modifiedChildren);\n }\n }\n return element;\n };\n \n\n // 对更多的popConfirm\n if(lastChildPart?.length){\n lastChildPart?.forEach((v, i) => {\n v = decoratePopconfirm(v);\n lastChildPart[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n inMore:true,\n })\n }) \n }\n \n const menu = (childArr)=>(\n <Menu className=\"menu-handle-icon-more\">\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n className={`tnt-handle-icon-wrap ${rest?.className||''}`}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown \n overlay={menu(lastChildPart || [])} \n arrow \n onClick={(e)=>{\n stopPropagation && e.stopPropagation()\n }}\n >\n <Icon type=\"more\" className='tnt-handle-icon-more'/>\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n\nHandleIcon.Item = (props) => {\n const {children, title, desc, tooltip=true, inMore, disabled} = props\n const replaceIconWithText = (element) => {\n if (React.isValidElement(element)) {\n const { type, props:eleProps } = element;\n let disabledProps = {}\n if(disabled){\n disabledProps = {\n disabled,\n onClick:()=>{},\n className:(eleProps?.className || \"\")+ (disabled?' disabled':\"\")\n }\n }\n // 如果是更多需要替换文字\n if (type.name === 'Icon' || type ==='img') {\n if(inMore){\n return (\n <a \n {...eleProps}\n {...disabledProps}\n \n >{title}</a>\n );\n }\n }\n\n if(disabled && type.name==='Icon' || ['img','a'].includes(type)){\n return React.cloneElement(element, {\n ...element?.props || {} ,\n ...disabledProps||{}\n })\n }\n\n if (eleProps && eleProps.children) {\n const modifiedChildren = React.Children.map(eleProps.children, (child) => {\n return replaceIconWithText(child);\n });\n return React.cloneElement(element, eleProps, modifiedChildren);\n }\n }\n return element;\n };\n\n let newChildren = children;\n if(Array.isArray(newChildren)){\n newChildren= children?.map(child=> replaceIconWithText(child))\n }else{\n newChildren= replaceIconWithText(children)\n }\n\n if(((inMore && desc) || !inMore) && tooltip){\n return (\n <Tooltip title={desc||title}>\n {newChildren}\n </Tooltip>\n )\n }\n\n return newChildren\n \n}\nexport default HandleIcon"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle-icon/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,4FAAmE;AACnE,0EAAkD;AAClD,mDAA0B;AAC1B,+DAAsC;AACtC,yDAAgC;AAChC,2DAAkC;AAClC,yDAAgC;AAChC,mDAA0B;AAC1B,wBAAqB;AAErB,MAAM,UAAU,GAAI,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CACL,8BAAC,wBAAc,IAAC,aAAa,EAAC,YAAY,IACvC,GAAG,EAAE;QACJ,MAAM,KAOF,KAAK,IAAI,EAAE,EAPT,EACF,QAAQ,GAAG,EAAE,EACb,GAAG,GAAG,CAAC,EACP,OAAO,GAAG,KAAK,EACf,eAAe,GAAC,IAAI,EACpB,IAAI,GAAE,OAAO,OAEF,EADR,IAAI,cANL,yDAOL,CAAc,CAAA;QAGf,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,KAAK,CAAC,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BAAmB,CAAC,KAAK,CAAC,CAAC,CAAA;KACjE;SAAI;QACD,WAAW,GAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;KAC7C;IAED,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,EAAC;QACxC,OAAO,CACH,8BAAC,iBAAO,kBAAC,KAAK,EAAE,IAAI,IAAE,KAAK,IAAM,CAAC,IAAI,IAAE,EAAE,CAAC,GACtC,WAAW,CACN,CACb,CAAA;KACJ;IAED,OAAO,WAAW,CAAA;AAEtB,CAAC,CAAA;AACD,kBAAe,UAAU,CAAA","sourcesContent":["import React from 'react'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport toArray from \"rc-util/es/Children/toArray\";\nimport Icon from '../icon'\nimport PopConfirm from \"../popconfirm\"\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Tooltip from '../tooltip'\nimport Menu from '../menu'\nimport './index.less'\n\nconst HandleIcon = (props) => {\n return (\n <LocaleReceiver componentName=\"HandleIcon\">\n {() => {\n const {\n children = [],\n num = 5,\n divider = false,\n stopPropagation=true,\n size= 'large',\n ...rest\n } = props || {}\n\n \n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n const flattenChildren = (children) => {\n if (!children) {\n return [];\n }\n return toArray(children).reduce(function (flatChildren, child) {\n if (child && child.type === React.Fragment) {\n return flatChildren.concat(flattenChildren(child.props.children));\n }\n \n flatChildren.push(child);\n return flatChildren;\n }, []);\n }\n\n // 解决需要Fragment包的场景\n newChildren = flattenChildren(newChildren);\n\n let [preChildPart, lastChildPart] = [newChildren, null];\n \n // 只有1个时不适配\n if (newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n \n if (divider && preChildPart) {\n preChildPart = preChildPart?.map((dom, i) => (\n <>\n {dom}\n {!(\n (i === preChildPart?.length - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </>\n ))\n }\n\n const decoratePopconfirm = (element, parentElement) => {\n if (React.isValidElement(element)) {\n const { type, props } = element;\n if (type === PopConfirm ) {\n const placement = { placement: 'left' }\n const {disabled} = parentElement?.props||{}\n let disableProps={};\n if(disabled){\n disableProps={\n disabled,\n onConfirm:()=>{}\n };\n }\n return React.cloneElement(element, {\n overlayStyle: { width: 180 },\n ...(props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n ...disableProps||{}\n })\n }\n if (props && props.children) {\n const modifiedChildren = React.Children.map(props.children, (child) => {\n return decoratePopconfirm(child,element);\n });\n return React.cloneElement(element, props, modifiedChildren);\n }\n }\n return element;\n };\n \n\n // 对更多的popConfirm\n if(lastChildPart?.length){\n lastChildPart?.forEach((v, i) => {\n v = decoratePopconfirm(v);\n lastChildPart[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n inMore:true,\n })\n }) \n }\n \n const menu = (childArr)=>(\n <Menu className={`menu-handle-icon-more tnt-handle-icon-${size}`}>\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n className={`tnt-handle-icon-wrap tnt-handle-icon-${size} ${rest?.className||''}`}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown \n overlay={menu(lastChildPart || [])} \n arrow \n onClick={(e)=>{\n stopPropagation && e.stopPropagation()\n }}\n >\n <Icon type=\"more\" className='tnt-handle-icon-more'/>\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n\nHandleIcon.Item = (props) => {\n const {children, title, desc, tooltip=true, inMore, disabled,...rest} = props\n const replaceIconWithText = (element) => {\n if (React.isValidElement(element)) {\n const { type, props:eleProps } = element;\n let disabledProps = {}\n if(disabled){\n disabledProps = {\n disabled,\n onClick:()=>{},\n className:(eleProps?.className || \"\")+ (disabled?' disabled':\"\")\n }\n }\n // 如果是更多需要替换文字\n if (type === Icon || type ==='img') {\n if(inMore){\n return (\n <a \n {...eleProps}\n {...disabledProps}\n \n >{title}</a>\n );\n }\n }\n\n if(disabled && (type===Icon || ['img','a'].includes(type))){\n return React.cloneElement(element, {\n ...element?.props || {} ,\n ...disabledProps||{}\n })\n }\n\n if (eleProps && eleProps.children) {\n const modifiedChildren = React.Children.map(eleProps.children, (child) => {\n return replaceIconWithText(child);\n });\n return React.cloneElement(element, eleProps, modifiedChildren);\n }\n }\n return element;\n };\n\n let newChildren = children;\n if(Array.isArray(newChildren)){\n newChildren= children?.map(child=> replaceIconWithText(child))\n }else{\n newChildren= replaceIconWithText(children)\n }\n\n if(((inMore && desc) || !inMore) && tooltip){\n return (\n <Tooltip title={desc||title} {...(rest||{})}>\n {newChildren}\n </Tooltip>\n )\n }\n\n return newChildren\n \n}\nexport default HandleIcon"]}
|
|
@@ -1,35 +1,48 @@
|
|
|
1
|
+
@small-size: 16px;
|
|
2
|
+
@middle-size: 18px;
|
|
3
|
+
@large-size: 20px;
|
|
1
4
|
.tnt-handle-icon-wrap{
|
|
2
5
|
>*:not(:last-child){
|
|
3
6
|
margin-right: 8px;
|
|
4
7
|
}
|
|
5
|
-
>*.tntd-anticon{
|
|
6
|
-
font-size: 20px;
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
>*{
|
|
10
|
-
&.icon-disabled,&.disabled{
|
|
11
|
-
cursor: not-allowed;
|
|
12
|
-
pointer-events: auto;
|
|
13
|
-
color: @disabled-color;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
.tnt-handle-icon-more{
|
|
18
|
-
font-size: 20px;
|
|
19
8
|
}
|
|
20
9
|
|
|
21
10
|
.menu-handle-icon-more{
|
|
22
11
|
min-width: 100px;
|
|
23
12
|
max-width: 300px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[class*=tnt-handle-icon]{
|
|
24
16
|
a{
|
|
25
17
|
display: block;
|
|
26
18
|
overflow: hidden;
|
|
27
19
|
white-space: nowrap;
|
|
28
20
|
text-overflow: ellipsis;
|
|
21
|
+
color:@text-color;
|
|
29
22
|
}
|
|
30
23
|
.icon-disabled,.disabled{
|
|
31
24
|
cursor: not-allowed;
|
|
32
25
|
pointer-events: auto;
|
|
33
26
|
color: @disabled-color;
|
|
34
27
|
}
|
|
35
|
-
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
.tnt-handle-icon-small{
|
|
31
|
+
.tntd-anticon{
|
|
32
|
+
font-size: @small-size;
|
|
33
|
+
}
|
|
34
|
+
font-size: @small-size;
|
|
35
|
+
}
|
|
36
|
+
.tnt-handle-icon-middle{
|
|
37
|
+
.tntd-anticon{
|
|
38
|
+
font-size: @middle-size;
|
|
39
|
+
}
|
|
40
|
+
font-size: @middle-size;
|
|
41
|
+
}
|
|
42
|
+
.tnt-handle-icon-large{
|
|
43
|
+
.tntd-anticon{
|
|
44
|
+
font-size: @large-size;
|
|
45
|
+
}
|
|
46
|
+
font-size: @large-size;
|
|
47
|
+
}
|
|
48
|
+
|
|
@@ -258,12 +258,11 @@
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
&-footer {
|
|
261
|
-
position: relative;
|
|
261
|
+
// position: relative;
|
|
262
262
|
padding: @table-padding-vertical @table-padding-horizontal;
|
|
263
263
|
color: @table-footer-color;
|
|
264
264
|
background: @table-footer-bg;
|
|
265
265
|
border-top: @border-width-base @border-style-base @border-color-split;
|
|
266
|
-
border-radius: 0 0 @table-border-radius-base @table-border-radius-base;
|
|
267
266
|
&::before {
|
|
268
267
|
position: absolute;
|
|
269
268
|
top: -1px;
|
|
@@ -275,26 +274,25 @@
|
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
&.@{table-prefix-cls}-bordered &-footer {
|
|
279
|
-
|
|
280
|
-
}
|
|
277
|
+
// &.@{table-prefix-cls}-bordered &-footer {
|
|
278
|
+
// border: @border-width-base @border-style-base @border-color-split;
|
|
279
|
+
// }
|
|
281
280
|
|
|
282
281
|
&-title {
|
|
283
|
-
position: relative;
|
|
284
|
-
top: 1px;
|
|
282
|
+
// position: relative;
|
|
283
|
+
// top: 1px;
|
|
285
284
|
padding: @table-padding-vertical 0;
|
|
286
|
-
border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
287
285
|
}
|
|
288
286
|
|
|
289
287
|
&.@{table-prefix-cls}-bordered &-title {
|
|
290
288
|
padding-right: @table-padding-horizontal;
|
|
291
289
|
padding-left: @table-padding-horizontal;
|
|
292
|
-
border: @border-width-base @border-style-base @border-color-split;
|
|
290
|
+
border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
293
291
|
}
|
|
294
292
|
|
|
295
293
|
&-title + &-content {
|
|
296
|
-
position: relative;
|
|
297
|
-
border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
294
|
+
// position: relative;
|
|
295
|
+
// border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
298
296
|
|
|
299
297
|
.@{table-prefix-cls}-bordered & {
|
|
300
298
|
&,
|
|
@@ -375,19 +373,23 @@
|
|
|
375
373
|
}
|
|
376
374
|
|
|
377
375
|
&-bordered {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
.@{table-prefix-cls}-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
376
|
+
border: @border-width-base @border-style-base @border-color-split;
|
|
377
|
+
border-radius: @border-radius-base;
|
|
378
|
+
overflow: hidden;
|
|
379
|
+
// .@{table-prefix-cls}-header > table,
|
|
380
|
+
// .@{table-prefix-cls}-body > table,
|
|
381
|
+
// .@{table-prefix-cls}-fixed-left table,
|
|
382
|
+
// .@{table-prefix-cls}-fixed-right table {
|
|
383
|
+
// border: @border-width-base @border-style-base @border-color-split;
|
|
384
|
+
// border-right: 0;
|
|
385
|
+
// border-bottom: 0;
|
|
386
|
+
// }
|
|
386
387
|
|
|
387
388
|
&.@{table-prefix-cls}-empty {
|
|
388
389
|
.@{table-prefix-cls}-placeholder {
|
|
389
|
-
border-right: @border-width-base @border-style-base @border-color-split;
|
|
390
|
-
border-left: @border-width-base @border-style-base @border-color-split;
|
|
390
|
+
// border-right: @border-width-base @border-style-base @border-color-split;
|
|
391
|
+
// border-left: @border-width-base @border-style-base @border-color-split;
|
|
392
|
+
border-bottom: 0;
|
|
391
393
|
}
|
|
392
394
|
}
|
|
393
395
|
|
|
@@ -414,6 +416,27 @@
|
|
|
414
416
|
.@{table-prefix-cls}-thead > tr > th,
|
|
415
417
|
.@{table-prefix-cls}-tbody > tr > td {
|
|
416
418
|
border-right: @border-width-base @border-style-base @border-color-split;
|
|
419
|
+
&:last-child {
|
|
420
|
+
border-right: 0;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
.@{table-prefix-cls}-fixed-left {
|
|
424
|
+
.@{table-prefix-cls}-thead > tr > th,
|
|
425
|
+
.@{table-prefix-cls}-tbody > tr > td {
|
|
426
|
+
&:last-child {
|
|
427
|
+
border-right: @border-width-base @border-style-base @border-color-split;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
.@{table-prefix-cls}-content:has(.@{table-prefix-cls}-fixed-right) .@{table-prefix-cls}-scroll {
|
|
432
|
+
.@{table-prefix-cls}-thead > tr > th {
|
|
433
|
+
&:last-child {
|
|
434
|
+
border-right: @border-width-base @border-style-base @border-color-split;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
.@{table-prefix-cls}-tbody > tr:last-child > td {
|
|
439
|
+
border-bottom: 0;
|
|
417
440
|
}
|
|
418
441
|
}
|
|
419
442
|
|
|
@@ -428,7 +451,7 @@
|
|
|
428
451
|
background: @component-background;
|
|
429
452
|
border-top: @border-width-base @border-style-base @border-color-split;
|
|
430
453
|
border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
431
|
-
border-radius: 0 0 @border-radius-base @border-radius-base;
|
|
454
|
+
// border-radius: 0 0 @border-radius-base @border-radius-base;
|
|
432
455
|
}
|
|
433
456
|
|
|
434
457
|
&-pagination.@{ant-prefix}-pagination {
|
|
@@ -604,7 +627,8 @@
|
|
|
604
627
|
}
|
|
605
628
|
|
|
606
629
|
td > .@{table-prefix-cls}-wrapper {
|
|
607
|
-
margin: -@table-padding-vertical -@table-padding-horizontal
|
|
630
|
+
margin: -@table-padding-vertical -@table-padding-horizontal
|
|
631
|
+
calc(-@table-padding-vertical - 1px);
|
|
608
632
|
}
|
|
609
633
|
}
|
|
610
634
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../../style/index.less';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import '../../empty/style';
|
|
4
|
+
import '../../radio/style';
|
|
5
|
+
import '../../checkbox/style';
|
|
6
|
+
import '../../dropdown/style';
|
|
7
|
+
import '../../spin/style';
|
|
8
|
+
import '../../pagination/style';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/style_/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,cAAc,CAAA;AAIrB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,kBAAkB,CAAA;AACzB,OAAO,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("../../style/index.less");
|
|
4
|
+
require("./index.less");
|
|
5
|
+
require("../../empty/style");
|
|
6
|
+
require("../../radio/style");
|
|
7
|
+
require("../../checkbox/style");
|
|
8
|
+
require("../../dropdown/style");
|
|
9
|
+
require("../../spin/style");
|
|
10
|
+
require("../../pagination/style");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/style_/index.tsx"],"names":[],"mappings":";;AAAA,kCAA+B;AAC/B,wBAAqB;AAErB,qBAAqB;AACrB,uBAAuB;AACvB,6BAA0B;AAC1B,6BAA0B;AAC1B,gCAA6B;AAC7B,gCAA6B;AAC7B,4BAAyB;AACzB,kCAA+B","sourcesContent":["import '../../style/index.less'\nimport './index.less'\n\n// style dependencies\n// deps-lint-skip: menu\nimport '../../empty/style'\nimport '../../radio/style'\nimport '../../checkbox/style'\nimport '../../dropdown/style'\nimport '../../spin/style'\nimport '../../pagination/style'\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../../style/index.less';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import '../../empty/style';
|
|
4
|
+
import '../../radio/style';
|
|
5
|
+
import '../../checkbox/style';
|
|
6
|
+
import '../../dropdown/style';
|
|
7
|
+
import '../../spin/style';
|
|
8
|
+
import '../../pagination/style';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/style_antd/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC;AAItB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("../../style/index.less");
|
|
4
|
+
require("./index.less");
|
|
5
|
+
require("../../empty/style");
|
|
6
|
+
require("../../radio/style");
|
|
7
|
+
require("../../checkbox/style");
|
|
8
|
+
require("../../dropdown/style");
|
|
9
|
+
require("../../spin/style");
|
|
10
|
+
require("../../pagination/style");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/style_antd/index.tsx"],"names":[],"mappings":";;AAAA,kCAAgC;AAChC,wBAAsB;AAEtB,qBAAqB;AACrB,uBAAuB;AACvB,6BAA2B;AAC3B,6BAA2B;AAC3B,gCAA8B;AAC9B,gCAA8B;AAC9B,4BAA0B;AAC1B,kCAAgC","sourcesContent":["import '../../style/index.less';\nimport './index.less';\n\n// style dependencies\n// deps-lint-skip: menu\nimport '../../empty/style';\nimport '../../radio/style';\nimport '../../checkbox/style';\nimport '../../dropdown/style';\nimport '../../spin/style';\nimport '../../pagination/style';\n"]}
|
package/lib/table/table.less
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
@spin-prefix-cls: ~'@{ant-prefix}-spin';
|
|
4
4
|
@table-borderless-shadow: 0 0 14px rgba(0, 0, 0, 0.08);
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
// .@{table-prefix-cls} {
|
|
8
|
-
.tnt-table-wrapper{
|
|
7
|
+
.tnt-table-wrapper {
|
|
9
8
|
background-color: @white;
|
|
10
9
|
border-radius: @border-radius-base;
|
|
11
10
|
|
|
@@ -30,9 +29,9 @@
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
&.@{table-prefix-cls}-hide-cell-borders {
|
|
33
|
-
.@{table-prefix-cls}-thead > tr > th
|
|
34
|
-
.@{table-prefix-cls}-tbody > tr > td
|
|
35
|
-
border-right: none;
|
|
32
|
+
.@{table-prefix-cls}-thead > tr > th,
|
|
33
|
+
.@{table-prefix-cls}-tbody > tr > td {
|
|
34
|
+
border-right: none !important;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -68,6 +67,7 @@
|
|
|
68
67
|
.@{table-prefix-cls}-placeholder {
|
|
69
68
|
padding-top: @table-padding-horizontal;
|
|
70
69
|
padding-bottom: @table-padding-horizontal;
|
|
70
|
+
border-bottom: 0;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// customize the loading of table
|
|
@@ -1,32 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { Table as component };
|
|
3
|
+
export const title: string;
|
|
4
|
+
export namespace parameters {
|
|
5
|
+
namespace backgrounds {
|
|
6
|
+
const _default: string;
|
|
7
|
+
export { _default as default };
|
|
8
|
+
export const values: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
export default _default;
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
export function Empty(args: any): React.JSX.Element;
|
|
17
|
+
export namespace Empty {
|
|
18
|
+
namespace args {
|
|
19
|
+
const columns: {
|
|
20
|
+
title: string;
|
|
21
|
+
dataIndex: string;
|
|
22
|
+
key: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function Loading(args: any): React.JSX.Element;
|
|
27
|
+
export namespace Loading {
|
|
28
|
+
export namespace args_1 {
|
|
29
|
+
const columns_1: {
|
|
30
|
+
title: string;
|
|
31
|
+
dataIndex: string;
|
|
32
|
+
key: string;
|
|
33
|
+
}[];
|
|
34
|
+
export { columns_1 as columns };
|
|
35
|
+
export const loading: boolean;
|
|
36
|
+
}
|
|
37
|
+
export { args_1 as args };
|
|
38
|
+
}
|
|
39
|
+
export function Default(args: any): React.JSX.Element;
|
|
40
|
+
export namespace Default {
|
|
41
|
+
export namespace args_2 {
|
|
42
|
+
const columns_2: ({
|
|
43
|
+
title: string;
|
|
44
|
+
dataIndex: string;
|
|
45
|
+
key: string;
|
|
46
|
+
render?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
title: string;
|
|
49
|
+
dataIndex: string;
|
|
50
|
+
key: string;
|
|
51
|
+
render: (cellData: any) => React.JSX.Element;
|
|
52
|
+
})[];
|
|
53
|
+
export { columns_2 as columns };
|
|
54
|
+
export const dataSource: {
|
|
55
|
+
key: string;
|
|
56
|
+
name: string;
|
|
57
|
+
age: number;
|
|
58
|
+
address: string;
|
|
59
|
+
}[];
|
|
60
|
+
export namespace pagination {
|
|
61
|
+
const total: number;
|
|
62
|
+
const position: string;
|
|
63
|
+
const showSizeChanger: boolean;
|
|
64
|
+
const showQuickJumper: boolean;
|
|
65
|
+
function showTotal(total: any, range: any): string;
|
|
66
|
+
}
|
|
67
|
+
const loading_1: boolean;
|
|
68
|
+
export { loading_1 as loading };
|
|
69
|
+
}
|
|
70
|
+
export { args_2 as args };
|
|
71
|
+
}
|
|
72
|
+
export function ColumnFilter(args: any): React.JSX.Element;
|
|
73
|
+
export namespace ColumnFilter {
|
|
74
|
+
export namespace args_3 {
|
|
75
|
+
const dataSource_1: {
|
|
76
|
+
key: string;
|
|
77
|
+
firstName: string;
|
|
78
|
+
lastName: string;
|
|
79
|
+
age: number;
|
|
80
|
+
address: string;
|
|
81
|
+
tags: string[];
|
|
82
|
+
}[];
|
|
83
|
+
export { dataSource_1 as dataSource };
|
|
84
|
+
export namespace pagination_1 {
|
|
85
|
+
const total_1: number;
|
|
86
|
+
export { total_1 as total };
|
|
87
|
+
const position_1: string;
|
|
88
|
+
export { position_1 as position };
|
|
89
|
+
const showSizeChanger_1: boolean;
|
|
90
|
+
export { showSizeChanger_1 as showSizeChanger };
|
|
91
|
+
const showQuickJumper_1: boolean;
|
|
92
|
+
export { showQuickJumper_1 as showQuickJumper };
|
|
93
|
+
export function showTotal_1(total: any, range: any): string;
|
|
94
|
+
export { showTotal_1 as showTotal };
|
|
95
|
+
}
|
|
96
|
+
export { pagination_1 as pagination };
|
|
97
|
+
const loading_2: boolean;
|
|
98
|
+
export { loading_2 as loading };
|
|
99
|
+
}
|
|
100
|
+
export { args_3 as args };
|
|
101
|
+
}
|
|
102
|
+
export function All(): React.JSX.Element;
|
|
103
|
+
export namespace All {
|
|
104
|
+
const args_4: {};
|
|
105
|
+
export { args_4 as args };
|
|
30
106
|
}
|
|
31
|
-
|
|
107
|
+
import { Table } from "./table";
|
|
108
|
+
import React from "react";
|
|
32
109
|
//# sourceMappingURL=table.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../src/table/table.stories.
|
|
1
|
+
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../src/table/table.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkBA,oDAQC;;;;;;;;;;AARD,sDAQC;;;;;;;;;;;;;AARD,sDAQC;;;;;;;;;;;;;;;;;;;;;;;;;;YAuFc,mDAA2D;;;;;;;AAKnE,2DAuCN;;;;;;;;;;;;;;;;;;;;;YAkCc,4DAA6D;;;;;;;;;AAKrE,yCA0UN"}
|