tntd 2.7.32 → 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.
- package/es/form/form.js +2 -2
- package/es/form/form.js.map +1 -1
- package/es/icon/IconFont.js +52 -0
- package/es/icon/IconFont.js.map +1 -0
- package/es/icon/components/Icon.js +106 -0
- package/es/icon/components/Icon.js.map +1 -0
- package/es/icon/components/index.js +1 -0
- package/es/icon/components/index.js.map +1 -0
- package/es/icon/components/utils.js +79 -0
- package/es/icon/components/utils.js.map +1 -0
- package/es/icon/index.js +114 -3
- package/es/icon/index.js.map +1 -1
- package/es/icon/twoTonePrimaryColor.js +10 -0
- package/es/icon/twoTonePrimaryColor.js.map +1 -0
- package/es/icon/utils.js +64 -0
- package/es/icon/utils.js.map +1 -0
- package/lib/form/form.js +2 -2
- package/lib/form/form.js.map +1 -1
- package/lib/icon/IconFont.d.ts +10 -0
- package/lib/icon/IconFont.d.ts.map +1 -0
- package/lib/icon/IconFont.js +62 -0
- package/lib/icon/IconFont.js.map +1 -0
- package/lib/icon/components/Icon.d.ts +31 -0
- package/lib/icon/components/Icon.d.ts.map +1 -0
- package/lib/icon/components/Icon.js +149 -0
- package/lib/icon/components/Icon.js.map +1 -0
- package/lib/icon/components/index.d.ts +2 -0
- package/lib/icon/components/index.d.ts.map +1 -0
- package/lib/icon/components/index.js +13 -0
- package/lib/icon/components/index.js.map +1 -0
- package/lib/icon/components/utils.d.ts +22 -0
- package/lib/icon/components/utils.d.ts.map +1 -0
- package/lib/icon/components/utils.js +120 -0
- package/lib/icon/components/utils.js.map +1 -0
- package/lib/icon/index.d.ts +45 -3
- package/lib/icon/index.d.ts.map +1 -1
- package/lib/icon/index.js +121 -15
- package/lib/icon/index.js.map +1 -1
- package/lib/icon/twoTonePrimaryColor.d.ts +3 -0
- package/lib/icon/twoTonePrimaryColor.d.ts.map +1 -0
- package/lib/icon/twoTonePrimaryColor.js +18 -0
- package/lib/icon/twoTonePrimaryColor.js.map +1 -0
- package/lib/icon/utils.d.ts +13 -0
- package/lib/icon/utils.d.ts.map +1 -0
- package/lib/icon/utils.js +76 -0
- package/lib/icon/utils.js.map +1 -0
- package/lib/segmented/index.d.ts +1 -1
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading.d.ts +1 -1
- package/package.json +106 -105
- package/es/tntd-form/_util/context.js +0 -12
- package/es/tntd-form/_util/context.js.map +0 -1
- package/es/tntd-form/_util/defaultRenderEmpty.js +0 -31
- package/es/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
- package/es/tntd-form/_util/hooks/useFlexGapSupport.js +0 -9
- package/es/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
- package/es/tntd-form/_util/hooks/useForceUpdate.js +0 -5
- package/es/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
- package/es/tntd-form/_util/motion.js +0 -47
- package/es/tntd-form/_util/motion.js.map +0 -1
- package/es/tntd-form/_util/reactNode.js +0 -16
- package/es/tntd-form/_util/reactNode.js.map +0 -1
- package/es/tntd-form/_util/responsiveObserve.js +0 -59
- package/es/tntd-form/_util/responsiveObserve.js.map +0 -1
- package/es/tntd-form/_util/scrollTo.js +0 -35
- package/es/tntd-form/_util/scrollTo.js.map +0 -1
- package/es/tntd-form/_util/styleChecker.js +0 -26
- package/es/tntd-form/_util/styleChecker.js.map +0 -1
- package/es/tntd-form/_util/type.js +0 -3
- package/es/tntd-form/_util/type.js.map +0 -1
- package/es/tntd-form/_util/warning.js +0 -5
- package/es/tntd-form/_util/warning.js.map +0 -1
- package/es/tntd-form/_util/wave.js +0 -168
- package/es/tntd-form/_util/wave.js.map +0 -1
- package/es/tntd-form/grid/RowContext.js +0 -3
- package/es/tntd-form/grid/RowContext.js.map +0 -1
- package/es/tntd-form/grid/col.js +0 -104
- package/es/tntd-form/grid/col.js.map +0 -1
- package/es/tntd-form/grid/hooks/useBreakpoint.js +0 -18
- package/es/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
- package/es/tntd-form/grid/index.js +0 -14
- package/es/tntd-form/grid/index.js.map +0 -1
- package/es/tntd-form/grid/row.js +0 -153
- package/es/tntd-form/grid/row.js.map +0 -1
- package/es/tntd-form/grid/style/index.js +0 -2
- package/es/tntd-form/grid/style/index.js.map +0 -1
- package/es/tntd-form/tntd-form.stories.js +0 -836
- package/es/tntd-form/tntd-form.stories.js.map +0 -1
- package/lib/tntd-form/_util/context.d.ts +0 -42
- package/lib/tntd-form/_util/context.d.ts.map +0 -1
- package/lib/tntd-form/_util/context.js +0 -22
- package/lib/tntd-form/_util/context.js.map +0 -1
- package/lib/tntd-form/_util/defaultRenderEmpty.d.ts +0 -5
- package/lib/tntd-form/_util/defaultRenderEmpty.d.ts.map +0 -1
- package/lib/tntd-form/_util/defaultRenderEmpty.js +0 -44
- package/lib/tntd-form/_util/defaultRenderEmpty.js.map +0 -1
- package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts +0 -3
- package/lib/tntd-form/_util/hooks/useFlexGapSupport.d.ts.map +0 -1
- package/lib/tntd-form/_util/hooks/useFlexGapSupport.js +0 -28
- package/lib/tntd-form/_util/hooks/useFlexGapSupport.js.map +0 -1
- package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts +0 -3
- package/lib/tntd-form/_util/hooks/useForceUpdate.d.ts.map +0 -1
- package/lib/tntd-form/_util/hooks/useForceUpdate.js +0 -24
- package/lib/tntd-form/_util/hooks/useForceUpdate.js.map +0 -1
- package/lib/tntd-form/_util/motion.d.ts +0 -9
- package/lib/tntd-form/_util/motion.d.ts.map +0 -1
- package/lib/tntd-form/_util/motion.js +0 -59
- package/lib/tntd-form/_util/motion.js.map +0 -1
- package/lib/tntd-form/_util/reactNode.d.ts +0 -9
- package/lib/tntd-form/_util/reactNode.d.ts.map +0 -1
- package/lib/tntd-form/_util/reactNode.js +0 -27
- package/lib/tntd-form/_util/reactNode.js.map +0 -1
- package/lib/tntd-form/_util/responsiveObserve.d.ts +0 -22
- package/lib/tntd-form/_util/responsiveObserve.d.ts.map +0 -1
- package/lib/tntd-form/_util/responsiveObserve.js +0 -73
- package/lib/tntd-form/_util/responsiveObserve.js.map +0 -1
- package/lib/tntd-form/_util/scrollTo.d.ts +0 -1
- package/lib/tntd-form/_util/scrollTo.d.ts.map +0 -1
- package/lib/tntd-form/_util/scrollTo.js +0 -35
- package/lib/tntd-form/_util/scrollTo.js.map +0 -1
- package/lib/tntd-form/_util/styleChecker.d.ts +0 -5
- package/lib/tntd-form/_util/styleChecker.d.ts.map +0 -1
- package/lib/tntd-form/_util/styleChecker.js +0 -42
- package/lib/tntd-form/_util/styleChecker.js.map +0 -1
- package/lib/tntd-form/_util/type.d.ts +0 -4
- package/lib/tntd-form/_util/type.d.ts.map +0 -1
- package/lib/tntd-form/_util/type.js +0 -21
- package/lib/tntd-form/_util/type.js.map +0 -1
- package/lib/tntd-form/_util/warning.d.ts +0 -5
- package/lib/tntd-form/_util/warning.d.ts.map +0 -1
- package/lib/tntd-form/_util/warning.js +0 -20
- package/lib/tntd-form/_util/warning.js.map +0 -1
- package/lib/tntd-form/_util/wave.d.ts +0 -1
- package/lib/tntd-form/_util/wave.d.ts.map +0 -1
- package/lib/tntd-form/_util/wave.js +0 -168
- package/lib/tntd-form/_util/wave.js.map +0 -1
- package/lib/tntd-form/grid/RowContext.d.ts +0 -9
- package/lib/tntd-form/grid/RowContext.d.ts.map +0 -1
- package/lib/tntd-form/grid/RowContext.js +0 -10
- package/lib/tntd-form/grid/RowContext.js.map +0 -1
- package/lib/tntd-form/grid/col.d.ts +0 -29
- package/lib/tntd-form/grid/col.d.ts.map +0 -1
- package/lib/tntd-form/grid/col.js +0 -105
- package/lib/tntd-form/grid/col.js.map +0 -1
- package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts +0 -4
- package/lib/tntd-form/grid/hooks/useBreakpoint.d.ts.map +0 -1
- package/lib/tntd-form/grid/hooks/useBreakpoint.js +0 -29
- package/lib/tntd-form/grid/hooks/useBreakpoint.js.map +0 -1
- package/lib/tntd-form/grid/index.d.ts +0 -12
- package/lib/tntd-form/grid/index.d.ts.map +0 -1
- package/lib/tntd-form/grid/index.js +0 -31
- package/lib/tntd-form/grid/index.js.map +0 -1
- package/lib/tntd-form/grid/row.d.ts +0 -21
- package/lib/tntd-form/grid/row.d.ts.map +0 -1
- package/lib/tntd-form/grid/row.js +0 -186
- package/lib/tntd-form/grid/row.js.map +0 -1
- package/lib/tntd-form/grid/style/index.d.ts +0 -3
- package/lib/tntd-form/grid/style/index.d.ts.map +0 -1
- package/lib/tntd-form/grid/style/index.js +0 -4
- package/lib/tntd-form/grid/style/index.js.map +0 -1
- package/lib/tntd-form/tntd-form.stories.d.ts +0 -33
- package/lib/tntd-form/tntd-form.stories.d.ts.map +0 -1
- package/lib/tntd-form/tntd-form.stories.js +0 -943
- package/lib/tntd-form/tntd-form.stories.js.map +0 -1
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// import * as React from 'react'
|
|
4
|
-
// import { findDOMNode } from 'react-dom'
|
|
5
|
-
// import TransitionEvents from 'css-animation/lib/Event'
|
|
6
|
-
// import raf from './raf'
|
|
7
|
-
// import { ConfigConsumer, ConfigConsumerProps, CSPConfig } from '../../config-provider'
|
|
8
|
-
// let styleForPesudo: HTMLStyleElement | null
|
|
9
|
-
// // Where el is the DOM element you'd like to test for visibility
|
|
10
|
-
// function isHidden(element: HTMLElement) {
|
|
11
|
-
// if (process.env.NODE_ENV === 'test') {
|
|
12
|
-
// return false
|
|
13
|
-
// }
|
|
14
|
-
// return !element || element.offsetParent === null
|
|
15
|
-
// }
|
|
16
|
-
// function isNotGrey(color: string) {
|
|
17
|
-
// // eslint-disable-next-line no-useless-escape
|
|
18
|
-
// const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/)
|
|
19
|
-
// if (match && match[1] && match[2] && match[3]) {
|
|
20
|
-
// return !(match[1] === match[2] && match[2] === match[3])
|
|
21
|
-
// }
|
|
22
|
-
// return true
|
|
23
|
-
// }
|
|
24
|
-
// export default class Wave extends React.Component<{ insertExtraNode?: boolean }> {
|
|
25
|
-
// private instance?: {
|
|
26
|
-
// cancel: () => void
|
|
27
|
-
// }
|
|
28
|
-
// private extraNode: HTMLDivElement
|
|
29
|
-
// private clickWaveTimeoutId: number
|
|
30
|
-
// private animationStartId: number
|
|
31
|
-
// private animationStart: boolean = false
|
|
32
|
-
// private destroy: boolean = false
|
|
33
|
-
// private csp?: CSPConfig
|
|
34
|
-
// componentDidMount() {
|
|
35
|
-
// const node = findDOMNode(this) as HTMLElement
|
|
36
|
-
// if (!node || node.nodeType !== 1) {
|
|
37
|
-
// return
|
|
38
|
-
// }
|
|
39
|
-
// this.instance = this.bindAnimationEvent(node)
|
|
40
|
-
// }
|
|
41
|
-
// componentWillUnmount() {
|
|
42
|
-
// if (this.instance) {
|
|
43
|
-
// this.instance.cancel()
|
|
44
|
-
// }
|
|
45
|
-
// if (this.clickWaveTimeoutId) {
|
|
46
|
-
// clearTimeout(this.clickWaveTimeoutId)
|
|
47
|
-
// }
|
|
48
|
-
// this.destroy = true
|
|
49
|
-
// }
|
|
50
|
-
// onClick = (node: HTMLElement, waveColor: string) => {
|
|
51
|
-
// if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {
|
|
52
|
-
// return
|
|
53
|
-
// }
|
|
54
|
-
// const { insertExtraNode } = this.props
|
|
55
|
-
// this.extraNode = document.createElement('div')
|
|
56
|
-
// const { extraNode } = this
|
|
57
|
-
// extraNode.className = 'ant-click-animating-node'
|
|
58
|
-
// const attributeName = this.getAttributeName()
|
|
59
|
-
// node.setAttribute(attributeName, 'true')
|
|
60
|
-
// // Not white or transparnt or grey
|
|
61
|
-
// styleForPesudo = styleForPesudo || document.createElement('style')
|
|
62
|
-
// if (
|
|
63
|
-
// waveColor &&
|
|
64
|
-
// waveColor !== '#ffffff' &&
|
|
65
|
-
// waveColor !== 'rgb(255, 255, 255)' &&
|
|
66
|
-
// isNotGrey(waveColor) &&
|
|
67
|
-
// !/rgba\(\d*, \d*, \d*, 0\)/.test(waveColor) && // any transparent rgba color
|
|
68
|
-
// waveColor !== 'transparent'
|
|
69
|
-
// ) {
|
|
70
|
-
// // Add nonce if CSP exist
|
|
71
|
-
// if (this.csp && this.csp.nonce) {
|
|
72
|
-
// styleForPesudo.nonce = this.csp.nonce
|
|
73
|
-
// }
|
|
74
|
-
// extraNode.style.borderColor = waveColor
|
|
75
|
-
// styleForPesudo.innerHTML = `
|
|
76
|
-
// [ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {
|
|
77
|
-
// --antd-wave-shadow-color: ${waveColor};
|
|
78
|
-
// }`
|
|
79
|
-
// if (!document.body.contains(styleForPesudo)) {
|
|
80
|
-
// document.body.appendChild(styleForPesudo)
|
|
81
|
-
// }
|
|
82
|
-
// }
|
|
83
|
-
// if (insertExtraNode) {
|
|
84
|
-
// node.appendChild(extraNode)
|
|
85
|
-
// }
|
|
86
|
-
// TransitionEvents.addStartEventListener(node, this.onTransitionStart)
|
|
87
|
-
// TransitionEvents.addEndEventListener(node, this.onTransitionEnd)
|
|
88
|
-
// }
|
|
89
|
-
// onTransitionStart = (e: AnimationEvent) => {
|
|
90
|
-
// if (this.destroy) return
|
|
91
|
-
// const node = findDOMNode(this) as HTMLElement
|
|
92
|
-
// if (!e || e.target !== node) {
|
|
93
|
-
// return
|
|
94
|
-
// }
|
|
95
|
-
// if (!this.animationStart) {
|
|
96
|
-
// this.resetEffect(node)
|
|
97
|
-
// }
|
|
98
|
-
// }
|
|
99
|
-
// onTransitionEnd = (e: AnimationEvent) => {
|
|
100
|
-
// if (!e || e.animationName !== 'fadeEffect') {
|
|
101
|
-
// return
|
|
102
|
-
// }
|
|
103
|
-
// this.resetEffect(e.target as HTMLElement)
|
|
104
|
-
// }
|
|
105
|
-
// getAttributeName() {
|
|
106
|
-
// const { insertExtraNode } = this.props
|
|
107
|
-
// return insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node'
|
|
108
|
-
// }
|
|
109
|
-
// bindAnimationEvent = (node: HTMLElement) => {
|
|
110
|
-
// if (
|
|
111
|
-
// !node ||
|
|
112
|
-
// !node.getAttribute ||
|
|
113
|
-
// node.getAttribute('disabled') ||
|
|
114
|
-
// node.className.indexOf('disabled') >= 0
|
|
115
|
-
// ) {
|
|
116
|
-
// return
|
|
117
|
-
// }
|
|
118
|
-
// const onClick = (e: MouseEvent) => {
|
|
119
|
-
// // Fix radio button click twice
|
|
120
|
-
// if ((e.target as HTMLElement).tagName === 'INPUT' || isHidden(e.target as HTMLElement)) {
|
|
121
|
-
// return
|
|
122
|
-
// }
|
|
123
|
-
// this.resetEffect(node)
|
|
124
|
-
// // Get wave color from target
|
|
125
|
-
// const waveColor =
|
|
126
|
-
// getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible
|
|
127
|
-
// getComputedStyle(node).getPropertyValue('border-color') ||
|
|
128
|
-
// getComputedStyle(node).getPropertyValue('background-color')
|
|
129
|
-
// this.clickWaveTimeoutId = window.setTimeout(() => this.onClick(node, waveColor), 0)
|
|
130
|
-
// raf.cancel(this.animationStartId)
|
|
131
|
-
// this.animationStart = true
|
|
132
|
-
// // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.
|
|
133
|
-
// this.animationStartId = raf(() => {
|
|
134
|
-
// this.animationStart = false
|
|
135
|
-
// }, 10)
|
|
136
|
-
// }
|
|
137
|
-
// node.addEventListener('click', onClick, true)
|
|
138
|
-
// return {
|
|
139
|
-
// cancel: () => {
|
|
140
|
-
// node.removeEventListener('click', onClick, true)
|
|
141
|
-
// },
|
|
142
|
-
// }
|
|
143
|
-
// }
|
|
144
|
-
// resetEffect(node: HTMLElement) {
|
|
145
|
-
// if (!node || node === this.extraNode || !(node instanceof Element)) {
|
|
146
|
-
// return
|
|
147
|
-
// }
|
|
148
|
-
// const { insertExtraNode } = this.props
|
|
149
|
-
// const attributeName = this.getAttributeName()
|
|
150
|
-
// node.setAttribute(attributeName, 'false') // edge has bug on `removeAttribute` #14466
|
|
151
|
-
// if (styleForPesudo) {
|
|
152
|
-
// styleForPesudo.innerHTML = ''
|
|
153
|
-
// }
|
|
154
|
-
// if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {
|
|
155
|
-
// node.removeChild(this.extraNode)
|
|
156
|
-
// }
|
|
157
|
-
// TransitionEvents.removeStartEventListener(node, this.onTransitionStart)
|
|
158
|
-
// TransitionEvents.removeEndEventListener(node, this.onTransitionEnd)
|
|
159
|
-
// }
|
|
160
|
-
// renderWave = ({ csp }: ConfigConsumerProps) => {
|
|
161
|
-
// const { children } = this.props
|
|
162
|
-
// this.csp = csp
|
|
163
|
-
// return children
|
|
164
|
-
// }
|
|
165
|
-
// render() {
|
|
166
|
-
// return <ConfigConsumer>{this.renderWave}</ConfigConsumer>
|
|
167
|
-
// }
|
|
168
|
-
// }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wave.js","sourceRoot":"","sources":["../../../src/tntd-form/_util/wave.tsx"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,0CAA0C;AAC1C,yDAAyD;AACzD,0BAA0B;AAC1B,yFAAyF;AAEzF,8CAA8C;AAE9C,mEAAmE;AACnE,4CAA4C;AAC5C,2CAA2C;AAC3C,mBAAmB;AACnB,MAAM;AACN,qDAAqD;AACrD,IAAI;AAEJ,sCAAsC;AACtC,kD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;AACzB,6CAA6C;AAC7C,gGAAgG;AAChG,MAAM;AAEN,kDAAkD;AAClD,WAAW;AACX,iBAAiB;AACjB,8BAA8B;AAC9B,yCAAyC;AACzC,gDAAgD;AAChD,UAAU;AACV,eAAe;AACf,QAAQ;AACR,2CAA2C;AAC3C,wCAAwC;AACxC,kGAAkG;AAClG,iBAAiB;AACjB,UAAU;AACV,+BAA+B;AAC/B,sCAAsC;AACtC,0BAA0B;AAC1B,+FAA+F;AAC/F,qEAAqE;AACrE,sEAAsE;AACtE,4FAA4F;AAE5F,0CAA0C;AAC1C,mCAAmC;AAEnC,kGAAkG;AAClG,4CAA4C;AAC5C,sCAAsC;AACtC,eAAe;AACf,QAAQ;AACR,oDAAoD;AACpD,eAAe;AACf,wBAAwB;AACxB,2DAA2D;AAC3D,WAAW;AACX,QAAQ;AACR,MAAM;AAEN,qCAAqC;AACrC,4EAA4E;AAC5E,eAAe;AACf,QAAQ;AACR,6CAA6C;AAC7C,oDAAoD;AACpD,4FAA4F;AAE5F,4BAA4B;AAC5B,sCAAsC;AACtC,QAAQ;AAER,gFAAgF;AAChF,yCAAyC;AACzC,QAAQ;AACR,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM;AAEN,qDAAqD;AACrD,sCAAsC;AACtC,qBAAqB;AAErB,sBAAsB;AACtB,MAAM;AAEN,eAAe;AACf,gEAAgE;AAChE,MAAM;AACN,IAAI","sourcesContent":["// import * as React from 'react'\n// import { findDOMNode } from 'react-dom'\n// import TransitionEvents from 'css-animation/lib/Event'\n// import raf from './raf'\n// import { ConfigConsumer, ConfigConsumerProps, CSPConfig } from '../../config-provider'\n\n// let styleForPesudo: HTMLStyleElement | null\n\n// // Where el is the DOM element you'd like to test for visibility\n// function isHidden(element: HTMLElement) {\n// if (process.env.NODE_ENV === 'test') {\n// return false\n// }\n// return !element || element.offsetParent === null\n// }\n\n// function isNotGrey(color: string) {\n// // eslint-disable-next-line no-useless-escape\n// const match = (color || '').match(/rgba?\\((\\d*), (\\d*), (\\d*)(, [\\.\\d]*)?\\)/)\n// if (match && match[1] && match[2] && match[3]) {\n// return !(match[1] === match[2] && match[2] === match[3])\n// }\n// return true\n// }\n\n// export default class Wave extends React.Component<{ insertExtraNode?: boolean }> {\n// private instance?: {\n// cancel: () => void\n// }\n\n// private extraNode: HTMLDivElement\n\n// private clickWaveTimeoutId: number\n\n// private animationStartId: number\n\n// private animationStart: boolean = false\n\n// private destroy: boolean = false\n\n// private csp?: CSPConfig\n\n// componentDidMount() {\n// const node = findDOMNode(this) as HTMLElement\n// if (!node || node.nodeType !== 1) {\n// return\n// }\n// this.instance = this.bindAnimationEvent(node)\n// }\n\n// componentWillUnmount() {\n// if (this.instance) {\n// this.instance.cancel()\n// }\n// if (this.clickWaveTimeoutId) {\n// clearTimeout(this.clickWaveTimeoutId)\n// }\n\n// this.destroy = true\n// }\n\n// onClick = (node: HTMLElement, waveColor: string) => {\n// if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {\n// return\n// }\n// const { insertExtraNode } = this.props\n// this.extraNode = document.createElement('div')\n// const { extraNode } = this\n// extraNode.className = 'ant-click-animating-node'\n// const attributeName = this.getAttributeName()\n// node.setAttribute(attributeName, 'true')\n// // Not white or transparnt or grey\n// styleForPesudo = styleForPesudo || document.createElement('style')\n// if (\n// waveColor &&\n// waveColor !== '#ffffff' &&\n// waveColor !== 'rgb(255, 255, 255)' &&\n// isNotGrey(waveColor) &&\n// !/rgba\\(\\d*, \\d*, \\d*, 0\\)/.test(waveColor) && // any transparent rgba color\n// waveColor !== 'transparent'\n// ) {\n// // Add nonce if CSP exist\n// if (this.csp && this.csp.nonce) {\n// styleForPesudo.nonce = this.csp.nonce\n// }\n\n// extraNode.style.borderColor = waveColor\n// styleForPesudo.innerHTML = `\n// [ant-click-animating-without-extra-node='true']::after, .ant-click-animating-node {\n// --antd-wave-shadow-color: ${waveColor};\n// }`\n// if (!document.body.contains(styleForPesudo)) {\n// document.body.appendChild(styleForPesudo)\n// }\n// }\n// if (insertExtraNode) {\n// node.appendChild(extraNode)\n// }\n// TransitionEvents.addStartEventListener(node, this.onTransitionStart)\n// TransitionEvents.addEndEventListener(node, this.onTransitionEnd)\n// }\n\n// onTransitionStart = (e: AnimationEvent) => {\n// if (this.destroy) return\n\n// const node = findDOMNode(this) as HTMLElement\n// if (!e || e.target !== node) {\n// return\n// }\n\n// if (!this.animationStart) {\n// this.resetEffect(node)\n// }\n// }\n\n// onTransitionEnd = (e: AnimationEvent) => {\n// if (!e || e.animationName !== 'fadeEffect') {\n// return\n// }\n// this.resetEffect(e.target as HTMLElement)\n// }\n\n// getAttributeName() {\n// const { insertExtraNode } = this.props\n// return insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node'\n// }\n\n// bindAnimationEvent = (node: HTMLElement) => {\n// if (\n// !node ||\n// !node.getAttribute ||\n// node.getAttribute('disabled') ||\n// node.className.indexOf('disabled') >= 0\n// ) {\n// return\n// }\n// const onClick = (e: MouseEvent) => {\n// // Fix radio button click twice\n// if ((e.target as HTMLElement).tagName === 'INPUT' || isHidden(e.target as HTMLElement)) {\n// return\n// }\n// this.resetEffect(node)\n// // Get wave color from target\n// const waveColor =\n// getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible\n// getComputedStyle(node).getPropertyValue('border-color') ||\n// getComputedStyle(node).getPropertyValue('background-color')\n// this.clickWaveTimeoutId = window.setTimeout(() => this.onClick(node, waveColor), 0)\n\n// raf.cancel(this.animationStartId)\n// this.animationStart = true\n\n// // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.\n// this.animationStartId = raf(() => {\n// this.animationStart = false\n// }, 10)\n// }\n// node.addEventListener('click', onClick, true)\n// return {\n// cancel: () => {\n// node.removeEventListener('click', onClick, true)\n// },\n// }\n// }\n\n// resetEffect(node: HTMLElement) {\n// if (!node || node === this.extraNode || !(node instanceof Element)) {\n// return\n// }\n// const { insertExtraNode } = this.props\n// const attributeName = this.getAttributeName()\n// node.setAttribute(attributeName, 'false') // edge has bug on `removeAttribute` #14466\n\n// if (styleForPesudo) {\n// styleForPesudo.innerHTML = ''\n// }\n\n// if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {\n// node.removeChild(this.extraNode)\n// }\n// TransitionEvents.removeStartEventListener(node, this.onTransitionStart)\n// TransitionEvents.removeEndEventListener(node, this.onTransitionEnd)\n// }\n\n// renderWave = ({ csp }: ConfigConsumerProps) => {\n// const { children } = this.props\n// this.csp = csp\n\n// return children\n// }\n\n// render() {\n// return <ConfigConsumer>{this.renderWave}</ConfigConsumer>\n// }\n// }\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RowContext.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/RowContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,UAAU,GAA6B,aAAa,CAAC,EAAE,CAAC,CAAC;AAE/D,eAAe,UAAU,CAAC","sourcesContent":["import type { Context } from 'react';\nimport { createContext } from 'react';\n\nexport interface RowContextState {\n gutter?: [number, number];\n wrap?: boolean;\n supportFlexGap?: boolean;\n}\n\nconst RowContext: Context<RowContextState> = createContext({});\n\nexport default RowContext;\n"]}
|
package/es/tntd-form/grid/col.js
DELETED
|
@@ -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"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,yDAAyD;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,UAAU,MAAM,cAAc,CAAC;AAgCtC,SAAS,SAAS,CAAC,IAAc;IAC/B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,CAAC;KAC/B;IAED,IAAI,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC3C,OAAO,OAAO,IAAI,EAAE,CAAC;KACtB;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AACD,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAC7D,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACpE,MAAM,EAAE,MAA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c,CAAC;KAC5C;IAED,IAAI,IAAI,EAAE;QACR,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAEnC,uCAAuC;QACvC,6EAA6E;QAC7E,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC3C,WAAW,CAAC,QAAQ,GAAG,CAAC,CAAC;SAC1B;KACF;IAED,OAAO,CACL,6CAAS,MAAM,IAAE,KAAK,kCAAO,WAAW,GAAK,KAAK,GAAI,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAC/E,QAAQ,CACL,CACP,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';\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"]}
|
package/es/tntd-form/grid/row.js
DELETED
|
@@ -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,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;AAoBpG,SAAS,oBAAoB,CAAC,OAAgD,EAAE,MAAiB;IAC/F,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,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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 +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"]}
|