tntd 3.0.74 → 3.0.76
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/button/style/mixin.less +1 -1
- package/es/tntd-action/Action.js +10 -87
- package/es/tntd-action/index.js +7 -61
- package/es/tntd-action/index.js.map +1 -1
- package/es/tntd-action/index.less +0 -44
- package/es/tntd-action_backup/index.less +114 -0
- package/lib/button/style/mixin.less +1 -1
- package/lib/tntd-action/index.d.ts +2 -1
- package/lib/tntd-action/index.d.ts.map +1 -1
- package/lib/tntd-action/index.js +7 -61
- package/lib/tntd-action/index.js.map +1 -1
- package/lib/tntd-action/index.less +0 -44
- package/lib/tntd-action_backup/index.less +114 -0
- package/package.json +1 -1
package/es/tntd-action/Action.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
4
|
Object.defineProperty(exports, "__esModule", {
|
|
13
5
|
value: true
|
|
14
6
|
});
|
|
@@ -19,84 +11,15 @@ var _configProvider = require("antd/es/config-provider");
|
|
|
19
11
|
var _LocaleReceiver = _interopRequireDefault(require("antd/es/locale-provider/LocaleReceiver"));
|
|
20
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
13
|
var _button = require("../button");
|
|
22
|
-
function _interopRequireDefault(e) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
32
|
-
return e ? t : r;
|
|
33
|
-
})(e);
|
|
34
|
-
}
|
|
35
|
-
function _interopRequireWildcard(e, r) {
|
|
36
|
-
if (!r && e && e.__esModule) return e;
|
|
37
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
38
|
-
"default": e
|
|
39
|
-
};
|
|
40
|
-
var t = _getRequireWildcardCache(r);
|
|
41
|
-
if (t && t.has(e)) return t.get(e);
|
|
42
|
-
var n = {
|
|
43
|
-
__proto__: null
|
|
44
|
-
},
|
|
45
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
47
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
48
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
49
|
-
}
|
|
50
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
51
|
-
}
|
|
52
|
-
function _slicedToArray(r, e) {
|
|
53
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
54
|
-
}
|
|
55
|
-
function _nonIterableRest() {
|
|
56
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
-
}
|
|
58
|
-
function _unsupportedIterableToArray(r, a) {
|
|
59
|
-
if (r) {
|
|
60
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
61
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
62
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function _arrayLikeToArray(r, a) {
|
|
66
|
-
(null == a || a > r.length) && (a = r.length);
|
|
67
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
68
|
-
return n;
|
|
69
|
-
}
|
|
70
|
-
function _iterableToArrayLimit(r, l) {
|
|
71
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
72
|
-
if (null != t) {
|
|
73
|
-
var e,
|
|
74
|
-
n,
|
|
75
|
-
i,
|
|
76
|
-
u,
|
|
77
|
-
a = [],
|
|
78
|
-
f = !0,
|
|
79
|
-
o = !1;
|
|
80
|
-
try {
|
|
81
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
82
|
-
if (Object(t) !== t) return;
|
|
83
|
-
f = !1;
|
|
84
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
85
|
-
} catch (r) {
|
|
86
|
-
o = !0, n = r;
|
|
87
|
-
} finally {
|
|
88
|
-
try {
|
|
89
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
90
|
-
} finally {
|
|
91
|
-
if (o) throw n;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return a;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function _arrayWithHoles(r) {
|
|
98
|
-
if (Array.isArray(r)) return r;
|
|
99
|
-
}
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
100
23
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
101
24
|
var t = {};
|
|
102
25
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
package/es/tntd-action/index.js
CHANGED
|
@@ -6,13 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = _default;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Action = _interopRequireDefault(require("./Action"));
|
|
9
10
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
10
|
-
var _popconfirm = _interopRequireDefault(require("../popconfirm"));
|
|
11
|
-
var _dropdown = _interopRequireDefault(require("../dropdown"));
|
|
12
|
-
var _button = _interopRequireDefault(require("../button"));
|
|
13
|
-
var _icon = _interopRequireDefault(require("../icon"));
|
|
14
|
-
var _menu = _interopRequireDefault(require("../menu"));
|
|
15
|
-
var _prevLocale = require("../prev-locale");
|
|
16
11
|
require("./index.less");
|
|
17
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -31,29 +26,16 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
31
26
|
}
|
|
32
27
|
return t;
|
|
33
28
|
};
|
|
34
|
-
|
|
35
|
-
// import Action from './Action'
|
|
36
|
-
|
|
37
29
|
var _checkShowChild = function checkShowChild(child) {
|
|
38
30
|
var _ref = child.props || {},
|
|
39
31
|
disabled = _ref.disabled,
|
|
40
32
|
children = _ref.children,
|
|
41
33
|
check = _ref.check,
|
|
42
34
|
text = _ref.text;
|
|
43
|
-
|
|
44
|
-
if (check) {
|
|
35
|
+
if (check && !disabled) {
|
|
45
36
|
return _react["default"].cloneElement(child, text ? {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// {children}
|
|
49
|
-
// <span>{text}</span>
|
|
50
|
-
// </>
|
|
51
|
-
// ),
|
|
52
|
-
children: text,
|
|
53
|
-
type: 'link'
|
|
54
|
-
} : {
|
|
55
|
-
type: 'link'
|
|
56
|
-
});
|
|
37
|
+
children: _react["default"].createElement(_react["default"].Fragment, null, children, text)
|
|
38
|
+
} : {});
|
|
57
39
|
} else if (children) {
|
|
58
40
|
var newChild = _react["default"].Children.map(children, function (child) {
|
|
59
41
|
return _checkShowChild(child);
|
|
@@ -66,30 +48,12 @@ var _checkShowChild = function checkShowChild(child) {
|
|
|
66
48
|
};
|
|
67
49
|
if (child.type === _tooltip["default"]) {
|
|
68
50
|
newProps.visible = false;
|
|
69
|
-
} else if (child.type === _popconfirm["default"]) {
|
|
70
|
-
newProps.hiddenArrow = true;
|
|
71
51
|
}
|
|
72
52
|
return _react["default"].cloneElement(child, newProps);
|
|
73
53
|
}
|
|
74
54
|
}
|
|
75
55
|
return false;
|
|
76
56
|
};
|
|
77
|
-
var _checkIsDisabled = function checkIsDisabled(child) {
|
|
78
|
-
var _ref2 = child.props || {},
|
|
79
|
-
disabled = _ref2.disabled,
|
|
80
|
-
children = _ref2.children,
|
|
81
|
-
check = _ref2.check;
|
|
82
|
-
if (check) {
|
|
83
|
-
return disabled;
|
|
84
|
-
} else if (children) {
|
|
85
|
-
return _react["default"].Children.map(children, function (child) {
|
|
86
|
-
return _checkIsDisabled(child);
|
|
87
|
-
}).filter(function (i) {
|
|
88
|
-
return !!i;
|
|
89
|
-
}).length > 0;
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
};
|
|
93
57
|
function _default(_a) {
|
|
94
58
|
var children = _a.children,
|
|
95
59
|
other = __rest(_a, ["children"]);
|
|
@@ -116,25 +80,7 @@ function _default(_a) {
|
|
|
116
80
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
117
81
|
thisChild = _useMemo2[0],
|
|
118
82
|
popChild = _useMemo2[1];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
key: i,
|
|
123
|
-
disabled: _checkIsDisabled(it)
|
|
124
|
-
}, it);
|
|
125
|
-
}));
|
|
126
|
-
};
|
|
127
|
-
if (popChild.length <= 1) {
|
|
128
|
-
// 如果只有一个,直接返回
|
|
129
|
-
return children;
|
|
130
|
-
}
|
|
131
|
-
var batchOperation = (0, _prevLocale.getText)('batchOperation', (0, _prevLocale.getLanguage)());
|
|
132
|
-
return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_dropdown["default"], {
|
|
133
|
-
overlay: createMenu(popChild),
|
|
134
|
-
overlayClassName: "tnt-action-dropdown"
|
|
135
|
-
}, _react["default"].createElement(_button["default"], {
|
|
136
|
-
className: "tnt-action-dropdown-btn"
|
|
137
|
-
}, batchOperation, " ", _react["default"].createElement(_icon["default"], {
|
|
138
|
-
type: "down"
|
|
139
|
-
}))));
|
|
83
|
+
return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_Action["default"], Object.assign({
|
|
84
|
+
data: popChild
|
|
85
|
+
}, other)));
|
|
140
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,cAAc,CAAA;AAErB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/B,M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E,EAAE;YACzC,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE;gBACxB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;gBAC/B,IAAI,OAAO,EAAE;oBACX,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;iBAClE;qBAAM;oBACL,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;oBACvC,IAAI,SAAS,EAAE;wBACb,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;qBACzB;iBACF;aACF;QACH,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL;QACG,SAAS;QAEV,oBAAC,MAAM,kBAAC,IAAI,EAAE,QAAQ,IAAM,KAAK,EAAI,CACpC,CACJ,CAAA;AACH,CAAC","sourcesContent":["import React, { useMemo } from 'react'\nimport Action from './Action'\nimport Tooltip from '../tooltip'\nimport './index.less'\n\nconst checkShowChild = (child) => {\n const { disabled, children, check, text } = child.props || {}\n if (check && !disabled) {\n return React.cloneElement(\n child,\n text\n ? {\n children: (\n <>\n {children}\n {text}\n </>\n ),\n }\n : {}\n )\n } else if (children) {\n const newChild = React.Children.map(children, (child) => {\n return checkShowChild(child)\n }).filter((i) => !!i)\n if (newChild.length > 0) {\n const newProps = { children: newChild }\n if (child.type === Tooltip) {\n newProps.visible = false\n }\n return React.cloneElement(child, newProps)\n }\n }\n return false\n}\n\nexport default function ({ children, ...other }) {\n const [thisChild, popChild] = useMemo(() => {\n const thisChild = []\n const popChild = []\n React.Children.forEach(children, (child) => {\n if (child && child.props) {\n const { exclude } = child.props\n if (exclude) {\n thisChild.push(React.cloneElement(child, { exclude: undefined }))\n } else {\n const showChild = checkShowChild(child)\n if (showChild) {\n popChild.push(showChild)\n }\n }\n }\n })\n return [thisChild, popChild]\n }, [children])\n\n return (\n <>\n {thisChild}\n\n <Action data={popChild} {...other} />\n </>\n )\n}\n"]}
|
|
@@ -67,48 +67,4 @@
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
&-dropdown {
|
|
72
|
-
&-btn {
|
|
73
|
-
margin-left: 8px !important;
|
|
74
|
-
border-radius: @border-radius-base !important;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ant-dropdown-menu-item {
|
|
78
|
-
.ant-btn {
|
|
79
|
-
display: block;
|
|
80
|
-
padding: 0;
|
|
81
|
-
height: auto;
|
|
82
|
-
border: none;
|
|
83
|
-
background-color: transparent;
|
|
84
|
-
color: inherit;
|
|
85
|
-
width: calc(100% + 24px);
|
|
86
|
-
text-align: left;
|
|
87
|
-
padding: 5px 12px;
|
|
88
|
-
margin: -5px -12px;
|
|
89
|
-
|
|
90
|
-
&:hover,
|
|
91
|
-
&:active {
|
|
92
|
-
color: inherit;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&[disabled] {
|
|
96
|
-
color: @disabled-color;
|
|
97
|
-
|
|
98
|
-
&:hover,
|
|
99
|
-
&:active {
|
|
100
|
-
color: @disabled-color;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 全局设置
|
|
109
|
-
.ant-btn-group:has(.tnt-action-dropdown-btn) {
|
|
110
|
-
&>.ant-btn:nth-last-child(2) {
|
|
111
|
-
border-top-right-radius: @border-radius-base;
|
|
112
|
-
border-bottom-right-radius: @border-radius-base;
|
|
113
|
-
}
|
|
114
70
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
.tnt-action {
|
|
2
|
+
position: fixed;
|
|
3
|
+
// bottom: 100px;
|
|
4
|
+
// width: @tnt-action-width;
|
|
5
|
+
// left: calc(50vw - @tnt-action-width / 2);
|
|
6
|
+
padding: 10px 16px;
|
|
7
|
+
background-color: @text-color;
|
|
8
|
+
border-radius: @border-radius-base;
|
|
9
|
+
z-index: 200;
|
|
10
|
+
cursor: grab;
|
|
11
|
+
box-shadow: 0px 4px 7px 0px rgba(0, 0, 0, 0.25), 0px 1px 1px 0px #263354 inset;
|
|
12
|
+
|
|
13
|
+
&-text {
|
|
14
|
+
color: @white;
|
|
15
|
+
margin-left: 20px;
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
user-select: none;
|
|
18
|
+
|
|
19
|
+
.num {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
23
|
+
background: #454f64;
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
font-size: 10px;
|
|
26
|
+
margin-right: 4px;
|
|
27
|
+
vertical-align: text-bottom;
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
>.tnt-btn-tertiary {
|
|
33
|
+
opacity: 0.5;
|
|
34
|
+
background: #454f64;
|
|
35
|
+
color: @white;
|
|
36
|
+
border-width: 0;
|
|
37
|
+
width: @tnt-action-close-width;
|
|
38
|
+
height: @tnt-action-close-width;
|
|
39
|
+
min-width: @tnt-action-close-width;
|
|
40
|
+
line-height: @tnt-action-close-width;
|
|
41
|
+
margin-top: 4px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
opacity: 0.8;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.fr {
|
|
50
|
+
float: right;
|
|
51
|
+
|
|
52
|
+
.ant-btn {
|
|
53
|
+
margin-left: 10px;
|
|
54
|
+
|
|
55
|
+
.tntd-anticon {
|
|
56
|
+
margin-right: 4px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ant-btn:not(.ant-btn-danger) {
|
|
61
|
+
background: rgba(69, 79, 100, 0.5);
|
|
62
|
+
color: @white;
|
|
63
|
+
border-width: 0;
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
background: rgba(69, 79, 100, 0.8);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-dropdown {
|
|
72
|
+
&-btn {
|
|
73
|
+
margin-left: 8px !important;
|
|
74
|
+
border-radius: @border-radius-base !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ant-dropdown-menu-item {
|
|
78
|
+
.ant-btn {
|
|
79
|
+
display: block;
|
|
80
|
+
padding: 0;
|
|
81
|
+
height: auto;
|
|
82
|
+
border: none;
|
|
83
|
+
background-color: transparent;
|
|
84
|
+
color: inherit;
|
|
85
|
+
width: calc(100% + 24px);
|
|
86
|
+
text-align: left;
|
|
87
|
+
padding: 5px 12px;
|
|
88
|
+
margin: -5px -12px;
|
|
89
|
+
|
|
90
|
+
&:hover,
|
|
91
|
+
&:active {
|
|
92
|
+
color: inherit;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&[disabled] {
|
|
96
|
+
color: @disabled-color;
|
|
97
|
+
|
|
98
|
+
&:hover,
|
|
99
|
+
&:active {
|
|
100
|
+
color: @disabled-color;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 全局设置
|
|
109
|
+
.ant-btn-group:has(.tnt-action-dropdown-btn) {
|
|
110
|
+
&>.ant-btn:nth-last-child(2) {
|
|
111
|
+
border-top-right-radius: @border-radius-base;
|
|
112
|
+
border-bottom-right-radius: @border-radius-base;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":"AAoCA;;;sBA2BC"}
|
package/lib/tntd-action/index.js
CHANGED
|
@@ -14,13 +14,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
14
14
|
});
|
|
15
15
|
exports["default"] = _default;
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _Action = _interopRequireDefault(require("./Action"));
|
|
17
18
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
18
|
-
var _popconfirm = _interopRequireDefault(require("../popconfirm"));
|
|
19
|
-
var _dropdown = _interopRequireDefault(require("../dropdown"));
|
|
20
|
-
var _button = _interopRequireDefault(require("../button"));
|
|
21
|
-
var _icon = _interopRequireDefault(require("../icon"));
|
|
22
|
-
var _menu = _interopRequireDefault(require("../menu"));
|
|
23
|
-
var _prevLocale = require("../prev-locale");
|
|
24
19
|
require("./index.less");
|
|
25
20
|
function _interopRequireDefault(e) {
|
|
26
21
|
return e && e.__esModule ? e : {
|
|
@@ -108,29 +103,16 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
108
103
|
}
|
|
109
104
|
return t;
|
|
110
105
|
};
|
|
111
|
-
|
|
112
|
-
// import Action from './Action'
|
|
113
|
-
|
|
114
106
|
var _checkShowChild = function checkShowChild(child) {
|
|
115
107
|
var _ref = child.props || {},
|
|
116
108
|
disabled = _ref.disabled,
|
|
117
109
|
children = _ref.children,
|
|
118
110
|
check = _ref.check,
|
|
119
111
|
text = _ref.text;
|
|
120
|
-
|
|
121
|
-
if (check) {
|
|
112
|
+
if (check && !disabled) {
|
|
122
113
|
return _react["default"].cloneElement(child, text ? {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// {children}
|
|
126
|
-
// <span>{text}</span>
|
|
127
|
-
// </>
|
|
128
|
-
// ),
|
|
129
|
-
children: text,
|
|
130
|
-
type: 'link'
|
|
131
|
-
} : {
|
|
132
|
-
type: 'link'
|
|
133
|
-
});
|
|
114
|
+
children: _react["default"].createElement(_react["default"].Fragment, null, children, text)
|
|
115
|
+
} : {});
|
|
134
116
|
} else if (children) {
|
|
135
117
|
var newChild = _react["default"].Children.map(children, function (child) {
|
|
136
118
|
return _checkShowChild(child);
|
|
@@ -143,30 +125,12 @@ var _checkShowChild = function checkShowChild(child) {
|
|
|
143
125
|
};
|
|
144
126
|
if (child.type === _tooltip["default"]) {
|
|
145
127
|
newProps.visible = false;
|
|
146
|
-
} else if (child.type === _popconfirm["default"]) {
|
|
147
|
-
newProps.hiddenArrow = true;
|
|
148
128
|
}
|
|
149
129
|
return _react["default"].cloneElement(child, newProps);
|
|
150
130
|
}
|
|
151
131
|
}
|
|
152
132
|
return false;
|
|
153
133
|
};
|
|
154
|
-
var _checkIsDisabled = function checkIsDisabled(child) {
|
|
155
|
-
var _ref2 = child.props || {},
|
|
156
|
-
disabled = _ref2.disabled,
|
|
157
|
-
children = _ref2.children,
|
|
158
|
-
check = _ref2.check;
|
|
159
|
-
if (check) {
|
|
160
|
-
return disabled;
|
|
161
|
-
} else if (children) {
|
|
162
|
-
return _react["default"].Children.map(children, function (child) {
|
|
163
|
-
return _checkIsDisabled(child);
|
|
164
|
-
}).filter(function (i) {
|
|
165
|
-
return !!i;
|
|
166
|
-
}).length > 0;
|
|
167
|
-
}
|
|
168
|
-
return false;
|
|
169
|
-
};
|
|
170
134
|
function _default(_a) {
|
|
171
135
|
var children = _a.children,
|
|
172
136
|
other = __rest(_a, ["children"]);
|
|
@@ -193,25 +157,7 @@ function _default(_a) {
|
|
|
193
157
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
194
158
|
thisChild = _useMemo2[0],
|
|
195
159
|
popChild = _useMemo2[1];
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
key: i,
|
|
200
|
-
disabled: _checkIsDisabled(it)
|
|
201
|
-
}, it);
|
|
202
|
-
}));
|
|
203
|
-
};
|
|
204
|
-
if (popChild.length <= 1) {
|
|
205
|
-
// 如果只有一个,直接返回
|
|
206
|
-
return children;
|
|
207
|
-
}
|
|
208
|
-
var batchOperation = (0, _prevLocale.getText)('batchOperation', (0, _prevLocale.getLanguage)());
|
|
209
|
-
return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_dropdown["default"], {
|
|
210
|
-
overlay: createMenu(popChild),
|
|
211
|
-
overlayClassName: "tnt-action-dropdown"
|
|
212
|
-
}, _react["default"].createElement(_button["default"], {
|
|
213
|
-
className: "tnt-action-dropdown-btn"
|
|
214
|
-
}, batchOperation, " ", _react["default"].createElement(_icon["default"], {
|
|
215
|
-
type: "down"
|
|
216
|
-
}))));
|
|
160
|
+
return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_Action["default"], Object.assign({
|
|
161
|
+
data: popChild
|
|
162
|
+
}, other)));
|
|
217
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,sDAA6B;AAC7B,yDAAgC;AAChC,wBAAqB;AAErB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAA;IAC7D,IAAI,KAAK,IAAI,CAAC,QAAQ,EAAE;QACtB,OAAO,eAAK,CAAC,YAAY,CACvB,KAAK,EACL,IAAI;YACF,CAAC,CAAC;gBACE,QAAQ,EAAE,CACR;oBACG,QAAQ;oBACR,IAAI,CACJ,CACJ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SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;oBACvC,IAAI,SAAS,EAAE;wBACb,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;qBACzB;iBACF;aACF;QACH,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL;QACG,SAAS;QAEV,8BAAC,gBAAM,kBAAC,IAAI,EAAE,QAAQ,IAAM,KAAK,EAAI,CACpC,CACJ,CAAA;AACH,CAAC;AA3BD,4BA2BC","sourcesContent":["import React, { useMemo } from 'react'\nimport Action from './Action'\nimport Tooltip from '../tooltip'\nimport './index.less'\n\nconst checkShowChild = (child) => {\n const { disabled, children, check, text } = child.props || {}\n if (check && !disabled) {\n return React.cloneElement(\n child,\n text\n ? {\n children: (\n <>\n {children}\n {text}\n </>\n ),\n }\n : {}\n )\n } else if (children) {\n const newChild = React.Children.map(children, (child) => {\n return checkShowChild(child)\n }).filter((i) => !!i)\n if (newChild.length > 0) {\n const newProps = { children: newChild }\n if (child.type === Tooltip) {\n newProps.visible = false\n }\n return React.cloneElement(child, newProps)\n }\n }\n return false\n}\n\nexport default function ({ children, ...other }) {\n const [thisChild, popChild] = useMemo(() => {\n const thisChild = []\n const popChild = []\n React.Children.forEach(children, (child) => {\n if (child && child.props) {\n const { exclude } = child.props\n if (exclude) {\n thisChild.push(React.cloneElement(child, { exclude: undefined }))\n } else {\n const showChild = checkShowChild(child)\n if (showChild) {\n popChild.push(showChild)\n }\n }\n }\n })\n return [thisChild, popChild]\n }, [children])\n\n return (\n <>\n {thisChild}\n\n <Action data={popChild} {...other} />\n </>\n )\n}\n"]}
|
|
@@ -67,48 +67,4 @@
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
&-dropdown {
|
|
72
|
-
&-btn {
|
|
73
|
-
margin-left: 8px !important;
|
|
74
|
-
border-radius: @border-radius-base !important;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ant-dropdown-menu-item {
|
|
78
|
-
.ant-btn {
|
|
79
|
-
display: block;
|
|
80
|
-
padding: 0;
|
|
81
|
-
height: auto;
|
|
82
|
-
border: none;
|
|
83
|
-
background-color: transparent;
|
|
84
|
-
color: inherit;
|
|
85
|
-
width: calc(100% + 24px);
|
|
86
|
-
text-align: left;
|
|
87
|
-
padding: 5px 12px;
|
|
88
|
-
margin: -5px -12px;
|
|
89
|
-
|
|
90
|
-
&:hover,
|
|
91
|
-
&:active {
|
|
92
|
-
color: inherit;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&[disabled] {
|
|
96
|
-
color: @disabled-color;
|
|
97
|
-
|
|
98
|
-
&:hover,
|
|
99
|
-
&:active {
|
|
100
|
-
color: @disabled-color;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 全局设置
|
|
109
|
-
.ant-btn-group:has(.tnt-action-dropdown-btn) {
|
|
110
|
-
&>.ant-btn:nth-last-child(2) {
|
|
111
|
-
border-top-right-radius: @border-radius-base;
|
|
112
|
-
border-bottom-right-radius: @border-radius-base;
|
|
113
|
-
}
|
|
114
70
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
.tnt-action {
|
|
2
|
+
position: fixed;
|
|
3
|
+
// bottom: 100px;
|
|
4
|
+
// width: @tnt-action-width;
|
|
5
|
+
// left: calc(50vw - @tnt-action-width / 2);
|
|
6
|
+
padding: 10px 16px;
|
|
7
|
+
background-color: @text-color;
|
|
8
|
+
border-radius: @border-radius-base;
|
|
9
|
+
z-index: 200;
|
|
10
|
+
cursor: grab;
|
|
11
|
+
box-shadow: 0px 4px 7px 0px rgba(0, 0, 0, 0.25), 0px 1px 1px 0px #263354 inset;
|
|
12
|
+
|
|
13
|
+
&-text {
|
|
14
|
+
color: @white;
|
|
15
|
+
margin-left: 20px;
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
user-select: none;
|
|
18
|
+
|
|
19
|
+
.num {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
23
|
+
background: #454f64;
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
font-size: 10px;
|
|
26
|
+
margin-right: 4px;
|
|
27
|
+
vertical-align: text-bottom;
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
>.tnt-btn-tertiary {
|
|
33
|
+
opacity: 0.5;
|
|
34
|
+
background: #454f64;
|
|
35
|
+
color: @white;
|
|
36
|
+
border-width: 0;
|
|
37
|
+
width: @tnt-action-close-width;
|
|
38
|
+
height: @tnt-action-close-width;
|
|
39
|
+
min-width: @tnt-action-close-width;
|
|
40
|
+
line-height: @tnt-action-close-width;
|
|
41
|
+
margin-top: 4px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
opacity: 0.8;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.fr {
|
|
50
|
+
float: right;
|
|
51
|
+
|
|
52
|
+
.ant-btn {
|
|
53
|
+
margin-left: 10px;
|
|
54
|
+
|
|
55
|
+
.tntd-anticon {
|
|
56
|
+
margin-right: 4px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ant-btn:not(.ant-btn-danger) {
|
|
61
|
+
background: rgba(69, 79, 100, 0.5);
|
|
62
|
+
color: @white;
|
|
63
|
+
border-width: 0;
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
background: rgba(69, 79, 100, 0.8);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-dropdown {
|
|
72
|
+
&-btn {
|
|
73
|
+
margin-left: 8px !important;
|
|
74
|
+
border-radius: @border-radius-base !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ant-dropdown-menu-item {
|
|
78
|
+
.ant-btn {
|
|
79
|
+
display: block;
|
|
80
|
+
padding: 0;
|
|
81
|
+
height: auto;
|
|
82
|
+
border: none;
|
|
83
|
+
background-color: transparent;
|
|
84
|
+
color: inherit;
|
|
85
|
+
width: calc(100% + 24px);
|
|
86
|
+
text-align: left;
|
|
87
|
+
padding: 5px 12px;
|
|
88
|
+
margin: -5px -12px;
|
|
89
|
+
|
|
90
|
+
&:hover,
|
|
91
|
+
&:active {
|
|
92
|
+
color: inherit;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&[disabled] {
|
|
96
|
+
color: @disabled-color;
|
|
97
|
+
|
|
98
|
+
&:hover,
|
|
99
|
+
&:active {
|
|
100
|
+
color: @disabled-color;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 全局设置
|
|
109
|
+
.ant-btn-group:has(.tnt-action-dropdown-btn) {
|
|
110
|
+
&>.ant-btn:nth-last-child(2) {
|
|
111
|
+
border-top-right-radius: @border-radius-base;
|
|
112
|
+
border-bottom-right-radius: @border-radius-base;
|
|
113
|
+
}
|
|
114
|
+
}
|