@next-bricks/form-platform 0.4.43 → 0.6.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 (73) hide show
  1. package/dist/bricks.json +6 -2
  2. package/dist/chunks/4837.c71e7277.js +2 -0
  3. package/dist/chunks/4837.c71e7277.js.map +1 -0
  4. package/dist/chunks/6046.d0b3cfb1.js +3 -0
  5. package/dist/chunks/6046.d0b3cfb1.js.map +1 -0
  6. package/dist/chunks/6223.ef1a783e.js +3 -0
  7. package/dist/chunks/6223.ef1a783e.js.map +1 -0
  8. package/dist/chunks/6580.ab4ba4d4.js +3 -0
  9. package/dist/chunks/{6580.cb814a92.js.map → 6580.ab4ba4d4.js.map} +1 -1
  10. package/dist/chunks/6941.66e34b74.js +2 -0
  11. package/dist/chunks/6941.66e34b74.js.map +1 -0
  12. package/dist/chunks/7218.16427ab5.js +2 -0
  13. package/dist/chunks/7218.16427ab5.js.map +1 -0
  14. package/dist/chunks/7304.593cf3e0.js +2 -0
  15. package/dist/chunks/7304.593cf3e0.js.map +1 -0
  16. package/dist/chunks/7733.6bb39aa4.js +2 -0
  17. package/dist/chunks/7733.6bb39aa4.js.map +1 -0
  18. package/dist/chunks/7895.0c6c8882.js +3 -0
  19. package/dist/chunks/7895.0c6c8882.js.LICENSE.txt +31 -0
  20. package/dist/chunks/7895.0c6c8882.js.map +1 -0
  21. package/dist/chunks/8989.8eb7605c.js +2 -0
  22. package/dist/chunks/{8989.ddec3574.js.map → 8989.8eb7605c.js.map} +1 -1
  23. package/dist/chunks/948.dec6ad6a.js +3 -0
  24. package/dist/chunks/948.dec6ad6a.js.map +1 -0
  25. package/dist/chunks/{9515.b803c371.js → 9515.ad9edd90.js} +2 -2
  26. package/dist/chunks/9515.ad9edd90.js.map +1 -0
  27. package/dist/chunks/eo-cmdb-instance-select.eca25616.js +2 -0
  28. package/dist/chunks/eo-cmdb-instance-select.eca25616.js.map +1 -0
  29. package/dist/chunks/eo-user-or-user-group-select.b49b99a5.js +3 -0
  30. package/dist/chunks/eo-user-or-user-group-select.b49b99a5.js.map +1 -0
  31. package/dist/chunks/main.dadcb141.js +2 -0
  32. package/dist/chunks/main.dadcb141.js.map +1 -0
  33. package/dist/examples.json +3 -0
  34. package/dist/index.d4f23f12.js +2 -0
  35. package/dist/index.d4f23f12.js.map +1 -0
  36. package/dist/manifest.json +190 -0
  37. package/dist/types.json +505 -0
  38. package/dist-types/bootstrap.d.ts +1 -0
  39. package/dist-types/cmdb-instance-select/CmdbInstanceSelectInternal.d.ts +98 -0
  40. package/dist-types/cmdb-instance-select/CmdbInstanceSelectInternal.spec.d.ts +1 -0
  41. package/dist-types/cmdb-instance-select/i18n.d.ts +13 -0
  42. package/dist-types/cmdb-instance-select/index.d.ts +185 -0
  43. package/dist-types/cmdb-instance-select/index.spec.d.ts +1 -0
  44. package/dist-types/jsx.d.ts +4 -0
  45. package/dist-types/user-or-user-group-select/index.d.ts +6 -0
  46. package/docs/eo-cmdb-instance-select.md +26 -0
  47. package/package.json +2 -2
  48. package/dist/chunks/562.a0776965.js +0 -3
  49. package/dist/chunks/562.a0776965.js.map +0 -1
  50. package/dist/chunks/6580.cb814a92.js +0 -3
  51. package/dist/chunks/7087.caf3e36e.js +0 -2
  52. package/dist/chunks/7087.caf3e36e.js.map +0 -1
  53. package/dist/chunks/7733.aa8bfd6d.js +0 -2
  54. package/dist/chunks/7733.aa8bfd6d.js.map +0 -1
  55. package/dist/chunks/8273.2f7fa990.js +0 -3
  56. package/dist/chunks/8273.2f7fa990.js.map +0 -1
  57. package/dist/chunks/843.53f0716d.js +0 -2
  58. package/dist/chunks/843.53f0716d.js.map +0 -1
  59. package/dist/chunks/8989.ddec3574.js +0 -2
  60. package/dist/chunks/948.d4495e18.js +0 -3
  61. package/dist/chunks/948.d4495e18.js.map +0 -1
  62. package/dist/chunks/9515.b803c371.js.map +0 -1
  63. package/dist/chunks/eo-user-or-user-group-select.8e3c1c0c.js +0 -3
  64. package/dist/chunks/eo-user-or-user-group-select.8e3c1c0c.js.map +0 -1
  65. package/dist/chunks/main.c1d91605.js +0 -2
  66. package/dist/chunks/main.c1d91605.js.map +0 -1
  67. package/dist/index.baf16d00.js +0 -2
  68. package/dist/index.baf16d00.js.map +0 -1
  69. /package/dist/chunks/{8273.2f7fa990.js.LICENSE.txt → 6046.d0b3cfb1.js.LICENSE.txt} +0 -0
  70. /package/dist/chunks/{562.a0776965.js.LICENSE.txt → 6223.ef1a783e.js.LICENSE.txt} +0 -0
  71. /package/dist/chunks/{6580.cb814a92.js.LICENSE.txt → 6580.ab4ba4d4.js.LICENSE.txt} +0 -0
  72. /package/dist/chunks/{948.d4495e18.js.LICENSE.txt → 948.dec6ad6a.js.LICENSE.txt} +0 -0
  73. /package/dist/chunks/{eo-user-or-user-group-select.8e3c1c0c.js.LICENSE.txt → eo-user-or-user-group-select.b49b99a5.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -239,5 +239,510 @@
239
239
  }
240
240
  ],
241
241
  "methods": []
242
+ },
243
+ "eo-cmdb-instance-select": {
244
+ "properties": [
245
+ {
246
+ "name": "name",
247
+ "annotation": {
248
+ "type": "keyword",
249
+ "value": "string"
250
+ }
251
+ },
252
+ {
253
+ "name": "label",
254
+ "annotation": {
255
+ "type": "keyword",
256
+ "value": "string"
257
+ }
258
+ },
259
+ {
260
+ "name": "required",
261
+ "annotation": {
262
+ "type": "keyword",
263
+ "value": "boolean"
264
+ }
265
+ },
266
+ {
267
+ "name": "placeholder",
268
+ "annotation": {
269
+ "type": "keyword",
270
+ "value": "string"
271
+ }
272
+ },
273
+ {
274
+ "name": "value",
275
+ "annotation": {
276
+ "type": "union",
277
+ "types": [
278
+ {
279
+ "type": "keyword",
280
+ "value": "string"
281
+ },
282
+ {
283
+ "type": "array",
284
+ "elementType": {
285
+ "type": "keyword",
286
+ "value": "string"
287
+ }
288
+ }
289
+ ]
290
+ }
291
+ },
292
+ {
293
+ "name": "objectId",
294
+ "annotation": {
295
+ "type": "keyword",
296
+ "value": "string"
297
+ }
298
+ },
299
+ {
300
+ "name": "disabled",
301
+ "annotation": {
302
+ "type": "keyword",
303
+ "value": "boolean"
304
+ }
305
+ },
306
+ {
307
+ "name": "allowClear",
308
+ "annotation": {
309
+ "type": "keyword",
310
+ "value": "boolean"
311
+ }
312
+ },
313
+ {
314
+ "name": "mode",
315
+ "annotation": {
316
+ "type": "keyword",
317
+ "value": "string"
318
+ }
319
+ },
320
+ {
321
+ "name": "pageSize",
322
+ "annotation": {
323
+ "type": "keyword",
324
+ "value": "number"
325
+ }
326
+ },
327
+ {
328
+ "name": "instanceQuery",
329
+ "annotation": {
330
+ "type": "keyword",
331
+ "value": "any"
332
+ }
333
+ },
334
+ {
335
+ "name": "fields",
336
+ "annotation": {
337
+ "type": "reference",
338
+ "typeName": {
339
+ "type": "identifier",
340
+ "name": "Partial"
341
+ },
342
+ "typeParameters": {
343
+ "type": "typeParameterInstantiation",
344
+ "params": [
345
+ {
346
+ "type": "reference",
347
+ "typeName": {
348
+ "type": "identifier",
349
+ "name": "ComplexOption"
350
+ },
351
+ "typeParameters": {
352
+ "type": "typeParameterInstantiation",
353
+ "params": [
354
+ {
355
+ "type": "keyword",
356
+ "value": "string"
357
+ }
358
+ ]
359
+ }
360
+ }
361
+ ]
362
+ }
363
+ }
364
+ },
365
+ {
366
+ "name": "minimumInputLength",
367
+ "annotation": {
368
+ "type": "keyword",
369
+ "value": "number"
370
+ }
371
+ },
372
+ {
373
+ "name": "extraSearchKey",
374
+ "annotation": {
375
+ "type": "array",
376
+ "elementType": {
377
+ "type": "keyword",
378
+ "value": "string"
379
+ }
380
+ }
381
+ },
382
+ {
383
+ "name": "extraFields",
384
+ "annotation": {
385
+ "type": "array",
386
+ "elementType": {
387
+ "type": "keyword",
388
+ "value": "string"
389
+ }
390
+ }
391
+ },
392
+ {
393
+ "name": "popoverPositionType",
394
+ "annotation": {
395
+ "type": "union",
396
+ "types": [
397
+ {
398
+ "type": "jsLiteral",
399
+ "value": "default"
400
+ },
401
+ {
402
+ "type": "jsLiteral",
403
+ "value": "parent"
404
+ }
405
+ ]
406
+ }
407
+ },
408
+ {
409
+ "name": "isMultiLabel",
410
+ "annotation": {
411
+ "type": "keyword",
412
+ "value": "boolean"
413
+ }
414
+ },
415
+ {
416
+ "name": "showSearchTip",
417
+ "annotation": {
418
+ "type": "keyword",
419
+ "value": "boolean"
420
+ }
421
+ },
422
+ {
423
+ "name": "labelTemplate",
424
+ "annotation": {
425
+ "type": "keyword",
426
+ "value": "string"
427
+ }
428
+ },
429
+ {
430
+ "name": "inputBoxStyle",
431
+ "annotation": {
432
+ "type": "reference",
433
+ "typeName": {
434
+ "type": "qualifiedName",
435
+ "left": {
436
+ "type": "identifier",
437
+ "name": "React"
438
+ },
439
+ "right": {
440
+ "type": "identifier",
441
+ "name": "CSSProperties"
442
+ }
443
+ }
444
+ }
445
+ },
446
+ {
447
+ "name": "permission",
448
+ "annotation": {
449
+ "type": "reference",
450
+ "typeName": {
451
+ "type": "identifier",
452
+ "name": "Array"
453
+ },
454
+ "typeParameters": {
455
+ "type": "typeParameterInstantiation",
456
+ "params": [
457
+ {
458
+ "type": "union",
459
+ "types": [
460
+ {
461
+ "type": "jsLiteral",
462
+ "value": "read"
463
+ },
464
+ {
465
+ "type": "jsLiteral",
466
+ "value": "update"
467
+ },
468
+ {
469
+ "type": "jsLiteral",
470
+ "value": "operate"
471
+ }
472
+ ]
473
+ }
474
+ ]
475
+ }
476
+ }
477
+ },
478
+ {
479
+ "name": "showTooltip",
480
+ "annotation": {
481
+ "type": "keyword",
482
+ "value": "boolean"
483
+ }
484
+ },
485
+ {
486
+ "name": "ignoreMissingFieldError",
487
+ "annotation": {
488
+ "type": "keyword",
489
+ "value": "boolean"
490
+ }
491
+ },
492
+ {
493
+ "name": "showKeyField",
494
+ "annotation": {
495
+ "type": "keyword",
496
+ "value": "boolean"
497
+ }
498
+ },
499
+ {
500
+ "name": "dropdownMatchSelectWidth",
501
+ "annotation": {
502
+ "type": "keyword",
503
+ "value": "boolean"
504
+ }
505
+ },
506
+ {
507
+ "name": "dropdownStyle",
508
+ "annotation": {
509
+ "type": "reference",
510
+ "typeName": {
511
+ "type": "qualifiedName",
512
+ "left": {
513
+ "type": "identifier",
514
+ "name": "React"
515
+ },
516
+ "right": {
517
+ "type": "identifier",
518
+ "name": "CSSProperties"
519
+ }
520
+ }
521
+ }
522
+ },
523
+ {
524
+ "name": "blurAfterValueChanged",
525
+ "annotation": {
526
+ "type": "keyword",
527
+ "value": "boolean"
528
+ }
529
+ },
530
+ {
531
+ "name": "sort",
532
+ "annotation": {
533
+ "type": "reference",
534
+ "typeName": {
535
+ "type": "identifier",
536
+ "name": "Array"
537
+ },
538
+ "typeParameters": {
539
+ "type": "typeParameterInstantiation",
540
+ "params": [
541
+ {
542
+ "type": "reference",
543
+ "typeName": {
544
+ "type": "identifier",
545
+ "name": "Record"
546
+ },
547
+ "typeParameters": {
548
+ "type": "typeParameterInstantiation",
549
+ "params": [
550
+ {
551
+ "type": "keyword",
552
+ "value": "string"
553
+ },
554
+ {
555
+ "type": "union",
556
+ "types": [
557
+ {
558
+ "type": "keyword",
559
+ "value": "number"
560
+ },
561
+ {
562
+ "type": "keyword",
563
+ "value": "string"
564
+ }
565
+ ]
566
+ }
567
+ ]
568
+ }
569
+ }
570
+ ]
571
+ }
572
+ }
573
+ },
574
+ {
575
+ "name": "useExternalCmdbApi",
576
+ "annotation": {
577
+ "type": "keyword",
578
+ "value": "boolean"
579
+ }
580
+ },
581
+ {
582
+ "name": "externalSourceId",
583
+ "annotation": {
584
+ "type": "keyword",
585
+ "value": "string"
586
+ }
587
+ }
588
+ ],
589
+ "events": [
590
+ {
591
+ "name": "change",
592
+ "detail": {
593
+ "annotation": {
594
+ "type": "union",
595
+ "types": [
596
+ {
597
+ "type": "keyword",
598
+ "value": "string"
599
+ },
600
+ {
601
+ "type": "array",
602
+ "elementType": {
603
+ "type": "keyword",
604
+ "value": "string"
605
+ }
606
+ }
607
+ ]
608
+ }
609
+ }
610
+ },
611
+ {
612
+ "name": "change.v2",
613
+ "detail": {
614
+ "annotation": {
615
+ "type": "reference",
616
+ "typeName": {
617
+ "type": "identifier",
618
+ "name": "ComplexOption"
619
+ }
620
+ }
621
+ }
622
+ },
623
+ {
624
+ "name": "options.change",
625
+ "detail": {
626
+ "annotation": {
627
+ "type": "typeLiteral",
628
+ "members": [
629
+ {
630
+ "type": "propertySignature",
631
+ "key": {
632
+ "type": "identifier",
633
+ "name": "options"
634
+ },
635
+ "annotation": {
636
+ "type": "array",
637
+ "elementType": {
638
+ "type": "reference",
639
+ "typeName": {
640
+ "type": "identifier",
641
+ "name": "ComplexOption"
642
+ }
643
+ }
644
+ },
645
+ "computed": false
646
+ },
647
+ {
648
+ "type": "propertySignature",
649
+ "key": {
650
+ "type": "identifier",
651
+ "name": "name"
652
+ },
653
+ "annotation": {
654
+ "type": "keyword",
655
+ "value": "string"
656
+ },
657
+ "computed": false
658
+ }
659
+ ]
660
+ }
661
+ }
662
+ }
663
+ ],
664
+ "methods": [],
665
+ "types": [
666
+ {
667
+ "type": "interface",
668
+ "name": "ComplexOption",
669
+ "typeParameters": {
670
+ "type": "typeParameterDeclaration",
671
+ "params": [
672
+ {
673
+ "type": "typeParameter",
674
+ "name": "T",
675
+ "default": {
676
+ "type": "union",
677
+ "types": [
678
+ {
679
+ "type": "keyword",
680
+ "value": "string"
681
+ },
682
+ {
683
+ "type": "keyword",
684
+ "value": "number"
685
+ }
686
+ ]
687
+ }
688
+ }
689
+ ]
690
+ },
691
+ "body": [
692
+ {
693
+ "type": "propertySignature",
694
+ "key": {
695
+ "type": "identifier",
696
+ "name": "label"
697
+ },
698
+ "annotation": {
699
+ "type": "union",
700
+ "types": [
701
+ {
702
+ "type": "array",
703
+ "elementType": {
704
+ "type": "keyword",
705
+ "value": "string"
706
+ }
707
+ },
708
+ {
709
+ "type": "keyword",
710
+ "value": "string"
711
+ }
712
+ ]
713
+ },
714
+ "computed": false
715
+ },
716
+ {
717
+ "type": "propertySignature",
718
+ "key": {
719
+ "type": "identifier",
720
+ "name": "value"
721
+ },
722
+ "annotation": {
723
+ "type": "reference",
724
+ "typeName": {
725
+ "type": "identifier",
726
+ "name": "T"
727
+ }
728
+ },
729
+ "computed": false
730
+ },
731
+ {
732
+ "type": "propertySignature",
733
+ "key": {
734
+ "type": "identifier",
735
+ "name": "user_icon"
736
+ },
737
+ "annotation": {
738
+ "type": "keyword",
739
+ "value": "string"
740
+ },
741
+ "optional": true,
742
+ "computed": false
743
+ }
744
+ ]
745
+ }
746
+ ]
242
747
  }
243
748
  }
@@ -1 +1,2 @@
1
1
  import "./user-or-user-group-select/index.js";
2
+ import "./cmdb-instance-select/index.js";
@@ -0,0 +1,98 @@
1
+ import React from "react";
2
+ import { UseBrickConf } from "@next-core/types";
3
+ export declare const getInstanceNameKey: (objectId: string | number) => "name" | "hostname";
4
+ export declare function parseTemplate(template: string, data: Record<string, any>, skipUndefined?: boolean): string;
5
+ export interface CmdbInstanceSelectProps {
6
+ /** 模型对象 ID,必填,指定要查询的模型 */
7
+ objectId: string;
8
+ /** 选择模式,支持 "default"(单选)、"multiple"(多选)、"tags"(标签模式) */
9
+ mode?: string;
10
+ /** 每页加载的实例数量,默认值通常为 20 */
11
+ pageSize?: number;
12
+ /** 实例查询条件,支持 CMDB 查询语法(如 { name: { $like: "%test%" } }) */
13
+ instanceQuery?: any;
14
+ /** 输入框占位文本,如"请选择"或"请输入搜索关键词" */
15
+ placeholder?: string;
16
+ /** 自定义字段配置,用于指定显示哪些字段以及如何显示 */
17
+ fields?: Partial<ComplexOption<string>>;
18
+ /** 是否为首次渲染,用于控制初始化行为 */
19
+ firstRender?: boolean;
20
+ /** 最少输入字符数才触发搜索,设置为 0 表示无限制 */
21
+ minimumInputLength?: number;
22
+ /** 当前选中值,单选时为字符串或数字,多选时为数组 */
23
+ value?: any;
24
+ /** 值变更回调函数,参数为新选中的值和对应的选项对象 */
25
+ onChange?: (value: string, option?: ComplexOption) => void;
26
+ /** 选项列表变更回调,当选项数据加载完成时触发 */
27
+ optionsChange?: (options: ComplexOption[]) => void;
28
+ /** 是否显示清除按钮 */
29
+ allowClear?: boolean;
30
+ /** 输入框自定义样式 */
31
+ inputBoxStyle?: React.CSSProperties;
32
+ /** 额外的搜索字段 ID 数组,用于在多个字段中搜索关键词 */
33
+ extraSearchKey?: string[];
34
+ /** 额外要查询的字段 ID 数组,用于在返回数据中包含更多字段 */
35
+ extraFields?: string[];
36
+ /** 弹出层定位类型,"default" 为相对于触发元素,"parent" 为相对于父容器 */
37
+ popoverPositionType?: "default" | "parent";
38
+ /** 是否启用多标签显示模式 */
39
+ isMultiLabel?: boolean;
40
+ /** 是否显示搜索提示文本 */
41
+ showSearchTip?: boolean;
42
+ /** 显示标签的模板字符串(如 "{{name}} ({{ip}})"),使用 {{fieldId}} 占位符 */
43
+ labelTemplate?: string;
44
+ /** 是否禁用选择器 */
45
+ disabled?: boolean;
46
+ /** 权限控制数组,可包含 "read"、"update"、"operate" 等权限值 */
47
+ permission?: Array<"read" | "update" | "operate">;
48
+ /** 是否在选项文本超长时显示 Tooltip */
49
+ showTooltip?: boolean;
50
+ /** 是否忽略字段缺失错误(当查询的字段在模型中不存在时不报错) */
51
+ ignoreMissingFieldError?: boolean;
52
+ /** 是否显示关键字段(通常是 instanceId) */
53
+ showKeyField?: boolean;
54
+ /** 下拉菜单宽度是否跟随选择框宽度 */
55
+ dropdownMatchSelectWidth?: boolean;
56
+ /** 下拉菜单自定义样式 */
57
+ dropdownStyle?: React.CSSProperties;
58
+ /** 值变化后是否自动失焦(关闭下拉菜单) */
59
+ blurAfterValueChanged?: boolean;
60
+ /** 排序配置数组,如 [{ name: 1 }] 表示按 name 字段升序排序 */
61
+ sort?: Array<Record<string, number | string>>;
62
+ /** 后缀自定义构件配置,用于在选择器后面添加自定义元素 */
63
+ suffix?: {
64
+ useBrick: UseBrickConf;
65
+ };
66
+ /** 是否使用构件可见性控制 */
67
+ useBrickVisible?: boolean;
68
+ /** 是否使用外部 CMDB API */
69
+ useExternalCmdbApi?: boolean;
70
+ /** 外部数据源 ID */
71
+ externalSourceId?: string;
72
+ /** 自定义弹出层容器 */
73
+ getPopupContainer?: (node: HTMLElement) => HTMLElement;
74
+ }
75
+ export interface ComplexOption<T = string | number> {
76
+ label: string[] | string;
77
+ value: T;
78
+ user_icon?: string;
79
+ }
80
+ export declare function formatUserQuery(instanceQuery: any): any[];
81
+ /**
82
+ * CMDB 实例下拉选择器组件
83
+ *
84
+ * 基于 Ant Design Select 的 CMDB 实例选择器,支持搜索、分页加载、
85
+ * 单选和多选模式。自动调用 CMDB API 获取实例列表。
86
+ *
87
+ * 主要特性:
88
+ * - 支持关键词搜索(搜索防抖 300ms)
89
+ * - 支持分页加载(滚动到底部自动加载下一页)
90
+ * - 支持单选和多选模式
91
+ * - 支持自定义查询条件(instanceQuery)
92
+ * - 支持自定义显示字段(labelTemplate)
93
+ * - USER 模型特殊处理(显示用户头像)
94
+ * - 支持权限控制(permission)
95
+ * - 支持外部 CMDB 数据源
96
+ * - 支持自定义后缀内容
97
+ */
98
+ export declare const CmdbInstanceSelect: React.ForwardRefExoticComponent<CmdbInstanceSelectProps & React.RefAttributes<unknown>>;
@@ -0,0 +1,13 @@
1
+ export declare enum K {
2
+ CMDB_INSTANCE_SELECT = "CMDB_INSTANCE_SELECT",
3
+ BACKGROUND_SEARCH = "BACKGROUND_SEARCH"
4
+ }
5
+ export declare const NS = "bricks/form-platform/eo-cmdb-instance-select";
6
+ export declare const locales: {
7
+ en: Locale;
8
+ zh: Locale;
9
+ };
10
+ type Locale = {
11
+ [key in K]: string;
12
+ };
13
+ export {};