shineout 3.8.0-beta.20 → 3.8.0-beta.21

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.
@@ -24,7 +24,7 @@ var jssStyle = {
24
24
  popover: _shineoutStyle.usePopoverStyle,
25
25
  link: _shineoutStyle.useLinkStyle
26
26
  };
27
- var BaseDatePicker = function BaseDatePicker(props) {
27
+ var DatePicker = function DatePicker(props) {
28
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.DatePicker, _objectSpread({
29
29
  jssStyle: jssStyle
30
30
  }, props));
@@ -55,5 +55,5 @@ var _default = exports.default = function _default(props) {
55
55
  }, []);
56
56
  return (0, _useFieldCommon.default)(_objectSpread(_objectSpread({}, props), {}, {
57
57
  defaultValue: defaultValue
58
- }), BaseDatePicker);
58
+ }), DatePicker);
59
59
  };
package/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.8.0-beta.20'
525
+ version: '3.8.0-beta.21'
526
526
  };
package/cjs/rate/rate.js CHANGED
@@ -18,17 +18,17 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  var jssStyle = {
19
19
  rate: _shineoutStyle.useRateStyle
20
20
  };
21
- var BaseRate = function BaseRate(props) {
21
+ var Rate = function Rate(props) {
22
22
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.Rate, _objectSpread({
23
23
  jssStyle: jssStyle
24
24
  }, props));
25
25
  };
26
- var Rate = function Rate(props) {
27
- return (0, _useFieldCommon.default)(props, BaseRate, 'number');
26
+ var WrappedRate = function WrappedRate(props) {
27
+ return (0, _useFieldCommon.default)(props, Rate, 'number');
28
28
  };
29
29
  var _default = exports.default = function _default(background, front, opts) {
30
30
  var RateIns = function RateIns(props) {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Rate, _objectSpread(_objectSpread({}, opts), {}, {
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedRate, _objectSpread(_objectSpread({}, opts), {}, {
32
32
  background: background,
33
33
  front: front || background
34
34
  }, props));
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { SelectPropsA, SelectPropsB } from './select.type';
3
- declare function Select<DataItem, Value>(props: SelectPropsA<DataItem, Value>): JSX.Element;
4
- declare function Select<DataItem, Value>(props: SelectPropsB<DataItem, Value>): JSX.Element;
5
- export default Select;
3
+ declare function SelectComponent<DataItem, Value>(props: SelectPropsA<DataItem, Value>): JSX.Element;
4
+ declare function SelectComponent<DataItem, Value>(props: SelectPropsB<DataItem, Value>): JSX.Element;
5
+ export default SelectComponent;
@@ -27,12 +27,12 @@ var jssStyle = {
27
27
  spin: _shineoutStyle.useSpinStyle,
28
28
  common: _shineoutStyle.useCommonStyle
29
29
  };
30
- function SelectComponent(props) {
30
+ function Select(props) {
31
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.Select, _objectSpread({
32
32
  jssStyle: jssStyle
33
33
  }, props));
34
34
  }
35
- function Select(props) {
36
- return (0, _useFieldCommon.default)(props, SelectComponent, 'array');
35
+ function SelectComponent(props) {
36
+ return (0, _useFieldCommon.default)(props, Select, 'array');
37
37
  }
38
- var _default = exports.default = Select;
38
+ var _default = exports.default = SelectComponent;
package/dist/shineout.js CHANGED
@@ -12234,7 +12234,7 @@ var handleStyle = function handleStyle(style) {
12234
12234
  };
12235
12235
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12236
12236
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12237
- /* harmony default export */ var version = ('3.8.0-beta.20');
12237
+ /* harmony default export */ var version = ('3.8.0-beta.21');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -30846,6 +30846,10 @@ var getFieldId = function getFieldId(name, formName) {
30846
30846
  if (!name) return undefined;
30847
30847
  return "".concat(formName ? "".concat(formName, "_") : '').concat(name);
30848
30848
  };
30849
+ var getOriginField = function getOriginField(name, formName) {
30850
+ if (!name || !formName) return '';
30851
+ return name.replace("".concat(formName, "_"), '');
30852
+ };
30849
30853
  ;// CONCATENATED MODULE: ../hooks/src/utils/attribute.ts
30850
30854
  var getDataAttribute = function getDataAttribute(attrs) {
30851
30855
  return Object.keys(attrs).reduce(function (acc, key) {
@@ -42892,6 +42896,7 @@ var useFormBind = function useFormBind() {
42892
42896
  var FormItemContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
42893
42897
  updateError: function updateError() {}
42894
42898
  });
42899
+ FormItemContext.displayName = 'FormItemContext';
42895
42900
  ;// CONCATENATED MODULE: ../hooks/src/components/use-form/use-form-fieldset/fieldset-context.ts
42896
42901
  'use client';
42897
42902
 
@@ -43549,6 +43554,15 @@ function useFormControl(props) {
43549
43554
  name: name
43550
43555
  };
43551
43556
  }
43557
+ ;// CONCATENATED MODULE: ../hooks/src/components/use-form/form-schema-context.ts
43558
+ "use client";
43559
+
43560
+
43561
+ var FormSchemaContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
43562
+ var useFormSchema = function useFormSchema() {
43563
+ return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormSchemaContext);
43564
+ };
43565
+ FormSchemaContext.displayName = 'FormSchemaContext';
43552
43566
  ;// CONCATENATED MODULE: ../base/src/form/form-field.tsx
43553
43567
 
43554
43568
 
@@ -43626,9 +43640,31 @@ var FormField = function FormField(props) {
43626
43640
  } else {
43627
43641
  finalChildren = children;
43628
43642
  }
43643
+ var formSchema = useFormSchema();
43644
+ var _useContext3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemContext),
43645
+ label = _useContext3.label;
43646
+ var finalFieldId = formFieldId || fieldId || fieldsetPathId;
43647
+
43648
+ // 只有当 formConfig.formName 存在时才运行 schema 逻辑
43649
+ if (formConfig.formName && formSchema && finalFieldId) {
43650
+ var schemaFields = finalFieldId.split(separator) || [];
43651
+ var schemaMeta = formSchema.buildSchemaFromComponent({
43652
+ componentElement: finalChildren,
43653
+ rules: props.rules,
43654
+ label: label,
43655
+ finalFieldId: finalFieldId,
43656
+ separator: separator
43657
+ });
43658
+ schemaFields.forEach(function (field) {
43659
+ formSchema.updateSchema({
43660
+ path: getOriginField(field, formConfig.formName),
43661
+ meta: schemaMeta
43662
+ });
43663
+ });
43664
+ }
43629
43665
  return /*#__PURE__*/(0,jsx_runtime.jsx)(FormFieldContext.Provider, {
43630
43666
  value: {
43631
- fieldId: formFieldId || fieldId || fieldsetPathId,
43667
+ fieldId: finalFieldId,
43632
43668
  separator: separator
43633
43669
  },
43634
43670
  children: finalChildren
@@ -48409,7 +48445,7 @@ var date_picker_jssStyle = {
48409
48445
  popover: usePopoverStyle,
48410
48446
  link: useLinkStyle
48411
48447
  };
48412
- var BaseDatePicker = function BaseDatePicker(props) {
48448
+ var date_picker_DatePicker = function DatePicker(props) {
48413
48449
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_date_picker_date_picker, objectSpread2_default()({
48414
48450
  jssStyle: date_picker_jssStyle
48415
48451
  }, props));
@@ -48440,7 +48476,7 @@ var BaseDatePicker = function BaseDatePicker(props) {
48440
48476
  }, []);
48441
48477
  return use_field_common(objectSpread2_default()(objectSpread2_default()({}, props), {}, {
48442
48478
  defaultValue: defaultValue
48443
- }), BaseDatePicker);
48479
+ }), date_picker_DatePicker);
48444
48480
  });
48445
48481
  ;// CONCATENATED MODULE: ./src/date-picker/index.ts
48446
48482
 
@@ -49996,7 +50032,10 @@ var Textarea = function Textarea(props) {
49996
50032
  });
49997
50033
  }
49998
50034
  }, [focused]);
49999
- var textareaEl = /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", objectSpread2_default()({}, textareaProps));
50035
+ var textareaElProps = removeProps(textareaProps, {
50036
+ formName: undefined
50037
+ });
50038
+ var textareaEl = /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", objectSpread2_default()({}, textareaElProps));
50000
50039
  if (typeof renderTextarea === 'function') {
50001
50040
  textareaEl = renderTextarea(textareaEl);
50002
50041
  }
@@ -50738,6 +50777,7 @@ EmptyComp.displayName = 'ShineoutEmpty';
50738
50777
 
50739
50778
 
50740
50779
 
50780
+
50741
50781
  var topPath = {
50742
50782
  path: '',
50743
50783
  validateFieldSet: function validateFieldSet() {}
@@ -50746,7 +50786,8 @@ var Provider = function Provider(props) {
50746
50786
  var children = props.children,
50747
50787
  formConfig = props.formConfig,
50748
50788
  formValue = props.formValue,
50749
- formFunc = props.formFunc;
50789
+ formFunc = props.formFunc,
50790
+ formSchema = props.formSchema;
50750
50791
  return /*#__PURE__*/(0,jsx_runtime.jsx)(FormFuncContext.Provider, {
50751
50792
  value: formFunc,
50752
50793
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormBindContext.Provider, {
@@ -50755,7 +50796,10 @@ var Provider = function Provider(props) {
50755
50796
  value: topPath,
50756
50797
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormConfigContext.Provider, {
50757
50798
  value: formConfig,
50758
- children: children
50799
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormSchemaContext.Provider, {
50800
+ value: formSchema,
50801
+ children: children
50802
+ })
50759
50803
  })
50760
50804
  })
50761
50805
  })
@@ -50854,6 +50898,303 @@ function use_previous_usePrevious(value) {
50854
50898
  });
50855
50899
  return ref.current;
50856
50900
  }
50901
+ ;// CONCATENATED MODULE: ../hooks/src/components/use-form/use-form-schema/form-schema-builder.ts
50902
+
50903
+
50904
+
50905
+
50906
+
50907
+
50908
+ var form_schema_builder_excluded = ["required"];
50909
+ var SchemaBuilder = /*#__PURE__*/function () {
50910
+ function SchemaBuilder(formName) {
50911
+ classCallCheck_default()(this, SchemaBuilder);
50912
+ defineProperty_default()(this, "schema", void 0);
50913
+ this.schema = {
50914
+ type: 'object',
50915
+ title: formName,
50916
+ properties: {}
50917
+ };
50918
+ }
50919
+ createClass_default()(SchemaBuilder, [{
50920
+ key: "updateSchema",
50921
+ value: function updateSchema(_ref) {
50922
+ var path = _ref.path,
50923
+ meta = _ref.meta;
50924
+ var pathSegments = this.parsePath(path);
50925
+ if (!pathSegments) return;
50926
+ this.mergeSchema(this.schema, pathSegments, meta);
50927
+ }
50928
+
50929
+ /**
50930
+ * 根据组件信息构建 schema meta
50931
+ */
50932
+ }, {
50933
+ key: "buildSchemaFromComponent",
50934
+ value: function buildSchemaFromComponent(params) {
50935
+ var _componentElement$pro;
50936
+ var componentElement = params.componentElement,
50937
+ rules = params.rules,
50938
+ label = params.label,
50939
+ finalFieldId = params.finalFieldId,
50940
+ separator = params.separator;
50941
+ var fieldSchemaInfo = {
50942
+ title: label
50943
+ };
50944
+ var data = componentElement.props.data;
50945
+ var isRequired = rules === null || rules === void 0 ? void 0 : rules.some(function (rule) {
50946
+ return rule.required;
50947
+ });
50948
+ fieldSchemaInfo.required = isRequired;
50949
+ fieldSchemaInfo.description = '';
50950
+ if (rules !== null && rules !== void 0 && rules.length) {
50951
+ var messageRules = rules.filter(function (rule) {
50952
+ return typeof rule.message === 'string';
50953
+ });
50954
+ if (messageRules.length) {
50955
+ fieldSchemaInfo.description += "rules: ".concat(messageRules.map(function (rule) {
50956
+ return rule.message;
50957
+ }).join(', '), ";");
50958
+ }
50959
+ }
50960
+ var itemType;
50961
+ if (typeof componentElement.type === 'function') {
50962
+ switch (componentElement.type.name) {
50963
+ case 'Input':
50964
+ fieldSchemaInfo.type = 'string';
50965
+ break;
50966
+ case 'InputNumber':
50967
+ fieldSchemaInfo.type = 'number';
50968
+ break;
50969
+ case 'InputPassword':
50970
+ fieldSchemaInfo.type = 'string';
50971
+ break;
50972
+ case 'Textarea':
50973
+ fieldSchemaInfo.type = 'string';
50974
+ break;
50975
+ case 'Select':
50976
+ case 'TreeSelect':
50977
+ {
50978
+ var format = componentElement.props.format || componentElement.props.keygen;
50979
+ if (typeof componentElement.props.keygen !== 'boolean') {
50980
+ if (typeof format === 'string') {
50981
+ var _data$;
50982
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? typeof_default()(data === null || data === void 0 || (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$[format]) : typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
50983
+ } else if (typeof format === 'function') {
50984
+ itemType = typeof_default()(format(data === null || data === void 0 ? void 0 : data[0]));
50985
+ } else {
50986
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
50987
+ }
50988
+ } else {
50989
+ itemType = typeof_default()(data === null || data === void 0 ? void 0 : data[0]);
50990
+ }
50991
+ if (componentElement.props.multiple) {
50992
+ fieldSchemaInfo.type = 'array';
50993
+ fieldSchemaInfo.items = {
50994
+ type: itemType
50995
+ };
50996
+ } else {
50997
+ fieldSchemaInfo.type = itemType;
50998
+ }
50999
+ // props.data格式: [
51000
+ // { "value": 1, "title": "年假" },
51001
+ // { "value": 2, "title": "调休" },
51002
+ // { "value": 3, "title": "事假" },
51003
+ // { "value": 4, "title": "病假" },
51004
+ // { "value": 5, "title": "其他" }
51005
+ // ]
51006
+ // 转换为jsonschema中的enum格式:
51007
+ // "enum": {
51008
+ // "anyOf": [
51009
+ // { "const": 1, "title": "年假" },
51010
+ // { "const": 2, "title": "调休" },
51011
+ // { "const": 3, "title": "事假" },
51012
+ // { "const": 4, "title": "病假" },
51013
+ // { "const": 5, "title": "其他" }
51014
+ // ]
51015
+ // }
51016
+ fieldSchemaInfo.enum = {
51017
+ anyOf: componentElement.props.data.map(function (item) {
51018
+ return {
51019
+ const: (item === null || item === void 0 ? void 0 : item[format]) || item,
51020
+ title: (item === null || item === void 0 ? void 0 : item.title) || item
51021
+ };
51022
+ })
51023
+ };
51024
+ break;
51025
+ }
51026
+ case 'DatePicker':
51027
+ if (componentElement.props.range) {
51028
+ if (finalFieldId !== null && finalFieldId !== void 0 && finalFieldId.includes(separator || '')) {
51029
+ fieldSchemaInfo.type = 'string';
51030
+ fieldSchemaInfo.format = 'date';
51031
+ } else {
51032
+ fieldSchemaInfo.type = 'array';
51033
+ fieldSchemaInfo.items = {
51034
+ type: 'string',
51035
+ format: 'date'
51036
+ };
51037
+ }
51038
+ } else {
51039
+ fieldSchemaInfo.type = 'string';
51040
+ fieldSchemaInfo.format = 'date';
51041
+ }
51042
+ fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '', "; \u683C\u5F0F\uFF1A").concat(componentElement.props.format || '', " ");
51043
+ break;
51044
+ case 'Checkbox':
51045
+ fieldSchemaInfo.type = 'array';
51046
+ fieldSchemaInfo.items = {
51047
+ type: 'string'
51048
+ };
51049
+ break;
51050
+ case 'Radio':
51051
+ fieldSchemaInfo.type = 'string';
51052
+ break;
51053
+ case 'Rate':
51054
+ fieldSchemaInfo.type = 'number';
51055
+ break;
51056
+ default:
51057
+ if (Array.isArray(componentElement.props.value) && componentElement.props.value.length === 0) {
51058
+ fieldSchemaInfo.type = 'array';
51059
+ fieldSchemaInfo.items = {
51060
+ type: 'string'
51061
+ };
51062
+ } else {
51063
+ fieldSchemaInfo.type = typeof_default()(componentElement.props.value);
51064
+ }
51065
+ break;
51066
+ }
51067
+ }
51068
+ return fieldSchemaInfo;
51069
+ }
51070
+
51071
+ // 解析路径字符串,如 'a[0].b1' -> ['a', '[0]', 'b1']
51072
+ }, {
51073
+ key: "parsePath",
51074
+ value: function parsePath(path) {
51075
+ if (!path) return null;
51076
+ var segments = [];
51077
+ var current = '';
51078
+ var inBracket = false;
51079
+ for (var i = 0; i < path.length; i++) {
51080
+ var char = path[i];
51081
+ if (char === '[') {
51082
+ if (current) {
51083
+ segments.push(current);
51084
+ current = '';
51085
+ }
51086
+ current = '[';
51087
+ inBracket = true;
51088
+ } else if (char === ']') {
51089
+ current += ']';
51090
+ segments.push(current);
51091
+ current = '';
51092
+ inBracket = false;
51093
+ } else if (char === '.' && !inBracket) {
51094
+ if (current) {
51095
+ segments.push(current);
51096
+ current = '';
51097
+ }
51098
+ } else {
51099
+ current += char;
51100
+ }
51101
+ }
51102
+ if (current) {
51103
+ segments.push(current);
51104
+ }
51105
+ return segments;
51106
+ }
51107
+
51108
+ // 递归合并 schema
51109
+ }, {
51110
+ key: "mergeSchema",
51111
+ value: function mergeSchema(currentSchema, pathSegments, meta) {
51112
+ if (pathSegments.length === 0) {
51113
+ // 到达叶子节点,应用元数据
51114
+ Object.assign(currentSchema, meta);
51115
+ return;
51116
+ }
51117
+ var _pathSegments = toArray_default()(pathSegments),
51118
+ currentSegment = _pathSegments[0],
51119
+ remainingSegments = _pathSegments.slice(1);
51120
+ if (currentSegment.startsWith('[') && currentSegment.endsWith(']')) {
51121
+ // 处理数组索引,如 [0]
51122
+ this.handleArraySegment(currentSchema, remainingSegments, meta);
51123
+ } else {
51124
+ // 处理对象属性
51125
+ this.handleObjectProperty(currentSchema, currentSegment, remainingSegments, meta);
51126
+ }
51127
+ }
51128
+ }, {
51129
+ key: "handleArraySegment",
51130
+ value: function handleArraySegment(currentSchema, remainingSegments, meta) {
51131
+ // 当前节点应该是数组类型
51132
+ if (!currentSchema.items) {
51133
+ currentSchema.type = 'array';
51134
+ currentSchema.items = {
51135
+ type: 'object',
51136
+ properties: {}
51137
+ };
51138
+ }
51139
+ this.mergeSchema(currentSchema.items, remainingSegments, meta);
51140
+ }
51141
+ }, {
51142
+ key: "handleObjectProperty",
51143
+ value: function handleObjectProperty(currentSchema, propertyName, remainingSegments, meta) {
51144
+ // 确保当前节点有 properties
51145
+ if (!currentSchema.properties) {
51146
+ currentSchema.properties = {};
51147
+ }
51148
+
51149
+ // 如果属性不存在,创建它
51150
+ if (!currentSchema.properties[propertyName]) {
51151
+ currentSchema.properties[propertyName] = remainingSegments.length > 0 ? {
51152
+ type: 'object'
51153
+ } : {};
51154
+ }
51155
+ if (remainingSegments.length === 0) {
51156
+ // 叶子节点,应用元数据并处理 required
51157
+ var required = meta.required,
51158
+ restMeta = objectWithoutProperties_default()(meta, form_schema_builder_excluded);
51159
+ Object.assign(currentSchema.properties[propertyName], restMeta);
51160
+ if (typeof required === 'boolean') {
51161
+ this.handleRequired(currentSchema, propertyName, required);
51162
+ }
51163
+ } else {
51164
+ // 继续递归
51165
+ this.mergeSchema(currentSchema.properties[propertyName], remainingSegments, meta);
51166
+ }
51167
+ }
51168
+ }, {
51169
+ key: "handleRequired",
51170
+ value: function handleRequired(parentSchema, propertyName, isRequired) {
51171
+ // 如果required是布尔值,转换为数组形式
51172
+ if (typeof parentSchema.required === 'boolean') {
51173
+ return;
51174
+ }
51175
+ if (!parentSchema.required) {
51176
+ parentSchema.required = [];
51177
+ }
51178
+ var requiredIndex = parentSchema.required.indexOf(propertyName);
51179
+ if (isRequired && requiredIndex === -1) {
51180
+ parentSchema.required.push(propertyName);
51181
+ } else if (!isRequired && requiredIndex !== -1) {
51182
+ parentSchema.required.splice(requiredIndex, 1);
51183
+ }
51184
+
51185
+ // 如果 required 数组为空,删除它
51186
+ if (parentSchema.required.length === 0) {
51187
+ delete parentSchema.required;
51188
+ }
51189
+ }
51190
+ }, {
51191
+ key: "getFormSchema",
51192
+ value: function getFormSchema() {
51193
+ return this.schema;
51194
+ }
51195
+ }]);
51196
+ return SchemaBuilder;
51197
+ }();
50857
51198
  ;// CONCATENATED MODULE: ../hooks/src/components/use-form/use-form.ts
50858
51199
 
50859
51200
 
@@ -50866,6 +51207,7 @@ function use_previous_usePrevious(value) {
50866
51207
 
50867
51208
 
50868
51209
 
51210
+
50869
51211
  var globalKey = '__global__&&@@';
50870
51212
  var SUBMIT_TIMEOUT = 10;
50871
51213
 
@@ -50914,7 +51256,8 @@ var useForm = function useForm(props) {
50914
51256
  resetTime: 0,
50915
51257
  mounted: false,
50916
51258
  unmounted: false,
50917
- removeLock: false
51259
+ removeLock: false,
51260
+ schema: props.name ? new SchemaBuilder(props.name) : null
50918
51261
  }),
50919
51262
  context = _React$useRef.current;
50920
51263
  var getValue = use_persist_fn(function (name) {
@@ -51425,7 +51768,11 @@ var useForm = function useForm(props) {
51425
51768
  validateFieldset: validateFieldset,
51426
51769
  insertError: insertError,
51427
51770
  spliceError: spliceError,
51428
- scrollToField: scrollToField
51771
+ scrollToField: scrollToField,
51772
+ getFormSchema: function getFormSchema() {
51773
+ var _context$schema;
51774
+ return (_context$schema = context.schema) === null || _context$schema === void 0 ? void 0 : _context$schema.getFormSchema();
51775
+ }
51429
51776
  });
51430
51777
  var formConfig = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
51431
51778
  return {
@@ -51494,7 +51841,8 @@ var useForm = function useForm(props) {
51494
51841
  ProviderProps: {
51495
51842
  formValue: formValue,
51496
51843
  formConfig: formConfig,
51497
- formFunc: formFunc
51844
+ formFunc: formFunc,
51845
+ formSchema: context.schema
51498
51846
  },
51499
51847
  formFunc: formFunc
51500
51848
  };
@@ -51578,7 +51926,8 @@ var Form = function Form(props) {
51578
51926
  validateFieldsWithValue: validateFieldsWithValue,
51579
51927
  validateFieldsWithError: formFunc.validateFields,
51580
51928
  set: formFunc.setValue,
51581
- scrollToField: formFunc.scrollToField
51929
+ scrollToField: formFunc.scrollToField,
51930
+ getFormSchema: formFunc.getFormSchema
51582
51931
  });
51583
51932
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
51584
51933
  if (formRef) {
@@ -51726,7 +52075,7 @@ var form_item_excluded = ["children", "jssStyle", "className", "style", "label",
51726
52075
 
51727
52076
 
51728
52077
  var FormItem = function FormItem(props) {
51729
- var _jssStyle$formItem;
52078
+ var _jssStyle$formItem, _labelRef$current, _labelTipRef$current;
51730
52079
  var children = props.children,
51731
52080
  jssStyle = props.jssStyle,
51732
52081
  className = props.className,
@@ -51737,7 +52086,7 @@ var FormItem = function FormItem(props) {
51737
52086
  rest = objectWithoutProperties_default()(props, form_item_excluded);
51738
52087
  var formItemClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$formItem = jssStyle.formItem) === null || _jssStyle$formItem === void 0 ? void 0 : _jssStyle$formItem.call(jssStyle);
51739
52088
  var _useFormItem = use_form_item(),
51740
- Provider = _useFormItem.Provider,
52089
+ FormItemContextProvider = _useFormItem.Provider,
51741
52090
  ProviderValue = _useFormItem.ProviderValue,
51742
52091
  labelConfig = _useFormItem.labelConfig,
51743
52092
  errors = _useFormItem.errors,
@@ -51797,11 +52146,19 @@ var FormItem = function FormItem(props) {
51797
52146
  children: label
51798
52147
  });
51799
52148
  };
52149
+ var labelRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
52150
+ var labelTipRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
52151
+ var labelText = (_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : _labelRef$current.textContent;
52152
+ if ((_labelTipRef$current = labelTipRef.current) !== null && _labelTipRef$current !== void 0 && _labelTipRef$current.textContent) {
52153
+ var _labelTipRef$current2;
52154
+ labelText += " (tip: ".concat((_labelTipRef$current2 = labelTipRef.current) === null || _labelTipRef$current2 === void 0 ? void 0 : _labelTipRef$current2.textContent, ")");
52155
+ }
51800
52156
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({
51801
52157
  className: classnames_default()(className, formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapper, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperLabelTop, labelAlign === 'top'), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperLabelVerticalMiddle, labelAlign !== 'top' && labelVerticalAlign === 'middle'), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperLabelVerticalBottom, labelAlign !== 'top' && labelVerticalAlign === 'bottom'), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperInline, inline), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperKeepHeight, keepErrorHeight), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperRequired, required), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperHideRequired, required === false), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.wrapperTip, showError || tip))
51802
52158
  }, attributes), {}, {
51803
52159
  style: style,
51804
52160
  children: [label !== undefined ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
52161
+ ref: labelRef,
51805
52162
  className: classnames_default()(formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.label, defineProperty_default()(defineProperty_default()(defineProperty_default()({}, formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.labelLeft, labelAlign === 'left'), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.labelWithColon, colon), formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.labelWithTooltip, label && typeof_default()(label) === 'object' && 'tooltip' in label)),
51806
52163
  style: labelAlign !== 'top' || inline ? {
51807
52164
  width: labelWidth
@@ -51812,10 +52169,13 @@ var FormItem = function FormItem(props) {
51812
52169
  }, getDataAttribute({
51813
52170
  role: 'form-control'
51814
52171
  })), {}, {
51815
- children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
51816
- value: ProviderValue,
52172
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)(FormItemContextProvider, {
52173
+ value: objectSpread2_default()(objectSpread2_default()({}, ProviderValue), {}, {
52174
+ label: labelText
52175
+ }),
51817
52176
  children: children
51818
52177
  }), !!tip && (!showError || keepErrorBelow) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
52178
+ ref: labelTipRef,
51819
52179
  className: formItemClasses === null || formItemClasses === void 0 ? void 0 : formItemClasses.tip,
51820
52180
  children: tip
51821
52181
  }), showError && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -60343,17 +60703,17 @@ var Rate = function Rate(props0) {
60343
60703
  var rate_jssStyle = {
60344
60704
  rate: useRateStyle
60345
60705
  };
60346
- var BaseRate = function BaseRate(props) {
60706
+ var rate_Rate = function Rate(props) {
60347
60707
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_rate_rate, objectSpread2_default()({
60348
60708
  jssStyle: rate_jssStyle
60349
60709
  }, props));
60350
60710
  };
60351
- var rate_Rate = function Rate(props) {
60352
- return use_field_common(props, BaseRate, 'number');
60711
+ var WrappedRate = function WrappedRate(props) {
60712
+ return use_field_common(props, rate_Rate, 'number');
60353
60713
  };
60354
60714
  /* harmony default export */ var src_rate_rate_0 = (function (background, front, opts) {
60355
60715
  var RateIns = function RateIns(props) {
60356
- return /*#__PURE__*/(0,jsx_runtime.jsx)(rate_Rate, objectSpread2_default()(objectSpread2_default()({}, opts), {}, {
60716
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(WrappedRate, objectSpread2_default()(objectSpread2_default()({}, opts), {}, {
60357
60717
  background: background,
60358
60718
  front: front || background
60359
60719
  }, props));
@@ -60574,15 +60934,15 @@ var select_jssStyle = {
60574
60934
  spin: useSpinStyle,
60575
60935
  common: useCommonStyle
60576
60936
  };
60577
- function SelectComponent(props) {
60937
+ function select_Select(props) {
60578
60938
  return /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_select_select, objectSpread2_default()({
60579
60939
  jssStyle: select_jssStyle
60580
60940
  }, props));
60581
60941
  }
60582
- function select_Select(props) {
60583
- return use_field_common(props, SelectComponent, 'array');
60942
+ function SelectComponent(props) {
60943
+ return use_field_common(props, select_Select, 'array');
60584
60944
  }
60585
- /* harmony default export */ var src_select_select_0 = (select_Select);
60945
+ /* harmony default export */ var src_select_select_0 = (SelectComponent);
60586
60946
  ;// CONCATENATED MODULE: ./src/select/index.ts
60587
60947
 
60588
60948
  var SelectComp = src_select_select_0;
@@ -72246,7 +72606,7 @@ var upload_interface = __webpack_require__(8821);
72246
72606
 
72247
72607
 
72248
72608
  /* harmony default export */ var src_0 = ({
72249
- version: '3.8.0-beta.20'
72609
+ version: '3.8.0-beta.21'
72250
72610
  });
72251
72611
  }();
72252
72612
  /******/ return __webpack_exports__;