@next-libs/cmdb-instances 6.5.1 → 6.6.1

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.
@@ -3,12 +3,14 @@ export var structData = {
3
3
  str: "string",
4
4
  int: 1000,
5
5
  ip: "0.0.0.0",
6
- enum: "1",
6
+ enum1: "1",
7
+ enum2: "3",
7
8
  date: "2019-05-24",
8
9
  datetime: "2019-05-24 12:00:00",
9
10
  enums: ["1", "3"],
10
11
  float: 100.1,
11
12
  json: "666",
13
+ bool: true,
12
14
  json1: {
13
15
  test: "666"
14
16
  }
@@ -40,17 +42,22 @@ export var attribute = {
40
42
  type: "str"
41
43
  }, {
42
44
  id: "int",
43
- name: "数组",
45
+ name: "整型",
44
46
  type: "int"
45
47
  }, {
46
48
  id: "ip",
47
49
  name: "IP地址",
48
50
  type: "ip"
49
51
  }, {
50
- id: "enum",
51
- name: "枚举",
52
+ id: "enum1",
53
+ name: "枚举(<6)",
52
54
  type: "enum",
53
55
  regex: ["1", "3", "5", "7", "9"]
56
+ }, {
57
+ id: "enum2",
58
+ name: "枚举(>=6)",
59
+ type: "enum",
60
+ regex: ["1", "3", "5", "7", "9", "11"]
54
61
  }, {
55
62
  id: "date",
56
63
  name: "日期",
@@ -68,6 +75,10 @@ export var attribute = {
68
75
  id: "float",
69
76
  name: "浮点型",
70
77
  type: "float"
78
+ }, {
79
+ id: "bool",
80
+ name: "布尔型",
81
+ type: "bool"
71
82
  }, {
72
83
  id: "json",
73
84
  name: "json",
@@ -78,4 +89,62 @@ export var attribute = {
78
89
  type: "json"
79
90
  }]
80
91
  }
92
+ };
93
+ export var attributeWithRegex = {
94
+ name: "结构体",
95
+ id: "struct",
96
+ value: {
97
+ type: "structs",
98
+ struct_define: [{
99
+ id: "arr",
100
+ name: "数组",
101
+ type: "arr",
102
+ regex: "^678"
103
+ }, {
104
+ id: "str",
105
+ name: "字符串",
106
+ type: "str",
107
+ regex: "^abc"
108
+ }, {
109
+ id: "int",
110
+ name: "整型",
111
+ type: "int",
112
+ regex: "10$"
113
+ }, {
114
+ id: "ip",
115
+ name: "IP地址",
116
+ type: "ip",
117
+ regex: "^((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\[[^\\[\\],;\\s]{1,100}\\]|)$"
118
+ }, {
119
+ id: "enum1",
120
+ name: "枚举(<6)",
121
+ type: "enum",
122
+ regex: ["1", "3", "5", "7", "9"]
123
+ }, {
124
+ id: "enum2",
125
+ name: "枚举(>=6)",
126
+ type: "enum",
127
+ regex: ["1", "3", "5", "7", "9", "11"]
128
+ }, {
129
+ id: "enums",
130
+ name: "枚举多选",
131
+ type: "enums",
132
+ regex: ["1", "3", "5", "7", "9"]
133
+ }, {
134
+ id: "json",
135
+ name: "json",
136
+ type: "json",
137
+ regex: JSON.stringify({
138
+ type: "object",
139
+ properties: {
140
+ city: {
141
+ type: "string"
142
+ },
143
+ number: {
144
+ type: "number"
145
+ }
146
+ }
147
+ })
148
+ }]
149
+ }
81
150
  };
@@ -51,7 +51,7 @@ export declare class ModelAttributeForm extends Component<ModelAttributeFormProp
51
51
  private modelData;
52
52
  static defaultProps: {
53
53
  showCancelButton: boolean;
54
- cancelType: "default" | "link" | "text" | "ghost" | "primary" | "dashed";
54
+ cancelType: "link" | "text" | "ghost" | "default" | "primary" | "dashed";
55
55
  };
56
56
  formItemProps: FormItemProps;
57
57
  constructor(props: ModelAttributeFormProps);
@@ -1,31 +1,10 @@
1
- import React, { ChangeEvent } from "react";
2
- import { Attribute, Structkey } from "./interfaces";
3
- import { RadioChangeEvent } from "antd/lib/radio";
4
- import { SelectValue } from "antd/lib/select";
1
+ import React from "react";
2
+ import { Attribute } from "./interfaces";
5
3
  export interface AddStructModalProps {
6
4
  structData?: any;
7
5
  attribute: Attribute;
8
- handleStoreFunction: Function;
9
- handleCancelFunction: Function;
6
+ handleStoreFunction: any;
7
+ handleCancelFunction: () => void;
10
8
  visible: boolean;
11
9
  }
12
- export interface AddStructModalState {
13
- structData?: any;
14
- showError?: boolean[];
15
- }
16
- export declare class AddStructModal extends React.Component<AddStructModalProps, AddStructModalState> {
17
- constructor(props: AddStructModalProps);
18
- componentDidUpdate(prevProps: AddStructModalProps): void;
19
- hasRegex: (regex: any) => boolean;
20
- hasValueWithRegex: (value: any, regex: any) => boolean;
21
- handleValueChange: (e: SelectValue, define: Structkey) => void;
22
- handleInputValueChange: (e: RadioChangeEvent | ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>, define: any) => void;
23
- validateRegex: (value: any, define: any, index: number) => void;
24
- handleIpValueChange: (e: ChangeEvent<HTMLInputElement>, define: any, index: number) => void;
25
- getEnumForm: (define: any, value: string) => JSX.Element;
26
- validateJson: (err: any, index: number) => void;
27
- getFormType: (define: Structkey, value: any, index: number) => JSX.Element;
28
- handleStore: () => void;
29
- handleCloseModal: () => void;
30
- render(): JSX.Element;
31
- }
10
+ export declare function AddStructModal(props: AddStructModalProps): React.ReactElement;
@@ -25,3 +25,16 @@ export interface Attribute {
25
25
  tips?: string;
26
26
  description?: string;
27
27
  }
28
+ export declare enum StructDefineType {
29
+ STRING = "str",
30
+ INTEGER = "int",
31
+ ENUM = "enum",
32
+ ENUMS = "enums",
33
+ ARR = "arr",
34
+ DATE = "date",
35
+ DATETIME = "datetime",
36
+ IP = "ip",
37
+ FLOAT = "float",
38
+ BOOLEAN = "bool",
39
+ JSON = "json"
40
+ }
@@ -4,12 +4,14 @@ export declare const structData: {
4
4
  str: string;
5
5
  int: number;
6
6
  ip: string;
7
- enum: string;
7
+ enum1: string;
8
+ enum2: string;
8
9
  date: string;
9
10
  datetime: string;
10
11
  enums: string[];
11
12
  float: number;
12
13
  json: string;
14
+ bool: boolean;
13
15
  json1: {
14
16
  test: string;
15
17
  };
@@ -25,7 +27,23 @@ export declare const structData2: {
25
27
  enums: string[];
26
28
  float: number;
27
29
  };
28
- export declare const structList: {
30
+ export declare const structList: ({
31
+ arr: string[];
32
+ str: string;
33
+ int: number;
34
+ ip: string;
35
+ enum1: string;
36
+ enum2: string;
37
+ date: string;
38
+ datetime: string;
39
+ enums: string[];
40
+ float: number;
41
+ json: string;
42
+ bool: boolean;
43
+ json1: {
44
+ test: string;
45
+ };
46
+ } | {
29
47
  arr: string[];
30
48
  str: string;
31
49
  int: number;
@@ -35,5 +53,6 @@ export declare const structList: {
35
53
  datetime: string;
36
54
  enums: string[];
37
55
  float: number;
38
- }[];
56
+ })[];
39
57
  export declare const attribute: Attribute;
58
+ export declare const attributeWithRegex: Attribute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-libs/cmdb-instances",
3
- "version": "6.5.1",
3
+ "version": "6.6.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "https://github.com/easyops-cn/next-libs/tree/master/libs/cmdb-instances",
6
6
  "license": "GPL-3.0",
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@next-core/brick-types": "^2.16.0",
39
- "@next-libs/basic-components": "^3.2.0",
39
+ "@next-libs/basic-components": "^3.2.3",
40
40
  "@next-libs/cmdb-utils": "^3.0.2",
41
- "@next-libs/code-editor-components": "^4.0.4",
42
- "@next-libs/forms": "^3.2.2",
41
+ "@next-libs/code-editor-components": "^4.0.7",
42
+ "@next-libs/forms": "^3.2.5",
43
43
  "@next-libs/storage": "^2.0.2",
44
44
  "@next-sdk/cmdb-sdk": "^2.1.1",
45
45
  "@next-sdk/permission-sdk": "^2.1.1",
@@ -50,5 +50,5 @@
50
50
  "immutability-helper": "^3.1.1",
51
51
  "marked": "^2.1.3"
52
52
  },
53
- "gitHead": "51e1257313e395767998c67d5fc411b7ff776aff"
53
+ "gitHead": "3b343ce2f9cab18091539c81f62517b792621f6e"
54
54
  }