@zat-design/sisyphus-react 3.4.8-beta.4 → 3.4.8-beta.6

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.
@@ -5163,6 +5163,14 @@ input[type='button'] {
5163
5163
  .ant-modal .ant-input-textarea-show-count.ant-input-textarea-in-form-item::after {
5164
5164
  background: transparent;
5165
5165
  }
5166
+ .ant-form .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before,
5167
+ .ant-drawer .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before,
5168
+ .ant-modal .ant-drawer-body .ant-form-item .ant-form-item-label.ant-form-item-label-left > .ant-form-item-required::before {
5169
+ position: absolute;
5170
+ top: calc(50% - 7px);
5171
+ left: -8px;
5172
+ margin: 0;
5173
+ }
5166
5174
  .ant-form .ant-form-item.ant-form-item-with-help,
5167
5175
  .ant-drawer .ant-form-item.ant-form-item-with-help,
5168
5176
  .ant-modal .ant-form-item.ant-form-item-with-help {
@@ -1,5 +1,6 @@
1
1
  import { Form, FormInstance } from 'antd';
2
- import { ForwardRefRenderFunction } from 'react';
2
+ import React, { ForwardRefRenderFunction } from 'react';
3
+ import { FormProviderProps } from 'antd/es/form/context';
3
4
  import { ProFormProps } from './propsType';
4
5
  interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
5
6
  useForm: typeof Form.useForm;
@@ -7,4 +8,5 @@ interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, Pr
7
8
  [key: string]: any;
8
9
  }
9
10
  declare const ProFormForward: IProForm;
11
+ export declare const ProFormProvider: React.FC<FormProviderProps>;
10
12
  export default ProFormForward;
@@ -1,4 +1,3 @@
1
- import _toArray from "@babel/runtime/helpers/esm/toArray";
2
1
  import "antd/es/row/style";
3
2
  import _Row from "antd/es/row";
4
3
  import "antd/es/form/style";
@@ -282,30 +281,32 @@ ProFormForward.useWatch = function (watchValue, form) {
282
281
  }
283
282
  return _Form.useWatch([], form);
284
283
  };
285
- var ProFormProvider = function ProFormProvider(props) {
284
+ export var ProFormProvider = function ProFormProvider(props) {
286
285
  var onFormChange = props.onFormChange,
287
286
  onFormFinish = props.onFormFinish,
288
287
  children = props.children;
289
- var handleFormChange = function handleFormChange(name, info) {
288
+ var handleFormChange = function handleFormChange(formName, info) {
290
289
  var changedFields = info.changedFields;
291
290
  var _changedFields = changedFields.flatMap(function (item) {
292
- var name = item.name,
293
- _item$value = item.value,
291
+ var _item$value = item.value,
294
292
  value = _item$value === void 0 ? [] : _item$value;
295
- var _name = _toArray(name),
296
- firstName = _name[0],
297
- names = _name.slice(1);
298
- var _namePath = [].concat(_toConsumableArray(splitNameStr(String(firstName))), _toConsumableArray(names));
299
- return _namePath.map(function (name, index) {
293
+ var name = item.name;
294
+ var namesStr = name[name.length - 1];
295
+ // name中的最后一位如果包含 '-' 则是names组件
296
+ var isNames = String(namesStr).includes('-');
297
+ if (!isNames) return item; // 不是names组件直接返回
298
+ var namesList = splitNameStr(String(namesStr)); // 拆解出name列表
299
+ var prefix = name.slice(0, name.length - 1);
300
+ return namesList.map(function (nameItem, index) {
300
301
  return _objectSpread(_objectSpread({}, item), {}, {
301
- name: name,
302
+ name: [].concat(_toConsumableArray(prefix), _toConsumableArray(nameItem)),
302
303
  value: value[index]
303
304
  });
304
305
  });
305
306
  });
306
307
  info.changedFields = _changedFields;
307
308
  // @ts-ignore
308
- onFormChange(name, info);
309
+ onFormChange(formName, info);
309
310
  };
310
311
  return _jsx(_Form.Provider, {
311
312
  onFormChange: onFormChange ? handleFormChange : undefined,
@@ -27,7 +27,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
27
27
  export declare const isUpperCase: (type: string, upperCase: boolean) => any;
28
28
  export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
29
29
  export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
30
- export declare const splitNameStr: (name: string) => NamePath[];
30
+ export declare const splitNameStr: (name: string) => string[][];
31
31
  export declare const filterInternalFields: (values: any) => any;
32
32
  export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
33
33
  export declare const isNullValue: (value: any) => boolean;
@@ -119,12 +119,16 @@ var ProCollapse = function ProCollapse(props) {
119
119
  return;
120
120
  }
121
121
  var proCollapseNoTitles = proCollapseContent.querySelectorAll('.pro-collapse-no-level1-title');
122
+ var proFooterNode = proCollapseContent.querySelector('.pro-footer');
122
123
  var proCollapses = proCollapseContent.querySelectorAll('.pro-collapse');
123
- if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
124
+ if ((proCollapseNoTitles === null || proCollapseNoTitles === void 0 ? void 0 : proCollapseNoTitles.length) === 1 && proCollapses.length === 1) {
124
125
  var rect = proCollapseNoTitles[0].getBoundingClientRect();
125
126
  if ((rect === null || rect === void 0 ? void 0 : rect.height) < window.innerHeight - rect.top) {
126
127
  proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + 16, "px)");
127
128
  }
129
+ if (proFooterNode) {
130
+ proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + proFooterNode.offsetHeight + 16, "px)");
131
+ }
128
132
  }
129
133
  return function () {
130
134
  if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
@@ -15,6 +15,21 @@
15
15
  background: transparent;
16
16
  }
17
17
  }
18
+ .@{ant-prefix}-drawer-body{
19
+
20
+ .@{ant-prefix}-form-item{
21
+ .@{ant-prefix}-form-item-label{
22
+ &.@{ant-prefix}-form-item-label-left{
23
+ & > .@{ant-prefix}-form-item-required::before{
24
+ position: absolute;
25
+ top: calc(50% - 7px);
26
+ left: -8px;
27
+ margin: 0;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
18
33
 
19
34
  .@{ant-prefix}-form-item {
20
35
  &.@{ant-prefix}-form-item-with-help {
@@ -28,7 +43,6 @@
28
43
  overflow: initial;
29
44
  line-height: 1;
30
45
  white-space: pre-wrap;
31
-
32
46
  .@{ant-prefix}-form-item-required {
33
47
  position: relative;
34
48
  &::before {
@@ -1,5 +1,6 @@
1
1
  import { Form, FormInstance } from 'antd';
2
- import { ForwardRefRenderFunction } from 'react';
2
+ import React, { ForwardRefRenderFunction } from 'react';
3
+ import { FormProviderProps } from 'antd/es/form/context';
3
4
  import { ProFormProps } from './propsType';
4
5
  interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
5
6
  useForm: typeof Form.useForm;
@@ -7,4 +8,5 @@ interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, Pr
7
8
  [key: string]: any;
8
9
  }
9
10
  declare const ProFormForward: IProForm;
11
+ export declare const ProFormProvider: React.FC<FormProviderProps>;
10
12
  export default ProFormForward;
@@ -5,8 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
9
- var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
8
+ exports.default = exports.ProFormProvider = void 0;
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
@@ -283,30 +282,32 @@ ProFormForward.useWatch = function (watchValue, form) {
283
282
  }
284
283
  return _antd.Form.useWatch([], form);
285
284
  };
286
- var ProFormProvider = function ProFormProvider(props) {
285
+ var ProFormProvider = exports.ProFormProvider = function ProFormProvider(props) {
287
286
  var onFormChange = props.onFormChange,
288
287
  onFormFinish = props.onFormFinish,
289
288
  children = props.children;
290
- var handleFormChange = function handleFormChange(name, info) {
289
+ var handleFormChange = function handleFormChange(formName, info) {
291
290
  var changedFields = info.changedFields;
292
291
  var _changedFields = changedFields.flatMap(function (item) {
293
- var name = item.name,
294
- _item$value = item.value,
292
+ var _item$value = item.value,
295
293
  value = _item$value === void 0 ? [] : _item$value;
296
- var _name = (0, _toArray2.default)(name),
297
- firstName = _name[0],
298
- names = _name.slice(1);
299
- var _namePath = [].concat((0, _toConsumableArray2.default)((0, _index.splitNameStr)(String(firstName))), (0, _toConsumableArray2.default)(names));
300
- return _namePath.map(function (name, index) {
294
+ var name = item.name;
295
+ var namesStr = name[name.length - 1];
296
+ // name中的最后一位如果包含 '-' 则是names组件
297
+ var isNames = String(namesStr).includes('-');
298
+ if (!isNames) return item; // 不是names组件直接返回
299
+ var namesList = (0, _index.splitNameStr)(String(namesStr)); // 拆解出name列表
300
+ var prefix = name.slice(0, name.length - 1);
301
+ return namesList.map(function (nameItem, index) {
301
302
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
302
- name: name,
303
+ name: [].concat((0, _toConsumableArray2.default)(prefix), (0, _toConsumableArray2.default)(nameItem)),
303
304
  value: value[index]
304
305
  });
305
306
  });
306
307
  });
307
308
  info.changedFields = _changedFields;
308
309
  // @ts-ignore
309
- onFormChange(name, info);
310
+ onFormChange(formName, info);
310
311
  };
311
312
  return (0, _jsxRuntime.jsx)(_antd.Form.Provider, {
312
313
  onFormChange: onFormChange ? handleFormChange : undefined,
@@ -27,7 +27,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
27
27
  export declare const isUpperCase: (type: string, upperCase: boolean) => any;
28
28
  export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
29
29
  export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
30
- export declare const splitNameStr: (name: string) => NamePath[];
30
+ export declare const splitNameStr: (name: string) => string[][];
31
31
  export declare const filterInternalFields: (values: any) => any;
32
32
  export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
33
33
  export declare const isNullValue: (value: any) => boolean;
@@ -121,12 +121,16 @@ var ProCollapse = function ProCollapse(props) {
121
121
  return;
122
122
  }
123
123
  var proCollapseNoTitles = proCollapseContent.querySelectorAll('.pro-collapse-no-level1-title');
124
+ var proFooterNode = proCollapseContent.querySelector('.pro-footer');
124
125
  var proCollapses = proCollapseContent.querySelectorAll('.pro-collapse');
125
- if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
126
+ if ((proCollapseNoTitles === null || proCollapseNoTitles === void 0 ? void 0 : proCollapseNoTitles.length) === 1 && proCollapses.length === 1) {
126
127
  var rect = proCollapseNoTitles[0].getBoundingClientRect();
127
128
  if ((rect === null || rect === void 0 ? void 0 : rect.height) < window.innerHeight - rect.top) {
128
129
  proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + 16, "px)");
129
130
  }
131
+ if (proFooterNode) {
132
+ proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + proFooterNode.offsetHeight + 16, "px)");
133
+ }
130
134
  }
131
135
  return function () {
132
136
  if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
@@ -15,6 +15,21 @@
15
15
  background: transparent;
16
16
  }
17
17
  }
18
+ .@{ant-prefix}-drawer-body{
19
+
20
+ .@{ant-prefix}-form-item{
21
+ .@{ant-prefix}-form-item-label{
22
+ &.@{ant-prefix}-form-item-label-left{
23
+ & > .@{ant-prefix}-form-item-required::before{
24
+ position: absolute;
25
+ top: calc(50% - 7px);
26
+ left: -8px;
27
+ margin: 0;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
18
33
 
19
34
  .@{ant-prefix}-form-item {
20
35
  &.@{ant-prefix}-form-item-with-help {
@@ -28,7 +43,6 @@
28
43
  overflow: initial;
29
44
  line-height: 1;
30
45
  white-space: pre-wrap;
31
-
32
46
  .@{ant-prefix}-form-item-required {
33
47
  position: relative;
34
48
  &::before {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.8-beta.4",
3
+ "version": "3.4.8-beta.6",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",