odant-work 1.0.90 → 1.0.92

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 (326) hide show
  1. package/#system/package-manifest.json +275 -246
  2. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  3. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +4 -0
  4. package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  5. package/$server/$folder/$class/$data/$catalog/$virtual/class.js +8 -0
  6. package/{MODULES/Register/CATALOGS/$catalog/$folder/$class → $server/$folder/$class/$data}/$catalog/class.js +1 -0
  7. package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +4 -0
  8. package/{MODULES/Register/OPERATIONS/$operation/$folder/$class → $server/$folder/$class/$data}/$operation/class.js +1 -0
  9. package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +4 -0
  10. package/$server/$folder/$class/$data/$register/$account/class.js +8 -0
  11. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +4 -0
  12. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +4 -0
  13. package/$server/$folder/$class/$data/$register/class.js +8 -0
  14. package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +4 -0
  15. package/$server/$folder/$class/$data/$struct/class.js +5 -0
  16. package/$server/$folder/$class/$data/class.js +5 -0
  17. package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
  18. package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
  19. package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +4 -0
  20. package/$server/$folder/$class/$domain/handlers/methods/restore/$handler/class.js +5 -5
  21. package/$server/$folder/$class/$domain/readme.md +1 -1
  22. package/$server/$folder/$class/$handler/$method/class.js +4 -0
  23. package/$server/$folder/$class/$handler/$timer/class.js +4 -0
  24. package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +4 -0
  25. package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +4 -0
  26. package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +4 -0
  27. package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +4 -0
  28. package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +4 -0
  29. package/$server/$folder/$class/$module/$folder/$class/$module/class.js +4 -0
  30. package/$server/$folder/$class/$module/class.js +418 -6
  31. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/mcp.js → $module/handlers/pages/form/system/mcp/$handler/class.js} +261 -220
  32. package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +7 -0
  33. package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +4 -0
  34. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$catalog/class.js +4 -0
  35. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$operation/class.js +4 -0
  36. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$register/class.js +4 -0
  37. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$struct/class.js +4 -0
  38. package/$server/$folder/$class/$structure/$organization/$folder/$class/$domain/class.js +4 -0
  39. package/$server/$folder/$class/$structure/$organization/$folder/$class/$module/class.js +4 -0
  40. package/{ORGANIZATIONS/$domain/$folder/$class/$base → $server/$folder/$class/$structure/$organization/$folder/$class/$structure/$organization}/class.js +4 -5
  41. package/$server/$folder/$class/$structure/$organization/$folder/$class/$structure/class.js +4 -0
  42. package/{ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base → $server/$folder/$class/$structure/$organization}/class.js +19 -17
  43. package/$server/$folder/$class/$structure/$organization/handlers/pages/form/system/requisites/$handler/class.js +3 -0
  44. package/$server/$folder/$class/$structure/{$base/handlers/pages/site/$handler/site.js → $organization/handlers/pages/site/$handler/class.js} +352 -365
  45. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +4 -0
  46. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +4 -0
  47. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +4 -0
  48. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +4 -0
  49. package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +4 -0
  50. package/$server/$folder/$class/$structure/$project/$folder/$class/$module/class.js +4 -0
  51. package/$server/$folder/$class/$structure/$project/class.js +1 -0
  52. package/$server/$folder/$class/$structure/$project/readme.md +1 -1
  53. package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +4 -0
  54. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/database/$handler/class.js +3 -0
  55. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/license.js → $structure/$server/handlers/pages/form/system/license/$handler/class.js} +104 -103
  56. package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
  57. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
  58. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
  59. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
  60. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +18 -0
  61. package/$server/$folder/$class/$structure/ai/system.md +1 -1
  62. package/$server/$folder/$class/$structure/class.js +1 -1
  63. package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +3 -3
  64. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +309 -8
  65. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +15 -4
  66. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
  67. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
  68. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
  69. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +1 -1
  70. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -9
  71. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/agent.js → $structure/handlers/pages/form/system/agent/$handler/class.js} +329 -320
  72. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/database.js → $structure/handlers/pages/form/system/database/$handler/class.js} +510 -577
  73. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/messengers.js → $structure/handlers/pages/form/system/messengers/$handler/class.js} +143 -144
  74. package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
  75. package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
  76. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
  77. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +1 -1
  78. package/$server/$folder/$class/$structure/readme.md +3 -3
  79. package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +4 -0
  80. package/$server/$folder/$class/$users/class.js +4 -0
  81. package/$server/$folder/$class/ai/agents/integrator-1c.md +1 -1
  82. package/$server/$folder/$class/ai/agents/it-admin.md +1 -1
  83. package/$server/$folder/$class/ai/agents/org-architect.md +4 -4
  84. package/$server/$folder/$class/ai/agents/readme.md +1 -1
  85. package/$server/$folder/$class/ai/agents/schema-validator.md +2 -2
  86. package/$server/$folder/$class/ai/skills/lan-inventory.md +2 -2
  87. package/$server/$folder/$class/ai/skills/org-structure.md +1 -1
  88. package/$server/$folder/$class/ai/skills/printer-setup.md +1 -1
  89. package/$server/$folder/$class/ai/skills/telegram-notify.md +2 -2
  90. package/$server/$folder/$class/ai/skills/work-scenarios.md +3 -3
  91. package/$server/$folder/$class/ai/system.md +14 -8
  92. package/$server/$folder/$class/class.js +2 -6
  93. package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
  94. package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
  95. package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +7 -0
  96. package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +100 -0
  97. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
  98. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +32 -5
  99. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +31 -3
  100. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +11 -3
  101. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +83 -3
  102. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +61 -3
  103. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
  104. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
  105. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +1 -1
  106. package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +33 -3
  107. package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
  108. package/$server/$folder/handlers/methods/create/$handler/class.js +5 -5
  109. package/$server/$folder/handlers/pages/form/$handler/class.js +2467 -3
  110. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
  111. package/$server/$folder/handlers/readme.md +1 -1
  112. package/$server/$folder/lib/chat-item/chat-item.js +5 -10
  113. package/$server/$folder/lib/consultant/consultant.js +7 -10
  114. package/$server/$folder/lib/explorer/explorer.js +1 -1
  115. package/$server/$folder/lib/icon/icon.js +1 -1
  116. package/$server/$folder/lib/menu/menu.js +3 -2
  117. package/$server/$folder/lib/messenger-settings/messenger-settings.js +4 -4
  118. package/$server/$folder/lib/node/node.js +3 -3
  119. package/$server/$folder/lib/prompt-bar/prompt-bar.js +2 -2
  120. package/$server/$folder/lib/role/role.js +1 -2
  121. package/$server/$folder/lib/security/admin/admin.js +3 -3
  122. package/$server/$folder/lib/security/security.js +4 -4
  123. package/$server/$folder/lib/security/users/users.js +2 -5
  124. package/$server/$folder/lib/site-loc/site-loc.js +3 -3
  125. package/$server/$folder/lib/tree/tree.js +14 -22
  126. package/$server/class.js +1 -0
  127. package/AGENTS.md +21 -13
  128. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-model.js → MODELS/$ai/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +385 -425
  129. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-provider.js → MODELS/$ai/$folder/$class/$provider/handlers/pages/form/system/ai/$handler/class.js} +157 -161
  130. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-root.js → MODELS/$ai/handlers/pages/form/system/ai/$handler/class.js} +34 -33
  131. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-local.js → MODELS/Local/$provider/handlers/pages/form/system/ai/$handler/class.js} +572 -622
  132. package/MODULES/$domain/class.js +85 -4
  133. package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +7 -0
  134. package/MODULES/$domain/readme.md +7 -6
  135. package/{SERVICES/1C/$service → MODULES/1C/$module}/class.js +7 -1
  136. package/MODULES/2GIS/$module/class.js +32 -0
  137. package/MODULES/2GIS/$module/readme.md +57 -0
  138. package/{SERVICES/Bitrix24/$service → MODULES/Bitrix24/$module}/class.js +7 -2
  139. package/{SERVICES/CBR/$service → MODULES/CBR/$module}/class.js +5 -0
  140. package/{SERVICES/DaData/$service → MODULES/DaData/$module}/class.js +9 -3
  141. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +648 -21
  142. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +140 -6
  143. package/{SERVICES/Marketplaces/$service → MODULES/Marketplaces/$domain}/class.js +1 -1
  144. package/{SERVICES/Marketplaces/Ozon/$service → MODULES/Marketplaces/Ozon/$module}/class.js +1 -1
  145. package/{SERVICES/Marketplaces/Wildberries/$service → MODULES/Marketplaces/Wildberries/$module}/class.js +1 -1
  146. package/{SERVICES/Marketplaces/YandexMarket/$service → MODULES/Marketplaces/YandexMarket/$module}/class.js +1 -1
  147. package/MODULES/Process/$module/readme.md +1 -1
  148. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +305 -6
  149. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +241 -6
  150. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +515 -16
  151. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual → $data/$catalog/$virtual}/class.js +3 -0
  152. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js +3 -0
  153. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/handlers/pages/form/virtual/$handler/virtual.js → $data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js} +413 -390
  154. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js +14 -0
  155. package/MODULES/Register/CATALOGS/$catalog/class.js +7 -14
  156. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +9 -0
  157. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js +0 -7
  158. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/$folder/$class/$data/$catalog/class.js +11 -0
  159. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +0 -9
  160. package/MODULES/Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js +16 -0
  161. package/MODULES/Register/OPERATIONS/$operation/class.js +0 -9
  162. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js +8 -0
  163. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +4 -10
  164. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/$folder/$class/$data/$operation/class.js +8 -0
  165. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +0 -6
  166. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/$folder/$class/$data/$operation/class.js +8 -0
  167. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js +4 -10
  168. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  169. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +4 -12
  170. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  171. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +4 -12
  172. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/$folder/$class/$data/$operation/class.js +24 -0
  173. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +0 -22
  174. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/analysis/$handler/analysis.js → $data/$register/$account/handlers/pages/form/analysis/$handler/class.js} +9 -4
  175. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/postings/$handler/postings.js → $data/$register/$account/handlers/pages/form/postings/$handler/class.js} +845 -753
  176. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/turnovers/$handler/turnovers.js → $data/$register/$account/handlers/pages/form/turnovers/$handler/class.js} +9 -4
  177. package/MODULES/Register/REGISTER/$register/{$folder/$class/$register/handlers/pages/form/journal/$handler/journal.js → handlers/pages/form/journal/$handler/class.js} +382 -329
  178. package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +807 -0
  179. package/MODULES/Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js +21 -0
  180. package/MODULES/Register/REGISTER/10/$account/class.js +0 -19
  181. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js +14 -0
  182. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +4 -16
  183. package/{SERVICES/SearXNG/$service → MODULES/SearXNG/$module}/class.js +5 -0
  184. package/{SERVICES/Yandex/$service → MODULES/Yandex/$module}/class.js +7 -0
  185. package/{SERVICES/YandexDisk/$service → MODULES/YandexDisk/$module}/class.js +8 -2
  186. package/NODES/$node/handlers/pages/form/network/$handler/class.js +122 -5
  187. package/ORGANIZATIONS/$domain/$folder/$class/$structure/$organization/class.js +5 -0
  188. package/ORGANIZATIONS/$domain/class.js +5 -5
  189. package/oda/components/inputs/link/link.js +1 -1
  190. package/package.json +1 -1
  191. package/readme.md +6 -7
  192. package/scripts/check-architecture.mjs +541 -0
  193. package/scripts/cleanup-storage.mjs +1 -1
  194. package/scripts/demo-seed.mjs +3 -3
  195. package/scripts/import-bis.mjs +33 -15
  196. package/scripts/import-delovaya.mjs +26 -14
  197. package/sources/client/class.js +19 -10
  198. package/sources/client/folder.js +10 -22
  199. package/sources/client/handler.js +75 -33
  200. package/sources/data/api.js +9 -10
  201. package/sources/data/classes.js +85 -9
  202. package/sources/data/db.js +10 -6
  203. package/sources/data/print.js +15 -41
  204. package/sources/data/readme.md +5 -5
  205. package/sources/data/schema.js +206 -118
  206. package/sources/data/sql-inspector.js +7 -7
  207. package/sources/host/auth-methods.js +2 -5
  208. package/sources/host/auto-updater.js +1 -2
  209. package/sources/host/babel-merge.js +174 -129
  210. package/sources/host/prewarm.js +1 -1
  211. package/sources/host/watch.js +1 -1
  212. package/sources/index.html +1 -1
  213. package/sources/modules/agent/extensions.js +48 -38
  214. package/sources/modules/agent/index.js +1 -1
  215. package/sources/modules/agent/node-rules.js +69 -41
  216. package/sources/modules/agent/permissions.js +1 -1
  217. package/sources/modules/agent/plugins.js +11 -11
  218. package/sources/modules/agent/resources.js +96 -52
  219. package/sources/modules/agent/tools/net.js +1 -1
  220. package/sources/modules/agent/tools/services.js +7 -7
  221. package/sources/modules/agent/tools/work/access.js +10 -8
  222. package/sources/modules/agent/tools/work/classes.js +26 -47
  223. package/sources/modules/agent/tools/work/common.js +8 -10
  224. package/sources/modules/agent/tools/work/data.js +4 -4
  225. package/sources/modules/agent/triggers.js +1 -1
  226. package/sources/modules/agent/twin-bus.js +4 -4
  227. package/sources/modules/agent/voice.js +1 -1
  228. package/sources/modules/call/call.js +4 -4
  229. package/sources/modules/kladr/index.js +3 -3
  230. package/sources/modules/lan/register.js +7 -7
  231. package/sources/modules/mcp-marketplaces/ozon.js +1 -1
  232. package/sources/modules/mcp-marketplaces/wildberries.js +1 -1
  233. package/sources/modules/mcp-marketplaces/yandex-market.js +1 -1
  234. package/sources/modules/nodes/mount.js +2 -4
  235. package/sources/modules/notify/index.js +18 -18
  236. package/sources/modules/rag/extract.js +9 -2
  237. package/sources/modules/rag/indexer.js +1 -1
  238. package/sources/modules/rag/scope.js +7 -33
  239. package/sources/modules/trainer/dataset.js +2 -2
  240. package/sources/modules/trainer/local-engine.js +1 -1
  241. package/sources/page.html +2 -2
  242. package/sources/readme.md +1 -1
  243. package/sources/server/access/gateway.js +19 -19
  244. package/sources/server/access/invites.js +4 -5
  245. package/sources/server/access/links.js +10 -8
  246. package/sources/server/access/policy.js +65 -39
  247. package/sources/server/access/workplaces.js +20 -14
  248. package/sources/server/chat-threads.js +4 -4
  249. package/sources/server/class/archive.js +15 -15
  250. package/sources/server/class/base-template.js +13 -9
  251. package/sources/server/class/distro.js +3 -4
  252. package/sources/server/class/feed.js +3 -3
  253. package/sources/server/class/mail-calendar.js +9 -8
  254. package/sources/server/class/scaffold.js +110 -60
  255. package/sources/server/class/search.js +2 -2
  256. package/sources/server/class/security.js +76 -94
  257. package/sources/server/class.js +181 -64
  258. package/sources/server/file.js +2 -2
  259. package/sources/server/folder.js +376 -191
  260. package/sources/server/handler.js +52 -13
  261. package/sources/server/logs.js +7 -7
  262. package/sources/server/node.js +12 -43
  263. package/sources/server/server.js +16 -17
  264. package/$server/$folder/$class/$device/class.js +0 -3
  265. package/$server/$folder/$class/$handler/$task/class.js +0 -3
  266. package/$server/$folder/$class/$service/$class/$service/class.js +0 -4
  267. package/$server/$folder/$class/$structure/$base/class.js +0 -10
  268. package/$server/$folder/$class/$structure/$base/roots_1/roots.test +0 -0
  269. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
  270. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
  271. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
  272. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2217
  273. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
  274. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
  275. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
  276. package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -33
  277. package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
  278. package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -33
  279. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
  280. package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -384
  281. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/modules.js +0 -244
  282. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/staff.js +0 -2126
  283. package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
  284. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
  285. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
  286. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
  287. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
  288. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
  289. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
  290. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -785
  291. package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
  292. package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
  293. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +0 -623
  294. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +0 -134
  295. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +0 -293
  296. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +0 -234
  297. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +0 -406
  298. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/handlers/pages/form/virtual/$handler/class.js +0 -6
  299. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/analysis/$handler/class.js +0 -9
  300. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/postings/$handler/class.js +0 -9
  301. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/turnovers/$handler/class.js +0 -9
  302. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/journal/$handler/class.js +0 -6
  303. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/class.js +0 -6
  304. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
  305. package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
  306. package/SERVICES/$service/$folder/$storage/$service/class.js +0 -8
  307. package/SERVICES/$service/class.js +0 -442
  308. package/SERVICES/readme.md +0 -36
  309. /package/$server/$folder/$class/$structure/{$base → $organization}/icon.png +0 -0
  310. /package/{SERVICES/DuckDuckGo/$service → MODULES/DuckDuckGo/$module}/class.js +0 -0
  311. /package/MODULES/KLADR/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  312. /package/MODULES/Process/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  313. /package/MODULES/Register/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  314. /package/MODULES/Register/$module/$folder/$class/{$operation → $data/$operation}/class.js +0 -0
  315. /package/MODULES/Register/$module/$folder/$class/{$register → $data/$register}/class.js +0 -0
  316. /package/MODULES/Register/$module/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  317. /package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/$folder/$class → $data/$catalog/$virtual/$folder/$class/$data/$catalog}/$virtual/class.js +0 -0
  318. /package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/{print → $folder/$class/$data/$operation/print}//320/237/320/273/320/260/321/202/321/221/320/266/320/275/320/276/320/265 /320/277/320/276/321/200/321/203/321/207/320/265/320/275/320/270/320/265.html" +0 -0
  319. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/class.js +0 -0
  320. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/readme.md +0 -0
  321. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$register → $data/$register}/class.js +0 -0
  322. /package/MODULES/Register/STRUCTS/$struct/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  323. /package/{SERVICES/RuCalendar/$service → MODULES/RuCalendar/$module}/class.js +0 -0
  324. /package/{SERVICES/Telegram/$service → MODULES/Telegram/$module}/class.js +0 -0
  325. /package/{SERVICES/Weather/$service → MODULES/Weather/$module}/class.js +0 -0
  326. /package/PROJECTS/$domain/$folder/$class/{$project → $structure/$project}/class.js +0 -0
@@ -1,4 +1,12 @@
1
1
  export default {
2
+ label: 'База данных',
3
+ icon: 'carbon:data-base',
4
+ order: 80,
5
+ group: 'infra',
6
+ allowUse($context) {
7
+ return Boolean($context?.DATA?.db ?? $context?.db);
8
+ },
9
+ component: {
2
10
  imports: 'oda//button, oda//icon, oda//tabs',
3
11
  template: /* html */`
4
12
  <style>
@@ -901,697 +909,622 @@ export default {
901
909
  </div>
902
910
  </div>
903
911
  `,
904
-
905
912
  $public: {
906
- $item: {
907
- $def: null,
908
- set(n) {
909
- if (n)
910
- this.initForItem();
911
- },
912
- },
913
- databases: { $def: [] },
914
- activeDbId: '',
915
- schemaInfo: null,
916
- tables: { $def: [] },
917
- relations: { $def: [] },
918
- tableFilter: '',
919
- showShadowTables: false,
920
- activeTableName: '',
921
- viewMode: 'rows', // 'rows' | 'er' | 'ddl'
922
- get dbModeTabItems() {
923
- return [
924
- { id: 'rows', label: 'Таблицы и записи', icon: 'carbon:table-split' },
925
- { id: 'er', label: 'Схема и связи (ER)', icon: 'carbon:network-3' },
926
- { id: 'ddl', label: 'Структура и DDL', icon: 'carbon:code' },
927
- ];
928
- },
929
- get dbModeTabIndex() {
930
- const idx = this.dbModeTabItems.findIndex(t => t.id === this.viewMode);
931
- return idx >= 0 ? idx : 0;
932
- },
933
- onDbModeTabSelect(e) {
934
- const id = e?.detail?.item?.id;
935
- if (id)
936
- this.setViewMode(id);
937
- },
938
- erSelectedTable: '',
939
-
940
- rows: { $def: [] },
941
- totalRows: 0,
942
- pageSize: 50,
943
- pageOffset: 0,
944
- sortCol: '',
945
- sortDir: 'ASC',
946
- rowSearch: '',
947
- columnFilters: { $def: {} },
948
- keyColumns: { $def: [] },
949
-
950
- selectedRow: null,
951
- creatingNew: false,
952
- editorValues: { $def: {} },
953
- editorNulls: { $def: {} },
954
- editorDirty: false,
955
-
956
- loading: false,
957
- saving: false,
958
- statusMessage: '',
959
- statusError: false,
913
+ $item: {
914
+ $def: null,
915
+ set(n) {
916
+ if (n) this.initForItem();
917
+ }
918
+ },
919
+ databases: {
920
+ $def: []
921
+ },
922
+ activeDbId: '',
923
+ schemaInfo: null,
924
+ tables: {
925
+ $def: []
926
+ },
927
+ relations: {
928
+ $def: []
929
+ },
930
+ tableFilter: '',
931
+ showShadowTables: false,
932
+ activeTableName: '',
933
+ viewMode: 'rows',
934
+ // 'rows' | 'er' | 'ddl'
935
+ get dbModeTabItems() {
936
+ return [{
937
+ id: 'rows',
938
+ label: 'Таблицы и записи',
939
+ icon: 'carbon:table-split'
940
+ }, {
941
+ id: 'er',
942
+ label: 'Схема и связи (ER)',
943
+ icon: 'carbon:network-3'
944
+ }, {
945
+ id: 'ddl',
946
+ label: 'Структура и DDL',
947
+ icon: 'carbon:code'
948
+ }];
949
+ },
950
+ get dbModeTabIndex() {
951
+ const idx = this.dbModeTabItems.findIndex(t => t.id === this.viewMode);
952
+ return idx >= 0 ? idx : 0;
953
+ },
954
+ onDbModeTabSelect(e) {
955
+ const id = e?.detail?.item?.id;
956
+ if (id) this.setViewMode(id);
957
+ },
958
+ erSelectedTable: '',
959
+ rows: {
960
+ $def: []
961
+ },
962
+ totalRows: 0,
963
+ pageSize: 50,
964
+ pageOffset: 0,
965
+ sortCol: '',
966
+ sortDir: 'ASC',
967
+ rowSearch: '',
968
+ columnFilters: {
969
+ $def: {}
970
+ },
971
+ keyColumns: {
972
+ $def: []
973
+ },
974
+ selectedRow: null,
975
+ creatingNew: false,
976
+ editorValues: {
977
+ $def: {}
978
+ },
979
+ editorNulls: {
980
+ $def: {}
981
+ },
982
+ editorDirty: false,
983
+ loading: false,
984
+ saving: false,
985
+ statusMessage: '',
986
+ statusError: false
960
987
  },
961
-
962
988
  attached() {
963
- if (this.$item)
964
- this.initForItem();
989
+ if (this.$item) this.initForItem();
965
990
  },
966
-
967
991
  get currentDbInfo() {
968
- return (this.databases || []).find(d => d.id === this.activeDbId) || this.databases?.[0] || null;
992
+ return (this.databases || []).find(d => d.id === this.activeDbId) || this.databases?.[0] || null;
969
993
  },
970
-
971
994
  get visibleTables() {
972
- const q = String(this.tableFilter || '').trim().toLowerCase();
973
- return (this.tables || []).filter(t => {
974
- if (!this.showShadowTables && t.isShadow)
975
- return false;
976
- if (!q)
977
- return true;
978
- return t.name.toLowerCase().includes(q) || String(t.description || '').toLowerCase().includes(q);
979
- });
995
+ const q = String(this.tableFilter || '').trim().toLowerCase();
996
+ return (this.tables || []).filter(t => {
997
+ if (!this.showShadowTables && t.isShadow) return false;
998
+ if (!q) return true;
999
+ return t.name.toLowerCase().includes(q) || String(t.description || '').toLowerCase().includes(q);
1000
+ });
980
1001
  },
981
-
982
1002
  get currentTable() {
983
- return (this.tables || []).find(t => t.name === this.activeTableName) || null;
1003
+ return (this.tables || []).find(t => t.name === this.activeTableName) || null;
984
1004
  },
985
-
986
1005
  get headerColumns() {
987
- const tbl = this.currentTable;
988
- if (!tbl || !Array.isArray(tbl.columns))
989
- return [];
990
- return tbl.columns.map(col => ({
991
- ...col,
992
- fkTarget: this.fkTargetFor(tbl.name, col.name),
993
- }));
1006
+ const tbl = this.currentTable;
1007
+ if (!tbl || !Array.isArray(tbl.columns)) return [];
1008
+ return tbl.columns.map(col => ({
1009
+ ...col,
1010
+ fkTarget: this.fkTargetFor(tbl.name, col.name)
1011
+ }));
994
1012
  },
995
-
996
1013
  get displayRows() {
997
- const tbl = this.currentTable;
998
- const cols = this.headerColumns;
999
- const rawRows = Array.isArray(this.rows) ? this.rows : [];
1000
- return rawRows.map(row => ({
1001
- raw: row,
1002
- rowid: row.__rowid__,
1003
- selected: this.isRowSelected(row),
1004
- cells: cols.map(col => {
1005
- const val = row[col.name];
1006
- const isNull = val === null || val === undefined;
1007
- return {
1008
- colName: col.name,
1009
- value: val,
1010
- isNull,
1011
- display: this.formatCellValue(val),
1012
- tooltip: this.formatCellTooltip(val, col.name),
1013
- fkTarget: col.fkTarget,
1014
- timeHint: isNull ? '' : this.formatTimeHint(val, col.name),
1015
- };
1016
- }),
1017
- }));
1014
+ const tbl = this.currentTable;
1015
+ const cols = this.headerColumns;
1016
+ const rawRows = Array.isArray(this.rows) ? this.rows : [];
1017
+ return rawRows.map(row => ({
1018
+ raw: row,
1019
+ rowid: row.__rowid__,
1020
+ selected: this.isRowSelected(row),
1021
+ cells: cols.map(col => {
1022
+ const val = row[col.name];
1023
+ const isNull = val === null || val === undefined;
1024
+ return {
1025
+ colName: col.name,
1026
+ value: val,
1027
+ isNull,
1028
+ display: this.formatCellValue(val),
1029
+ tooltip: this.formatCellTooltip(val, col.name),
1030
+ fkTarget: col.fkTarget,
1031
+ timeHint: isNull ? '' : this.formatTimeHint(val, col.name)
1032
+ };
1033
+ })
1034
+ }));
1018
1035
  },
1019
-
1020
1036
  get erTables() {
1021
- return (this.visibleTables || []).map(tbl => ({
1022
- ...tbl,
1023
- isRelated: this.isTableRelatedToSelected(tbl.name),
1024
- colItems: (tbl.columns || []).map(col => ({
1025
- ...col,
1026
- fkTarget: this.fkTargetFor(tbl.name, col.name),
1027
- })),
1028
- }));
1037
+ return (this.visibleTables || []).map(tbl => ({
1038
+ ...tbl,
1039
+ isRelated: this.isTableRelatedToSelected(tbl.name),
1040
+ colItems: (tbl.columns || []).map(col => ({
1041
+ ...col,
1042
+ fkTarget: this.fkTargetFor(tbl.name, col.name)
1043
+ }))
1044
+ }));
1029
1045
  },
1030
-
1031
1046
  get showRowidColumn() {
1032
- const t = this.currentTable;
1033
- return Boolean(t && t.pkColumns?.length === 0 && t.hasRowid);
1047
+ const t = this.currentTable;
1048
+ return Boolean(t && t.pkColumns?.length === 0 && t.hasRowid);
1034
1049
  },
1035
-
1036
1050
  get activeFilterChips() {
1037
- const filters = this.columnFilters || {};
1038
- return Object.entries(filters)
1039
- .filter(([, v]) => v !== undefined && v !== null && String(v).trim() !== '')
1040
- .map(([col, val]) => ({ col, val: String(val) }));
1051
+ const filters = this.columnFilters || {};
1052
+ return Object.entries(filters).filter(([, v]) => v !== undefined && v !== null && String(v).trim() !== '').map(([col, val]) => ({
1053
+ col,
1054
+ val: String(val)
1055
+ }));
1041
1056
  },
1042
-
1043
1057
  get rowsRangeLabel() {
1044
- if (!this.totalRows || !this.rows?.length)
1045
- return '0';
1046
- const start = this.pageOffset + 1;
1047
- const end = Math.min(this.pageOffset + this.rows.length, this.totalRows);
1048
- return `${start}–${end}`;
1058
+ if (!this.totalRows || !this.rows?.length) return '0';
1059
+ const start = this.pageOffset + 1;
1060
+ const end = Math.min(this.pageOffset + this.rows.length, this.totalRows);
1061
+ return `${start}–${end}`;
1049
1062
  },
1050
-
1051
1063
  get currentPageNumber() {
1052
- if (!this.totalRows)
1053
- return 1;
1054
- return Math.floor(this.pageOffset / (this.pageSize || 50)) + 1;
1064
+ if (!this.totalRows) return 1;
1065
+ return Math.floor(this.pageOffset / (this.pageSize || 50)) + 1;
1055
1066
  },
1056
-
1057
1067
  get totalPages() {
1058
- if (!this.totalRows)
1059
- return 1;
1060
- return Math.max(1, Math.ceil(this.totalRows / (this.pageSize || 50)));
1068
+ if (!this.totalRows) return 1;
1069
+ return Math.max(1, Math.ceil(this.totalRows / (this.pageSize || 50)));
1061
1070
  },
1062
-
1063
1071
  get selectedRowLabel() {
1064
- if (!this.selectedRow)
1065
- return '';
1066
- const keys = this.keyColumns?.length ? this.keyColumns : ['id'];
1067
- return keys.map(k => `${k}=${this.selectedRow[k]}`).join(', ');
1072
+ if (!this.selectedRow) return '';
1073
+ const keys = this.keyColumns?.length ? this.keyColumns : ['id'];
1074
+ return keys.map(k => `${k}=${this.selectedRow[k]}`).join(', ');
1068
1075
  },
1069
-
1070
1076
  get editorFields() {
1071
- const tbl = this.currentTable;
1072
- if (!tbl)
1073
- return [];
1074
- const vals = this.editorValues || {};
1075
- const nulls = this.editorNulls || {};
1076
- return (tbl.columns || []).map(col => {
1077
- const raw = vals[col.name] ?? '';
1078
- const isNull = Boolean(nulls[col.name]);
1079
- const isJson = ['body', 'own', 'analytics'].includes(col.name)
1080
- || (typeof raw === 'string' && /^\s*[\[{]/.test(raw));
1081
- const multiline = isJson || col.name === 'text' || col.name === 'sql' || String(raw).length > 100;
1082
- return {
1083
- ...col,
1084
- value: isNull ? '' : String(raw),
1085
- isNull,
1086
- isJson,
1087
- multiline,
1088
- };
1089
- });
1077
+ const tbl = this.currentTable;
1078
+ if (!tbl) return [];
1079
+ const vals = this.editorValues || {};
1080
+ const nulls = this.editorNulls || {};
1081
+ return (tbl.columns || []).map(col => {
1082
+ const raw = vals[col.name] ?? '';
1083
+ const isNull = Boolean(nulls[col.name]);
1084
+ const isJson = ['body', 'own', 'analytics'].includes(col.name) || typeof raw === 'string' && /^\s*[\[{]/.test(raw);
1085
+ const multiline = isJson || col.name === 'text' || col.name === 'sql' || String(raw).length > 100;
1086
+ return {
1087
+ ...col,
1088
+ value: isNull ? '' : String(raw),
1089
+ isNull,
1090
+ isJson,
1091
+ multiline
1092
+ };
1093
+ });
1090
1094
  },
1091
-
1092
1095
  get selectedOutgoingLinks() {
1093
- const tbl = this.currentTable;
1094
- const row = this.selectedRow;
1095
- if (!tbl || !row)
1096
- return [];
1097
- return (this.relations || [])
1098
- .filter(r => r.fromTable === tbl.name && row[r.fromColumn] !== null && row[r.fromColumn] !== undefined && row[r.fromColumn] !== '')
1099
- .map(r => ({
1100
- fromColumn: r.fromColumn,
1101
- table: r.toTable,
1102
- column: r.toColumn,
1103
- value: row[r.fromColumn],
1104
- label: r.label,
1105
- }));
1096
+ const tbl = this.currentTable;
1097
+ const row = this.selectedRow;
1098
+ if (!tbl || !row) return [];
1099
+ return (this.relations || []).filter(r => r.fromTable === tbl.name && row[r.fromColumn] !== null && row[r.fromColumn] !== undefined && row[r.fromColumn] !== '').map(r => ({
1100
+ fromColumn: r.fromColumn,
1101
+ table: r.toTable,
1102
+ column: r.toColumn,
1103
+ value: row[r.fromColumn],
1104
+ label: r.label
1105
+ }));
1106
1106
  },
1107
-
1108
1107
  get selectedIncomingLinks() {
1109
- const tbl = this.currentTable;
1110
- const row = this.selectedRow;
1111
- if (!tbl || !row)
1112
- return [];
1113
- return (this.relations || [])
1114
- .filter(r => r.toTable === tbl.name && row[r.toColumn] !== null && row[r.toColumn] !== undefined && row[r.toColumn] !== '')
1115
- .map(r => ({
1116
- table: r.fromTable,
1117
- column: r.fromColumn,
1118
- value: row[r.toColumn],
1119
- label: r.label,
1120
- }));
1108
+ const tbl = this.currentTable;
1109
+ const row = this.selectedRow;
1110
+ if (!tbl || !row) return [];
1111
+ return (this.relations || []).filter(r => r.toTable === tbl.name && row[r.toColumn] !== null && row[r.toColumn] !== undefined && row[r.toColumn] !== '').map(r => ({
1112
+ table: r.fromTable,
1113
+ column: r.fromColumn,
1114
+ value: row[r.toColumn],
1115
+ label: r.label
1116
+ }));
1121
1117
  },
1122
-
1123
1118
  get filteredRelations() {
1124
- const sel = this.erSelectedTable;
1125
- if (!sel)
1126
- return this.relations || [];
1127
- return (this.relations || []).filter(r => r.fromTable === sel || r.toTable === sel);
1119
+ const sel = this.erSelectedTable;
1120
+ if (!sel) return this.relations || [];
1121
+ return (this.relations || []).filter(r => r.fromTable === sel || r.toTable === sel);
1128
1122
  },
1129
-
1130
1123
  setStatus(msg, isError = false) {
1131
- this.statusMessage = msg || '';
1132
- this.statusError = Boolean(isError);
1133
- if (msg && !isError) {
1134
- clearTimeout(this._statusTimer);
1135
- this._statusTimer = setTimeout(() => {
1136
- if (!this.statusError)
1137
- this.statusMessage = '';
1138
- }, 3500);
1139
- }
1124
+ this.statusMessage = msg || '';
1125
+ this.statusError = Boolean(isError);
1126
+ if (msg && !isError) {
1127
+ clearTimeout(this._statusTimer);
1128
+ this._statusTimer = setTimeout(() => {
1129
+ if (!this.statusError) this.statusMessage = '';
1130
+ }, 3500);
1131
+ }
1140
1132
  },
1141
-
1142
1133
  async initForItem() {
1143
- if (!this.$item || this._initializing)
1144
- return;
1145
- this._initializing = true;
1146
- this.loading = true;
1147
- this.statusMessage = '';
1148
- try {
1149
- const res = await this.$item.fetch('sql_databases');
1150
- const list = Array.isArray(res?.databases) ? res.databases : [];
1151
- this.databases = list;
1152
- if (!this.activeDbId || !list.some(d => d.id === this.activeDbId)) {
1153
- this.activeDbId = list[0]?.id || 'data';
1154
- }
1155
- await this.loadSchema(this.activeDbId);
1156
- }
1157
- catch (err) {
1158
- this.setStatus(err?.message || String(err), true);
1159
- }
1160
- finally {
1161
- this.loading = false;
1162
- this._initializing = false;
1134
+ if (!this.$item || this._initializing) return;
1135
+ this._initializing = true;
1136
+ this.loading = true;
1137
+ this.statusMessage = '';
1138
+ try {
1139
+ const res = await this.$item.fetch('sql_databases');
1140
+ const list = Array.isArray(res?.databases) ? res.databases : [];
1141
+ this.databases = list;
1142
+ if (!this.activeDbId || !list.some(d => d.id === this.activeDbId)) {
1143
+ this.activeDbId = list[0]?.id || 'data';
1163
1144
  }
1145
+ await this.loadSchema(this.activeDbId);
1146
+ } catch (err) {
1147
+ this.setStatus(err?.message || String(err), true);
1148
+ } finally {
1149
+ this.loading = false;
1150
+ this._initializing = false;
1151
+ }
1164
1152
  },
1165
-
1166
1153
  async reloadAll() {
1167
- await this.initForItem();
1154
+ await this.initForItem();
1168
1155
  },
1169
-
1170
1156
  async onSelectDatabase(e) {
1171
- const nextId = e?.target?.value;
1172
- if (!nextId || nextId === this.activeDbId)
1173
- return;
1174
- this.activeDbId = nextId;
1175
- this.activeTableName = '';
1176
- this.selectedRow = null;
1177
- this.creatingNew = false;
1178
- await this.loadSchema(nextId);
1157
+ const nextId = e?.target?.value;
1158
+ if (!nextId || nextId === this.activeDbId) return;
1159
+ this.activeDbId = nextId;
1160
+ this.activeTableName = '';
1161
+ this.selectedRow = null;
1162
+ this.creatingNew = false;
1163
+ await this.loadSchema(nextId);
1179
1164
  },
1180
-
1181
1165
  async loadSchema(dbId = this.activeDbId) {
1182
- if (!this.$item)
1183
- return;
1184
- this.loading = true;
1185
- try {
1186
- const info = await this.$item.fetch('sql_schema', { dbId });
1187
- this.schemaInfo = info;
1188
- this.tables = Array.isArray(info?.tables) ? info.tables : [];
1189
- this.relations = Array.isArray(info?.relations) ? info.relations : [];
1190
-
1191
- const vis = this.visibleTables;
1192
- if (!this.activeTableName || !this.tables.some(t => t.name === this.activeTableName)) {
1193
- const preferred = vis.find(t => t.name === 'objects') || vis[0] || this.tables[0];
1194
- this.activeTableName = preferred?.name || '';
1195
- }
1196
- if (this.activeTableName) {
1197
- await this.loadRows();
1198
- }
1199
- else {
1200
- this.rows = [];
1201
- this.totalRows = 0;
1202
- }
1203
- }
1204
- catch (err) {
1205
- this.setStatus(err?.message || String(err), true);
1166
+ if (!this.$item) return;
1167
+ this.loading = true;
1168
+ try {
1169
+ const info = await this.$item.fetch('sql_schema', {
1170
+ dbId
1171
+ });
1172
+ this.schemaInfo = info;
1173
+ this.tables = Array.isArray(info?.tables) ? info.tables : [];
1174
+ this.relations = Array.isArray(info?.relations) ? info.relations : [];
1175
+ const vis = this.visibleTables;
1176
+ if (!this.activeTableName || !this.tables.some(t => t.name === this.activeTableName)) {
1177
+ const preferred = vis.find(t => t.name === 'objects') || vis[0] || this.tables[0];
1178
+ this.activeTableName = preferred?.name || '';
1206
1179
  }
1207
- finally {
1208
- this.loading = false;
1180
+ if (this.activeTableName) {
1181
+ await this.loadRows();
1182
+ } else {
1183
+ this.rows = [];
1184
+ this.totalRows = 0;
1209
1185
  }
1186
+ } catch (err) {
1187
+ this.setStatus(err?.message || String(err), true);
1188
+ } finally {
1189
+ this.loading = false;
1190
+ }
1210
1191
  },
1211
-
1212
1192
  async selectTable(tableName, initialFilters = null) {
1213
- if (!tableName)
1214
- return;
1215
- this.activeTableName = tableName;
1216
- this.pageOffset = 0;
1217
- this.sortCol = '';
1218
- this.sortDir = 'ASC';
1219
- this.rowSearch = '';
1220
- this.columnFilters = initialFilters && typeof initialFilters === 'object' ? { ...initialFilters } : {};
1221
- this.selectedRow = null;
1222
- this.creatingNew = false;
1223
- await this.loadRows();
1193
+ if (!tableName) return;
1194
+ this.activeTableName = tableName;
1195
+ this.pageOffset = 0;
1196
+ this.sortCol = '';
1197
+ this.sortDir = 'ASC';
1198
+ this.rowSearch = '';
1199
+ this.columnFilters = initialFilters && typeof initialFilters === 'object' ? {
1200
+ ...initialFilters
1201
+ } : {};
1202
+ this.selectedRow = null;
1203
+ this.creatingNew = false;
1204
+ await this.loadRows();
1224
1205
  },
1225
-
1226
1206
  async loadRows() {
1227
- if (!this.$item || !this.activeTableName)
1228
- return;
1229
- this.loading = true;
1230
- try {
1231
- const res = await this.$item.fetch('sql_rows', {
1232
- dbId: this.activeDbId,
1233
- table: this.activeTableName,
1234
- offset: this.pageOffset,
1235
- limit: this.pageSize,
1236
- sortCol: this.sortCol,
1237
- sortDir: this.sortDir,
1238
- search: this.rowSearch,
1239
- filters: JSON.stringify(this.columnFilters || {}),
1240
- });
1241
- this.rows = Array.isArray(res?.rows) ? res.rows : [];
1242
- this.totalRows = Number(res?.total) || 0;
1243
- this.keyColumns = Array.isArray(res?.keyColumns) ? res.keyColumns : [];
1244
- if (!this.rowSearch && !this.activeFilterChips.length) {
1245
- const tbl = (this.tables || []).find(t => t.name === this.activeTableName);
1246
- if (tbl)
1247
- tbl.rowCount = this.totalRows;
1248
- }
1249
- }
1250
- catch (err) {
1251
- this.setStatus(err?.message || String(err), true);
1252
- }
1253
- finally {
1254
- this.loading = false;
1207
+ if (!this.$item || !this.activeTableName) return;
1208
+ this.loading = true;
1209
+ try {
1210
+ const res = await this.$item.fetch('sql_rows', {
1211
+ dbId: this.activeDbId,
1212
+ table: this.activeTableName,
1213
+ offset: this.pageOffset,
1214
+ limit: this.pageSize,
1215
+ sortCol: this.sortCol,
1216
+ sortDir: this.sortDir,
1217
+ search: this.rowSearch,
1218
+ filters: JSON.stringify(this.columnFilters || {})
1219
+ });
1220
+ this.rows = Array.isArray(res?.rows) ? res.rows : [];
1221
+ this.totalRows = Number(res?.total) || 0;
1222
+ this.keyColumns = Array.isArray(res?.keyColumns) ? res.keyColumns : [];
1223
+ if (!this.rowSearch && !this.activeFilterChips.length) {
1224
+ const tbl = (this.tables || []).find(t => t.name === this.activeTableName);
1225
+ if (tbl) tbl.rowCount = this.totalRows;
1255
1226
  }
1227
+ } catch (err) {
1228
+ this.setStatus(err?.message || String(err), true);
1229
+ } finally {
1230
+ this.loading = false;
1231
+ }
1256
1232
  },
1257
-
1258
1233
  setViewMode(mode) {
1259
- this.viewMode = mode;
1234
+ this.viewMode = mode;
1260
1235
  },
1261
-
1262
1236
  toggleSort(colName) {
1263
- if (this.sortCol === colName) {
1264
- this.sortDir = this.sortDir === 'ASC' ? 'DESC' : 'ASC';
1265
- }
1266
- else {
1267
- this.sortCol = colName;
1268
- this.sortDir = 'ASC';
1269
- }
1270
- this.pageOffset = 0;
1271
- this.loadRows();
1237
+ if (this.sortCol === colName) {
1238
+ this.sortDir = this.sortDir === 'ASC' ? 'DESC' : 'ASC';
1239
+ } else {
1240
+ this.sortCol = colName;
1241
+ this.sortDir = 'ASC';
1242
+ }
1243
+ this.pageOffset = 0;
1244
+ this.loadRows();
1272
1245
  },
1273
-
1274
1246
  onRowSearchInput(e) {
1275
- this.rowSearch = e?.target?.value ?? '';
1276
- this.pageOffset = 0;
1277
- clearTimeout(this._searchDebounce);
1278
- this._searchDebounce = setTimeout(() => this.loadRows(), 220);
1247
+ this.rowSearch = e?.target?.value ?? '';
1248
+ this.pageOffset = 0;
1249
+ clearTimeout(this._searchDebounce);
1250
+ this._searchDebounce = setTimeout(() => this.loadRows(), 220);
1279
1251
  },
1280
-
1281
1252
  onColumnFilterInput(colName, e) {
1282
- const val = e?.target?.value ?? '';
1283
- this.columnFilters = { ...(this.columnFilters || {}), [colName]: val };
1284
- this.pageOffset = 0;
1285
- clearTimeout(this._colFilterDebounce);
1286
- this._colFilterDebounce = setTimeout(() => this.loadRows(), 220);
1253
+ const val = e?.target?.value ?? '';
1254
+ this.columnFilters = {
1255
+ ...(this.columnFilters || {}),
1256
+ [colName]: val
1257
+ };
1258
+ this.pageOffset = 0;
1259
+ clearTimeout(this._colFilterDebounce);
1260
+ this._colFilterDebounce = setTimeout(() => this.loadRows(), 220);
1287
1261
  },
1288
-
1289
1262
  clearColumnFilter(colName) {
1290
- const next = { ...(this.columnFilters || {}) };
1291
- delete next[colName];
1292
- this.columnFilters = next;
1293
- this.pageOffset = 0;
1294
- this.loadRows();
1263
+ const next = {
1264
+ ...(this.columnFilters || {})
1265
+ };
1266
+ delete next[colName];
1267
+ this.columnFilters = next;
1268
+ this.pageOffset = 0;
1269
+ this.loadRows();
1295
1270
  },
1296
-
1297
1271
  resetAllRowFilters() {
1298
- this.rowSearch = '';
1299
- this.columnFilters = {};
1300
- this.pageOffset = 0;
1301
- this.loadRows();
1272
+ this.rowSearch = '';
1273
+ this.columnFilters = {};
1274
+ this.pageOffset = 0;
1275
+ this.loadRows();
1302
1276
  },
1303
-
1304
1277
  onLimitChange(e) {
1305
- this.pageSize = Number(e?.target?.value) || 50;
1306
- this.pageOffset = 0;
1307
- this.loadRows();
1278
+ this.pageSize = Number(e?.target?.value) || 50;
1279
+ this.pageOffset = 0;
1280
+ this.loadRows();
1308
1281
  },
1309
-
1310
1282
  goToPage(nextOffset) {
1311
- const maxOffset = Math.max(0, (this.totalPages - 1) * this.pageSize);
1312
- this.pageOffset = Math.min(Math.max(0, nextOffset), maxOffset);
1313
- this.loadRows();
1283
+ const maxOffset = Math.max(0, (this.totalPages - 1) * this.pageSize);
1284
+ this.pageOffset = Math.min(Math.max(0, nextOffset), maxOffset);
1285
+ this.loadRows();
1314
1286
  },
1315
-
1316
1287
  fkTargetFor(tableName, colName) {
1317
- return (this.relations || []).find(r => r.fromTable === tableName && r.fromColumn === colName) || null;
1288
+ return (this.relations || []).find(r => r.fromTable === tableName && r.fromColumn === colName) || null;
1318
1289
  },
1319
-
1320
1290
  async jumpToRelated(targetTable, targetCol, value) {
1321
- this.viewMode = 'rows';
1322
- await this.selectTable(targetTable, { [targetCol]: `exact:${value}` });
1323
- if (this.rows?.length === 1) {
1324
- this.selectRow(this.rows[0]);
1325
- }
1291
+ this.viewMode = 'rows';
1292
+ await this.selectTable(targetTable, {
1293
+ [targetCol]: `exact:${value}`
1294
+ });
1295
+ if (this.rows?.length === 1) {
1296
+ this.selectRow(this.rows[0]);
1297
+ }
1326
1298
  },
1327
-
1328
1299
  extractRowPk(row) {
1329
- if (!row)
1330
- return null;
1331
- const tbl = this.currentTable;
1332
- const pk = {};
1333
- if (tbl?.pkColumns?.length) {
1334
- for (const c of tbl.pkColumns)
1335
- pk[c] = row[c];
1336
- }
1337
- else if (row.__rowid__ !== undefined) {
1338
- pk.__rowid__ = row.__rowid__;
1339
- }
1340
- else if (tbl?.columns?.length) {
1341
- for (const c of tbl.columns)
1342
- pk[c.name] = row[c.name];
1343
- }
1344
- return pk;
1300
+ if (!row) return null;
1301
+ const tbl = this.currentTable;
1302
+ const pk = {};
1303
+ if (tbl?.pkColumns?.length) {
1304
+ for (const c of tbl.pkColumns) pk[c] = row[c];
1305
+ } else if (row.__rowid__ !== undefined) {
1306
+ pk.__rowid__ = row.__rowid__;
1307
+ } else if (tbl?.columns?.length) {
1308
+ for (const c of tbl.columns) pk[c.name] = row[c.name];
1309
+ }
1310
+ return pk;
1345
1311
  },
1346
-
1347
1312
  isRowSelected(row) {
1348
- if (!this.selectedRow || !row)
1349
- return false;
1350
- const keys = this.keyColumns?.length ? this.keyColumns : ['__rowid__'];
1351
- return keys.every(k => this.selectedRow[k] === row[k]);
1313
+ if (!this.selectedRow || !row) return false;
1314
+ const keys = this.keyColumns?.length ? this.keyColumns : ['__rowid__'];
1315
+ return keys.every(k => this.selectedRow[k] === row[k]);
1352
1316
  },
1353
-
1354
1317
  selectRow(row) {
1355
- if (!row)
1356
- return;
1357
- this.creatingNew = false;
1358
- this.selectedRow = row;
1359
- const vals = {};
1360
- const nulls = {};
1361
- for (const col of this.currentTable?.columns || []) {
1362
- const v = row[col.name];
1363
- if (v === null || v === undefined) {
1364
- vals[col.name] = '';
1365
- nulls[col.name] = true;
1366
- }
1367
- else {
1368
- vals[col.name] = String(v);
1369
- nulls[col.name] = false;
1370
- }
1318
+ if (!row) return;
1319
+ this.creatingNew = false;
1320
+ this.selectedRow = row;
1321
+ const vals = {};
1322
+ const nulls = {};
1323
+ for (const col of this.currentTable?.columns || []) {
1324
+ const v = row[col.name];
1325
+ if (v === null || v === undefined) {
1326
+ vals[col.name] = '';
1327
+ nulls[col.name] = true;
1328
+ } else {
1329
+ vals[col.name] = String(v);
1330
+ nulls[col.name] = false;
1371
1331
  }
1372
- this.editorValues = vals;
1373
- this.editorNulls = nulls;
1374
- this.editorDirty = false;
1332
+ }
1333
+ this.editorValues = vals;
1334
+ this.editorNulls = nulls;
1335
+ this.editorDirty = false;
1375
1336
  },
1376
-
1377
1337
  startCreateRow() {
1378
- const tbl = this.currentTable;
1379
- if (!tbl)
1380
- return;
1381
- this.selectedRow = null;
1382
- this.creatingNew = true;
1383
- const vals = {};
1384
- const nulls = {};
1385
- for (const col of tbl.columns || []) {
1386
- if (['body', 'own', 'analytics'].includes(col.name)) {
1387
- vals[col.name] = '{}';
1388
- nulls[col.name] = false;
1389
- }
1390
- else {
1391
- vals[col.name] = '';
1392
- nulls[col.name] = !col.notnull && col.dfltValue === null && col.pk === 0;
1393
- }
1338
+ const tbl = this.currentTable;
1339
+ if (!tbl) return;
1340
+ this.selectedRow = null;
1341
+ this.creatingNew = true;
1342
+ const vals = {};
1343
+ const nulls = {};
1344
+ for (const col of tbl.columns || []) {
1345
+ if (['body', 'own', 'analytics'].includes(col.name)) {
1346
+ vals[col.name] = '{}';
1347
+ nulls[col.name] = false;
1348
+ } else {
1349
+ vals[col.name] = '';
1350
+ nulls[col.name] = !col.notnull && col.dfltValue === null && col.pk === 0;
1394
1351
  }
1395
- this.editorValues = vals;
1396
- this.editorNulls = nulls;
1397
- this.editorDirty = true;
1352
+ }
1353
+ this.editorValues = vals;
1354
+ this.editorNulls = nulls;
1355
+ this.editorDirty = true;
1398
1356
  },
1399
-
1400
1357
  closeInspector() {
1401
- this.selectedRow = null;
1402
- this.creatingNew = false;
1403
- this.editorDirty = false;
1358
+ this.selectedRow = null;
1359
+ this.creatingNew = false;
1360
+ this.editorDirty = false;
1404
1361
  },
1405
-
1406
1362
  onEditorFieldInput(colName, val) {
1407
- this.editorValues = { ...(this.editorValues || {}), [colName]: val };
1408
- this.editorNulls = { ...(this.editorNulls || {}), [colName]: false };
1409
- this.editorDirty = true;
1363
+ this.editorValues = {
1364
+ ...(this.editorValues || {}),
1365
+ [colName]: val
1366
+ };
1367
+ this.editorNulls = {
1368
+ ...(this.editorNulls || {}),
1369
+ [colName]: false
1370
+ };
1371
+ this.editorDirty = true;
1410
1372
  },
1411
-
1412
1373
  setFieldNull(colName) {
1413
- this.editorValues = { ...(this.editorValues || {}), [colName]: '' };
1414
- this.editorNulls = { ...(this.editorNulls || {}), [colName]: true };
1415
- this.editorDirty = true;
1374
+ this.editorValues = {
1375
+ ...(this.editorValues || {}),
1376
+ [colName]: ''
1377
+ };
1378
+ this.editorNulls = {
1379
+ ...(this.editorNulls || {}),
1380
+ [colName]: true
1381
+ };
1382
+ this.editorDirty = true;
1416
1383
  },
1417
-
1418
1384
  prettifyJsonField(colName) {
1419
- const raw = this.editorValues?.[colName];
1420
- if (!raw)
1421
- return;
1422
- try {
1423
- const parsed = JSON.parse(raw);
1424
- this.editorValues = { ...(this.editorValues || {}), [colName]: JSON.stringify(parsed, null, 2) };
1425
- this.editorDirty = true;
1426
- }
1427
- catch (err) {
1428
- this.setStatus(`Ошибка JSON в поле «${colName}»: ${err.message}`, true);
1429
- }
1385
+ const raw = this.editorValues?.[colName];
1386
+ if (!raw) return;
1387
+ try {
1388
+ const parsed = JSON.parse(raw);
1389
+ this.editorValues = {
1390
+ ...(this.editorValues || {}),
1391
+ [colName]: JSON.stringify(parsed, null, 2)
1392
+ };
1393
+ this.editorDirty = true;
1394
+ } catch (err) {
1395
+ this.setStatus(`Ошибка JSON в поле «${colName}»: ${err.message}`, true);
1396
+ }
1430
1397
  },
1431
-
1432
1398
  async saveSelectedRow() {
1433
- const tbl = this.currentTable;
1434
- if (!this.$item || !tbl)
1435
- return;
1436
- this.saving = true;
1437
- try {
1438
- const values = {};
1439
- for (const col of tbl.columns || []) {
1440
- if (this.editorNulls?.[col.name]) {
1441
- values[col.name] = null;
1442
- }
1443
- else {
1444
- values[col.name] = this.editorValues?.[col.name] ?? '';
1445
- }
1446
- }
1447
-
1448
- if (this.creatingNew) {
1449
- await this.$item.fetch('sql_insert_row', {
1450
- dbId: this.activeDbId,
1451
- table: tbl.name,
1452
- }, {
1453
- dbId: this.activeDbId,
1454
- table: tbl.name,
1455
- values,
1456
- });
1457
- this.setStatus(`Запись добавлена в таблицу «${tbl.name}»`);
1458
- this.creatingNew = false;
1459
- }
1460
- else if (this.selectedRow) {
1461
- const pk = this.extractRowPk(this.selectedRow);
1462
- await this.$item.fetch('sql_update_row', {
1463
- dbId: this.activeDbId,
1464
- table: tbl.name,
1465
- }, {
1466
- dbId: this.activeDbId,
1467
- table: tbl.name,
1468
- pk,
1469
- values,
1470
- });
1471
- this.setStatus(`Запись в таблице «${tbl.name}» сохранена`);
1472
- this.editorDirty = false;
1473
- }
1474
- await this.loadRows();
1475
- if (this.selectedRow) {
1476
- const updated = (this.rows || []).find(r => this.isRowSelected(r));
1477
- if (updated)
1478
- this.selectRow(updated);
1479
- }
1399
+ const tbl = this.currentTable;
1400
+ if (!this.$item || !tbl) return;
1401
+ this.saving = true;
1402
+ try {
1403
+ const values = {};
1404
+ for (const col of tbl.columns || []) {
1405
+ if (this.editorNulls?.[col.name]) {
1406
+ values[col.name] = null;
1407
+ } else {
1408
+ values[col.name] = this.editorValues?.[col.name] ?? '';
1409
+ }
1480
1410
  }
1481
- catch (err) {
1482
- this.setStatus(err?.message || String(err), true);
1411
+ if (this.creatingNew) {
1412
+ await this.$item.fetch('sql_insert_row', {
1413
+ dbId: this.activeDbId,
1414
+ table: tbl.name
1415
+ }, {
1416
+ dbId: this.activeDbId,
1417
+ table: tbl.name,
1418
+ values
1419
+ });
1420
+ this.setStatus(`Запись добавлена в таблицу «${tbl.name}»`);
1421
+ this.creatingNew = false;
1422
+ } else if (this.selectedRow) {
1423
+ const pk = this.extractRowPk(this.selectedRow);
1424
+ await this.$item.fetch('sql_update_row', {
1425
+ dbId: this.activeDbId,
1426
+ table: tbl.name
1427
+ }, {
1428
+ dbId: this.activeDbId,
1429
+ table: tbl.name,
1430
+ pk,
1431
+ values
1432
+ });
1433
+ this.setStatus(`Запись в таблице «${tbl.name}» сохранена`);
1434
+ this.editorDirty = false;
1483
1435
  }
1484
- finally {
1485
- this.saving = false;
1436
+ await this.loadRows();
1437
+ if (this.selectedRow) {
1438
+ const updated = (this.rows || []).find(r => this.isRowSelected(r));
1439
+ if (updated) this.selectRow(updated);
1486
1440
  }
1441
+ } catch (err) {
1442
+ this.setStatus(err?.message || String(err), true);
1443
+ } finally {
1444
+ this.saving = false;
1445
+ }
1487
1446
  },
1488
-
1489
1447
  async deleteSelectedRow() {
1490
- const tbl = this.currentTable;
1491
- if (!this.$item || !tbl || !this.selectedRow)
1492
- return;
1493
- const label = this.selectedRowLabel;
1494
- let confirmed = true;
1495
- if (typeof globalThis.WORK?.showConfirm === 'function') {
1496
- try {
1497
- const res = await globalThis.WORK.showConfirm(`Удалить запись (${label}) из таблицы «${tbl.name}»?`);
1498
- confirmed = Boolean(res && res !== 'cancel' && res !== 'no');
1499
- }
1500
- catch {
1501
- confirmed = false;
1502
- }
1503
- }
1504
- else if (typeof window !== 'undefined' && typeof window.confirm === 'function') {
1505
- confirmed = window.confirm(`Удалить запись (${label}) из таблицы «${tbl.name}»?`);
1506
- }
1507
- if (!confirmed)
1508
- return;
1509
-
1510
- this.saving = true;
1448
+ const tbl = this.currentTable;
1449
+ if (!this.$item || !tbl || !this.selectedRow) return;
1450
+ const label = this.selectedRowLabel;
1451
+ let confirmed = true;
1452
+ if (typeof globalThis.WORK?.showConfirm === 'function') {
1511
1453
  try {
1512
- const pk = this.extractRowPk(this.selectedRow);
1513
- await this.$item.fetch('sql_delete_row', {
1514
- dbId: this.activeDbId,
1515
- table: tbl.name,
1516
- }, {
1517
- dbId: this.activeDbId,
1518
- table: tbl.name,
1519
- pks: [pk],
1520
- });
1521
- this.setStatus(`Запись (${label}) удалена из «${tbl.name}»`);
1522
- this.selectedRow = null;
1523
- await this.loadRows();
1524
- }
1525
- catch (err) {
1526
- this.setStatus(err?.message || String(err), true);
1527
- }
1528
- finally {
1529
- this.saving = false;
1454
+ const res = await globalThis.WORK.showConfirm(`Удалить запись (${label}) из таблицы «${tbl.name}»?`);
1455
+ confirmed = Boolean(res && res !== 'cancel' && res !== 'no');
1456
+ } catch {
1457
+ confirmed = false;
1530
1458
  }
1459
+ } else if (typeof window !== 'undefined' && typeof window.confirm === 'function') {
1460
+ confirmed = window.confirm(`Удалить запись (${label}) из таблицы «${tbl.name}»?`);
1461
+ }
1462
+ if (!confirmed) return;
1463
+ this.saving = true;
1464
+ try {
1465
+ const pk = this.extractRowPk(this.selectedRow);
1466
+ await this.$item.fetch('sql_delete_row', {
1467
+ dbId: this.activeDbId,
1468
+ table: tbl.name
1469
+ }, {
1470
+ dbId: this.activeDbId,
1471
+ table: tbl.name,
1472
+ pks: [pk]
1473
+ });
1474
+ this.setStatus(`Запись (${label}) удалена из «${tbl.name}»`);
1475
+ this.selectedRow = null;
1476
+ await this.loadRows();
1477
+ } catch (err) {
1478
+ this.setStatus(err?.message || String(err), true);
1479
+ } finally {
1480
+ this.saving = false;
1481
+ }
1531
1482
  },
1532
-
1533
1483
  onErCardTap(tableName) {
1534
- this.activeTableName = tableName;
1535
- this.erSelectedTable = this.erSelectedTable === tableName ? '' : tableName;
1484
+ this.activeTableName = tableName;
1485
+ this.erSelectedTable = this.erSelectedTable === tableName ? '' : tableName;
1536
1486
  },
1537
-
1538
1487
  async openTableRowsFromEr(tableName) {
1539
- this.viewMode = 'rows';
1540
- await this.selectTable(tableName);
1488
+ this.viewMode = 'rows';
1489
+ await this.selectTable(tableName);
1541
1490
  },
1542
-
1543
1491
  isTableRelatedToSelected(tableName) {
1544
- const sel = this.erSelectedTable || this.activeTableName;
1545
- if (!sel || sel === tableName)
1546
- return false;
1547
- return (this.relations || []).some(r =>
1548
- (r.fromTable === sel && r.toTable === tableName)
1549
- || (r.toTable === sel && r.fromTable === tableName)
1550
- );
1492
+ const sel = this.erSelectedTable || this.activeTableName;
1493
+ if (!sel || sel === tableName) return false;
1494
+ return (this.relations || []).some(r => r.fromTable === sel && r.toTable === tableName || r.toTable === sel && r.fromTable === tableName);
1551
1495
  },
1552
-
1553
1496
  formatNumber(n) {
1554
- const num = Number(n) || 0;
1555
- return num.toLocaleString('ru-RU');
1497
+ const num = Number(n) || 0;
1498
+ return num.toLocaleString('ru-RU');
1556
1499
  },
1557
-
1558
1500
  formatBytes(bytes) {
1559
- const b = Number(bytes) || 0;
1560
- if (b < 1024)
1561
- return `${b} Б`;
1562
- if (b < 1024 * 1024)
1563
- return `${(b / 1024).toFixed(1)} КБ`;
1564
- return `${(b / (1024 * 1024)).toFixed(2)} МБ`;
1501
+ const b = Number(bytes) || 0;
1502
+ if (b < 1024) return `${b} Б`;
1503
+ if (b < 1024 * 1024) return `${(b / 1024).toFixed(1)} КБ`;
1504
+ return `${(b / (1024 * 1024)).toFixed(2)} МБ`;
1565
1505
  },
1566
-
1567
1506
  formatCellValue(val) {
1568
- if (val === null || val === undefined)
1569
- return 'NULL';
1570
- const str = String(val);
1571
- return str.length > 120 ? str.slice(0, 117) + '…' : str;
1507
+ if (val === null || val === undefined) return 'NULL';
1508
+ const str = String(val);
1509
+ return str.length > 120 ? str.slice(0, 117) + '…' : str;
1572
1510
  },
1573
-
1574
1511
  formatCellTooltip(val, colName) {
1575
- if (val === null || val === undefined)
1576
- return `${colName}: NULL`;
1577
- return String(val);
1512
+ if (val === null || val === undefined) return `${colName}: NULL`;
1513
+ return String(val);
1578
1514
  },
1579
-
1580
1515
  formatTimeHint(val, colName) {
1581
- if (!['time', 'created', 'updated', 'valid_from', 'last_run', 'next_run'].includes(colName))
1582
- return '';
1583
- const n = Number(val);
1584
- if (!Number.isFinite(n) || n < 946684800000 || n > 4102444800000)
1585
- return '';
1586
- try {
1587
- const d = new Date(n);
1588
- const yyyy = d.getFullYear();
1589
- const mm = String(d.getMonth() + 1).padStart(2, '0');
1590
- const dd = String(d.getDate()).padStart(2, '0');
1591
- return `${yyyy}-${mm}-${dd}`;
1592
- }
1593
- catch {
1594
- return '';
1595
- }
1596
- },
1516
+ if (!['time', 'created', 'updated', 'valid_from', 'last_run', 'next_run'].includes(colName)) return '';
1517
+ const n = Number(val);
1518
+ if (!Number.isFinite(n) || n < 946684800000 || n > 4102444800000) return '';
1519
+ try {
1520
+ const d = new Date(n);
1521
+ const yyyy = d.getFullYear();
1522
+ const mm = String(d.getMonth() + 1).padStart(2, '0');
1523
+ const dd = String(d.getDate()).padStart(2, '0');
1524
+ return `${yyyy}-${mm}-${dd}`;
1525
+ } catch {
1526
+ return '';
1527
+ }
1528
+ }
1529
+ }
1597
1530
  };