@donglegeyu/company-ui 1.2.32 → 1.2.34

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.
@@ -286,6 +286,7 @@ function IconSelectInner({
286
286
  placeholder,
287
287
  size,
288
288
  style: { width: "100%", ...style },
289
+ classNames: { popup: { root: "icon-select-popup" } },
289
290
  allowClear: true,
290
291
  showSearch: true,
291
292
  filterOption: false,
@@ -302,7 +303,7 @@ function IconSelectInner({
302
303
  {
303
304
  open: showAddModal,
304
305
  title: "添加自定义图标",
305
- width: 380,
306
+ size: 380,
306
307
  onClose: closeAddModal,
307
308
  placement: "right",
308
309
  zIndex: 2e3,
@@ -77,7 +77,9 @@
77
77
  display: flex;
78
78
  align-items: center;
79
79
  }
80
+ }
80
81
 
82
+ .icon-select-popup {
81
83
  .icon-option-item {
82
84
  display: flex;
83
85
  align-items: center;
@@ -85,6 +87,10 @@
85
87
  height: 100%;
86
88
  min-height: 32px;
87
89
 
90
+ svg {
91
+ vertical-align: middle;
92
+ }
93
+
88
94
  .icon-option-label {
89
95
  font-size: 13px;
90
96
  line-height: 1;
@@ -260,6 +260,7 @@ function SmartListTemplate({
260
260
  width: field.width || 120,
261
261
  fixed: field.fixed,
262
262
  ellipsis: enableEllipsis,
263
+ sorter: field.sortable === true ? true : void 0,
263
264
  render: (_, record) => {
264
265
  const customContent = bodyCell ? bodyCell({ ...field, key: field.key }, record) : null;
265
266
  if (customContent !== null) {
@@ -566,8 +567,14 @@ function SmartListTemplate({
566
567
  [onChange]
567
568
  );
568
569
  const handleTableChange = (0, import_react.useCallback)(
569
- (_pagination) => {
570
- onChange == null ? void 0 : onChange(_pagination);
570
+ (_pagination, _filters, sorter) => {
571
+ const sortInfo = Array.isArray(sorter) ? sorter[0] : sorter;
572
+ const sortField = sortInfo == null ? void 0 : sortInfo.field;
573
+ const sortOrder = sortInfo == null ? void 0 : sortInfo.order;
574
+ onChange == null ? void 0 : onChange({
575
+ sortField,
576
+ sortOrder
577
+ });
571
578
  },
572
579
  [onChange]
573
580
  );
@@ -31,7 +31,7 @@ export interface FilterItem {
31
31
  export interface DisplayItem {
32
32
  key: string;
33
33
  label?: string;
34
- type: 'item' | 'button';
34
+ type: "item" | "button";
35
35
  inputType?: string;
36
36
  placeholder?: string | string[];
37
37
  options?: {
@@ -42,16 +42,18 @@ export interface DisplayItem {
42
42
  export interface FieldDefinition {
43
43
  key: string;
44
44
  label: string;
45
- type?: 'input' | 'select' | 'date' | 'daterange' | 'item';
45
+ type?: "input" | "select" | "date" | "daterange" | "item";
46
46
  placeholder?: string;
47
47
  options?: {
48
48
  label: string;
49
49
  value: string | number;
50
50
  }[];
51
51
  width?: number;
52
- fixed?: 'left' | 'right';
52
+ fixed?: "left" | "right";
53
53
  ellipsis?: boolean;
54
54
  hideInFilter?: boolean;
55
+ /** 是否支持列排序(表头显示排序按钮)。默认 false */
56
+ sortable?: boolean;
55
57
  }
56
58
  export interface PaginationConfig {
57
59
  current: number;
@@ -462,6 +462,11 @@ function IconSelectInner(_ref) {
462
462
  style: _objectSpread({
463
463
  width: "100%"
464
464
  }, style),
465
+ classNames: {
466
+ popup: {
467
+ root: "icon-select-popup"
468
+ }
469
+ },
465
470
  allowClear: true,
466
471
  showSearch: true,
467
472
  filterOption: false,
@@ -474,7 +479,7 @@ function IconSelectInner(_ref) {
474
479
  }), /*#__PURE__*/_jsx(CompanyDrawer, {
475
480
  open: showAddModal,
476
481
  title: "\u6DFB\u52A0\u81EA\u5B9A\u4E49\u56FE\u6807",
477
- width: 380,
482
+ size: 380,
478
483
  onClose: closeAddModal,
479
484
  placement: "right",
480
485
  zIndex: 2000,
@@ -77,7 +77,9 @@
77
77
  display: flex;
78
78
  align-items: center;
79
79
  }
80
+ }
80
81
 
82
+ .icon-select-popup {
81
83
  .icon-option-item {
82
84
  display: flex;
83
85
  align-items: center;
@@ -85,6 +87,10 @@
85
87
  height: 100%;
86
88
  min-height: 32px;
87
89
 
90
+ svg {
91
+ vertical-align: middle;
92
+ }
93
+
88
94
  .icon-option-label {
89
95
  font-size: 13px;
90
96
  line-height: 1;
@@ -335,6 +335,7 @@ export default function SmartListTemplate(_ref) {
335
335
  width: field.width || 120,
336
336
  fixed: field.fixed,
337
337
  ellipsis: enableEllipsis,
338
+ sorter: field.sortable === true ? true : undefined,
338
339
  render: function render(_, record) {
339
340
  var customContent = bodyCell ? bodyCell(_objectSpread(_objectSpread({}, field), {}, {
340
341
  key: field.key
@@ -797,8 +798,14 @@ export default function SmartListTemplate(_ref) {
797
798
  var handleFilterChange = useCallback(function (data) {
798
799
  onChange === null || onChange === void 0 || onChange(data);
799
800
  }, [onChange]);
800
- var handleTableChange = useCallback(function (_pagination) {
801
- onChange === null || onChange === void 0 || onChange(_pagination);
801
+ var handleTableChange = useCallback(function (_pagination, _filters, sorter) {
802
+ var sortInfo = Array.isArray(sorter) ? sorter[0] : sorter;
803
+ var sortField = sortInfo === null || sortInfo === void 0 ? void 0 : sortInfo.field;
804
+ var sortOrder = sortInfo === null || sortInfo === void 0 ? void 0 : sortInfo.order;
805
+ onChange === null || onChange === void 0 || onChange({
806
+ sortField: sortField,
807
+ sortOrder: sortOrder
808
+ });
802
809
  }, [onChange]);
803
810
  var handlePageChange = useCallback(function (page, pageSize) {
804
811
  setPaginationConfig({
@@ -31,7 +31,7 @@ export interface FilterItem {
31
31
  export interface DisplayItem {
32
32
  key: string;
33
33
  label?: string;
34
- type: 'item' | 'button';
34
+ type: "item" | "button";
35
35
  inputType?: string;
36
36
  placeholder?: string | string[];
37
37
  options?: {
@@ -42,16 +42,18 @@ export interface DisplayItem {
42
42
  export interface FieldDefinition {
43
43
  key: string;
44
44
  label: string;
45
- type?: 'input' | 'select' | 'date' | 'daterange' | 'item';
45
+ type?: "input" | "select" | "date" | "daterange" | "item";
46
46
  placeholder?: string;
47
47
  options?: {
48
48
  label: string;
49
49
  value: string | number;
50
50
  }[];
51
51
  width?: number;
52
- fixed?: 'left' | 'right';
52
+ fixed?: "left" | "right";
53
53
  ellipsis?: boolean;
54
54
  hideInFilter?: boolean;
55
+ /** 是否支持列排序(表头显示排序按钮)。默认 false */
56
+ sortable?: boolean;
55
57
  }
56
58
  export interface PaginationConfig {
57
59
  current: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donglegeyu/company-ui",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",