tntd 2.7.33 → 2.8.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/es/icon/IconFont.js +52 -0
  2. package/es/icon/IconFont.js.map +1 -0
  3. package/es/icon/components/Icon.js +106 -0
  4. package/es/icon/components/Icon.js.map +1 -0
  5. package/es/icon/components/index.js +1 -0
  6. package/es/icon/components/index.js.map +1 -0
  7. package/es/icon/components/utils.js +79 -0
  8. package/es/icon/components/utils.js.map +1 -0
  9. package/es/icon/index.js +114 -3
  10. package/es/icon/index.js.map +1 -1
  11. package/es/icon/twoTonePrimaryColor.js +10 -0
  12. package/es/icon/twoTonePrimaryColor.js.map +1 -0
  13. package/es/icon/utils.js +64 -0
  14. package/es/icon/utils.js.map +1 -0
  15. package/lib/icon/IconFont.d.ts +10 -0
  16. package/lib/icon/IconFont.d.ts.map +1 -0
  17. package/lib/icon/IconFont.js +62 -0
  18. package/lib/icon/IconFont.js.map +1 -0
  19. package/lib/icon/components/Icon.d.ts +31 -0
  20. package/lib/icon/components/Icon.d.ts.map +1 -0
  21. package/lib/icon/components/Icon.js +149 -0
  22. package/lib/icon/components/Icon.js.map +1 -0
  23. package/lib/icon/components/index.d.ts +2 -0
  24. package/lib/icon/components/index.d.ts.map +1 -0
  25. package/lib/icon/components/index.js +13 -0
  26. package/lib/icon/components/index.js.map +1 -0
  27. package/lib/icon/components/utils.d.ts +22 -0
  28. package/lib/icon/components/utils.d.ts.map +1 -0
  29. package/lib/icon/components/utils.js +120 -0
  30. package/lib/icon/components/utils.js.map +1 -0
  31. package/lib/icon/index.d.ts +45 -3
  32. package/lib/icon/index.d.ts.map +1 -1
  33. package/lib/icon/index.js +121 -15
  34. package/lib/icon/index.js.map +1 -1
  35. package/lib/icon/twoTonePrimaryColor.d.ts +3 -0
  36. package/lib/icon/twoTonePrimaryColor.d.ts.map +1 -0
  37. package/lib/icon/twoTonePrimaryColor.js +18 -0
  38. package/lib/icon/twoTonePrimaryColor.js.map +1 -0
  39. package/lib/icon/utils.d.ts +13 -0
  40. package/lib/icon/utils.d.ts.map +1 -0
  41. package/lib/icon/utils.js +76 -0
  42. package/lib/icon/utils.js.map +1 -0
  43. package/lib/segmented/index.d.ts +1 -1
  44. package/lib/svg-components/illustration-403.d.ts +1 -1
  45. package/lib/svg-components/illustration-404.d.ts +1 -1
  46. package/lib/svg-components/illustration-500.d.ts +1 -1
  47. package/lib/svg-components/illustration-empty.d.ts +1 -1
  48. package/lib/svg-components/illustration-failure.d.ts +1 -1
  49. package/lib/svg-components/illustration-no-access.d.ts +1 -1
  50. package/lib/svg-components/illustration-no-chart.d.ts +1 -1
  51. package/lib/svg-components/illustration-no-result.d.ts +1 -1
  52. package/lib/svg-components/illustration-offline.d.ts +1 -1
  53. package/lib/svg-components/illustration-success.d.ts +1 -1
  54. package/lib/table/assets/image-loading-background.d.ts +1 -1
  55. package/lib/table/assets/image-loading.d.ts +1 -1
  56. package/package.json +106 -105
  57. package/es/tntd-form/_util/context.js +0 -12
  58. package/es/tntd-form/_util/context.js.map +0 -1
  59. package/es/tntd-form/_util/defaultRenderEmpty.js +0 -31
  60. package/es/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  61. package/es/tntd-form/_util/hooks/useFlexGapSupport.js +0 -9
  62. package/es/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  63. package/es/tntd-form/_util/hooks/useForceUpdate.js +0 -5
  64. package/es/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  65. package/es/tntd-form/_util/motion.js +0 -47
  66. package/es/tntd-form/_util/motion.js.map +0 -1
  67. package/es/tntd-form/_util/reactNode.js +0 -16
  68. package/es/tntd-form/_util/reactNode.js.map +0 -1
  69. package/es/tntd-form/_util/responsiveObserve.js +0 -59
  70. package/es/tntd-form/_util/responsiveObserve.js.map +0 -1
  71. package/es/tntd-form/_util/scrollTo.js +0 -35
  72. package/es/tntd-form/_util/scrollTo.js.map +0 -1
  73. package/es/tntd-form/_util/styleChecker.js +0 -26
  74. package/es/tntd-form/_util/styleChecker.js.map +0 -1
  75. package/es/tntd-form/_util/type.js +0 -3
  76. package/es/tntd-form/_util/type.js.map +0 -1
  77. package/es/tntd-form/_util/warning.js +0 -5
  78. package/es/tntd-form/_util/warning.js.map +0 -1
  79. package/es/tntd-form/_util/wave.js +0 -168
  80. package/es/tntd-form/_util/wave.js.map +0 -1
  81. package/es/tntd-form/grid/RowContext.js +0 -3
  82. package/es/tntd-form/grid/RowContext.js.map +0 -1
  83. package/es/tntd-form/grid/col.js +0 -104
  84. package/es/tntd-form/grid/col.js.map +0 -1
  85. package/es/tntd-form/grid/hooks/useBreakpoint.js +0 -18
  86. package/es/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  87. package/es/tntd-form/grid/index.js +0 -14
  88. package/es/tntd-form/grid/index.js.map +0 -1
  89. package/es/tntd-form/grid/row.js +0 -153
  90. package/es/tntd-form/grid/row.js.map +0 -1
  91. package/es/tntd-form/grid/style/index.js +0 -2
  92. package/es/tntd-form/grid/style/index.js.map +0 -1
  93. package/es/tntd-form/tntd-form.stories.js +0 -836
  94. package/es/tntd-form/tntd-form.stories.js.map +0 -1
  95. package/lib/tntd-form/_util/context.d.ts +0 -42
  96. package/lib/tntd-form/_util/context.d.ts.map +0 -1
  97. package/lib/tntd-form/_util/context.js +0 -22
  98. package/lib/tntd-form/_util/context.js.map +0 -1
  99. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts +0 -5
  100. package/lib/tntd-form/_util/defaultRenderEmpty.d.ts.map +0 -1
  101. package/lib/tntd-form/_util/defaultRenderEmpty.js +0 -44
  102. package/lib/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
  103. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts +0 -3
  104. package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts.map +0 -1
  105. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js +0 -28
  106. package/lib/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
  107. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts +0 -3
  108. package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts.map +0 -1
  109. package/lib/tntd-form/_util/hooks/useForceUpdate.js +0 -24
  110. package/lib/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
  111. package/lib/tntd-form/_util/motion.d.ts +0 -9
  112. package/lib/tntd-form/_util/motion.d.ts.map +0 -1
  113. package/lib/tntd-form/_util/motion.js +0 -59
  114. package/lib/tntd-form/_util/motion.js.map +0 -1
  115. package/lib/tntd-form/_util/reactNode.d.ts +0 -9
  116. package/lib/tntd-form/_util/reactNode.d.ts.map +0 -1
  117. package/lib/tntd-form/_util/reactNode.js +0 -27
  118. package/lib/tntd-form/_util/reactNode.js.map +0 -1
  119. package/lib/tntd-form/_util/responsiveObserve.d.ts +0 -22
  120. package/lib/tntd-form/_util/responsiveObserve.d.ts.map +0 -1
  121. package/lib/tntd-form/_util/responsiveObserve.js +0 -73
  122. package/lib/tntd-form/_util/responsiveObserve.js.map +0 -1
  123. package/lib/tntd-form/_util/scrollTo.d.ts +0 -1
  124. package/lib/tntd-form/_util/scrollTo.d.ts.map +0 -1
  125. package/lib/tntd-form/_util/scrollTo.js +0 -35
  126. package/lib/tntd-form/_util/scrollTo.js.map +0 -1
  127. package/lib/tntd-form/_util/styleChecker.d.ts +0 -5
  128. package/lib/tntd-form/_util/styleChecker.d.ts.map +0 -1
  129. package/lib/tntd-form/_util/styleChecker.js +0 -42
  130. package/lib/tntd-form/_util/styleChecker.js.map +0 -1
  131. package/lib/tntd-form/_util/type.d.ts +0 -4
  132. package/lib/tntd-form/_util/type.d.ts.map +0 -1
  133. package/lib/tntd-form/_util/type.js +0 -21
  134. package/lib/tntd-form/_util/type.js.map +0 -1
  135. package/lib/tntd-form/_util/warning.d.ts +0 -5
  136. package/lib/tntd-form/_util/warning.d.ts.map +0 -1
  137. package/lib/tntd-form/_util/warning.js +0 -20
  138. package/lib/tntd-form/_util/warning.js.map +0 -1
  139. package/lib/tntd-form/_util/wave.d.ts +0 -1
  140. package/lib/tntd-form/_util/wave.d.ts.map +0 -1
  141. package/lib/tntd-form/_util/wave.js +0 -168
  142. package/lib/tntd-form/_util/wave.js.map +0 -1
  143. package/lib/tntd-form/grid/RowContext.d.ts +0 -9
  144. package/lib/tntd-form/grid/RowContext.d.ts.map +0 -1
  145. package/lib/tntd-form/grid/RowContext.js +0 -10
  146. package/lib/tntd-form/grid/RowContext.js.map +0 -1
  147. package/lib/tntd-form/grid/col.d.ts +0 -29
  148. package/lib/tntd-form/grid/col.d.ts.map +0 -1
  149. package/lib/tntd-form/grid/col.js +0 -105
  150. package/lib/tntd-form/grid/col.js.map +0 -1
  151. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts +0 -4
  152. package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts.map +0 -1
  153. package/lib/tntd-form/grid/hooks/useBreakpoint.js +0 -29
  154. package/lib/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
  155. package/lib/tntd-form/grid/index.d.ts +0 -12
  156. package/lib/tntd-form/grid/index.d.ts.map +0 -1
  157. package/lib/tntd-form/grid/index.js +0 -31
  158. package/lib/tntd-form/grid/index.js.map +0 -1
  159. package/lib/tntd-form/grid/row.d.ts +0 -21
  160. package/lib/tntd-form/grid/row.d.ts.map +0 -1
  161. package/lib/tntd-form/grid/row.js +0 -186
  162. package/lib/tntd-form/grid/row.js.map +0 -1
  163. package/lib/tntd-form/grid/style/index.d.ts +0 -3
  164. package/lib/tntd-form/grid/style/index.d.ts.map +0 -1
  165. package/lib/tntd-form/grid/style/index.js +0 -4
  166. package/lib/tntd-form/grid/style/index.js.map +0 -1
  167. package/lib/tntd-form/tntd-form.stories.d.ts +0 -33
  168. package/lib/tntd-form/tntd-form.stories.d.ts.map +0 -1
  169. package/lib/tntd-form/tntd-form.stories.js +0 -943
  170. package/lib/tntd-form/tntd-form.stories.js.map +0 -1
@@ -1,104 +0,0 @@
1
- var __rest = this && this.__rest || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
- }
7
- return t;
8
- };
9
- import classNames from 'classnames';
10
- import * as React from 'react';
11
- // import { ConfigContext } from '../../config-provider';
12
- import { ConfigContext } from '../_util/context';
13
- import RowContext from './RowContext';
14
- function parseFlex(flex) {
15
- if (typeof flex === 'number') {
16
- return `${flex} ${flex} auto`;
17
- }
18
- if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
19
- return `0 0 ${flex}`;
20
- }
21
- return flex;
22
- }
23
- const sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
24
- const Col = React.forwardRef((props, ref) => {
25
- const {
26
- getPrefixCls,
27
- direction
28
- } = React.useContext(ConfigContext);
29
- const {
30
- gutter,
31
- wrap,
32
- supportFlexGap
33
- } = React.useContext(RowContext);
34
- const {
35
- prefixCls: customizePrefixCls = 'tnt-col',
36
- span,
37
- order,
38
- offset,
39
- push,
40
- pull,
41
- className,
42
- children,
43
- flex,
44
- style
45
- } = props,
46
- others = __rest(props, ["prefixCls", "span", "order", "offset", "push", "pull", "className", "children", "flex", "style"]);
47
- const prefixCls = getPrefixCls('col', customizePrefixCls);
48
- let sizeClassObj = {};
49
- sizes.forEach(size => {
50
- let sizeProps = {};
51
- const propSize = props[size];
52
- if (typeof propSize === 'number') {
53
- sizeProps.span = propSize;
54
- } else if (typeof propSize === 'object') {
55
- sizeProps = propSize || {};
56
- }
57
- delete others[size];
58
- sizeClassObj = Object.assign(Object.assign({}, sizeClassObj), {
59
- [`${prefixCls}-${size}-${sizeProps.span}`]: sizeProps.span !== undefined,
60
- [`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,
61
- [`${prefixCls}-${size}-offset-${sizeProps.offset}`]: sizeProps.offset || sizeProps.offset === 0,
62
- [`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,
63
- [`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,
64
- [`${prefixCls}-rtl`]: direction === 'rtl'
65
- });
66
- });
67
- const classes = classNames(prefixCls, {
68
- [`${prefixCls}-${span}`]: span !== undefined,
69
- [`${prefixCls}-order-${order}`]: order,
70
- [`${prefixCls}-offset-${offset}`]: offset,
71
- [`${prefixCls}-push-${push}`]: push,
72
- [`${prefixCls}-pull-${pull}`]: pull
73
- }, className, sizeClassObj);
74
- const mergedStyle = {};
75
- // Horizontal gutter use padding
76
- if (gutter && gutter[0] > 0) {
77
- const horizontalGutter = gutter[0] / 2;
78
- mergedStyle.paddingLeft = horizontalGutter;
79
- mergedStyle.paddingRight = horizontalGutter;
80
- }
81
- // Vertical gutter use padding when gap not support
82
- if (gutter && gutter[1] > 0 && !supportFlexGap) {
83
- const verticalGutter = gutter[1] / 2;
84
- mergedStyle.paddingTop = verticalGutter;
85
- mergedStyle.paddingBottom = verticalGutter;
86
- }
87
- if (flex) {
88
- mergedStyle.flex = parseFlex(flex);
89
- // Hack for Firefox to avoid size issue
90
- // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
91
- if (wrap === false && !mergedStyle.minWidth) {
92
- mergedStyle.minWidth = 0;
93
- }
94
- }
95
- return React.createElement("div", Object.assign({}, others, {
96
- style: Object.assign(Object.assign({}, mergedStyle), style),
97
- className: classes,
98
- ref: ref
99
- }), children);
100
- });
101
- if (process.env.NODE_ENV !== 'production') {
102
- Col.displayName = 'Col';
103
- }
104
- export default Col;
@@ -1 +0,0 @@
1
- {"version":3,"file":"col.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/col.tsx"],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C,QAAQ,KAAK,YAAY,EAAE;IACzC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;CACzB;AAED,eAAe,GAAG,CAAC","sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\n// import { ConfigContext } from '../../config-provider';\nimport { ConfigContext } from '../_util/context'\nimport RowContext from './RowContext';\n\n// https://github.com/ant-design/ant-design/issues/14324\ntype ColSpanType = number | string;\n\ntype FlexType = number | 'none' | 'auto' | string;\n\nexport interface ColSize {\n flex?: FlexType;\n span?: ColSpanType;\n order?: ColSpanType;\n offset?: ColSpanType;\n push?: ColSpanType;\n pull?: ColSpanType;\n}\n\nexport interface ColProps extends React.HTMLAttributes<HTMLDivElement> {\n flex?: FlexType;\n span?: ColSpanType;\n order?: ColSpanType;\n offset?: ColSpanType;\n push?: ColSpanType;\n pull?: ColSpanType;\n xs?: ColSpanType | ColSize;\n sm?: ColSpanType | ColSize;\n md?: ColSpanType | ColSize;\n lg?: ColSpanType | ColSize;\n xl?: ColSpanType | ColSize;\n xxl?: ColSpanType | ColSize;\n prefixCls?: string;\n}\n\nfunction parseFlex(flex: FlexType): string {\n if (typeof flex === 'number') {\n return `${flex} ${flex} auto`;\n }\n\n if (/^\\d+(\\.\\d+)?(px|em|rem|%)$/.test(flex)) {\n return `0 0 ${flex}`;\n }\n\n return flex;\n}\nconst sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const;\nconst Col = React.forwardRef<HTMLDivElement, ColProps>((props, ref) => {\n const { getPrefixCls, direction } = React.useContext(ConfigContext);\n const { gutter, wrap, supportFlexGap } = React.useContext(RowContext);\n\n const {\n prefixCls: customizePrefixCls='tnt-col',\n span,\n order,\n offset,\n push,\n pull,\n className,\n children,\n flex,\n style,\n ...others\n } = props;\n\n const prefixCls = getPrefixCls('col', customizePrefixCls);\n\n let sizeClassObj = {};\n sizes.forEach(size => {\n let sizeProps: ColSize = {};\n const propSize = props[size];\n if (typeof propSize === 'number') {\n sizeProps.span = propSize;\n } else if (typeof propSize === 'object') {\n sizeProps = propSize || {};\n }\n\n delete others[size];\n\n sizeClassObj = {\n ...sizeClassObj,\n [`${prefixCls}-${size}-${sizeProps.span}`]: sizeProps.span !== undefined,\n [`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,\n [`${prefixCls}-${size}-offset-${sizeProps.offset}`]:\n sizeProps.offset || sizeProps.offset === 0,\n [`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,\n [`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n };\n });\n\n const classes = classNames(\n prefixCls,\n {\n [`${prefixCls}-${span}`]: span !== undefined,\n [`${prefixCls}-order-${order}`]: order,\n [`${prefixCls}-offset-${offset}`]: offset,\n [`${prefixCls}-push-${push}`]: push,\n [`${prefixCls}-pull-${pull}`]: pull,\n },\n className,\n sizeClassObj,\n );\n\n const mergedStyle: React.CSSProperties = {};\n // Horizontal gutter use padding\n if (gutter && gutter[0] > 0) {\n const horizontalGutter = gutter[0] / 2;\n mergedStyle.paddingLeft = horizontalGutter;\n mergedStyle.paddingRight = horizontalGutter;\n }\n\n // Vertical gutter use padding when gap not support\n if (gutter && gutter[1] > 0 && !supportFlexGap) {\n const verticalGutter = gutter[1] / 2;\n mergedStyle.paddingTop = verticalGutter;\n mergedStyle.paddingBottom = verticalGutter;\n }\n\n if (flex) {\n mergedStyle.flex = parseFlex(flex);\n\n // Hack for Firefox to avoid size issue\n // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553\n if (wrap === false && !mergedStyle.minWidth) {\n mergedStyle.minWidth = 0;\n }\n }\n\n return (\n <div {...others} style={{ ...mergedStyle, ...style }} className={classes} ref={ref}>\n {children}\n </div>\n );\n});\n\nif (process.env.NODE_ENV !== 'production') {\n Col.displayName = 'Col';\n}\n\nexport default Col;\n"]}
@@ -1,18 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import useForceUpdate from '../../_util/hooks/useForceUpdate';
3
- import ResponsiveObserve from '../../_util/responsiveObserve';
4
- function useBreakpoint(refreshOnChange = true) {
5
- const screensRef = useRef({});
6
- const forceUpdate = useForceUpdate();
7
- useEffect(() => {
8
- const token = ResponsiveObserve.subscribe(supportScreens => {
9
- screensRef.current = supportScreens;
10
- if (refreshOnChange) {
11
- forceUpdate();
12
- }
13
- });
14
- return () => ResponsiveObserve.unsubscribe(token);
15
- }, []);
16
- return screensRef.current;
17
- }
18
- export default useBreakpoint;
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../../../src/tntd-form/grid/hooks/useBreakpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAE9D,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAE9D,SAAS,aAAa,CAAC,kBAA2B,IAAI;IACpD,MAAM,UAAU,GAAG,MAAM,CAAY,EAAE,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE;YACzD,UAAU,CAAC,OAAO,GAAG,cAAc,CAAC;YACpC,IAAI,eAAe,EAAE;gBACnB,WAAW,EAAE,CAAC;aACf;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC,OAAO,CAAC;AAC5B,CAAC;AAED,eAAe,aAAa,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\nimport useForceUpdate from '../../_util/hooks/useForceUpdate';\nimport type { ScreenMap } from '../../_util/responsiveObserve';\nimport ResponsiveObserve from '../../_util/responsiveObserve';\n\nfunction useBreakpoint(refreshOnChange: boolean = true): ScreenMap {\n const screensRef = useRef<ScreenMap>({});\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n const token = ResponsiveObserve.subscribe(supportScreens => {\n screensRef.current = supportScreens;\n if (refreshOnChange) {\n forceUpdate();\n }\n });\n\n return () => ResponsiveObserve.unsubscribe(token);\n }, []);\n\n return screensRef.current;\n}\n\nexport default useBreakpoint;\n"]}
@@ -1,14 +0,0 @@
1
- import Col from './col';
2
- import useInternalBreakpoint from './hooks/useBreakpoint';
3
- import Row from './row';
4
- import './style';
5
- // Do not export params
6
- function useBreakpoint() {
7
- return useInternalBreakpoint();
8
- }
9
- export {} from './col';
10
- export {} from './row';
11
- export { Row, Col };
12
- export default {
13
- useBreakpoint
14
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/index.tsx"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,qBAAqB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,OAAO,SAAS,CAAA;AAEhB,uBAAuB;AACvB,SAAS,aAAa;IACpB,OAAO,qBAAqB,EAAE,CAAC;AACjC,CAAC;AAED,OAAO,EAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAY,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpB,eAAe,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import Col from './col';\nimport useInternalBreakpoint from './hooks/useBreakpoint';\nimport Row from './row';\n\nimport './style'\n\n// Do not export params\nfunction useBreakpoint() {\n return useInternalBreakpoint();\n}\n\nexport { ColProps, ColSize } from './col';\nexport { RowProps } from './row';\nexport { Row, Col };\n\nexport default { useBreakpoint };\n"]}
@@ -1,153 +0,0 @@
1
- var __rest = this && this.__rest || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
- }
7
- return t;
8
- };
9
- import classNames from 'classnames';
10
- import * as React from 'react';
11
- import { ConfigContext } from '../_util/context';
12
- import useFlexGapSupport from '../_util/hooks/useFlexGapSupport';
13
- import ResponsiveObserve, { responsiveArray } from '../_util/responsiveObserve';
14
- import { tuple } from '../_util/type';
15
- import RowContext from './RowContext';
16
- const RowAligns = tuple('top', 'middle', 'bottom', 'stretch');
17
- const RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between', 'space-evenly');
18
- function useMergePropByScreen(oriProp, screen) {
19
- const [prop, setProp] = React.useState(typeof oriProp === 'string' ? oriProp : '');
20
- const clacMergeAlignOrJustify = () => {
21
- if (typeof oriProp === 'string') {
22
- setProp(oriProp);
23
- }
24
- if (typeof oriProp !== 'object') {
25
- return;
26
- }
27
- for (let i = 0; i < responsiveArray.length; i++) {
28
- const breakpoint = responsiveArray[i];
29
- // if do not match, do nothing
30
- if (!screen[breakpoint]) continue;
31
- const curVal = oriProp[breakpoint];
32
- if (curVal !== undefined) {
33
- setProp(curVal);
34
- return;
35
- }
36
- }
37
- };
38
- React.useEffect(() => {
39
- clacMergeAlignOrJustify();
40
- }, [JSON.stringify(oriProp), screen]);
41
- return prop;
42
- }
43
- const Row = React.forwardRef((props, ref) => {
44
- const {
45
- prefixCls: customizePrefixCls = 'tnt-row',
46
- justify,
47
- align,
48
- className,
49
- style,
50
- children,
51
- gutter = 0,
52
- wrap
53
- } = props,
54
- others = __rest(props, ["prefixCls", "justify", "align", "className", "style", "children", "gutter", "wrap"]);
55
- const {
56
- getPrefixCls,
57
- direction
58
- } = React.useContext(ConfigContext);
59
- const [screens, setScreens] = React.useState({
60
- xs: true,
61
- sm: true,
62
- md: true,
63
- lg: true,
64
- xl: true,
65
- xxl: true
66
- });
67
- // to save screens info when responsiveObserve callback had been call
68
- const [curScreens, setCurScreens] = React.useState({
69
- xs: false,
70
- sm: false,
71
- md: false,
72
- lg: false,
73
- xl: false,
74
- xxl: false
75
- });
76
- // ================================== calc reponsive data ==================================
77
- const mergeAlign = useMergePropByScreen(align, curScreens);
78
- const mergeJustify = useMergePropByScreen(justify, curScreens);
79
- const supportFlexGap = useFlexGapSupport();
80
- const gutterRef = React.useRef(gutter);
81
- // ================================== Effect ==================================
82
- React.useEffect(() => {
83
- const token = ResponsiveObserve.subscribe(screen => {
84
- setCurScreens(screen);
85
- const currentGutter = gutterRef.current || 0;
86
- if (!Array.isArray(currentGutter) && typeof currentGutter === 'object' || Array.isArray(currentGutter) && (typeof currentGutter[0] === 'object' || typeof currentGutter[1] === 'object')) {
87
- setScreens(screen);
88
- }
89
- });
90
- return () => ResponsiveObserve.unsubscribe(token);
91
- }, []);
92
- // ================================== Render ==================================
93
- const getGutter = () => {
94
- const results = [undefined, undefined];
95
- const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
96
- normalizedGutter.forEach((g, index) => {
97
- if (typeof g === 'object') {
98
- for (let i = 0; i < responsiveArray.length; i++) {
99
- const breakpoint = responsiveArray[i];
100
- if (screens[breakpoint] && g[breakpoint] !== undefined) {
101
- results[index] = g[breakpoint];
102
- break;
103
- }
104
- }
105
- } else {
106
- results[index] = g;
107
- }
108
- });
109
- return results;
110
- };
111
- const prefixCls = getPrefixCls('row', customizePrefixCls);
112
- const gutters = getGutter();
113
- const classes = classNames(prefixCls, {
114
- [`${prefixCls}-no-wrap`]: wrap === false,
115
- [`${prefixCls}-${mergeJustify}`]: mergeJustify,
116
- [`${prefixCls}-${mergeAlign}`]: mergeAlign,
117
- [`${prefixCls}-rtl`]: direction === 'rtl'
118
- }, className);
119
- // Add gutter related style
120
- const rowStyle = {};
121
- const horizontalGutter = gutters[0] != null && gutters[0] > 0 ? gutters[0] / -2 : undefined;
122
- const verticalGutter = gutters[1] != null && gutters[1] > 0 ? gutters[1] / -2 : undefined;
123
- if (horizontalGutter) {
124
- rowStyle.marginLeft = horizontalGutter;
125
- rowStyle.marginRight = horizontalGutter;
126
- }
127
- if (supportFlexGap) {
128
- // Set gap direct if flex gap support
129
- [, rowStyle.rowGap] = gutters;
130
- } else if (verticalGutter) {
131
- rowStyle.marginTop = verticalGutter;
132
- rowStyle.marginBottom = verticalGutter;
133
- }
134
- // "gutters" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.
135
- // So we deconstruct "gutters" variable here.
136
- const [gutterH, gutterV] = gutters;
137
- const rowContext = React.useMemo(() => ({
138
- gutter: [gutterH, gutterV],
139
- wrap,
140
- supportFlexGap
141
- }), [gutterH, gutterV, wrap, supportFlexGap]);
142
- return React.createElement(RowContext.Provider, {
143
- value: rowContext
144
- }, React.createElement("div", Object.assign({}, others, {
145
- className: classes,
146
- style: Object.assign(Object.assign({}, rowStyle), style),
147
- ref: ref
148
- }), children));
149
- });
150
- if (process.env.NODE_ENV !== 'production') {
151
- Row.displayName = 'Row';
152
- }
153
- export default Row;
@@ -1 +0,0 @@
1
- {"version":3,"file":"row.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/row.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAEjE,OAAO,iBAAiB,EAAE,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,SAAS,GAAG,KAAK,CAAC,KA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Ac,CAAC;QACpC,QAAQ,CAAC,YAAY,GAAG,cAAc,CAAC;KACxC;IAED,2FAA2F;IAC3F,6CAA6C;IAC7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAqB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAChF,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,CACzC,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU;QACpC,6CAAS,MAAM,IAAE,SAAS,EAAE,OAAO,EAAE,KAAK,kCAAO,QAAQ,GAAK,KAAK,GAAI,GAAG,EAAE,GAAG,KAC5E,QAAQ,CACL,CACc,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;CACzB;AAED,eAAe,GAAG,CAAC","sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\nimport { ConfigContext } from '../_util/context'\nimport useFlexGapSupport from '../_util/hooks/useFlexGapSupport';\nimport type { Breakpoint, ScreenMap } from '../_util/responsiveObserve';\nimport ResponsiveObserve, { responsiveArray } from '../_util/responsiveObserve';\nimport { tuple } from '../_util/type';\nimport RowContext from './RowContext';\n\nconst RowAligns = tuple('top', 'middle', 'bottom', 'stretch');\nconst RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between', 'space-evenly');\n\ntype Responsive = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';\ntype ResponsiveLike<T> = {\n [key in Responsive]?: T;\n};\n\ntype Gap = number | undefined;\nexport type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;\n\ntype ResponsiveAligns = ResponsiveLike<typeof RowAligns[number]>;\ntype ResponsiveJustify = ResponsiveLike<typeof RowJustify[number]>;\nexport interface RowProps extends React.HTMLAttributes<HTMLDivElement> {\n gutter?: Gutter | [Gutter, Gutter];\n align?: typeof RowAligns[number] | ResponsiveAligns;\n justify?: typeof RowJustify[number] | ResponsiveJustify;\n prefixCls?: string;\n wrap?: boolean;\n}\n\nfunction useMergePropByScreen(oriProp: RowProps['align'] | RowProps['justify'], screen: ScreenMap) {\n const [prop, setProp] = React.useState(typeof oriProp === 'string' ? oriProp : '');\n\n const clacMergeAlignOrJustify = () => {\n if (typeof oriProp === 'string') {\n setProp(oriProp);\n }\n if (typeof oriProp !== 'object') {\n return;\n }\n for (let i = 0; i < responsiveArray.length; i++) {\n const breakpoint: Breakpoint = responsiveArray[i];\n // if do not match, do nothing\n if (!screen[breakpoint]) continue;\n const curVal = oriProp[breakpoint];\n if (curVal !== undefined) {\n setProp(curVal);\n return;\n }\n }\n };\n\n React.useEffect(() => {\n clacMergeAlignOrJustify();\n }, [JSON.stringify(oriProp), screen]);\n\n return prop;\n}\n\nconst Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {\n const {\n prefixCls: customizePrefixCls='tnt-row',\n justify,\n align,\n className,\n style,\n children,\n gutter = 0,\n wrap,\n ...others\n } = props;\n\n const { getPrefixCls, direction } = React.useContext(ConfigContext);\n\n const [screens, setScreens] = React.useState<ScreenMap>({\n xs: true,\n sm: true,\n md: true,\n lg: true,\n xl: true,\n xxl: true,\n });\n // to save screens info when responsiveObserve callback had been call\n const [curScreens, setCurScreens] = React.useState<ScreenMap>({\n xs: false,\n sm: false,\n md: false,\n lg: false,\n xl: false,\n xxl: false,\n });\n\n // ================================== calc reponsive data ==================================\n const mergeAlign = useMergePropByScreen(align, curScreens);\n\n const mergeJustify = useMergePropByScreen(justify, curScreens);\n\n const supportFlexGap = useFlexGapSupport();\n\n const gutterRef = React.useRef<Gutter | [Gutter, Gutter]>(gutter);\n\n // ================================== Effect ==================================\n React.useEffect(() => {\n const token = ResponsiveObserve.subscribe(screen => {\n setCurScreens(screen);\n const currentGutter = gutterRef.current || 0;\n if (\n (!Array.isArray(currentGutter) && typeof currentGutter === 'object') ||\n (Array.isArray(currentGutter) &&\n (typeof currentGutter[0] === 'object' || typeof currentGutter[1] === 'object'))\n ) {\n setScreens(screen);\n }\n });\n return () => ResponsiveObserve.unsubscribe(token);\n }, []);\n\n // ================================== Render ==================================\n const getGutter = (): [Gap, Gap] => {\n const results: [Gap, Gap] = [undefined, undefined];\n const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];\n normalizedGutter.forEach((g, index) => {\n if (typeof g === 'object') {\n for (let i = 0; i < responsiveArray.length; i++) {\n const breakpoint: Breakpoint = responsiveArray[i];\n if (screens[breakpoint] && g[breakpoint] !== undefined) {\n results[index] = g[breakpoint] as number;\n break;\n }\n }\n } else {\n results[index] = g;\n }\n });\n return results;\n };\n\n const prefixCls = getPrefixCls('row', customizePrefixCls);\n const gutters = getGutter();\n const classes = classNames(\n prefixCls,\n {\n [`${prefixCls}-no-wrap`]: wrap === false,\n [`${prefixCls}-${mergeJustify}`]: mergeJustify,\n [`${prefixCls}-${mergeAlign}`]: mergeAlign,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n },\n className,\n );\n\n // Add gutter related style\n const rowStyle: React.CSSProperties = {};\n const horizontalGutter = gutters[0] != null && gutters[0] > 0 ? gutters[0] / -2 : undefined;\n const verticalGutter = gutters[1] != null && gutters[1] > 0 ? gutters[1] / -2 : undefined;\n\n if (horizontalGutter) {\n rowStyle.marginLeft = horizontalGutter;\n rowStyle.marginRight = horizontalGutter;\n }\n\n if (supportFlexGap) {\n // Set gap direct if flex gap support\n [, rowStyle.rowGap] = gutters;\n } else if (verticalGutter) {\n rowStyle.marginTop = verticalGutter;\n rowStyle.marginBottom = verticalGutter;\n }\n\n // \"gutters\" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.\n // So we deconstruct \"gutters\" variable here.\n const [gutterH, gutterV] = gutters;\n const rowContext = React.useMemo(\n () => ({ gutter: [gutterH, gutterV] as [number, number], wrap, supportFlexGap }),\n [gutterH, gutterV, wrap, supportFlexGap],\n );\n\n return (\n <RowContext.Provider value={rowContext}>\n <div {...others} className={classes} style={{ ...rowStyle, ...style }} ref={ref}>\n {children}\n </div>\n </RowContext.Provider>\n );\n});\n\nif (process.env.NODE_ENV !== 'production') {\n Row.displayName = 'Row';\n}\n\nexport default Row;\n"]}
@@ -1,2 +0,0 @@
1
- import '../../style/index.less';
2
- import './index.less';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tntd-form/grid/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC","sourcesContent":["import '../../style/index.less';\nimport './index.less';\n"]}