tntd 3.0.75 → 3.0.77
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/query-list-scene/List.js +5 -0
- package/es/query-list-scene/List.js.map +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/query-list-scene/List.d.ts +1 -0
- package/lib/query-list-scene/List.d.ts.map +1 -1
- package/lib/query-list-scene/List.js +5 -0
- package/lib/query-list-scene/List.js.map +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
|
@@ -93,10 +93,15 @@ var QueryList = exports["default"] = /*#__PURE__*/function (_React$PureComponent
|
|
|
93
93
|
if (!isInterval) {
|
|
94
94
|
_this.isFetching = true;
|
|
95
95
|
}
|
|
96
|
+
var currentRequestTime = new Date().getTime();
|
|
97
|
+
_this.lastestRequestTime = currentRequestTime;
|
|
96
98
|
actions.setData('submittedFormData', params);
|
|
97
99
|
return query((0, _pickBy2["default"])(params, function (val) {
|
|
98
100
|
return val !== '' && val !== null && val !== undefined;
|
|
99
101
|
})).then(function (result) {
|
|
102
|
+
if (_this.lastestRequestTime !== currentRequestTime) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
100
105
|
var dataSource = hasPagination ? result.data || [] : result;
|
|
101
106
|
_this.setState(Object.assign({
|
|
102
107
|
loading: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CA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,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC9D,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;CAgKF","sourcesContent":["/**\n * @file QueryList\n * @author you.zhang\n */\nimport cn from 'classnames'\nimport { debounce, get, isEmpty, pickBy, throttle } from 'lodash'\nimport React, { createRef } from 'react'\nimport { findDOMNode } from 'react-dom'\n\nimport { getLanguage, getText } from '../prev-locale'\nimport Spin from '../spin'\nimport Table from '../table'\n\nexport default class QueryList extends React.PureComponent {\n constructor(props) {\n super(props)\n this.state = {\n loading: false,\n dataSource: [],\n pagination: {\n // pageSize: 20,\n current: 1,\n total: 0,\n },\n scroll: props.scroll,\n hasScrollToBottom: !props.scroll?.y,\n }\n\n this.tableRef = createRef()\n\n const { actions } = props\n actions.on('search', this.onSearch)\n actions.on('setTableDataSource', this.updateDataSource)\n actions.on('setPagination', this.updatePagination)\n actions.on('setFormData', this.onFormChange)\n }\n\n render() {\n const {\n columns,\n children,\n pagination,\n localPagination = false,\n paginationSticky = false,\n className = '',\n qlsProps,\n ...rest\n } = this.props\n const { dataSource, loading, expandedRowKeys = [], scroll, hasScrollToBottom } = this.state\n const hasPagination = typeof pagination !== 'undefined' ? pagination : true\n const paginationInfo = {\n hideOnSinglePage: false,\n ...this.state.pagination,\n // size: 'small',\n showQuickJumper: true,\n showSizeChanger: true,\n showTotal: (total) => getText('totalRecords', getLanguage(), total),\n ...(pagination || {}),\n }\n const expandProps = {\n ...(rest.defaultExpandAllRows\n ? {\n expandedRowKeys,\n onExpandedRowsChange: this.onExpandedRowsChange,\n }\n : {}),\n }\n\n return (\n <div\n className={cn(`tnt-querylistscene-list ${className}`, {\n paginationSticky,\n hasScrollToBottom,\n })}\n >\n <Spin spinning={loading}>\n <Table\n ref={this.tableRef}\n shadowed={false}\n bordered={false}\n {...expandProps}\n {...rest}\n {...(columns\n ? {\n columns,\n }\n : {})}\n scroll={scroll}\n dataSource={dataSource}\n pagination={hasPagination ? paginationInfo : localPagination}\n onChange={this.onTableChange}\n >\n {!columns && children}\n </Table>\n </Spin>\n </div>\n )\n }\n\n onWindowResize = debounce(() => {\n const { scroll } = this.state\n\n this.setState({\n scroll: {\n ...scroll,\n y: window.innerHeight - (this.initialTop || this.props.top || 200),\n },\n })\n }, 50)\n\n componentDidMount() {\n const { qlsProps, actions } = this.props\n\n this.formData = {\n ...(actions.getFormData() || {}),\n // 记住上次查询的分页参数\n ...(qlsProps.memory ? actions.getPagination() : {}),\n }\n\n if (!qlsProps.initSearch) {\n // 默认进来不请求\n this.fetchData(this.formData).finally(() => {\n // 轮询\n if (qlsProps.interval && !this.isUnmounted) {\n const doIntervalQuery = (ms) => {\n // 组件unmounted后,不执行轮训逻辑\n if (!this.isUnmounted) {\n this.timmer = setTimeout(() => {\n // 如果有查询请求还未结束,则该次轮询不执行,重新设置下次轮询\n if (!this.isFetching) {\n this.fetchData(actions.getSubmittedFormData(), {\n isInterval: true,\n showLoading: false,\n }).then(() => {\n doIntervalQuery(ms)\n })\n } else {\n doIntervalQuery(ms)\n }\n }, ms)\n }\n }\n doIntervalQuery(qlsProps.interval)\n }\n })\n }\n if (this.state.scroll?.y) {\n window.addEventListener('resize', this.onWindowResize)\n\n if (this.tableRef.current) {\n // table内垂直滚动,需要动态设置分页组件上阴影样式\n const tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body')\n this.initialTop = window.innerHeight - this.state.scroll.y\n this.updateIsScrollToBottom(tableBody)\n tableBody.addEventListener('scroll', this.onTableBodyScroll)\n }\n }\n }\n\n componentWillUnmount() {\n const { actions } = this.props\n\n this.isUnmounted = true\n\n actions.removeListener('search', this.onSearch)\n actions.removeListener('setTableDataSource', this.updateDataSource)\n actions.removeListener('setPagination', this.updatePagination)\n actions.removeListener('setFormData', this.onFormChange)\n window.removeEventListener('resize', this.onWindowResize)\n this.timmer && clearTimeout(this.timmer)\n }\n\n fetchData = (params = {}, { callback, showLoading = true, isInterval } = {}) => {\n const {\n qlsProps: { query },\n defaultExpandAllRows,\n rowKey,\n actions,\n } = this.props\n const { pagination } = this.state\n const hasPagination = this.props.pagination !== false\n\n if (hasPagination) {\n params = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n ...params,\n }\n }\n\n showLoading &&\n this.setState({\n loading: true,\n })\n\n // 当用户操作查询还未得到服务端响应前,不要执行轮询请求时序问题导致覆盖\n if (!isInterval) {\n this.isFetching = true\n }\n\n actions.setData('submittedFormData', params)\n\n return query(pickBy(params, (val) => val !== '' && val !== null && val !== undefined))\n .then((result) => {\n const dataSource = hasPagination ? result.data || [] : result\n\n this.setState(\n {\n loading: false,\n dataSource,\n pagination: hasPagination\n ? {\n pageSize: result.pageSize || pagination.pageSize || 10,\n current: result.current || params.current || pagination.current || 1,\n total: result.total || 0,\n }\n : null,\n ...(defaultExpandAllRows\n ? {\n expandedRowKeys: dataSource.map((row) => row[rowKey]),\n }\n : {}),\n },\n () => {\n actions.setData('pagination', this.state.pagination)\n actions.setData('dataSource', this.state.dataSource)\n }\n )\n })\n .finally(() => {\n this.isFetching = false\n showLoading &&\n this.setState({\n loading: false,\n })\n callback && callback()\n })\n }\n\n updateDataSource = (dataSource) => {\n this.setState({\n dataSource,\n })\n this.props.actions.setData('dataSource', dataSource)\n }\n\n updatePagination = (pagination) => {\n this.setState({\n pagination,\n })\n this.props.actions.setData('pagination', pagination)\n }\n\n onFormChange = (values) => {\n this.formData = pickBy(\n {\n ...values,\n sorter: get(this.formData, 'sorter'),\n filters: get(this.formData, 'filters'),\n },\n (val) => val !== undefined\n )\n }\n\n onSearch = (values, { callback, showLoading = true } = {}) => {\n this.formData = {\n ...this.formData,\n ...values,\n }\n // this.props.actions.setData('formData', this.formData);\n return this.fetchData(this.formData, { callback, showLoading })\n }\n\n onTableChange = (pagination, filters, sorter) => {\n const { actions, localPagination } = this.props\n const tableParams = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n filters: isEmpty(filters) ? undefined : filters,\n sorter: isEmpty(sorter) ? undefined : sorter,\n }\n\n Object.assign(this.formData, tableParams)\n\n // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求\n // 所以暂时排序有使用者自己处理\n if (!localPagination) {\n this.fetchData({\n ...actions.getSubmittedFormData(),\n ...tableParams,\n })\n return\n }\n\n const { dataSource } = this.state\n\n // 前端本地分页\n if (localPagination) {\n this.setState(\n {\n dataSource,\n pagination: {\n current: pagination.current,\n pageSize: pagination.pageSize,\n total: pagination.total,\n },\n },\n () => {\n actions.setData('formData', this.formData)\n actions.setData('pagination', this.state.pagination)\n }\n )\n }\n }\n\n onTableBodyScroll = throttle((evt) => {\n this.updateIsScrollToBottom(evt.target)\n }, 50)\n\n updateIsScrollToBottom = (tableBody) => {\n const isScrollToBottom = (tableBody) => {\n const { scrollHeight, scrollTop, offsetHeight } = tableBody\n\n return scrollHeight === scrollTop + offsetHeight\n }\n\n this.setState({\n hasScrollToBottom: isScrollToBottom(tableBody),\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjE,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,IAAI,MAAM,SAAS,CAA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YAAY,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;CAoKF","sourcesContent":["/**\n * @file QueryList\n * @author you.zhang\n */\nimport cn from 'classnames'\nimport { debounce, get, isEmpty, pickBy, throttle } from 'lodash'\nimport React, { createRef } from 'react'\nimport { findDOMNode } from 'react-dom'\n\nimport { getLanguage, getText } from '../prev-locale'\nimport Spin from '../spin'\nimport Table from '../table'\n\nexport default class QueryList extends React.PureComponent {\n constructor(props) {\n super(props)\n this.state = {\n loading: false,\n dataSource: [],\n pagination: {\n // pageSize: 20,\n current: 1,\n total: 0,\n },\n scroll: props.scroll,\n hasScrollToBottom: !props.scroll?.y,\n }\n\n this.tableRef = createRef()\n\n const { actions } = props\n actions.on('search', this.onSearch)\n actions.on('setTableDataSource', this.updateDataSource)\n actions.on('setPagination', this.updatePagination)\n actions.on('setFormData', this.onFormChange)\n }\n\n render() {\n const {\n columns,\n children,\n pagination,\n localPagination = false,\n paginationSticky = false,\n className = '',\n qlsProps,\n ...rest\n } = this.props\n const { dataSource, loading, expandedRowKeys = [], scroll, hasScrollToBottom } = this.state\n const hasPagination = typeof pagination !== 'undefined' ? pagination : true\n const paginationInfo = {\n hideOnSinglePage: false,\n ...this.state.pagination,\n // size: 'small',\n showQuickJumper: true,\n showSizeChanger: true,\n showTotal: (total) => getText('totalRecords', getLanguage(), total),\n ...(pagination || {}),\n }\n const expandProps = {\n ...(rest.defaultExpandAllRows\n ? {\n expandedRowKeys,\n onExpandedRowsChange: this.onExpandedRowsChange,\n }\n : {}),\n }\n\n return (\n <div\n className={cn(`tnt-querylistscene-list ${className}`, {\n paginationSticky,\n hasScrollToBottom,\n })}\n >\n <Spin spinning={loading}>\n <Table\n ref={this.tableRef}\n shadowed={false}\n bordered={false}\n {...expandProps}\n {...rest}\n {...(columns\n ? {\n columns,\n }\n : {})}\n scroll={scroll}\n dataSource={dataSource}\n pagination={hasPagination ? paginationInfo : localPagination}\n onChange={this.onTableChange}\n >\n {!columns && children}\n </Table>\n </Spin>\n </div>\n )\n }\n\n onWindowResize = debounce(() => {\n const { scroll } = this.state\n\n this.setState({\n scroll: {\n ...scroll,\n y: window.innerHeight - (this.initialTop || this.props.top || 200),\n },\n })\n }, 50)\n\n componentDidMount() {\n const { qlsProps, actions } = this.props\n\n this.formData = {\n ...(actions.getFormData() || {}),\n // 记住上次查询的分页参数\n ...(qlsProps.memory ? actions.getPagination() : {}),\n }\n\n if (!qlsProps.initSearch) {\n // 默认进来不请求\n this.fetchData(this.formData).finally(() => {\n // 轮询\n if (qlsProps.interval && !this.isUnmounted) {\n const doIntervalQuery = (ms) => {\n // 组件unmounted后,不执行轮训逻辑\n if (!this.isUnmounted) {\n this.timmer = setTimeout(() => {\n // 如果有查询请求还未结束,则该次轮询不执行,重新设置下次轮询\n if (!this.isFetching) {\n this.fetchData(actions.getSubmittedFormData(), {\n isInterval: true,\n showLoading: false,\n }).then(() => {\n doIntervalQuery(ms)\n })\n } else {\n doIntervalQuery(ms)\n }\n }, ms)\n }\n }\n doIntervalQuery(qlsProps.interval)\n }\n })\n }\n if (this.state.scroll?.y) {\n window.addEventListener('resize', this.onWindowResize)\n\n if (this.tableRef.current) {\n // table内垂直滚动,需要动态设置分页组件上阴影样式\n const tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body')\n this.initialTop = window.innerHeight - this.state.scroll.y\n this.updateIsScrollToBottom(tableBody)\n tableBody.addEventListener('scroll', this.onTableBodyScroll)\n }\n }\n }\n\n componentWillUnmount() {\n const { actions } = this.props\n\n this.isUnmounted = true\n\n actions.removeListener('search', this.onSearch)\n actions.removeListener('setTableDataSource', this.updateDataSource)\n actions.removeListener('setPagination', this.updatePagination)\n actions.removeListener('setFormData', this.onFormChange)\n window.removeEventListener('resize', this.onWindowResize)\n this.timmer && clearTimeout(this.timmer)\n }\n\n fetchData = (params = {}, { callback, showLoading = true, isInterval } = {}) => {\n const {\n qlsProps: { query },\n defaultExpandAllRows,\n rowKey,\n actions,\n } = this.props\n const { pagination } = this.state\n const hasPagination = this.props.pagination !== false\n\n if (hasPagination) {\n params = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n ...params,\n }\n }\n\n showLoading &&\n this.setState({\n loading: true,\n })\n\n // 当用户操作查询还未得到服务端响应前,不要执行轮询请求时序问题导致覆盖\n if (!isInterval) {\n this.isFetching = true\n }\n const currentRequestTime = new Date().getTime();\n this.lastestRequestTime = currentRequestTime;\n actions.setData('submittedFormData', params)\n\n return query(pickBy(params, (val) => val !== '' && val !== null && val !== undefined))\n .then((result) => {\n if(this.lastestRequestTime !== currentRequestTime){\n return;\n }\n const dataSource = hasPagination ? result.data || [] : result\n\n this.setState(\n {\n loading: false,\n dataSource,\n pagination: hasPagination\n ? {\n pageSize: result.pageSize || pagination.pageSize || 10,\n current: result.current || params.current || pagination.current || 1,\n total: result.total || 0,\n }\n : null,\n ...(defaultExpandAllRows\n ? {\n expandedRowKeys: dataSource.map((row) => row[rowKey]),\n }\n : {}),\n },\n () => {\n actions.setData('pagination', this.state.pagination)\n actions.setData('dataSource', this.state.dataSource)\n }\n )\n })\n .finally(() => {\n this.isFetching = false\n showLoading &&\n this.setState({\n loading: false,\n })\n callback && callback()\n })\n }\n\n updateDataSource = (dataSource) => {\n this.setState({\n dataSource,\n })\n this.props.actions.setData('dataSource', dataSource)\n }\n\n updatePagination = (pagination) => {\n this.setState({\n pagination,\n })\n this.props.actions.setData('pagination', pagination)\n }\n\n onFormChange = (values) => {\n this.formData = pickBy(\n {\n ...values,\n sorter: get(this.formData, 'sorter'),\n filters: get(this.formData, 'filters'),\n },\n (val) => val !== undefined\n )\n }\n\n onSearch = (values, { callback, showLoading = true } = {}) => {\n this.formData = {\n ...this.formData,\n ...values,\n }\n // this.props.actions.setData('formData', this.formData);\n return this.fetchData(this.formData, { callback, showLoading })\n }\n\n onTableChange = (pagination, filters, sorter) => {\n const { actions, localPagination } = this.props\n const tableParams = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n filters: isEmpty(filters) ? undefined : filters,\n sorter: isEmpty(sorter) ? undefined : sorter,\n }\n\n Object.assign(this.formData, tableParams)\n\n // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求\n // 所以暂时排序有使用者自己处理\n if (!localPagination) {\n this.fetchData({\n ...actions.getSubmittedFormData(),\n ...tableParams,\n })\n return\n }\n\n const { dataSource } = this.state\n\n // 前端本地分页\n if (localPagination) {\n this.setState(\n {\n dataSource,\n pagination: {\n current: pagination.current,\n pageSize: pagination.pageSize,\n total: pagination.total,\n },\n },\n () => {\n actions.setData('formData', this.formData)\n actions.setData('pagination', this.state.pagination)\n }\n )\n }\n }\n\n onTableBodyScroll = throttle((evt) => {\n this.updateIsScrollToBottom(evt.target)\n }, 50)\n\n updateIsScrollToBottom = (tableBody) => {\n const isScrollToBottom = (tableBody) => {\n const { scrollHeight, scrollTop, offsetHeight } = tableBody\n\n return scrollHeight === scrollTop + offsetHeight\n }\n\n this.setState({\n hasScrollToBottom: isScrollToBottom(tableBody),\n })\n }\n}\n"]}
|
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
|
+
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AAW,EAAsB;QAAtB,EAAE,QAAQ,OAAY,EAAP,KAAK,cAApB,YAAsB,CAAF;IAC3C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE;QACzC,MAAM,SAAS,GAAG,EAAE,CAAA;QACpB,MAAM,QAAQ,GAAG,EAAE,CAAA;QACnB,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,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
|
+
}
|
|
@@ -25,6 +25,7 @@ export default class QueryList extends React.PureComponent<any, any, any> {
|
|
|
25
25
|
isInterval: any;
|
|
26
26
|
}) => any;
|
|
27
27
|
isFetching: boolean | undefined;
|
|
28
|
+
lastestRequestTime: number | undefined;
|
|
28
29
|
updateDataSource: (dataSource: any) => void;
|
|
29
30
|
updatePagination: (pagination: any) => void;
|
|
30
31
|
onFormChange: (values: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":"AAaA;IACE,wBAqBC;IAnBC;;;;;;;;;MAUC;IAED,+BAA2B;IAS7B,4BA4DC;IAED,2DASM;IAEN,0BA+CC;IA5CC,cAIC;IAUS,mCAYM;IAaZ,+BAA0D;IAOhE,6BAWC;IARC,iCAAuB;IAUzB;;;;
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":"AAaA;IACE,wBAqBC;IAnBC;;;;;;;;;MAUC;IAED,+BAA2B;IAS7B,4BA4DC;IAED,2DASM;IAEN,0BA+CC;IA5CC,cAIC;IAUS,mCAYM;IAaZ,+BAA0D;IAOhE,6BAWC;IARC,iCAAuB;IAUzB;;;;cAqEC;IA5CG,gCAAsB;IAGxB,uCAA4C;IA2C9C,4CAKC;IAED,4CAKC;IAED,oCASC;IAED;;;cAOC;IAED,oEAwCC;IAED,sEAEM;IAEN,iDAUC;CACF"}
|
|
@@ -186,10 +186,15 @@ var QueryList = exports["default"] = /*#__PURE__*/function (_React$PureComponent
|
|
|
186
186
|
if (!isInterval) {
|
|
187
187
|
_this.isFetching = true;
|
|
188
188
|
}
|
|
189
|
+
var currentRequestTime = new Date().getTime();
|
|
190
|
+
_this.lastestRequestTime = currentRequestTime;
|
|
189
191
|
actions.setData('submittedFormData', params);
|
|
190
192
|
return query((0, _pickBy2["default"])(params, function (val) {
|
|
191
193
|
return val !== '' && val !== null && val !== undefined;
|
|
192
194
|
})).then(function (result) {
|
|
195
|
+
if (_this.lastestRequestTime !== currentRequestTime) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
193
198
|
var dataSource = hasPagination ? result.data || [] : result;
|
|
194
199
|
_this.setState(Object.assign({
|
|
195
200
|
loading: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,4DAA2B;AAC3B,mCAAiE;AACjE,+CAAwC;AACxC,yCAAuC;AAEvC,gDAAqD;AACrD,mDAA0B;AAC1B,qDAA4B;AAE5B,MAAqB,SAAU,SAAQ,eAAK,CAAC,aAAa;IACxD,YAAY,KAAK;;QACf,KAAK,CAAC,KAAK,CAAC,CAAA;QAoFd;;;;mBAAiB,IAAA,iBAAQ,EAAC,GAAG,EAAE;gBAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;gBAE7B,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,kCACD,MAAM,KACT,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GACnE;iBACF,CAAC,CAAA;YACJ,CAAC,EAAE,EAAE,CAAC;WAAA;QAgEN;;;;mBAAY,CAAC,MAAM,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE;gBAC7E,MAAM,EACJ,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AC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;aAC7D;SACF;IACH,CAAC;IAED,oBAAoB;QAClB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE9B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QAEvB,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC/C,OAAO,CAAC,cAAc,CAAC,oBAAoB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACnE,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC9D,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;CAgKF;AA7TD,4BA6TC","sourcesContent":["/**\n * @file QueryList\n * @author you.zhang\n */\nimport cn from 'classnames'\nimport { debounce, get, isEmpty, pickBy, throttle } from 'lodash'\nimport React, { createRef } from 'react'\nimport { findDOMNode } from 'react-dom'\n\nimport { getLanguage, getText } from '../prev-locale'\nimport Spin from '../spin'\nimport Table from '../table'\n\nexport default class QueryList extends React.PureComponent {\n constructor(props) {\n super(props)\n this.state = {\n loading: false,\n dataSource: [],\n pagination: {\n // pageSize: 20,\n current: 1,\n total: 0,\n },\n scroll: props.scroll,\n hasScrollToBottom: !props.scroll?.y,\n }\n\n this.tableRef = createRef()\n\n const { actions } = props\n actions.on('search', this.onSearch)\n actions.on('setTableDataSource', this.updateDataSource)\n actions.on('setPagination', this.updatePagination)\n actions.on('setFormData', this.onFormChange)\n }\n\n render() {\n const {\n columns,\n children,\n pagination,\n localPagination = false,\n paginationSticky = false,\n className = '',\n qlsProps,\n ...rest\n } = this.props\n const { dataSource, loading, expandedRowKeys = [], scroll, hasScrollToBottom } = this.state\n const hasPagination = typeof pagination !== 'undefined' ? pagination : true\n const paginationInfo = {\n hideOnSinglePage: false,\n ...this.state.pagination,\n // size: 'small',\n showQuickJumper: true,\n showSizeChanger: true,\n showTotal: (total) => getText('totalRecords', getLanguage(), total),\n ...(pagination || {}),\n }\n const expandProps = {\n ...(rest.defaultExpandAllRows\n ? {\n expandedRowKeys,\n onExpandedRowsChange: this.onExpandedRowsChange,\n }\n : {}),\n }\n\n return (\n <div\n className={cn(`tnt-querylistscene-list ${className}`, {\n paginationSticky,\n hasScrollToBottom,\n })}\n >\n <Spin spinning={loading}>\n <Table\n ref={this.tableRef}\n shadowed={false}\n bordered={false}\n {...expandProps}\n {...rest}\n {...(columns\n ? {\n columns,\n }\n : {})}\n scroll={scroll}\n dataSource={dataSource}\n pagination={hasPagination ? paginationInfo : localPagination}\n onChange={this.onTableChange}\n >\n {!columns && children}\n </Table>\n </Spin>\n </div>\n )\n }\n\n onWindowResize = debounce(() => {\n const { scroll } = this.state\n\n this.setState({\n scroll: {\n ...scroll,\n y: window.innerHeight - (this.initialTop || this.props.top || 200),\n },\n })\n }, 50)\n\n componentDidMount() {\n const { qlsProps, actions } = this.props\n\n this.formData = {\n ...(actions.getFormData() || {}),\n // 记住上次查询的分页参数\n ...(qlsProps.memory ? actions.getPagination() : {}),\n }\n\n if (!qlsProps.initSearch) {\n // 默认进来不请求\n this.fetchData(this.formData).finally(() => {\n // 轮询\n if (qlsProps.interval && !this.isUnmounted) {\n const doIntervalQuery = (ms) => {\n // 组件unmounted后,不执行轮训逻辑\n if (!this.isUnmounted) {\n this.timmer = setTimeout(() => {\n // 如果有查询请求还未结束,则该次轮询不执行,重新设置下次轮询\n if (!this.isFetching) {\n this.fetchData(actions.getSubmittedFormData(), {\n isInterval: true,\n showLoading: false,\n }).then(() => {\n doIntervalQuery(ms)\n })\n } else {\n doIntervalQuery(ms)\n }\n }, ms)\n }\n }\n doIntervalQuery(qlsProps.interval)\n }\n })\n }\n if (this.state.scroll?.y) {\n window.addEventListener('resize', this.onWindowResize)\n\n if (this.tableRef.current) {\n // table内垂直滚动,需要动态设置分页组件上阴影样式\n const tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body')\n this.initialTop = window.innerHeight - this.state.scroll.y\n this.updateIsScrollToBottom(tableBody)\n tableBody.addEventListener('scroll', this.onTableBodyScroll)\n }\n }\n }\n\n componentWillUnmount() {\n const { actions } = this.props\n\n this.isUnmounted = true\n\n actions.removeListener('search', this.onSearch)\n actions.removeListener('setTableDataSource', this.updateDataSource)\n actions.removeListener('setPagination', this.updatePagination)\n actions.removeListener('setFormData', this.onFormChange)\n window.removeEventListener('resize', this.onWindowResize)\n this.timmer && clearTimeout(this.timmer)\n }\n\n fetchData = (params = {}, { callback, showLoading = true, isInterval } = {}) => {\n const {\n qlsProps: { query },\n defaultExpandAllRows,\n rowKey,\n actions,\n } = this.props\n const { pagination } = this.state\n const hasPagination = this.props.pagination !== false\n\n if (hasPagination) {\n params = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n ...params,\n }\n }\n\n showLoading &&\n this.setState({\n loading: true,\n })\n\n // 当用户操作查询还未得到服务端响应前,不要执行轮询请求时序问题导致覆盖\n if (!isInterval) {\n this.isFetching = true\n }\n\n actions.setData('submittedFormData', params)\n\n return query(pickBy(params, (val) => val !== '' && val !== null && val !== undefined))\n .then((result) => {\n const dataSource = hasPagination ? result.data || [] : result\n\n this.setState(\n {\n loading: false,\n dataSource,\n pagination: hasPagination\n ? {\n pageSize: result.pageSize || pagination.pageSize || 10,\n current: result.current || params.current || pagination.current || 1,\n total: result.total || 0,\n }\n : null,\n ...(defaultExpandAllRows\n ? {\n expandedRowKeys: dataSource.map((row) => row[rowKey]),\n }\n : {}),\n },\n () => {\n actions.setData('pagination', this.state.pagination)\n actions.setData('dataSource', this.state.dataSource)\n }\n )\n })\n .finally(() => {\n this.isFetching = false\n showLoading &&\n this.setState({\n loading: false,\n })\n callback && callback()\n })\n }\n\n updateDataSource = (dataSource) => {\n this.setState({\n dataSource,\n })\n this.props.actions.setData('dataSource', dataSource)\n }\n\n updatePagination = (pagination) => {\n this.setState({\n pagination,\n })\n this.props.actions.setData('pagination', pagination)\n }\n\n onFormChange = (values) => {\n this.formData = pickBy(\n {\n ...values,\n sorter: get(this.formData, 'sorter'),\n filters: get(this.formData, 'filters'),\n },\n (val) => val !== undefined\n )\n }\n\n onSearch = (values, { callback, showLoading = true } = {}) => {\n this.formData = {\n ...this.formData,\n ...values,\n }\n // this.props.actions.setData('formData', this.formData);\n return this.fetchData(this.formData, { callback, showLoading })\n }\n\n onTableChange = (pagination, filters, sorter) => {\n const { actions, localPagination } = this.props\n const tableParams = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n filters: isEmpty(filters) ? undefined : filters,\n sorter: isEmpty(sorter) ? undefined : sorter,\n }\n\n Object.assign(this.formData, tableParams)\n\n // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求\n // 所以暂时排序有使用者自己处理\n if (!localPagination) {\n this.fetchData({\n ...actions.getSubmittedFormData(),\n ...tableParams,\n })\n return\n }\n\n const { dataSource } = this.state\n\n // 前端本地分页\n if (localPagination) {\n this.setState(\n {\n dataSource,\n pagination: {\n current: pagination.current,\n pageSize: pagination.pageSize,\n total: pagination.total,\n },\n },\n () => {\n actions.setData('formData', this.formData)\n actions.setData('pagination', this.state.pagination)\n }\n )\n }\n }\n\n onTableBodyScroll = throttle((evt) => {\n this.updateIsScrollToBottom(evt.target)\n }, 50)\n\n updateIsScrollToBottom = (tableBody) => {\n const isScrollToBottom = (tableBody) => {\n const { scrollHeight, scrollTop, offsetHeight } = tableBody\n\n return scrollHeight === scrollTop + offsetHeight\n }\n\n this.setState({\n hasScrollToBottom: isScrollToBottom(tableBody),\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/query-list-scene/List.js"],"names":[],"mappings":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O,CAAC,cAAc,CAAC,oBAAoB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACnE,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC9D,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACxD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;CAoKF;AAjUD,4BAiUC","sourcesContent":["/**\n * @file QueryList\n * @author you.zhang\n */\nimport cn from 'classnames'\nimport { debounce, get, isEmpty, pickBy, throttle } from 'lodash'\nimport React, { createRef } from 'react'\nimport { findDOMNode } from 'react-dom'\n\nimport { getLanguage, getText } from '../prev-locale'\nimport Spin from '../spin'\nimport Table from '../table'\n\nexport default class QueryList extends React.PureComponent {\n constructor(props) {\n super(props)\n this.state = {\n loading: false,\n dataSource: [],\n pagination: {\n // pageSize: 20,\n current: 1,\n total: 0,\n },\n scroll: props.scroll,\n hasScrollToBottom: !props.scroll?.y,\n }\n\n this.tableRef = createRef()\n\n const { actions } = props\n actions.on('search', this.onSearch)\n actions.on('setTableDataSource', this.updateDataSource)\n actions.on('setPagination', this.updatePagination)\n actions.on('setFormData', this.onFormChange)\n }\n\n render() {\n const {\n columns,\n children,\n pagination,\n localPagination = false,\n paginationSticky = false,\n className = '',\n qlsProps,\n ...rest\n } = this.props\n const { dataSource, loading, expandedRowKeys = [], scroll, hasScrollToBottom } = this.state\n const hasPagination = typeof pagination !== 'undefined' ? pagination : true\n const paginationInfo = {\n hideOnSinglePage: false,\n ...this.state.pagination,\n // size: 'small',\n showQuickJumper: true,\n showSizeChanger: true,\n showTotal: (total) => getText('totalRecords', getLanguage(), total),\n ...(pagination || {}),\n }\n const expandProps = {\n ...(rest.defaultExpandAllRows\n ? {\n expandedRowKeys,\n onExpandedRowsChange: this.onExpandedRowsChange,\n }\n : {}),\n }\n\n return (\n <div\n className={cn(`tnt-querylistscene-list ${className}`, {\n paginationSticky,\n hasScrollToBottom,\n })}\n >\n <Spin spinning={loading}>\n <Table\n ref={this.tableRef}\n shadowed={false}\n bordered={false}\n {...expandProps}\n {...rest}\n {...(columns\n ? {\n columns,\n }\n : {})}\n scroll={scroll}\n dataSource={dataSource}\n pagination={hasPagination ? paginationInfo : localPagination}\n onChange={this.onTableChange}\n >\n {!columns && children}\n </Table>\n </Spin>\n </div>\n )\n }\n\n onWindowResize = debounce(() => {\n const { scroll } = this.state\n\n this.setState({\n scroll: {\n ...scroll,\n y: window.innerHeight - (this.initialTop || this.props.top || 200),\n },\n })\n }, 50)\n\n componentDidMount() {\n const { qlsProps, actions } = this.props\n\n this.formData = {\n ...(actions.getFormData() || {}),\n // 记住上次查询的分页参数\n ...(qlsProps.memory ? actions.getPagination() : {}),\n }\n\n if (!qlsProps.initSearch) {\n // 默认进来不请求\n this.fetchData(this.formData).finally(() => {\n // 轮询\n if (qlsProps.interval && !this.isUnmounted) {\n const doIntervalQuery = (ms) => {\n // 组件unmounted后,不执行轮训逻辑\n if (!this.isUnmounted) {\n this.timmer = setTimeout(() => {\n // 如果有查询请求还未结束,则该次轮询不执行,重新设置下次轮询\n if (!this.isFetching) {\n this.fetchData(actions.getSubmittedFormData(), {\n isInterval: true,\n showLoading: false,\n }).then(() => {\n doIntervalQuery(ms)\n })\n } else {\n doIntervalQuery(ms)\n }\n }, ms)\n }\n }\n doIntervalQuery(qlsProps.interval)\n }\n })\n }\n if (this.state.scroll?.y) {\n window.addEventListener('resize', this.onWindowResize)\n\n if (this.tableRef.current) {\n // table内垂直滚动,需要动态设置分页组件上阴影样式\n const tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body')\n this.initialTop = window.innerHeight - this.state.scroll.y\n this.updateIsScrollToBottom(tableBody)\n tableBody.addEventListener('scroll', this.onTableBodyScroll)\n }\n }\n }\n\n componentWillUnmount() {\n const { actions } = this.props\n\n this.isUnmounted = true\n\n actions.removeListener('search', this.onSearch)\n actions.removeListener('setTableDataSource', this.updateDataSource)\n actions.removeListener('setPagination', this.updatePagination)\n actions.removeListener('setFormData', this.onFormChange)\n window.removeEventListener('resize', this.onWindowResize)\n this.timmer && clearTimeout(this.timmer)\n }\n\n fetchData = (params = {}, { callback, showLoading = true, isInterval } = {}) => {\n const {\n qlsProps: { query },\n defaultExpandAllRows,\n rowKey,\n actions,\n } = this.props\n const { pagination } = this.state\n const hasPagination = this.props.pagination !== false\n\n if (hasPagination) {\n params = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n ...params,\n }\n }\n\n showLoading &&\n this.setState({\n loading: true,\n })\n\n // 当用户操作查询还未得到服务端响应前,不要执行轮询请求时序问题导致覆盖\n if (!isInterval) {\n this.isFetching = true\n }\n const currentRequestTime = new Date().getTime();\n this.lastestRequestTime = currentRequestTime;\n actions.setData('submittedFormData', params)\n\n return query(pickBy(params, (val) => val !== '' && val !== null && val !== undefined))\n .then((result) => {\n if(this.lastestRequestTime !== currentRequestTime){\n return;\n }\n const dataSource = hasPagination ? result.data || [] : result\n\n this.setState(\n {\n loading: false,\n dataSource,\n pagination: hasPagination\n ? {\n pageSize: result.pageSize || pagination.pageSize || 10,\n current: result.current || params.current || pagination.current || 1,\n total: result.total || 0,\n }\n : null,\n ...(defaultExpandAllRows\n ? {\n expandedRowKeys: dataSource.map((row) => row[rowKey]),\n }\n : {}),\n },\n () => {\n actions.setData('pagination', this.state.pagination)\n actions.setData('dataSource', this.state.dataSource)\n }\n )\n })\n .finally(() => {\n this.isFetching = false\n showLoading &&\n this.setState({\n loading: false,\n })\n callback && callback()\n })\n }\n\n updateDataSource = (dataSource) => {\n this.setState({\n dataSource,\n })\n this.props.actions.setData('dataSource', dataSource)\n }\n\n updatePagination = (pagination) => {\n this.setState({\n pagination,\n })\n this.props.actions.setData('pagination', pagination)\n }\n\n onFormChange = (values) => {\n this.formData = pickBy(\n {\n ...values,\n sorter: get(this.formData, 'sorter'),\n filters: get(this.formData, 'filters'),\n },\n (val) => val !== undefined\n )\n }\n\n onSearch = (values, { callback, showLoading = true } = {}) => {\n this.formData = {\n ...this.formData,\n ...values,\n }\n // this.props.actions.setData('formData', this.formData);\n return this.fetchData(this.formData, { callback, showLoading })\n }\n\n onTableChange = (pagination, filters, sorter) => {\n const { actions, localPagination } = this.props\n const tableParams = {\n pageSize: pagination.pageSize,\n current: pagination.current,\n filters: isEmpty(filters) ? undefined : filters,\n sorter: isEmpty(sorter) ? undefined : sorter,\n }\n\n Object.assign(this.formData, tableParams)\n\n // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求\n // 所以暂时排序有使用者自己处理\n if (!localPagination) {\n this.fetchData({\n ...actions.getSubmittedFormData(),\n ...tableParams,\n })\n return\n }\n\n const { dataSource } = this.state\n\n // 前端本地分页\n if (localPagination) {\n this.setState(\n {\n dataSource,\n pagination: {\n current: pagination.current,\n pageSize: pagination.pageSize,\n total: pagination.total,\n },\n },\n () => {\n actions.setData('formData', this.formData)\n actions.setData('pagination', this.state.pagination)\n }\n )\n }\n }\n\n onTableBodyScroll = throttle((evt) => {\n this.updateIsScrollToBottom(evt.target)\n }, 50)\n\n updateIsScrollToBottom = (tableBody) => {\n const isScrollToBottom = (tableBody) => {\n const { scrollHeight, scrollTop, offsetHeight } = tableBody\n\n return scrollHeight === scrollTop + offsetHeight\n }\n\n this.setState({\n hasScrollToBottom: isScrollToBottom(tableBody),\n })\n }\n}\n"]}
|
|
@@ -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;aACF;YACH,CAAC,CAAC,EAAE,CACP,CAAA;KACF;SAAM,IAAI,QAAQ,EAAE;QACnB,MAAM,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK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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
|
+
}
|