@donglegeyu/company-ui 1.2.40 → 1.2.42
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/shared-components/BaseInfoForm/index.d.ts +21 -7
- package/dist/cjs/shared-components/BaseInfoForm/index.js +101 -12
- package/dist/cjs/shared-components/index.d.ts +1 -1
- package/dist/cjs/template-components/AdminLayoutTemplate/index.d.ts +1 -1
- package/dist/cjs/template-components/AdminLayoutTemplate/index.js +1 -1
- package/dist/es/shared-components/BaseInfoForm/index.d.ts +21 -7
- package/dist/es/shared-components/BaseInfoForm/index.js +121 -13
- package/dist/es/shared-components/index.d.ts +1 -1
- package/dist/es/template-components/AdminLayoutTemplate/index.d.ts +1 -1
- package/dist/es/template-components/AdminLayoutTemplate/index.js +5 -5
- package/package.json +2 -1
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FormInstance, FormRule } from "antd";
|
|
3
3
|
import "./index.scss";
|
|
4
|
-
export type FormFieldValue = string | number | boolean | null | undefined;
|
|
4
|
+
export type FormFieldValue = string | number | boolean | null | undefined | (string | number)[];
|
|
5
|
+
export interface FormFieldOption {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
/** cascader 树形选项 */
|
|
9
|
+
children?: FormFieldOption[];
|
|
10
|
+
}
|
|
11
|
+
export type FormFieldItemType = "input" | "select" | "textarea" | "input-number" | "select-multi" | "radio" | "cascader" | "date" | "daterange";
|
|
5
12
|
export interface FormFieldItem {
|
|
6
13
|
name: string;
|
|
7
14
|
label: string;
|
|
8
|
-
type:
|
|
15
|
+
type: FormFieldItemType;
|
|
9
16
|
placeholder?: string;
|
|
10
17
|
readonly?: boolean;
|
|
11
18
|
disabled?: boolean;
|
|
12
|
-
options?:
|
|
13
|
-
value: string | number;
|
|
14
|
-
label: string;
|
|
15
|
-
}[];
|
|
19
|
+
options?: FormFieldOption[];
|
|
16
20
|
rules?: FormRule[];
|
|
17
21
|
required?: boolean;
|
|
18
22
|
rows?: number;
|
|
23
|
+
/** date / daterange 专用:是否展示时间选择 */
|
|
24
|
+
showTime?: boolean;
|
|
19
25
|
}
|
|
20
|
-
export interface
|
|
26
|
+
export interface FormFieldCompactGroup {
|
|
21
27
|
type: "compact";
|
|
22
28
|
label: string;
|
|
23
29
|
children: FormFieldItem[];
|
|
24
30
|
}
|
|
31
|
+
/** 视觉分组:带标题的独立小节,内部字段仍走响应式网格 */
|
|
32
|
+
export interface FormFieldSectionGroup {
|
|
33
|
+
type: "section";
|
|
34
|
+
label: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
children: FormFieldItem[];
|
|
37
|
+
}
|
|
38
|
+
export type FormFieldGroup = FormFieldCompactGroup | FormFieldSectionGroup;
|
|
25
39
|
export type FormField = FormFieldItem | FormFieldGroup;
|
|
26
40
|
export type FormValues = Record<string, FormFieldValue>;
|
|
27
41
|
export interface BaseInfoFormProps {
|
|
@@ -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,6 +16,14 @@ 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/shared-components/BaseInfoForm/index.tsx
|
|
@@ -24,9 +34,37 @@ __export(BaseInfoForm_exports, {
|
|
|
24
34
|
module.exports = __toCommonJS(BaseInfoForm_exports);
|
|
25
35
|
var import_react = require("react");
|
|
26
36
|
var import_antd = require("antd");
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
27
38
|
var import_basic_components = require("../../basic-components");
|
|
39
|
+
var import_SectionTitle = __toESM(require("../SectionTitle"));
|
|
28
40
|
var import_index = require("./index.scss");
|
|
29
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var DATE_FORMAT = "YYYY-MM-DD";
|
|
43
|
+
var DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
44
|
+
var isDateLike = (type) => type === "date" || type === "daterange";
|
|
45
|
+
var getDateItemProps = (field) => {
|
|
46
|
+
const format = field.showTime ? DATETIME_FORMAT : DATE_FORMAT;
|
|
47
|
+
if (field.type === "date") {
|
|
48
|
+
return {
|
|
49
|
+
getValueProps: (val) => ({
|
|
50
|
+
value: val ? (0, import_dayjs.default)(val, format) : void 0
|
|
51
|
+
}),
|
|
52
|
+
getValueFromEvent: (_date, dateString) => dateString || void 0
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
getValueProps: (val) => ({
|
|
57
|
+
value: Array.isArray(val) && val.length === 2 ? [(0, import_dayjs.default)(String(val[0]), format), (0, import_dayjs.default)(String(val[1]), format)] : void 0
|
|
58
|
+
}),
|
|
59
|
+
getValueFromEvent: (_dates, dateStrings) => (dateStrings == null ? void 0 : dateStrings[0]) && (dateStrings == null ? void 0 : dateStrings[1]) ? dateStrings : void 0
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
var isEqualValue = (a, b) => {
|
|
63
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
64
|
+
return JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
65
|
+
}
|
|
66
|
+
return a === b;
|
|
67
|
+
};
|
|
30
68
|
var BaseInfoForm = (0, import_react.forwardRef)(
|
|
31
69
|
({ value, fields, layout = "horizontal", labelMaxWidth = 8, onChange, onFieldChange }, ref) => {
|
|
32
70
|
const [form] = import_basic_components.CompanyForm.useForm();
|
|
@@ -63,7 +101,7 @@ var BaseInfoForm = (0, import_react.forwardRef)(
|
|
|
63
101
|
const diff = {};
|
|
64
102
|
for (const k of Object.keys(value)) {
|
|
65
103
|
const v = value[k] === "" ? void 0 : value[k];
|
|
66
|
-
if (v
|
|
104
|
+
if (!isEqualValue(v, currentFormValues[k])) {
|
|
67
105
|
diff[k] = v;
|
|
68
106
|
}
|
|
69
107
|
}
|
|
@@ -116,6 +154,49 @@ var BaseInfoForm = (0, import_react.forwardRef)(
|
|
|
116
154
|
style: { width: "100%" }
|
|
117
155
|
}
|
|
118
156
|
);
|
|
157
|
+
case "select-multi":
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
|
+
import_basic_components.CompanySelect,
|
|
160
|
+
{
|
|
161
|
+
mode: "multiple",
|
|
162
|
+
placeholder: field.placeholder ?? "请选择",
|
|
163
|
+
disabled: field.disabled,
|
|
164
|
+
options: field.options,
|
|
165
|
+
maxTagCount: "responsive",
|
|
166
|
+
style: { width: "100%" }
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
case "radio":
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyRadio.Group, { options: field.options, disabled: field.disabled });
|
|
171
|
+
case "cascader":
|
|
172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
173
|
+
import_basic_components.CompanyCascader,
|
|
174
|
+
{
|
|
175
|
+
placeholder: field.placeholder ?? "请选择",
|
|
176
|
+
disabled: field.disabled,
|
|
177
|
+
options: field.options,
|
|
178
|
+
style: { width: "100%" }
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
case "date":
|
|
182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
183
|
+
import_basic_components.CompanyDatePicker,
|
|
184
|
+
{
|
|
185
|
+
placeholder: field.placeholder ?? "请选择",
|
|
186
|
+
disabled: field.disabled,
|
|
187
|
+
showTime: field.showTime,
|
|
188
|
+
style: { width: "100%" }
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
case "daterange":
|
|
192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
import_basic_components.CompanyDatePicker.RangePicker,
|
|
194
|
+
{
|
|
195
|
+
disabled: field.disabled,
|
|
196
|
+
showTime: field.showTime,
|
|
197
|
+
style: { width: "100%" }
|
|
198
|
+
}
|
|
199
|
+
);
|
|
119
200
|
case "textarea":
|
|
120
201
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
202
|
import_basic_components.CompanyInput.TextArea,
|
|
@@ -139,6 +220,18 @@ var BaseInfoForm = (0, import_react.forwardRef)(
|
|
|
139
220
|
return null;
|
|
140
221
|
}
|
|
141
222
|
};
|
|
223
|
+
const renderItem = (field) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
+
import_basic_components.CompanyForm.Item,
|
|
225
|
+
{
|
|
226
|
+
label: field.label,
|
|
227
|
+
name: field.name,
|
|
228
|
+
rules: field.rules,
|
|
229
|
+
required: field.required,
|
|
230
|
+
className: field.type === "textarea" ? "label-top" : void 0,
|
|
231
|
+
...isDateLike(field.type) ? getDateItemProps(field) : null,
|
|
232
|
+
children: renderField(field)
|
|
233
|
+
}
|
|
234
|
+
);
|
|
142
235
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
236
|
"div",
|
|
144
237
|
{
|
|
@@ -165,17 +258,13 @@ var BaseInfoForm = (0, import_react.forwardRef)(
|
|
|
165
258
|
child.name
|
|
166
259
|
)) }) }) }, `compact-${index}`);
|
|
167
260
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
className: field.type === "textarea" ? "label-top" : void 0,
|
|
176
|
-
children: renderField(field)
|
|
177
|
-
}
|
|
178
|
-
) }, field.name);
|
|
261
|
+
if (field.type === "section") {
|
|
262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Col, { span: 24, children: [
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SectionTitle.default, { title: field.label, description: field.description }),
|
|
264
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Row, { gutter: 24, children: (field.children || []).map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { span: getColSpan(), children: renderItem(child) }, child.name)) })
|
|
265
|
+
] }, `section-${index}`);
|
|
266
|
+
}
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { span: getColSpan(), children: renderItem(field) }, field.name);
|
|
179
268
|
}) })
|
|
180
269
|
}
|
|
181
270
|
)
|
|
@@ -6,7 +6,7 @@ export { default as PageTitle } from "./PageTitle";
|
|
|
6
6
|
export { default as FormFooterActions } from "./FormFooterActions";
|
|
7
7
|
export { default as SectionTitle } from "./SectionTitle";
|
|
8
8
|
export { default as BaseInfoForm } from "./BaseInfoForm";
|
|
9
|
-
export type { FormField, FormFieldItem, FormFieldGroup, BaseInfoFormProps, BaseInfoFormRef, } from "./BaseInfoForm";
|
|
9
|
+
export type { FormField, FormFieldItem, FormFieldGroup, FormFieldCompactGroup, FormFieldSectionGroup, FormFieldItemType, FormFieldOption, FormFieldValue, FormValues, BaseInfoFormProps, BaseInfoFormRef, } from "./BaseInfoForm";
|
|
10
10
|
export { default as ColorScale } from "./ColorScale";
|
|
11
11
|
export { default as AccessibilityChecker } from "./AccessibilityChecker";
|
|
12
12
|
export { default as EllipsisText } from "./EllipsisText";
|
|
@@ -42,7 +42,7 @@ export interface AdminLayoutTemplateProps {
|
|
|
42
42
|
businessMenus: SidebarMenuItem[];
|
|
43
43
|
/** 一级图标菜单(默认:首页 + 收藏) */
|
|
44
44
|
firstMenus?: SidebarMenuItem[];
|
|
45
|
-
/**
|
|
45
|
+
/** 一级栏底部固定菜单(默认:超级搜索) */
|
|
46
46
|
systemBottomMenus?: SidebarMenuItem[];
|
|
47
47
|
/** 一级导航最多可见数量,超出进「更多应用」抽屉 */
|
|
48
48
|
visibleMenuCount?: number;
|
|
@@ -42,7 +42,7 @@ var DEFAULT_FIRST_MENUS = [
|
|
|
42
42
|
{ key: "favorites", label: "收藏", icon: "favorites" }
|
|
43
43
|
];
|
|
44
44
|
var DEFAULT_SYSTEM_BOTTOM_MENUS = [
|
|
45
|
-
{ key: "
|
|
45
|
+
{ key: "super-search", label: "超级搜索", icon: "search" }
|
|
46
46
|
];
|
|
47
47
|
function findMenuByKey(menus, key) {
|
|
48
48
|
var _a;
|
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FormInstance, FormRule } from "antd";
|
|
3
3
|
import "./index.scss";
|
|
4
|
-
export type FormFieldValue = string | number | boolean | null | undefined;
|
|
4
|
+
export type FormFieldValue = string | number | boolean | null | undefined | (string | number)[];
|
|
5
|
+
export interface FormFieldOption {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
/** cascader 树形选项 */
|
|
9
|
+
children?: FormFieldOption[];
|
|
10
|
+
}
|
|
11
|
+
export type FormFieldItemType = "input" | "select" | "textarea" | "input-number" | "select-multi" | "radio" | "cascader" | "date" | "daterange";
|
|
5
12
|
export interface FormFieldItem {
|
|
6
13
|
name: string;
|
|
7
14
|
label: string;
|
|
8
|
-
type:
|
|
15
|
+
type: FormFieldItemType;
|
|
9
16
|
placeholder?: string;
|
|
10
17
|
readonly?: boolean;
|
|
11
18
|
disabled?: boolean;
|
|
12
|
-
options?:
|
|
13
|
-
value: string | number;
|
|
14
|
-
label: string;
|
|
15
|
-
}[];
|
|
19
|
+
options?: FormFieldOption[];
|
|
16
20
|
rules?: FormRule[];
|
|
17
21
|
required?: boolean;
|
|
18
22
|
rows?: number;
|
|
23
|
+
/** date / daterange 专用:是否展示时间选择 */
|
|
24
|
+
showTime?: boolean;
|
|
19
25
|
}
|
|
20
|
-
export interface
|
|
26
|
+
export interface FormFieldCompactGroup {
|
|
21
27
|
type: "compact";
|
|
22
28
|
label: string;
|
|
23
29
|
children: FormFieldItem[];
|
|
24
30
|
}
|
|
31
|
+
/** 视觉分组:带标题的独立小节,内部字段仍走响应式网格 */
|
|
32
|
+
export interface FormFieldSectionGroup {
|
|
33
|
+
type: "section";
|
|
34
|
+
label: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
children: FormFieldItem[];
|
|
37
|
+
}
|
|
38
|
+
export type FormFieldGroup = FormFieldCompactGroup | FormFieldSectionGroup;
|
|
25
39
|
export type FormField = FormFieldItem | FormFieldGroup;
|
|
26
40
|
export type FormValues = Record<string, FormFieldValue>;
|
|
27
41
|
export interface BaseInfoFormProps {
|
|
@@ -1,4 +1,6 @@
|
|
|
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
|
+
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
|
+
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; }
|
|
2
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; }
|
|
3
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
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); }
|
|
@@ -10,9 +12,52 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
10
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
13
|
import { forwardRef, useImperativeHandle, useRef, useEffect, useState } from "react";
|
|
12
14
|
import { Row, Col, Space } from "antd";
|
|
13
|
-
import
|
|
15
|
+
import dayjs from "dayjs";
|
|
16
|
+
import { CompanyForm, CompanyInput, CompanySelect, CompanyInputNumber, CompanyDatePicker, CompanyCascader, CompanyRadio } from "../../basic-components";
|
|
17
|
+
import SectionTitle from "../SectionTitle";
|
|
14
18
|
import "./index.scss";
|
|
19
|
+
|
|
20
|
+
/** 视觉分组:带标题的独立小节,内部字段仍走响应式网格 */
|
|
15
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
var DATE_FORMAT = "YYYY-MM-DD";
|
|
24
|
+
var DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
25
|
+
var isDateLike = function isDateLike(type) {
|
|
26
|
+
return type === "date" || type === "daterange";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** 日期类字段:value 统一为格式化字符串(可 JSON 序列化),控件内部用 Dayjs */
|
|
30
|
+
var getDateItemProps = function getDateItemProps(field) {
|
|
31
|
+
var format = field.showTime ? DATETIME_FORMAT : DATE_FORMAT;
|
|
32
|
+
if (field.type === "date") {
|
|
33
|
+
return {
|
|
34
|
+
getValueProps: function getValueProps(val) {
|
|
35
|
+
return {
|
|
36
|
+
value: val ? dayjs(val, format) : undefined
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
getValueFromEvent: function getValueFromEvent(_date, dateString) {
|
|
40
|
+
return dateString || undefined;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
getValueProps: function getValueProps(val) {
|
|
46
|
+
return {
|
|
47
|
+
value: Array.isArray(val) && val.length === 2 ? [dayjs(String(val[0]), format), dayjs(String(val[1]), format)] : undefined
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
getValueFromEvent: function getValueFromEvent(_dates, dateStrings) {
|
|
51
|
+
return dateStrings !== null && dateStrings !== void 0 && dateStrings[0] && dateStrings !== null && dateStrings !== void 0 && dateStrings[1] ? dateStrings : undefined;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var isEqualValue = function isEqualValue(a, b) {
|
|
56
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
57
|
+
return JSON.stringify(a !== null && a !== void 0 ? a : null) === JSON.stringify(b !== null && b !== void 0 ? b : null);
|
|
58
|
+
}
|
|
59
|
+
return a === b;
|
|
60
|
+
};
|
|
16
61
|
var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
62
|
var value = _ref.value,
|
|
18
63
|
fields = _ref.fields,
|
|
@@ -60,7 +105,7 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
60
105
|
for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
|
|
61
106
|
var k = _Object$keys[_i];
|
|
62
107
|
var v = value[k] === "" ? undefined : value[k];
|
|
63
|
-
if (v
|
|
108
|
+
if (!isEqualValue(v, currentFormValues[k])) {
|
|
64
109
|
diff[k] = v;
|
|
65
110
|
}
|
|
66
111
|
}
|
|
@@ -98,7 +143,7 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
98
143
|
};
|
|
99
144
|
}, [form]);
|
|
100
145
|
var renderField = function renderField(field) {
|
|
101
|
-
var _field$placeholder, _field$placeholder2, _field$placeholder3, _field$placeholder4;
|
|
146
|
+
var _field$placeholder, _field$placeholder2, _field$placeholder3, _field$placeholder4, _field$placeholder5, _field$placeholder6, _field$placeholder7;
|
|
102
147
|
switch (field.type) {
|
|
103
148
|
case "input":
|
|
104
149
|
return /*#__PURE__*/_jsx(CompanyInput, {
|
|
@@ -115,9 +160,51 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
115
160
|
width: "100%"
|
|
116
161
|
}
|
|
117
162
|
});
|
|
163
|
+
case "select-multi":
|
|
164
|
+
return /*#__PURE__*/_jsx(CompanySelect, {
|
|
165
|
+
mode: "multiple",
|
|
166
|
+
placeholder: (_field$placeholder3 = field.placeholder) !== null && _field$placeholder3 !== void 0 ? _field$placeholder3 : "请选择",
|
|
167
|
+
disabled: field.disabled,
|
|
168
|
+
options: field.options,
|
|
169
|
+
maxTagCount: "responsive",
|
|
170
|
+
style: {
|
|
171
|
+
width: "100%"
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
case "radio":
|
|
175
|
+
return /*#__PURE__*/_jsx(CompanyRadio.Group, {
|
|
176
|
+
options: field.options,
|
|
177
|
+
disabled: field.disabled
|
|
178
|
+
});
|
|
179
|
+
case "cascader":
|
|
180
|
+
return /*#__PURE__*/_jsx(CompanyCascader, {
|
|
181
|
+
placeholder: (_field$placeholder4 = field.placeholder) !== null && _field$placeholder4 !== void 0 ? _field$placeholder4 : "请选择",
|
|
182
|
+
disabled: field.disabled,
|
|
183
|
+
options: field.options,
|
|
184
|
+
style: {
|
|
185
|
+
width: "100%"
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
case "date":
|
|
189
|
+
return /*#__PURE__*/_jsx(CompanyDatePicker, {
|
|
190
|
+
placeholder: (_field$placeholder5 = field.placeholder) !== null && _field$placeholder5 !== void 0 ? _field$placeholder5 : "请选择",
|
|
191
|
+
disabled: field.disabled,
|
|
192
|
+
showTime: field.showTime,
|
|
193
|
+
style: {
|
|
194
|
+
width: "100%"
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
case "daterange":
|
|
198
|
+
return /*#__PURE__*/_jsx(CompanyDatePicker.RangePicker, {
|
|
199
|
+
disabled: field.disabled,
|
|
200
|
+
showTime: field.showTime,
|
|
201
|
+
style: {
|
|
202
|
+
width: "100%"
|
|
203
|
+
}
|
|
204
|
+
});
|
|
118
205
|
case "textarea":
|
|
119
206
|
return /*#__PURE__*/_jsx(CompanyInput.TextArea, {
|
|
120
|
-
placeholder: (_field$
|
|
207
|
+
placeholder: (_field$placeholder6 = field.placeholder) !== null && _field$placeholder6 !== void 0 ? _field$placeholder6 : "请输入",
|
|
121
208
|
disabled: field.disabled,
|
|
122
209
|
rows: field.rows,
|
|
123
210
|
style: {
|
|
@@ -126,7 +213,7 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
126
213
|
});
|
|
127
214
|
case "input-number":
|
|
128
215
|
return /*#__PURE__*/_jsx(CompanyInputNumber, {
|
|
129
|
-
placeholder: (_field$
|
|
216
|
+
placeholder: (_field$placeholder7 = field.placeholder) !== null && _field$placeholder7 !== void 0 ? _field$placeholder7 : "请输入",
|
|
130
217
|
disabled: field.disabled,
|
|
131
218
|
style: {
|
|
132
219
|
width: "100%"
|
|
@@ -136,6 +223,17 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
136
223
|
return null;
|
|
137
224
|
}
|
|
138
225
|
};
|
|
226
|
+
var renderItem = function renderItem(field) {
|
|
227
|
+
return /*#__PURE__*/_jsx(CompanyForm.Item, _objectSpread(_objectSpread({
|
|
228
|
+
label: field.label,
|
|
229
|
+
name: field.name,
|
|
230
|
+
rules: field.rules,
|
|
231
|
+
required: field.required,
|
|
232
|
+
className: field.type === "textarea" ? "label-top" : undefined
|
|
233
|
+
}, isDateLike(field.type) ? getDateItemProps(field) : null), {}, {
|
|
234
|
+
children: renderField(field)
|
|
235
|
+
}));
|
|
236
|
+
};
|
|
139
237
|
return /*#__PURE__*/_jsx("div", {
|
|
140
238
|
ref: formRef,
|
|
141
239
|
className: "base-info-form",
|
|
@@ -169,16 +267,26 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
169
267
|
})
|
|
170
268
|
}, "compact-".concat(index));
|
|
171
269
|
}
|
|
270
|
+
if (field.type === "section") {
|
|
271
|
+
return /*#__PURE__*/_jsxs(Col, {
|
|
272
|
+
span: 24,
|
|
273
|
+
children: [/*#__PURE__*/_jsx(SectionTitle, {
|
|
274
|
+
title: field.label,
|
|
275
|
+
description: field.description
|
|
276
|
+
}), /*#__PURE__*/_jsx(Row, {
|
|
277
|
+
gutter: 24,
|
|
278
|
+
children: (field.children || []).map(function (child) {
|
|
279
|
+
return /*#__PURE__*/_jsx(Col, {
|
|
280
|
+
span: getColSpan(),
|
|
281
|
+
children: renderItem(child)
|
|
282
|
+
}, child.name);
|
|
283
|
+
})
|
|
284
|
+
})]
|
|
285
|
+
}, "section-".concat(index));
|
|
286
|
+
}
|
|
172
287
|
return /*#__PURE__*/_jsx(Col, {
|
|
173
288
|
span: getColSpan(),
|
|
174
|
-
children:
|
|
175
|
-
label: field.label,
|
|
176
|
-
name: field.name,
|
|
177
|
-
rules: field.rules,
|
|
178
|
-
required: field.required,
|
|
179
|
-
className: field.type === "textarea" ? "label-top" : undefined,
|
|
180
|
-
children: renderField(field)
|
|
181
|
-
})
|
|
289
|
+
children: renderItem(field)
|
|
182
290
|
}, field.name);
|
|
183
291
|
})
|
|
184
292
|
})
|
|
@@ -6,7 +6,7 @@ export { default as PageTitle } from "./PageTitle";
|
|
|
6
6
|
export { default as FormFooterActions } from "./FormFooterActions";
|
|
7
7
|
export { default as SectionTitle } from "./SectionTitle";
|
|
8
8
|
export { default as BaseInfoForm } from "./BaseInfoForm";
|
|
9
|
-
export type { FormField, FormFieldItem, FormFieldGroup, BaseInfoFormProps, BaseInfoFormRef, } from "./BaseInfoForm";
|
|
9
|
+
export type { FormField, FormFieldItem, FormFieldGroup, FormFieldCompactGroup, FormFieldSectionGroup, FormFieldItemType, FormFieldOption, FormFieldValue, FormValues, BaseInfoFormProps, BaseInfoFormRef, } from "./BaseInfoForm";
|
|
10
10
|
export { default as ColorScale } from "./ColorScale";
|
|
11
11
|
export { default as AccessibilityChecker } from "./AccessibilityChecker";
|
|
12
12
|
export { default as EllipsisText } from "./EllipsisText";
|
|
@@ -42,7 +42,7 @@ export interface AdminLayoutTemplateProps {
|
|
|
42
42
|
businessMenus: SidebarMenuItem[];
|
|
43
43
|
/** 一级图标菜单(默认:首页 + 收藏) */
|
|
44
44
|
firstMenus?: SidebarMenuItem[];
|
|
45
|
-
/**
|
|
45
|
+
/** 一级栏底部固定菜单(默认:超级搜索) */
|
|
46
46
|
systemBottomMenus?: SidebarMenuItem[];
|
|
47
47
|
/** 一级导航最多可见数量,超出进「更多应用」抽屉 */
|
|
48
48
|
visibleMenuCount?: number;
|
|
@@ -41,11 +41,11 @@ var DEFAULT_FIRST_MENUS = [{
|
|
|
41
41
|
icon: "favorites"
|
|
42
42
|
}];
|
|
43
43
|
|
|
44
|
-
/**
|
|
44
|
+
/** 默认一级栏底部固定菜单:超级搜索(与组件库标准 demo 一致) */
|
|
45
45
|
var DEFAULT_SYSTEM_BOTTOM_MENUS = [{
|
|
46
|
-
key: "
|
|
47
|
-
label: "
|
|
48
|
-
icon: "
|
|
46
|
+
key: "super-search",
|
|
47
|
+
label: "超级搜索",
|
|
48
|
+
icon: "search"
|
|
49
49
|
}];
|
|
50
50
|
|
|
51
51
|
/** 在菜单树中按键查找菜单项 */
|
|
@@ -461,7 +461,7 @@ export default function AdminLayoutTemplate(_ref) {
|
|
|
461
461
|
}
|
|
462
462
|
// 父级菜单只负责展开(展开交互由 CompanySidebar 内部处理)
|
|
463
463
|
if ((_menu$children5 = menu.children) !== null && _menu$children5 !== void 0 && _menu$children5.length) return;
|
|
464
|
-
//
|
|
464
|
+
// 一级系统菜单(首页/收藏/超级搜索)不开页签;首页激活 homeTab
|
|
465
465
|
if (systemMenuKeys.has(menu.key)) {
|
|
466
466
|
if (homeTab && menu.key === homeTab.key) {
|
|
467
467
|
if (!isTabActiveControlled) setInternalActiveTabKey(homeTab.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.42",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
6
|
"types": "dist/es/index.d.ts",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"gen:icons": "node scripts/gen-icons.mjs",
|
|
20
20
|
"gen:llms": "node scripts/gen-llms.mjs",
|
|
21
21
|
"mcp": "node scripts/mcp-server.mjs",
|
|
22
|
+
"lint:ai": "node scripts/ai-lint.mjs",
|
|
22
23
|
"build": "father build",
|
|
23
24
|
"type-check": "tsc --noEmit",
|
|
24
25
|
"lint": "eslint src --ext .ts,.tsx",
|