tntd 2.7.33 → 2.8.0-beta.2
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/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/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,12 +0,0 @@
|
|
|
1
|
-
import Col from './col';
|
|
2
|
-
import Row from './row';
|
|
3
|
-
import './style';
|
|
4
|
-
declare function useBreakpoint(): Partial<Record<import("../_util/responsiveObserve").Breakpoint, boolean>>;
|
|
5
|
-
export { ColProps, ColSize } from './col';
|
|
6
|
-
export { RowProps } from './row';
|
|
7
|
-
export { Row, Col };
|
|
8
|
-
declare const _default: {
|
|
9
|
-
useBreakpoint: typeof useBreakpoint;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tntd-form/grid/index.tsx"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,OAAO,SAAS,CAAA;AAGhB,iBAAS,aAAa,8EAErB;AAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;;;;AAEpB,wBAAiC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Col", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _col["default"];
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "Row", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _row["default"];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
exports["default"] = void 0;
|
|
19
|
-
var _col = _interopRequireDefault(require("./col"));
|
|
20
|
-
var _useBreakpoint = _interopRequireDefault(require("./hooks/useBreakpoint"));
|
|
21
|
-
var _row = _interopRequireDefault(require("./row"));
|
|
22
|
-
require("./style");
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
24
|
-
// Do not export params
|
|
25
|
-
function useBreakpoint() {
|
|
26
|
-
return (0, _useBreakpoint["default"])();
|
|
27
|
-
}
|
|
28
|
-
var _default = {
|
|
29
|
-
useBreakpoint: useBreakpoint
|
|
30
|
-
};
|
|
31
|
-
exports["default"] = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/index.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAaV,cAbP,aAAG,CAaO;AAZjB,0EAA0D;AAC1D,gDAAwB;AAWf,cAXF,aAAG,CAWE;AATZ,mBAAgB;AAEhB,uBAAuB;AACvB,SAAS,aAAa;IACpB,OAAO,IAAA,uBAAqB,GAAE,CAAC;AACjC,CAAC;AAED,6BAA0C;AAC1C,6BAAiC;AAGjC,kBAAe,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import Col from './col';\nimport useInternalBreakpoint from './hooks/useBreakpoint';\nimport Row from './row';\n\nimport './style'\n\n// Do not export params\nfunction useBreakpoint() {\n return useInternalBreakpoint();\n}\n\nexport { ColProps, ColSize } from './col';\nexport { RowProps } from './row';\nexport { Row, Col };\n\nexport default { useBreakpoint };\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Breakpoint } from '../_util/responsiveObserve';
|
|
3
|
-
declare const RowAligns: ["top", "middle", "bottom", "stretch"];
|
|
4
|
-
declare const RowJustify: ["start", "end", "center", "space-around", "space-between", "space-evenly"];
|
|
5
|
-
declare type Responsive = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
6
|
-
declare type ResponsiveLike<T> = {
|
|
7
|
-
[key in Responsive]?: T;
|
|
8
|
-
};
|
|
9
|
-
export declare type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;
|
|
10
|
-
declare type ResponsiveAligns = ResponsiveLike<typeof RowAligns[number]>;
|
|
11
|
-
declare type ResponsiveJustify = ResponsiveLike<typeof RowJustify[number]>;
|
|
12
|
-
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
-
gutter?: Gutter | [Gutter, Gutter];
|
|
14
|
-
align?: typeof RowAligns[number] | ResponsiveAligns;
|
|
15
|
-
justify?: typeof RowJustify[number] | ResponsiveJustify;
|
|
16
|
-
prefixCls?: string;
|
|
17
|
-
wrap?: boolean;
|
|
18
|
-
}
|
|
19
|
-
declare const Row: React.ForwardRefExoticComponent<RowProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export default Row;
|
|
21
|
-
//# sourceMappingURL=row.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/tntd-form/grid/row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,4BAA4B,CAAC;AAKxE,QAAA,MAAM,SAAS,wCAA8C,CAAC;AAC9D,QAAA,MAAM,UAAU,6EAAmF,CAAC;AAEpG,aAAK,UAAU,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3D,aAAK,cAAc,CAAC,CAAC,IAAI;KACtB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC;CACxB,CAAC;AAGF,oBAAY,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9E,aAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,aAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AACnE,MAAM,WAAW,QAAS,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;IACpD,OAAO,CAAC,EAAE,OAAO,UAAU,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AA+BD,QAAA,MAAM,GAAG,iFA4HP,CAAC;AAMH,eAAe,GAAG,CAAC"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _context = require("../_util/context");
|
|
10
|
-
var _useFlexGapSupport = _interopRequireDefault(require("../_util/hooks/useFlexGapSupport"));
|
|
11
|
-
var _responsiveObserve = _interopRequireWildcard(require("../_util/responsiveObserve"));
|
|
12
|
-
var _type = require("../_util/type");
|
|
13
|
-
var _RowContext = _interopRequireDefault(require("./RowContext"));
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
21
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
26
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
-
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
28
|
-
var t = {};
|
|
29
|
-
for (var p in s) {
|
|
30
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
31
|
-
}
|
|
32
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
33
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
};
|
|
37
|
-
var RowAligns = (0, _type.tuple)('top', 'middle', 'bottom', 'stretch');
|
|
38
|
-
var RowJustify = (0, _type.tuple)('start', 'end', 'center', 'space-around', 'space-between', 'space-evenly');
|
|
39
|
-
function useMergePropByScreen(oriProp, screen) {
|
|
40
|
-
var _React$useState = React.useState(typeof oriProp === 'string' ? oriProp : ''),
|
|
41
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
42
|
-
prop = _React$useState2[0],
|
|
43
|
-
setProp = _React$useState2[1];
|
|
44
|
-
var clacMergeAlignOrJustify = function clacMergeAlignOrJustify() {
|
|
45
|
-
if (typeof oriProp === 'string') {
|
|
46
|
-
setProp(oriProp);
|
|
47
|
-
}
|
|
48
|
-
if (_typeof(oriProp) !== 'object') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
for (var i = 0; i < _responsiveObserve.responsiveArray.length; i++) {
|
|
52
|
-
var breakpoint = _responsiveObserve.responsiveArray[i];
|
|
53
|
-
// if do not match, do nothing
|
|
54
|
-
if (!screen[breakpoint]) continue;
|
|
55
|
-
var curVal = oriProp[breakpoint];
|
|
56
|
-
if (curVal !== undefined) {
|
|
57
|
-
setProp(curVal);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
React.useEffect(function () {
|
|
63
|
-
clacMergeAlignOrJustify();
|
|
64
|
-
}, [JSON.stringify(oriProp), screen]);
|
|
65
|
-
return prop;
|
|
66
|
-
}
|
|
67
|
-
var Row = React.forwardRef(function (props, ref) {
|
|
68
|
-
var _classNames;
|
|
69
|
-
var _props$prefixCls = props.prefixCls,
|
|
70
|
-
customizePrefixCls = _props$prefixCls === void 0 ? 'tnt-row' : _props$prefixCls,
|
|
71
|
-
justify = props.justify,
|
|
72
|
-
align = props.align,
|
|
73
|
-
className = props.className,
|
|
74
|
-
style = props.style,
|
|
75
|
-
children = props.children,
|
|
76
|
-
_props$gutter = props.gutter,
|
|
77
|
-
gutter = _props$gutter === void 0 ? 0 : _props$gutter,
|
|
78
|
-
wrap = props.wrap,
|
|
79
|
-
others = __rest(props, ["prefixCls", "justify", "align", "className", "style", "children", "gutter", "wrap"]);
|
|
80
|
-
var _React$useContext = React.useContext(_context.ConfigContext),
|
|
81
|
-
getPrefixCls = _React$useContext.getPrefixCls,
|
|
82
|
-
direction = _React$useContext.direction;
|
|
83
|
-
var _React$useState3 = React.useState({
|
|
84
|
-
xs: true,
|
|
85
|
-
sm: true,
|
|
86
|
-
md: true,
|
|
87
|
-
lg: true,
|
|
88
|
-
xl: true,
|
|
89
|
-
xxl: true
|
|
90
|
-
}),
|
|
91
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
92
|
-
screens = _React$useState4[0],
|
|
93
|
-
setScreens = _React$useState4[1];
|
|
94
|
-
// to save screens info when responsiveObserve callback had been call
|
|
95
|
-
var _React$useState5 = React.useState({
|
|
96
|
-
xs: false,
|
|
97
|
-
sm: false,
|
|
98
|
-
md: false,
|
|
99
|
-
lg: false,
|
|
100
|
-
xl: false,
|
|
101
|
-
xxl: false
|
|
102
|
-
}),
|
|
103
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
104
|
-
curScreens = _React$useState6[0],
|
|
105
|
-
setCurScreens = _React$useState6[1];
|
|
106
|
-
// ================================== calc reponsive data ==================================
|
|
107
|
-
var mergeAlign = useMergePropByScreen(align, curScreens);
|
|
108
|
-
var mergeJustify = useMergePropByScreen(justify, curScreens);
|
|
109
|
-
var supportFlexGap = (0, _useFlexGapSupport["default"])();
|
|
110
|
-
var gutterRef = React.useRef(gutter);
|
|
111
|
-
// ================================== Effect ==================================
|
|
112
|
-
React.useEffect(function () {
|
|
113
|
-
var token = _responsiveObserve["default"].subscribe(function (screen) {
|
|
114
|
-
setCurScreens(screen);
|
|
115
|
-
var currentGutter = gutterRef.current || 0;
|
|
116
|
-
if (!Array.isArray(currentGutter) && _typeof(currentGutter) === 'object' || Array.isArray(currentGutter) && (_typeof(currentGutter[0]) === 'object' || _typeof(currentGutter[1]) === 'object')) {
|
|
117
|
-
setScreens(screen);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return function () {
|
|
121
|
-
return _responsiveObserve["default"].unsubscribe(token);
|
|
122
|
-
};
|
|
123
|
-
}, []);
|
|
124
|
-
// ================================== Render ==================================
|
|
125
|
-
var getGutter = function getGutter() {
|
|
126
|
-
var results = [undefined, undefined];
|
|
127
|
-
var normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
|
|
128
|
-
normalizedGutter.forEach(function (g, index) {
|
|
129
|
-
if (_typeof(g) === 'object') {
|
|
130
|
-
for (var i = 0; i < _responsiveObserve.responsiveArray.length; i++) {
|
|
131
|
-
var breakpoint = _responsiveObserve.responsiveArray[i];
|
|
132
|
-
if (screens[breakpoint] && g[breakpoint] !== undefined) {
|
|
133
|
-
results[index] = g[breakpoint];
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
results[index] = g;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
return results;
|
|
142
|
-
};
|
|
143
|
-
var prefixCls = getPrefixCls('row', customizePrefixCls);
|
|
144
|
-
var gutters = getGutter();
|
|
145
|
-
var classes = (0, _classnames["default"])(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-no-wrap"), wrap === false), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(mergeJustify), mergeJustify), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(mergeAlign), mergeAlign), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _classNames), className);
|
|
146
|
-
// Add gutter related style
|
|
147
|
-
var rowStyle = {};
|
|
148
|
-
var horizontalGutter = gutters[0] != null && gutters[0] > 0 ? gutters[0] / -2 : undefined;
|
|
149
|
-
var verticalGutter = gutters[1] != null && gutters[1] > 0 ? gutters[1] / -2 : undefined;
|
|
150
|
-
if (horizontalGutter) {
|
|
151
|
-
rowStyle.marginLeft = horizontalGutter;
|
|
152
|
-
rowStyle.marginRight = horizontalGutter;
|
|
153
|
-
}
|
|
154
|
-
if (supportFlexGap) {
|
|
155
|
-
// Set gap direct if flex gap support
|
|
156
|
-
var _gutters = _slicedToArray(gutters, 2);
|
|
157
|
-
rowStyle.rowGap = _gutters[1];
|
|
158
|
-
} else if (verticalGutter) {
|
|
159
|
-
rowStyle.marginTop = verticalGutter;
|
|
160
|
-
rowStyle.marginBottom = verticalGutter;
|
|
161
|
-
}
|
|
162
|
-
// "gutters" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.
|
|
163
|
-
// So we deconstruct "gutters" variable here.
|
|
164
|
-
var _gutters2 = _slicedToArray(gutters, 2),
|
|
165
|
-
gutterH = _gutters2[0],
|
|
166
|
-
gutterV = _gutters2[1];
|
|
167
|
-
var rowContext = React.useMemo(function () {
|
|
168
|
-
return {
|
|
169
|
-
gutter: [gutterH, gutterV],
|
|
170
|
-
wrap: wrap,
|
|
171
|
-
supportFlexGap: supportFlexGap
|
|
172
|
-
};
|
|
173
|
-
}, [gutterH, gutterV, wrap, supportFlexGap]);
|
|
174
|
-
return React.createElement(_RowContext["default"].Provider, {
|
|
175
|
-
value: rowContext
|
|
176
|
-
}, React.createElement("div", Object.assign({}, others, {
|
|
177
|
-
className: classes,
|
|
178
|
-
style: Object.assign(Object.assign({}, rowStyle), style),
|
|
179
|
-
ref: ref
|
|
180
|
-
}), children));
|
|
181
|
-
});
|
|
182
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
183
|
-
Row.displayName = 'Row';
|
|
184
|
-
}
|
|
185
|
-
var _default = Row;
|
|
186
|
-
exports["default"] = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../../src/tntd-form/grid/row.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAoC;AACpC,6CAA+B;AAC/B,8CAAgD;AAChD,yFAAiE;AAEjE,gFAAgF;AAChF,wCAAsC;AACtC,8DAAsC;AAEtC,MAAM,SAAS,GAAG,IAAA,YAAK,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,IAAA,YAAK,EAAC,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,CAA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AC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,CACzC,CAAC;IAEF,OAAO,CACL,oBAAC,oBAAU,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,kBAAe,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.d.ts","sourceRoot":"","sources":["../../../../src/tntd-form/grid/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tntd-form/grid/style/index.tsx"],"names":[],"mappings":";;AAAA,kCAAgC;AAChC,wBAAsB","sourcesContent":["import '../../style/index.less';\nimport './index.less';\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Meta, Story } from '@tntd/storybook-react-storykit';
|
|
3
|
-
import type { FormProps } from './Form';
|
|
4
|
-
declare const _default: Meta<(<Values = any>(props: FormProps<Values> & {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
} & {
|
|
7
|
-
ref?: React.Ref<import("./index").FormInstance<Values>> | undefined;
|
|
8
|
-
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
9
|
-
useForm: typeof import("./Form").useForm;
|
|
10
|
-
useFormInstance: typeof import("./hooks/useFormInstance").default;
|
|
11
|
-
useWatch: typeof import("rc-field-form/es/useWatch").default;
|
|
12
|
-
Item: (<Values_1 = any>(props: import("./FormItem").FormItemProps<Values_1>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
13
|
-
useStatus: () => {
|
|
14
|
-
status?: "" | "success" | "error" | "warning" | "validating" | undefined;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
List: React.FC<import("./FormList").FormListProps>;
|
|
18
|
-
ErrorList: typeof import("./ErrorList").default;
|
|
19
|
-
Provider: React.FC<import("./context").FormProviderProps>;
|
|
20
|
-
create: () => void;
|
|
21
|
-
}>;
|
|
22
|
-
export default _default;
|
|
23
|
-
export declare const Basic: Story<FormProps<any>>;
|
|
24
|
-
export declare const FormMethodInvoke: Story<FormProps<any>>;
|
|
25
|
-
export declare const FormLayoutDemo: () => JSX.Element;
|
|
26
|
-
export declare const UnblockValidate: () => JSX.Element;
|
|
27
|
-
export declare const UseWatchHooks: () => JSX.Element;
|
|
28
|
-
export declare const DynamicAddRemoveFields: () => JSX.Element;
|
|
29
|
-
export declare const DynamicItemsComplex: () => JSX.Element;
|
|
30
|
-
export declare const FormInModal: () => JSX.Element;
|
|
31
|
-
export declare const FormDisabledReadonly: () => JSX.Element;
|
|
32
|
-
export declare const NestValidatorForm: () => JSX.Element;
|
|
33
|
-
//# sourceMappingURL=tntd-form.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tntd-form.stories.d.ts","sourceRoot":"","sources":["../../src/tntd-form/tntd-form.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;AA+BvC,wBAGsB;AAOtB,eAAO,MAAM,KAAK,uBAAoB,CAAA;AAuJtC,eAAO,MAAM,gBAAgB,uBAA+B,CAAA;AAyD5D,eAAO,MAAM,cAAc,mBAA8B,CAAA;AAyCzD,eAAO,MAAM,eAAe,mBAAmC,CAAA;AAuB/D,eAAO,MAAM,aAAa,mBAA4B,CAAA;AAuGtD,eAAO,MAAM,sBAAsB,mBAAqC,CAAA;AA8FxE,eAAO,MAAM,mBAAmB,mBAAkC,CAAA;AAkElE,eAAO,MAAM,WAAW,mBAA0B,CAAA;AAiKlD,eAAO,MAAM,oBAAoB,mBAA2B,CAAA;AAkD5D,eAAO,MAAM,iBAAiB,mBAAgC,CAAA"}
|