@lemon-fe/kits 1.0.1-0 → 1.0.1

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.
@@ -16,7 +16,7 @@ export declare type SelectEditorParams = Pick<SelectProps<any, BaseOptionType>,
16
16
  */
17
17
  action?: 'next' | 'stop' | 'none';
18
18
  };
19
- declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & Pick<SelectProps<any, BaseOptionType>, "disabled" | "options" | "virtual" | "showSearch" | "listHeight" | "allowClear" | "mode"> & {
19
+ declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & Pick<SelectProps<any, BaseOptionType>, "disabled" | "mode" | "showSearch" | "allowClear" | "options" | "virtual" | "listHeight"> & {
20
20
  fieldNames?: {
21
21
  label: string;
22
22
  value: string;
@@ -28,6 +28,6 @@ declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, a
28
28
  /**
29
29
  * 完成选择后的单元格切换行为,默认为next
30
30
  */
31
- action?: "stop" | "next" | "none" | undefined;
31
+ action?: "stop" | "none" | "next" | undefined;
32
32
  } & React.RefAttributes<ICellEditorReactComp>>;
33
33
  export default _default;
@@ -98,7 +98,7 @@ import CellIndexRender from "./renderer/CellIndexRenderer";
98
98
  import CellRenderer from "./renderer/CellRenderer";
99
99
  import DetailCellRenderer from "./renderer/DetailCellRenderer";
100
100
  import HeaderRenderer from "./renderer/HeaderRenderer";
101
- import { prefix, getColField, isColumn, withSyncRender, Store, Selection, columnTypes } from "./utils";
101
+ import { prefix, getColField, isColumn, withSyncRender, Store, Selection, columnTypes, isColumnDef } from "./utils";
102
102
 
103
103
  var add = function add(a, b) {
104
104
  return new BigNumber(a).plus(b);
@@ -917,8 +917,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
917
917
  defs = _this5$getColumnDefs2[0],
918
918
  leafColIds = _this5$getColumnDefs2[1];
919
919
 
920
- _this5.api.setColumnDefs(defs);
921
-
922
920
  if (state) {
923
921
  var newState = _toConsumableArray(state);
924
922
 
@@ -937,18 +935,41 @@ var DataGrid = /*#__PURE__*/function (_Component) {
937
935
  });
938
936
  }
939
937
  });
940
- /**
941
- * 初始化的时候,需要使用存储的columnState,不仅仅是顺序,其他情况由于在defs里已经有列的状态控制了
942
- */
943
938
 
944
- _this5.columnApi.applyColumnState({
945
- state: allState ? newState : newState.map(function (item) {
939
+ if (allState) {
940
+ /**
941
+ * 表格初始化列抖动问题:先调用setColumnDefs,后applyColumnState,会产生列移动动画,所以先处理一遍colDefs,将需要隐藏的列默认隐藏
942
+ */
943
+ defs.forEach(function (col) {
944
+ if (isColumnDef(col)) {
945
+ var colState = state.find(function (item) {
946
+ return item.colId === col.colId;
947
+ });
948
+
949
+ if (colState !== undefined && colState.hide) {
950
+ col.initialHide = true;
951
+ }
952
+ }
953
+ });
954
+ } else {
955
+ /**
956
+ * 初始化的时候,需要使用存储的columnState的所有属性,但其他情况由于在defs里已经有列的状态控制了,所以只需要应用排序不需要其他状态
957
+ */
958
+ newState = newState.map(function (item) {
946
959
  return {
947
960
  colId: item.colId
948
961
  };
949
- }),
962
+ });
963
+ }
964
+
965
+ _this5.api.setColumnDefs(defs);
966
+
967
+ _this5.columnApi.applyColumnState({
968
+ state: newState,
950
969
  applyOrder: true
951
970
  });
971
+ } else {
972
+ _this5.api.setColumnDefs(defs);
952
973
  }
953
974
  });
954
975
  }
@@ -1,8 +1,9 @@
1
- import type { ColDef } from '@ag-grid-community/core';
1
+ import type { ColDef, ColGroupDef } from '@ag-grid-community/core';
2
2
  import { Subject } from '@lemon-fe/utils';
3
3
  import type { ColType, ColGroupType, PathType } from './typings';
4
4
  export declare const prefix: (val?: string | undefined) => string;
5
5
  export declare function isColumn<T>(col: ColGroupType<T> | ColType<T>): col is ColType<T>;
6
+ export declare function isColumnDef<T>(col: ColGroupDef<T> | ColDef<T>): col is ColDef<T>;
6
7
  export declare function getColField(col: {
7
8
  field?: string;
8
9
  key?: string;
@@ -32,6 +32,9 @@ export var prefix = prefixClassName('grid');
32
32
  export function isColumn(col) {
33
33
  return col.children === undefined;
34
34
  }
35
+ export function isColumnDef(col) {
36
+ return col.children === undefined;
37
+ }
35
38
  export function getColField(col) {
36
39
  return col.field || col.key || (Array.isArray(col.dataIndex) ? col.dataIndex.join('.') : col.dataIndex) || col.colId;
37
40
  }
@@ -67,7 +67,7 @@
67
67
 
68
68
  &-type-default&-shape-default {
69
69
  &::before {
70
- background-color: @color-disabled;
70
+ background-color: #c0c0c0;
71
71
  }
72
72
  }
73
73
 
package/es/init.js CHANGED
@@ -159,6 +159,14 @@ export default function init() {
159
159
  pointerEvents: 'none'
160
160
  }
161
161
  })
162
+ });
163
+ TimePicker.RangePicker.defaultProps = _objectSpread(_objectSpread({}, TimePicker.RangePicker.defaultProps), {}, {
164
+ suffixIcon: /*#__PURE__*/React.createElement(Icons.Clock, {
165
+ style: {
166
+ pointerEvents: 'none'
167
+ }
168
+ }),
169
+ clearIcon: /*#__PURE__*/React.createElement(Clear, null)
162
170
  }); //@ts-ignore
163
171
 
164
172
  Menu.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.1-0",
3
+ "version": "1.0.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",