@zat-design/sisyphus-react 4.6.5 → 4.7.0-beta.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.
@@ -4,18 +4,15 @@ import { tools } from "@zat-design/utils";
4
4
  import { valueTypeRender } from "../../../ProUtils/utils";
5
5
  const { calc } = tools;
6
6
  const formatSummaryColumns = (columns, { rowSelection }) => {
7
- const nextColumns = [...columns];
8
- if (!rowSelection) {
9
- nextColumns.forEach((column) => {
10
- column.index = calc(column.index ?? 0, "-", 1);
11
- });
12
- }
7
+ const nextColumns = columns.map((column) => ({
8
+ ...column,
9
+ index: rowSelection ? column.index : calc(column.index ?? 0, "-", 1)
10
+ }));
13
11
  const { index: firstIndex } = (nextColumns == null ? void 0 : nextColumns[0]) || {};
14
- if (firstIndex !== 0) {
15
- const colSpan = calc(firstIndex ?? 0, "-", 1);
12
+ if (firstIndex > 0) {
16
13
  nextColumns.unshift({
17
14
  index: 0,
18
- colSpan: colSpan === 0 ? void 0 : colSpan
15
+ colSpan: firstIndex === 1 ? void 0 : firstIndex
19
16
  });
20
17
  }
21
18
  return nextColumns;
@@ -47,6 +47,7 @@ const ComRender = (props) => {
47
47
  const mergedGetValueProps = getValueProps || ((val) => ({ [valuePropName]: val }));
48
48
  const nextProps = mergedGetValueProps(fieldProps.value);
49
49
  const componentProps = omit({ ...fieldProps, ...rest, ...nextProps }, ["onFieldChange"]);
50
+ const childContext = { ...contextProps, name, valueType, type, isView };
50
51
  const componentElementProps = (_a = props == null ? void 0 : props.component) == null ? void 0 : _a.props;
51
52
  const isSeparator = (componentElementProps == null ? void 0 : componentElementProps.className) === "group-separator";
52
53
  if (isSeparator && isView) {
@@ -57,7 +58,7 @@ const ComRender = (props) => {
57
58
  ] });
58
59
  }
59
60
  if (viewRender && isView) {
60
- return /* @__PURE__ */ jsx(FieldProvider, { value: { ...contextProps, valueType, type, isView }, children: viewRender(componentProps) });
61
+ return /* @__PURE__ */ jsx(FieldProvider, { value: childContext, children: viewRender(componentProps) });
61
62
  }
62
63
  const Component = component ? React.cloneElement(component, { ...componentProps }) : /* @__PURE__ */ jsx(TypeComponent, { ...componentProps });
63
64
  const renderComponent = getComRender(Component, props, componentProps);
@@ -66,6 +67,8 @@ const ComRender = (props) => {
66
67
  name,
67
68
  className: formItemClassName,
68
69
  style: formItemStyle,
70
+ // Group controls the input value. Do not inject it into FieldProvider.value.
71
+ getValueProps: () => ({}),
69
72
  ...isView ? {} : { required: rest == null ? void 0 : rest.required, rules: rest == null ? void 0 : rest.rules }
70
73
  };
71
74
  if (dependencies && dependencies.length > 0) {
@@ -89,13 +92,13 @@ const ComRender = (props) => {
89
92
  return hasChanged;
90
93
  },
91
94
  noStyle: true,
92
- children: () => /* @__PURE__ */ jsx(Form.Item, { ...formItemProps, children: /* @__PURE__ */ jsx(FieldProvider, { value: { ...contextProps, valueType, type, isView }, children: renderComponent }) })
95
+ children: () => /* @__PURE__ */ jsx(Form.Item, { ...formItemProps, children: /* @__PURE__ */ jsx(FieldProvider, { value: childContext, children: renderComponent }) })
93
96
  }
94
97
  );
95
98
  }
96
- return /* @__PURE__ */ jsx(Form.Item, { ...formItemProps, children: /* @__PURE__ */ jsx(FieldProvider, { value: { ...contextProps, valueType, type, isView }, children: renderComponent }) });
99
+ return /* @__PURE__ */ jsx(Form.Item, { ...formItemProps, children: /* @__PURE__ */ jsx(FieldProvider, { value: childContext, children: renderComponent }) });
97
100
  }
98
- return /* @__PURE__ */ jsx(FieldProvider, { value: { ...contextProps, valueType, type, isView }, children: renderComponent });
101
+ return /* @__PURE__ */ jsx(FieldProvider, { value: childContext, children: renderComponent });
99
102
  };
100
103
  var ComRender_default = ComRender;
101
104
  export {
@@ -169,19 +169,28 @@ const ProForm = (props, ref) => {
169
169
  });
170
170
  const footerRender = () => {
171
171
  let footerEle = null;
172
+ let alignSearchFooter = false;
172
173
  if (isView || disabled) {
173
174
  footerEle = null;
174
175
  } else if (React.isValidElement(footer)) {
175
176
  footerEle = footer;
176
177
  } else if (footer === void 0 || footer || isObject(footer)) {
177
178
  footerEle = defaultFooter(footer);
179
+ alignSearchFooter = mode === "search";
178
180
  }
179
181
  const expandEle = expandRender();
180
182
  const hasElement = footerEle || expandEle;
181
- return hasElement ? /* @__PURE__ */ jsx(Col, { ...colProps, className: footerCls, children: /* @__PURE__ */ jsxs(Space, { align: "center", children: [
182
- footerEle,
183
- expandEle
184
- ] }) }) : null;
183
+ return hasElement ? /* @__PURE__ */ jsx(
184
+ Col,
185
+ {
186
+ ...colProps,
187
+ className: classnames(footerCls, { "pro-form-search-footer": alignSearchFooter }),
188
+ children: /* @__PURE__ */ jsxs(Space, { align: "center", children: [
189
+ footerEle,
190
+ expandEle
191
+ ] })
192
+ }
193
+ ) : null;
185
194
  };
186
195
  if ((localStorage == null ? void 0 : localStorage.locale) && localStorage.locale !== "zh-CN") {
187
196
  if (span === 24) {
@@ -328,6 +328,12 @@
328
328
  }
329
329
  }
330
330
 
331
+ > .@{ant-prefix}-row > .pro-form-search-footer {
332
+ display: flex;
333
+ justify-content: flex-end;
334
+ margin-inline-start: auto;
335
+ }
336
+
331
337
  .pro-form-view-container {
332
338
  display: inline-block;
333
339
  word-break: break-all;
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Button } from "antd";
2
+ import { Button, Tooltip } from "antd";
3
3
  import { ReactSVG } from "react-svg";
4
4
  import { ProTreeModal } from "../../../index";
5
5
  const RenderTableHeader = (props) => {
6
- var _a, _b, _c;
6
+ var _a, _b, _c, _d, _e;
7
7
  const { dataSource } = props;
8
8
  const {
9
9
  headerRender,
@@ -23,18 +23,20 @@ const RenderTableHeader = (props) => {
23
23
  return /* @__PURE__ */ jsxs("div", { className: "column-config", children: [
24
24
  /* @__PURE__ */ jsx("div", { className: "left-contain", children: headerRender ? typeof headerRender === "function" ? headerRender() : headerRender : null }),
25
25
  /* @__PURE__ */ jsxs("div", { className: "right-actions", children: [
26
- resizeColumn && /* @__PURE__ */ jsx(
26
+ resizeColumn && /* @__PURE__ */ jsx(Tooltip, { title: (_a = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _a.resetColumnWidth, children: /* @__PURE__ */ jsx(
27
27
  Button,
28
28
  {
29
+ "aria-label": (_b = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _b.resetColumnWidth,
30
+ className: "table-header-icon-btn",
29
31
  icon: /* @__PURE__ */ jsx(ReactSVG, { className: "anticon", wrapper: "span", src: resetSvg }),
30
32
  onClick: resetColumnWidth,
31
- children: (_a = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _a.resetColumnWidth
33
+ type: "text"
32
34
  }
33
- ),
35
+ ) }),
34
36
  columnConfig && /* @__PURE__ */ jsx(
35
37
  ProTreeModal,
36
38
  {
37
- title: (_b = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _b.customColumns,
39
+ title: (_c = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _c.customColumns,
38
40
  span: 8,
39
41
  mode: "list",
40
42
  draggable: true,
@@ -42,14 +44,15 @@ const RenderTableHeader = (props) => {
42
44
  value: checkColumns,
43
45
  allValue: "all",
44
46
  onChange: handleColumnConfig,
45
- trigger: /* @__PURE__ */ jsx(
47
+ trigger: /* @__PURE__ */ jsx(Tooltip, { title: (_d = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _d.customColumns, children: /* @__PURE__ */ jsx(
46
48
  Button,
47
49
  {
48
- className: "custom-column-btn",
50
+ "aria-label": (_e = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _e.customColumns,
51
+ className: "custom-column-btn table-header-icon-btn",
49
52
  icon: /* @__PURE__ */ jsx(ReactSVG, { className: "anticon", wrapper: "span", src: customColumnSvg }),
50
- children: (_c = locale == null ? void 0 : locale.ProTable) == null ? void 0 : _c.customColumns
53
+ type: "text"
51
54
  }
52
- )
55
+ ) })
53
56
  }
54
57
  )
55
58
  ] })
@@ -12,8 +12,8 @@ import useAntdTable, { SELECTION_ALL, CURRENT_PAGE, UNCHECK_ALL } from "./hooks/
12
12
  import { BaseTable, DraggableTable } from "./components/RcTable";
13
13
  import { formatColumn } from "./components/FormatColumn";
14
14
  import empty from "../assets/empty.png";
15
- import resetSvg from "../assets/reset.svg";
16
- import customColumnSvg from "../assets/customColumn.svg";
15
+ import refreshSvg from "../assets/refresh.svg";
16
+ import settingsSvg from "../assets/settings.svg";
17
17
  import { filterVisibleColumns, getColumnDataIndex, getRowKey } from "./utils";
18
18
  import {
19
19
  baseStorage,
@@ -360,13 +360,13 @@ const ProTable = forwardRef((props, tableRef) => {
360
360
  headerRender,
361
361
  columnConfig,
362
362
  resizeColumn,
363
- resetSvg,
363
+ resetSvg: refreshSvg,
364
364
  resetColumnWidth,
365
365
  locale,
366
366
  customColumns,
367
367
  checkColumns,
368
368
  handleColumnConfig,
369
- customColumnSvg
369
+ customColumnSvg: settingsSvg
370
370
  }
371
371
  }
372
372
  ),
@@ -254,21 +254,36 @@
254
254
  }
255
255
  }
256
256
 
257
- .column-config .right-actions .@{ant-prefix}-btn {
257
+ .column-config .right-actions .table-header-icon-btn {
258
+ display: inline-flex;
259
+ align-items: flex-end;
260
+ justify-content: center;
261
+ width: 28px;
262
+ height: 32px;
263
+ border: 0;
264
+ box-shadow: none;
265
+ padding: 0;
266
+
258
267
  &:hover,
259
268
  &:visited,
260
269
  &:focus {
261
270
  color: #333 !important;
262
- background: #fff !important;
263
- border: 1px solid #d9d9d9 !important;
271
+ background: transparent !important;
272
+ border: 0 !important;
264
273
  }
265
- }
266
274
 
267
- .custom-column-btn {
268
- display: inline-flex;
269
- align-items: center;
270
- .anticon {
271
- height: 16px;
275
+ &:focus-visible {
276
+ outline: 2px solid var(--zaui-brand, #006aff);
277
+ outline-offset: 2px;
278
+ }
279
+
280
+ .anticon > * {
281
+ line-height: 0;
282
+ }
283
+ .anticon svg {
284
+ display: block;
285
+ width: 20px;
286
+ height: 20px;
272
287
  }
273
288
  }
274
289
 
@@ -424,25 +439,12 @@
424
439
  .column-config {
425
440
  display: flex;
426
441
  justify-content: space-between;
427
- margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
442
+ margin-bottom: calc(var(--zaui-space-size-md; 14px) * var(--zaui-size; 1));
428
443
 
429
444
  .right-actions {
430
445
  display: flex;
446
+ gap: 0;
431
447
  align-items: center;
432
-
433
- > .@{ant-prefix}-btn {
434
- &:hover,
435
- &:visited,
436
- &:focus {
437
- color: unset;
438
- background: unset;
439
- border: 1px solid #d9d9d9;
440
- }
441
- }
442
-
443
- .custom-column-btn {
444
- margin-left: var(--zaui-space-size-sm, 8px);
445
- }
446
448
  }
447
449
  }
448
450
 
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="#343434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M10 4a7 7 0 1 0 6.06 3.5" />
3
+ <path d="m8 2 2 2-2 2" />
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="#343434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M8.25 2h3.5l.5 2 1.5.87 2-.57 1.75 3.03L16 8.8v2.4l1.5 1.47-1.75 3.03-2-.57-1.5.87-.5 2h-3.5l-.5-2-1.5-.87-2 .57-1.75-3.03L4 11.2V8.8L2.5 7.33 4.25 4.3l2 .57L7.75 4z" />
3
+ <circle cx="10" cy="10" r="2.5" />
4
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.6.5",
3
+ "version": "4.7.0-beta.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",