@next-bricks/form-platform 0.1.0

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.
Files changed (94) hide show
  1. package/dist/bricks.json +15 -0
  2. package/dist/chunks/1646.15e769ed.js +2 -0
  3. package/dist/chunks/1646.15e769ed.js.map +1 -0
  4. package/dist/chunks/1874.e1acf168.js +2 -0
  5. package/dist/chunks/1874.e1acf168.js.map +1 -0
  6. package/dist/chunks/1909.b23e9585.js +3 -0
  7. package/dist/chunks/1909.b23e9585.js.LICENSE.txt +3 -0
  8. package/dist/chunks/1909.b23e9585.js.map +1 -0
  9. package/dist/chunks/2024.232c5c0f.js +2 -0
  10. package/dist/chunks/2024.232c5c0f.js.map +1 -0
  11. package/dist/chunks/2108.bdbd07c0.js +2 -0
  12. package/dist/chunks/2108.bdbd07c0.js.map +1 -0
  13. package/dist/chunks/2386.00bf76a9.js +2 -0
  14. package/dist/chunks/2386.00bf76a9.js.map +1 -0
  15. package/dist/chunks/2754.66ac1595.js +2 -0
  16. package/dist/chunks/2754.66ac1595.js.map +1 -0
  17. package/dist/chunks/2784.91d434a8.js +2 -0
  18. package/dist/chunks/2784.91d434a8.js.LICENSE.txt +9 -0
  19. package/dist/chunks/2993.e1ed15e5.js +2 -0
  20. package/dist/chunks/2993.e1ed15e5.js.map +1 -0
  21. package/dist/chunks/3458.de6bfe67.js +2 -0
  22. package/dist/chunks/3458.de6bfe67.js.map +1 -0
  23. package/dist/chunks/3914.8e90018e.js +2 -0
  24. package/dist/chunks/3914.8e90018e.js.map +1 -0
  25. package/dist/chunks/4049.d0aaa25b.js +2 -0
  26. package/dist/chunks/4049.d0aaa25b.js.map +1 -0
  27. package/dist/chunks/4275.f7775053.js +2 -0
  28. package/dist/chunks/4275.f7775053.js.map +1 -0
  29. package/dist/chunks/4717.36c87a44.js +2 -0
  30. package/dist/chunks/4717.36c87a44.js.map +1 -0
  31. package/dist/chunks/5151.c2b57bdf.js +2 -0
  32. package/dist/chunks/5151.c2b57bdf.js.map +1 -0
  33. package/dist/chunks/5202.406083e3.js +2 -0
  34. package/dist/chunks/5202.406083e3.js.map +1 -0
  35. package/dist/chunks/5628.77f92adc.js +2 -0
  36. package/dist/chunks/5628.77f92adc.js.map +1 -0
  37. package/dist/chunks/5637.c7e5c6b1.js +2 -0
  38. package/dist/chunks/5637.c7e5c6b1.js.map +1 -0
  39. package/dist/chunks/5725.5aa43e8a.js +2 -0
  40. package/dist/chunks/5725.5aa43e8a.js.map +1 -0
  41. package/dist/chunks/6205.7102ad44.js +2 -0
  42. package/dist/chunks/6205.7102ad44.js.map +1 -0
  43. package/dist/chunks/6473.64c6f123.js +2 -0
  44. package/dist/chunks/6473.64c6f123.js.map +1 -0
  45. package/dist/chunks/6635.a062156c.js +3 -0
  46. package/dist/chunks/6635.a062156c.js.LICENSE.txt +8 -0
  47. package/dist/chunks/6635.a062156c.js.map +1 -0
  48. package/dist/chunks/6653.9260aa26.js +2 -0
  49. package/dist/chunks/6653.9260aa26.js.map +1 -0
  50. package/dist/chunks/7110.1f333041.js +2 -0
  51. package/dist/chunks/7110.1f333041.js.map +1 -0
  52. package/dist/chunks/714.69e54307.js +2 -0
  53. package/dist/chunks/714.69e54307.js.map +1 -0
  54. package/dist/chunks/7164.d143d878.js +2 -0
  55. package/dist/chunks/7164.d143d878.js.map +1 -0
  56. package/dist/chunks/7672.06b13df8.js +2 -0
  57. package/dist/chunks/7672.06b13df8.js.map +1 -0
  58. package/dist/chunks/7746.2f1136b9.js +2 -0
  59. package/dist/chunks/7746.2f1136b9.js.map +1 -0
  60. package/dist/chunks/7782.0ad7fbe8.js +2 -0
  61. package/dist/chunks/7782.0ad7fbe8.js.map +1 -0
  62. package/dist/chunks/7915.cdf7487e.js +2 -0
  63. package/dist/chunks/7915.cdf7487e.js.map +1 -0
  64. package/dist/chunks/8008.30d8018a.js +3 -0
  65. package/dist/chunks/8008.30d8018a.js.LICENSE.txt +3 -0
  66. package/dist/chunks/8008.30d8018a.js.map +1 -0
  67. package/dist/chunks/8316.a2413992.js +2 -0
  68. package/dist/chunks/8316.a2413992.js.LICENSE.txt +19 -0
  69. package/dist/chunks/8498.b7e6d18a.js +2 -0
  70. package/dist/chunks/8498.b7e6d18a.js.map +1 -0
  71. package/dist/chunks/8691.7b30fb8e.js +2 -0
  72. package/dist/chunks/8691.7b30fb8e.js.map +1 -0
  73. package/dist/chunks/9264.5fa27146.js +2 -0
  74. package/dist/chunks/9264.5fa27146.js.map +1 -0
  75. package/dist/chunks/9431.845ca073.js +2 -0
  76. package/dist/chunks/9431.845ca073.js.map +1 -0
  77. package/dist/chunks/9549.d3a078f4.js +2 -0
  78. package/dist/chunks/9549.d3a078f4.js.map +1 -0
  79. package/dist/chunks/eo-user-or-user-group-select.c95de601.js +2 -0
  80. package/dist/chunks/eo-user-or-user-group-select.c95de601.js.map +1 -0
  81. package/dist/chunks/main.743428ee.js +2 -0
  82. package/dist/chunks/main.743428ee.js.map +1 -0
  83. package/dist/examples.json +5 -0
  84. package/dist/index.6ed8d941.js +2 -0
  85. package/dist/index.6ed8d941.js.map +1 -0
  86. package/dist/manifest.json +106 -0
  87. package/dist/types.json +276 -0
  88. package/dist-types/bootstrap.d.ts +1 -0
  89. package/dist-types/index.d.ts +1 -0
  90. package/dist-types/user-or-user-group-select/i18n.d.ts +11 -0
  91. package/dist-types/user-or-user-group-select/index.d.ts +133 -0
  92. package/dist-types/user-or-user-group-select/index.spec.d.ts +1 -0
  93. package/docs/eo-user-or-user-group-select.md +14 -0
  94. package/package.json +42 -0
@@ -0,0 +1,276 @@
1
+ {
2
+ "eo-user-or-user-group-select": {
3
+ "properties": [
4
+ {
5
+ "name": "name",
6
+ "annotation": {
7
+ "type": "keyword",
8
+ "value": "string"
9
+ }
10
+ },
11
+ {
12
+ "name": "label",
13
+ "annotation": {
14
+ "type": "keyword",
15
+ "value": "string"
16
+ }
17
+ },
18
+ {
19
+ "name": "required",
20
+ "annotation": {
21
+ "type": "keyword",
22
+ "value": "boolean"
23
+ }
24
+ },
25
+ {
26
+ "name": "placeholder",
27
+ "annotation": {
28
+ "type": "keyword",
29
+ "value": "string"
30
+ }
31
+ },
32
+ {
33
+ "name": "value",
34
+ "annotation": {
35
+ "type": "union",
36
+ "types": [
37
+ {
38
+ "type": "array",
39
+ "elementType": {
40
+ "type": "keyword",
41
+ "value": "string"
42
+ }
43
+ },
44
+ {
45
+ "type": "reference",
46
+ "typeName": {
47
+ "type": "identifier",
48
+ "name": "UserOrUserGroupSelectValue"
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ },
54
+ {
55
+ "name": "objectList",
56
+ "annotation": {
57
+ "type": "array",
58
+ "elementType": {
59
+ "type": "reference",
60
+ "typeName": {
61
+ "type": "identifier",
62
+ "name": "Partial"
63
+ },
64
+ "typeParameters": {
65
+ "type": "typeParameterInstantiation",
66
+ "params": [
67
+ {
68
+ "type": "reference",
69
+ "typeName": {
70
+ "type": "qualifiedName",
71
+ "left": {
72
+ "type": "identifier",
73
+ "name": "CmdbModels"
74
+ },
75
+ "right": {
76
+ "type": "identifier",
77
+ "name": "ModelCmdbObject"
78
+ }
79
+ }
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "name": "query",
88
+ "annotation": {
89
+ "type": "reference",
90
+ "typeName": {
91
+ "type": "identifier",
92
+ "name": "Record"
93
+ },
94
+ "typeParameters": {
95
+ "type": "typeParameterInstantiation",
96
+ "params": [
97
+ {
98
+ "type": "keyword",
99
+ "value": "string"
100
+ },
101
+ {
102
+ "type": "keyword",
103
+ "value": "any"
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "name": "userQuery",
111
+ "annotation": {
112
+ "type": "reference",
113
+ "typeName": {
114
+ "type": "identifier",
115
+ "name": "Record"
116
+ },
117
+ "typeParameters": {
118
+ "type": "typeParameterInstantiation",
119
+ "params": [
120
+ {
121
+ "type": "keyword",
122
+ "value": "string"
123
+ },
124
+ {
125
+ "type": "keyword",
126
+ "value": "any"
127
+ }
128
+ ]
129
+ }
130
+ }
131
+ },
132
+ {
133
+ "name": "userGroupQuery",
134
+ "annotation": {
135
+ "type": "reference",
136
+ "typeName": {
137
+ "type": "identifier",
138
+ "name": "Record"
139
+ },
140
+ "typeParameters": {
141
+ "type": "typeParameterInstantiation",
142
+ "params": [
143
+ {
144
+ "type": "keyword",
145
+ "value": "string"
146
+ },
147
+ {
148
+ "type": "keyword",
149
+ "value": "any"
150
+ }
151
+ ]
152
+ }
153
+ }
154
+ },
155
+ {
156
+ "name": "optionsMode",
157
+ "annotation": {
158
+ "type": "union",
159
+ "types": [
160
+ {
161
+ "type": "jsLiteral",
162
+ "value": "user"
163
+ },
164
+ {
165
+ "type": "jsLiteral",
166
+ "value": "group"
167
+ },
168
+ {
169
+ "type": "jsLiteral",
170
+ "value": "all"
171
+ }
172
+ ]
173
+ }
174
+ },
175
+ {
176
+ "name": "mergeUseAndUserGroup",
177
+ "annotation": {
178
+ "type": "keyword",
179
+ "value": "boolean"
180
+ }
181
+ },
182
+ {
183
+ "name": "disabled",
184
+ "annotation": {
185
+ "type": "keyword",
186
+ "value": "boolean"
187
+ }
188
+ },
189
+ {
190
+ "name": "isMultiple",
191
+ "annotation": {
192
+ "type": "keyword",
193
+ "value": "boolean"
194
+ }
195
+ },
196
+ {
197
+ "name": "staticList",
198
+ "annotation": {
199
+ "type": "array",
200
+ "elementType": {
201
+ "type": "keyword",
202
+ "value": "string"
203
+ }
204
+ }
205
+ }
206
+ ],
207
+ "events": [
208
+ {
209
+ "name": "change",
210
+ "detail": {
211
+ "annotation": {
212
+ "type": "union",
213
+ "types": [
214
+ {
215
+ "type": "array",
216
+ "elementType": {
217
+ "type": "keyword",
218
+ "value": "string"
219
+ }
220
+ },
221
+ {
222
+ "type": "reference",
223
+ "typeName": {
224
+ "type": "identifier",
225
+ "name": "UserOrUserGroupSelectValue"
226
+ }
227
+ }
228
+ ]
229
+ }
230
+ }
231
+ }
232
+ ],
233
+ "methods": [],
234
+ "types": [
235
+ {
236
+ "type": "typeAlias",
237
+ "name": "UserOrUserGroupSelectValue",
238
+ "annotation": {
239
+ "type": "typeLiteral",
240
+ "members": [
241
+ {
242
+ "type": "propertySignature",
243
+ "key": {
244
+ "type": "identifier",
245
+ "name": "selectedUser"
246
+ },
247
+ "annotation": {
248
+ "type": "array",
249
+ "elementType": {
250
+ "type": "keyword",
251
+ "value": "string"
252
+ }
253
+ },
254
+ "computed": false
255
+ },
256
+ {
257
+ "type": "propertySignature",
258
+ "key": {
259
+ "type": "identifier",
260
+ "name": "selectedUserGroup"
261
+ },
262
+ "annotation": {
263
+ "type": "array",
264
+ "elementType": {
265
+ "type": "keyword",
266
+ "value": "string"
267
+ }
268
+ },
269
+ "computed": false
270
+ }
271
+ ]
272
+ }
273
+ }
274
+ ]
275
+ }
276
+ }
@@ -0,0 +1 @@
1
+ import "./user-or-user-group-select/index.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare enum K {
2
+ }
3
+ export declare const NS = "bricks/form-platform/eo-user-or-user-group-select";
4
+ export declare const locales: {
5
+ en: Locale;
6
+ zh: Locale;
7
+ };
8
+ type Locale = {
9
+ [key in K]: string;
10
+ };
11
+ export {};
@@ -0,0 +1,133 @@
1
+ /// <reference types="react" />
2
+ import "@next-core/theme";
3
+ import { FormItemProps } from "@next-bricks/form/form-item";
4
+ import { FormItemElementBase } from "@next-shared/form";
5
+ import { CmdbModels } from "@next-api-sdk/cmdb-sdk";
6
+ type ModelObjectItem = Partial<CmdbModels.ModelCmdbObject>;
7
+ export type UserOrUserGroupSelectValue = {
8
+ selectedUser: string[];
9
+ selectedUserGroup: string[];
10
+ };
11
+ export interface EoUserOrUserGroupSelectProps extends FormItemProps {
12
+ value?: UserOrUserGroupSelectValue | undefined;
13
+ placeholder?: string;
14
+ disabled?: boolean;
15
+ readOnly?: boolean;
16
+ clearable?: boolean;
17
+ validateState?: string;
18
+ onChange?: (value: string[]) => void;
19
+ objectList?: ModelObjectItem[];
20
+ query?: Record<string, any>;
21
+ userGroupQuery?: Record<string, any>;
22
+ userQuery?: Record<string, any>;
23
+ optionsMode: "user" | "group" | "all";
24
+ staticList?: string[];
25
+ isMultiple?: boolean;
26
+ }
27
+ /**
28
+ * 构件 `eo-user-or-user-group-select`
29
+ */
30
+ export declare class EoUserOrUserGroupSelect extends FormItemElementBase {
31
+ #private;
32
+ /**
33
+ * 字段名称
34
+ */
35
+ accessor name: string | undefined;
36
+ /**
37
+ * 字段说明
38
+ */
39
+ accessor label: string | undefined;
40
+ /**
41
+ * 是否必填
42
+ */
43
+ accessor required: boolean | undefined;
44
+ /**
45
+ * 字段placeholder
46
+ */
47
+ accessor placeholder: string | undefined;
48
+ /**
49
+ * 值
50
+ */
51
+ accessor value: string[] | UserOrUserGroupSelectValue | undefined;
52
+ /**
53
+ * 模型列表,不传该属性构件内部会发请求获取该列表,如果需要传该属性则优先使用外部传进来的数据,该数据来自"providers-of-cmdb.cmdb-object-api-get-object-ref" 如 demo 所示
54
+ * advanced
55
+ */
56
+ accessor objectList: Partial<CmdbModels.ModelCmdbObject>[] | undefined;
57
+ /**
58
+ * 用户和用户组`search`接口的`query`,此参数比较适用于,两者接口需要参数相同的情况
59
+ * advanced
60
+ */
61
+ accessor query: Record<string, any> | undefined;
62
+ /**
63
+ * @description 针对`USER/instance/_search`接口的`query`,此参数比较适用于,可能只需要针对用户做筛选的情况
64
+ * @group advanced
65
+ */
66
+ accessor userQuery: Record<string, any> | undefined;
67
+ /**
68
+ * @description 针对`USER_GROUP/instance/_search`接口的`query`,此参数比较适用于,可能只需要针对用户组做筛选的情况
69
+ * @group advanced
70
+ */
71
+ accessor userGroupQuery: Record<string, any> | undefined;
72
+ /**
73
+ * @default "all"
74
+ * @description 支持选择用户、用户组或者两者
75
+ * @editor radio
76
+ * @editorProps {
77
+ * "optionType": "button",
78
+ * "options": [
79
+ * {
80
+ * "label": "All",
81
+ * "value": "all"
82
+ * },
83
+ * {
84
+ * "label": "User",
85
+ * "value": "user",
86
+ * "icon": {
87
+ * "lib": "antd",
88
+ * "icon": "user",
89
+ * "theme": "outlined"
90
+ * }
91
+ * },
92
+ * {
93
+ * "label": "Group",
94
+ * "value": "group",
95
+ * "icon": {
96
+ * "lib": "antd",
97
+ * "icon": "usergroup-add",
98
+ * "theme": "outlined"
99
+ * }
100
+ * }
101
+ * ]
102
+ * }
103
+ * @group advanced
104
+ */
105
+ accessor optionsMode: "user" | "group" | "all";
106
+ /**
107
+ * @default false
108
+ * @description 是否合并用户和用户组数据,当设置为 true 时,输入的`value`和`user.group.change`事件输出的 detail 都为`string[]`格式。
109
+ * @group advanced
110
+ */
111
+ accessor mergeUseAndUserGroup: boolean;
112
+ /**
113
+ * 是否禁用
114
+ */
115
+ accessor disabled: boolean | undefined;
116
+ /**
117
+ * @description 是否多选,默认为多选
118
+ * @group advanced
119
+ */
120
+ accessor isMultiple: boolean;
121
+ /**
122
+ * @description 固定白名单列表,该列表中的值用户不能取消。
123
+ * @group advanced
124
+ */
125
+ accessor staticList: string[] | undefined;
126
+ handleUserOrUserGroupChange: (values: string[]) => void;
127
+ private _handleMergeUseAndUserGroup;
128
+ private mutableValue;
129
+ connectedCallback(): void;
130
+ render(): JSX.Element;
131
+ }
132
+ export declare function EoUserOrUserGroupSelectComponent(props: EoUserOrUserGroupSelectProps): JSX.Element;
133
+ export {};
@@ -0,0 +1 @@
1
+ import "./";
@@ -0,0 +1,14 @@
1
+ 构件 `eo-user-or-user-group-select`
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ - brick: eo-user-or-user-group-select
9
+ properties:
10
+ label: Label
11
+ name: user
12
+ placeholder: 用户
13
+ isMultiple: true
14
+ ```
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@next-bricks/form-platform",
3
+ "version": "0.1.0",
4
+ "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/form-platform",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git@github.com:easyops-cn/next-bricks.git"
8
+ },
9
+ "license": "GPL-3.0",
10
+ "type": "module",
11
+ "sideEffects": true,
12
+ "files": [
13
+ "dist",
14
+ "dist-types",
15
+ "docs"
16
+ ],
17
+ "exports": {
18
+ "./package.json": "./package.json",
19
+ "./dist/bricks.json": "./dist/bricks.json",
20
+ "./dist/manifest.json": "./dist/manifest.json",
21
+ "./*": {
22
+ "types": "./dist-types/*/index.d.ts"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "start": "cross-env NODE_ENV=development build-next-bricks --watch",
27
+ "build": "npm run build:main && npm run build:types",
28
+ "build:main": "cross-env NODE_ENV=production build-next-bricks",
29
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json",
30
+ "build:manifest": "cross-env NODE_ENV=production build-next-bricks --manifest-only",
31
+ "test": "cross-env NODE_ENV='test' test-next",
32
+ "test:ci": "cross-env NODE_ENV='test' CI=true test-next",
33
+ "prepublishOnly": "cp package.json package.json.bak && npm pkg delete dependencies",
34
+ "postpublish": "mv package.json.bak package.json"
35
+ },
36
+ "devDependencies": {
37
+ "@next-api-sdk/cmdb-sdk": "^1.1.0",
38
+ "@next-core/build-next-bricks": "^1.14.0",
39
+ "@next-core/test-next": "^1.0.8"
40
+ },
41
+ "gitHead": "b19c4f42ade24835a55058209fa8c3948c559f49"
42
+ }