@trionesdev/antd-mobile-base-react 0.0.2-beta.25 → 0.0.2-beta.28

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.
@@ -36,7 +36,8 @@ export var Avatar = function Avatar(_ref) {
36
36
  style: _objectSpread({
37
37
  width: avatarSize,
38
38
  height: avatarSize,
39
- backgroundColor: src ? undefined : '#ccc'
39
+ backgroundColor: src ? undefined : '#ccc',
40
+ color: src ? undefined : '#fff'
40
41
  }, style),
41
42
  onClick: onClick
42
43
  }, src ? typeof src === 'string' ? /*#__PURE__*/React.createElement("img", {
@@ -8,8 +8,6 @@ import classNames from 'classnames';
8
8
  import React from 'react';
9
9
  import { cls } from "./types";
10
10
  import { CellGroupContext } from "./context";
11
- import Cell from '.';
12
- import { Cell as InternalCell } from "./cell";
13
11
  export var CellGroup = function CellGroup(_ref) {
14
12
  var className = _ref.className,
15
13
  style = _ref.style,
@@ -27,7 +25,7 @@ export var CellGroup = function CellGroup(_ref) {
27
25
  if (children) {
28
26
  if (Array.isArray(children)) {
29
27
  var validChildren = React.Children.toArray(children).filter(function (child) {
30
- return /*#__PURE__*/React.isValidElement(child) && (child.type == Cell || child.type == InternalCell);
28
+ return /*#__PURE__*/React.isValidElement(child);
31
29
  });
32
30
  var childrenArray = [];
33
31
  validChildren.forEach(function (child, index) {
@@ -1,7 +1,7 @@
1
1
  import { useWatch } from 'rc-field-form';
2
2
  import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
3
3
  import type { FormRef } from 'rc-field-form/lib/interface';
4
- import React from 'react';
4
+ import React, { ReactNode } from 'react';
5
5
  import { FormInstance } from './interface';
6
6
  import { FormHorizontalAlign, FormLayout, RequiredMark } from "./types";
7
7
  import "./styles.scss";
@@ -51,6 +51,7 @@ export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form
51
51
  * @default
52
52
  */
53
53
  extra?: React.ReactNode;
54
+ divider?: ReactNode;
54
55
  }
55
56
  declare const InternalForm: React.ForwardRefExoticComponent<FormProps<any> & React.RefAttributes<FormRef>>;
56
57
  export { useWatch };
package/dist/Form/form.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "colon", "layout", "labelAlign", "labelWidth", "contentAlign", "requiredMark", "hiddenError", "extra"];
1
+ var _excluded = ["children", "colon", "layout", "labelAlign", "labelWidth", "contentAlign", "requiredMark", "hiddenError", "extra", "divider"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -18,6 +18,7 @@ var InternalForm = /*#__PURE__*/React.forwardRef(function Form(_ref, ref) {
18
18
  _ref$hiddenError = _ref.hiddenError,
19
19
  hiddenError = _ref$hiddenError === void 0 ? false : _ref$hiddenError,
20
20
  extra = _ref.extra,
21
+ divider = _ref.divider,
21
22
  rest = _objectWithoutProperties(_ref, _excluded);
22
23
  var contextValue = React.useMemo(function () {
23
24
  return {
@@ -31,12 +32,44 @@ var InternalForm = /*#__PURE__*/React.forwardRef(function Form(_ref, ref) {
31
32
  extra: extra
32
33
  };
33
34
  }, [colon, layout, labelAlign, labelWidth, contentAlign, requiredMark, hiddenError, extra]);
35
+ var handleRender = function handleRender() {
36
+ if (children) {
37
+ if (Array.isArray(children)) {
38
+ var validChildren = React.Children.toArray(children).filter(function (child) {
39
+ return /*#__PURE__*/React.isValidElement(child);
40
+ });
41
+ var childrenArray = [];
42
+ validChildren.forEach(function (child, index) {
43
+ var _child$key;
44
+ childrenArray.push( /*#__PURE__*/React.cloneElement(child, {
45
+ key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : "form-item-".concat(index)
46
+ }));
47
+ if (divider && index < validChildren.length - 1) {
48
+ if ( /*#__PURE__*/React.isValidElement(divider)) {
49
+ var _divider$key;
50
+ childrenArray.push( /*#__PURE__*/React.cloneElement(divider, {
51
+ key: (_divider$key = divider.key) !== null && _divider$key !== void 0 ? _divider$key : "divider-".concat(index)
52
+ }));
53
+ } else {
54
+ childrenArray.push( /*#__PURE__*/React.createElement(React.Fragment, {
55
+ key: "divider-".concat(index)
56
+ }, divider));
57
+ }
58
+ }
59
+ });
60
+ return childrenArray;
61
+ } else {
62
+ return children;
63
+ }
64
+ }
65
+ return null;
66
+ };
34
67
  return /*#__PURE__*/React.createElement(FormContext.Provider, {
35
68
  value: contextValue
36
69
  }, /*#__PURE__*/React.createElement(FieldForm, _extends({}, rest, {
37
70
  ref: ref,
38
71
  component: false
39
- }), children));
72
+ }), handleRender()));
40
73
  });
41
74
  InternalForm.displayName = 'Form';
42
75
  export { useWatch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trionesdev/antd-mobile-base-react",
3
- "version": "0.0.2-beta.25",
3
+ "version": "0.0.2-beta.28",
4
4
  "description": "antd mobile base react",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,6 +30,7 @@
30
30
  "react": ">=16.9.0"
31
31
  },
32
32
  "devDependencies": {
33
+ "@trionesdev/antd-mobile-icons-react": "0.0.2-beta.28",
33
34
  "@types/crypto-js": "^4.2.2",
34
35
  "@types/lodash-es": "^4.17.12",
35
36
  "@types/node": "^18.19.123",
@@ -40,12 +41,11 @@
40
41
  "stylelint": "^16.12.0"
41
42
  },
42
43
  "dependencies": {
43
- "@trionesdev/antd-mobile-icons-react": "0.0.2-beta.25",
44
44
  "crypto-js": "^4.2.0",
45
45
  "rc-field-form": "^2.7.0",
46
46
  "rc-util": "^5.44.3",
47
47
  "react": "^18.0.0",
48
48
  "runes2": "^1.1.4"
49
49
  },
50
- "gitHead": "21c0b5deaf9878fe78a4dfe4b2427ca78ecc1a6d"
50
+ "gitHead": "f91f9c94e8f56bab1a3ce61712cc8787e0125a9f"
51
51
  }