@donglegeyu/company-ui 1.2.20 → 1.2.22

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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { FormInstance } from 'antd';
3
3
  import './index.scss';
4
- export interface FormField {
4
+ export interface FormFieldItem {
5
5
  name: string;
6
6
  label: string;
7
7
  type: 'input' | 'select' | 'textarea' | 'input-number';
@@ -16,6 +16,12 @@ export interface FormField {
16
16
  required?: boolean;
17
17
  rows?: number;
18
18
  }
19
+ export interface FormFieldGroup {
20
+ type: 'compact';
21
+ label: string;
22
+ children: FormFieldItem[];
23
+ }
24
+ export type FormField = FormFieldItem | FormFieldGroup;
19
25
  export interface BaseInfoFormProps {
20
26
  value: Record<string, any>;
21
27
  fields: FormField[];
@@ -153,17 +153,31 @@ var BaseInfoForm = (0, import_react.forwardRef)(({
153
153
  initialValues: normalizeValue(value),
154
154
  layout,
155
155
  onValuesChange: handleValuesChange,
156
- 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)(
157
- import_basic_components.CompanyForm.Item,
158
- {
159
- label: field.label,
160
- name: field.name,
161
- rules: field.rules,
162
- required: field.required,
163
- className: field.type === "textarea" ? "label-top" : void 0,
164
- children: renderField(field)
156
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Row, { gutter: 24, children: fields.map((field, index) => {
157
+ if (field.type === "compact") {
158
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { span: getColSpan(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_basic_components.CompanyForm.Item, { label: field.label, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Space.Compact, { style: { width: "100%" }, children: field.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
+ import_basic_components.CompanyForm.Item,
160
+ {
161
+ name: child.name,
162
+ noStyle: true,
163
+ rules: child.rules,
164
+ children: renderField(child)
165
+ },
166
+ child.name
167
+ )) }) }) }, `compact-${index}`);
165
168
  }
166
- ) }, field.name)) })
169
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Col, { span: getColSpan(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
+ import_basic_components.CompanyForm.Item,
171
+ {
172
+ label: field.label,
173
+ name: field.name,
174
+ rules: field.rules,
175
+ required: field.required,
176
+ className: field.type === "textarea" ? "label-top" : void 0,
177
+ children: renderField(field)
178
+ }
179
+ ) }, field.name);
180
+ }) })
167
181
  }
168
182
  )
169
183
  }
@@ -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, BaseInfoFormProps, BaseInfoFormRef } from "./BaseInfoForm";
9
+ export type { FormField, FormFieldItem, FormFieldGroup, 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";
@@ -148,7 +148,9 @@ function SmartListTemplate({
148
148
  (0, import_react.useEffect)(() => {
149
149
  if (!fields || fields.length === 0)
150
150
  return;
151
- const updatedOptions = fields.filter((field) => !nonBusinessFields.includes(field.key)).map((field) => {
151
+ const updatedOptions = fields.filter(
152
+ (field) => !nonBusinessFields.includes(field.key) && !field.hideInFilter
153
+ ).map((field) => {
152
154
  var _a;
153
155
  return {
154
156
  key: field.key,
@@ -51,6 +51,7 @@ export interface FieldDefinition {
51
51
  width?: number;
52
52
  fixed?: 'left' | 'right';
53
53
  ellipsis?: boolean;
54
+ hideInFilter?: boolean;
54
55
  }
55
56
  export interface PaginationConfig {
56
57
  current: number;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { FormInstance } from 'antd';
3
3
  import './index.scss';
4
- export interface FormField {
4
+ export interface FormFieldItem {
5
5
  name: string;
6
6
  label: string;
7
7
  type: 'input' | 'select' | 'textarea' | 'input-number';
@@ -16,6 +16,12 @@ export interface FormField {
16
16
  required?: boolean;
17
17
  rows?: number;
18
18
  }
19
+ export interface FormFieldGroup {
20
+ type: 'compact';
21
+ label: string;
22
+ children: FormFieldItem[];
23
+ }
24
+ export type FormField = FormFieldItem | FormFieldGroup;
19
25
  export interface BaseInfoFormProps {
20
26
  value: Record<string, any>;
21
27
  fields: FormField[];
@@ -9,7 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9
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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { forwardRef, useImperativeHandle, useRef, useEffect, useState } from 'react';
12
- import { Row, Col } from 'antd';
12
+ import { Row, Col, Space } from 'antd';
13
13
  import { CompanyForm, CompanyInput, CompanySelect, CompanyInputNumber } from "../../basic-components";
14
14
  import "./index.scss";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -146,7 +146,28 @@ var BaseInfoForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
146
146
  onValuesChange: handleValuesChange,
147
147
  children: /*#__PURE__*/_jsx(Row, {
148
148
  gutter: 24,
149
- children: fields.map(function (field) {
149
+ children: fields.map(function (field, index) {
150
+ if (field.type === 'compact') {
151
+ return /*#__PURE__*/_jsx(Col, {
152
+ span: getColSpan(),
153
+ children: /*#__PURE__*/_jsx(CompanyForm.Item, {
154
+ label: field.label,
155
+ children: /*#__PURE__*/_jsx(Space.Compact, {
156
+ style: {
157
+ width: '100%'
158
+ },
159
+ children: field.children.map(function (child) {
160
+ return /*#__PURE__*/_jsx(CompanyForm.Item, {
161
+ name: child.name,
162
+ noStyle: true,
163
+ rules: child.rules,
164
+ children: renderField(child)
165
+ }, child.name);
166
+ })
167
+ })
168
+ })
169
+ }, "compact-".concat(index));
170
+ }
150
171
  return /*#__PURE__*/_jsx(Col, {
151
172
  span: getColSpan(),
152
173
  children: /*#__PURE__*/_jsx(CompanyForm.Item, {
@@ -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, BaseInfoFormProps, BaseInfoFormRef } from "./BaseInfoForm";
9
+ export type { FormField, FormFieldItem, FormFieldGroup, 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";
@@ -214,7 +214,7 @@ export default function SmartListTemplate(_ref) {
214
214
  useEffect(function () {
215
215
  if (!fields || fields.length === 0) return;
216
216
  var updatedOptions = fields.filter(function (field) {
217
- return !nonBusinessFields.includes(field.key);
217
+ return !nonBusinessFields.includes(field.key) && !field.hideInFilter;
218
218
  }).map(function (field) {
219
219
  var _field$options;
220
220
  return {
@@ -51,6 +51,7 @@ export interface FieldDefinition {
51
51
  width?: number;
52
52
  fixed?: 'left' | 'right';
53
53
  ellipsis?: boolean;
54
+ hideInFilter?: boolean;
54
55
  }
55
56
  export interface PaginationConfig {
56
57
  current: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donglegeyu/company-ui",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",