tntd 2.7.33 → 2.7.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.
Files changed (119) hide show
  1. package/es/form/form.js +5 -3
  2. package/es/form/form.js.map +1 -1
  3. package/lib/form/form.js +5 -3
  4. package/lib/form/form.js.map +1 -1
  5. package/package.json +103 -104
  6. package/es/tntd-form/_util/context.js +0 -12
  7. package/es/tntd-form/_util/context.js.map +0 -1
  8. package/es/tntd-form/_util/defaultRenderEmpty.js +0 -31
  9. package/es/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  10. package/es/tntd-form/_util/hooks/useFlexGapSupport.js +0 -9
  11. package/es/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  12. package/es/tntd-form/_util/hooks/useForceUpdate.js +0 -5
  13. package/es/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  14. package/es/tntd-form/_util/motion.js +0 -47
  15. package/es/tntd-form/_util/motion.js.map +0 -1
  16. package/es/tntd-form/_util/reactNode.js +0 -16
  17. package/es/tntd-form/_util/reactNode.js.map +0 -1
  18. package/es/tntd-form/_util/responsiveObserve.js +0 -59
  19. package/es/tntd-form/_util/responsiveObserve.js.map +0 -1
  20. package/es/tntd-form/_util/scrollTo.js +0 -35
  21. package/es/tntd-form/_util/scrollTo.js.map +0 -1
  22. package/es/tntd-form/_util/styleChecker.js +0 -26
  23. package/es/tntd-form/_util/styleChecker.js.map +0 -1
  24. package/es/tntd-form/_util/type.js +0 -3
  25. package/es/tntd-form/_util/type.js.map +0 -1
  26. package/es/tntd-form/_util/warning.js +0 -5
  27. package/es/tntd-form/_util/warning.js.map +0 -1
  28. package/es/tntd-form/_util/wave.js +0 -168
  29. package/es/tntd-form/_util/wave.js.map +0 -1
  30. package/es/tntd-form/grid/RowContext.js +0 -3
  31. package/es/tntd-form/grid/RowContext.js.map +0 -1
  32. package/es/tntd-form/grid/col.js +0 -104
  33. package/es/tntd-form/grid/col.js.map +0 -1
  34. package/es/tntd-form/grid/hooks/useBreakpoint.js +0 -18
  35. package/es/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  36. package/es/tntd-form/grid/index.js +0 -14
  37. package/es/tntd-form/grid/index.js.map +0 -1
  38. package/es/tntd-form/grid/row.js +0 -153
  39. package/es/tntd-form/grid/row.js.map +0 -1
  40. package/es/tntd-form/grid/style/index.js +0 -2
  41. package/es/tntd-form/grid/style/index.js.map +0 -1
  42. package/es/tntd-form/tntd-form.stories.js +0 -836
  43. package/es/tntd-form/tntd-form.stories.js.map +0 -1
  44. package/lib/tntd-form/_util/context.d.ts +0 -42
  45. package/lib/tntd-form/_util/context.d.ts.map +0 -1
  46. package/lib/tntd-form/_util/context.js +0 -22
  47. package/lib/tntd-form/_util/context.js.map +0 -1
  48. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts +0 -5
  49. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts.map +0 -1
  50. package/lib/tntd-form/_util/defaultRenderEmpty.js +0 -44
  51. package/lib/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  52. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts +0 -3
  53. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts.map +0 -1
  54. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js +0 -28
  55. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  56. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts +0 -3
  57. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts.map +0 -1
  58. package/lib/tntd-form/_util/hooks/useForceUpdate.js +0 -24
  59. package/lib/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  60. package/lib/tntd-form/_util/motion.d.ts +0 -9
  61. package/lib/tntd-form/_util/motion.d.ts.map +0 -1
  62. package/lib/tntd-form/_util/motion.js +0 -59
  63. package/lib/tntd-form/_util/motion.js.map +0 -1
  64. package/lib/tntd-form/_util/reactNode.d.ts +0 -9
  65. package/lib/tntd-form/_util/reactNode.d.ts.map +0 -1
  66. package/lib/tntd-form/_util/reactNode.js +0 -27
  67. package/lib/tntd-form/_util/reactNode.js.map +0 -1
  68. package/lib/tntd-form/_util/responsiveObserve.d.ts +0 -22
  69. package/lib/tntd-form/_util/responsiveObserve.d.ts.map +0 -1
  70. package/lib/tntd-form/_util/responsiveObserve.js +0 -73
  71. package/lib/tntd-form/_util/responsiveObserve.js.map +0 -1
  72. package/lib/tntd-form/_util/scrollTo.d.ts +0 -1
  73. package/lib/tntd-form/_util/scrollTo.d.ts.map +0 -1
  74. package/lib/tntd-form/_util/scrollTo.js +0 -35
  75. package/lib/tntd-form/_util/scrollTo.js.map +0 -1
  76. package/lib/tntd-form/_util/styleChecker.d.ts +0 -5
  77. package/lib/tntd-form/_util/styleChecker.d.ts.map +0 -1
  78. package/lib/tntd-form/_util/styleChecker.js +0 -42
  79. package/lib/tntd-form/_util/styleChecker.js.map +0 -1
  80. package/lib/tntd-form/_util/type.d.ts +0 -4
  81. package/lib/tntd-form/_util/type.d.ts.map +0 -1
  82. package/lib/tntd-form/_util/type.js +0 -21
  83. package/lib/tntd-form/_util/type.js.map +0 -1
  84. package/lib/tntd-form/_util/warning.d.ts +0 -5
  85. package/lib/tntd-form/_util/warning.d.ts.map +0 -1
  86. package/lib/tntd-form/_util/warning.js +0 -20
  87. package/lib/tntd-form/_util/warning.js.map +0 -1
  88. package/lib/tntd-form/_util/wave.d.ts +0 -1
  89. package/lib/tntd-form/_util/wave.d.ts.map +0 -1
  90. package/lib/tntd-form/_util/wave.js +0 -168
  91. package/lib/tntd-form/_util/wave.js.map +0 -1
  92. package/lib/tntd-form/grid/RowContext.d.ts +0 -9
  93. package/lib/tntd-form/grid/RowContext.d.ts.map +0 -1
  94. package/lib/tntd-form/grid/RowContext.js +0 -10
  95. package/lib/tntd-form/grid/RowContext.js.map +0 -1
  96. package/lib/tntd-form/grid/col.d.ts +0 -29
  97. package/lib/tntd-form/grid/col.d.ts.map +0 -1
  98. package/lib/tntd-form/grid/col.js +0 -105
  99. package/lib/tntd-form/grid/col.js.map +0 -1
  100. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts +0 -4
  101. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts.map +0 -1
  102. package/lib/tntd-form/grid/hooks/useBreakpoint.js +0 -29
  103. package/lib/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  104. package/lib/tntd-form/grid/index.d.ts +0 -12
  105. package/lib/tntd-form/grid/index.d.ts.map +0 -1
  106. package/lib/tntd-form/grid/index.js +0 -31
  107. package/lib/tntd-form/grid/index.js.map +0 -1
  108. package/lib/tntd-form/grid/row.d.ts +0 -21
  109. package/lib/tntd-form/grid/row.d.ts.map +0 -1
  110. package/lib/tntd-form/grid/row.js +0 -186
  111. package/lib/tntd-form/grid/row.js.map +0 -1
  112. package/lib/tntd-form/grid/style/index.d.ts +0 -3
  113. package/lib/tntd-form/grid/style/index.d.ts.map +0 -1
  114. package/lib/tntd-form/grid/style/index.js +0 -4
  115. package/lib/tntd-form/grid/style/index.js.map +0 -1
  116. package/lib/tntd-form/tntd-form.stories.d.ts +0 -33
  117. package/lib/tntd-form/tntd-form.stories.d.ts.map +0 -1
  118. package/lib/tntd-form/tntd-form.stories.js +0 -943
  119. package/lib/tntd-form/tntd-form.stories.js.map +0 -1
package/es/form/form.js CHANGED
@@ -37,7 +37,7 @@ Form.Item = forwardRef((_a, ref) => {
37
37
  });
38
38
  const Create = options => WrappedComponent => {
39
39
  const validateSubmitMap = {};
40
- const CustomFormWrapper = props => {
40
+ const CustomFormWrapper = (props, ref) => {
41
41
  const getFieldDecorator = props.form.getFieldDecorator;
42
42
  props.form.getFieldDecorator = (name, options) => {
43
43
  let opt = options || {};
@@ -49,7 +49,9 @@ const Create = options => WrappedComponent => {
49
49
  }
50
50
  return getFieldDecorator(name, opt);
51
51
  };
52
- return React.createElement(WrappedComponent, Object.assign({}, props));
52
+ return React.createElement(WrappedComponent, Object.assign({}, props, {
53
+ ref: ref
54
+ }));
53
55
  };
54
56
  return AntdForm.create(Object.assign(Object.assign({}, options), {
55
57
  onValuesChange: (props, changedValues, allValues) => {
@@ -69,7 +71,7 @@ const Create = options => WrappedComponent => {
69
71
  options.onValuesChange(props, changedValues, allValues);
70
72
  }
71
73
  }
72
- }))(CustomFormWrapper);
74
+ }))(forwardRef(CustomFormWrapper));
73
75
  };
74
76
  Form.createFormField = AntdForm.createFormField;
75
77
  Form.create = Create;
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,cAAc,cAAc,CAAA;AAW5B,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,oBAAC,cAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,oBAAC,QAAQ,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACzC,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAkC,CAAC,EAAkB,EAAE,GAAG,EAAE,EAAE;QAA3B,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvE,OAAO,CACL,oBAAC,cAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,oBAAC,QAAQ,CAAC,IAAI,oBAAK,IAAI,IAAE,KAAK,EAA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BACH;gBACH,CAAC,CAAC,CAAA;aACH;YACD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;gBACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,iBAAiB,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;AAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/es/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\nimport type AntdFormItem from 'antd/es/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/es/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(CustomFormWrapper)\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,cAAc,cAAc,CAAA;AAW5B,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,oBAAC,cAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,oBAAC,QAAQ,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACzC,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAkC,CAAC,EAAkB,EA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AC,MAAM,KAAK,CAAC,EAAE;gBACrB,IAAI,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,EAAE;oBACzB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE;wBAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;4BACnB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;yBAC9B,CAAC,CAAA;qBACH;gBACH,CAAC,CAAC,CAAA;aACH;YACD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;gBACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;AAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/es/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\nimport type AntdFormItem from 'antd/es/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/es/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any, ref: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} ref={ref} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(forwardRef(CustomFormWrapper))\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
package/lib/form/form.js CHANGED
@@ -62,7 +62,7 @@ Form.Item = (0, _react.forwardRef)(function (_a, ref) {
62
62
  var Create = function Create(options) {
63
63
  return function (WrappedComponent) {
64
64
  var validateSubmitMap = {};
65
- var CustomFormWrapper = function CustomFormWrapper(props) {
65
+ var CustomFormWrapper = function CustomFormWrapper(props, ref) {
66
66
  var getFieldDecorator = props.form.getFieldDecorator;
67
67
  props.form.getFieldDecorator = function (name, options) {
68
68
  var opt = options || {};
@@ -74,7 +74,9 @@ var Create = function Create(options) {
74
74
  }
75
75
  return getFieldDecorator(name, opt);
76
76
  };
77
- return _react["default"].createElement(WrappedComponent, Object.assign({}, props));
77
+ return _react["default"].createElement(WrappedComponent, Object.assign({}, props, {
78
+ ref: ref
79
+ }));
78
80
  };
79
81
  return _form["default"].create(Object.assign(Object.assign({}, options), {
80
82
  onValuesChange: function onValuesChange(props, changedValues, allValues) {
@@ -92,7 +94,7 @@ var Create = function Create(options) {
92
94
  options.onValuesChange(props, changedValues, allValues);
93
95
  }
94
96
  }
95
- }))(CustomFormWrapper);
97
+ }))((0, _react.forwardRef)(CustomFormWrapper));
96
98
  };
97
99
  };
98
100
  Form.createFormField = _form["default"].createFormField;
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,+CAAyC;AAEzC,6DAAwD;AAExD,wDAAkD;AAGlD,oCAAuC;AAEvC,+CAA4B;AAWf,QAAA,IAAI,GAAG,IAAA,kBAAU,EAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACzC,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,YAAI,CAAC,IAAI,GAAG,IAAA,kBAAU,EAAkC,CAAC,EAAkB,EAAE,GAAG,EAAE,EAAE;QAA3B,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,CAAC,IAAI,oBAAK,IAAI,IAAE,KAAK,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC1E,CAAC,CACc,CA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ACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,iBAAiB,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,YAAI,CAAC,eAAe,GAAG,cAAQ,CAAC,eAAe,CAAA;AAC/C,YAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/lib/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/lib/config-provider'\n\nimport { default as AntdForm } from 'antd/lib/form'\nimport type AntdFormItem from 'antd/lib/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/lib/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(CustomFormWrapper)\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,+CAAyC;AAEzC,6DAAwD;AAExD,wDAAkD;AAGlD,oCAAuC;AAEvC,+CAA4B;AAWf,QAAA,IAAI,GAAG,IAAA,kBAAU,EAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,oBAAK,IAAI,IAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACzC,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,YAAI,CAAC,IAAI,GAAG,IAAA,kBAAU,EAAkC,CAAC,EAAkB,EAAE,GAAG,EAAE,EAAE;QAA3B,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,CAAC,IAAI,oBAAK,IAAI,IAA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AAE,EAAE,MAAM,EAAE,SAAS,EAAE;yBAC9B,CAAC,CAAA;qBACH;gBACH,CAAC,CAAC,CAAA;aACH;YACD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;gBACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,IAAA,kBAAU,EAAC,iBAAiB,CAAC,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,YAAI,CAAC,eAAe,GAAG,cAAQ,CAAC,eAAe,CAAA;AAC/C,YAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/lib/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/lib/config-provider'\n\nimport { default as AntdForm } from 'antd/lib/form'\nimport type AntdFormItem from 'antd/lib/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/lib/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any, ref: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} ref={ref} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(forwardRef(CustomFormWrapper))\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
package/package.json CHANGED
@@ -1,107 +1,106 @@
1
1
  {
2
- "name": "tntd",
3
- "version": "2.7.33",
4
- "license": "MIT",
5
- "dependencies": {
6
- "@icon-park/react": "^1.3.5",
7
- "@stellaris/hooks": "~0.4.6",
8
- "classnames": "~2.3.1",
9
- "@tntx/logo-icon": "~1.0.4",
10
- "delete-all-cookies": "~0.3.0",
11
- "styled-components": "^5.3.0",
12
- "rc-util": "^5.25.2",
13
- "rc-motion": "^2.6.1",
14
- "array-tree-filter": "^2.1.0",
15
- "rc-select": "~14.2.0",
16
- "rc-tree": "~5.7.0",
17
- "rc-overflow": "^1.0.0",
18
- "rc-trigger": "^5.0.4",
19
- "rc-virtual-list": "^3.4.13",
20
- "rc-align": "^4.0.0",
21
- "react-color": "^2.17.2",
22
- "lodash": "~4.17.21",
23
- "color-alpha": "~1.1.3",
24
- "rc-segmented": "~2.2.2",
25
- "rc-field-form": "~1.34.0",
26
- "scroll-into-view-if-needed": "^2.2.25"
27
- },
28
- "devDependencies": {
29
- "@react-types/shared": "^3.10.1",
30
- "@types/react": "~16.14.23",
31
- "@types/react-dom": "~16.9.14",
32
- "@types/styled-components": "~5.1.26",
33
- "@rushstack/eslint-config": "~2.5.1",
34
- "@rushstack/heft": "~0.44.2",
35
- "@rushstack/heft-storybook-plugin": "~0.1.91",
36
- "@types/jest": "~28.1.6",
37
- "@tntd/heft-rig": "0.1.0",
38
- "@tntd/storybook-react-storykit": "0.0.0",
39
- "antd": "^3.26.19",
40
- "react": "~16.14.0",
41
- "react-dom": "~16.14.0",
42
- "jest": "~28.1.0",
43
- "eslint-plugin-react-hooks": "~4.3.0",
44
- "eslint": "~8.11.0",
45
- "eslint-plugin-import": "~2.25.4",
46
- "typescript": "~4.6.2",
47
- "@types/lodash-es": "~4.17.6",
48
- "@types/lodash": "~4.14.191",
49
- "babel-plugin-lodash": "~3.3.4",
50
- "@babel/cli": "~7.21.0",
51
- "@babel/core": "~7.21.0",
52
- "@babel/preset-env": "~7.20.2",
53
- "moment": "~2.29.4"
54
- },
55
- "peerDependencies": {
56
- "antd": "^3.0.0 || ^4.0.0",
57
- "react": "^16.0.0 || ^17.0.0",
58
- "react-dom": "^16.0.0 || ^17.0.0"
59
- },
60
- "svgr": {
61
- "typescript": true,
62
- "memo": true,
63
- "dimensions": false,
64
- "filenameCase": "kebab",
65
- "replaceAttrValues": {
66
- "#126bfb": "currentColor"
2
+ "name": "tntd",
3
+ "version": "2.7.34",
4
+ "license": "MIT",
5
+ "scripts": {
6
+ "start": "heft start --storybook",
7
+ "build": "heft build --clean && npm run build:es && npm run build:cjs && npm run post:build",
8
+ "build:es": "ES_MODULE=true babel es --out-dir es",
9
+ "build:cjs": "babel es --presets @babel/preset-env --out-dir lib",
10
+ "post:build": "node ./scripts/postbuild.js",
11
+ "build:watch": "heft build --clean --watch",
12
+ "watch": "rush build:watch --changed-projects-only --to-except tntd",
13
+ "svgr": "npx svgr ./svg --out-dir ./src/svg-components",
14
+ "test": "heft test",
15
+ "test:watch": "heft test --watch --clean"
67
16
  },
68
- "ref": true
69
- },
70
- "repository": {
71
- "type": "git",
72
- "url": "git@gitlab.tongdun.cn:app/tntd.git"
73
- },
74
- "keywords": [
75
- "react",
76
- "component",
77
- "components",
78
- "framework",
79
- "frontend",
80
- "react-component",
81
- "react-ui",
82
- "tntd"
83
- ],
84
- "files": [
85
- "lib",
86
- "es",
87
- "themes",
88
- "LICENSE",
89
- "README.md"
90
- ],
91
- "main": "lib/index.js",
92
- "module": "es/index.js",
93
- "typings": "lib/index.d.ts",
94
- "scripts": {
95
- "start": "heft start --storybook",
96
- "build": "heft build --clean && npm run build:es && npm run build:cjs && npm run post:build",
97
- "build:es": "ES_MODULE=true babel es --out-dir es",
98
- "build:cjs": "babel es --presets @babel/preset-env --out-dir lib",
99
- "post:build": "node ./scripts/postbuild.js",
100
- "build:watch": "heft build --clean --watch",
101
- "watch": "rush build:watch --changed-projects-only --to-except tntd",
102
- "svgr": "npx svgr ./svg --out-dir ./src/svg-components",
103
- "test": "heft test",
104
- "test:watch": "heft test --watch --clean"
105
- },
106
- "readme": "# 组件介绍\ntntd是基于 TNT Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。\n\n\n## 如何从 `tntd v1.0` 迁移到 `tntd v2.0` \n\n### 安装 `tntd` 最新版本\n\n```\nnpm install tntd\n```\n\n### 更改配置\n\n1. 添加 .babelrc 中的 import 插件配置,实现按需引入\n\n```diff title=\".babelrc\"\n+ [\n+ \"import\",\n+ {\n+ \"libraryName\": \"tntd\",\n+ libraryDirectory: 'es',\n+ },\n+ \"tntd\"\n+ ],\n```\n\n2. 更改 webpack.config.js 中的主题配置\n\n```diff title=\"webpack.config.js\"\n{\n loader: \"less-loader\",\n options: {\n javascriptEnabled: true,\n ...\n modifyVars: {\n- hack: \"true; @import \\\"~@tntd/antd-cover/tnt.less\\\";\"\n+ hack: \"true; @import \\\"~tntd/themes/default/variables.less\\\";\"\n }\n }\n}\n```\n\n3. 修改导入名称\n\nLayout, Icon, Select 等 tntd 1.0 组件和 antd 组件名称存在冲突,请按下方例子进行重命名:\n\n```diff\n- import { Layout, Icon, Select } from 'tntd'\n+ import { TntdLayout, TntdIcon, TntdSelect } from 'tntd'\n```\n\n4. 更改配置\n\n```jsx\n// 使用全新的空状态插画\nimport { renderEmpty } from 'tntd'\n// 使用内置语言包替换 antd\n// 英文语言包\nconst enUS = import 'tntd/es/locale/en_US'\n// 中文语言包\nconst zhCN = import 'tntd/es/locale/zh_CN'\n\nexport const App = () => {\n return (\n // 使用空状态插画及语言包\n <ConfigProvider locale={zhCN} renderEmpty={renderEmpty}>\n ...\n </ConfigProvider>\n )\n}\n```\n"
17
+ "dependencies": {
18
+ "@icon-park/react": "^1.3.5",
19
+ "@stellaris/hooks": "~0.4.6",
20
+ "classnames": "~2.3.1",
21
+ "@tntx/logo-icon": "~1.0.4",
22
+ "delete-all-cookies": "~0.3.0",
23
+ "styled-components": "^5.3.0",
24
+ "rc-util": "^5.25.2",
25
+ "rc-motion": "^2.6.1",
26
+ "array-tree-filter": "^2.1.0",
27
+ "rc-select": "~14.2.0",
28
+ "rc-tree": "~5.7.0",
29
+ "rc-overflow": "^1.0.0",
30
+ "rc-trigger": "^5.0.4",
31
+ "rc-virtual-list": "^3.4.13",
32
+ "rc-align": "^4.0.0",
33
+ "react-color": "^2.17.2",
34
+ "lodash": "~4.17.21",
35
+ "color-alpha": "~1.1.3",
36
+ "rc-segmented": "~2.2.2",
37
+ "rc-field-form": "~1.34.0",
38
+ "scroll-into-view-if-needed": "^2.2.25"
39
+ },
40
+ "devDependencies": {
41
+ "@react-types/shared": "^3.10.1",
42
+ "@types/react": "~16.14.23",
43
+ "@types/react-dom": "~16.9.14",
44
+ "@types/styled-components": "~5.1.26",
45
+ "@rushstack/eslint-config": "~2.5.1",
46
+ "@rushstack/heft": "~0.44.2",
47
+ "@rushstack/heft-storybook-plugin": "~0.1.91",
48
+ "@types/jest": "~28.1.6",
49
+ "@tntd/heft-rig": "workspace:*",
50
+ "@tntd/storybook-react-storykit": "workspace:*",
51
+ "antd": "^3.26.19",
52
+ "react": "~16.14.0",
53
+ "react-dom": "~16.14.0",
54
+ "jest": "~28.1.0",
55
+ "eslint-plugin-react-hooks": "~4.3.0",
56
+ "eslint": "~8.11.0",
57
+ "eslint-plugin-import": "~2.25.4",
58
+ "typescript": "~4.6.2",
59
+ "@types/lodash-es": "~4.17.6",
60
+ "@types/lodash": "~4.14.191",
61
+ "babel-plugin-lodash": "~3.3.4",
62
+ "@babel/cli": "~7.21.0",
63
+ "@babel/core": "~7.21.0",
64
+ "@babel/preset-env": "~7.20.2",
65
+ "moment": "~2.29.4"
66
+ },
67
+ "peerDependencies": {
68
+ "antd": "^3.0.0 || ^4.0.0",
69
+ "react": "^16.0.0 || ^17.0.0",
70
+ "react-dom": "^16.0.0 || ^17.0.0"
71
+ },
72
+ "svgr": {
73
+ "typescript": true,
74
+ "memo": true,
75
+ "dimensions": false,
76
+ "filenameCase": "kebab",
77
+ "replaceAttrValues": {
78
+ "#126bfb": "currentColor"
79
+ },
80
+ "ref": true
81
+ },
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "git@gitlab.tongdun.cn:app/tntd.git"
85
+ },
86
+ "keywords": [
87
+ "react",
88
+ "component",
89
+ "components",
90
+ "framework",
91
+ "frontend",
92
+ "react-component",
93
+ "react-ui",
94
+ "tntd"
95
+ ],
96
+ "files": [
97
+ "lib",
98
+ "es",
99
+ "themes",
100
+ "LICENSE",
101
+ "README.md"
102
+ ],
103
+ "main": "lib/index.js",
104
+ "module": "es/index.js",
105
+ "typings": "lib/index.d.ts"
107
106
  }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- const defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
3
- if (customizePrefixCls) return customizePrefixCls;
4
- return suffixCls ? `tntd-rc-${suffixCls}` : 'tntd-rc';
5
- };
6
- export const defaultIconPrefixCls = 'anticon';
7
- // zombieJ: 🚨 Do not pass `defaultRenderEmpty` here since it will case circular dependency.
8
- export const ConfigContext = React.createContext({
9
- // We provide a default function for Context without provider
10
- getPrefixCls: defaultGetPrefixCls
11
- });
12
- export const ConfigConsumer = ConfigContext.Consumer;
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,mBAAmB,GAAG,CAAC,SAAkB,EAAE,kBAA2B,EAAE,EAAE;IAC9E,IAAI,kBAAkB;QAAE,OAAO,kBAAkB,CAAA;IAEjD,OAAO,SAAS,CAAC,CAAC,CAAC,WAAW,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAA;AAiC7C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAsB;IACpE,6DAA6D;IAC7D,YAAY,EAAE,mBAAmB;CAClC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAA","sourcesContent":["import React from 'react'\nimport type { RenderEmptyHandler } from './defaultRenderEmpty'\n\nexport interface CSPConfig {\n nonce?: string\n}\n\nconst defaultGetPrefixCls = (suffixCls?: string, customizePrefixCls?: string) => {\n if (customizePrefixCls) return customizePrefixCls\n\n return suffixCls ? `tntd-rc-${suffixCls}` : 'tntd-rc'\n}\n\nexport type DirectionType = 'ltr' | 'rtl' | undefined\n\nexport type SizeType = 'small' | 'middle' | 'large' | undefined\n\nexport type RequiredMark = boolean | 'optional'\n\nexport const defaultIconPrefixCls = 'anticon'\n\nexport interface ConfigConsumerProps {\n getTargetContainer?: () => HTMLElement\n getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement\n rootPrefixCls?: string\n iconPrefixCls?: string\n getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string\n renderEmpty?: RenderEmptyHandler\n csp?: CSPConfig\n autoInsertSpaceInButton?: boolean\n input?: {\n autoComplete?: string\n }\n pagination?: {\n showSizeChanger?: boolean\n }\n locale?: object\n pageHeader?: {\n ghost: boolean\n }\n direction?: DirectionType\n space?: {\n size?: SizeType | number\n }\n virtual?: boolean\n dropdownMatchSelectWidth?: boolean\n form?: {\n requiredMark?: RequiredMark\n colon?: boolean\n }\n}\n\n// zombieJ: 🚨 Do not pass `defaultRenderEmpty` here since it will case circular dependency.\nexport const ConfigContext = React.createContext<ConfigConsumerProps>({\n // We provide a default function for Context without provider\n getPrefixCls: defaultGetPrefixCls,\n})\n\nexport const ConfigConsumer = ConfigContext.Consumer\n"]}
@@ -1,31 +0,0 @@
1
- /*
2
- * @Descripttion: 空状态
3
- * @Author: 郑泳健
4
- * @Date: 2022-12-19 16:45:16
5
- * @LastEditors: 郑泳健
6
- * @LastEditTime: 2023-02-07 11:47:03
7
- */
8
- import * as React from 'react';
9
- import { ConfigConsumer } from './context';
10
- import LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver';
11
- const defaultRenderEmpty = componentName => React.createElement(ConfigConsumer, null, ({
12
- getPrefixCls
13
- }) => {
14
- const prefix = getPrefixCls('empty');
15
- return React.createElement(LocaleReceiver, {
16
- componentName: "TntdSelect"
17
- }, locale => {
18
- return React.createElement("div", {
19
- className: `tntd-select-no-data-wrapper ${prefix}`
20
- }, React.createElement("img", {
21
- style: {
22
- width: 80,
23
- height: 50
24
- },
25
- src: require('../img/no-data-s.png').default
26
- }), React.createElement("div", {
27
- className: "tntd-select-no-data-content"
28
- }, locale.noData));
29
- });
30
- });
31
- export default defaultRenderEmpty;
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaultRenderEmpty.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/defaultRenderEmpty.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,cAAc,MAAM,wCAAwC,CAAA;AAEnE,MAAM,kBAAkB,GAAG,CAAC,aAAqB,EAAE,EAAE,CAAC,CACpD,oBAAC,cAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAEpC,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,YAAY,IACvC,CAAC,MAAM,EAAE,EAAE;QACV,OAAO,CACL,6BAAK,SAAS,EAAE,+BAA+B,MAAM,EAAE;YACrD,6BACE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAChC,GAAG,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC,OAAO,GAC5C;YACF,6BAAK,SAAS,EAAC,6BAA6B,IACxC,MAAmC,CAAC,MAAM,CACxC,CACF,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CACc,CAClB,CAAA;AAID,eAAe,kBAAkB,CAAA","sourcesContent":["/*\n * @Descripttion: 空状态\n * @Author: 郑泳健\n * @Date: 2022-12-19 16:45:16\n * @LastEditors: 郑泳健\n * @LastEditTime: 2023-02-07 11:47:03\n */\nimport * as React from 'react'\nimport { ConfigConsumer } from './context'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\n\nconst defaultRenderEmpty = (componentName: string) => (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefix = getPrefixCls('empty')\n\n return (\n <LocaleReceiver componentName=\"TntdSelect\">\n {(locale) => {\n return (\n <div className={`tntd-select-no-data-wrapper ${prefix}`}>\n <img\n style={{ width: 80, height: 50 }}\n src={require('../img/no-data-s.png').default}\n />\n <div className=\"tntd-select-no-data-content\">\n {(locale as Record<'noData', object>).noData}\n </div>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n }}\n </ConfigConsumer>\n)\n\nexport type RenderEmptyHandler = typeof defaultRenderEmpty\n\nexport default defaultRenderEmpty\n"]}
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import { detectFlexGapSupported } from '../styleChecker';
3
- export default (() => {
4
- const [flexible, setFlexible] = React.useState(false);
5
- React.useEffect(() => {
6
- setFlexible(detectFlexGapSupported());
7
- }, []);
8
- return flexible;
9
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFlexGapSupport.js","sourceRoot":"","sources":["../../../../src/tntd-form/_util/hooks/useFlexGapSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,eAAe,GAAG,EAAE;IAClB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,WAAW,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { detectFlexGapSupported } from '../styleChecker';\n\nexport default () => {\n const [flexible, setFlexible] = React.useState(false);\n React.useEffect(() => {\n setFlexible(detectFlexGapSupported());\n }, []);\n\n return flexible;\n};\n"]}
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export default function useForceUpdate() {
3
- const [, forceUpdate] = React.useReducer(x => x + 1, 0);
4
- return forceUpdate;
5
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"useForceUpdate.js","sourceRoot":"","sources":["../../../../src/tntd-form/_util/hooks/useForceUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,cAAc;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import * as React from 'react';\n\nexport default function useForceUpdate() {\n const [, forceUpdate] = React.useReducer(x => x + 1, 0);\n return forceUpdate;\n}\n"]}
@@ -1,47 +0,0 @@
1
- import { tuple } from './type';
2
- // ================== Collapse Motion ==================
3
- const getCollapsedHeight = () => ({
4
- height: 0,
5
- opacity: 0
6
- });
7
- const getRealHeight = node => {
8
- const {
9
- scrollHeight
10
- } = node;
11
- return {
12
- height: scrollHeight,
13
- opacity: 1
14
- };
15
- };
16
- const getCurrentHeight = node => ({
17
- height: node ? node.offsetHeight : 0
18
- });
19
- const skipOpacityTransition = (_, event) => (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
20
- const collapseMotion = {
21
- motionName: 'ant-motion-collapse',
22
- onAppearStart: getCollapsedHeight,
23
- onEnterStart: getCollapsedHeight,
24
- onAppearActive: getRealHeight,
25
- onEnterActive: getRealHeight,
26
- onLeaveStart: getCurrentHeight,
27
- onLeaveActive: getCollapsedHeight,
28
- onAppearEnd: skipOpacityTransition,
29
- onEnterEnd: skipOpacityTransition,
30
- onLeaveEnd: skipOpacityTransition,
31
- motionDeadline: 500
32
- };
33
- const SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight');
34
- const getTransitionDirection = placement => {
35
- if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) {
36
- return `slide-down`;
37
- }
38
- return `slide-up`;
39
- };
40
- const getTransitionName = (rootPrefixCls, motion, transitionName) => {
41
- if (transitionName !== undefined) {
42
- return transitionName;
43
- }
44
- return `${rootPrefixCls}-${motion}`;
45
- };
46
- export { getTransitionName, getTransitionDirection };
47
- export default collapseMotion;
@@ -1 +0,0 @@
1
- {"version":3,"file":"motion.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/motion.tsx"],"names":[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CAAC,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,UAAU,CAAC,EAAE;QACpF,OAAO,YAAY,CAAA;KACpB;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,aAAqB,EAAE,MAAc,EAAE,cAAuB,EAAE,EAAE;IAC3F,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,OAAO,cAAc,CAAA;KACtB;IACD,OAAO,GAAG,aAAa,IAAI,MAAM,EAAE,CAAA;AACrC,CAAC,CAAA;AACD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,CAAA;AACpD,eAAe,cAAc,CAAA","sourcesContent":["import type { CSSMotionProps, MotionEndEventHandler, MotionEventHandler } from 'rc-motion'\nimport type { MotionEvent } from 'rc-motion/lib/interface'\nimport { tuple } from './type'\n\n// ================== Collapse Motion ==================\nconst getCollapsedHeight: MotionEventHandler = () => ({ height: 0, opacity: 0 })\nconst getRealHeight: MotionEventHandler = (node) => {\n const { scrollHeight } = node\n return { height: scrollHeight, opacity: 1 }\n}\nconst getCurrentHeight: MotionEventHandler = (node) => ({ height: node ? node.offsetHeight : 0 })\nconst skipOpacityTransition: MotionEndEventHandler = (_, event: MotionEvent) =>\n event?.deadline === true || (event as TransitionEvent).propertyName === 'height'\n\nconst collapseMotion: CSSMotionProps = {\n motionName: 'ant-motion-collapse',\n onAppearStart: getCollapsedHeight,\n onEnterStart: getCollapsedHeight,\n onAppearActive: getRealHeight,\n onEnterActive: getRealHeight,\n onLeaveStart: getCurrentHeight,\n onLeaveActive: getCollapsedHeight,\n onAppearEnd: skipOpacityTransition,\n onEnterEnd: skipOpacityTransition,\n onLeaveEnd: skipOpacityTransition,\n motionDeadline: 500,\n}\n\nconst SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight')\nexport type SelectCommonPlacement = typeof SelectPlacements[number]\n\nconst getTransitionDirection = (placement: SelectCommonPlacement | undefined) => {\n if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) {\n return `slide-down`\n }\n return `slide-up`\n}\n\nconst getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => {\n if (transitionName !== undefined) {\n return transitionName\n }\n return `${rootPrefixCls}-${motion}`\n}\nexport { getTransitionName, getTransitionDirection }\nexport default collapseMotion\n"]}
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- export const {
3
- isValidElement
4
- } = React;
5
- export function isFragment(child) {
6
- return child && isValidElement(child) && child.type === React.Fragment;
7
- }
8
- export function replaceElement(element, replacement, props) {
9
- if (!isValidElement(element)) {
10
- return replacement;
11
- }
12
- return React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
13
- }
14
- export function cloneElement(element, props) {
15
- return replaceElement(element, element, props);
16
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactNode.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/reactNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAA;AAEvC,MAAM,UAAU,UAAU,CAAC,KAAU;IACnC,OAAO,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAA;AACxE,CAAC;AAMD,MAAM,UAAU,cAAc,CAC5B,OAAwB,EACxB,WAA4B,EAC5B,KAAmB;IAEnB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QAC5B,OAAO,WAAW,CAAA;KACnB;IACD,OAAO,KAAK,CAAC,YAAY,CACvB,OAAO,EACP,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CACjE,CAAA;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAwB,EAAE,KAAmB;IACxE,OAAO,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAuB,CAAA;AACtE,CAAC","sourcesContent":["import * as React from 'react'\n\nexport const { isValidElement } = React\n\nexport function isFragment(child: any): boolean {\n return child && isValidElement(child) && child.type === React.Fragment\n}\n\ntype AnyObject = Record<PropertyKey, any>\n\ntype RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void)\n\nexport function replaceElement(\n element: React.ReactNode,\n replacement: React.ReactNode,\n props?: RenderProps\n): React.ReactNode {\n if (!isValidElement(element)) {\n return replacement\n }\n return React.cloneElement(\n element,\n typeof props === 'function' ? props(element.props || {}) : props\n )\n}\n\nexport function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement {\n return replaceElement(element, element, props) as React.ReactElement\n}\n"]}
@@ -1,59 +0,0 @@
1
- export const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
2
- export const responsiveMap = {
3
- xs: '(max-width: 575px)',
4
- sm: '(min-width: 576px)',
5
- md: '(min-width: 768px)',
6
- lg: '(min-width: 992px)',
7
- xl: '(min-width: 1200px)',
8
- xxl: '(min-width: 1600px)'
9
- };
10
- const subscribers = new Map();
11
- let subUid = -1;
12
- let screens = {};
13
- const responsiveObserve = {
14
- matchHandlers: {},
15
- dispatch(pointMap) {
16
- screens = pointMap;
17
- subscribers.forEach(func => func(screens));
18
- return subscribers.size >= 1;
19
- },
20
- subscribe(func) {
21
- if (!subscribers.size) this.register();
22
- subUid += 1;
23
- subscribers.set(subUid, func);
24
- func(screens);
25
- return subUid;
26
- },
27
- unsubscribe(token) {
28
- subscribers.delete(token);
29
- if (!subscribers.size) this.unregister();
30
- },
31
- unregister() {
32
- Object.keys(responsiveMap).forEach(screen => {
33
- const matchMediaQuery = responsiveMap[screen];
34
- const handler = this.matchHandlers[matchMediaQuery];
35
- handler === null || handler === void 0 ? void 0 : handler.mql.removeListener(handler === null || handler === void 0 ? void 0 : handler.listener);
36
- });
37
- subscribers.clear();
38
- },
39
- register() {
40
- Object.keys(responsiveMap).forEach(screen => {
41
- const matchMediaQuery = responsiveMap[screen];
42
- const listener = ({
43
- matches
44
- }) => {
45
- this.dispatch(Object.assign(Object.assign({}, screens), {
46
- [screen]: matches
47
- }));
48
- };
49
- const mql = window.matchMedia(matchMediaQuery);
50
- mql.addListener(listener);
51
- this.matchHandlers[matchMediaQuery] = {
52
- mql,
53
- listener
54
- };
55
- listener(mql);
56
- });
57
- }
58
- };
59
- export default responsiveObserve;
@@ -1 +0,0 @@
1
- {"version":3,"file":"responsiveObserve.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/responsiveObserve.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,qBAAqB;IACzB,GAAG,EAAE,qBAAqB;CAC3B,CAAC;AAGF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;AACrD,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAChB,IAAI,OAAO,GAAG,EAAE,CAAC;AAEjB,MAAM,iBAAiB,GAAG;IACxB,aAAa,EAAE,EAKd;IACD,QAAQ,CAAC,QAAmB;QAC1B,OAAO,GAAG,QAAQ,CAAC;QACnB,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3C,OAAO,WAAW,CAAC,IAAI,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,SAAS,CAAC,IAAmB;QAC3B,IAAI,CAAC,WAAW,CAAC,IAAI;YAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM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,CAAC;YAEF,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';\nexport type BreakpointMap = Record<Breakpoint, string>;\nexport type ScreenMap = Partial<Record<Breakpoint, boolean>>;\nexport type ScreenSizeMap = Partial<Record<Breakpoint, number>>;\n\nexport const responsiveArray: Breakpoint[] = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];\n\nexport const responsiveMap: BreakpointMap = {\n xs: '(max-width: 575px)',\n sm: '(min-width: 576px)',\n md: '(min-width: 768px)',\n lg: '(min-width: 992px)',\n xl: '(min-width: 1200px)',\n xxl: '(min-width: 1600px)',\n};\n\ntype SubscribeFunc = (screens: ScreenMap) => void;\nconst subscribers = new Map<Number, SubscribeFunc>();\nlet subUid = -1;\nlet screens = {};\n\nconst responsiveObserve = {\n matchHandlers: {} as {\n [prop: string]: {\n mql: MediaQueryList;\n listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;\n };\n },\n dispatch(pointMap: ScreenMap) {\n screens = pointMap;\n subscribers.forEach(func => func(screens));\n return subscribers.size >= 1;\n },\n subscribe(func: SubscribeFunc): number {\n if (!subscribers.size) this.register();\n subUid += 1;\n subscribers.set(subUid, func);\n func(screens);\n return subUid;\n },\n unsubscribe(token: number) {\n subscribers.delete(token);\n if (!subscribers.size) this.unregister();\n },\n unregister() {\n Object.keys(responsiveMap).forEach((screen: string ) => {\n const matchMediaQuery = responsiveMap[screen as Breakpoint];\n const handler = this.matchHandlers[matchMediaQuery];\n handler?.mql.removeListener(handler?.listener);\n });\n subscribers.clear();\n },\n register() {\n Object.keys(responsiveMap).forEach((screen: string) => {\n const matchMediaQuery = responsiveMap[screen as Breakpoint];\n const listener = ({ matches }: { matches: boolean }) => {\n this.dispatch({\n ...screens,\n [screen]: matches,\n });\n };\n const mql = window.matchMedia(matchMediaQuery);\n mql.addListener(listener);\n this.matchHandlers[matchMediaQuery] = {\n mql,\n listener,\n };\n\n listener(mql);\n });\n },\n};\n\nexport default responsiveObserve;\n"]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- // import raf from 'raf';
4
- // import getScroll from './getScroll';
5
- // import { easeInOutCubic } from './easings';
6
- // interface ScrollToOptions {
7
- // /** Scroll container, default as window */
8
- // getContainer?: () => HTMLElement | Window;
9
- // /** Scroll end callback */
10
- // callback?: () => any;
11
- // /** Animation duration, default as 450 */
12
- // duration?: number;
13
- // }
14
- // export default function scrollTo(y: number, options: ScrollToOptions = {}) {
15
- // const { getContainer = () => window, callback, duration = 450 } = options;
16
- // const container = getContainer();
17
- // const scrollTop = getScroll(container, true);
18
- // const startTime = Date.now();
19
- // const frameFunc = () => {
20
- // const timestamp = Date.now();
21
- // const time = timestamp - startTime;
22
- // const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
23
- // if (container === window) {
24
- // window.scrollTo(window.pageXOffset, nextScrollTop);
25
- // } else {
26
- // (container as HTMLElement).scrollTop = nextScrollTop;
27
- // }
28
- // if (time < duration) {
29
- // raf(frameFunc);
30
- // } else if (typeof callback === 'function') {
31
- // callback();
32
- // }
33
- // };
34
- // raf(frameFunc);
35
- // }
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrollTo.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/scrollTo.ts"],"names":[],"mappings":";AAAA,yBAAyB;AACzB,uCAAuC;AACvC,8CAA8C;AAE9C,8BAA8B;AAC9B,+CAA+C;AAC/C,+CAA+C;AAC/C,+BAA+B;AAC/B,0BAA0B;AAC1B,8CAA8C;AAC9C,uBAAuB;AACvB,IAAI;AAEJ,+EAA+E;AAC/E,+EAA+E;AAE/E,sCAAsC;AACtC,kDAAkD;AAClD,kCAAkC;AAElC,8BAA8B;AAC9B,oCAAoC;AACpC,0CAA0C;AAC1C,uGAAuG;AACvG,kCAAkC;AAClC,4DAA4D;AAC5D,eAAe;AACf,8DAA8D;AAC9D,QAAQ;AACR,6BAA6B;AAC7B,wBAAwB;AACxB,mDAAmD;AACnD,oBAAoB;AACpB,QAAQ;AACR,OAAO;AACP,oBAAoB;AACpB,IAAI","sourcesContent":["// import raf from 'raf';\n// import getScroll from './getScroll';\n// import { easeInOutCubic } from './easings';\n\n// interface ScrollToOptions {\n// /** Scroll container, default as window */\n// getContainer?: () => HTMLElement | Window;\n// /** Scroll end callback */\n// callback?: () => any;\n// /** Animation duration, default as 450 */\n// duration?: number;\n// }\n\n// export default function scrollTo(y: number, options: ScrollToOptions = {}) {\n// const { getContainer = () => window, callback, duration = 450 } = options;\n\n// const container = getContainer();\n// const scrollTop = getScroll(container, true);\n// const startTime = Date.now();\n\n// const frameFunc = () => {\n// const timestamp = Date.now();\n// const time = timestamp - startTime;\n// const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);\n// if (container === window) {\n// window.scrollTo(window.pageXOffset, nextScrollTop);\n// } else {\n// (container as HTMLElement).scrollTop = nextScrollTop;\n// }\n// if (time < duration) {\n// raf(frameFunc);\n// } else if (typeof callback === 'function') {\n// callback();\n// }\n// };\n// raf(frameFunc);\n// }\n"]}