linkmore-design 1.1.7 → 1.1.8

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.
Files changed (43) hide show
  1. package/dist/LmFilter/utils.d.ts +1 -0
  2. package/dist/LmTable/hooks/useRowSelectControllableValue.d.ts +2 -0
  3. package/dist/LmUpload/fns/index.d.ts +1 -0
  4. package/dist/index.umd.js +337 -213
  5. package/dist/index.umd.min.js +16 -16
  6. package/dist/variables.css +10 -3
  7. package/es/LmEditTable/style/index.css +3 -0
  8. package/es/LmEditTable/style/variables.css +3 -0
  9. package/es/LmFilter/clearFilter/index.js +3 -1
  10. package/es/LmFilter/complexFilter/index.js +3 -2
  11. package/es/LmFilter/components/DropdownFIlter.js +8 -6
  12. package/es/LmFilter/style/index.css +4 -0
  13. package/es/LmFilter/style/variables.css +4 -0
  14. package/es/LmFilter/utils.js +18 -0
  15. package/es/LmFilter/wrapper/Filter.js +6 -2
  16. package/es/LmTable/Table.js +82 -78
  17. package/es/LmTable/hooks/useRowSelectControllableValue.js +67 -0
  18. package/es/LmTable/style/index.css +3 -3
  19. package/es/LmTable/style/variables.css +3 -3
  20. package/es/LmUpload/UploadList/ItemPictureCard.js +3 -1
  21. package/es/LmUpload/UploadList/index.js +2 -2
  22. package/es/LmUpload/fns/index.d.ts +1 -0
  23. package/es/LmUpload/fns/index.js +22 -3
  24. package/es/styles/variables.css +10 -3
  25. package/lib/LmEditTable/style/index.css +3 -0
  26. package/lib/LmEditTable/style/variables.css +3 -0
  27. package/lib/LmFilter/clearFilter/index.js +3 -1
  28. package/lib/LmFilter/complexFilter/index.js +3 -2
  29. package/lib/LmFilter/components/DropdownFIlter.js +8 -6
  30. package/lib/LmFilter/style/index.css +4 -0
  31. package/lib/LmFilter/style/variables.css +4 -0
  32. package/lib/LmFilter/utils.js +18 -0
  33. package/lib/LmFilter/wrapper/Filter.js +6 -2
  34. package/lib/LmTable/Table.js +82 -78
  35. package/lib/LmTable/hooks/useRowSelectControllableValue.js +67 -0
  36. package/lib/LmTable/style/index.css +3 -3
  37. package/lib/LmTable/style/variables.css +3 -3
  38. package/lib/LmUpload/UploadList/ItemPictureCard.js +3 -1
  39. package/lib/LmUpload/UploadList/index.js +2 -2
  40. package/lib/LmUpload/fns/index.d.ts +1 -0
  41. package/lib/LmUpload/fns/index.js +22 -3
  42. package/lib/styles/variables.css +10 -3
  43. package/package.json +1 -1
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _utils = require("ahooks/lib/utils");
11
+
12
+ var _ahooks = require("ahooks");
13
+
14
+ function useControllableValue() {
15
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17
+ var defaultValue = options.defaultValue,
18
+ _options$defaultValue = options.defaultValuePropName,
19
+ defaultValuePropName = _options$defaultValue === void 0 ? 'defaultValue' : _options$defaultValue,
20
+ _options$valuePropNam = options.valuePropName,
21
+ valuePropName = _options$valuePropNam === void 0 ? 'value' : _options$valuePropNam,
22
+ _options$trigger = options.trigger,
23
+ trigger = _options$trigger === void 0 ? 'onChange' : _options$trigger;
24
+ var value = props[valuePropName];
25
+ var isControlled = props === null || props === void 0 ? void 0 : props.hasOwnProperty(valuePropName);
26
+ var isControlledOnChange = props[trigger];
27
+ var initialValue = (0, _react.useMemo)(function () {
28
+ if (isControlled) {
29
+ return value;
30
+ }
31
+
32
+ if (props === null || props === void 0 ? void 0 : props.hasOwnProperty(defaultValuePropName)) {
33
+ return props[defaultValuePropName];
34
+ }
35
+
36
+ return defaultValue;
37
+ }, []);
38
+ var stateRef = (0, _react.useRef)(initialValue);
39
+
40
+ if (isControlled && isControlledOnChange) {
41
+ stateRef.current = value;
42
+ }
43
+
44
+ var update = (0, _ahooks.useUpdate)();
45
+
46
+ function setState(v) {
47
+ var r = (0, _utils.isFunction)(v) ? v(stateRef.current) : v;
48
+
49
+ if (!isControlledOnChange) {
50
+ stateRef.current = r;
51
+ update();
52
+ }
53
+
54
+ if (props[trigger]) {
55
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
56
+ args[_key - 1] = arguments[_key];
57
+ }
58
+
59
+ props[trigger].apply(props, [r].concat(args));
60
+ }
61
+ }
62
+
63
+ return [stateRef.current, (0, _ahooks.useMemoizedFn)(setState)];
64
+ }
65
+
66
+ var _default = useControllableValue;
67
+ exports.default = _default;
@@ -1237,6 +1237,9 @@ p {
1237
1237
  height: 48px;
1238
1238
  font-size: 12px;
1239
1239
  }
1240
+ #lm_protable_warp .ant-table-tbody > tr.ant-table-measure-row > td {
1241
+ padding: 0 !important;
1242
+ }
1240
1243
  .row-dragging {
1241
1244
  display: flex;
1242
1245
  align-items: center;
@@ -1589,9 +1592,6 @@ button.ant-table-row-expand-icon::before,
1589
1592
  button.ant-table-row-expand-icon::after {
1590
1593
  color: #bfbfbf;
1591
1594
  }
1592
- .ant-table-tbody > tr.ant-table-measure-row > td {
1593
- padding: 0 !important;
1594
- }
1595
1595
  .react-resizable-handle {
1596
1596
  position: absolute;
1597
1597
  right: -5px;
@@ -726,6 +726,9 @@
726
726
  height: 48px;
727
727
  font-size: 12px;
728
728
  }
729
+ #lm_protable_warp .ant-table-tbody > tr.ant-table-measure-row > td {
730
+ padding: 0 !important;
731
+ }
729
732
  .row-dragging {
730
733
  display: flex;
731
734
  align-items: center;
@@ -1078,9 +1081,6 @@ button.ant-table-row-expand-icon::before,
1078
1081
  button.ant-table-row-expand-icon::after {
1079
1082
  color: #bfbfbf;
1080
1083
  }
1081
- .ant-table-tbody > tr.ant-table-measure-row > td {
1082
- padding: 0 !important;
1083
- }
1084
1084
  .react-resizable-handle {
1085
1085
  position: absolute;
1086
1086
  right: -5px;
@@ -91,11 +91,13 @@ var PictureItem = function PictureItem(_ref) {
91
91
 
92
92
 
93
93
  var resetFile = (0, _react.useMemo)(function () {
94
+ var _a;
95
+
94
96
  var fileParams = getFileFields(file);
95
97
  var realFileName = fileParams.realFileName,
96
98
  fileName = fileParams.fileName,
97
99
  filename = fileParams.filename;
98
- var fileExtension = (realFileName || fileName || filename).replace(/.*\./, '').toLowerCase();
100
+ var fileExtension = (_a = (realFileName || fileName || filename).replace(/.*\./, '')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
99
101
  return Object.assign(Object.assign({}, fileParams), {
100
102
  fileExtension: fileExtension
101
103
  });
@@ -18,7 +18,7 @@ var LmUploadList = function LmUploadList(_ref) {
18
18
 
19
19
  var _a, _b;
20
20
 
21
- var uid = instance.uid,
21
+ var getFileHasValue = instance.getFileHasValue,
22
22
  getFileList = instance.getFileList,
23
23
  itemRender = instance.itemRender,
24
24
  listType = instance.listType,
@@ -29,7 +29,7 @@ var LmUploadList = function LmUploadList(_ref) {
29
29
  })) === null || _b === void 0 ? void 0 : _b.map(function (file, idx) {
30
30
  return (0, _utils.render)(itemRender || _RenderItem.default, {
31
31
  type: listType,
32
- key: file[uid] || idx,
32
+ key: getFileHasValue(file) || idx,
33
33
  file: file,
34
34
  instance: instance
35
35
  });
@@ -5,6 +5,7 @@ declare const useCoreOptions: ({ state, dispatch, props }: {
5
5
  }) => {
6
6
  CoreMethods: {
7
7
  getIsMaxCount: () => boolean;
8
+ getFileHasValue: (obj: any) => string;
8
9
  getFileFields: (fileParams: any) => {};
9
10
  beforeUpload: (e: any) => Promise<void>;
10
11
  checkOver: (file: any) => Promise<void>;
@@ -61,7 +61,25 @@ var useCoreOptions = function useCoreOptions(_ref) {
61
61
  fileAreaSize = props.fileAreaSize,
62
62
  enabledOss = props.enabledOss,
63
63
  enableCrop = props.enableCrop,
64
- ossConfig = props.ossConfig; // 获取当前的文件列表
64
+ ossConfig = props.ossConfig; // 获取两个对象是否存在指定值相等
65
+
66
+ var getHasEqual = (0, _react.useCallback)(function (obj1, obj2) {
67
+ var extend = [uid, 'fileName'];
68
+ var flag = false;
69
+ extend.forEach(function (v) {
70
+ if (!flag) flag = obj1[v] === obj2[v];
71
+ });
72
+ return flag;
73
+ }, []); // 从对象中读取存在的指定属性
74
+
75
+ var getFileHasValue = (0, _react.useCallback)(function (obj) {
76
+ var extend = [uid, 'fileName'];
77
+ var val = '';
78
+ extend.forEach(function (v) {
79
+ if (!val) val = obj[v];
80
+ });
81
+ return val;
82
+ }, [uid]); // 获取当前的文件列表
65
83
 
66
84
  var getFileList = (0, _react.useCallback)(function () {
67
85
  return props.fileList || state.fileList;
@@ -429,7 +447,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
429
447
 
430
448
  if (res) {
431
449
  fileList = (_b = getFileList()) === null || _b === void 0 ? void 0 : _b.filter(function (v) {
432
- return v[uid] !== file[uid];
450
+ return !getHasEqual(v, file);
433
451
  });
434
452
  dispatch({
435
453
  type: 'changeFileList',
@@ -448,7 +466,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
448
466
  }
449
467
  }, _callee4);
450
468
  }));
451
- }, [props.onRemove, getFileList, onChange, dispatch, uid]); // 点击文件链接或预览图标时的回调
469
+ }, [props.onRemove, getFileList, onChange, dispatch, getHasEqual]); // 点击文件链接或预览图标时的回调
452
470
 
453
471
  var preview = (0, _react.useCallback)(function (file) {
454
472
  var _a;
@@ -463,6 +481,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
463
481
  }, [props.onDownload]);
464
482
  var CoreMethods = {
465
483
  getIsMaxCount: getIsMaxCount,
484
+ getFileHasValue: getFileHasValue,
466
485
  getFileFields: getFileFields,
467
486
  beforeUpload: beforeUpload,
468
487
  checkOver: checkOver,
@@ -9764,6 +9764,9 @@ p {
9764
9764
  .lm_editTable_warpper .icon_drag:hover {
9765
9765
  color: var(--text-color);
9766
9766
  }
9767
+ .lm_editTable_warpper .ant-table .ant-table-tbody > .ant-table-measure-row > td {
9768
+ padding: 0 !important;
9769
+ }
9767
9770
  .lm_editTable_warpper .ant-picker {
9768
9771
  height: 24px !important;
9769
9772
  padding: 2px 8px;
@@ -9844,11 +9847,15 @@ p {
9844
9847
  background-color: var(--background-color-hover);
9845
9848
  }
9846
9849
  .lm_filter_wrapper .lm_filter_container .lm_filter .lm_filter_search {
9850
+ width: 140px;
9847
9851
  max-width: 140px;
9848
9852
  }
9849
9853
  .lm_filter_wrapper .lm_filter_container .lm_filter .lm_filter_complex {
9850
9854
  display: inline-flex;
9851
9855
  }
9856
+ .lm_filter_wrapper .lm_filter_container .lm_filter.lm_filter_small .lm_filter_custom_line {
9857
+ height: 24px;
9858
+ }
9852
9859
  .lm_filter_basic_item {
9853
9860
  font-size: 12px;
9854
9861
  display: inline-flex;
@@ -11259,6 +11266,9 @@ p {
11259
11266
  height: 48px;
11260
11267
  font-size: 12px;
11261
11268
  }
11269
+ #lm_protable_warp .ant-table-tbody > tr.ant-table-measure-row > td {
11270
+ padding: 0 !important;
11271
+ }
11262
11272
  .row-dragging {
11263
11273
  display: flex;
11264
11274
  align-items: center;
@@ -11611,9 +11621,6 @@ button.ant-table-row-expand-icon::before,
11611
11621
  button.ant-table-row-expand-icon::after {
11612
11622
  color: #bfbfbf;
11613
11623
  }
11614
- .ant-table-tbody > tr.ant-table-measure-row > td {
11615
- padding: 0 !important;
11616
- }
11617
11624
  .react-resizable-handle {
11618
11625
  position: absolute;
11619
11626
  right: -5px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"