@donglegeyu/company-ui 1.2.8 → 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/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/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/StatisticsListPage/index.js +1 -1
- package/dist/es/basic-components/CompanyDrawer/index.js +12 -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/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/StatisticsListPage/index.js +4 -4
- package/package.json +2 -2
|
@@ -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,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",
|
|
@@ -3,10 +3,11 @@ import './index.scss';
|
|
|
3
3
|
interface FilterFormProps {
|
|
4
4
|
modelValue?: Record<string, unknown>;
|
|
5
5
|
items?: FilterItem[];
|
|
6
|
+
labelMaxWidth?: number;
|
|
6
7
|
onSearch?: (data: Record<string, unknown>) => void;
|
|
7
8
|
onReset?: () => void;
|
|
8
9
|
onChange?: (data: Record<string, unknown>) => void;
|
|
9
10
|
onUpdateModelValue?: (data: Record<string, unknown>) => void;
|
|
10
11
|
}
|
|
11
|
-
export default function FilterForm({ modelValue, items, onSearch, onReset, onChange, onUpdateModelValue, }: FilterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function FilterForm({ modelValue, items, labelMaxWidth, onSearch, onReset, onChange, onUpdateModelValue, }: FilterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -48,6 +48,7 @@ var presets = [
|
|
|
48
48
|
function FilterForm({
|
|
49
49
|
modelValue = {},
|
|
50
50
|
items = [],
|
|
51
|
+
labelMaxWidth = 8,
|
|
51
52
|
onSearch,
|
|
52
53
|
onReset,
|
|
53
54
|
onChange,
|
|
@@ -179,7 +180,8 @@ function FilterForm({
|
|
|
179
180
|
"div",
|
|
180
181
|
{
|
|
181
182
|
ref: containerRef,
|
|
182
|
-
className: "filter-form",
|
|
183
|
+
className: "filter-form company-form",
|
|
184
|
+
style: { ["--company-label-max-width"]: `${labelMaxWidth}em` },
|
|
183
185
|
onKeyDown: (e) => {
|
|
184
186
|
if (e.key === "Enter")
|
|
185
187
|
handleSearch();
|
|
@@ -191,7 +193,7 @@ function FilterForm({
|
|
|
191
193
|
{
|
|
192
194
|
className: "btn-col",
|
|
193
195
|
style: { marginLeft: "auto" },
|
|
194
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyForm.Item, { className: "filter-item", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
195
197
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyButton, { type: "primary", onClick: handleSearch, children: "查询" }),
|
|
196
198
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyButton, { onClick: handleReset, children: "重置" }),
|
|
197
199
|
needExpand && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -210,7 +212,7 @@ function FilterForm({
|
|
|
210
212
|
"btn"
|
|
211
213
|
);
|
|
212
214
|
}
|
|
213
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { ...colSpans, className: "filter-col", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { ...colSpans, className: "filter-col", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_basic_components.CompanyForm.Item, { label: item.label, className: "filter-item", children: [
|
|
214
216
|
item.inputType === "input" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
217
|
import_basic_components.CompanyInput,
|
|
216
218
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.filter-form {
|
|
2
|
+
--company-label-max-width: 8em;
|
|
2
3
|
background: #fff;
|
|
3
4
|
padding: 0.625rem 0.75rem;
|
|
4
5
|
border-radius: 0.38rem;
|
|
@@ -13,12 +14,6 @@
|
|
|
13
14
|
margin: 6px 0;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
.ant-form-item-label > label {
|
|
17
|
-
margin: 6px 0;
|
|
18
|
-
height: 32px;
|
|
19
|
-
line-height: 32px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
17
|
.ant-select-selection-item {
|
|
23
18
|
color: rgba(0, 0, 0, 0.85);
|
|
24
19
|
}
|
|
@@ -35,21 +30,6 @@
|
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
32
|
|
|
38
|
-
.filter-item .ant-form-item-label {
|
|
39
|
-
width: 80px;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
|
|
42
|
-
> label {
|
|
43
|
-
justify-content: flex-end;
|
|
44
|
-
width: 100%;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.filter-item .ant-form-item-control {
|
|
49
|
-
flex: 1;
|
|
50
|
-
min-width: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
33
|
.filter-item .ant-form-item-control-input-content {
|
|
54
34
|
width: 100%;
|
|
55
35
|
}
|
|
@@ -378,7 +378,7 @@ var StatisticsListPage = (props) => {
|
|
|
378
378
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyButton, { onClick: () => setTempFilters({}), children: "重置" }),
|
|
379
379
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyButton, { type: "primary", onClick: handleFilterConfirm, children: "查询" })
|
|
380
380
|
] }),
|
|
381
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyForm, { layout: "vertical", children: filterFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_basic_components.CompanyForm.Item, { label: field.label, children: [
|
|
382
382
|
field.type === "input" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
383
383
|
import_basic_components.CompanyInput,
|
|
384
384
|
{
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["closable"];
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
10
|
import React from "react";
|
|
8
11
|
import { Drawer, ConfigProvider } from "antd";
|
|
9
12
|
import { companyTheme } from "../../theme";
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
export var CompanyDrawer = function CompanyDrawer(
|
|
14
|
+
export var CompanyDrawer = function CompanyDrawer(_ref) {
|
|
15
|
+
var _ref$closable = _ref.closable,
|
|
16
|
+
closable = _ref$closable === void 0 ? {
|
|
17
|
+
placement: "end"
|
|
18
|
+
} : _ref$closable,
|
|
19
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
12
20
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
13
21
|
theme: companyTheme,
|
|
14
|
-
children: /*#__PURE__*/_jsx(Drawer, _objectSpread({
|
|
22
|
+
children: /*#__PURE__*/_jsx(Drawer, _objectSpread({
|
|
23
|
+
closable: closable
|
|
24
|
+
}, restProps))
|
|
15
25
|
});
|
|
16
26
|
};
|
|
@@ -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
|
};
|
|
@@ -1,16 +1,64 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["labelMaxWidth", "labelAlignVertical", "layout", "requiredMark", "className", "style"];
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
10
|
import React from "react";
|
|
8
11
|
import { Form as AntdForm, ConfigProvider } from "antd";
|
|
9
12
|
import { companyTheme } from "../../theme";
|
|
13
|
+
import "./index.scss";
|
|
10
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
var requiredMarkRight = function requiredMarkRight(labelNode, _ref) {
|
|
18
|
+
var required = _ref.required;
|
|
19
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
20
|
+
children: [labelNode, required && /*#__PURE__*/_jsx("span", {
|
|
21
|
+
style: {
|
|
22
|
+
color: '#ff4d4f',
|
|
23
|
+
marginLeft: 4
|
|
24
|
+
},
|
|
25
|
+
children: "*"
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var CompanyFormComponent = function CompanyFormComponent(_ref2) {
|
|
30
|
+
var _ref2$labelMaxWidth = _ref2.labelMaxWidth,
|
|
31
|
+
labelMaxWidth = _ref2$labelMaxWidth === void 0 ? 8 : _ref2$labelMaxWidth,
|
|
32
|
+
_ref2$labelAlignVerti = _ref2.labelAlignVertical,
|
|
33
|
+
labelAlignVertical = _ref2$labelAlignVerti === void 0 ? 'center' : _ref2$labelAlignVerti,
|
|
34
|
+
_ref2$layout = _ref2.layout,
|
|
35
|
+
layout = _ref2$layout === void 0 ? 'horizontal' : _ref2$layout,
|
|
36
|
+
requiredMark = _ref2.requiredMark,
|
|
37
|
+
className = _ref2.className,
|
|
38
|
+
style = _ref2.style,
|
|
39
|
+
restProps = _objectWithoutProperties(_ref2, _excluded);
|
|
40
|
+
var mergedStyle = _objectSpread(_defineProperty({}, '--company-label-max-width', "".concat(labelMaxWidth, "em")), style);
|
|
41
|
+
var mergedRequiredMark = requiredMark !== undefined ? requiredMark : layout === 'vertical' ? requiredMarkRight : true;
|
|
12
42
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
13
43
|
theme: companyTheme,
|
|
14
|
-
children: /*#__PURE__*/_jsx(AntdForm, _objectSpread({},
|
|
44
|
+
children: /*#__PURE__*/_jsx(AntdForm, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
45
|
+
layout: layout,
|
|
46
|
+
requiredMark: mergedRequiredMark,
|
|
47
|
+
"data-label-align": labelAlignVertical,
|
|
48
|
+
className: "company-form".concat(className ? " ".concat(className) : ''),
|
|
49
|
+
style: mergedStyle
|
|
50
|
+
}))
|
|
15
51
|
});
|
|
16
|
-
};
|
|
52
|
+
};
|
|
53
|
+
export var CompanyForm = Object.assign(CompanyFormComponent, {
|
|
54
|
+
Item: AntdForm.Item,
|
|
55
|
+
List: AntdForm.List,
|
|
56
|
+
Provider: AntdForm.Provider,
|
|
57
|
+
useForm: AntdForm.useForm,
|
|
58
|
+
useWatch: AntdForm.useWatch,
|
|
59
|
+
useFormItemStatus: AntdForm.useFormItemStatus,
|
|
60
|
+
ErrorList: AntdForm.ErrorList,
|
|
61
|
+
useFormInstance: AntdForm.useFormInstance,
|
|
62
|
+
PREFIX: AntdForm.PREFIX,
|
|
63
|
+
NAME: AntdForm.NAME
|
|
64
|
+
});
|
|
@@ -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
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -5,8 +9,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import { forwardRef, useImperativeHandle, useRef, useEffect, useState } from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import { CompanyInput, CompanySelect, CompanyInputNumber } from "../../basic-components";
|
|
12
|
+
import { Row, Col } from 'antd';
|
|
13
|
+
import { CompanyForm, CompanyInput, CompanySelect, CompanyInputNumber } from "../../basic-components";
|
|
10
14
|
import "./index.scss";
|
|
11
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
16
|
var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -14,11 +18,13 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
14
18
|
fields = _ref.fields,
|
|
15
19
|
_ref$layout = _ref.layout,
|
|
16
20
|
layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
|
|
21
|
+
_ref$labelMaxWidth = _ref.labelMaxWidth,
|
|
22
|
+
labelMaxWidth = _ref$labelMaxWidth === void 0 ? 8 : _ref$labelMaxWidth,
|
|
17
23
|
onChange = _ref.onChange,
|
|
18
24
|
onFieldChange = _ref.onFieldChange;
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
form =
|
|
25
|
+
var _CompanyForm$useForm = CompanyForm.useForm(),
|
|
26
|
+
_CompanyForm$useForm2 = _slicedToArray(_CompanyForm$useForm, 1),
|
|
27
|
+
form = _CompanyForm$useForm2[0];
|
|
22
28
|
var _useState = useState(1200),
|
|
23
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
30
|
contentWidth = _useState2[0],
|
|
@@ -103,6 +109,7 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
103
109
|
return /*#__PURE__*/_jsx(CompanyInput.TextArea, {
|
|
104
110
|
placeholder: (_field$placeholder3 = field.placeholder) !== null && _field$placeholder3 !== void 0 ? _field$placeholder3 : '请输入',
|
|
105
111
|
disabled: field.disabled,
|
|
112
|
+
rows: field.rows,
|
|
106
113
|
style: {
|
|
107
114
|
width: '100%'
|
|
108
115
|
}
|
|
@@ -122,7 +129,8 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
122
129
|
return /*#__PURE__*/_jsx("div", {
|
|
123
130
|
ref: formRef,
|
|
124
131
|
className: "base-info-form",
|
|
125
|
-
|
|
132
|
+
style: _defineProperty({}, '--company-label-max-width', "".concat(labelMaxWidth, "em")),
|
|
133
|
+
children: /*#__PURE__*/_jsx(CompanyForm, {
|
|
126
134
|
form: form,
|
|
127
135
|
initialValues: value,
|
|
128
136
|
layout: layout,
|
|
@@ -132,11 +140,12 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
132
140
|
children: fields.map(function (field) {
|
|
133
141
|
return /*#__PURE__*/_jsx(Col, {
|
|
134
142
|
span: getColSpan(),
|
|
135
|
-
children: /*#__PURE__*/_jsx(
|
|
143
|
+
children: /*#__PURE__*/_jsx(CompanyForm.Item, {
|
|
136
144
|
label: field.label,
|
|
137
145
|
name: field.name,
|
|
138
146
|
rules: field.rules,
|
|
139
147
|
required: field.required,
|
|
148
|
+
className: field.type === 'textarea' ? 'label-top' : undefined,
|
|
140
149
|
children: renderField(field)
|
|
141
150
|
})
|
|
142
151
|
}, field.name);
|
|
@@ -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
|
}
|
|
@@ -4,6 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
7
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
11
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
12
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -16,7 +19,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
16
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
20
|
import { useState, useEffect, useCallback } from 'react';
|
|
18
21
|
import { Checkbox } from 'antd';
|
|
19
|
-
import { CompanyDrawer, CompanyButton, CompanyInput, CompanySelect } from "../../basic-components";
|
|
22
|
+
import { CompanyDrawer, CompanyButton, CompanyInput, CompanySelect, CompanyForm } from "../../basic-components";
|
|
20
23
|
import SvgIcon from "../SvgIcon";
|
|
21
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -31,22 +34,21 @@ export default function FilterOptionsDrawer(_ref) {
|
|
|
31
34
|
editId = _ref$editId === void 0 ? '' : _ref$editId,
|
|
32
35
|
onClose = _ref.onClose,
|
|
33
36
|
onSave = _ref.onSave;
|
|
34
|
-
var
|
|
37
|
+
var _CompanyForm$useForm = CompanyForm.useForm(),
|
|
38
|
+
_CompanyForm$useForm2 = _slicedToArray(_CompanyForm$useForm, 1),
|
|
39
|
+
form = _CompanyForm$useForm2[0];
|
|
40
|
+
var _useState = useState(editId),
|
|
35
41
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var _useState3 = useState(
|
|
42
|
+
editingId = _useState2[0],
|
|
43
|
+
setEditingId = _useState2[1];
|
|
44
|
+
var _useState3 = useState([]),
|
|
39
45
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var _useState5 = useState(
|
|
46
|
+
localOptions = _useState4[0],
|
|
47
|
+
setLocalOptions = _useState4[1];
|
|
48
|
+
var _useState5 = useState(null),
|
|
43
49
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var _useState7 = useState(null),
|
|
47
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
48
|
-
dragIndex = _useState8[0],
|
|
49
|
-
setDragIndex = _useState8[1];
|
|
50
|
+
dragIndex = _useState6[0],
|
|
51
|
+
setDragIndex = _useState6[1];
|
|
50
52
|
useEffect(function () {
|
|
51
53
|
if (open) {
|
|
52
54
|
setLocalOptions(options.map(function (opt) {
|
|
@@ -58,25 +60,51 @@ export default function FilterOptionsDrawer(_ref) {
|
|
|
58
60
|
defaultValue: opt.defaultValue
|
|
59
61
|
};
|
|
60
62
|
}));
|
|
61
|
-
|
|
63
|
+
form.setFieldsValue({
|
|
64
|
+
schemeName: editName
|
|
65
|
+
});
|
|
62
66
|
setEditingId(editId);
|
|
63
67
|
}
|
|
64
|
-
}, [open, options, editName, editId]);
|
|
68
|
+
}, [open, options, editName, editId, form]);
|
|
65
69
|
var handleClose = useCallback(function () {
|
|
66
70
|
onClose === null || onClose === void 0 || onClose();
|
|
67
71
|
}, [onClose]);
|
|
68
|
-
var handleSave = useCallback(function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
var handleSave = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
73
|
+
var values, name, selectedCount;
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
_context.prev = 0;
|
|
78
|
+
_context.next = 3;
|
|
79
|
+
return form.validateFields();
|
|
80
|
+
case 3:
|
|
81
|
+
values = _context.sent;
|
|
82
|
+
name = values.schemeName.trim();
|
|
83
|
+
selectedCount = localOptions.filter(function (opt) {
|
|
84
|
+
return opt.checked;
|
|
85
|
+
}).length;
|
|
86
|
+
if (!(selectedCount === 0)) {
|
|
87
|
+
_context.next = 8;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return _context.abrupt("return");
|
|
91
|
+
case 8:
|
|
92
|
+
onSave === null || onSave === void 0 || onSave({
|
|
93
|
+
name: name,
|
|
94
|
+
id: editingId,
|
|
95
|
+
options: _toConsumableArray(localOptions)
|
|
96
|
+
});
|
|
97
|
+
_context.next = 13;
|
|
98
|
+
break;
|
|
99
|
+
case 11:
|
|
100
|
+
_context.prev = 11;
|
|
101
|
+
_context.t0 = _context["catch"](0);
|
|
102
|
+
case 13:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}, _callee, null, [[0, 11]]);
|
|
107
|
+
})), [form, localOptions, editingId, onSave]);
|
|
80
108
|
var handleCheckedChange = useCallback(function (index, checked) {
|
|
81
109
|
setLocalOptions(function (prev) {
|
|
82
110
|
return prev.map(function (item, i) {
|
|
@@ -144,31 +172,22 @@ export default function FilterOptionsDrawer(_ref) {
|
|
|
144
172
|
flexDirection: 'column',
|
|
145
173
|
gap: 0
|
|
146
174
|
},
|
|
147
|
-
children: [/*#__PURE__*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}), /*#__PURE__*/_jsx(CompanyInput, {
|
|
164
|
-
value: schemeName,
|
|
165
|
-
onChange: function onChange(e) {
|
|
166
|
-
return setSchemeName(e.target.value);
|
|
167
|
-
},
|
|
168
|
-
placeholder: "\u8BF7\u8F93\u5165\u89C6\u56FE\u540D\u79F0\uFF08\u6700\u591A8\u4E2A\u5B57\uFF09",
|
|
169
|
-
maxLength: 8,
|
|
170
|
-
showCount: true
|
|
171
|
-
})]
|
|
175
|
+
children: [/*#__PURE__*/_jsx(CompanyForm, {
|
|
176
|
+
layout: "vertical",
|
|
177
|
+
form: form,
|
|
178
|
+
children: /*#__PURE__*/_jsx(CompanyForm.Item, {
|
|
179
|
+
label: "\u89C6\u56FE\u540D\u79F0",
|
|
180
|
+
name: "schemeName",
|
|
181
|
+
rules: [{
|
|
182
|
+
required: true,
|
|
183
|
+
message: '请输入视图名称'
|
|
184
|
+
}],
|
|
185
|
+
children: /*#__PURE__*/_jsx(CompanyInput, {
|
|
186
|
+
placeholder: "\u8BF7\u8F93\u5165\u89C6\u56FE\u540D\u79F0\uFF08\u6700\u591A8\u4E2A\u5B57\uFF09",
|
|
187
|
+
maxLength: 8,
|
|
188
|
+
showCount: true
|
|
189
|
+
})
|
|
190
|
+
})
|
|
172
191
|
}), /*#__PURE__*/_jsx("div", {
|
|
173
192
|
style: {
|
|
174
193
|
fontSize: 12,
|
|
@@ -3,10 +3,11 @@ import './index.scss';
|
|
|
3
3
|
interface FilterFormProps {
|
|
4
4
|
modelValue?: Record<string, unknown>;
|
|
5
5
|
items?: FilterItem[];
|
|
6
|
+
labelMaxWidth?: number;
|
|
6
7
|
onSearch?: (data: Record<string, unknown>) => void;
|
|
7
8
|
onReset?: () => void;
|
|
8
9
|
onChange?: (data: Record<string, unknown>) => void;
|
|
9
10
|
onUpdateModelValue?: (data: Record<string, unknown>) => void;
|
|
10
11
|
}
|
|
11
|
-
export default function FilterForm({ modelValue, items, onSearch, onReset, onChange, onUpdateModelValue, }: FilterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function FilterForm({ modelValue, items, labelMaxWidth, onSearch, onReset, onChange, onUpdateModelValue, }: FilterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -15,9 +15,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
15
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import { useState, useCallback, useMemo, useRef, useEffect } from 'react';
|
|
18
|
-
import { Row, Col, DatePicker
|
|
18
|
+
import { Row, Col, DatePicker } from 'antd';
|
|
19
19
|
import dayjs from 'dayjs';
|
|
20
|
-
import { CompanyInput, CompanySelect, CompanyDatePicker, CompanyButton } from "../../basic-components";
|
|
20
|
+
import { CompanyForm, CompanyInput, CompanySelect, CompanyDatePicker, CompanyButton } from "../../basic-components";
|
|
21
21
|
import { SvgIcon } from "../../shared-components";
|
|
22
22
|
import "./index.scss";
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -40,6 +40,8 @@ export default function FilterForm(_ref) {
|
|
|
40
40
|
modelValue = _ref$modelValue === void 0 ? {} : _ref$modelValue,
|
|
41
41
|
_ref$items = _ref.items,
|
|
42
42
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
43
|
+
_ref$labelMaxWidth = _ref.labelMaxWidth,
|
|
44
|
+
labelMaxWidth = _ref$labelMaxWidth === void 0 ? 8 : _ref$labelMaxWidth,
|
|
43
45
|
onSearch = _ref.onSearch,
|
|
44
46
|
onReset = _ref.onReset,
|
|
45
47
|
onChange = _ref.onChange,
|
|
@@ -193,7 +195,8 @@ export default function FilterForm(_ref) {
|
|
|
193
195
|
}, []);
|
|
194
196
|
return /*#__PURE__*/_jsx("div", {
|
|
195
197
|
ref: containerRef,
|
|
196
|
-
className: "filter-form",
|
|
198
|
+
className: "filter-form company-form",
|
|
199
|
+
style: _defineProperty({}, '--company-label-max-width', "".concat(labelMaxWidth, "em")),
|
|
197
200
|
onKeyDown: function onKeyDown(e) {
|
|
198
201
|
if (e.key === 'Enter') handleSearch();
|
|
199
202
|
},
|
|
@@ -206,7 +209,7 @@ export default function FilterForm(_ref) {
|
|
|
206
209
|
style: {
|
|
207
210
|
marginLeft: 'auto'
|
|
208
211
|
},
|
|
209
|
-
children: /*#__PURE__*/_jsx(
|
|
212
|
+
children: /*#__PURE__*/_jsx(CompanyForm.Item, {
|
|
210
213
|
className: "filter-item",
|
|
211
214
|
children: /*#__PURE__*/_jsxs("div", {
|
|
212
215
|
style: {
|
|
@@ -241,7 +244,7 @@ export default function FilterForm(_ref) {
|
|
|
241
244
|
}
|
|
242
245
|
return /*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, colSpans), {}, {
|
|
243
246
|
className: "filter-col",
|
|
244
|
-
children: /*#__PURE__*/_jsxs(
|
|
247
|
+
children: /*#__PURE__*/_jsxs(CompanyForm.Item, {
|
|
245
248
|
label: item.label,
|
|
246
249
|
className: "filter-item",
|
|
247
250
|
children: [item.inputType === 'input' && /*#__PURE__*/_jsx(CompanyInput, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.filter-form {
|
|
2
|
+
--company-label-max-width: 8em;
|
|
2
3
|
background: #fff;
|
|
3
4
|
padding: 0.625rem 0.75rem;
|
|
4
5
|
border-radius: 0.38rem;
|
|
@@ -13,12 +14,6 @@
|
|
|
13
14
|
margin: 6px 0;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
.ant-form-item-label > label {
|
|
17
|
-
margin: 6px 0;
|
|
18
|
-
height: 32px;
|
|
19
|
-
line-height: 32px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
17
|
.ant-select-selection-item {
|
|
23
18
|
color: rgba(0, 0, 0, 0.85);
|
|
24
19
|
}
|
|
@@ -35,21 +30,6 @@
|
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
32
|
|
|
38
|
-
.filter-item .ant-form-item-label {
|
|
39
|
-
width: 80px;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
|
|
42
|
-
> label {
|
|
43
|
-
justify-content: flex-end;
|
|
44
|
-
width: 100%;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.filter-item .ant-form-item-control {
|
|
49
|
-
flex: 1;
|
|
50
|
-
min-width: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
33
|
.filter-item .ant-form-item-control-input-content {
|
|
54
34
|
width: 100%;
|
|
55
35
|
}
|
|
@@ -24,10 +24,10 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
24
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
26
|
import { useState, useEffect, useCallback, useMemo, Component } from 'react';
|
|
27
|
-
import { Card, Empty,
|
|
27
|
+
import { Card, Empty, Space, Typography, ConfigProvider } from 'antd';
|
|
28
28
|
import zhCN from 'antd/locale/zh_CN';
|
|
29
29
|
import { FilterOutlined, CloseOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
30
|
-
import { CompanyButton, CompanyInput, CompanySelect, CompanyTable, CompanyPagination, CompanyDrawer, CompanyDatePicker, CompanyTooltip, CompanyMessage } from "../../basic-components";
|
|
30
|
+
import { CompanyButton, CompanyInput, CompanySelect, CompanyTable, CompanyPagination, CompanyDrawer, CompanyDatePicker, CompanyTooltip, CompanyMessage, CompanyForm } from "../../basic-components";
|
|
31
31
|
import { PageTitle, SvgIcon } from "../../shared-components";
|
|
32
32
|
import { useCompanyToken } from "../../theme/useCompanyToken";
|
|
33
33
|
import "./index.scss";
|
|
@@ -534,10 +534,10 @@ export var StatisticsListPage = function StatisticsListPage(props) {
|
|
|
534
534
|
children: "\u67E5\u8BE2"
|
|
535
535
|
})]
|
|
536
536
|
}),
|
|
537
|
-
children: /*#__PURE__*/_jsx(
|
|
537
|
+
children: /*#__PURE__*/_jsx(CompanyForm, {
|
|
538
538
|
layout: "vertical",
|
|
539
539
|
children: filterFields.map(function (field) {
|
|
540
|
-
return /*#__PURE__*/_jsxs(
|
|
540
|
+
return /*#__PURE__*/_jsxs(CompanyForm.Item, {
|
|
541
541
|
label: field.label,
|
|
542
542
|
children: [field.type === 'input' && /*#__PURE__*/_jsx(CompanyInput, {
|
|
543
543
|
value: tempFilters[field.key] || '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donglegeyu/company-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
6
|
"types": "dist/es/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/react": "^19.2.15",
|
|
42
42
|
"@types/react-dom": "^19.2.3",
|
|
43
43
|
"antd": "^6.0.0",
|
|
44
|
-
"dumi": "^2.4.
|
|
44
|
+
"dumi": "^2.4.30",
|
|
45
45
|
"father": "^4.6.19",
|
|
46
46
|
"react": "^19.2.0",
|
|
47
47
|
"react-dom": "^19.2.0",
|