@easyv/screen-cli 0.1.4 → 0.1.5

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.
@@ -122,12 +122,15 @@ info:
122
122
  - 新增 `kind: component` 的元素(`layers` 里的位置决定落在根层级还是某个分组内)。
123
123
  服务端以组件包的默认配置、事件、动作和默认数据为底,只叠加你给的 `config`、`layout`、`staticData`,
124
124
  和编辑器拖入组件的结果一致。`config` 里出现默认配置没有的路径时整单拒绝(`COMPONENT_CONFIG_INVALID`)
125
+ - 新增 `kind: panel` 或 `kind: container`。动态面板自带「状态1」,组件容器自带一个空子屏。`states` 留空数组
126
+ - 新增 `filters`、`dataContainers`。二者挂在根屏上,不占图层
125
127
  - 删除组件:从 `elements` 和 `layers` 同时去掉,进入回收站
126
128
 
127
129
  **会整单拒绝、不落库**(`400 UNSUPPORTED_CHANGE` 或 `400 UNSUPPORTED_OPERATION`,`details.unsupported` 列出路径或操作名):
128
130
 
129
131
  - 移动已有元素的父节点,或调整同级顺序
130
- - 新增或删除面板、容器、分组
132
+ - 删除面板、容器、过滤器、数据容器,或修改面板 / 容器的内部结构
133
+ - 修改已有过滤器、数据容器,或把它们绑定到组件
131
134
  - 修改组件的 `module` / `version`
132
135
  - 只改 `layout` 不改 `config`(位置在属性树里,直接改 `config`)
133
136
  - 修改 `interactions`
@@ -1250,6 +1253,617 @@ paths:
1250
1253
  '200': {description: 数据。}
1251
1254
  '401': {$ref: '#/components/responses/Unauthorized'}
1252
1255
 
1256
+ /screens/{screenId}/panels:
1257
+ get:
1258
+ operationId: listPanels
1259
+ tags: [大屏元素]
1260
+ summary: 列出动态面板
1261
+ description: 只返回动态面板。引用面板不在这里。从零搭建请把面板写进文档一次提交,不要逐个调用本接口。
1262
+ x-easyv-status: stable
1263
+ x-easyv-scope: screen:read
1264
+ parameters:
1265
+ - {$ref: '#/components/parameters/ScreenId'}
1266
+ responses:
1267
+ '200':
1268
+ description: 动态面板列表。
1269
+ content:
1270
+ application/json:
1271
+ schema:
1272
+ type: object
1273
+ required: [revision, panels]
1274
+ properties:
1275
+ revision: {type: string}
1276
+ panels:
1277
+ type: array
1278
+ items: {$ref: '#/components/schemas/PanelResource'}
1279
+ '401': {$ref: '#/components/responses/Unauthorized'}
1280
+ '403': {$ref: '#/components/responses/Forbidden'}
1281
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1282
+ post:
1283
+ operationId: createPanel
1284
+ tags: [大屏元素]
1285
+ summary: 新建动态面板
1286
+ description: 自带一个名为「状态1」的空状态。`parentKey` 只能是已有分组。
1287
+ x-easyv-status: stable
1288
+ x-easyv-scope: screen:write
1289
+ parameters:
1290
+ - {$ref: '#/components/parameters/ScreenId'}
1291
+ requestBody:
1292
+ required: true
1293
+ content:
1294
+ application/json:
1295
+ schema: {$ref: '#/components/schemas/PanelWrite'}
1296
+ responses:
1297
+ '200':
1298
+ description: 已创建。
1299
+ content:
1300
+ application/json:
1301
+ schema:
1302
+ type: object
1303
+ required: [revision, panel]
1304
+ properties:
1305
+ revision: {type: string}
1306
+ panel: {$ref: '#/components/schemas/PanelResource'}
1307
+ '400': {$ref: '#/components/responses/BadRequest'}
1308
+ '401': {$ref: '#/components/responses/Unauthorized'}
1309
+ '403': {$ref: '#/components/responses/Forbidden'}
1310
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1311
+
1312
+ /screens/{screenId}/panels/{key}:
1313
+ get:
1314
+ operationId: getPanel
1315
+ tags: [大屏元素]
1316
+ summary: 查看动态面板
1317
+ x-easyv-status: stable
1318
+ x-easyv-scope: screen:read
1319
+ parameters:
1320
+ - {$ref: '#/components/parameters/ScreenId'}
1321
+ - {$ref: '#/components/parameters/ElementKey'}
1322
+ responses:
1323
+ '200':
1324
+ description: 动态面板,含状态。
1325
+ content:
1326
+ application/json:
1327
+ schema:
1328
+ type: object
1329
+ required: [revision, panel]
1330
+ properties:
1331
+ revision: {type: string}
1332
+ panel: {$ref: '#/components/schemas/PanelResource'}
1333
+ '401': {$ref: '#/components/responses/Unauthorized'}
1334
+ '403': {$ref: '#/components/responses/Forbidden'}
1335
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1336
+ patch:
1337
+ operationId: updatePanel
1338
+ tags: [大屏元素]
1339
+ summary: 修改动态面板的名称或位置
1340
+ x-easyv-status: stable
1341
+ x-easyv-scope: screen:write
1342
+ parameters:
1343
+ - {$ref: '#/components/parameters/ScreenId'}
1344
+ - {$ref: '#/components/parameters/ElementKey'}
1345
+ requestBody:
1346
+ required: true
1347
+ content:
1348
+ application/json:
1349
+ schema: {$ref: '#/components/schemas/PanelUpdate'}
1350
+ responses:
1351
+ '200':
1352
+ description: 已更新。
1353
+ content:
1354
+ application/json:
1355
+ schema:
1356
+ type: object
1357
+ required: [revision, panel]
1358
+ properties:
1359
+ revision: {type: string}
1360
+ panel: {$ref: '#/components/schemas/PanelResource'}
1361
+ '400': {$ref: '#/components/responses/BadRequest'}
1362
+ '401': {$ref: '#/components/responses/Unauthorized'}
1363
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1364
+ delete:
1365
+ operationId: deletePanel
1366
+ tags: [大屏元素]
1367
+ summary: 删除动态面板
1368
+ description: 进入回收站,可在编辑器恢复。
1369
+ x-easyv-status: stable
1370
+ x-easyv-scope: screen:write
1371
+ parameters:
1372
+ - {$ref: '#/components/parameters/ScreenId'}
1373
+ - {$ref: '#/components/parameters/ElementKey'}
1374
+ responses:
1375
+ '200':
1376
+ description: 已删除。
1377
+ content:
1378
+ application/json:
1379
+ schema: {$ref: '#/components/schemas/DeletedResource'}
1380
+ '401': {$ref: '#/components/responses/Unauthorized'}
1381
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1382
+
1383
+ /screens/{screenId}/panels/{key}/states:
1384
+ get:
1385
+ operationId: listPanelStates
1386
+ tags: [大屏元素]
1387
+ summary: 列出动态面板状态
1388
+ x-easyv-status: stable
1389
+ x-easyv-scope: screen:read
1390
+ parameters:
1391
+ - {$ref: '#/components/parameters/ScreenId'}
1392
+ - {$ref: '#/components/parameters/ElementKey'}
1393
+ responses:
1394
+ '200':
1395
+ description: 状态列表。
1396
+ content:
1397
+ application/json:
1398
+ schema:
1399
+ type: object
1400
+ required: [revision, states]
1401
+ properties:
1402
+ revision: {type: string}
1403
+ states:
1404
+ type: array
1405
+ items: {$ref: '#/components/schemas/PanelState'}
1406
+ '401': {$ref: '#/components/responses/Unauthorized'}
1407
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1408
+ post:
1409
+ operationId: createPanelState
1410
+ tags: [大屏元素]
1411
+ summary: 新增动态面板状态
1412
+ description: 新建一个空状态。不传 `name` 时按「状态N」命名。不能在状态里放组件。
1413
+ x-easyv-status: stable
1414
+ x-easyv-scope: screen:write
1415
+ parameters:
1416
+ - {$ref: '#/components/parameters/ScreenId'}
1417
+ - {$ref: '#/components/parameters/ElementKey'}
1418
+ requestBody:
1419
+ required: true
1420
+ content:
1421
+ application/json:
1422
+ schema:
1423
+ type: object
1424
+ properties:
1425
+ name: {type: string, maxLength: 255}
1426
+ responses:
1427
+ '200':
1428
+ description: 已创建。
1429
+ content:
1430
+ application/json:
1431
+ schema:
1432
+ type: object
1433
+ required: [revision, state]
1434
+ properties:
1435
+ revision: {type: string}
1436
+ state: {$ref: '#/components/schemas/PanelState'}
1437
+ '400': {$ref: '#/components/responses/BadRequest'}
1438
+ '401': {$ref: '#/components/responses/Unauthorized'}
1439
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1440
+
1441
+ /screens/{screenId}/panels/{key}/states/{stateKey}:
1442
+ parameters:
1443
+ - {$ref: '#/components/parameters/ScreenId'}
1444
+ - {$ref: '#/components/parameters/ElementKey'}
1445
+ - name: stateKey
1446
+ in: path
1447
+ required: true
1448
+ schema: {type: string}
1449
+ description: 状态 key,形如 `s-88001`。
1450
+ get:
1451
+ operationId: getPanelState
1452
+ tags: [大屏元素]
1453
+ summary: 查看一个动态面板状态
1454
+ x-easyv-status: stable
1455
+ x-easyv-scope: screen:read
1456
+ responses:
1457
+ '200':
1458
+ description: 状态,含内部图层和元素。
1459
+ content:
1460
+ application/json:
1461
+ schema:
1462
+ type: object
1463
+ required: [revision, state]
1464
+ properties:
1465
+ revision: {type: string}
1466
+ state: {$ref: '#/components/schemas/PanelState'}
1467
+ '401': {$ref: '#/components/responses/Unauthorized'}
1468
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1469
+ patch:
1470
+ operationId: updatePanelState
1471
+ tags: [大屏元素]
1472
+ summary: 重命名动态面板状态
1473
+ x-easyv-status: stable
1474
+ x-easyv-scope: screen:write
1475
+ requestBody:
1476
+ required: true
1477
+ content:
1478
+ application/json:
1479
+ schema:
1480
+ type: object
1481
+ required: [name]
1482
+ properties:
1483
+ name: {type: string, maxLength: 255}
1484
+ responses:
1485
+ '200':
1486
+ description: 已更新。
1487
+ content:
1488
+ application/json:
1489
+ schema:
1490
+ type: object
1491
+ required: [revision, state]
1492
+ properties:
1493
+ revision: {type: string}
1494
+ state: {$ref: '#/components/schemas/PanelState'}
1495
+ '400': {$ref: '#/components/responses/BadRequest'}
1496
+ '401': {$ref: '#/components/responses/Unauthorized'}
1497
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1498
+ delete:
1499
+ operationId: deletePanelState
1500
+ tags: [大屏元素]
1501
+ summary: 删除动态面板状态
1502
+ description: 至少保留一个状态。
1503
+ x-easyv-status: stable
1504
+ x-easyv-scope: screen:write
1505
+ responses:
1506
+ '200':
1507
+ description: 已删除。
1508
+ content:
1509
+ application/json:
1510
+ schema: {$ref: '#/components/schemas/DeletedResource'}
1511
+ '400': {$ref: '#/components/responses/BadRequest'}
1512
+ '401': {$ref: '#/components/responses/Unauthorized'}
1513
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1514
+
1515
+ /screens/{screenId}/component-containers:
1516
+ get:
1517
+ operationId: listComponentContainers
1518
+ tags: [大屏元素]
1519
+ summary: 列出组件容器
1520
+ x-easyv-status: stable
1521
+ x-easyv-scope: screen:read
1522
+ parameters:
1523
+ - {$ref: '#/components/parameters/ScreenId'}
1524
+ responses:
1525
+ '200':
1526
+ description: 组件容器列表。
1527
+ content:
1528
+ application/json:
1529
+ schema:
1530
+ type: object
1531
+ required: [revision, containers]
1532
+ properties:
1533
+ revision: {type: string}
1534
+ containers:
1535
+ type: array
1536
+ items: {$ref: '#/components/schemas/ContainerResource'}
1537
+ '401': {$ref: '#/components/responses/Unauthorized'}
1538
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1539
+ post:
1540
+ operationId: createComponentContainer
1541
+ tags: [大屏元素]
1542
+ summary: 新建组件容器
1543
+ description: 自带一个空子屏。名称最长 50。
1544
+ x-easyv-status: stable
1545
+ x-easyv-scope: screen:write
1546
+ parameters:
1547
+ - {$ref: '#/components/parameters/ScreenId'}
1548
+ requestBody:
1549
+ required: true
1550
+ content:
1551
+ application/json:
1552
+ schema: {$ref: '#/components/schemas/PanelWrite'}
1553
+ responses:
1554
+ '200':
1555
+ description: 已创建。
1556
+ content:
1557
+ application/json:
1558
+ schema:
1559
+ type: object
1560
+ required: [revision, container]
1561
+ properties:
1562
+ revision: {type: string}
1563
+ container: {$ref: '#/components/schemas/ContainerResource'}
1564
+ '400': {$ref: '#/components/responses/BadRequest'}
1565
+ '401': {$ref: '#/components/responses/Unauthorized'}
1566
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1567
+
1568
+ /screens/{screenId}/component-containers/{key}:
1569
+ parameters:
1570
+ - {$ref: '#/components/parameters/ScreenId'}
1571
+ - {$ref: '#/components/parameters/ElementKey'}
1572
+ get:
1573
+ operationId: getComponentContainer
1574
+ tags: [大屏元素]
1575
+ summary: 查看组件容器
1576
+ x-easyv-status: stable
1577
+ x-easyv-scope: screen:read
1578
+ responses:
1579
+ '200':
1580
+ description: 组件容器。
1581
+ content:
1582
+ application/json:
1583
+ schema:
1584
+ type: object
1585
+ required: [revision, container]
1586
+ properties:
1587
+ revision: {type: string}
1588
+ container: {$ref: '#/components/schemas/ContainerResource'}
1589
+ '401': {$ref: '#/components/responses/Unauthorized'}
1590
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1591
+ patch:
1592
+ operationId: updateComponentContainer
1593
+ tags: [大屏元素]
1594
+ summary: 修改组件容器的名称或位置
1595
+ x-easyv-status: stable
1596
+ x-easyv-scope: screen:write
1597
+ requestBody:
1598
+ required: true
1599
+ content:
1600
+ application/json:
1601
+ schema: {$ref: '#/components/schemas/PanelUpdate'}
1602
+ responses:
1603
+ '200':
1604
+ description: 已更新。
1605
+ content:
1606
+ application/json:
1607
+ schema:
1608
+ type: object
1609
+ required: [revision, container]
1610
+ properties:
1611
+ revision: {type: string}
1612
+ container: {$ref: '#/components/schemas/ContainerResource'}
1613
+ '400': {$ref: '#/components/responses/BadRequest'}
1614
+ '401': {$ref: '#/components/responses/Unauthorized'}
1615
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1616
+ delete:
1617
+ operationId: deleteComponentContainer
1618
+ tags: [大屏元素]
1619
+ summary: 删除组件容器
1620
+ description: 进入回收站,可在编辑器恢复。
1621
+ x-easyv-status: stable
1622
+ x-easyv-scope: screen:write
1623
+ responses:
1624
+ '200':
1625
+ description: 已删除。
1626
+ content:
1627
+ application/json:
1628
+ schema: {$ref: '#/components/schemas/DeletedResource'}
1629
+ '401': {$ref: '#/components/responses/Unauthorized'}
1630
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1631
+
1632
+ /screens/{screenId}/filters:
1633
+ get:
1634
+ operationId: listFilters
1635
+ tags: [大屏元素]
1636
+ summary: 列出过滤器
1637
+ description: 过滤器挂在根屏上,不占图层。
1638
+ x-easyv-status: stable
1639
+ x-easyv-scope: screen:read
1640
+ parameters:
1641
+ - {$ref: '#/components/parameters/ScreenId'}
1642
+ responses:
1643
+ '200':
1644
+ description: 过滤器列表。
1645
+ content:
1646
+ application/json:
1647
+ schema:
1648
+ type: object
1649
+ required: [revision, filters]
1650
+ properties:
1651
+ revision: {type: string}
1652
+ filters:
1653
+ type: array
1654
+ items: {$ref: '#/components/schemas/FilterView'}
1655
+ '401': {$ref: '#/components/responses/Unauthorized'}
1656
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1657
+ post:
1658
+ operationId: createFilter
1659
+ tags: [大屏元素]
1660
+ summary: 新建过滤器
1661
+ x-easyv-status: stable
1662
+ x-easyv-scope: screen:write
1663
+ parameters:
1664
+ - {$ref: '#/components/parameters/ScreenId'}
1665
+ requestBody:
1666
+ required: true
1667
+ content:
1668
+ application/json:
1669
+ schema: {$ref: '#/components/schemas/FilterWrite'}
1670
+ responses:
1671
+ '200':
1672
+ description: 已创建。
1673
+ content:
1674
+ application/json:
1675
+ schema:
1676
+ type: object
1677
+ required: [revision, filter]
1678
+ properties:
1679
+ revision: {type: string}
1680
+ filter: {$ref: '#/components/schemas/FilterView'}
1681
+ '400': {$ref: '#/components/responses/BadRequest'}
1682
+ '401': {$ref: '#/components/responses/Unauthorized'}
1683
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1684
+
1685
+ /screens/{screenId}/filters/{key}:
1686
+ parameters:
1687
+ - {$ref: '#/components/parameters/ScreenId'}
1688
+ - {$ref: '#/components/parameters/ElementKey'}
1689
+ get:
1690
+ operationId: getFilter
1691
+ tags: [大屏元素]
1692
+ summary: 查看过滤器
1693
+ x-easyv-status: stable
1694
+ x-easyv-scope: screen:read
1695
+ responses:
1696
+ '200':
1697
+ description: 过滤器。
1698
+ content:
1699
+ application/json:
1700
+ schema:
1701
+ type: object
1702
+ required: [revision, filter]
1703
+ properties:
1704
+ revision: {type: string}
1705
+ filter: {$ref: '#/components/schemas/FilterView'}
1706
+ '401': {$ref: '#/components/responses/Unauthorized'}
1707
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1708
+ patch:
1709
+ operationId: updateFilter
1710
+ tags: [大屏元素]
1711
+ summary: 修改过滤器
1712
+ x-easyv-status: stable
1713
+ x-easyv-scope: screen:write
1714
+ requestBody:
1715
+ required: true
1716
+ content:
1717
+ application/json:
1718
+ schema: {$ref: '#/components/schemas/FilterUpdate'}
1719
+ responses:
1720
+ '200':
1721
+ description: 已更新。
1722
+ content:
1723
+ application/json:
1724
+ schema:
1725
+ type: object
1726
+ required: [revision, filter]
1727
+ properties:
1728
+ revision: {type: string}
1729
+ filter: {$ref: '#/components/schemas/FilterView'}
1730
+ '400': {$ref: '#/components/responses/BadRequest'}
1731
+ '401': {$ref: '#/components/responses/Unauthorized'}
1732
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1733
+ delete:
1734
+ operationId: deleteFilter
1735
+ tags: [大屏元素]
1736
+ summary: 删除过滤器
1737
+ description: 同时解开组件上对它的引用。
1738
+ x-easyv-status: stable
1739
+ x-easyv-scope: screen:write
1740
+ responses:
1741
+ '200':
1742
+ description: 已删除。
1743
+ content:
1744
+ application/json:
1745
+ schema: {$ref: '#/components/schemas/DeletedResource'}
1746
+ '401': {$ref: '#/components/responses/Unauthorized'}
1747
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1748
+
1749
+ /screens/{screenId}/data-containers:
1750
+ get:
1751
+ operationId: listDataContainers
1752
+ tags: [大屏元素]
1753
+ summary: 列出数据容器
1754
+ description: 数据容器挂在根屏上,不占图层。
1755
+ x-easyv-status: stable
1756
+ x-easyv-scope: screen:read
1757
+ parameters:
1758
+ - {$ref: '#/components/parameters/ScreenId'}
1759
+ responses:
1760
+ '200':
1761
+ description: 数据容器列表。
1762
+ content:
1763
+ application/json:
1764
+ schema:
1765
+ type: object
1766
+ required: [revision, dataContainers]
1767
+ properties:
1768
+ revision: {type: string}
1769
+ dataContainers:
1770
+ type: array
1771
+ items: {$ref: '#/components/schemas/DataContainerView'}
1772
+ '401': {$ref: '#/components/responses/Unauthorized'}
1773
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1774
+ post:
1775
+ operationId: createDataContainer
1776
+ tags: [大屏元素]
1777
+ summary: 新建数据容器
1778
+ description: 新建一份静态数据容器。名称最长 50。
1779
+ x-easyv-status: stable
1780
+ x-easyv-scope: screen:write
1781
+ parameters:
1782
+ - {$ref: '#/components/parameters/ScreenId'}
1783
+ requestBody:
1784
+ required: true
1785
+ content:
1786
+ application/json:
1787
+ schema: {$ref: '#/components/schemas/DataContainerWrite'}
1788
+ responses:
1789
+ '200':
1790
+ description: 已创建。
1791
+ content:
1792
+ application/json:
1793
+ schema:
1794
+ type: object
1795
+ required: [revision, dataContainer]
1796
+ properties:
1797
+ revision: {type: string}
1798
+ dataContainer: {$ref: '#/components/schemas/DataContainerView'}
1799
+ '400': {$ref: '#/components/responses/BadRequest'}
1800
+ '401': {$ref: '#/components/responses/Unauthorized'}
1801
+ '404': {$ref: '#/components/responses/ScreenNotFound'}
1802
+
1803
+ /screens/{screenId}/data-containers/{key}:
1804
+ parameters:
1805
+ - {$ref: '#/components/parameters/ScreenId'}
1806
+ - {$ref: '#/components/parameters/ElementKey'}
1807
+ get:
1808
+ operationId: getDataContainer
1809
+ tags: [大屏元素]
1810
+ summary: 查看数据容器
1811
+ x-easyv-status: stable
1812
+ x-easyv-scope: screen:read
1813
+ responses:
1814
+ '200':
1815
+ description: 数据容器。
1816
+ content:
1817
+ application/json:
1818
+ schema:
1819
+ type: object
1820
+ required: [revision, dataContainer]
1821
+ properties:
1822
+ revision: {type: string}
1823
+ dataContainer: {$ref: '#/components/schemas/DataContainerView'}
1824
+ '401': {$ref: '#/components/responses/Unauthorized'}
1825
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1826
+ patch:
1827
+ operationId: updateDataContainer
1828
+ tags: [大屏元素]
1829
+ summary: 重命名数据容器
1830
+ x-easyv-status: stable
1831
+ x-easyv-scope: screen:write
1832
+ requestBody:
1833
+ required: true
1834
+ content:
1835
+ application/json:
1836
+ schema: {$ref: '#/components/schemas/DataContainerUpdate'}
1837
+ responses:
1838
+ '200':
1839
+ description: 已更新。
1840
+ content:
1841
+ application/json:
1842
+ schema:
1843
+ type: object
1844
+ required: [revision, dataContainer]
1845
+ properties:
1846
+ revision: {type: string}
1847
+ dataContainer: {$ref: '#/components/schemas/DataContainerView'}
1848
+ '400': {$ref: '#/components/responses/BadRequest'}
1849
+ '401': {$ref: '#/components/responses/Unauthorized'}
1850
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1851
+ delete:
1852
+ operationId: deleteDataContainer
1853
+ tags: [大屏元素]
1854
+ summary: 删除数据容器
1855
+ description: 同时解开组件和组件容器上的绑定。
1856
+ x-easyv-status: stable
1857
+ x-easyv-scope: screen:write
1858
+ responses:
1859
+ '200':
1860
+ description: 已删除。
1861
+ content:
1862
+ application/json:
1863
+ schema: {$ref: '#/components/schemas/DeletedResource'}
1864
+ '401': {$ref: '#/components/responses/Unauthorized'}
1865
+ '404': {$ref: '#/components/responses/ElementNotFound'}
1866
+
1253
1867
  /screens/{screenId}/preview-token:
1254
1868
  post:
1255
1869
  operationId: issuePreviewToken
@@ -1299,53 +1913,6 @@ paths:
1299
1913
  application/json:
1300
1914
  schema: {$ref: '#/components/schemas/Error'}
1301
1915
 
1302
- /auth/device/code:
1303
- post:
1304
- operationId: issueDeviceCode
1305
- tags: [授权]
1306
- summary: 申请设备码
1307
- description: 不需要 API Key。返回设备码、用户码和授权页路径。
1308
- security: []
1309
- x-easyv-status: available
1310
- responses:
1311
- '200':
1312
- description: 设备码。
1313
- content:
1314
- application/json:
1315
- schema: {$ref: '#/components/schemas/DeviceCode'}
1316
-
1317
- /auth/device/token:
1318
- post:
1319
- operationId: pollDeviceToken
1320
- tags: [授权]
1321
- summary: 用设备码换长期 API Key(旧版)
1322
- description: |
1323
- 保留给还没升级的命令行。按 `interval` 轮询。用户尚未确认时返回 `AUTHORIZATION_PENDING`,应继续轮询。
1324
- 授权后只返回一次 `appId.secret`。新客户端改用 `/oauth/device` 和 `/oauth/token` 的设备码授权,拿到的是 1 小时访问令牌。
1325
- 同一次同意只能取走一种凭证。
1326
- security: []
1327
- x-easyv-status: available
1328
- requestBody:
1329
- required: true
1330
- content:
1331
- application/json:
1332
- schema:
1333
- type: object
1334
- required: [deviceCode]
1335
- properties:
1336
- deviceCode: {type: string}
1337
- responses:
1338
- '200':
1339
- description: token 与其绑定的空间、团队。
1340
- content:
1341
- application/json:
1342
- schema: {$ref: '#/components/schemas/DeviceToken'}
1343
- '400':
1344
- description: '`AUTHORIZATION_PENDING`、`DEVICE_CODE_EXPIRED` 或 `DEVICE_CODE_INVALID`。'
1345
- content:
1346
- application/json:
1347
- schema: {$ref: '#/components/schemas/Error'}
1348
-
1349
1916
  /assets:
1350
1917
  post:
1351
1918
  operationId: uploadAsset
@@ -1400,9 +1967,8 @@ paths:
1400
1967
  '403': {$ref: '#/components/responses/Forbidden'}
1401
1968
  '413':
1402
1969
  description: |
1403
- 文件超过 `limits.assetMaxBytes`。
1404
- 业务校验命中时 `code` 为 `ASSET_TOO_LARGE`(`details` 含 `size`、`maxBytes`);
1405
- 在进入业务前被解析器截断时 `code` 可能是 `DOCUMENT_TOO_LARGE`。
1970
+ 文件超过 `limits.assetMaxBytes`。`code` 为 `ASSET_TOO_LARGE`。
1971
+ `details.maxBytes` 为上限;文件已完整读入时 `details` 还含 `size`。
1406
1972
  content:
1407
1973
  application/json:
1408
1974
  schema: {$ref: '#/components/schemas/Error'}
@@ -1649,6 +2215,12 @@ components:
1649
2215
  required: true
1650
2216
  description: 数据源 id。必须属于当前 Key 所在团队,否则 404。
1651
2217
  schema: {type: string}
2218
+ ElementKey:
2219
+ name: key
2220
+ in: path
2221
+ required: true
2222
+ description: 文档 key。动态面板、组件容器、过滤器、数据容器各自使用 `document` 里的 key。
2223
+ schema: {type: string, minLength: 1, maxLength: 64}
1652
2224
  IfMatch:
1653
2225
  name: If-Match
1654
2226
  in: header
@@ -1681,6 +2253,13 @@ components:
1681
2253
  content:
1682
2254
  application/json:
1683
2255
  schema: {$ref: '#/components/schemas/Error'}
2256
+ ElementNotFound:
2257
+ description: |
2258
+ `ELEMENT_NOT_FOUND`:动态面板、状态、过滤器、组件容器或数据容器不存在。
2259
+ `details` 含 `key` 和 `kind`。引用面板也会返回这个错误。
2260
+ content:
2261
+ application/json:
2262
+ schema: {$ref: '#/components/schemas/Error'}
1684
2263
  ScreenNotFound:
1685
2264
  description: '`SCREEN_NOT_FOUND`:大屏不存在,或不属于当前 Key 的团队。'
1686
2265
  content:
@@ -1775,7 +2354,7 @@ components:
1775
2354
  | `SCHEMA_VIOLATION` | 400 | 文档缺少必填结构。`details.issues` |
1776
2355
  | `UNSUPPORTED_CHANGE` | 400 | 文档 diff 含未支持的变更,未落库 |
1777
2356
  | `UNSUPPORTED_OPERATION` | 400 | operations 含未支持的操作,未落库 |
1778
- | `DOCUMENT_TOO_LARGE` | 413 | 请求体超过限制(也用作上传在解析阶段被截断时的码) |
2357
+ | `DOCUMENT_TOO_LARGE` | 413 | 文档请求体超过限制 |
1779
2358
  | `PUBLISH_ROOT_ONLY` | 400 | 只有根大屏可以发布 |
1780
2359
  | `PUBLISH_OPTION_CONFLICT` | 400 | 密码和 Token 不能同时开启 |
1781
2360
  | `PUBLISH_NOT_ALLOWED_FOR_PLAN` | 403 | 当前产品版本不能发布 |
@@ -1787,7 +2366,7 @@ components:
1787
2366
  | `COMPONENT_PRESET_REQUIRED` | 400 | 组件需要先选预设,暂不支持通过 OpenAPI 新增 |
1788
2367
  | `ASSET_FILE_REQUIRED` | 400 | 没有上传文件或文件为空 |
1789
2368
  | `ASSET_TYPE_NOT_ALLOWED` | 415 | 扩展名不在白名单 |
1790
- | `ASSET_TOO_LARGE` | 413 | 文件超过 `limits.assetMaxBytes` |
2369
+ | `ASSET_TOO_LARGE` | 413 | 文件超过 `limits.assetMaxBytes`。`details.maxBytes` 为上限;文件已完整读入时还含 `size` |
1791
2370
  | `ASSET_UPLOAD_FAILED` | 500 | 对象存储写入失败 |
1792
2371
  | `RATE_LIMITED` | 429 | 请求过于频繁 |
1793
2372
  | `NOT_IMPLEMENTED` | 501 | 接口尚未实现 |
@@ -2098,12 +2677,12 @@ components:
2098
2677
  additionalProperties: {$ref: '#/components/schemas/ScreenElement'}
2099
2678
  dataContainers:
2100
2679
  type: object
2101
- description: 数据容器。当前写入路径不处理对它的修改。
2102
- additionalProperties: {type: object}
2680
+ description: 数据容器,挂在根屏上。可以新增。修改或删除会整单拒绝。没有数据容器时省略。
2681
+ additionalProperties: {$ref: '#/components/schemas/DataContainerResource'}
2103
2682
  filters:
2104
2683
  type: object
2105
- description: 过滤器。当前写入路径不处理对它的修改。
2106
- additionalProperties: {type: object}
2684
+ description: 过滤器,挂在根屏上。可以新增。修改或删除会整单拒绝。没有过滤器时省略。
2685
+ additionalProperties: {$ref: '#/components/schemas/FilterResource'}
2107
2686
 
2108
2687
  ScreenMeta:
2109
2688
  type: object
@@ -2216,12 +2795,36 @@ components:
2216
2795
  $ref: '#/components/schemas/DataBinding'
2217
2796
  description: 数据源绑定。`dataType` 为 `static` 表示改回静态数据。
2218
2797
 
2798
+ FilterResource:
2799
+ type: object
2800
+ required: [name]
2801
+ description: 过滤器。`id` 只读。`content` 是函数体,缺省为 `return data`。
2802
+ properties:
2803
+ id: {type: integer, description: 数据库 id,只读。}
2804
+ name: {type: string, maxLength: 255}
2805
+ content: {type: string, description: 函数体,不含 function 外壳。}
2806
+ callbackKeys:
2807
+ type: array
2808
+ items: {type: string}
2809
+
2810
+ DataContainerResource:
2811
+ type: object
2812
+ required: [name]
2813
+ description: 数据容器。`id` 只读。当前只创建名称,取数方式保持编辑器默认的静态数据。
2814
+ properties:
2815
+ id: {type: integer, description: 数据库 id,只读。}
2816
+ name: {type: string, maxLength: 50}
2817
+
2219
2818
  PanelElement:
2220
2819
  type: object
2221
2820
  required: [kind, states]
2222
- description: 动态面板或引用面板。可以读到完整子内容。新增、删除、修改内部结构当前都会被拒绝。
2821
+ description: |
2822
+ 动态面板或引用面板。可以读到完整子内容。
2823
+ 可以新增动态面板(自带「状态1」)。不能新增引用面板,不能删除,不能修改已有状态。
2824
+ 新增时 `states` 传空数组。`id` 只读。
2223
2825
  properties:
2224
2826
  kind: {const: panel}
2827
+ id: {type: integer, description: 面板 id,只读。自定义事件 `$panel(panel_<id>)` 用它。}
2225
2828
  name: {type: string, description: 面板名称。}
2226
2829
  layout: {$ref: '#/components/schemas/ElementLayout'}
2227
2830
  states:
@@ -2232,10 +2835,13 @@ components:
2232
2835
  ContainerElement:
2233
2836
  type: object
2234
2837
  required: [kind, states]
2235
- description: 组件容器。读写限制与动态面板相同。
2838
+ description: |
2839
+ 组件容器。可以新增,服务端自带一个空子屏。不能删除,不能修改已有状态。
2840
+ 新增时 `states` 传空数组。`id` 只读。万能组件不能通过本文档新增。
2236
2841
  properties:
2237
2842
  kind: {const: container}
2238
- name: {type: string, description: 容器名称。}
2843
+ id: {type: integer, description: 容器 id,只读。}
2844
+ name: {type: string, description: 容器名称,最长 50。}
2239
2845
  layout: {$ref: '#/components/schemas/ElementLayout'}
2240
2846
  states:
2241
2847
  type: array
@@ -2357,6 +2963,10 @@ components:
2357
2963
  - {$ref: '#/components/schemas/UpdateMetaOperation'}
2358
2964
  - {$ref: '#/components/schemas/UpdateElementOperation'}
2359
2965
  - {$ref: '#/components/schemas/AddComponentOperation'}
2966
+ - {$ref: '#/components/schemas/AddPanelOperation'}
2967
+ - {$ref: '#/components/schemas/AddContainerOperation'}
2968
+ - {$ref: '#/components/schemas/AddFilterOperation'}
2969
+ - {$ref: '#/components/schemas/AddDataContainerOperation'}
2360
2970
  - {$ref: '#/components/schemas/RemoveComponentOperation'}
2361
2971
  - {$ref: '#/components/schemas/SetComponentConfigOperation'}
2362
2972
  - {$ref: '#/components/schemas/SetComponentLayoutOperation'}
@@ -2433,6 +3043,54 @@ components:
2433
3043
  parentKey: {type: string, description: 目标分组 key。}
2434
3044
  index: {type: integer, minimum: 0, description: 在兄弟图层中的位置,不传则放最后。}
2435
3045
 
3046
+ AddPanelOperation:
3047
+ type: object
3048
+ required: [op, key]
3049
+ description: |
3050
+ 新增动态面板,自带一个名为「状态1」的空状态。
3051
+ `key` 会保留。引用面板不能用这条操作创建。
3052
+ properties:
3053
+ op: {const: addPanel}
3054
+ key: {type: string, description: 自定义 key,如 `panel-tabs`。}
3055
+ name: {type: string, maxLength: 255}
3056
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3057
+ parentKey: {type: string, description: 父分组 key。不传则放在根层级。}
3058
+ index: {type: integer, minimum: 0}
3059
+
3060
+ AddContainerOperation:
3061
+ type: object
3062
+ required: [op, key]
3063
+ description: 新增组件容器,自带一个空子屏。`key` 会保留。万能组件不能用这条操作创建。
3064
+ properties:
3065
+ op: {const: addContainer}
3066
+ key: {type: string}
3067
+ name: {type: string, maxLength: 50}
3068
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3069
+ parentKey: {type: string}
3070
+ index: {type: integer, minimum: 0}
3071
+
3072
+ AddFilterOperation:
3073
+ type: object
3074
+ required: [op, key, name]
3075
+ description: 在根屏上新增过滤器。同屏不能重名。`content` 缺省为 `return data`。
3076
+ properties:
3077
+ op: {const: addFilter}
3078
+ key: {type: string}
3079
+ name: {type: string, maxLength: 255}
3080
+ content: {type: string, description: 函数体。}
3081
+ callbackKeys:
3082
+ type: array
3083
+ items: {type: string}
3084
+
3085
+ AddDataContainerOperation:
3086
+ type: object
3087
+ required: [op, key, name]
3088
+ description: 在根屏上新增数据容器,默认静态数据。不占图层。
3089
+ properties:
3090
+ op: {const: addDataContainer}
3091
+ key: {type: string}
3092
+ name: {type: string, maxLength: 50}
3093
+
2436
3094
  RemoveComponentOperation:
2437
3095
  type: object
2438
3096
  required: [op, key]
@@ -2949,6 +3607,117 @@ components:
2949
3607
  baseId: {type: string, description: 数据填报的 baseId。}
2950
3608
  brokers: {type: array, items: {type: string}, description: Kafka brokers。}
2951
3609
 
3610
+ PanelWrite:
3611
+ type: object
3612
+ required: [key]
3613
+ description: 新建动态面板或组件容器。
3614
+ properties:
3615
+ key: {type: string, minLength: 1, maxLength: 64}
3616
+ name: {type: string}
3617
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3618
+ parentKey: {type: string, description: 已有分组的 key。}
3619
+ index: {type: integer, minimum: 0}
3620
+
3621
+ PanelUpdate:
3622
+ type: object
3623
+ description: 至少提供 `name` 或 `layout`。
3624
+ properties:
3625
+ name: {type: string}
3626
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3627
+
3628
+ PanelState:
3629
+ type: object
3630
+ required: [key, layers, elements]
3631
+ properties:
3632
+ key: {type: string}
3633
+ name: {type: string}
3634
+ screenId: {type: integer}
3635
+ layers: {type: array, items: {type: object, additionalProperties: true}}
3636
+ elements: {type: object, additionalProperties: true}
3637
+
3638
+ PanelResource:
3639
+ type: object
3640
+ required: [key, kind, states]
3641
+ properties:
3642
+ key: {type: string}
3643
+ kind: {type: string, enum: [panel]}
3644
+ id: {type: integer}
3645
+ name: {type: string}
3646
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3647
+ states:
3648
+ type: array
3649
+ items: {$ref: '#/components/schemas/PanelState'}
3650
+
3651
+ ContainerResource:
3652
+ type: object
3653
+ required: [key, kind, states]
3654
+ properties:
3655
+ key: {type: string}
3656
+ kind: {type: string, enum: [container]}
3657
+ id: {type: integer}
3658
+ name: {type: string}
3659
+ layout: {$ref: '#/components/schemas/ElementLayout'}
3660
+ states:
3661
+ type: array
3662
+ items: {$ref: '#/components/schemas/PanelState'}
3663
+
3664
+ FilterWrite:
3665
+ type: object
3666
+ required: [key, name]
3667
+ properties:
3668
+ key: {type: string, minLength: 1, maxLength: 64}
3669
+ name: {type: string, minLength: 1, maxLength: 255}
3670
+ content: {type: string, description: 函数体。缺省为 `return data`。}
3671
+ callbackKeys: {type: array, items: {type: string}}
3672
+
3673
+ FilterUpdate:
3674
+ type: object
3675
+ properties:
3676
+ name: {type: string, minLength: 1, maxLength: 255}
3677
+ content: {type: string}
3678
+ callbackKeys: {type: array, items: {type: string}}
3679
+
3680
+ FilterView:
3681
+ type: object
3682
+ required: [key, name]
3683
+ description: 带调用方 key 的过滤器。文档里的 `FilterResource` 不含 key。
3684
+ properties:
3685
+ key: {type: string}
3686
+ id: {type: integer}
3687
+ name: {type: string}
3688
+ content: {type: string}
3689
+ callbackKeys: {type: array, items: {type: string}}
3690
+
3691
+ DataContainerWrite:
3692
+ type: object
3693
+ required: [key, name]
3694
+ properties:
3695
+ key: {type: string, minLength: 1, maxLength: 64}
3696
+ name: {type: string, minLength: 1, maxLength: 50}
3697
+
3698
+ DataContainerUpdate:
3699
+ type: object
3700
+ required: [name]
3701
+ properties:
3702
+ name: {type: string, minLength: 1, maxLength: 50}
3703
+
3704
+ DataContainerView:
3705
+ type: object
3706
+ required: [key, name]
3707
+ description: 带调用方 key 的数据容器。文档里的 `DataContainerResource` 不含 key。
3708
+ properties:
3709
+ key: {type: string}
3710
+ id: {type: integer}
3711
+ name: {type: string}
3712
+
3713
+ DeletedResource:
3714
+ type: object
3715
+ required: [deleted, key, revision]
3716
+ properties:
3717
+ deleted: {type: boolean, enum: [true]}
3718
+ key: {type: string}
3719
+ revision: {type: string}
3720
+
2952
3721
  PreviewToken:
2953
3722
  type: object
2954
3723
  required: [token, expiresAt, previewPath]
@@ -2968,26 +3737,3 @@ components:
2968
3737
  expires_in: {type: integer}
2969
3738
  interval: {type: integer}
2970
3739
  verificationPath: {type: string, description: 授权页路径。命令行在 API 与 Web 不同域时,把这个路径拼到 Web 站点上}
2971
-
2972
- DeviceCode:
2973
- type: object
2974
- required: [deviceCode, userCode, verificationPath, interval, expiresIn]
2975
- properties:
2976
- deviceCode: {type: string, description: CLI 轮询时使用。}
2977
- userCode: {type: string, description: 用户在授权页确认的短码,形如 ABCD-EFGH。}
2978
- verificationPath: {type: string, description: 授权页路径,拼到 Web 站点域名后打开。}
2979
- interval: {type: integer, description: 建议的轮询间隔,单位秒。}
2980
- expiresIn: {type: integer, description: 有效期,单位秒。}
2981
-
2982
- DeviceToken:
2983
- type: object
2984
- required: [token, context]
2985
- properties:
2986
- token: {type: string, description: API Key,格式 appId.secret。只返回这一次。}
2987
- context:
2988
- type: object
2989
- properties:
2990
- appId: {type: string}
2991
- spaceId: {type: integer}
2992
- teamId: {type: integer}
2993
- scopes: {type: array, items: {type: string}}