@easyv/screen-cli 0.1.2 → 0.1.4

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.
@@ -139,7 +139,7 @@ info:
139
139
 
140
140
  1. `GET /meta` 看 `context` 和 `limits`
141
141
  2. `GET /groups` 取 `groupId`,`POST /screens` 创建空白大屏
142
- 3. `GET /components` 选组件,`GET /components/{module}/config-fields?keyword=...` 按意图查要改的字段
142
+ 3. `GET /components/official` 选官方组件(已发布,不含定制组件)。没有合适的再 `GET /components/space` 查当前空间已发布的自定义组件。父组件包里的子组件用 `GET /components/{module}/children` 列出,再把返回的 `module` 传给 `schema` / `config-fields` 的 `child`。`GET /components/{module}/config-fields?keyword=...` 按意图查要改的字段
143
143
  4. 需要图片时 `POST /assets`,把返回的 `path` 写进组件 `config`
144
144
  5. `GET /screens/{screenId}/document` 拿基线文档和 `revision`
145
145
  6. 改完后 `POST /screens/{screenId}/validate` 预检(不落库)
@@ -770,6 +770,12 @@ paths:
770
770
  required: false
771
771
  description: 为 `true` 时忽略缓存,重新解析组件包。默认 `false`。
772
772
  schema: {type: boolean, default: false}
773
+ - name: child
774
+ in: query
775
+ required: false
776
+ description: 只返回这个子组件。取值是 `GET /components/{module}/children` 返回的 `children[].module`。不传则只返回父组件自己的配置,不包含子组件。
777
+ schema: {type: string, maxLength: 64, pattern: '^[A-Za-z][\\w]*$'}
778
+ example: VectorScatterLayer
773
779
  responses:
774
780
  '200':
775
781
  description: 组件配置结构
@@ -796,6 +802,68 @@ paths:
796
802
  '400': {$ref: '#/components/responses/BadRequest'}
797
803
  '401': {$ref: '#/components/responses/Unauthorized'}
798
804
  '403': {$ref: '#/components/responses/Forbidden'}
805
+ '404':
806
+ description: |
807
+ `COMPONENT_NOT_FOUND`:组件不存在,或该版本不可用。
808
+ `COMPONENT_CHILD_NOT_FOUND`:父组件存在,但 `child` 不是它的子组件。
809
+ content:
810
+ application/json:
811
+ schema: {$ref: '#/components/schemas/Error'}
812
+ '422':
813
+ description: '`COMPONENT_SCHEMA_UNAVAILABLE`:组件包里提取不出配置结构。'
814
+ content:
815
+ application/json:
816
+ schema: {$ref: '#/components/schemas/Error'}
817
+
818
+ /components/{module}/children:
819
+ get:
820
+ operationId: listComponentChildren
821
+ tags: [组件]
822
+ summary: 列出组件包里的子组件
823
+ description: |
824
+ 从父组件包的 `getDefaultChildrenConfig()` 静态提取子组件清单,不执行组件代码。
825
+
826
+ - 子组件不是独立发布的 module。查某一层的配置或数据字段时,把这里的 `children[].module` 传给 `schema` / `config-fields` 的 `child`
827
+ - `children[].id` 是模板 id。给这一层灌数据时,数据的 `id` 要和它相同
828
+ - 没有子组件时 `children` 为空数组,不报错
829
+ - `version` 不传时用该组件当前发布版本
830
+ - 与 `schema` 共用 24 小时缓存;`refresh=true` 强制重新解析
831
+ x-easyv-status: beta
832
+ x-easyv-scope: component:read
833
+ parameters:
834
+ - name: module
835
+ in: path
836
+ required: true
837
+ description: 父组件模块名。
838
+ schema: {type: string}
839
+ example: basicPlaneMap
840
+ - name: version
841
+ in: query
842
+ required: false
843
+ description: 语义化版本,至少 `主.次.修订` 三段数字。不传则取当前发布版本。
844
+ schema: {type: string, pattern: '^\\d+\\.\\d+\\.\\d+'}
845
+ - name: refresh
846
+ in: query
847
+ required: false
848
+ description: 为 `true` 时忽略缓存,重新解析组件包。默认 `false`。
849
+ schema: {type: boolean, default: false}
850
+ responses:
851
+ '200':
852
+ description: 子组件清单
853
+ content:
854
+ application/json:
855
+ schema: {$ref: '#/components/schemas/ComponentChildren'}
856
+ example:
857
+ module: basicPlaneMap
858
+ version: 1.8.0
859
+ children:
860
+ - module: VectorScatterLayer
861
+ id: scatter-1
862
+ name: 矢量散点
863
+ version: 1.0.0
864
+ '400': {$ref: '#/components/responses/BadRequest'}
865
+ '401': {$ref: '#/components/responses/Unauthorized'}
866
+ '403': {$ref: '#/components/responses/Forbidden'}
799
867
  '404':
800
868
  description: '`COMPONENT_NOT_FOUND`:组件不存在,或该版本不可用。'
801
869
  content:
@@ -818,6 +886,7 @@ paths:
818
886
  - 关键词按中文标签链(`labelPath`,如 `['图例', '宽度']`)和路径匹配,空格分隔的多个词需要同时命中
819
887
  - 不传 `keyword` 时 `fields` 为空,只返回 `groups` 分组概览,用来决定下一步搜什么
820
888
  - 字段来自静态解析,`strict: false` 时清单不完整
889
+ - `child` 只查父组件包里的一个子组件。不传时只查父组件自己的字段,不会把子组件配置一起返回
821
890
  x-easyv-status: beta
822
891
  x-easyv-scope: component:read
823
892
  parameters:
@@ -836,6 +905,12 @@ paths:
836
905
  required: false
837
906
  schema: {type: string, maxLength: 100}
838
907
  example: 图例 宽度
908
+ - name: child
909
+ in: query
910
+ required: false
911
+ description: 只查这个子组件的配置。取值是 `GET /components/{module}/children` 返回的 `children[].module`。不传则只查父组件自己的字段。
912
+ schema: {type: string, maxLength: 64, pattern: '^[A-Za-z][\\w]*$'}
913
+ example: VectorScatterLayer
839
914
  - name: limit
840
915
  in: query
841
916
  required: false
@@ -850,6 +925,7 @@ paths:
850
925
  required: [module, version, strict, total, groups, fields]
851
926
  properties:
852
927
  module: {type: string}
928
+ child: {type: string, description: 请求带 `child` 时回显被选中的子组件 module_name。不带则省略。}
853
929
  version: {type: string}
854
930
  strict: {type: boolean, description: 字段是否完整提取。}
855
931
  total: {type: integer, description: 命中总数;不传关键词时是字段总数。}
@@ -882,7 +958,9 @@ paths:
882
958
  '401': {$ref: '#/components/responses/Unauthorized'}
883
959
  '403': {$ref: '#/components/responses/Forbidden'}
884
960
  '404':
885
- description: '`COMPONENT_NOT_FOUND`'
961
+ description: |
962
+ `COMPONENT_NOT_FOUND`:组件不存在,或该版本不可用。
963
+ `COMPONENT_CHILD_NOT_FOUND`:父组件存在,但 `child` 不是它的子组件。
886
964
  content:
887
965
  application/json:
888
966
  schema: {$ref: '#/components/schemas/Error'}
@@ -892,12 +970,14 @@ paths:
892
970
  application/json:
893
971
  schema: {$ref: '#/components/schemas/Error'}
894
972
 
895
- /components:
973
+ /components/official:
896
974
  get:
897
- operationId: listComponents
975
+ operationId: listOfficialComponents
898
976
  tags: [组件]
899
- summary: 组件目录
900
- description: 官方组件与当前空间的私有组件,含最新版本和发布状态。用于选择组件或检查重名。
977
+ summary: 官方组件目录
978
+ description: |
979
+ EasyV 官方提供的组件,用于选型。只返回已发布组件(`isShow = true`),不含定制组件。
980
+ 官方组件没有合适的,再查 `GET /components/space`。
901
981
  x-easyv-status: available
902
982
  x-easyv-scope: component:read
903
983
  parameters:
@@ -907,7 +987,7 @@ paths:
907
987
  description: 按名称或 module 过滤。
908
988
  responses:
909
989
  '200':
910
- description: 组件列表。
990
+ description: 已发布的官方组件。
911
991
  content:
912
992
  application/json:
913
993
  schema:
@@ -919,6 +999,38 @@ paths:
919
999
  items: {$ref: '#/components/schemas/ComponentCatalogItem'}
920
1000
  '401': {$ref: '#/components/responses/Unauthorized'}
921
1001
  '403': {$ref: '#/components/responses/Forbidden'}
1002
+
1003
+ /components/space:
1004
+ get:
1005
+ operationId: listSpaceComponents
1006
+ tags: [组件]
1007
+ summary: 空间组件目录
1008
+ description: |
1009
+ 当前空间自己开发并已发布的组件。只在官方组件没有合适的时候查询。
1010
+ 未发布的空间组件不在此列。
1011
+ x-easyv-status: available
1012
+ x-easyv-scope: component:read
1013
+ parameters:
1014
+ - name: keyword
1015
+ in: query
1016
+ schema: {type: string}
1017
+ description: 按名称或 module 过滤。
1018
+ responses:
1019
+ '200':
1020
+ description: 当前空间已发布的自定义组件。
1021
+ content:
1022
+ application/json:
1023
+ schema:
1024
+ type: object
1025
+ required: [components]
1026
+ properties:
1027
+ components:
1028
+ type: array
1029
+ items: {$ref: '#/components/schemas/ComponentCatalogItem'}
1030
+ '401': {$ref: '#/components/responses/Unauthorized'}
1031
+ '403': {$ref: '#/components/responses/Forbidden'}
1032
+
1033
+ /components:
922
1034
  post:
923
1035
  operationId: publishComponent
924
1036
  tags: [组件]
@@ -2645,11 +2757,42 @@ components:
2645
2757
  value: {type: string, description: 字段映射值。}
2646
2758
  desc: {type: string, description: 字段说明。}
2647
2759
 
2760
+ ComponentChild:
2761
+ type: object
2762
+ required: [module]
2763
+ description: 父组件包里的一个子组件。不含配置树。
2764
+ properties:
2765
+ module:
2766
+ type: string
2767
+ description: 子组件的 `base.module_name`。传给 `schema` / `config-fields` 的 `child`。
2768
+ id:
2769
+ type: string
2770
+ description: 模板 id。给这一层灌数据时,数据的 `id` 要和它相同。没有则省略。
2771
+ name:
2772
+ type: string
2773
+ description: 显示名,来自 `base.name`。没有则省略。
2774
+ version:
2775
+ type: string
2776
+ description: 子组件版本,来自 `base.version`。没有则省略。
2777
+
2778
+ ComponentChildren:
2779
+ type: object
2780
+ required: [module, version, children]
2781
+ description: 父组件包里的子组件清单。
2782
+ properties:
2783
+ module: {type: string, description: 父组件模块名。}
2784
+ version: {type: string, description: 实际解析的父组件版本。}
2785
+ children:
2786
+ type: array
2787
+ description: 按组件包中的顺序排列。没有子组件时为空数组。
2788
+ items: {$ref: '#/components/schemas/ComponentChild'}
2789
+
2648
2790
  ComponentSchema:
2649
2791
  type: object
2650
2792
  required: [module, version, source, strict, fields, dataFields, triggers, actions, requiresPreset, unsupported, cached, stats]
2651
2793
  properties:
2652
2794
  module: {type: string, description: 请求的组件模块名。}
2795
+ child: {type: string, description: 请求带 `child` 时回显被选中的子组件 module_name。不带则省略。}
2653
2796
  version: {type: string, description: 实际解析的版本。}
2654
2797
  source:
2655
2798
  type: string
@@ -2756,7 +2899,7 @@ components:
2756
2899
  category: {type: string, description: 分类。空间组件固定为「空间组件」。}
2757
2900
  thumb: {type: string, description: 缩略图路径,原样返回数据库里的值。没有时省略。}
2758
2901
  source: {type: string, enum: [platform, space], description: platform 官方组件,space 空间私有组件。}
2759
- status: {type: string, enum: [published, unpublished], description: 发布状态。官方组件恒为 published。}
2902
+ status: {type: string, enum: [published], description: 列表只返回已发布组件,因此恒为 published。}
2760
2903
 
2761
2904
  PublishedComponent:
2762
2905
  type: object