@tachybase/components 0.23.8
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/.turbo/turbo-build.log +9 -0
- package/LICENSE +201 -0
- package/lib/__builtins__/dayjs.d.ts +4 -0
- package/lib/__builtins__/dayjs.js +95 -0
- package/lib/__builtins__/hooks/index.d.ts +4 -0
- package/lib/__builtins__/hooks/index.js +27 -0
- package/lib/__builtins__/hooks/useClickAway.d.ts +5 -0
- package/lib/__builtins__/hooks/useClickAway.js +64 -0
- package/lib/__builtins__/hooks/useConfig.d.ts +1 -0
- package/lib/__builtins__/hooks/useConfig.js +31 -0
- package/lib/__builtins__/hooks/usePrefixCls.d.ts +3 -0
- package/lib/__builtins__/hooks/usePrefixCls.js +38 -0
- package/lib/__builtins__/hooks/useToken.d.ts +6 -0
- package/lib/__builtins__/hooks/useToken.js +28 -0
- package/lib/__builtins__/index.d.ts +7 -0
- package/lib/__builtins__/index.js +33 -0
- package/lib/__builtins__/loading.d.ts +1 -0
- package/lib/__builtins__/loading.js +40 -0
- package/lib/__builtins__/pickDataProps.d.ts +1 -0
- package/lib/__builtins__/pickDataProps.js +36 -0
- package/lib/__builtins__/portal.d.ts +10 -0
- package/lib/__builtins__/portal.js +89 -0
- package/lib/__builtins__/render.d.ts +9 -0
- package/lib/__builtins__/render.js +99 -0
- package/lib/__builtins__/sort.d.ts +73 -0
- package/lib/__builtins__/sort.js +126 -0
- package/lib/__builtins__/style.d.ts +23 -0
- package/lib/__builtins__/style.js +88 -0
- package/lib/array-base/index.d.ts +64 -0
- package/lib/array-base/index.js +345 -0
- package/lib/array-base/style.d.ts +2 -0
- package/lib/array-base/style.js +68 -0
- package/lib/array-cards/index.d.ts +5 -0
- package/lib/array-cards/index.js +166 -0
- package/lib/array-cards/style.d.ts +2 -0
- package/lib/array-cards/style.js +37 -0
- package/lib/array-collapse/index.d.ts +10 -0
- package/lib/array-collapse/index.js +199 -0
- package/lib/array-collapse/style.d.ts +2 -0
- package/lib/array-collapse/style.js +33 -0
- package/lib/array-items/index.d.ts +8 -0
- package/lib/array-items/index.js +122 -0
- package/lib/array-items/style.d.ts +2 -0
- package/lib/array-items/style.js +82 -0
- package/lib/array-table/index.d.ts +9 -0
- package/lib/array-table/index.js +376 -0
- package/lib/array-table/style.d.ts +2 -0
- package/lib/array-table/style.js +71 -0
- package/lib/array-tabs/index.d.ts +4 -0
- package/lib/array-tabs/index.js +102 -0
- package/lib/cascader/index.d.ts +12 -0
- package/lib/cascader/index.js +58 -0
- package/lib/checkbox/index.d.ts +5 -0
- package/lib/checkbox/index.js +51 -0
- package/lib/code-mirror/index.d.ts +3 -0
- package/lib/code-mirror/index.js +91 -0
- package/lib/date-picker/index.d.ts +2 -0
- package/lib/date-picker/index.js +70 -0
- package/lib/date-picker/style.d.ts +1 -0
- package/lib/date-picker/style.js +1 -0
- package/lib/editable/index.d.ts +8 -0
- package/lib/editable/index.js +181 -0
- package/lib/editable/style.d.ts +2 -0
- package/lib/editable/style.js +69 -0
- package/lib/form/index.d.ts +12 -0
- package/lib/form/index.js +71 -0
- package/lib/form-button-group/index.d.ts +27 -0
- package/lib/form-button-group/index.js +148 -0
- package/lib/form-button-group/style.d.ts +2 -0
- package/lib/form-button-group/style.js +41 -0
- package/lib/form-collapse/index.d.ts +28 -0
- package/lib/form-collapse/index.js +150 -0
- package/lib/form-dialog/index.d.ts +26 -0
- package/lib/form-dialog/index.js +194 -0
- package/lib/form-drawer/index.d.ts +25 -0
- package/lib/form-drawer/index.js +187 -0
- package/lib/form-grid/index.d.ts +34 -0
- package/lib/form-grid/index.js +108 -0
- package/lib/form-grid/style.d.ts +2 -0
- package/lib/form-grid/style.js +31 -0
- package/lib/form-item/hooks/index.d.ts +2 -0
- package/lib/form-item/hooks/index.js +23 -0
- package/lib/form-item/hooks/useFormItemLayout.d.ts +37 -0
- package/lib/form-item/hooks/useFormItemLayout.js +66 -0
- package/lib/form-item/hooks/useOverflow.d.ts +5 -0
- package/lib/form-item/hooks/useOverflow.js +55 -0
- package/lib/form-item/index.d.ts +11 -0
- package/lib/form-item/index.js +303 -0
- package/lib/form-item/style/animation.d.ts +2 -0
- package/lib/form-item/style/animation.js +57 -0
- package/lib/form-item/style/grid.d.ts +2 -0
- package/lib/form-item/style/grid.js +50 -0
- package/lib/form-item/style/index.d.ts +2 -0
- package/lib/form-item/style/index.js +387 -0
- package/lib/form-item/style/other.d.ts +2 -0
- package/lib/form-item/style/other.js +490 -0
- package/lib/form-item/types.d.ts +35 -0
- package/lib/form-item/types.js +15 -0
- package/lib/form-layout/index.d.ts +74 -0
- package/lib/form-layout/index.js +96 -0
- package/lib/form-layout/useResponsiveFormLayout.d.ts +17 -0
- package/lib/form-layout/useResponsiveFormLayout.js +89 -0
- package/lib/form-step/index.d.ts +27 -0
- package/lib/form-step/index.js +154 -0
- package/lib/form-tab/index.d.ts +19 -0
- package/lib/form-tab/index.js +150 -0
- package/lib/index.d.ts +38 -0
- package/lib/index.js +95 -0
- package/lib/input/index.d.ts +7 -0
- package/lib/input/index.js +57 -0
- package/lib/lightbox/constant.d.ts +21 -0
- package/lib/lightbox/constant.js +79 -0
- package/lib/lightbox/index.d.ts +2 -0
- package/lib/lightbox/index.js +37 -0
- package/lib/lightbox/interface.d.ts +43 -0
- package/lib/lightbox/interface.js +15 -0
- package/lib/lightbox/react-image-lightbox.d.ts +197 -0
- package/lib/lightbox/react-image-lightbox.js +1431 -0
- package/lib/lightbox/style.css +305 -0
- package/lib/lightbox/util.d.ts +7 -0
- package/lib/lightbox/util.js +71 -0
- package/lib/number-picker/index.d.ts +4 -0
- package/lib/number-picker/index.js +32 -0
- package/lib/password/PasswordStrength.d.ts +9 -0
- package/lib/password/PasswordStrength.js +188 -0
- package/lib/password/index.d.ts +7 -0
- package/lib/password/index.js +85 -0
- package/lib/preview-text/index.d.ts +12 -0
- package/lib/preview-text/index.js +263 -0
- package/lib/preview-text/style.d.ts +2 -0
- package/lib/preview-text/style.js +37 -0
- package/lib/radio/index.d.ts +8 -0
- package/lib/radio/index.js +51 -0
- package/lib/reset/index.d.ts +10 -0
- package/lib/reset/index.js +67 -0
- package/lib/select/index.d.ts +4 -0
- package/lib/select/index.js +59 -0
- package/lib/select-table/hooks/index.d.ts +5 -0
- package/lib/select-table/hooks/index.js +29 -0
- package/lib/select-table/hooks/useCheckSlackly.d.ts +16 -0
- package/lib/select-table/hooks/useCheckSlackly.js +57 -0
- package/lib/select-table/hooks/useFilterOptions.d.ts +3 -0
- package/lib/select-table/hooks/useFilterOptions.js +97 -0
- package/lib/select-table/hooks/useFlatOptions.d.ts +3 -0
- package/lib/select-table/hooks/useFlatOptions.js +46 -0
- package/lib/select-table/hooks/useSize.d.ts +9 -0
- package/lib/select-table/hooks/useSize.js +48 -0
- package/lib/select-table/hooks/useTitleAddon.d.ts +7 -0
- package/lib/select-table/hooks/useTitleAddon.js +90 -0
- package/lib/select-table/index.d.ts +27 -0
- package/lib/select-table/index.js +339 -0
- package/lib/select-table/style.d.ts +2 -0
- package/lib/select-table/style.js +33 -0
- package/lib/select-table/utils.d.ts +78 -0
- package/lib/select-table/utils.js +166 -0
- package/lib/space/index.d.ts +4 -0
- package/lib/space/index.js +49 -0
- package/lib/submit/index.d.ts +11 -0
- package/lib/submit/index.js +67 -0
- package/lib/switch/index.d.ts +2 -0
- package/lib/switch/index.js +44 -0
- package/lib/time-picker/index.d.ts +2 -0
- package/lib/time-picker/index.js +60 -0
- package/lib/time-picker/style.d.ts +1 -0
- package/lib/time-picker/style.js +1 -0
- package/lib/transfer/index.d.ts +2 -0
- package/lib/transfer/index.js +56 -0
- package/lib/tree-select/index.d.ts +2 -0
- package/lib/tree-select/index.js +58 -0
- package/lib/upload/index.d.ts +18 -0
- package/lib/upload/index.js +159 -0
- package/lib/upload/placeholder.d.ts +4 -0
- package/lib/upload/placeholder.js +88 -0
- package/package.json +31 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactFC } from '@tachybase/schema';
|
|
3
|
+
export interface IPortalProps {
|
|
4
|
+
id?: string | symbol;
|
|
5
|
+
}
|
|
6
|
+
export declare const createPortalProvider: (id: string | symbol) => ReactFC<IPortalProps>;
|
|
7
|
+
export declare function createPortalRoot<T extends React.ReactNode>(host: HTMLElement, id: string): {
|
|
8
|
+
render: (renderer?: () => T) => void;
|
|
9
|
+
unmount: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var portal_exports = {};
|
|
30
|
+
__export(portal_exports, {
|
|
31
|
+
createPortalProvider: () => createPortalProvider,
|
|
32
|
+
createPortalRoot: () => createPortalRoot
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(portal_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_schema = require("@tachybase/schema");
|
|
37
|
+
var import_react_dom = require("react-dom");
|
|
38
|
+
var import_render = require("./render");
|
|
39
|
+
const PortalMap = (0, import_schema.observable)(/* @__PURE__ */ new Map());
|
|
40
|
+
const createPortalProvider = /* @__PURE__ */ __name((id) => {
|
|
41
|
+
const Portal = /* @__PURE__ */ __name((props) => {
|
|
42
|
+
if (props.id && !PortalMap.has(props.id)) {
|
|
43
|
+
PortalMap.set(props.id, null);
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.Fragment, null, props.children, /* @__PURE__ */ import_react.default.createElement(import_schema.Observer, null, () => {
|
|
46
|
+
if (!props.id) return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null);
|
|
47
|
+
const portal = PortalMap.get(props.id);
|
|
48
|
+
if (portal) return (0, import_react_dom.createPortal)(portal, document.body);
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null);
|
|
50
|
+
}));
|
|
51
|
+
}, "Portal");
|
|
52
|
+
Portal.defaultProps = {
|
|
53
|
+
id
|
|
54
|
+
};
|
|
55
|
+
return Portal;
|
|
56
|
+
}, "createPortalProvider");
|
|
57
|
+
function createPortalRoot(host, id) {
|
|
58
|
+
function render(renderer) {
|
|
59
|
+
if (PortalMap.has(id)) {
|
|
60
|
+
PortalMap.set(id, renderer == null ? void 0 : renderer());
|
|
61
|
+
} else if (host) {
|
|
62
|
+
(0, import_render.render)(/* @__PURE__ */ import_react.default.createElement(import_react.Fragment, null, renderer == null ? void 0 : renderer()), host);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
__name(render, "render");
|
|
66
|
+
function unmount() {
|
|
67
|
+
var _a;
|
|
68
|
+
if (PortalMap.has(id)) {
|
|
69
|
+
PortalMap.set(id, null);
|
|
70
|
+
}
|
|
71
|
+
if (host) {
|
|
72
|
+
const unmountResult = (0, import_render.unmount)(host);
|
|
73
|
+
if (unmountResult && host.parentNode) {
|
|
74
|
+
(_a = host.parentNode) == null ? void 0 : _a.removeChild(host);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
__name(unmount, "unmount");
|
|
79
|
+
return {
|
|
80
|
+
render,
|
|
81
|
+
unmount
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
__name(createPortalRoot, "createPortalRoot");
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
createPortalProvider,
|
|
88
|
+
createPortalRoot
|
|
89
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import type { Root } from 'react-dom/client';
|
|
3
|
+
declare const MARK = "__antd_mobile_root__";
|
|
4
|
+
type ContainerType = (Element | DocumentFragment) & {
|
|
5
|
+
[MARK]?: Root;
|
|
6
|
+
};
|
|
7
|
+
export declare function render(node: ReactElement, container: ContainerType): void;
|
|
8
|
+
export declare function unmount(container: ContainerType): boolean | Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var render_exports = {};
|
|
30
|
+
__export(render_exports, {
|
|
31
|
+
render: () => render,
|
|
32
|
+
unmount: () => unmount
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(render_exports);
|
|
35
|
+
var ReactDOM = __toESM(require("react-dom"));
|
|
36
|
+
const fullClone = {
|
|
37
|
+
...ReactDOM
|
|
38
|
+
};
|
|
39
|
+
const { version, render: reactRender, unmountComponentAtNode } = fullClone;
|
|
40
|
+
let createRoot;
|
|
41
|
+
try {
|
|
42
|
+
const mainVersion = Number((version || "").split(".")[0]);
|
|
43
|
+
if (mainVersion >= 18 && fullClone.createRoot) {
|
|
44
|
+
createRoot = fullClone.createRoot;
|
|
45
|
+
}
|
|
46
|
+
} catch (e) {
|
|
47
|
+
}
|
|
48
|
+
function toggleWarning(skip) {
|
|
49
|
+
const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = fullClone;
|
|
50
|
+
if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === "object") {
|
|
51
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
__name(toggleWarning, "toggleWarning");
|
|
55
|
+
const MARK = "__antd_mobile_root__";
|
|
56
|
+
function legacyRender(node, container) {
|
|
57
|
+
reactRender(node, container);
|
|
58
|
+
}
|
|
59
|
+
__name(legacyRender, "legacyRender");
|
|
60
|
+
function concurrentRender(node, container) {
|
|
61
|
+
toggleWarning(true);
|
|
62
|
+
const root = container[MARK] || createRoot(container);
|
|
63
|
+
toggleWarning(false);
|
|
64
|
+
root.render(node);
|
|
65
|
+
container[MARK] = root;
|
|
66
|
+
}
|
|
67
|
+
__name(concurrentRender, "concurrentRender");
|
|
68
|
+
function render(node, container) {
|
|
69
|
+
if (createRoot) {
|
|
70
|
+
concurrentRender(node, container);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
legacyRender(node, container);
|
|
74
|
+
}
|
|
75
|
+
__name(render, "render");
|
|
76
|
+
function legacyUnmount(container) {
|
|
77
|
+
return unmountComponentAtNode(container);
|
|
78
|
+
}
|
|
79
|
+
__name(legacyUnmount, "legacyUnmount");
|
|
80
|
+
async function concurrentUnmount(container) {
|
|
81
|
+
return Promise.resolve().then(() => {
|
|
82
|
+
var _a;
|
|
83
|
+
(_a = container[MARK]) == null ? void 0 : _a.unmount();
|
|
84
|
+
delete container[MARK];
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
__name(concurrentUnmount, "concurrentUnmount");
|
|
88
|
+
function unmount(container) {
|
|
89
|
+
if (createRoot) {
|
|
90
|
+
return concurrentUnmount(container);
|
|
91
|
+
}
|
|
92
|
+
return legacyUnmount(container);
|
|
93
|
+
}
|
|
94
|
+
__name(unmount, "unmount");
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
render,
|
|
98
|
+
unmount
|
|
99
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactFC } from '@tachybase/schema';
|
|
3
|
+
import { DragStartEvent } from '@dnd-kit/core';
|
|
4
|
+
export type { Transform } from '@dnd-kit/utilities';
|
|
5
|
+
export interface ISortableContainerProps {
|
|
6
|
+
list: any[];
|
|
7
|
+
start?: number;
|
|
8
|
+
accessibility?: {
|
|
9
|
+
container?: Element;
|
|
10
|
+
};
|
|
11
|
+
onSortStart?: (event: DragStartEvent) => void;
|
|
12
|
+
onSortEnd?: (event: {
|
|
13
|
+
oldIndex: number;
|
|
14
|
+
newIndex: number;
|
|
15
|
+
}) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function SortableContainer<T extends React.HTMLAttributes<HTMLElement>>(Component: ReactFC<T>): ReactFC<ISortableContainerProps & T>;
|
|
18
|
+
export declare const useSortableItem: () => Partial<{
|
|
19
|
+
active: import("@dnd-kit/core").Active | null;
|
|
20
|
+
activeIndex: number;
|
|
21
|
+
attributes: import("@dnd-kit/core").DraggableAttributes;
|
|
22
|
+
data: import("@dnd-kit/sortable").SortableData & {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
};
|
|
25
|
+
rect: import("react").MutableRefObject<import("@dnd-kit/core").ClientRect | null>;
|
|
26
|
+
index: number;
|
|
27
|
+
newIndex: number;
|
|
28
|
+
items: import("@dnd-kit/core").UniqueIdentifier[];
|
|
29
|
+
isOver: boolean;
|
|
30
|
+
isSorting: boolean;
|
|
31
|
+
isDragging: boolean;
|
|
32
|
+
listeners: import("@dnd-kit/core/dist/hooks/utilities").SyntheticListenerMap | undefined;
|
|
33
|
+
node: import("react").MutableRefObject<HTMLElement | null>;
|
|
34
|
+
overIndex: number;
|
|
35
|
+
over: import("@dnd-kit/core").Over | null;
|
|
36
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
37
|
+
setActivatorNodeRef: (element: HTMLElement | null) => void;
|
|
38
|
+
setDroppableNodeRef: (element: HTMLElement | null) => void;
|
|
39
|
+
setDraggableNodeRef: (element: HTMLElement | null) => void;
|
|
40
|
+
transform: import("@dnd-kit/utilities").Transform | null;
|
|
41
|
+
transition: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const SortableItemContext: React.Context<Partial<{
|
|
44
|
+
active: import("@dnd-kit/core").Active | null;
|
|
45
|
+
activeIndex: number;
|
|
46
|
+
attributes: import("@dnd-kit/core").DraggableAttributes;
|
|
47
|
+
data: import("@dnd-kit/sortable").SortableData & {
|
|
48
|
+
[x: string]: any;
|
|
49
|
+
};
|
|
50
|
+
rect: import("react").MutableRefObject<import("@dnd-kit/core").ClientRect | null>;
|
|
51
|
+
index: number;
|
|
52
|
+
newIndex: number;
|
|
53
|
+
items: import("@dnd-kit/core").UniqueIdentifier[];
|
|
54
|
+
isOver: boolean;
|
|
55
|
+
isSorting: boolean;
|
|
56
|
+
isDragging: boolean;
|
|
57
|
+
listeners: import("@dnd-kit/core/dist/hooks/utilities").SyntheticListenerMap | undefined;
|
|
58
|
+
node: import("react").MutableRefObject<HTMLElement | null>;
|
|
59
|
+
overIndex: number;
|
|
60
|
+
over: import("@dnd-kit/core").Over | null;
|
|
61
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
62
|
+
setActivatorNodeRef: (element: HTMLElement | null) => void;
|
|
63
|
+
setDroppableNodeRef: (element: HTMLElement | null) => void;
|
|
64
|
+
setDraggableNodeRef: (element: HTMLElement | null) => void;
|
|
65
|
+
transform: import("@dnd-kit/utilities").Transform | null;
|
|
66
|
+
transition: string | undefined;
|
|
67
|
+
}>>;
|
|
68
|
+
export interface ISortableElementProps {
|
|
69
|
+
index?: number;
|
|
70
|
+
lockAxis?: 'x' | 'y';
|
|
71
|
+
}
|
|
72
|
+
export declare function SortableElement<T extends React.HTMLAttributes<HTMLElement>>(Component: ReactFC<T>): ReactFC<T & ISortableElementProps>;
|
|
73
|
+
export declare function SortableHandle<T extends React.HTMLAttributes<HTMLElement>>(Component: ReactFC<T>): ReactFC<T>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var sort_exports = {};
|
|
30
|
+
__export(sort_exports, {
|
|
31
|
+
SortableContainer: () => SortableContainer,
|
|
32
|
+
SortableElement: () => SortableElement,
|
|
33
|
+
SortableHandle: () => SortableHandle,
|
|
34
|
+
SortableItemContext: () => SortableItemContext,
|
|
35
|
+
useSortableItem: () => useSortableItem
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(sort_exports);
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_core = require("@dnd-kit/core");
|
|
40
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
41
|
+
function SortableContainer(Component) {
|
|
42
|
+
return ({ list, start = 0, accessibility, onSortStart, onSortEnd, ...props }) => {
|
|
43
|
+
const _onSortEnd = /* @__PURE__ */ __name((event) => {
|
|
44
|
+
const { active, over } = event;
|
|
45
|
+
if (!over) return;
|
|
46
|
+
const oldIndex = +active.id - 1;
|
|
47
|
+
const newIndex = +over.id - 1;
|
|
48
|
+
onSortEnd == null ? void 0 : onSortEnd({
|
|
49
|
+
oldIndex,
|
|
50
|
+
newIndex
|
|
51
|
+
});
|
|
52
|
+
}, "_onSortEnd");
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_core.DndContext, { accessibility, onDragStart: onSortStart, onDragEnd: _onSortEnd }, /* @__PURE__ */ import_react.default.createElement(import_sortable.SortableContext, { items: list.map((_, index) => index + start + 1), strategy: import_sortable.verticalListSortingStrategy }, /* @__PURE__ */ import_react.default.createElement(Component, { ...props }, props.children)));
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
__name(SortableContainer, "SortableContainer");
|
|
57
|
+
const useSortableItem = /* @__PURE__ */ __name(() => {
|
|
58
|
+
return (0, import_react.useContext)(SortableItemContext);
|
|
59
|
+
}, "useSortableItem");
|
|
60
|
+
const SortableItemContext = (0, import_react.createContext)({});
|
|
61
|
+
function SortableElement(Component) {
|
|
62
|
+
return ({ index = 0, lockAxis, ...props }) => {
|
|
63
|
+
const sortable = (0, import_sortable.useSortable)({
|
|
64
|
+
id: index + 1
|
|
65
|
+
});
|
|
66
|
+
const { setNodeRef, transform, transition, isDragging } = sortable;
|
|
67
|
+
if (transform) {
|
|
68
|
+
switch (lockAxis) {
|
|
69
|
+
case "x":
|
|
70
|
+
transform.y = 0;
|
|
71
|
+
break;
|
|
72
|
+
case "y":
|
|
73
|
+
transform.x = 0;
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const style = (0, import_react.useMemo)(() => {
|
|
80
|
+
const zIndex = transform ? 1 : "none";
|
|
81
|
+
const position = transform ? "relative" : "unset";
|
|
82
|
+
const itemStyle = {
|
|
83
|
+
position,
|
|
84
|
+
touchAction: "none",
|
|
85
|
+
zIndex,
|
|
86
|
+
transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : "none",
|
|
87
|
+
transition: `${transform ? "all 200ms ease" : ""}`
|
|
88
|
+
};
|
|
89
|
+
const dragStyle = {
|
|
90
|
+
transition,
|
|
91
|
+
opacity: "0.8",
|
|
92
|
+
transform: `translate3d(${(transform == null ? void 0 : transform.x) || 0}px, ${(transform == null ? void 0 : transform.y) || 0}px, 0)`
|
|
93
|
+
};
|
|
94
|
+
const computedStyle = isDragging ? {
|
|
95
|
+
...itemStyle,
|
|
96
|
+
...dragStyle,
|
|
97
|
+
...props.style
|
|
98
|
+
} : {
|
|
99
|
+
...itemStyle,
|
|
100
|
+
...props.style
|
|
101
|
+
};
|
|
102
|
+
return computedStyle;
|
|
103
|
+
}, [isDragging, transform, transition, props.style]);
|
|
104
|
+
return /* @__PURE__ */ import_react.default.createElement(SortableItemContext.Provider, { value: sortable }, Component({
|
|
105
|
+
...props,
|
|
106
|
+
style,
|
|
107
|
+
ref: setNodeRef
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
__name(SortableElement, "SortableElement");
|
|
112
|
+
function SortableHandle(Component) {
|
|
113
|
+
return (props) => {
|
|
114
|
+
const { attributes, listeners } = useSortableItem();
|
|
115
|
+
return /* @__PURE__ */ import_react.default.createElement(Component, { ...props, ...attributes, ...listeners });
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
__name(SortableHandle, "SortableHandle");
|
|
119
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
120
|
+
0 && (module.exports = {
|
|
121
|
+
SortableContainer,
|
|
122
|
+
SortableElement,
|
|
123
|
+
SortableHandle,
|
|
124
|
+
SortableItemContext,
|
|
125
|
+
useSortableItem
|
|
126
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CSSInterpolation, type CSSObject } from '@ant-design/cssinjs';
|
|
2
|
+
import type { ComponentTokenMap, GlobalToken } from 'antd/es/theme/interface';
|
|
3
|
+
export type OverrideComponent = keyof ComponentTokenMap | (string & {});
|
|
4
|
+
export interface StyleInfo {
|
|
5
|
+
hashId: string;
|
|
6
|
+
prefixCls: string;
|
|
7
|
+
rootPrefixCls: string;
|
|
8
|
+
iconPrefixCls: string;
|
|
9
|
+
}
|
|
10
|
+
export type TokenWithCommonCls<T> = T & {
|
|
11
|
+
/** Wrap component class with `.` prefix */
|
|
12
|
+
componentCls: string;
|
|
13
|
+
/** Origin prefix which do not have `.` prefix */
|
|
14
|
+
prefixCls: string;
|
|
15
|
+
/** Wrap icon class with `.` prefix */
|
|
16
|
+
iconCls: string;
|
|
17
|
+
/** Wrap ant prefixCls class with `.` prefix */
|
|
18
|
+
antCls: string;
|
|
19
|
+
};
|
|
20
|
+
export type GenerateStyle<ComponentToken extends object = TokenWithCommonCls<GlobalToken>, ReturnType = CSSInterpolation> = (token: ComponentToken, options?: any) => ReturnType;
|
|
21
|
+
export declare const genCommonStyle: (token: any, componentPrefixCls: string) => CSSObject;
|
|
22
|
+
export type UseComponentStyleResult = [(node: React.ReactNode) => React.ReactElement, string];
|
|
23
|
+
export declare const genStyleHook: <ComponentName extends OverrideComponent>(component: ComponentName, styleFn: (token: TokenWithCommonCls<GlobalToken>, info: StyleInfo) => CSSInterpolation) => (prefixCls: string) => UseComponentStyleResult;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var style_exports = {};
|
|
20
|
+
__export(style_exports, {
|
|
21
|
+
genCommonStyle: () => genCommonStyle,
|
|
22
|
+
genStyleHook: () => genStyleHook
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_schema = require("@tachybase/schema");
|
|
26
|
+
var import_cssinjs = require("@ant-design/cssinjs");
|
|
27
|
+
var import_hooks = require("./hooks");
|
|
28
|
+
const genCommonStyle = /* @__PURE__ */ __name((token, componentPrefixCls) => {
|
|
29
|
+
const { fontFamily, fontSize } = token;
|
|
30
|
+
const rootPrefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
|
|
31
|
+
return {
|
|
32
|
+
[rootPrefixSelector]: {
|
|
33
|
+
fontFamily,
|
|
34
|
+
fontSize,
|
|
35
|
+
boxSizing: "border-box",
|
|
36
|
+
"&::before, &::after": {
|
|
37
|
+
boxSizing: "border-box"
|
|
38
|
+
},
|
|
39
|
+
[rootPrefixSelector]: {
|
|
40
|
+
boxSizing: "border-box",
|
|
41
|
+
"&::before, &::after": {
|
|
42
|
+
boxSizing: "border-box"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, "genCommonStyle");
|
|
48
|
+
const genStyleHook = /* @__PURE__ */ __name((component, styleFn) => {
|
|
49
|
+
return (prefixCls) => {
|
|
50
|
+
const { theme, token, hashId } = (0, import_hooks.useToken)();
|
|
51
|
+
const { getPrefixCls, iconPrefixCls } = (0, import_hooks.useConfig)();
|
|
52
|
+
const rootPrefixCls = getPrefixCls();
|
|
53
|
+
return [
|
|
54
|
+
(0, import_cssinjs.useStyleRegister)(
|
|
55
|
+
{
|
|
56
|
+
theme,
|
|
57
|
+
token,
|
|
58
|
+
hashId,
|
|
59
|
+
path: ["formily-antd", component, prefixCls, iconPrefixCls]
|
|
60
|
+
},
|
|
61
|
+
() => {
|
|
62
|
+
const componentCls = `.${prefixCls}`;
|
|
63
|
+
const mergedToken = (0, import_schema.merge)(token, {
|
|
64
|
+
...token["Form"],
|
|
65
|
+
// Merge the antd form token
|
|
66
|
+
componentCls,
|
|
67
|
+
prefixCls,
|
|
68
|
+
iconCls: `.${iconPrefixCls}`,
|
|
69
|
+
antCls: `.${rootPrefixCls}`
|
|
70
|
+
});
|
|
71
|
+
const styleInterpolation = styleFn(mergedToken, {
|
|
72
|
+
hashId,
|
|
73
|
+
prefixCls,
|
|
74
|
+
rootPrefixCls,
|
|
75
|
+
iconPrefixCls
|
|
76
|
+
});
|
|
77
|
+
return [genCommonStyle(token, prefixCls), styleInterpolation];
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
hashId
|
|
81
|
+
];
|
|
82
|
+
};
|
|
83
|
+
}, "genStyleHook");
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
genCommonStyle,
|
|
87
|
+
genStyleHook
|
|
88
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArrayField, ReactFC, Schema } from '@tachybase/schema';
|
|
3
|
+
import { ButtonProps } from 'antd';
|
|
4
|
+
export interface IArrayBaseAdditionProps extends ButtonProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
method?: 'push' | 'unshift';
|
|
7
|
+
defaultValue?: any;
|
|
8
|
+
}
|
|
9
|
+
export interface IArrayBaseContext {
|
|
10
|
+
props: IArrayBaseProps;
|
|
11
|
+
field: ArrayField;
|
|
12
|
+
schema: Schema;
|
|
13
|
+
}
|
|
14
|
+
export interface IArrayBaseItemProps {
|
|
15
|
+
index: number;
|
|
16
|
+
record: ((index: number) => Record<string, any>) | Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
type CommonProps = ButtonProps & {
|
|
19
|
+
index?: number;
|
|
20
|
+
};
|
|
21
|
+
export type ArrayBaseMixins = {
|
|
22
|
+
Addition: ReactFC<IArrayBaseAdditionProps>;
|
|
23
|
+
Copy: ReactFC<CommonProps>;
|
|
24
|
+
Remove: ReactFC<CommonProps>;
|
|
25
|
+
MoveUp: ReactFC<CommonProps>;
|
|
26
|
+
MoveDown: React.FC<React.PropsWithChildren<CommonProps>>;
|
|
27
|
+
SortHandle: ReactFC<CommonProps>;
|
|
28
|
+
Index: React.FC;
|
|
29
|
+
useArray: () => IArrayBaseContext | null;
|
|
30
|
+
useIndex: (index?: number) => number;
|
|
31
|
+
useRecord: (record?: number) => any;
|
|
32
|
+
};
|
|
33
|
+
export interface IArrayBaseProps {
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
onAdd?: (index: number) => void;
|
|
36
|
+
onCopy?: (index: number) => void;
|
|
37
|
+
onRemove?: (index: number) => void;
|
|
38
|
+
onMoveDown?: (index: number) => void;
|
|
39
|
+
onMoveUp?: (index: number) => void;
|
|
40
|
+
}
|
|
41
|
+
declare function mixin<T extends object = object>(target: T): T & ArrayBaseMixins;
|
|
42
|
+
export declare const ArrayBase: ReactFC<IArrayBaseProps> & {
|
|
43
|
+
Item: ReactFC<IArrayBaseItemProps>;
|
|
44
|
+
Index: React.FC<React.HTMLAttributes<HTMLSpanElement>>;
|
|
45
|
+
SortHandle: ReactFC<CommonProps>;
|
|
46
|
+
Addition: ReactFC<IArrayBaseAdditionProps>;
|
|
47
|
+
Copy: React.ForwardRefExoticComponent<ButtonProps & {
|
|
48
|
+
index?: number;
|
|
49
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
50
|
+
Remove: React.ForwardRefExoticComponent<ButtonProps & {
|
|
51
|
+
index?: number;
|
|
52
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
53
|
+
MoveDown: React.ForwardRefExoticComponent<ButtonProps & {
|
|
54
|
+
index?: number;
|
|
55
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
56
|
+
MoveUp: React.ForwardRefExoticComponent<ButtonProps & {
|
|
57
|
+
index?: number;
|
|
58
|
+
} & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
59
|
+
useArray: () => IArrayBaseContext;
|
|
60
|
+
useIndex: (index?: number) => number;
|
|
61
|
+
useRecord: (record?: number) => any;
|
|
62
|
+
mixin: typeof mixin;
|
|
63
|
+
};
|
|
64
|
+
export default ArrayBase;
|