zmdms-webui 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/node_modules/clsx/dist/clsx.m.js +3 -0
- package/dist/es/node_modules/react-contexify/dist/index.js +7 -0
- package/dist/es/table/components/TableMenu.js +57 -0
- package/dist/es/table/hooks.js +21 -6
- package/dist/es/table/interface.d.ts +8 -0
- package/dist/es/table/table.js +14 -3
- package/dist/es/table/useSummary.js +8 -5
- package/dist/index.es.css +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2
|
+
|
|
3
|
+
export { clsx, clsx as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React__default, { createContext, useReducer, useRef, useState, useEffect, useContext, Children, cloneElement } from 'react';
|
|
2
|
+
import { clsx } from '../../clsx/dist/clsx.m.js';
|
|
3
|
+
import { flushSync } from 'react-dom';
|
|
4
|
+
|
|
5
|
+
var Y=createContext({}),F=()=>useContext(Y),$=t=>React__default.createElement(Y.Provider,{...t});function le(){let t=new Map;return {on(e,r){return t.has(e)?t.get(e).add(r):t.set(e,new Set([r])),this},off(e,r){return t.has(e)&&t.get(e).delete(r),this},emit(e,r){return t.has(e)&&t.get(e).forEach(f=>{f(r);}),this}}}var R=le();var B=()=>useRef(new Map).current;var z=()=>{},U=["resize","contextmenu","click","scroll","blur"];var A={show({event:t,id:e,props:r,position:f}){t.preventDefault&&t.preventDefault(),R.emit(0).emit(e,{event:t.nativeEvent||t,props:r,position:f});},hideAll(){R.emit(0);}};function Fe(t){return {show(e){A.show({...t,...e});},hideAll(){A.hideAll();}}}function G(){let t=new Map,e,r,f,s,i=!1;function P(n){s=Array.from(n.values()),e=-1,f=!0;}function v(){s[e].node.focus();}let x=()=>e>=0&&s[e].isSubmenu,w=()=>Array.from(s[e].submenuRefTracker.values());function m(){return e===-1?(b(),!1):!0}function b(){e+1<s.length?e++:e+1===s.length&&(e=0),i&&a(),v();}function E(){e===-1||e===0?e=s.length-1:e-1<s.length&&e--,i&&a(),v();}function T(){if(m()&&x()){let n=w(),{node:c,setSubmenuPosition:h}=s[e];return t.set(c,{isRoot:f,focusedIndex:e,parentNode:r||c,items:s}),h(),c.classList.add("contexify_submenu-isOpen"),r=c,n.length>0?(e=0,s=n):i=!0,f=!1,v(),!0}return !1}function a(){if(m()&&!f){let n=t.get(r);r.classList.remove("contexify_submenu-isOpen"),s=n.items,r=n.parentNode,n.isRoot&&(f=!0,t.clear()),i||(e=n.focusedIndex,v());}}function y(n){function c(h){for(let o of h)o.isSubmenu&&o.submenuRefTracker&&c(Array.from(o.submenuRefTracker.values())),o.keyMatcher&&o.keyMatcher(n);}c(s);}return {init:P,moveDown:b,moveUp:E,openSubmenu:T,closeSubmenu:a,matchKeys:y}}function I(t){return typeof t=="function"}function V(t){return typeof t=="string"}function _(t,e){return Children.map(Children.toArray(t).filter(Boolean),r=>cloneElement(r,e))}function J(t){let e={x:t.clientX,y:t.clientY},r=t.changedTouches;return r&&(e.x=r[0].clientX,e.y=r[0].clientY),(!e.x||e.x<0)&&(e.x=0),(!e.y||e.y<0)&&(e.y=0),e}function k(t,e){return I(t)?t(e):t}function be(t,e){return {...t,...I(e)?e(t):e}}var it=({id:t,theme:e,style:r,className:f,children:s,animation:i="fade",preventDefaultOnKeydown:P=!0,disableBoundariesCheck:v=!1,onVisibilityChange:x,...w})=>{let[m,b]=useReducer(be,{x:0,y:0,visible:!1,triggerEvent:{},propsFromTrigger:null,willLeave:!1}),E=useRef(null),T=B(),[a]=useState(()=>G()),y=useRef(),n=useRef();useEffect(()=>(R.on(t,h).on(0,o),()=>{R.off(t,h).off(0,o);}),[t,i,v]),useEffect(()=>{m.visible?a.init(T):T.clear();},[m.visible,a,T]);function c(u,p){if(E.current&&!v){let{innerWidth:d,innerHeight:C}=window,{offsetWidth:K,offsetHeight:O}=E.current;u+K>d&&(u-=u+K-d),p+O>C&&(p-=p+O-C);}return {x:u,y:p}}useEffect(()=>{m.visible&&b(c(m.x,m.y));},[m.visible]),useEffect(()=>{function u(d){P&&d.preventDefault();}function p(d){switch(d.key){case"Enter":case" ":a.openSubmenu()||o();break;case"Escape":o();break;case"ArrowUp":u(d),a.moveUp();break;case"ArrowDown":u(d),a.moveDown();break;case"ArrowRight":u(d),a.openSubmenu();break;case"ArrowLeft":u(d),a.closeSubmenu();break;default:a.matchKeys(d);break}}if(m.visible){window.addEventListener("keydown",p);for(let d of U)window.addEventListener(d,o);}return ()=>{window.removeEventListener("keydown",p);for(let d of U)window.removeEventListener(d,o);}},[m.visible,a,P]);function h({event:u,props:p,position:d}){u.stopPropagation();let C=d||J(u),{x:K,y:O}=c(C.x,C.y);flushSync(()=>{b({visible:!0,willLeave:!1,x:K,y:O,triggerEvent:u,propsFromTrigger:p});}),clearTimeout(n.current),!y.current&&I(x)&&(x(!0),y.current=!0);}function o(u){u!=null&&(u.button===2||u.ctrlKey)&&u.type!=="contextmenu"||(i&&(V(i)||"exit"in i&&i.exit)?b(p=>({willLeave:p.visible})):b(p=>({visible:p.visible?!1:p.visible})),n.current=setTimeout(()=>{I(x)&&x(!1),y.current=!1;}));}function M(){m.willLeave&&m.visible&&flushSync(()=>b({visible:!1,willLeave:!1}));}function S(){return V(i)?clsx({[`${"contexify_willEnter-"}${i}`]:g&&!D,[`${"contexify_willLeave-"}${i} ${"contexify_willLeave-"}'disabled'`]:g&&D}):i&&"enter"in i&&"exit"in i?clsx({[`${"contexify_willEnter-"}${i.enter}`]:i.enter&&g&&!D,[`${"contexify_willLeave-"}${i.exit} ${"contexify_willLeave-"}'disabled'`]:i.exit&&g&&D}):null}let{visible:g,triggerEvent:l,propsFromTrigger:L,x:oe,y:ie,willLeave:D}=m,ae=clsx("contexify",f,{[`${"contexify_theme-"}${e}`]:e},S());return React__default.createElement($,{value:T},g&&React__default.createElement("div",{...w,className:ae,onAnimationEnd:M,style:{...r,left:oe,top:ie,opacity:1},ref:E,role:"menu"},_(s,{propsFromTrigger:L,triggerEvent:l})))};var pt=({id:t,children:e,className:r,style:f,triggerEvent:s,data:i,propsFromTrigger:P,keyMatcher:v,onClick:x=z,disabled:w=!1,hidden:m=!1,closeOnClick:b=!0,handlerEvent:E="onClick",...T})=>{let a=useRef(),y=F(),n={id:t,data:i,triggerEvent:s,props:P},c=k(w,n),h=k(m,n);function o(l){n.event=l,l.stopPropagation(),c||(b?M():x(n));}function M(){let l=a.current;l.focus(),l.addEventListener("animationend",()=>setTimeout(A.hideAll),{once:!0}),l.classList.add("contexify_item-feedback"),x(n);}function S(l){l&&!c&&(a.current=l,y.set(l,{node:l,isSubmenu:!1,keyMatcher:!c&&I(v)&&(L=>{v(L)&&(L.stopPropagation(),L.preventDefault(),n.event=L,M());})}));}function g(l){(l.key==="Enter"||l.key===" ")&&(l.stopPropagation(),n.event=l,M());}return h?null:React__default.createElement("div",{...T,[E]:o,className:clsx("contexify_item",r,{[`${"contexify_item-disabled"}`]:c}),style:f,onKeyDown:g,ref:S,tabIndex:-1,role:"menuitem","aria-disabled":c},React__default.createElement("div",{className:"contexify_itemContent"},e))};
|
|
6
|
+
|
|
7
|
+
export { pt as Item, it as Menu, A as contextMenu, Fe as useContextMenu };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { Menu as it, Item as pt } from '../../node_modules/react-contexify/dist/index.js';
|
|
5
|
+
import screenfull from '../../node_modules/screenfull/index.js';
|
|
6
|
+
import { useLatest } from 'ahooks';
|
|
7
|
+
|
|
8
|
+
var TableMenu = function (_a) {
|
|
9
|
+
var menuId = _a.menuId, tableRef = _a.tableRef, isFullscreenHandle = _a.isFullscreenHandle;
|
|
10
|
+
var _b = useState(false), isFull = _b[0], setIsFull = _b[1];
|
|
11
|
+
var isFullscreenHandleRef = useLatest(isFullscreenHandle);
|
|
12
|
+
function onMenuItemClick(e) {
|
|
13
|
+
var data = e.data;
|
|
14
|
+
switch (data) {
|
|
15
|
+
case "fullscreen": {
|
|
16
|
+
if (screenfull.isEnabled) {
|
|
17
|
+
var realScreenFull = screenfull;
|
|
18
|
+
if (tableRef === null || tableRef === void 0 ? void 0 : tableRef.current) {
|
|
19
|
+
realScreenFull.toggle(tableRef.current);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
realScreenFull.toggle();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// 全屏
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
if (screenfull.isEnabled) {
|
|
32
|
+
var realScreenFull_1 = screenfull;
|
|
33
|
+
var callback_1 = function () {
|
|
34
|
+
var _a;
|
|
35
|
+
var isFull = realScreenFull_1.isFullscreen;
|
|
36
|
+
(_a = isFullscreenHandleRef.current) === null || _a === void 0 ? void 0 : _a.call(isFullscreenHandleRef, isFull);
|
|
37
|
+
setIsFull(isFull);
|
|
38
|
+
// 如果是全屏状态,那么修改表格背景
|
|
39
|
+
if (tableRef && tableRef.current) {
|
|
40
|
+
if (isFull) {
|
|
41
|
+
tableRef.current.style.backgroundColor = "#fff";
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
tableRef.current.style.removeProperty("background-color");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
realScreenFull_1.on("change", callback_1);
|
|
49
|
+
return function () {
|
|
50
|
+
realScreenFull_1.off("change", callback_1);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, [tableRef, isFullscreenHandleRef]);
|
|
54
|
+
return (jsx(Fragment, { children: jsx(it, __assign({ id: menuId }, { children: jsx(pt, __assign({ data: "fullscreen", onClick: onMenuItemClick }, { children: isFull ? "退出全屏" : "全屏" })) })) }));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { TableMenu as default };
|
package/dist/es/table/hooks.js
CHANGED
|
@@ -33,7 +33,7 @@ function useEditChange(dataSourceRef, onTableChange) {
|
|
|
33
33
|
* @returns 排序相关方法
|
|
34
34
|
*/
|
|
35
35
|
function useMoveRowChange(dataSourceRef, onTableChange, options) {
|
|
36
|
-
var isMove = options.isMove, refreshScuCell = options.refreshScuCell, currentPage = options.currentPage, extraOnRow = options.extraOnRow, fixedRowsCount = options.fixedRowsCount, fixedRowsConfig = options.fixedRowsConfig;
|
|
36
|
+
var isMove = options.isMove, refreshScuCell = options.refreshScuCell, currentPage = options.currentPage, extraOnRow = options.extraOnRow, fixedRowsCount = options.fixedRowsCount, fixedRowsConfig = options.fixedRowsConfig, menuShow = options.menuShow;
|
|
37
37
|
var moveRow = useCallback(function (dI, hI) {
|
|
38
38
|
var _a;
|
|
39
39
|
// 内部分页时,获取数据真正的行数
|
|
@@ -63,6 +63,14 @@ function useMoveRowChange(dataSourceRef, onTableChange, options) {
|
|
|
63
63
|
index: index,
|
|
64
64
|
moveRow: moveRow,
|
|
65
65
|
};
|
|
66
|
+
var defaultOnRow = extraOnRow === null || extraOnRow === void 0 ? void 0 : extraOnRow(record, index);
|
|
67
|
+
var onContextMenuCapture = function (e) {
|
|
68
|
+
var _a;
|
|
69
|
+
(_a = defaultOnRow === null || defaultOnRow === void 0 ? void 0 : defaultOnRow.onContextMenuCapture) === null || _a === void 0 ? void 0 : _a.call(defaultOnRow, e);
|
|
70
|
+
menuShow === null || menuShow === void 0 ? void 0 : menuShow({
|
|
71
|
+
event: e,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
66
74
|
// 确定固定行数量和行高
|
|
67
75
|
var fixedCount = (fixedRowsConfig === null || fixedRowsConfig === void 0 ? void 0 : fixedRowsConfig.count) || fixedRowsCount;
|
|
68
76
|
var rowHeight = (fixedRowsConfig === null || fixedRowsConfig === void 0 ? void 0 : fixedRowsConfig.rowHeight) || 36; // 默认行高36px
|
|
@@ -76,18 +84,25 @@ function useMoveRowChange(dataSourceRef, onTableChange, options) {
|
|
|
76
84
|
borderBottom: "1px solid #f0f0f0",
|
|
77
85
|
zIndex: 10,
|
|
78
86
|
};
|
|
79
|
-
return __assign(__assign({}, baseProps), { style: customStyle
|
|
87
|
+
return __assign(__assign(__assign(__assign({}, defaultOnRow), { onContextMenuCapture: onContextMenuCapture }), baseProps), { style: customStyle
|
|
80
88
|
? __assign(__assign({}, defaultStyle), customStyle) : defaultStyle });
|
|
81
89
|
}
|
|
82
90
|
return baseProps;
|
|
83
|
-
}, [moveRow, fixedRowsCount, fixedRowsConfig]);
|
|
84
|
-
var defaultOnRow = useMemoizedFn(function (record) {
|
|
91
|
+
}, [moveRow, fixedRowsCount, fixedRowsConfig, menuShow, extraOnRow]);
|
|
92
|
+
var defaultOnRow = useMemoizedFn(function (record, index) {
|
|
85
93
|
var extra = extraOnRow === null || extraOnRow === void 0 ? void 0 : extraOnRow(record);
|
|
94
|
+
var onContextMenuCapture = function (e) {
|
|
95
|
+
var _a;
|
|
96
|
+
(_a = extra === null || extra === void 0 ? void 0 : extra.onContextMenuCapture) === null || _a === void 0 ? void 0 : _a.call(extra, e);
|
|
97
|
+
menuShow === null || menuShow === void 0 ? void 0 : menuShow({
|
|
98
|
+
event: e,
|
|
99
|
+
});
|
|
100
|
+
};
|
|
86
101
|
var summaryStyle = __assign({ background: "#ebf3fe", fontWeight: "bold" }, extra === null || extra === void 0 ? void 0 : extra.style);
|
|
87
102
|
if (record[IS_SUMMARY]) {
|
|
88
|
-
return __assign(__assign({}, extra), { style: summaryStyle });
|
|
103
|
+
return __assign(__assign({}, extra), { onContextMenuCapture: onContextMenuCapture, style: summaryStyle });
|
|
89
104
|
}
|
|
90
|
-
return {};
|
|
105
|
+
return __assign(__assign({}, extra), { onContextMenuCapture: onContextMenuCapture });
|
|
91
106
|
});
|
|
92
107
|
return {
|
|
93
108
|
onRow: isMove || fixedRowsCount || fixedRowsConfig ? onRow : defaultOnRow,
|
|
@@ -497,6 +497,14 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
|
|
|
497
497
|
* 目前index的话会自动加个序号
|
|
498
498
|
*/
|
|
499
499
|
mode?: "index";
|
|
500
|
+
/**
|
|
501
|
+
* 是否开启右键功能
|
|
502
|
+
*/
|
|
503
|
+
isContextMenu?: boolean;
|
|
504
|
+
/**
|
|
505
|
+
* 全屏后的一些事件
|
|
506
|
+
*/
|
|
507
|
+
isFullscreenHandle?: (isFullscreen: boolean) => void;
|
|
500
508
|
}
|
|
501
509
|
interface IFields {
|
|
502
510
|
/**
|
package/dist/es/table/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest, __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { memo, useMemo, useRef, useCallback, useImperativeHandle } from 'react';
|
|
3
|
+
import { memo, useState, useMemo, useRef, useCallback, useImperativeHandle } from 'react';
|
|
4
4
|
import { Table as Table$1 } from 'antd';
|
|
5
5
|
import { BasicBodyRow, MoveBodyRow } from './components/EnhanceBodyRow.js';
|
|
6
6
|
import EnhanceCell from './components/EnhanceBodyCell.js';
|
|
@@ -23,6 +23,8 @@ import { VList, scrollTo } from '../node_modules/virtuallist-antd/dist/index.es.
|
|
|
23
23
|
import useTableValidate, { tableValidate } from './useTableValidate.js';
|
|
24
24
|
import TitleDirectionColumn from './components/TitleDirectionColumn.js';
|
|
25
25
|
import { useExcelExport } from './excel.js';
|
|
26
|
+
import TableMenu from './components/TableMenu.js';
|
|
27
|
+
import { useContextMenu as Fe } from '../node_modules/react-contexify/dist/index.js';
|
|
26
28
|
import DynamicSetting from '../dynamicsetting/dynamicSetting.js';
|
|
27
29
|
import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js';
|
|
28
30
|
|
|
@@ -39,10 +41,16 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
|
|
|
39
41
|
// completed: 实现从execl复制到表格中的功能
|
|
40
42
|
var Table = function (props) {
|
|
41
43
|
// console.log("表格渲染");
|
|
42
|
-
var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 65 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, headerAlign = props.headerAlign, isDimensionDynamic = props.isDimensionDynamic, isAutoMerge = props.isAutoMerge, mode = props.mode, rowSelection = props.rowSelection, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig", "headerAlign", "isDimensionDynamic", "isAutoMerge", "mode", "rowSelection"]);
|
|
44
|
+
var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 65 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, headerAlign = props.headerAlign, isDimensionDynamic = props.isDimensionDynamic, isAutoMerge = props.isAutoMerge, mode = props.mode, rowSelection = props.rowSelection, isContextMenu = props.isContextMenu, isFullscreenHandle = props.isFullscreenHandle, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig", "headerAlign", "isDimensionDynamic", "isAutoMerge", "mode", "rowSelection", "isContextMenu", "isFullscreenHandle"]);
|
|
43
45
|
var classes = classNames("ztxk-table", className, {
|
|
44
46
|
"ztxk-table--flex": isFlex,
|
|
45
47
|
});
|
|
48
|
+
var menuId = useState(isContextMenu
|
|
49
|
+
? "menuId-" + Math.floor(Math.random() * 100000000)
|
|
50
|
+
: undefined)[0];
|
|
51
|
+
var menuShow = Fe({
|
|
52
|
+
id: menuId,
|
|
53
|
+
}).show;
|
|
46
54
|
// 针对SCU和增减行 做特殊处理
|
|
47
55
|
var _q = useScuRfresh(), refreshScuCell = _q.refreshScuCell, getRefreshScuCell = _q.getRefreshScuCell;
|
|
48
56
|
// 做一些前置处理
|
|
@@ -104,6 +112,7 @@ var Table = function (props) {
|
|
|
104
112
|
fixedRowsCount: fixedRowsCount,
|
|
105
113
|
fixedRowsConfig: fixedRowsConfig,
|
|
106
114
|
virtualKey: virtualKey,
|
|
115
|
+
menuShow: menuShow,
|
|
107
116
|
}).onRow;
|
|
108
117
|
// 内部表格新增删除事件
|
|
109
118
|
var onAddAndDel = useAddAndDelChange(dataSourceRef, onTableChange, {
|
|
@@ -302,6 +311,8 @@ var Table = function (props) {
|
|
|
302
311
|
(_b = (_a = dynamicSettingRef.current) === null || _a === void 0 ? void 0 : _a.updateList) === null || _b === void 0 ? void 0 : _b.call(_a, list);
|
|
303
312
|
},
|
|
304
313
|
exportExcel: exportExcel,
|
|
314
|
+
/** 获取表格容器 */
|
|
315
|
+
getContainer: function () { return tableRef.current; },
|
|
305
316
|
};
|
|
306
317
|
});
|
|
307
318
|
// 表格
|
|
@@ -325,7 +336,7 @@ var Table = function (props) {
|
|
|
325
336
|
overflow: "hidden",
|
|
326
337
|
marginTop: isMarginTop ? 10 : 0,
|
|
327
338
|
marginBottom: isMarginBottom ? 10 : 0,
|
|
328
|
-
}, ref: tableRef, id: tableId }, { children: [isMove ? (jsx(DndProvider, __assign({ backend: HTML5Backend, context: window }, { children: SingleTable }))) : (SingleTable), dynamicKey ? (jsx(DynamicSetting, { parentDynamicKey: TABLE_DYNAMIC_KEY, dynamicKey: dynamicKey, defaultList: defaultDynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef, hiddenOperationIcon: true, isMore: true, isFixed: true, isDimensionDynamic: isDimensionDynamic })) : null] })));
|
|
339
|
+
}, ref: tableRef, id: tableId }, { children: [isMove ? (jsx(DndProvider, __assign({ backend: HTML5Backend, context: window }, { children: SingleTable }))) : (SingleTable), dynamicKey ? (jsx(DynamicSetting, { parentDynamicKey: TABLE_DYNAMIC_KEY, dynamicKey: dynamicKey, defaultList: defaultDynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef, hiddenOperationIcon: true, isMore: true, isFixed: true, isDimensionDynamic: isDimensionDynamic })) : null, menuId ? (jsx(TableMenu, { menuId: menuId, tableRef: tableRef, isFullscreenHandle: isFullscreenHandle })) : null] })));
|
|
329
340
|
};
|
|
330
341
|
var MemoTable = memo(Table);
|
|
331
342
|
MemoTable.displayName = "ZTXK_WEBUI_Table";
|
|
@@ -144,6 +144,10 @@ function getSubtotalObj(fields, dataSource) {
|
|
|
144
144
|
summaryTotalObj[field] = summaryItem
|
|
145
145
|
? plus(summaryItem, dataItem)
|
|
146
146
|
: dataItem;
|
|
147
|
+
// 合计添加千分符
|
|
148
|
+
if (summaryTotalObj[field]) {
|
|
149
|
+
summaryTotalObj[field] = addThousedSeparator(summaryTotalObj[field]);
|
|
150
|
+
}
|
|
147
151
|
}
|
|
148
152
|
else {
|
|
149
153
|
var key = field.key, showKey = field.showKey, toFixedNum_1 = field.toFixedNum, value = field.value, callback = field.callback;
|
|
@@ -236,14 +240,13 @@ function getSubtotalObj(fields, dataSource) {
|
|
|
236
240
|
summaryTotalConfigObj[key] = {
|
|
237
241
|
align: field === null || field === void 0 ? void 0 : field.align,
|
|
238
242
|
};
|
|
243
|
+
// 合计添加千分符
|
|
244
|
+
if (summaryTotalObj[key]) {
|
|
245
|
+
summaryTotalObj[key] = addThousedSeparator(summaryTotalObj[key]);
|
|
246
|
+
}
|
|
239
247
|
}
|
|
240
248
|
});
|
|
241
249
|
});
|
|
242
|
-
Object.keys(summaryTotalObj).forEach(function (key) {
|
|
243
|
-
if (summaryTotalObj[key] !== undefined) {
|
|
244
|
-
summaryTotalObj[key] = addThousedSeparator(summaryTotalObj[key]);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
250
|
return {
|
|
248
251
|
summaryTotalObj: summaryTotalObj,
|
|
249
252
|
summaryTotalConfigObj: summaryTotalConfigObj,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--contexify-zIndex:666;--contexify-menu-minWidth:220px;--contexify-menu-padding:6px;--contexify-menu-radius:6px;--contexify-menu-bgColor:#fff;--contexify-menu-shadow:1px 2px 2px #0000001a,2px 4px 4px #0000001a,3px 6px 6px #0000001a;--contexify-menu-negatePadding:var(--contexify-menu-padding);--contexify-separator-color:#0003;--contexify-separator-margin:5px;--contexify-itemContent-padding:6px;--contexify-activeItem-radius:4px;--contexify-item-color:#333;--contexify-activeItem-color:#fff;--contexify-activeItem-bgColor:#3498db;--contexify-rightSlot-color:#6f6e77;--contexify-activeRightSlot-color:#fff;--contexify-arrow-color:#6f6e77;--contexify-activeArrow-color:#fff}@keyframes contexify_feedback{0%{opacity:.4}to{opacity:1}}.contexify{background-color:var(--contexify-menu-bgColor);border-radius:var(--contexify-menu-radius);box-shadow:var(--contexify-menu-shadow);box-sizing:border-box;min-width:var(--contexify-menu-minWidth);opacity:0;padding:var(--contexify-menu-padding);position:fixed;-webkit-user-select:none;user-select:none;z-index:var(--contexify-zIndex)}.contexify_submenu-isOpen,.contexify_submenu-isOpen>.contexify_itemContent{background-color:var(--contexify-activeItem-bgColor);border-radius:var(--contexify-activeItem-radius);color:var(--contexify-activeItem-color)}.contexify_submenu-isOpen>.contexify_itemContent .contexify_rightSlot{color:var(--contexify-activeArrow-color)}.contexify_submenu-isOpen>.contexify_submenu{opacity:1;pointer-events:auto}.contexify .contexify_submenu{left:100%;pointer-events:none;position:absolute;top:calc(var(--contexify-menu-negatePadding)*-1);transition:opacity .265s}.contexify .contexify_submenu-bottom{bottom:calc(var(--contexify-menu-negatePadding)*-1);top:unset}.contexify .contexify_submenu-right{left:unset;right:100%}.contexify_rightSlot{color:var(--contexify-rightSlot-color);display:flex;margin-left:auto}.contexify_separator{background-color:var(--contexify-separator-color);cursor:default;height:1px;margin:var(--contexify-separator-margin)}.contexify_willLeave-disabled{pointer-events:none}.contexify_item{cursor:pointer;position:relative}.contexify_item:focus{outline:0}.contexify_item:focus .contexify_rightSlot,.contexify_item:not(.contexify_item-disabled):hover>.contexify_itemContent .contexify_rightSlot{color:var(--contexify-activeRightSlot-color)}.contexify_item:not(.contexify_item-disabled)[aria-haspopup]>.contexify_itemContent .contexify_rightSlot{color:var(--contexify-arrow-color)}.contexify_item:not(.contexify_item-disabled)[aria-haspopup].contexify_submenu-isOpen>.contexify_itemContent .contexify_rightSlot,.contexify_item:not(.contexify_item-disabled)[aria-haspopup]:hover>.contexify_itemContent .contexify_rightSlot,.contexify_item[aria-haspopup]:focus>.contexify_itemContent .contexify_rightSlot{color:var(--contexify-activeArrow-color)}.contexify_item:not(.contexify_item-disabled):focus>.contexify_itemContent,.contexify_item:not(.contexify_item-disabled):hover>.contexify_itemContent{background-color:var(--contexify-activeItem-bgColor);border-radius:var(--contexify-activeItem-radius);color:var(--contexify-activeItem-color)}.contexify_item:not(.contexify_item-disabled):hover>.contexify_submenu{opacity:1;pointer-events:auto}.contexify_item-disabled{cursor:default;opacity:.5}.contexify_itemContent{align-items:center;color:var(--contexify-item-color);display:flex;padding:var(--contexify-itemContent-padding);position:relative;white-space:nowrap}.contexify_item-feedback{animation:contexify_feedback .12s both}.contexify_theme-dark{--contexify-menu-bgColor:#282828fa;--contexify-separator-color:#4c4c4c;--contexify-item-color:#fff}.contexify_theme-light{--contexify-separator-color:#eee;--contexify-item-color:#666;--contexify-activeItem-color:#3498db;--contexify-activeItem-bgColor:#e0eefd;--contexify-activeRightSlot-color:#3498db;--contexify-active-arrow-color:#3498db}@keyframes contexify_scaleIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}to{opacity:1}}@keyframes contexify_scaleOut{0%{opacity:1}to{opacity:0;transform:scale3d(.3,.3,.3)}}.contexify_willEnter-scale{animation:contexify_scaleIn .3s;transform-origin:top left}.contexify_willLeave-scale{animation:contexify_scaleOut .3s;transform-origin:top left}@keyframes contexify_fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes contexify_fadeOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}.contexify_willEnter-fade{animation:contexify_fadeIn .3s ease}.contexify_willLeave-fade{animation:contexify_fadeOut .3s ease}@keyframes contexify_flipInX{0%{transform:perspective(800px) rotateX(45deg)}to{transform:perspective(800px)}}@keyframes contexify_flipOutX{0%{transform:perspective(800px)}to{opacity:0;transform:perspective(800px) rotateX(45deg)}}.contexify_willEnter-flip{animation:contexify_flipInX .3s}.contexify_willEnter-flip,.contexify_willLeave-flip{backface-visibility:visible!important;transform-origin:top center}.contexify_willLeave-flip{animation:contexify_flipOutX .3s}@keyframes contexify_slideIn{0%{opacity:0;transform:scaleY(.3)}to{opacity:1}}@keyframes contexify_slideOut{0%{opacity:1}to{opacity:0;transform:scaleY(.3)}}.contexify_willEnter-slide{animation:contexify_slideIn .3s;transform-origin:top center}.contexify_willLeave-slide{animation:contexify_slideOut .3s;transform-origin:top center}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zmdms-webui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -141,6 +141,7 @@
|
|
|
141
141
|
"dependencies": {
|
|
142
142
|
"antd-img-crop": "^4.12.2",
|
|
143
143
|
"immutability-helper": "^3.1.1",
|
|
144
|
+
"react-contexify": "^6.0.0",
|
|
144
145
|
"react-dnd": "^16.0.1",
|
|
145
146
|
"react-dnd-html5-backend": "^16.0.1",
|
|
146
147
|
"screenfull": "^6.0.2",
|