@donglegeyu/company-ui 1.2.7 → 1.2.9
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/dist/cjs/basic-components/CompanyDrawer/index.js +5 -2
- package/dist/cjs/basic-components/CompanyFloatButton/index.d.ts +12 -2
- package/dist/cjs/basic-components/CompanyFloatButton/index.js +28 -2
- package/dist/cjs/basic-components/CompanyForm/index.d.ts +6 -1
- package/dist/cjs/basic-components/CompanyForm/index.js +42 -2
- package/dist/cjs/basic-components/CompanyForm/index.scss +63 -0
- package/dist/cjs/shared-components/BaseInfoForm/index.d.ts +2 -0
- package/dist/cjs/shared-components/BaseInfoForm/index.js +27 -16
- package/dist/cjs/shared-components/BaseInfoForm/index.scss +5 -1
- package/dist/cjs/shared-components/FilterOptionsDrawer/index.js +34 -31
- package/dist/cjs/template-components/DetailPageTemplate/index.d.ts +35 -0
- package/dist/cjs/template-components/DetailPageTemplate/index.js +152 -0
- package/dist/cjs/template-components/DetailPageTemplate/index.scss +177 -0
- package/dist/cjs/template-components/FilterForm/index.d.ts +2 -1
- package/dist/cjs/template-components/FilterForm/index.js +5 -3
- package/dist/cjs/template-components/FilterForm/index.scss +1 -21
- package/dist/cjs/template-components/SmartListTemplate/index.js +13 -3
- package/dist/cjs/template-components/StatisticsListPage/index.d.ts +78 -0
- package/dist/cjs/template-components/StatisticsListPage/index.js +427 -0
- package/dist/cjs/template-components/StatisticsListPage/index.scss +191 -0
- package/dist/cjs/template-components/index.d.ts +3 -1
- package/dist/cjs/template-components/index.js +5 -2
- package/dist/cjs/types/index.d.ts +7 -0
- package/dist/es/basic-components/CompanyDrawer/index.js +12 -2
- package/dist/es/basic-components/CompanyFloatButton/index.d.ts +12 -2
- package/dist/es/basic-components/CompanyFloatButton/index.js +26 -2
- package/dist/es/basic-components/CompanyForm/index.d.ts +6 -1
- package/dist/es/basic-components/CompanyForm/index.js +51 -3
- package/dist/es/basic-components/CompanyForm/index.scss +63 -0
- package/dist/es/shared-components/BaseInfoForm/index.d.ts +2 -0
- package/dist/es/shared-components/BaseInfoForm/index.js +16 -7
- package/dist/es/shared-components/BaseInfoForm/index.scss +5 -1
- package/dist/es/shared-components/FilterOptionsDrawer/index.js +72 -53
- package/dist/es/template-components/DetailPageTemplate/index.d.ts +35 -0
- package/dist/es/template-components/DetailPageTemplate/index.js +145 -0
- package/dist/es/template-components/DetailPageTemplate/index.scss +177 -0
- package/dist/es/template-components/FilterForm/index.d.ts +2 -1
- package/dist/es/template-components/FilterForm/index.js +8 -5
- package/dist/es/template-components/FilterForm/index.scss +1 -21
- package/dist/es/template-components/SmartListTemplate/index.js +15 -3
- package/dist/es/template-components/StatisticsListPage/index.d.ts +78 -0
- package/dist/es/template-components/{CommonListPage → StatisticsListPage}/index.js +474 -198
- package/dist/es/template-components/StatisticsListPage/index.scss +191 -0
- package/dist/es/template-components/index.d.ts +3 -1
- package/dist/es/template-components/index.js +2 -1
- package/dist/es/types/index.d.ts +7 -0
- package/package.json +2 -2
- package/dist/cjs/template-components/CommonListPage/index.d.ts +0 -33
- package/dist/cjs/template-components/CommonListPage/index.js +0 -186
- package/dist/es/template-components/CommonListPage/index.d.ts +0 -33
|
@@ -25,8 +25,11 @@ module.exports = __toCommonJS(CompanyDrawer_exports);
|
|
|
25
25
|
var import_antd = require("antd");
|
|
26
26
|
var import_theme = require("../../theme");
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var CompanyDrawer = (
|
|
29
|
-
|
|
28
|
+
var CompanyDrawer = ({
|
|
29
|
+
closable = { placement: "end" },
|
|
30
|
+
...restProps
|
|
31
|
+
}) => {
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Drawer, { closable, ...restProps }) });
|
|
30
33
|
};
|
|
31
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
35
|
0 && (module.exports = {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { FloatButton } from "antd";
|
|
3
|
+
import type { FloatButtonProps, FloatButtonRef, FloatButtonGroupProps } from "antd";
|
|
4
|
+
export type CompanyFloatButtonProps = FloatButtonProps;
|
|
5
|
+
export type CompanyFloatButtonRef = FloatButtonRef;
|
|
6
|
+
export type CompanyFloatButtonGroupProps = FloatButtonGroupProps;
|
|
7
|
+
export type CompanyFloatButtonBackTopProps = React.ComponentProps<typeof FloatButton.BackTop>;
|
|
8
|
+
export declare const CompanyFloatButton: React.ForwardRefExoticComponent<FloatButtonProps & React.RefAttributes<import("antd/es/float-button/FloatButton").FloatButtonElement>> & {
|
|
9
|
+
Group: React.FC<Readonly<FloatButtonGroupProps>>;
|
|
10
|
+
BackTop: React.ForwardRefExoticComponent<import("antd/es/float-button/BackTop").BackTopProps & React.RefAttributes<FloatButtonRef>>;
|
|
11
|
+
_InternalPanelDoNotUseOrYouWillBeFired: React.FC<import("antd/es/float-button/PurePanel").PurePanelProps>;
|
|
12
|
+
};
|
|
13
|
+
export declare const CompanyBackTop: React.FC<CompanyFloatButtonBackTopProps>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,21 +16,45 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
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
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/basic-components/CompanyFloatButton/index.tsx
|
|
20
30
|
var CompanyFloatButton_exports = {};
|
|
21
31
|
__export(CompanyFloatButton_exports, {
|
|
32
|
+
CompanyBackTop: () => CompanyBackTop,
|
|
22
33
|
CompanyFloatButton: () => CompanyFloatButton
|
|
23
34
|
});
|
|
24
35
|
module.exports = __toCommonJS(CompanyFloatButton_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
25
37
|
var import_antd = require("antd");
|
|
26
38
|
var import_theme = require("../../theme");
|
|
27
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.FloatButton, { ...props }) });
|
|
40
|
+
var CompanyFloatButtonComponent = import_react.default.forwardRef((props, ref) => {
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.FloatButton, { ref, ...props }) });
|
|
42
|
+
});
|
|
43
|
+
var CompanyFloatButtonGroup = (props) => {
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.FloatButton.Group, { ...props }) });
|
|
45
|
+
};
|
|
46
|
+
var CompanyFloatButtonBackTop = (props) => {
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.FloatButton.BackTop, { ...props }) });
|
|
48
|
+
};
|
|
49
|
+
var CompanyFloatButton = Object.assign(CompanyFloatButtonComponent, {
|
|
50
|
+
Group: CompanyFloatButtonGroup,
|
|
51
|
+
BackTop: CompanyFloatButtonBackTop
|
|
52
|
+
});
|
|
53
|
+
var CompanyBackTop = (props) => {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.FloatButton.BackTop, { ...props }) });
|
|
30
55
|
};
|
|
31
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
57
|
0 && (module.exports = {
|
|
58
|
+
CompanyBackTop,
|
|
33
59
|
CompanyFloatButton
|
|
34
60
|
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FormProps } from "antd";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export interface CompanyFormProps extends FormProps {
|
|
5
|
+
labelMaxWidth?: number;
|
|
6
|
+
labelAlignVertical?: 'center' | 'start';
|
|
7
|
+
}
|
|
3
8
|
export declare const CompanyForm: (<Values = any>(props: FormProps<Values> & {
|
|
4
9
|
children?: React.ReactNode;
|
|
5
10
|
} & React.RefAttributes<import("@rc-component/form/lib/interface").FormRef<Values>>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>) & Pick<React.FC<{}>, "displayName"> & {
|
|
@@ -8,7 +13,7 @@ export declare const CompanyForm: (<Values = any>(props: FormProps<Values> & {
|
|
|
8
13
|
useWatch: typeof import("@rc-component/form").useWatch;
|
|
9
14
|
Item: (<Values_1 = any>(props: import("antd").FormItemProps<Values_1>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>) & {
|
|
10
15
|
useStatus: () => {
|
|
11
|
-
status?: "" | "success" | "
|
|
16
|
+
status?: "" | "success" | "error" | "warning" | "validating" | undefined;
|
|
12
17
|
errors: React.ReactNode[];
|
|
13
18
|
warnings: React.ReactNode[];
|
|
14
19
|
};
|
|
@@ -24,10 +24,50 @@ __export(CompanyForm_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(CompanyForm_exports);
|
|
25
25
|
var import_antd = require("antd");
|
|
26
26
|
var import_theme = require("../../theme");
|
|
27
|
+
var import_index = require("./index.scss");
|
|
27
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var
|
|
29
|
-
|
|
29
|
+
var requiredMarkRight = (labelNode, { required }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
30
|
+
labelNode,
|
|
31
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { color: "#ff4d4f", marginLeft: 4 }, children: "*" })
|
|
32
|
+
] });
|
|
33
|
+
var CompanyFormComponent = ({
|
|
34
|
+
labelMaxWidth = 8,
|
|
35
|
+
labelAlignVertical = "center",
|
|
36
|
+
layout = "horizontal",
|
|
37
|
+
requiredMark,
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
...restProps
|
|
41
|
+
}) => {
|
|
42
|
+
const mergedStyle = {
|
|
43
|
+
["--company-label-max-width"]: `${labelMaxWidth}em`,
|
|
44
|
+
...style
|
|
45
|
+
};
|
|
46
|
+
const mergedRequiredMark = requiredMark !== void 0 ? requiredMark : layout === "vertical" ? requiredMarkRight : true;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { theme: import_theme.companyTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
import_antd.Form,
|
|
49
|
+
{
|
|
50
|
+
...restProps,
|
|
51
|
+
layout,
|
|
52
|
+
requiredMark: mergedRequiredMark,
|
|
53
|
+
"data-label-align": labelAlignVertical,
|
|
54
|
+
className: `company-form${className ? ` ${className}` : ""}`,
|
|
55
|
+
style: mergedStyle
|
|
56
|
+
}
|
|
57
|
+
) });
|
|
30
58
|
};
|
|
59
|
+
var CompanyForm = Object.assign(CompanyFormComponent, {
|
|
60
|
+
Item: import_antd.Form.Item,
|
|
61
|
+
List: import_antd.Form.List,
|
|
62
|
+
Provider: import_antd.Form.Provider,
|
|
63
|
+
useForm: import_antd.Form.useForm,
|
|
64
|
+
useWatch: import_antd.Form.useWatch,
|
|
65
|
+
useFormItemStatus: import_antd.Form.useFormItemStatus,
|
|
66
|
+
ErrorList: import_antd.Form.ErrorList,
|
|
67
|
+
useFormInstance: import_antd.Form.useFormInstance,
|
|
68
|
+
PREFIX: import_antd.Form.PREFIX,
|
|
69
|
+
NAME: import_antd.Form.NAME
|
|
70
|
+
});
|
|
31
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
72
|
0 && (module.exports = {
|
|
33
73
|
CompanyForm
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.company-form {
|
|
2
|
+
--company-label-max-width: 8em;
|
|
3
|
+
|
|
4
|
+
&[data-label-align="start"] {
|
|
5
|
+
.ant-form-item-horizontal .ant-form-item-label {
|
|
6
|
+
align-items: flex-start;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ant-form-item-horizontal.label-top {
|
|
11
|
+
.ant-form-item-label {
|
|
12
|
+
align-items: flex-start !important;
|
|
13
|
+
padding-top: 0.4em;
|
|
14
|
+
|
|
15
|
+
> label {
|
|
16
|
+
align-items: flex-start !important;
|
|
17
|
+
|
|
18
|
+
&::before {
|
|
19
|
+
align-self: flex-start !important;
|
|
20
|
+
top: 0 !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ant-form-item-horizontal {
|
|
27
|
+
.ant-form-item-label {
|
|
28
|
+
width: var(--company-label-max-width);
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ant-form-item-label > label {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
width: 100%;
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
height: auto;
|
|
40
|
+
white-space: normal;
|
|
41
|
+
word-break: break-word;
|
|
42
|
+
line-height: 1.14;
|
|
43
|
+
align-items: flex-end;
|
|
44
|
+
|
|
45
|
+
&::after {
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
align-self: flex-end;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::before {
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
align-self: flex-start;
|
|
53
|
+
position: relative;
|
|
54
|
+
top: 0.25em;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ant-form-item-control {
|
|
59
|
+
flex: 1;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -14,11 +14,13 @@ export interface FormField {
|
|
|
14
14
|
}[];
|
|
15
15
|
rules?: any[];
|
|
16
16
|
required?: boolean;
|
|
17
|
+
rows?: number;
|
|
17
18
|
}
|
|
18
19
|
export interface BaseInfoFormProps {
|
|
19
20
|
value: Record<string, any>;
|
|
20
21
|
fields: FormField[];
|
|
21
22
|
layout?: 'horizontal' | 'vertical';
|
|
23
|
+
labelMaxWidth?: number;
|
|
22
24
|
onChange?: (value: Record<string, any>) => void;
|
|
23
25
|
onFieldChange?: (field: string, value: any) => void;
|
|
24
26
|
}
|
|
@@ -31,10 +31,11 @@ var BaseInfoForm = (0, import_react.forwardRef)(({
|
|
|
31
31
|
value,
|
|
32
32
|
fields,
|
|
33
33
|
layout = "horizontal",
|
|
34
|
+
labelMaxWidth = 8,
|
|
34
35
|
onChange,
|
|
35
36
|
onFieldChange
|
|
36
37
|
}, ref) => {
|
|
37
|
-
const [form] =
|
|
38
|
+
const [form] = import_basic_components.CompanyForm.useForm();
|
|
38
39
|
const [contentWidth, setContentWidth] = (0, import_react.useState)(1200);
|
|
39
40
|
const formRef = (0, import_react.useRef)(null);
|
|
40
41
|
const prevValueRef = (0, import_react.useRef)(value);
|
|
@@ -114,6 +115,7 @@ var BaseInfoForm = (0, import_react.forwardRef)(({
|
|
|
114
115
|
{
|
|
115
116
|
placeholder: field.placeholder ?? "请输入",
|
|
116
117
|
disabled: field.disabled,
|
|
118
|
+
rows: field.rows,
|
|
117
119
|
style: { width: "100%" }
|
|
118
120
|
}
|
|
119
121
|
);
|
|
@@ -130,25 +132,34 @@ var BaseInfoForm = (0, import_react.forwardRef)(({
|
|
|
130
132
|
return null;
|
|
131
133
|
}
|
|
132
134
|
};
|
|
133
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
-
|
|
135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
+
"div",
|
|
135
137
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
import_antd.Form.Item,
|
|
138
|
+
ref: formRef,
|
|
139
|
+
className: "base-info-form",
|
|
140
|
+
style: { ["--company-label-max-width"]: `${labelMaxWidth}em` },
|
|
141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
|
+
import_basic_components.CompanyForm,
|
|
142
143
|
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
children:
|
|
144
|
+
form,
|
|
145
|
+
initialValues: value,
|
|
146
|
+
layout,
|
|
147
|
+
onValuesChange: handleValuesChange,
|
|
148
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Row, { gutter: 24, children: fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { span: getColSpan(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
import_basic_components.CompanyForm.Item,
|
|
150
|
+
{
|
|
151
|
+
label: field.label,
|
|
152
|
+
name: field.name,
|
|
153
|
+
rules: field.rules,
|
|
154
|
+
required: field.required,
|
|
155
|
+
className: field.type === "textarea" ? "label-top" : void 0,
|
|
156
|
+
children: renderField(field)
|
|
157
|
+
}
|
|
158
|
+
) }, field.name)) })
|
|
148
159
|
}
|
|
149
|
-
)
|
|
160
|
+
)
|
|
150
161
|
}
|
|
151
|
-
)
|
|
162
|
+
);
|
|
152
163
|
});
|
|
153
164
|
BaseInfoForm.displayName = "BaseInfoForm";
|
|
154
165
|
var BaseInfoForm_default = BaseInfoForm;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.base-info-form.base-info-form {
|
|
2
|
+
--company-label-max-width: 8em;
|
|
2
3
|
width: 100%;
|
|
3
4
|
|
|
4
5
|
.ant-form-item.ant-form-item {
|
|
@@ -8,11 +9,14 @@
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.ant-form-item-label.ant-form-item-label {
|
|
11
|
-
width:
|
|
12
|
+
width: var(--company-label-max-width);
|
|
12
13
|
flex-shrink: 0;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.ant-form-item-label > label {
|
|
16
17
|
justify-content: flex-end;
|
|
18
|
+
white-space: normal;
|
|
19
|
+
word-break: break-word;
|
|
20
|
+
align-items: flex-start;
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -46,7 +46,7 @@ function FilterOptionsDrawer({
|
|
|
46
46
|
onClose,
|
|
47
47
|
onSave
|
|
48
48
|
}) {
|
|
49
|
-
const [
|
|
49
|
+
const [form] = import_basic_components.CompanyForm.useForm();
|
|
50
50
|
const [editingId, setEditingId] = (0, import_react.useState)(editId);
|
|
51
51
|
const [localOptions, setLocalOptions] = (0, import_react.useState)([]);
|
|
52
52
|
const [dragIndex, setDragIndex] = (0, import_react.useState)(null);
|
|
@@ -61,25 +61,28 @@ function FilterOptionsDrawer({
|
|
|
61
61
|
defaultValue: opt.defaultValue
|
|
62
62
|
}))
|
|
63
63
|
);
|
|
64
|
-
|
|
64
|
+
form.setFieldsValue({ schemeName: editName });
|
|
65
65
|
setEditingId(editId);
|
|
66
66
|
}
|
|
67
|
-
}, [open, options, editName, editId]);
|
|
67
|
+
}, [open, options, editName, editId, form]);
|
|
68
68
|
const handleClose = (0, import_react.useCallback)(() => {
|
|
69
69
|
onClose == null ? void 0 : onClose();
|
|
70
70
|
}, [onClose]);
|
|
71
|
-
const handleSave = (0, import_react.useCallback)(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
const handleSave = (0, import_react.useCallback)(async () => {
|
|
72
|
+
try {
|
|
73
|
+
const values = await form.validateFields();
|
|
74
|
+
const name = values.schemeName.trim();
|
|
75
|
+
const selectedCount = localOptions.filter((opt) => opt.checked).length;
|
|
76
|
+
if (selectedCount === 0)
|
|
77
|
+
return;
|
|
78
|
+
onSave == null ? void 0 : onSave({
|
|
79
|
+
name,
|
|
80
|
+
id: editingId,
|
|
81
|
+
options: [...localOptions]
|
|
82
|
+
});
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}, [form, localOptions, editingId, onSave]);
|
|
83
86
|
const handleCheckedChange = (0, import_react.useCallback)((index, checked) => {
|
|
84
87
|
setLocalOptions(
|
|
85
88
|
(prev) => prev.map((item, i) => i === index ? { ...item, checked } : item)
|
|
@@ -123,22 +126,22 @@ function FilterOptionsDrawer({
|
|
|
123
126
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyButton, { type: "primary", style: { marginLeft: 8 }, onClick: handleSave, children: "保存" })
|
|
124
127
|
] }),
|
|
125
128
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 0 }, children: [
|
|
126
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyForm, { layout: "vertical", form, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
+
import_basic_components.CompanyForm.Item,
|
|
131
|
+
{
|
|
132
|
+
label: "视图名称",
|
|
133
|
+
name: "schemeName",
|
|
134
|
+
rules: [{ required: true, message: "请输入视图名称" }],
|
|
135
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
+
import_basic_components.CompanyInput,
|
|
137
|
+
{
|
|
138
|
+
placeholder: "请输入视图名称(最多8个字)",
|
|
139
|
+
maxLength: 8,
|
|
140
|
+
showCount: true
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
) }),
|
|
142
145
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, color: "rgba(0, 0, 0, 0.45)", marginTop: 24, marginBottom: 8 }, children: "勾选并调整视图条件顺序后保存" }),
|
|
143
146
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: localOptions.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
144
147
|
"div",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
export interface DetailFieldItem {
|
|
4
|
+
label: string;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface DetailTagItem {
|
|
8
|
+
text: ReactNode;
|
|
9
|
+
variant?: 'default' | 'volcano' | 'success' | 'warning';
|
|
10
|
+
}
|
|
11
|
+
export interface DetailTabItem {
|
|
12
|
+
key: string;
|
|
13
|
+
label: ReactNode;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface DetailPageTemplateProps {
|
|
18
|
+
title: string;
|
|
19
|
+
showBack?: boolean;
|
|
20
|
+
onBack?: () => void;
|
|
21
|
+
titleActions?: ReactNode;
|
|
22
|
+
avatar?: ReactNode;
|
|
23
|
+
primaryName?: ReactNode;
|
|
24
|
+
tags?: DetailTagItem[];
|
|
25
|
+
infoFields?: DetailFieldItem[];
|
|
26
|
+
infoColumns?: number;
|
|
27
|
+
infoArea?: ReactNode;
|
|
28
|
+
tabs?: DetailTabItem[];
|
|
29
|
+
activeTab?: string;
|
|
30
|
+
onTabChange?: (key: string) => void;
|
|
31
|
+
showDivider?: boolean;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export default function DetailPageTemplate({ title, showBack, onBack, titleActions, avatar, primaryName, tags, infoFields, infoColumns, infoArea, tabs, activeTab: controlledActiveTab, onTabChange, showDivider, children, }: DetailPageTemplateProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
|
|
29
|
+
// src/template-components/DetailPageTemplate/index.tsx
|
|
30
|
+
var DetailPageTemplate_exports = {};
|
|
31
|
+
__export(DetailPageTemplate_exports, {
|
|
32
|
+
default: () => DetailPageTemplate
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DetailPageTemplate_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_basic_components = require("../../basic-components");
|
|
37
|
+
var import_PageTitle = __toESM(require("../../shared-components/PageTitle"));
|
|
38
|
+
var import_index = require("./index.scss");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
function DetailPageTemplate({
|
|
41
|
+
title,
|
|
42
|
+
showBack = false,
|
|
43
|
+
onBack,
|
|
44
|
+
titleActions,
|
|
45
|
+
avatar,
|
|
46
|
+
primaryName,
|
|
47
|
+
tags,
|
|
48
|
+
infoFields,
|
|
49
|
+
infoColumns = 3,
|
|
50
|
+
infoArea,
|
|
51
|
+
tabs,
|
|
52
|
+
activeTab: controlledActiveTab,
|
|
53
|
+
onTabChange,
|
|
54
|
+
showDivider = true,
|
|
55
|
+
children
|
|
56
|
+
}) {
|
|
57
|
+
var _a;
|
|
58
|
+
const [internalActiveTab, setInternalActiveTab] = (0, import_react.useState)(((_a = tabs == null ? void 0 : tabs[0]) == null ? void 0 : _a.key) ?? "");
|
|
59
|
+
const [isScrolling, setIsScrolling] = (0, import_react.useState)(false);
|
|
60
|
+
const scrollTimeoutRef = (0, import_react.useRef)(null);
|
|
61
|
+
const activeTab = controlledActiveTab ?? internalActiveTab;
|
|
62
|
+
const handleTabChange = (0, import_react.useCallback)(
|
|
63
|
+
(key) => {
|
|
64
|
+
if (onTabChange) {
|
|
65
|
+
onTabChange(key);
|
|
66
|
+
} else {
|
|
67
|
+
setInternalActiveTab(key);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
[onTabChange]
|
|
71
|
+
);
|
|
72
|
+
const handleScroll = (0, import_react.useCallback)((e) => {
|
|
73
|
+
const target = e.currentTarget;
|
|
74
|
+
setIsScrolling(true);
|
|
75
|
+
if (scrollTimeoutRef.current) {
|
|
76
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
77
|
+
}
|
|
78
|
+
scrollTimeoutRef.current = setTimeout(() => {
|
|
79
|
+
setIsScrolling(false);
|
|
80
|
+
}, 150);
|
|
81
|
+
if (target.scrollTop > 0) {
|
|
82
|
+
target.classList.add("scrolled");
|
|
83
|
+
} else {
|
|
84
|
+
target.classList.remove("scrolled");
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
const tagVariantClass = {
|
|
88
|
+
default: "dpt-tag-default",
|
|
89
|
+
volcano: "dpt-tag-volcano",
|
|
90
|
+
success: "dpt-tag-success",
|
|
91
|
+
warning: "dpt-tag-warning"
|
|
92
|
+
};
|
|
93
|
+
const hasHeader = avatar !== void 0 || primaryName !== void 0 || tags && tags.length > 0;
|
|
94
|
+
const hasInfoCard = hasHeader || infoFields && infoFields.length > 0 || infoArea;
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "detail-page-template", children: [
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_PageTitle.default,
|
|
98
|
+
{
|
|
99
|
+
title,
|
|
100
|
+
showBack,
|
|
101
|
+
onBack,
|
|
102
|
+
className: "dpt-page-title",
|
|
103
|
+
actions: titleActions
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
hasInfoCard && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpt-info-card", children: [
|
|
107
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpt-info-top", children: [
|
|
108
|
+
(avatar !== void 0 || primaryName !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpt-info-identity", children: [
|
|
109
|
+
avatar !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dpt-avatar", children: avatar }),
|
|
110
|
+
primaryName !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpt-primary-name", children: primaryName })
|
|
111
|
+
] }),
|
|
112
|
+
tags && tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dpt-info-tags", children: tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyTag, { className: tagVariantClass[tag.variant ?? "default"], children: tag.text }, index)) })
|
|
113
|
+
] }),
|
|
114
|
+
infoFields && infoFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: "dpt-info-fields",
|
|
118
|
+
style: { gridTemplateColumns: `repeat(${infoColumns}, minmax(0, 1fr))` },
|
|
119
|
+
children: infoFields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpt-field-item", children: [
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dpt-field-label", children: [
|
|
121
|
+
field.label,
|
|
122
|
+
":"
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpt-field-value", children: field.value ?? "--" })
|
|
125
|
+
] }, index))
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
infoArea
|
|
129
|
+
] }),
|
|
130
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dpt-divider" }),
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dpt-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: `dpt-content${isScrolling ? " scrolling" : ""}`,
|
|
135
|
+
onScroll: handleScroll,
|
|
136
|
+
children: tabs && tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
import_basic_components.CompanyTabs,
|
|
138
|
+
{
|
|
139
|
+
activeKey: activeTab,
|
|
140
|
+
onChange: handleTabChange,
|
|
141
|
+
items: tabs.map((tab) => ({
|
|
142
|
+
key: tab.key,
|
|
143
|
+
label: tab.label,
|
|
144
|
+
disabled: tab.disabled,
|
|
145
|
+
children: tab.children
|
|
146
|
+
}))
|
|
147
|
+
}
|
|
148
|
+
) : children
|
|
149
|
+
}
|
|
150
|
+
) })
|
|
151
|
+
] });
|
|
152
|
+
}
|