@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,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IFormFeedback } from '@tachybase/schema';
|
|
3
|
+
import { ButtonProps } from 'antd/lib/button';
|
|
4
|
+
export interface ISubmitProps extends ButtonProps {
|
|
5
|
+
onClick?: (e: React.MouseEvent<Element, MouseEvent>) => any;
|
|
6
|
+
onSubmit?: (values: any) => any;
|
|
7
|
+
onSubmitSuccess?: (payload: any) => void;
|
|
8
|
+
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const Submit: React.FC<React.PropsWithChildren<ISubmitProps>>;
|
|
11
|
+
export default Submit;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 submit_exports = {};
|
|
29
|
+
__export(submit_exports, {
|
|
30
|
+
Submit: () => Submit,
|
|
31
|
+
default: () => submit_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(submit_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_schema = require("@tachybase/schema");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
const Submit = (0, import_schema.observer)(
|
|
38
|
+
({ onSubmit, onSubmitFailed, onSubmitSuccess, ...props }) => {
|
|
39
|
+
const form = (0, import_schema.useParentForm)();
|
|
40
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
41
|
+
import_antd.Button,
|
|
42
|
+
{
|
|
43
|
+
htmlType: onSubmit ? "button" : "submit",
|
|
44
|
+
type: "primary",
|
|
45
|
+
...props,
|
|
46
|
+
loading: props.loading !== void 0 ? props.loading : form.submitting,
|
|
47
|
+
onClick: (e) => {
|
|
48
|
+
if (props.onClick) {
|
|
49
|
+
if (props.onClick(e) === false) return;
|
|
50
|
+
}
|
|
51
|
+
if (onSubmit) {
|
|
52
|
+
form.submit(onSubmit).then(onSubmitSuccess).catch(onSubmitFailed);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
props.children
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
forwardRef: true
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
var submit_default = Submit;
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
Submit
|
|
67
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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 switch_exports = {};
|
|
19
|
+
__export(switch_exports, {
|
|
20
|
+
Switch: () => Switch,
|
|
21
|
+
default: () => switch_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(switch_exports);
|
|
24
|
+
var import_schema = require("@tachybase/schema");
|
|
25
|
+
var import_antd = require("antd");
|
|
26
|
+
const Switch = (0, import_schema.connect)(
|
|
27
|
+
import_antd.Switch,
|
|
28
|
+
(0, import_schema.mapProps)(
|
|
29
|
+
{
|
|
30
|
+
value: "checked"
|
|
31
|
+
},
|
|
32
|
+
(props) => {
|
|
33
|
+
delete props["value"];
|
|
34
|
+
return {
|
|
35
|
+
...props
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
var switch_default = Switch;
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
Switch
|
|
44
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
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 time_picker_exports = {};
|
|
20
|
+
__export(time_picker_exports, {
|
|
21
|
+
TimePicker: () => TimePicker,
|
|
22
|
+
default: () => time_picker_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(time_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 mapTimeFormat = /* @__PURE__ */ __name(function() {
|
|
30
|
+
return (props) => {
|
|
31
|
+
const format = props["format"] || "HH:mm:ss";
|
|
32
|
+
const onChange = props.onChange;
|
|
33
|
+
return {
|
|
34
|
+
...props,
|
|
35
|
+
format,
|
|
36
|
+
value: (0, import_builtins.dayjsable)(props.value, format),
|
|
37
|
+
onChange: /* @__PURE__ */ __name((value) => {
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onChange((0, import_builtins.formatDayjsValue)(value, format));
|
|
40
|
+
}
|
|
41
|
+
}, "onChange")
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, "mapTimeFormat");
|
|
45
|
+
const InternalTimePicker = (0, import_schema.connect)(
|
|
46
|
+
import_antd.TimePicker,
|
|
47
|
+
(0, import_schema.mapProps)(mapTimeFormat()),
|
|
48
|
+
(0, import_schema.mapReadPretty)(import_preview_text.PreviewText.TimePicker)
|
|
49
|
+
);
|
|
50
|
+
const RangePicker = (0, import_schema.connect)(
|
|
51
|
+
import_antd.TimePicker.RangePicker,
|
|
52
|
+
(0, import_schema.mapProps)(mapTimeFormat()),
|
|
53
|
+
(0, import_schema.mapReadPretty)(import_preview_text.PreviewText.TimeRangePicker)
|
|
54
|
+
);
|
|
55
|
+
const TimePicker = Object.assign(InternalTimePicker, { RangePicker });
|
|
56
|
+
var time_picker_default = TimePicker;
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
TimePicker
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'antd/lib/time-picker/style/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var import_style = require("antd/lib/time-picker/style/index");
|
|
@@ -0,0 +1,56 @@
|
|
|
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 transfer_exports = {};
|
|
20
|
+
__export(transfer_exports, {
|
|
21
|
+
Transfer: () => Transfer,
|
|
22
|
+
default: () => transfer_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(transfer_exports);
|
|
25
|
+
var import_schema = require("@tachybase/schema");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
const Transfer = (0, import_schema.connect)(
|
|
28
|
+
import_antd.Transfer,
|
|
29
|
+
(0, import_schema.mapProps)(
|
|
30
|
+
{
|
|
31
|
+
value: "targetKeys"
|
|
32
|
+
},
|
|
33
|
+
(props, field) => {
|
|
34
|
+
var _a;
|
|
35
|
+
if ((0, import_schema.isVoidField)(field)) return props;
|
|
36
|
+
return {
|
|
37
|
+
...props,
|
|
38
|
+
dataSource: ((_a = field.dataSource) == null ? void 0 : _a.map((item) => {
|
|
39
|
+
return {
|
|
40
|
+
...item,
|
|
41
|
+
title: item.title || item.label,
|
|
42
|
+
key: item.key || item.value
|
|
43
|
+
};
|
|
44
|
+
})) || []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
Transfer.defaultProps = {
|
|
50
|
+
render: /* @__PURE__ */ __name((item) => item.title ?? null, "render")
|
|
51
|
+
};
|
|
52
|
+
var transfer_default = Transfer;
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
Transfer
|
|
56
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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 tree_select_exports = {};
|
|
29
|
+
__export(tree_select_exports, {
|
|
30
|
+
TreeSelect: () => TreeSelect,
|
|
31
|
+
default: () => tree_select_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(tree_select_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_schema = require("@tachybase/schema");
|
|
36
|
+
var import_icons = require("@ant-design/icons");
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_preview_text = require("../preview-text");
|
|
39
|
+
const TreeSelect = (0, import_schema.connect)(
|
|
40
|
+
import_antd.TreeSelect,
|
|
41
|
+
(0, import_schema.mapProps)(
|
|
42
|
+
{
|
|
43
|
+
dataSource: "treeData"
|
|
44
|
+
},
|
|
45
|
+
(props, field) => {
|
|
46
|
+
return {
|
|
47
|
+
...props,
|
|
48
|
+
suffixIcon: (field == null ? void 0 : field["loading"]) || (field == null ? void 0 : field["validating"]) ? /* @__PURE__ */ import_react.default.createElement(import_icons.LoadingOutlined, null) : props.suffixIcon
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
(0, import_schema.mapReadPretty)(import_preview_text.PreviewText.TreeSelect)
|
|
53
|
+
);
|
|
54
|
+
var tree_select_default = TreeSelect;
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
TreeSelect
|
|
58
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DraggerProps as AntdDraggerProps, UploadProps as AntdUploadProps } from 'antd/lib/upload';
|
|
3
|
+
import { UploadFile } from 'antd/lib/upload/interface';
|
|
4
|
+
export type IUploadProps = Omit<AntdUploadProps, 'onChange'> & {
|
|
5
|
+
textContent?: React.ReactNode;
|
|
6
|
+
onChange?: (fileList: UploadFile[]) => void;
|
|
7
|
+
serviceErrorMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
export type IDraggerUploadProps = Omit<AntdDraggerProps, 'onChange'> & {
|
|
10
|
+
textContent?: React.ReactNode;
|
|
11
|
+
onChange?: (fileList: UploadFile[]) => void;
|
|
12
|
+
serviceErrorMessage?: string;
|
|
13
|
+
};
|
|
14
|
+
type ComposedUpload = React.FC<React.PropsWithChildren<IUploadProps>> & {
|
|
15
|
+
Dragger?: React.FC<React.PropsWithChildren<IDraggerUploadProps>>;
|
|
16
|
+
};
|
|
17
|
+
export declare const Upload: ComposedUpload;
|
|
18
|
+
export default Upload;
|
|
@@ -0,0 +1,159 @@
|
|
|
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 upload_exports = {};
|
|
30
|
+
__export(upload_exports, {
|
|
31
|
+
Upload: () => Upload,
|
|
32
|
+
default: () => upload_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(upload_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_builtins = require("../__builtins__");
|
|
40
|
+
var import_placeholder = require("./placeholder");
|
|
41
|
+
const testOpts = /* @__PURE__ */ __name((ext, options) => {
|
|
42
|
+
if (options && (0, import_schema.isArr)(options.include)) {
|
|
43
|
+
return options.include.some((url) => ext.test(url));
|
|
44
|
+
}
|
|
45
|
+
if (options && (0, import_schema.isArr)(options.exclude)) {
|
|
46
|
+
return !options.exclude.some((url) => ext.test(url));
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}, "testOpts");
|
|
50
|
+
const getImageByUrl = /* @__PURE__ */ __name((url, options) => {
|
|
51
|
+
for (let i = 0; i < import_placeholder.UPLOAD_PLACEHOLDER.length; i++) {
|
|
52
|
+
if (import_placeholder.UPLOAD_PLACEHOLDER[i].ext.test(url) && testOpts(import_placeholder.UPLOAD_PLACEHOLDER[i].ext, options)) {
|
|
53
|
+
return import_placeholder.UPLOAD_PLACEHOLDER[i].icon || url;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return url;
|
|
57
|
+
}, "getImageByUrl");
|
|
58
|
+
const getURL = /* @__PURE__ */ __name((target) => {
|
|
59
|
+
return (target == null ? void 0 : target["url"]) || (target == null ? void 0 : target["downloadURL"]) || (target == null ? void 0 : target["imgURL"]);
|
|
60
|
+
}, "getURL");
|
|
61
|
+
const getThumbURL = /* @__PURE__ */ __name((target) => {
|
|
62
|
+
return (target == null ? void 0 : target["thumbUrl"]) || (target == null ? void 0 : target["url"]) || (target == null ? void 0 : target["downloadURL"]) || (target == null ? void 0 : target["imgURL"]);
|
|
63
|
+
}, "getThumbURL");
|
|
64
|
+
const getErrorMessage = /* @__PURE__ */ __name((target) => {
|
|
65
|
+
return (target == null ? void 0 : target.errorMessage) || (target == null ? void 0 : target.errMsg) || (target == null ? void 0 : target.errorMsg) || (target == null ? void 0 : target.message) || (typeof (target == null ? void 0 : target.error) === "string" ? target.error : "");
|
|
66
|
+
}, "getErrorMessage");
|
|
67
|
+
const getState = /* @__PURE__ */ __name((target) => {
|
|
68
|
+
if ((target == null ? void 0 : target.success) === false) return "error";
|
|
69
|
+
if ((target == null ? void 0 : target.failed) === true) return "error";
|
|
70
|
+
if (target == null ? void 0 : target.error) return "error";
|
|
71
|
+
return (target == null ? void 0 : target.state) || (target == null ? void 0 : target.status);
|
|
72
|
+
}, "getState");
|
|
73
|
+
const normalizeFileList = /* @__PURE__ */ __name((fileList) => {
|
|
74
|
+
if (fileList && fileList.length) {
|
|
75
|
+
return fileList.map((file, index) => {
|
|
76
|
+
return {
|
|
77
|
+
...file,
|
|
78
|
+
uid: file.uid || `${index}`,
|
|
79
|
+
status: getState(file.response) || getState(file),
|
|
80
|
+
url: getURL(file) || getURL(file == null ? void 0 : file.response),
|
|
81
|
+
thumbUrl: getImageByUrl(getThumbURL(file) || getThumbURL(file == null ? void 0 : file.response), {
|
|
82
|
+
exclude: [".png", ".jpg", ".jpeg", ".gif"]
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}, "normalizeFileList");
|
|
89
|
+
const useValidator = /* @__PURE__ */ __name((validator) => {
|
|
90
|
+
const field = (0, import_schema.useField)();
|
|
91
|
+
(0, import_react.useEffect)(() => {
|
|
92
|
+
const dispose = (0, import_schema.reaction)(
|
|
93
|
+
() => field.value,
|
|
94
|
+
(value) => {
|
|
95
|
+
const message = validator(value);
|
|
96
|
+
field.setFeedback({
|
|
97
|
+
type: "error",
|
|
98
|
+
code: "UploadError",
|
|
99
|
+
messages: message ? [message] : []
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return () => {
|
|
104
|
+
dispose();
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
}, "useValidator");
|
|
108
|
+
const useUploadValidator = /* @__PURE__ */ __name((serviceErrorMessage = "Upload Service Error") => {
|
|
109
|
+
useValidator((value) => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
const list = (0, import_schema.toArr)(value);
|
|
112
|
+
for (let i = 0; i < list.length; i++) {
|
|
113
|
+
if (((_a = list[i]) == null ? void 0 : _a.status) === "error") {
|
|
114
|
+
return getErrorMessage((_b = list[i]) == null ? void 0 : _b.response) || getErrorMessage(list[i]) || serviceErrorMessage;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}, "useUploadValidator");
|
|
119
|
+
function useUploadProps({ serviceErrorMessage, ...props }) {
|
|
120
|
+
useUploadValidator(serviceErrorMessage);
|
|
121
|
+
const onChange = /* @__PURE__ */ __name((param) => {
|
|
122
|
+
var _a;
|
|
123
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, normalizeFileList([...param.fileList]));
|
|
124
|
+
}, "onChange");
|
|
125
|
+
return {
|
|
126
|
+
...props,
|
|
127
|
+
fileList: normalizeFileList(props.fileList),
|
|
128
|
+
onChange
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
__name(useUploadProps, "useUploadProps");
|
|
132
|
+
const getPlaceholder = /* @__PURE__ */ __name((props) => {
|
|
133
|
+
if (props.listType !== "picture-card") {
|
|
134
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Button, null, /* @__PURE__ */ import_react.default.createElement(import_icons.UploadOutlined, null), props.textContent);
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}, "getPlaceholder");
|
|
138
|
+
const Upload = (0, import_schema.connect)(
|
|
139
|
+
(props) => {
|
|
140
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Upload, { ...useUploadProps(props) }, props.children || getPlaceholder(props));
|
|
141
|
+
},
|
|
142
|
+
(0, import_schema.mapProps)({
|
|
143
|
+
value: "fileList"
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
const Dragger = (0, import_schema.connect)(
|
|
147
|
+
(props) => {
|
|
148
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_builtins.usePrefixCls)("upload-dragger") }, /* @__PURE__ */ import_react.default.createElement(import_antd.Upload.Dragger, { ...useUploadProps(props) }, props.children || /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("p", { className: "ant-upload-drag-icon" }, /* @__PURE__ */ import_react.default.createElement(import_icons.InboxOutlined, null)), props.textContent && /* @__PURE__ */ import_react.default.createElement("p", { className: "ant-upload-text" }, props.textContent))));
|
|
149
|
+
},
|
|
150
|
+
(0, import_schema.mapProps)({
|
|
151
|
+
value: "fileList"
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
Upload.Dragger = Dragger;
|
|
155
|
+
var upload_default = Upload;
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
Upload
|
|
159
|
+
});
|
|
@@ -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 __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 placeholder_exports = {};
|
|
19
|
+
__export(placeholder_exports, {
|
|
20
|
+
UPLOAD_PLACEHOLDER: () => UPLOAD_PLACEHOLDER
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(placeholder_exports);
|
|
23
|
+
const UPLOAD_PLACEHOLDER = [
|
|
24
|
+
{
|
|
25
|
+
ext: /\.docx/i,
|
|
26
|
+
icon: "//img.alicdn.com/tfs/TB1n8jfr1uSBuNjy1XcXXcYjFXa-200-200.png"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
ext: /\.pptx/i,
|
|
30
|
+
icon: "//img.alicdn.com/tfs/TB1ItgWr_tYBeNjy1XdXXXXyVXa-200-200.png"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
ext: /\.jpe?g/i,
|
|
34
|
+
icon: "//img.alicdn.com/tfs/TB1wrT5r9BYBeNjy0FeXXbnmFXa-200-200.png"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
ext: /\.pdf/i,
|
|
38
|
+
icon: "//img.alicdn.com/tfs/TB1GwD8r9BYBeNjy0FeXXbnmFXa-200-200.png"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
ext: /\.png/i,
|
|
42
|
+
icon: "//img.alicdn.com/tfs/TB1BHT5r9BYBeNjy0FeXXbnmFXa-200-200.png"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
ext: /\.eps/i,
|
|
46
|
+
icon: "//img.alicdn.com/tfs/TB1G_iGrVOWBuNjy0FiXXXFxVXa-200-200.png"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
ext: /\.ai/i,
|
|
50
|
+
icon: "//img.alicdn.com/tfs/TB1B2cVr_tYBeNjy1XdXXXXyVXa-200-200.png"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
ext: /\.gif/i,
|
|
54
|
+
icon: "//img.alicdn.com/tfs/TB1DTiGrVOWBuNjy0FiXXXFxVXa-200-200.png"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
ext: /\.svg/i,
|
|
58
|
+
icon: "//img.alicdn.com/tfs/TB1uUm9rY9YBuNjy0FgXXcxcXXa-200-200.png"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
ext: /\.xlsx?/i,
|
|
62
|
+
icon: "//img.alicdn.com/tfs/TB1any1r1OSBuNjy0FdXXbDnVXa-200-200.png"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
ext: /\.psd?/i,
|
|
66
|
+
icon: "//img.alicdn.com/tfs/TB1_nu1r1OSBuNjy0FdXXbDnVXa-200-200.png"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
ext: /\.(wav|aif|aiff|au|mp1|mp2|mp3|ra|rm|ram|mid|rmi)/i,
|
|
70
|
+
icon: "//img.alicdn.com/tfs/TB1jPvwr49YBuNjy0FfXXXIsVXa-200-200.png"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
ext: /\.(avi|wmv|mpg|mpeg|vob|dat|3gp|mp4|mkv|rm|rmvb|mov|flv)/i,
|
|
74
|
+
icon: "//img.alicdn.com/tfs/TB1FrT5r9BYBeNjy0FeXXbnmFXa-200-200.png"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
ext: /\.(zip|rar|arj|z|gz|iso|jar|ace|tar|uue|dmg|pkg|lzh|cab)/i,
|
|
78
|
+
icon: "//img.alicdn.com/tfs/TB10jmfr29TBuNjy0FcXXbeiFXa-200-200.png"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
ext: /\.[^.]+/i,
|
|
82
|
+
icon: "//img.alicdn.com/tfs/TB10.R4r3mTBuNjy1XbXXaMrVXa-200-200.png"
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
UPLOAD_PLACEHOLDER
|
|
88
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/components",
|
|
3
|
+
"version": "0.23.8",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ant-design/cssinjs": "^1.22.1",
|
|
9
|
+
"@ant-design/icons": "^5.5.2",
|
|
10
|
+
"@dnd-kit/core": "^6.3.1",
|
|
11
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
12
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
13
|
+
"@monaco-editor/react": "^4.6.0",
|
|
14
|
+
"antd": "5.22.5",
|
|
15
|
+
"classnames": "^2.5.1",
|
|
16
|
+
"dayjs": "1.11.13",
|
|
17
|
+
"prop-types": "^15.8.1",
|
|
18
|
+
"react-modal": "^3.16.3",
|
|
19
|
+
"react-sticky-box": "^1.0.2",
|
|
20
|
+
"@tachybase/schema": "0.23.8"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"rc-cascader": "3.31.0",
|
|
24
|
+
"rc-input-number": "9.3.0",
|
|
25
|
+
"rc-picker": "4.9.0",
|
|
26
|
+
"rc-tree-select": "5.25.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tachybase-build --no-dts @tachybase/components"
|
|
30
|
+
}
|
|
31
|
+
}
|