Parse or format dates
Omit<IInputProps, ...>
无法得到正确的类型提示,因此每个类型单独Omit一次再联合
This is a modified version from underscore. https://github.com/jashkenas/underscore/blob/master/underscore.js
With some differences:
Similar to invariant but only logs a warning if the condition is not met. This can be used to log issues in development environments in critical paths. Removing the logging code for production environments will keep the same logic and follow the same code paths.
getDocumentClientSize
inlined Object.is polyfill to avoid requiring consumers ship their own https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
Support style names that may come passed in prefixed by adding permutations of vendor prefixes.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
根据 name
订阅 FieldSet
的值
根据 name
或者 model
订阅字段的更新
Old Select
implementation is a disaster,
temporary dirty code.
通用上传组件上传项
通用上传组件上传项
Highlights all occurrences of search terms (searchText) within a string (textToHighlight). This function returns an array of strings and s (wrapping highlighted words).
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
如果传入为数字,返回值也为数字 如果传入为 Date 的实例,返回值也为 Date 的实例 默认返回 format 格式的字符串
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Register a resize event on Window
The event handler got a second parameter: {deltaX, deltaY}.
The onResize
callback is throttled to run only once in a frame, you don't need to throttle the callback.
Register a scroll event on Window.
onScroll
is throttled to run only once in a frame, you don't have to throttle you callback.
创建一个 FieldArray
builder
数组元素的 builder 对象,可以是 field
、array
或者 set
的返回值
为满足动画的无缝衔接 在原子节点后增加第一个子节点
关闭所有notify
关闭notify
notify容器Id
执行notify结束callback
关闭notify回调
Takes an array of chunks and combines chunks that overlap into single chunks.
```tsx
function when
const validator = compose(when(() => Math.random() > 0.5))(required('required if random number great then 5'));
A number representing offset
converted into pixels.
Converts a hex value to a decimal
用于向上向下查找关联节点
创建一个异步校验函数
异步校验函数的实现
Creates an instance of the element for the specified tag.
The name of an element.
创建承载notify portal的容器
Create a new placement.
(anchorBoundingBox, containerBoundingBox, contentDimension, options) => { name, getCSSStyle }
根据props生成初始 state
创建一个唯一 Id
Convert a value into the proper css writable value. The style name name
should be logical (no hyphens), as specified
in CSSProperty.isUnitlessNumber
.
CSS property name such as topMargin
.
CSS property value such as 10px
.
Normalized style value with dimensions applied.
Returns a function, that, as long as it continues to be invoked, will not be triggered.
The function will be called after it stops being called for wait
milliseconds
Examine text for any matches. If we find matches, add them to the returned array as a "chunk" object.
默认获取缩略图方法
默认点击图片时的放大预览方法,排除上传失败的图片
returns result of applying ease math function to a number
限制一个值是合法的 email 地址,规则和 Angular 使用的一致
错误信息
Generate a unique key for any set of event options
A high order component to expose imperative APIs for popover.
Adds a popover prop to component.
创建一个 Field
builder
Field
的默认值
Given a set of chunks to highlight, create an additional set of chunks to represent the bits of text between the highlighted text.
Creates an array of chunk objects representing both highlightable and non highlightable pieces of text that match each search word.
Find the first positioned ancestor up in the DOM tree.
dom element to search from
true if elem is considered an ancestor of itself
the first positioned ancestor node
Set focus to node
without scroll
创建一个 Form
builder,是最顶层的 builder 对象
Form
每个字段对应的 builder 对象,其值可以是 field
、array
或者 set
的返回值
Format a date
Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
格式化一个 date 对象
The date to format
解析的格式,默认为 'default'
the i18n setting for fecha
date 对象
将文件的Byte转换为可读性更好的G\M\K\B
大小,单位Byte
格式化后的字符串
An object with bounds data for the waypoint and scrollable parent
The current position of the waypoint in relation to the visible portion of the scrollable parent.
如果 props.format 有修改,则使用之,否则检查showSecond,判断是否要显示秒
Like _.get, but only supports objects! You don't need this function 99% of the time.
获取必要的判断数据
rootInfoMap
根据props的children,获取有效的渲染节点
props的子节点
Get current scroll position in page
将一个字符串、数字转化为 Date 的实例
需要转换的值
Date 的实例
获取viewport的宽高
Converts an HSL color value to RGB.
Assumes: h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] Returns: { r, g, b } in the set [0, 255]
Converts an HSV color value to RGB.
Assumes: h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] Returns: { r, g, b } in the set [0, 255]
Hyphenates a camelcased CSS property name, for example:
hyphenateStyleName('backgroundColor') < "background-color" hyphenateStyleName('MozTransition') < "-moz-transition" hyphenateStyleName('msTransition') < "-ms-transition"
As Modernizr suggests (http://modernizr.com/docs/#prefixed), an ms
prefix
is converted to -ms-
.
Given a string or object, convert that input to RGB
Possible string inputs:
"red"
"#f00" or "f00"
"#ff0000" or "ff0000"
"#ff000000" or "ff000000"
"rgb 255 0 0" or "rgb (255, 0, 0)"
"rgb 1.0 0 0" or "rgb (1, 0, 0)"
"rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
"rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
"hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
"hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
"hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
判断一个校验函数是否是异步的,异步的校验函数必须使用 createAsyncValidator
创建
校验函数
When an element's type is a string, it represents a DOM node with that tag name https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html#dom-elements
Whether the component is a DOM Element
This function is non-recursive, and handles cyclic values. It ignores symbol key properties in objects.
Test whether an object looks like a promise
Check to see if it looks like a CSS unit
(see matchers
above for definition).
Tests whether MaybeDerive is a covariant of Base
Show at most 5 pages
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
| anchor | | |
popover |
---|
| anchor | | |
popover |
---|
| anchor | | |
|popover|
---------
popover | anchor |
---|
|--------------------|
----------| | | popover | anchor | |---------| | |--------------------| |--------------------| ----------| | | popover | anchor | |---------|--------------------|
| anchor | popover | | |---------
| |---------- | anchor | popover | | |--------- |--------------------|
| |---------- | anchor | popover | |--------------------|---------
popover |
---|
anchor |
popover |
---|
anchor |
---------
|popover|
| anchor | | |
生成一个默认的onChange
回调,这个回调会触发model.validate
如果不需要在onChange的时候触发校验,如下即可:
const onChange = useCallback(value => model.value = value, [model]);
例如是一个input
:
const onChange = useCallback((value: React.ChangeEvent<HTMLInputElement>) => {
model.value = e.target.value;
}, [model]);
可以配合usePipe使用:
function mapEventToValue(e) {
return e.target.value;
}
function Foo() {
const onChange = FieldUtils.usePipe(
mapEventToValue,
FieldUtils.makeChangeHandler(model),
);
}
获得 YYYY-MM-DD 格式的日期字符串的快捷方法
需要格式化的字符串,兼容字符串、数字和 Date 实例
解析的格式,默认为 'YYYY-MM-DD',方便日常开发
格式化后的日期字符串
获得 YYYY-MM-DD HH:mm:ss 格式的日期字符串的快捷方法
需要格式化的字符串,兼容字符串、数字和 Date 实例
解析的格式,默认为 'YYYY-MM-DD HH:mm:ss',方便日常开发
格式化后的日期字符串
进入状态的识别
离开状态的识别
创建一个新state,每个state是一次性的,识别完成后需要创建一个新的state
state的名称
识别成功时的回调函数
限制一个值的最大值
允许的最大值(包含自身)
错误信息
限制一个值的最大长度,通过 .length
属性判断
允许的最大长度(包含自身)
错误信息
为校验错误设定动态的message
限制一个值的最小值
允许的最小值(包含自身)
错误信息
限制一个值的最小长度,通过 .length
属性判断
允许的最小长度(包含自身)
错误信息
Parse a date string into an object, changes - into /
Date string
Date parse format
解析日期,字符串转化为日期
需要解析的 date,默认应该传入字符串,但对下面两个情况也做了兼容:
解析的格式
the i18n setting for fecha
转化后的日期
Parse a base-16 hex value into a base-10 integer
Attempts to parse the offset provided as a prop as a percentage. For
instance, if the component has been provided with the string "20%" as
a value of one of the offset props. If the value matches, then it returns
a numeric version of the prop. For instance, "20%" would become 0.2
.
If str
isn't a percentage, then undefined
will be returned.
The value of an offset prop to be converted to a number.
The numeric version of str
. Undefined if str
was not a percentage.
Attempts to parse the offset provided as a prop as a pixel value. If
parsing fails, then undefined
is returned. Three examples of values that
will be successfully parsed are:
20
"20px"
"20"
A string of the form "{number}" or "{number}px", or just a number.
The numeric version of str
. Undefined if str
was neither a number nor string ending in "px".
为 upload item 添加 _id 属性
限制一个字符串必须匹配一个正则表达式
要匹配的正则表达式
错误信息
vendor-specific prefix, eg: Webkit
style name, eg: transitionDuration
style name prefixed with prefix
, properly camelCased, eg:
WebkitTransitionDuration
限制一个值不为 null
/undefined
,并且长度不为零
错误信息
限制一个值必须为 true
错误信息
Converts an RGB color to hex
Assumes r, g, and b are contained in the set [0, 255] Returns a 3 or 6 character hex
Converts an RGB color value to HSL. Assumes: r, g, and b are contained in [0, 255] or [0, 1] Returns: { h, s, l } in [0,1]
Converts an RGB color value to HSV
Assumes: r, g, and b are contained in the set [0, 255] or [0, 1] Returns: { h, s, v } in [0,1]
Handle bounds / percentage checking to conform to CSS color spec http://www.w3.org/TR/css3-color/ Assumes: r, g, b in [0, 255] or [0, 1] Returns: { r, g, b } in [0, 255]
Invoke callback
only once in next frame with arguments from the last invocation.
changes scroll position inside an element
创建一个 FieldSet
builder
FieldSet
每个字段对应的 builder 对象,其值可以是 field
、array
或者 set
的返回值
Sets the value for multiple styles on a node. If a value is specified as '' (empty string), the corresponding style property will be unset.
Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between the arguments. Returns true when the values of all keys are strictly equal.
notify显示
显示文案
显示时长
notify状态
notify消失时回调
scrolls element with a smooth behavior
element to scroll
target position x
target position y
animation duration
self invoked function that, given a context, steps through scrolling
Permissive string parsing. Take in a number of formats, and output an object
based on detected format. Returns { r, g, b }
or { h, s, l }
or { h, s, v}
sweet [main function]
[close function returned by openDialog]
这个hook对React返回的状态更新函数(例 如useState、useReducer的返回值)包装 了一层,避免在异步回调中使用时导致可能的 内存泄漏(Async-Safe)
生成一组 onCompositionStart
和 onCompositionEnd
的回调函数,用于跟踪输入法 composition 的状态,
这个状态会写到 model.isCompositing
字段上。
用于记录状态的 model
对象
上层传入的被代理的回调
创建一个 Field
字段名,当 FormStrategy
是 View
的时候才能用字段名
默认值
当 field
是字段名的时候,可以传入validator
创建一个 Field
Field
对应的 model 对象,用于关联 Field
和 model;当 FormStrategy
是 Model
或渲染 FieldArray
的时候才能使用
创建一个 FieldArray
字段名,当 FormStrategy
是 View
的时候才能用字段名
当 field
是字段名的时候,可以传入 validator
默认值
创建一个 FieldArray
FieldArray
对应的 model 对象,用于关联 FieldArray
和 model;当 FormStrategy
是 Model
的时候才能用
根据 name
或者 model
订阅 FieldArray
的更新
创建一个 FieldSet
model 或者字段名,当FormStrategy
是View
的时候才能用字段名
当field
是字段名的时候,可以传入validator
创建一个 Form
指定一个 builder 对象来显式构造表单数据,或者指定 FormStrategy.View
自动根据视图构造表单数据
为 model 设置初始值,初始值会被作为 effect 的依赖,谨慎使用字面量
返回一个ref对象,其中存放的值会在组件unmount时变更为false
const callback = usePipe(foo, bar, baz)
is equal to
const callback = useMemo(() => arg => {
return baz(bar(foo(arg)))
}, [foo, bar, baz])
执行 model
上的校验规则对 model
校验
要校验的 model 对象
条件校验,条件函数返回true时才会执行校验,否则直接视为校验通过
ValidatorMiddlewares.when的异步版本,接收异步的条件函数
将 key 对应的 value 写入 namespace 下 比较暴力,如果无法写入会把所有 Design 相关的缓存清除
true 表示成功,false 写入失败
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
If set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
If set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
A mention is surrounded by spaces
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
兼容老的参数
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
If set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
accept uniformed data to traverse then inject selected option or options to next state
props of Select
uniformed data
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
judge if param 'item' selected
next state marked selected item or items
coordinate for seleted judging
option object after uniformed
index of option in options list
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
将使用 child-element 传入的 Options 格式化为对象数组(未严格约束) data-prop 的优先级高于 child-element
props of Select
uniformedData - 格式化后对象数组
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
根据选择的keys拼装一个选好的列
Array 一个keys的数组
rows Array 一个每行的数据的数组
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
选了一行
某一行的key
是否被选中
设置内部属性,cached选中结果
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
上传项列表
判断是否受控
剩余可上传文件数量
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount
.
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
删除上传文件项
触发 onError 回调
触发外部上传方法
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
获取上传成功时要覆盖到 item 上的属性
添加新的上传项
重新上传文件
Called to determine whether the change in props and state should trigger a re-render.
Component
always returns true.
PureComponent
implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component#render
, componentWillUpdate
and componentDidUpdate
will not be called.
修改文件列表内容
更新某个上传项的属性
更新文件上传进度
更新上传项状态为失败
更新上传项状态为成功
是否选中全部
isSelectAll
是否选中了部分
是否选中了部分
切换是否监听事件
CSS properties which accept numbers but are not in units of "px".
获取状态展示图标
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
Generated using TypeDoc
copied from https://github.com/alexreardon/memoize-one