@hzab/list-render 1.12.5 → 1.12.6

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/package.json CHANGED
@@ -1,73 +1,77 @@
1
- {
2
- "name": "@hzab/list-render",
3
- "version": "1.12.5",
4
- "description": "",
5
- "main": "src",
6
- "scripts": {
7
- "dev": "webpack serve -c ./config/webpack.config.js --env local",
8
- "build": "webpack -c ./config/webpack.config.js --env production",
9
- "version:alpha": "npm version prerelease --preid=alpha",
10
- "publish:alpha": "npm publish --tag alpha",
11
- "version:beta": "npm version prerelease --preid=beta",
12
- "publish:beta": "npm publish --tag beta",
13
- "version:patch": "npm version patch",
14
- "version:minior": "npm version minor",
15
- "version:major": "npm version major",
16
- "publish:stable": "npm publish --access public"
17
- },
18
- "files": [
19
- "src",
20
- "docs",
21
- "CHANGELOG.md"
22
- ],
23
- "keywords": [],
24
- "author": "CaiYansong",
25
- "license": "ISC",
26
- "devDependencies": {
27
- "@ant-design/icons": "^4.8.1",
28
- "@hzab/data-model": "^1.7.4",
29
- "@hzab/form-render": "^1.6.12",
30
- "@hzab/formily-result-utils": "^1.2.0",
31
- "@hzab/permissions": "^1.0.0",
32
- "@hzab/schema-descriptions": "^1.3.0",
33
- "@hzab/utils": "^1.0.7",
34
- "@hzab/webpack-config": "^0.7.2",
35
- "@types/react": "^17.0.62",
36
- "@types/react-dom": "^17.0.20",
37
- "antd": "^4.24.12",
38
- "axios": "^1.4.0",
39
- "eslint": "^8.30.0",
40
- "less": "^4.1.3",
41
- "lodash": "^4.17.21",
42
- "mobx": "^6.7.0",
43
- "mobx-react": "^7.6.0",
44
- "react": "^17.0.2",
45
- "react-dom": "^17.0.2",
46
- "react-router-dom": "^6.8.1",
47
- "typescript": "^4.9.4"
48
- },
49
- "peerDependencies": {
50
- "@formily/core": "2.3.1",
51
- "@formily/react": "2.3.1",
52
- "@formily/reactive-react": "2.3.1",
53
- "@hzab/data-model": ">=1.7.4",
54
- "@hzab/form-render": ">=1.0.0",
55
- "@hzab/formily-result-utils": ">=1.2.0",
56
- "@hzab/schema-descriptions": ">=1.0.0",
57
- "@hzab/utils": ">=1.0.7",
58
- "antd": "4.x",
59
- "axios": ">=1.4.0",
60
- "c-formily-antd": "2.3.1",
61
- "lodash": ">=4.17.21",
62
- "react": ">=16.8.0",
63
- "react-dom": ">=16.8.0",
64
- "@hzab/edit-table": ">=0.1.2"
65
- },
66
- "directories": {
67
- "lib": "lib"
68
- },
69
- "dependencies": {
70
- "array-move": "^4.0.0",
71
- "react-sortable-hoc": "^2.0.0"
72
- }
73
- }
1
+ {
2
+ "name": "@hzab/list-render",
3
+ "version": "1.12.6",
4
+ "private": false,
5
+ "src-direct": true,
6
+ "type": "module",
7
+ "description": "列表与表格渲染",
8
+ "license": "ISC",
9
+ "author": "CaiYansong",
10
+ "engines": {
11
+ "node": ">=24"
12
+ },
13
+ "main": "src",
14
+ "files": [
15
+ "src",
16
+ "dist",
17
+ "docs",
18
+ "CHANGELOG.md"
19
+ ],
20
+ "sideEffects": [
21
+ "**/*.less"
22
+ ],
23
+ "peerDependencies": {
24
+ "@formily/core": ">=2.0.0",
25
+ "@formily/json-schema": ">=2.0.0",
26
+ "@formily/react": ">=2.0.0",
27
+ "@formily/reactive": ">=2.0.0",
28
+ "antd": ">=4.0.0",
29
+ "array-move": "^4.0.0",
30
+ "c-formily-antd": ">=2.0.0",
31
+ "react": ">=16.8.0",
32
+ "react-dom": ">=16.8.0",
33
+ "react-sortable-hoc": ">=2.0.0"
34
+ },
35
+ "dependencies": {
36
+ "@ant-design/icons": "^4.8.0",
37
+ "dayjs": "^1.11.7",
38
+ "lodash": "^4.17.21",
39
+ "@hzab/data-model": ">=1.7.4",
40
+ "@hzab/edit-table": ">=0.0.1",
41
+ "@hzab/form-render": ">=1.0.0",
42
+ "@hzab/formily-result-utils": ">=1.2.0",
43
+ "@hzab/schema-descriptions": ">=1.0.0",
44
+ "@hzab/utils": ">=1.0.7"
45
+ },
46
+ "devDependencies": {
47
+ "@ant-design/icons": "^4.8.0",
48
+ "@formily/core": "2.3.1",
49
+ "@formily/json-schema": "^2.3.1",
50
+ "@formily/reactive": "^2.3.1",
51
+ "@formily/react": "2.3.1",
52
+ "@types/lodash": "^4.17.12",
53
+ "@types/react": "^17.0.62",
54
+ "@types/react-dom": "^17.0.20",
55
+ "@vitest/coverage-v8": "4.1.10",
56
+ "antd": "^4.24.12",
57
+ "array-move": "^4.0.0",
58
+ "c-formily-antd": "^2.3.1",
59
+ "happy-dom": "^20.11.1",
60
+ "lodash": "^4.17.21",
61
+ "react": "^17.0.2",
62
+ "react-dom": "^17.0.2",
63
+ "react-sortable-hoc": "^2.0.0",
64
+ "typescript": "^5.9.3",
65
+ "vite": "^8.0.0",
66
+ "vitest": "^4.1.10",
67
+ "@hzab/eslint-config": "^0.0.0",
68
+ "@hzab/typescript-config": "^0.0.0",
69
+ "@hzab/vite-config": "^0.0.3-alpha.0"
70
+ },
71
+ "scripts": {
72
+ "build": "vite build && tsc -p tsconfig.build.json",
73
+ "typecheck": "tsc -p tsconfig.json",
74
+ "test": "vitest run --passWithNoTests",
75
+ "test:watch": "vitest"
76
+ }
77
+ }
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import "./index.less";
3
3
  import { Tag } from "antd";
4
- import { getVal } from "@hzab/list-render/src/common/utils";
4
+ import { getVal } from "@hzab/utils/src/formily/field";
5
5
  function hasValue(val) {
6
6
  return val !== null && val !== undefined;
7
7
  }
@@ -12,13 +12,12 @@ const FilterTag = (props: any) => {
12
12
  if (queryRef) {
13
13
  const list = [];
14
14
  const fieldSchemas = queryRef.current?.formRef?.current?.formRender?.fields;
15
- for (let key in schema?.schema?.properties) {
15
+ for (const key in schema?.schema?.properties) {
16
16
  const field = schema?.schema?.properties[key];
17
17
  if (hasValue(searchQuery[key])) {
18
- let val = getVal({ ...field, ...fieldSchemas[field?.name] }, searchQuery, {
18
+ const val = getVal({ ...field, ...fieldSchemas[field?.name] }, searchQuery, {
19
19
  fieldSchema: fieldSchemas?.[field?.name],
20
20
  });
21
-
22
21
  list.push({
23
22
  label: field?.title,
24
23
  value: val,
@@ -13,7 +13,7 @@ export interface IFormRender {
13
13
  setValues: Function;
14
14
  reset: Function;
15
15
  validate: Function;
16
- values: Object;
16
+ values: object;
17
17
  }
18
18
  export interface IFormRef {
19
19
  formRender: IFormRender;
@@ -26,7 +26,7 @@ export interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
26
26
  record: Item;
27
27
  index: number;
28
28
  editable: boolean;
29
- onEdit: (record: Partial<Item> & { key: React.Key }, dataIndex: string, opt: Object) => void;
29
+ onEdit: (record: Partial<Item> & { key: React.Key }, dataIndex: string, opt: object) => void;
30
30
  onSave: (field: { type: string; name: string }) => void;
31
31
  onCancel: () => void;
32
32
  topProps: {
@@ -67,7 +67,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
67
67
  }
68
68
  // 无编辑权限或禁止编辑
69
69
  const _hasEdit = hasEdit && typeof hasEdit === "function" ? hasEdit(record, index) : hasEdit !== false;
70
- let _editable =
70
+ const _editable =
71
71
  _hasEdit &&
72
72
  editable &&
73
73
  !(fPattern === "disabled" || fPattern === "readOnly" || fDisplay === "none") &&
@@ -150,7 +150,7 @@ export const useEditTable = (props) => {
150
150
 
151
151
  // 创建 formily 表单相关参数
152
152
  /** schema scope 解决父级无 schema Scope 导致 scope 对象刷新的问题 */
153
- const schemaScopeRef = useRef<{ _$tempData: Object }>();
153
+ const schemaScopeRef = useRef<{ _$tempData: object }>();
154
154
  if (props.schemaScope && !schemaScopeRef.current) {
155
155
  schemaScopeRef.current = props.schemaScope;
156
156
  } else if (!schemaScopeRef.current) {
@@ -1,7 +1,8 @@
1
1
  import { memo, useMemo, useCallback } from "react";
2
2
  import { createForm } from "@formily/core";
3
3
  import { antdComponents, customComponents } from "@hzab/form-render";
4
- import { createSchemaField, useField, useFieldSchema, Schema } from "@formily/react";
4
+ import type { Schema } from "@formily/react";
5
+ import { createSchemaField, useField, useFieldSchema } from "@formily/react";
5
6
  import { Form } from "c-formily-antd";
6
7
  import { cloneSchema } from "@hzab/utils/src/formily/cloneSchema";
7
8
 
@@ -10,9 +11,9 @@ import { handleReaction } from "../../common/handleReactions";
10
11
  type formilyFieldPropsT = {
11
12
  schema: Schema;
12
13
  formilyRef: any;
13
- schemaScope: Object;
14
- components: Object;
15
- reactionOpts?: Object;
14
+ schemaScope: object;
15
+ components: object;
16
+ reactionOpts?: object;
16
17
  };
17
18
 
18
19
  // TODO: 借住 formily 核心代码实现相关数据响应
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  import _ from "lodash";
3
3
 
4
4
  import { getFieldOptItByVal } from "../../common/utils";
@@ -6,9 +6,9 @@ import { getFieldOptItByVal } from "../../common/utils";
6
6
  import "./index.less";
7
7
 
8
8
  export interface IPrefixNodeProps {
9
- showPrefixNode?: boolean | Object;
9
+ showPrefixNode?: boolean | object;
10
10
  value: any;
11
- field?: Object;
11
+ field?: object;
12
12
  }
13
13
 
14
14
  export interface ITagOption {
@@ -34,7 +34,7 @@ export const defaultSwitchEnum = [
34
34
 
35
35
  export const PrefixNode = (props) => {
36
36
  const { value, field } = props;
37
- let showVal = Array.isArray(value) ? value : [value];
37
+ const showVal = Array.isArray(value) ? value : [value];
38
38
 
39
39
  const _field = { enum: defaultSwitchEnum, ...field };
40
40
 
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  import { Tag } from "antd";
3
3
  import _ from "lodash";
4
4
 
@@ -7,9 +7,9 @@ import { getFieldOptItByVal } from "../../common/utils";
7
7
  import "./index.less";
8
8
 
9
9
  export interface ITagsProps {
10
- showTags?: boolean | Object;
10
+ showTags?: boolean | object;
11
11
  value: any;
12
- field?: Object;
12
+ field?: object;
13
13
  }
14
14
 
15
15
  export interface ITagOption {
@@ -22,7 +22,7 @@ export interface ITagOption {
22
22
 
23
23
  export const Tags = (props) => {
24
24
  const { value, field } = props;
25
- let showVal = Array.isArray(value) ? value : [value];
25
+ const showVal = Array.isArray(value) ? value : [value];
26
26
 
27
27
  return showVal?.map((it, i) => {
28
28
  const option = getFieldOptItByVal(it, field) || {};
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />