@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,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var checkbox_exports = {};
|
|
19
|
+
__export(checkbox_exports, {
|
|
20
|
+
Checkbox: () => Checkbox,
|
|
21
|
+
default: () => checkbox_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(checkbox_exports);
|
|
24
|
+
var import_schema = require("@tachybase/schema");
|
|
25
|
+
var import_antd = require("antd");
|
|
26
|
+
var import_preview_text = require("../preview-text");
|
|
27
|
+
const InternalCheckbox = (0, import_schema.connect)(
|
|
28
|
+
import_antd.Checkbox,
|
|
29
|
+
(0, import_schema.mapProps)({
|
|
30
|
+
value: "checked",
|
|
31
|
+
onInput: "onChange"
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
const Group = (0, import_schema.connect)(
|
|
35
|
+
import_antd.Checkbox.Group,
|
|
36
|
+
(0, import_schema.mapProps)({
|
|
37
|
+
dataSource: "options"
|
|
38
|
+
}),
|
|
39
|
+
(0, import_schema.mapReadPretty)(import_preview_text.PreviewText.Select, {
|
|
40
|
+
mode: "tags"
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
const Checkbox = Object.assign(InternalCheckbox, {
|
|
44
|
+
__ANT_CHECKBOX: true,
|
|
45
|
+
Group
|
|
46
|
+
});
|
|
47
|
+
var checkbox_default = Checkbox;
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
Checkbox
|
|
51
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const CodeMirror: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
|
|
3
|
+
export declare const CodeEditor: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,91 @@
|
|
|
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 __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var code_mirror_exports = {};
|
|
29
|
+
__export(code_mirror_exports, {
|
|
30
|
+
CodeEditor: () => CodeEditor,
|
|
31
|
+
CodeMirror: () => CodeMirror
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(code_mirror_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_schema = require("@tachybase/schema");
|
|
36
|
+
var import_react2 = __toESM(require("@monaco-editor/react"));
|
|
37
|
+
import_react2.loader.config({ paths: { vs: "https://assets.tachybase.com/monaco-editor@0.52.0/min/vs" } });
|
|
38
|
+
const CodeMirror = (0, import_schema.connect)(
|
|
39
|
+
({ value, onChange, ...otherProps }) => {
|
|
40
|
+
const monaco = (0, import_react2.useMonaco)();
|
|
41
|
+
(0, import_react.useEffect)(() => {
|
|
42
|
+
if (monaco) {
|
|
43
|
+
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
44
|
+
jsx: 4
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [monaco]);
|
|
48
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
49
|
+
import_react2.default,
|
|
50
|
+
{
|
|
51
|
+
options: { readOnly: !!otherProps.disabled },
|
|
52
|
+
value,
|
|
53
|
+
height: "300px",
|
|
54
|
+
defaultLanguage: "javascript",
|
|
55
|
+
onChange,
|
|
56
|
+
...otherProps
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
(0, import_schema.mapReadPretty)(({ value, onChange, ...otherProps }) => {
|
|
61
|
+
const monaco = (0, import_react2.useMonaco)();
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
if (monaco) {
|
|
64
|
+
monaco.editor.EditorOptions.readOnly.defaultValue = true;
|
|
65
|
+
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
66
|
+
jsx: 4
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}, [monaco]);
|
|
70
|
+
if (value == null) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
74
|
+
import_react2.default,
|
|
75
|
+
{
|
|
76
|
+
options: { readOnly: true },
|
|
77
|
+
value,
|
|
78
|
+
height: "300px",
|
|
79
|
+
defaultLanguage: "javascript",
|
|
80
|
+
onChange,
|
|
81
|
+
...otherProps
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
const CodeEditor = CodeMirror;
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
CodeEditor,
|
|
90
|
+
CodeMirror
|
|
91
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
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 date_picker_exports = {};
|
|
20
|
+
__export(date_picker_exports, {
|
|
21
|
+
DatePicker: () => DatePicker,
|
|
22
|
+
default: () => date_picker_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(date_picker_exports);
|
|
25
|
+
var import_schema = require("@tachybase/schema");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_builtins = require("../__builtins__");
|
|
28
|
+
var import_preview_text = require("../preview-text");
|
|
29
|
+
const mapDateFormat = /* @__PURE__ */ __name(function() {
|
|
30
|
+
const getDefaultFormat = /* @__PURE__ */ __name((props) => {
|
|
31
|
+
if (props["picker"] === "month") {
|
|
32
|
+
return "YYYY-MM";
|
|
33
|
+
} else if (props["picker"] === "quarter") {
|
|
34
|
+
return "YYYY-\\QQ";
|
|
35
|
+
} else if (props["picker"] === "year") {
|
|
36
|
+
return "YYYY";
|
|
37
|
+
} else if (props["picker"] === "week") {
|
|
38
|
+
return "gggg-wo";
|
|
39
|
+
}
|
|
40
|
+
return props["showTime"] ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
41
|
+
}, "getDefaultFormat");
|
|
42
|
+
return (props) => {
|
|
43
|
+
const format = props["format"] || getDefaultFormat(props);
|
|
44
|
+
const onChange = props.onChange;
|
|
45
|
+
return {
|
|
46
|
+
...props,
|
|
47
|
+
format,
|
|
48
|
+
value: (0, import_builtins.dayjsable)(props.value, format === "gggg-wo" ? "gggg-ww" : format),
|
|
49
|
+
onChange: /* @__PURE__ */ __name((value) => {
|
|
50
|
+
if (onChange) {
|
|
51
|
+
onChange((0, import_builtins.formatDayjsValue)(value, format));
|
|
52
|
+
}
|
|
53
|
+
}, "onChange")
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}, "mapDateFormat");
|
|
57
|
+
const InternalDatePicker = (0, import_schema.connect)(import_antd.DatePicker, (0, import_schema.mapProps)(mapDateFormat()), (0, import_schema.mapReadPretty)(import_preview_text.PreviewText.DatePicker));
|
|
58
|
+
const RangePicker = (0, import_schema.connect)(
|
|
59
|
+
import_antd.DatePicker.RangePicker,
|
|
60
|
+
(0, import_schema.mapProps)(mapDateFormat()),
|
|
61
|
+
(0, import_schema.mapReadPretty)(import_preview_text.PreviewText.DateRangePicker)
|
|
62
|
+
);
|
|
63
|
+
const DatePicker = Object.assign(InternalDatePicker, {
|
|
64
|
+
RangePicker
|
|
65
|
+
});
|
|
66
|
+
var date_picker_default = DatePicker;
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
DatePicker
|
|
70
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'antd/lib/date-picker/style/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var import_style = require("antd/lib/date-picker/style/index");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactFC } from '@tachybase/schema';
|
|
3
|
+
import { PopoverProps } from 'antd/lib/popover';
|
|
4
|
+
import { IFormItemProps } from '../form-item';
|
|
5
|
+
export declare const Editable: ReactFC<IFormItemProps> & {
|
|
6
|
+
Popover: React.MemoExoticComponent<ReactFC<PopoverProps>>;
|
|
7
|
+
};
|
|
8
|
+
export default Editable;
|
|
@@ -0,0 +1,181 @@
|
|
|
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 editable_exports = {};
|
|
30
|
+
__export(editable_exports, {
|
|
31
|
+
Editable: () => Editable,
|
|
32
|
+
default: () => editable_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(editable_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_schema = require("@tachybase/schema");
|
|
37
|
+
var import_icons = require("@ant-design/icons");
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_classnames = __toESM(require("classnames"));
|
|
40
|
+
var import_builtins = require("../__builtins__");
|
|
41
|
+
var import_form_item = require("../form-item");
|
|
42
|
+
var import_style = __toESM(require("./style"));
|
|
43
|
+
const useParentPattern = /* @__PURE__ */ __name(() => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const field = (0, import_schema.useField)();
|
|
46
|
+
return ((_a = field == null ? void 0 : field.parent) == null ? void 0 : _a.pattern) || ((_b = field == null ? void 0 : field.form) == null ? void 0 : _b.pattern);
|
|
47
|
+
}, "useParentPattern");
|
|
48
|
+
const useEditable = /* @__PURE__ */ __name(() => {
|
|
49
|
+
const pattern = useParentPattern();
|
|
50
|
+
const field = (0, import_schema.useField)();
|
|
51
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
52
|
+
if (pattern === "editable") {
|
|
53
|
+
return field.setPattern("readPretty");
|
|
54
|
+
}
|
|
55
|
+
}, [pattern]);
|
|
56
|
+
return [
|
|
57
|
+
field.pattern === "editable",
|
|
58
|
+
(payload) => {
|
|
59
|
+
if (pattern !== "editable") return;
|
|
60
|
+
field.setPattern(payload ? "editable" : "readPretty");
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
}, "useEditable");
|
|
64
|
+
const useFormItemProps = /* @__PURE__ */ __name(() => {
|
|
65
|
+
const field = (0, import_schema.useField)();
|
|
66
|
+
if ((0, import_schema.isVoidField)(field)) return {};
|
|
67
|
+
if (!field) return {};
|
|
68
|
+
const takeMessage = /* @__PURE__ */ __name(() => {
|
|
69
|
+
if (field.selfErrors.length) return field.selfErrors;
|
|
70
|
+
if (field.selfWarnings.length) return field.selfWarnings;
|
|
71
|
+
if (field.selfSuccesses.length) return field.selfSuccesses;
|
|
72
|
+
}, "takeMessage");
|
|
73
|
+
return {
|
|
74
|
+
feedbackStatus: field.validateStatus === "validating" ? "pending" : field.validateStatus,
|
|
75
|
+
feedbackText: takeMessage(),
|
|
76
|
+
extra: field.description
|
|
77
|
+
};
|
|
78
|
+
}, "useFormItemProps");
|
|
79
|
+
const InternalEditable = (0, import_schema.observer)((props) => {
|
|
80
|
+
const [editable, setEditable] = useEditable();
|
|
81
|
+
const pattern = useParentPattern();
|
|
82
|
+
const itemProps = useFormItemProps();
|
|
83
|
+
const field = (0, import_schema.useField)();
|
|
84
|
+
const basePrefixCls = (0, import_builtins.usePrefixCls)();
|
|
85
|
+
const prefixCls = (0, import_builtins.usePrefixCls)("formily-editable");
|
|
86
|
+
const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
|
|
87
|
+
const ref = (0, import_react.useRef)();
|
|
88
|
+
const innerRef = (0, import_react.useRef)(null);
|
|
89
|
+
const recover = /* @__PURE__ */ __name(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (ref.current && !((_a = field == null ? void 0 : field.errors) == null ? void 0 : _a.length)) {
|
|
92
|
+
setEditable(false);
|
|
93
|
+
}
|
|
94
|
+
}, "recover");
|
|
95
|
+
const renderEditHelper = /* @__PURE__ */ __name(() => {
|
|
96
|
+
if (editable) return;
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(import_form_item.BaseItem, { ...props, ...itemProps }, pattern === "editable" && /* @__PURE__ */ import_react.default.createElement(import_icons.EditOutlined, { className: `${prefixCls}-edit-btn` }), pattern !== "editable" && /* @__PURE__ */ import_react.default.createElement(import_icons.MessageOutlined, { className: `${prefixCls}-edit-btn` }));
|
|
98
|
+
}, "renderEditHelper");
|
|
99
|
+
const renderCloseHelper = /* @__PURE__ */ __name(() => {
|
|
100
|
+
if (!editable) return;
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement(import_form_item.BaseItem, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_icons.CloseOutlined, { className: `${prefixCls}-close-btn` }));
|
|
102
|
+
}, "renderCloseHelper");
|
|
103
|
+
(0, import_builtins.useClickAway)((e) => {
|
|
104
|
+
const target = e.target;
|
|
105
|
+
if (target == null ? void 0 : target.closest(`.${basePrefixCls}-select-dropdown`)) return;
|
|
106
|
+
if (target == null ? void 0 : target.closest(`.${basePrefixCls}-picker-dropdown`)) return;
|
|
107
|
+
if (target == null ? void 0 : target.closest(`.${basePrefixCls}-cascader-menus`)) return;
|
|
108
|
+
recover();
|
|
109
|
+
}, innerRef);
|
|
110
|
+
const onClick = /* @__PURE__ */ __name((e) => {
|
|
111
|
+
var _a;
|
|
112
|
+
const target = e.target;
|
|
113
|
+
const close = ((_a = innerRef.current) == null ? void 0 : _a.querySelector(`.${prefixCls}-close-btn`)) || null;
|
|
114
|
+
if ((target == null ? void 0 : target.contains(close)) || (close == null ? void 0 : close.contains(target))) {
|
|
115
|
+
recover();
|
|
116
|
+
} else if (!ref.current) {
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
setEditable(true);
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
var _a2, _b;
|
|
121
|
+
(_b = (_a2 = innerRef.current) == null ? void 0 : _a2.querySelector("input")) == null ? void 0 : _b.focus();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, "onClick");
|
|
126
|
+
ref.current = editable;
|
|
127
|
+
return wrapSSR(
|
|
128
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(prefixCls, hashId), ref: innerRef, onClick }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-content` }, /* @__PURE__ */ import_react.default.createElement(import_form_item.BaseItem, { ...props, ...itemProps }, props.children), renderEditHelper(), renderCloseHelper()))
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
const Popover = (0, import_schema.observer)((props) => {
|
|
132
|
+
const field = (0, import_schema.useField)();
|
|
133
|
+
const pattern = useParentPattern();
|
|
134
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
135
|
+
const prefixCls = (0, import_builtins.usePrefixCls)("formily-editable");
|
|
136
|
+
const [wrapSSR, hashId] = (0, import_style.default)(prefixCls);
|
|
137
|
+
const closePopover = /* @__PURE__ */ __name(async () => {
|
|
138
|
+
try {
|
|
139
|
+
await field.form.validate(`${field.address}.*`);
|
|
140
|
+
} finally {
|
|
141
|
+
const errors = field.form.queryFeedbacks({
|
|
142
|
+
type: "error",
|
|
143
|
+
address: `${field.address}.*`
|
|
144
|
+
});
|
|
145
|
+
if (!(errors == null ? void 0 : errors.length)) {
|
|
146
|
+
setOpen(false);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, "closePopover");
|
|
150
|
+
const openPopover = /* @__PURE__ */ __name(() => {
|
|
151
|
+
setOpen(true);
|
|
152
|
+
}, "openPopover");
|
|
153
|
+
return wrapSSR(
|
|
154
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
155
|
+
import_antd.Popover,
|
|
156
|
+
{
|
|
157
|
+
...props,
|
|
158
|
+
title: props.title || field.title,
|
|
159
|
+
open,
|
|
160
|
+
className: (0, import_classnames.default)(prefixCls, hashId, props.className),
|
|
161
|
+
content: props.children,
|
|
162
|
+
trigger: "click",
|
|
163
|
+
destroyTooltipOnHide: true,
|
|
164
|
+
onOpenChange: (open2) => {
|
|
165
|
+
if (open2) {
|
|
166
|
+
openPopover();
|
|
167
|
+
} else {
|
|
168
|
+
closePopover();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
/* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_form_item.BaseItem, { className: `${prefixCls}-trigger` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-content` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-preview` }, props.title || field.title), pattern === "editable" && /* @__PURE__ */ import_react.default.createElement(import_icons.EditOutlined, { className: `${prefixCls}-edit-btn` }), pattern !== "editable" && /* @__PURE__ */ import_react.default.createElement(import_icons.MessageOutlined, { className: `${prefixCls}-edit-btn` }))))
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
const Editable = Object.assign(InternalEditable, { Popover });
|
|
177
|
+
var editable_default = Editable;
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
Editable
|
|
181
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var style_exports = {};
|
|
19
|
+
__export(style_exports, {
|
|
20
|
+
default: () => style_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(style_exports);
|
|
23
|
+
var import_builtins = require("./../__builtins__");
|
|
24
|
+
var style_default = (0, import_builtins.genStyleHook)("editable", (token) => {
|
|
25
|
+
const { antCls, componentCls, fontSizeSM, colorPrimary } = token;
|
|
26
|
+
return {
|
|
27
|
+
[componentCls]: {
|
|
28
|
+
cursor: "pointer",
|
|
29
|
+
display: "inline-block !important",
|
|
30
|
+
[`${antCls}-form-text`]: {
|
|
31
|
+
display: "flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
[`${antCls}-tag`]: {
|
|
34
|
+
transition: "none !important"
|
|
35
|
+
},
|
|
36
|
+
[`${antCls}-tag:last-child`]: {
|
|
37
|
+
paddingInlineEnd: "0 !important"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[`${componentCls}-content`]: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
"> *": {
|
|
44
|
+
marginInlineEnd: 3,
|
|
45
|
+
"&:last-child": {
|
|
46
|
+
marginInlineEnd: 0
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[`${componentCls}-edit-btn,
|
|
51
|
+
${componentCls}-close-btn`]: {
|
|
52
|
+
transition: "all .25s ease-in-out",
|
|
53
|
+
color: "#aaa",
|
|
54
|
+
fontSize: fontSizeSM,
|
|
55
|
+
"&:hover": {
|
|
56
|
+
color: colorPrimary
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
[`${componentCls}-preview`]: {
|
|
60
|
+
whiteSpace: "nowrap",
|
|
61
|
+
textOverflow: "ellipsis",
|
|
62
|
+
overflow: "hidden",
|
|
63
|
+
wordBreak: "break-all",
|
|
64
|
+
maxWidth: "100%",
|
|
65
|
+
display: "block"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form as FormType, IFormFeedback, JSXComponent } from '@tachybase/schema';
|
|
3
|
+
import { IFormLayoutProps } from '../form-layout';
|
|
4
|
+
export interface FormProps extends IFormLayoutProps {
|
|
5
|
+
form?: FormType;
|
|
6
|
+
component?: JSXComponent;
|
|
7
|
+
onAutoSubmit?: (values: any) => any;
|
|
8
|
+
onAutoSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
|
9
|
+
previewTextPlaceholder?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const Form: React.FC<React.PropsWithChildren<FormProps>>;
|
|
12
|
+
export default Form;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 form_exports = {};
|
|
30
|
+
__export(form_exports, {
|
|
31
|
+
Form: () => Form,
|
|
32
|
+
default: () => form_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(form_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_schema = require("@tachybase/schema");
|
|
37
|
+
var import_form_layout = require("../form-layout");
|
|
38
|
+
var import_preview_text = require("../preview-text");
|
|
39
|
+
const Form = /* @__PURE__ */ __name(({
|
|
40
|
+
form,
|
|
41
|
+
component,
|
|
42
|
+
onAutoSubmit,
|
|
43
|
+
onAutoSubmitFailed,
|
|
44
|
+
previewTextPlaceholder,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const top = (0, import_schema.useParentForm)();
|
|
48
|
+
const renderContent = /* @__PURE__ */ __name((form2) => /* @__PURE__ */ import_react.default.createElement(import_schema.RecordScope, { getRecord: () => (0, import_schema.isForm)(form2) ? form2.values : form2.value }, /* @__PURE__ */ import_react.default.createElement(import_preview_text.PreviewText.Placeholder, { value: previewTextPlaceholder }, /* @__PURE__ */ import_react.default.createElement(import_form_layout.FormLayout, { ...props }, import_react.default.createElement(
|
|
49
|
+
component,
|
|
50
|
+
{
|
|
51
|
+
onSubmit(e) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
(_a = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a.call(e);
|
|
54
|
+
(_b = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b.call(e);
|
|
55
|
+
form2.submit(onAutoSubmit).catch(onAutoSubmitFailed);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
props.children
|
|
59
|
+
)))), "renderContent");
|
|
60
|
+
if (form) return /* @__PURE__ */ import_react.default.createElement(import_schema.FormProvider, { form }, renderContent(form));
|
|
61
|
+
if (!top) throw new Error("must pass form instance by createForm");
|
|
62
|
+
return renderContent(top);
|
|
63
|
+
}, "Form");
|
|
64
|
+
Form.defaultProps = {
|
|
65
|
+
component: "form"
|
|
66
|
+
};
|
|
67
|
+
var form_default = Form;
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
Form
|
|
71
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1. FormItem网格布局
|
|
3
|
+
* 2. 居中,居右,居左布局
|
|
4
|
+
* 3. 行内布局
|
|
5
|
+
* 4. 吸底布局
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { SpaceProps } from 'antd/lib/space';
|
|
9
|
+
import StickyBox from 'react-sticky-box';
|
|
10
|
+
interface IStickyProps extends React.ComponentProps<typeof StickyBox> {
|
|
11
|
+
align?: React.CSSProperties['textAlign'];
|
|
12
|
+
}
|
|
13
|
+
export declare const FormButtonGroup: {
|
|
14
|
+
({ align, gutter, ...props }: Omit<SpaceProps, "size" | "align"> & {
|
|
15
|
+
gutter?: any;
|
|
16
|
+
align?: any;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
defaultProps: {
|
|
19
|
+
align: string;
|
|
20
|
+
};
|
|
21
|
+
FormItem({ gutter, ...props }: {
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
gutter: any;
|
|
24
|
+
}): React.JSX.Element;
|
|
25
|
+
Sticky: ({ align, ...props }: React.PropsWithChildren<IStickyProps & React.HTMLProps<HTMLDivElement>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
26
|
+
};
|
|
27
|
+
export default FormButtonGroup;
|