linkmore-design 1.0.64 → 1.0.66
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/README.md +1 -1
- package/dist/Approval/demos/basic.d.ts +2 -0
- package/dist/Approval/index.d.ts +24 -0
- package/dist/Approval/style/index.d.ts +1 -0
- package/dist/Form/index.d.ts +1 -1
- package/dist/LmEditTable/EditTable.d.ts +1 -0
- package/dist/LmFilter/filterFns/index.d.ts +5 -0
- package/dist/index.umd.js +82 -17
- package/dist/index.umd.min.js +1 -1
- package/es/Approval/index.d.ts +24 -0
- package/es/Approval/index.js +210 -0
- package/es/Approval/style/index.css +592 -0
- package/es/Approval/style/index.d.ts +1 -0
- package/es/Approval/style/index.js +1 -0
- package/es/Form/container.js +17 -1
- package/es/Form/index.d.ts +1 -1
- package/es/Form/index.js +5 -2
- package/es/Form/style/index.css +18 -3
- package/es/LmEditTable/EditTable.d.ts +1 -0
- package/es/LmEditTable/EditTable.js +56 -10
- package/es/LmFilter/components/DropdownFIlter.js +0 -1
- package/es/LmFilter/filterFns/index.js +6 -0
- package/lib/Approval/index.d.ts +24 -0
- package/lib/Approval/index.js +223 -0
- package/lib/Approval/style/index.css +592 -0
- package/lib/Approval/style/index.d.ts +1 -0
- package/lib/Approval/style/index.js +3 -0
- package/lib/Form/container.js +17 -1
- package/lib/Form/index.d.ts +1 -1
- package/lib/Form/index.js +5 -2
- package/lib/Form/style/index.css +18 -3
- package/lib/LmEditTable/EditTable.d.ts +1 -0
- package/lib/LmEditTable/EditTable.js +56 -10
- package/lib/LmFilter/components/DropdownFIlter.js +0 -1
- package/lib/LmFilter/filterFns/index.js +6 -0
- package/package.json +2 -2
|
@@ -407,6 +407,7 @@ var EditableCell = function EditableCell(props) {
|
|
|
407
407
|
return ((_b = (_a = option.children) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.indexOf(input.toLowerCase())) >= 0;
|
|
408
408
|
}
|
|
409
409
|
}, componentProps, {
|
|
410
|
+
// open={true}
|
|
410
411
|
onChange: handleFormItemChange
|
|
411
412
|
}));
|
|
412
413
|
|
|
@@ -806,8 +807,60 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
806
807
|
setDataSource(res);
|
|
807
808
|
}
|
|
808
809
|
};
|
|
810
|
+
/** 判断columne中有没有带optionOnly参数 */
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
var hasDisableOptions = useMemo(function () {
|
|
814
|
+
var hasOnlyOptionsDatas = columns.filter(function (item) {
|
|
815
|
+
var _a;
|
|
816
|
+
|
|
817
|
+
return (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.optionOnly;
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
if (hasOnlyOptionsDatas.length) {
|
|
821
|
+
return hasOnlyOptionsDatas.map(function (item) {
|
|
822
|
+
return item.dataIndex;
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
return false;
|
|
827
|
+
}, [columns]);
|
|
828
|
+
/** 动态获取disabled的props数据源 */
|
|
829
|
+
|
|
830
|
+
var DisableOptions = useMemo(function () {
|
|
831
|
+
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
832
|
+
var _ref3 = item.componentProps || {},
|
|
833
|
+
optionOnly = _ref3.optionOnly,
|
|
834
|
+
options = _ref3.options;
|
|
835
|
+
|
|
836
|
+
if (optionOnly && options) {
|
|
837
|
+
var dataIndex = item.dataIndex;
|
|
838
|
+
var dataIndexData = dataSource.map(function (d) {
|
|
839
|
+
return d[dataIndex];
|
|
840
|
+
});
|
|
841
|
+
var newOptions = options.map(function (o) {
|
|
842
|
+
return Object.assign(Object.assign({}, o), {
|
|
843
|
+
disabled: dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value) ? true : false
|
|
844
|
+
});
|
|
845
|
+
});
|
|
846
|
+
return Object.assign(Object.assign({}, item), {
|
|
847
|
+
componentProps: Object.assign(Object.assign({}, item.componentProps), {
|
|
848
|
+
options: newOptions
|
|
849
|
+
})
|
|
850
|
+
});
|
|
851
|
+
} else {
|
|
852
|
+
return item;
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
return newColumns;
|
|
856
|
+
}, [columns, dataSource]);
|
|
857
|
+
var memoOptions = useMemo(function () {
|
|
858
|
+
return hasDisableOptions ? [DisableOptions] : [];
|
|
859
|
+
}, [hasDisableOptions, DisableOptions]);
|
|
860
|
+
/** 组装之后的最终columns */
|
|
809
861
|
|
|
810
862
|
var resultColumns = useMemo(function () {
|
|
863
|
+
var rColumns = hasDisableOptions ? DisableOptions : columns;
|
|
811
864
|
var localColumns = [sortOpen ? {
|
|
812
865
|
title: '',
|
|
813
866
|
dataIndex: 'sort',
|
|
@@ -818,7 +871,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
818
871
|
id: record[_rowKey] || record.id
|
|
819
872
|
});
|
|
820
873
|
}
|
|
821
|
-
} : null].concat(_toConsumableArray(
|
|
874
|
+
} : null].concat(_toConsumableArray(rColumns), [useQuickOpetate ? {
|
|
822
875
|
title: '操作',
|
|
823
876
|
dataIndex: 'lm_edit_opetate',
|
|
824
877
|
width: 68,
|
|
@@ -859,18 +912,12 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
859
912
|
shouldCellUpdate: function shouldCellUpdate(record, prevRecord) {
|
|
860
913
|
var dataIndex = col.dataIndex;
|
|
861
914
|
|
|
862
|
-
if (col === null || col === void 0 ? void 0 : col.fixed) {
|
|
915
|
+
if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex)) {
|
|
863
916
|
return true;
|
|
864
917
|
}
|
|
865
918
|
|
|
866
919
|
return record[dataIndex] === prevRecord[dataIndex] ? false : true;
|
|
867
920
|
},
|
|
868
|
-
// render: (text: string, record: Record<string, any>, index: number) => {
|
|
869
|
-
// const { editable, render } = record
|
|
870
|
-
// if (!editable && render) {
|
|
871
|
-
// return render?.(text, record ,index)
|
|
872
|
-
// }
|
|
873
|
-
// },
|
|
874
921
|
onCell: function onCell(record) {
|
|
875
922
|
return {
|
|
876
923
|
getLength: function getLength() {
|
|
@@ -898,9 +945,8 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
898
945
|
}
|
|
899
946
|
});
|
|
900
947
|
});
|
|
901
|
-
console.log(res, '---res');
|
|
902
948
|
return res;
|
|
903
|
-
}, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable]);
|
|
949
|
+
}, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable, _toConsumableArray(memoOptions)]);
|
|
904
950
|
var DraggableContainer = useCallback(function (_a) {
|
|
905
951
|
var _b;
|
|
906
952
|
|
|
@@ -346,6 +346,11 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
346
346
|
type: 'changeBasicQuery',
|
|
347
347
|
basicQuery: basicQuery
|
|
348
348
|
});
|
|
349
|
+
var globalQuery = {
|
|
350
|
+
filters: [{
|
|
351
|
+
conditions: tranformQuery(state.customFilter.data)
|
|
352
|
+
}]
|
|
353
|
+
};
|
|
349
354
|
var filterQuery = {
|
|
350
355
|
filters: [{
|
|
351
356
|
conditions: (_Object$keys7 = Object.keys(basicQuery)) === null || _Object$keys7 === void 0 ? void 0 : _Object$keys7.map(function (k) {
|
|
@@ -355,6 +360,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
355
360
|
};
|
|
356
361
|
return {
|
|
357
362
|
basicFilter: basicFilter,
|
|
363
|
+
globalQuery: globalQuery,
|
|
358
364
|
filterQuery: filterQuery,
|
|
359
365
|
type: 'basic'
|
|
360
366
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type VoidFunction = () => void;
|
|
3
|
+
export interface IApprovalItemProps {
|
|
4
|
+
avator?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
time?: string;
|
|
7
|
+
type?: 'start' | 'comment' | 'carbonCopy' | 'agree' | 'refuse';
|
|
8
|
+
[prop: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export interface IApprovalProps {
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
close?: () => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
userType?: 'self' | 'approver';
|
|
17
|
+
status?: number;
|
|
18
|
+
steps?: [];
|
|
19
|
+
onComment: VoidFunction;
|
|
20
|
+
onRefuse: VoidFunction;
|
|
21
|
+
onAgree: VoidFunction;
|
|
22
|
+
}
|
|
23
|
+
declare const LMApproval: React.FC<IApprovalProps>;
|
|
24
|
+
export default LMApproval;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _ = require("..");
|
|
15
|
+
|
|
16
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
|
|
19
|
+
for (var p in s) {
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
24
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var prefixCls = 'lm_approval';
|
|
30
|
+
var colors = ['#36BCF1', '#AE86DC', '#8BD248', '#F5A173'];
|
|
31
|
+
var statusMap = new Map([[1, '审核中'], [2, '已审核'], [3, '未通过']]);
|
|
32
|
+
var defaultStatus = 1;
|
|
33
|
+
|
|
34
|
+
var LMDrawer = function LMDrawer(props) {
|
|
35
|
+
var _props$visible = props.visible,
|
|
36
|
+
visible = _props$visible === void 0 ? false : _props$visible,
|
|
37
|
+
_props$title = props.title,
|
|
38
|
+
title = _props$title === void 0 ? '' : _props$title,
|
|
39
|
+
_props$status = props.status,
|
|
40
|
+
status = _props$status === void 0 ? defaultStatus : _props$status,
|
|
41
|
+
_props$userType = props.userType,
|
|
42
|
+
userType = _props$userType === void 0 ? 'self' : _props$userType,
|
|
43
|
+
close = props.close,
|
|
44
|
+
children = props.children,
|
|
45
|
+
_props$onComment = props.onComment,
|
|
46
|
+
onComment = _props$onComment === void 0 ? function () {} : _props$onComment,
|
|
47
|
+
_props$onRefuse = props.onRefuse,
|
|
48
|
+
onRefuse = _props$onRefuse === void 0 ? function () {} : _props$onRefuse,
|
|
49
|
+
_props$onAgree = props.onAgree,
|
|
50
|
+
onAgree = _props$onAgree === void 0 ? function () {} : _props$onAgree;
|
|
51
|
+
var currentStatusCls = (0, _classnames.default)(prefixCls + '_title_status');
|
|
52
|
+
var drawerCls = (0, _classnames.default)(prefixCls + '_drawer');
|
|
53
|
+
var statusText = statusMap.has(status) ? statusMap.get(status) : statusMap.get(1);
|
|
54
|
+
|
|
55
|
+
var handleClose = function handleClose() {
|
|
56
|
+
visible = false;
|
|
57
|
+
close();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_.Drawer, {
|
|
61
|
+
className: drawerCls,
|
|
62
|
+
visible: visible,
|
|
63
|
+
title: title,
|
|
64
|
+
onClose: handleClose,
|
|
65
|
+
extra: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
+
className: currentStatusCls
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, statusText)), status === 1 && userType === 'approver' && /*#__PURE__*/_react.default.createElement(_.Space, null, /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
68
|
+
size: "small",
|
|
69
|
+
onClick: onComment
|
|
70
|
+
}, "\u4EC5\u8BC4\u8BBA"), /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
71
|
+
size: "small",
|
|
72
|
+
onClick: onRefuse,
|
|
73
|
+
style: {
|
|
74
|
+
borderColor: '#FA4F53',
|
|
75
|
+
color: '#FA4F53'
|
|
76
|
+
}
|
|
77
|
+
}, "\u62D2\u7EDD"), /*#__PURE__*/_react.default.createElement(_.Button, {
|
|
78
|
+
size: "small",
|
|
79
|
+
onClick: onAgree,
|
|
80
|
+
type: "primary"
|
|
81
|
+
}, "\u540C\u610F")))
|
|
82
|
+
}, children);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var ApprovalItem = function ApprovalItem(props) {
|
|
86
|
+
var _props$avator = props.avator,
|
|
87
|
+
avator = _props$avator === void 0 ? '' : _props$avator,
|
|
88
|
+
_props$name = props.name,
|
|
89
|
+
name = _props$name === void 0 ? '' : _props$name,
|
|
90
|
+
_props$time = props.time,
|
|
91
|
+
time = _props$time === void 0 ? '' : _props$time,
|
|
92
|
+
color = props.color,
|
|
93
|
+
status = props.status,
|
|
94
|
+
_props$type = props.type,
|
|
95
|
+
type = _props$type === void 0 ? 'start' : _props$type;
|
|
96
|
+
var itemCls = (0, _classnames.default)(prefixCls + '_item');
|
|
97
|
+
var itemHeaderCls = (0, _classnames.default)(itemCls + '_header');
|
|
98
|
+
var itemBodyCls = (0, _classnames.default)(itemCls + '_body');
|
|
99
|
+
|
|
100
|
+
var getIcon = function getIcon() {
|
|
101
|
+
if (status === 1) {
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement("i", {
|
|
103
|
+
className: 'icon iconfont lmweb-icon_china1'
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (status === 2) {
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement("i", {
|
|
109
|
+
className: 'icon iconfont lmweb-icon_china1'
|
|
110
|
+
}); // return <img className='icon' src={fulfilledSvg} alt="" />
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (status === 3) {
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement("i", {
|
|
115
|
+
className: 'icon iconfont lmweb-icon_china1'
|
|
116
|
+
}); // return <img className='icon' src={rejectdSvg} alt="" />
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
var getApprovalText = function getApprovalText() {
|
|
123
|
+
if (type === 'refuse') {
|
|
124
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
125
|
+
className: 'desc red'
|
|
126
|
+
}, "\u62D2\u7EDD");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (type === 'start') {
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: 'desc'
|
|
132
|
+
}, "\u53D1\u8D77\u5BA1\u6279");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (type === 'comment') {
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
+
className: 'desc grey'
|
|
138
|
+
}, "\u4EC5\u8BC4\u8BBA");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (type === 'carbonCopy') {
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
143
|
+
className: 'desc grey'
|
|
144
|
+
}, "\u5DF2\u6284\u90018\u4EBA");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (type === 'agree') {
|
|
148
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
149
|
+
className: 'desc'
|
|
150
|
+
}, "\u5DF2\u540C\u610F");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
var subname = name.substring(name.length - 1, name.length);
|
|
157
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
className: itemCls
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
className: itemHeaderCls
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
162
|
+
className: "avator"
|
|
163
|
+
}, avator ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", {
|
|
164
|
+
className: 'picture',
|
|
165
|
+
src: avator,
|
|
166
|
+
alt: ""
|
|
167
|
+
}), getIcon()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
+
className: 'subname',
|
|
169
|
+
style: {
|
|
170
|
+
backgroundColor: color
|
|
171
|
+
}
|
|
172
|
+
}, subname), getIcon())), /*#__PURE__*/_react.default.createElement("div", {
|
|
173
|
+
className: "content"
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
className: 'name'
|
|
176
|
+
}, name), getApprovalText()), /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
className: "right"
|
|
178
|
+
}, time)), type !== 'start' && /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
className: itemBodyCls
|
|
180
|
+
}, "sdf"));
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
var Approval = function Approval(props) {
|
|
184
|
+
var _props$status2 = props.status,
|
|
185
|
+
status = _props$status2 === void 0 ? 1 : _props$status2,
|
|
186
|
+
_props$steps = props.steps,
|
|
187
|
+
steps = _props$steps === void 0 ? [] : _props$steps;
|
|
188
|
+
var cacheColorMap = new Map();
|
|
189
|
+
steps.forEach(function (step, i) {
|
|
190
|
+
if (i === 0) {
|
|
191
|
+
step.status = status;
|
|
192
|
+
} else {
|
|
193
|
+
step.status = 2;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!step.color) {
|
|
197
|
+
if (cacheColorMap.has(step.name)) {
|
|
198
|
+
step.color = cacheColorMap.get(step.name);
|
|
199
|
+
} else {
|
|
200
|
+
var index = parseInt(Math.random() * 4 + '');
|
|
201
|
+
var color = colors[index];
|
|
202
|
+
step.color = color;
|
|
203
|
+
cacheColorMap.set(step.name, color);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
var list = steps.map(function (step) {
|
|
208
|
+
return /*#__PURE__*/_react.default.createElement(ApprovalItem, Object.assign({}, step));
|
|
209
|
+
});
|
|
210
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, list);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
var LMApproval = function LMApproval(props) {
|
|
214
|
+
var className = props.className,
|
|
215
|
+
others = __rest(props, ["className"]);
|
|
216
|
+
|
|
217
|
+
return /*#__PURE__*/_react.default.createElement(LMDrawer, Object.assign({
|
|
218
|
+
className: (0, _classnames.default)(className, prefixCls)
|
|
219
|
+
}, others), /*#__PURE__*/_react.default.createElement(Approval, Object.assign({}, others)));
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
var _default = LMApproval;
|
|
223
|
+
exports.default = _default;
|