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.
@@ -436,6 +436,7 @@ var EditableCell = function EditableCell(props) {
436
436
  return ((_b = (_a = option.children) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.indexOf(input.toLowerCase())) >= 0;
437
437
  }
438
438
  }, componentProps, {
439
+ // open={true}
439
440
  onChange: handleFormItemChange
440
441
  }));
441
442
 
@@ -834,8 +835,60 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
834
835
  setDataSource(res);
835
836
  }
836
837
  };
838
+ /** 判断columne中有没有带optionOnly参数 */
839
+
840
+
841
+ var hasDisableOptions = (0, _react.useMemo)(function () {
842
+ var hasOnlyOptionsDatas = columns.filter(function (item) {
843
+ var _a;
844
+
845
+ return (_a = item === null || item === void 0 ? void 0 : item.componentProps) === null || _a === void 0 ? void 0 : _a.optionOnly;
846
+ });
847
+
848
+ if (hasOnlyOptionsDatas.length) {
849
+ return hasOnlyOptionsDatas.map(function (item) {
850
+ return item.dataIndex;
851
+ });
852
+ }
853
+
854
+ return false;
855
+ }, [columns]);
856
+ /** 动态获取disabled的props数据源 */
857
+
858
+ var DisableOptions = (0, _react.useMemo)(function () {
859
+ var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
860
+ var _ref3 = item.componentProps || {},
861
+ optionOnly = _ref3.optionOnly,
862
+ options = _ref3.options;
863
+
864
+ if (optionOnly && options) {
865
+ var dataIndex = item.dataIndex;
866
+ var dataIndexData = dataSource.map(function (d) {
867
+ return d[dataIndex];
868
+ });
869
+ var newOptions = options.map(function (o) {
870
+ return Object.assign(Object.assign({}, o), {
871
+ disabled: dataIndexData.includes(o === null || o === void 0 ? void 0 : o.value) ? true : false
872
+ });
873
+ });
874
+ return Object.assign(Object.assign({}, item), {
875
+ componentProps: Object.assign(Object.assign({}, item.componentProps), {
876
+ options: newOptions
877
+ })
878
+ });
879
+ } else {
880
+ return item;
881
+ }
882
+ });
883
+ return newColumns;
884
+ }, [columns, dataSource]);
885
+ var memoOptions = (0, _react.useMemo)(function () {
886
+ return hasDisableOptions ? [DisableOptions] : [];
887
+ }, [hasDisableOptions, DisableOptions]);
888
+ /** 组装之后的最终columns */
837
889
 
838
890
  var resultColumns = (0, _react.useMemo)(function () {
891
+ var rColumns = hasDisableOptions ? DisableOptions : columns;
839
892
  var localColumns = [sortOpen ? {
840
893
  title: '',
841
894
  dataIndex: 'sort',
@@ -846,7 +899,7 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
846
899
  id: record[_rowKey] || record.id
847
900
  });
848
901
  }
849
- } : null].concat((0, _toConsumableArray2.default)(columns), [useQuickOpetate ? {
902
+ } : null].concat((0, _toConsumableArray2.default)(rColumns), [useQuickOpetate ? {
850
903
  title: '操作',
851
904
  dataIndex: 'lm_edit_opetate',
852
905
  width: 68,
@@ -887,18 +940,12 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
887
940
  shouldCellUpdate: function shouldCellUpdate(record, prevRecord) {
888
941
  var dataIndex = col.dataIndex;
889
942
 
890
- if (col === null || col === void 0 ? void 0 : col.fixed) {
943
+ if ((col === null || col === void 0 ? void 0 : col.fixed) || hasDisableOptions && hasDisableOptions.includes(dataIndex)) {
891
944
  return true;
892
945
  }
893
946
 
894
947
  return record[dataIndex] === prevRecord[dataIndex] ? false : true;
895
948
  },
896
- // render: (text: string, record: Record<string, any>, index: number) => {
897
- // const { editable, render } = record
898
- // if (!editable && render) {
899
- // return render?.(text, record ,index)
900
- // }
901
- // },
902
949
  onCell: function onCell(record) {
903
950
  return {
904
951
  getLength: function getLength() {
@@ -926,9 +973,8 @@ var EditTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
926
973
  }
927
974
  });
928
975
  });
929
- console.log(res, '---res');
930
976
  return res;
931
- }, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable]);
977
+ }, [columns, isAdd, sortOpen, useQuickOpetate, sortEditTable, (0, _toConsumableArray2.default)(memoOptions)]);
932
978
  var DraggableContainer = (0, _react.useCallback)(function (_a) {
933
979
  var _b;
934
980
 
@@ -106,7 +106,6 @@ var getLabel = function getLabel(filterValue, item) {
106
106
  data = item.data; // 不存在筛选时
107
107
 
108
108
  if (!(0, _utils.getIsHas)(filterValue)) {
109
- console.log('label', filterValue, item);
110
109
  return getPlacehodler(item);
111
110
  } // 存在筛选数据时 ⬇️
112
111
  // 级联数据转换平级结构
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"
@@ -35,7 +35,7 @@
35
35
  "create": "node ./config/main.js",
36
36
  "dumi": "dumi dev",
37
37
  "dumi:build": "dumi build",
38
- "pub": "npm run build && npm verion patch && npm publish"
38
+ "pub": "npm run build && npm version patch && npm publish"
39
39
  },
40
40
  "lint-staged": {
41
41
  "gitDir": "../",