mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 17:40:59 +03:00
feat(meta-edit): свойства-списки DataLockFields + RegisteredDocuments (Фаза 2.4, v1.18)
Расширены complex-свойства (были Owners/RegisterRecords/BasedOn/InputByString): + DataLockFields (поля блокировки данных, с разворотом короткого имени реквизита в полный путь через Expand-DataPath — как у meta-compile) + RegisteredDocuments (регистрируемые документы журнала). JSON modify.properties + inline add-/remove-/set-. Флаг expand в complexPropertyMap разворачивает пути (Add/Remove/Set-ComplexProperty). ps1+py зеркально. Cert декомпиляцией: DataLockFields/RegisteredDocuments БАЙТ-В-БАЙТ = meta-compile (ps1). verify-snapshots --case (Catalog+DocumentJournal, реальные объекты через preRun) — грузятся в 1С. meta-edit 16/16 ps1+py. NB: py-lxml сериализует \r в tail как (пре-существующее для всех complex-свойств, валидно — загрузка в 1С подтверждена). EOL-конвенция py(LF)/ps1(CRLF) — отдельная тема. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b8a6a80d9a
commit
2ff7c271fb
@@ -1,4 +1,4 @@
|
||||
# meta-edit v1.17 — Edit existing 1C metadata object XML (+structural attr props Format/EditFormat/ToolTip/ChoiceForm/MinValue/MaxValue/LinkByType/ChoiceParameterLinks/ChoiceParameters/FillValue)
|
||||
# meta-edit v1.18 — Edit existing 1C metadata object XML (+свойства-списки DataLockFields/RegisteredDocuments)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -12,14 +12,17 @@ param(
|
||||
"add-attribute", "add-ts", "add-dimension", "add-resource",
|
||||
"add-enumValue", "add-column", "add-form", "add-template", "add-command",
|
||||
"add-owner", "add-registerRecord", "add-basedOn", "add-inputByString",
|
||||
"add-dataLockField", "add-registeredDocument",
|
||||
"remove-attribute", "remove-ts", "remove-dimension", "remove-resource",
|
||||
"remove-enumValue", "remove-column", "remove-form", "remove-template", "remove-command",
|
||||
"remove-owner", "remove-registerRecord", "remove-basedOn", "remove-inputByString",
|
||||
"remove-dataLockField", "remove-registeredDocument",
|
||||
"add-ts-attribute", "remove-ts-attribute", "modify-ts-attribute", "modify-ts",
|
||||
"modify-attribute", "modify-dimension", "modify-resource",
|
||||
"modify-enumValue", "modify-column",
|
||||
"modify-property",
|
||||
"set-owners", "set-registerRecords", "set-basedOn", "set-inputByString"
|
||||
"set-owners", "set-registerRecords", "set-basedOn", "set-inputByString",
|
||||
"set-dataLockFields", "set-registeredDocuments"
|
||||
)]
|
||||
[string]$Operation,
|
||||
[string]$Value,
|
||||
@@ -1490,6 +1493,8 @@ function Convert-InlineToDefinition([string]$operation, [string]$value) {
|
||||
"registerRecord" = "RegisterRecords"; "registerRecords" = "RegisterRecords"
|
||||
"basedOn" = "BasedOn"
|
||||
"inputByString" = "InputByString"
|
||||
"dataLockField" = "DataLockFields"; "dataLockFields" = "DataLockFields"
|
||||
"registeredDocument" = "RegisteredDocuments"; "registeredDocuments" = "RegisteredDocuments"
|
||||
}
|
||||
|
||||
if ($complexTargetMap.ContainsKey($target)) {
|
||||
@@ -2363,6 +2368,8 @@ $script:complexPropertyMap = @{
|
||||
"RegisterRecords" = @{ tag = "xr:Item"; attr = 'xsi:type="xr:MDObjectRef"' }
|
||||
"BasedOn" = @{ tag = "xr:Item"; attr = 'xsi:type="xr:MDObjectRef"' }
|
||||
"InputByString" = @{ tag = "xr:Field"; attr = $null }
|
||||
"DataLockFields" = @{ tag = "xr:Field"; attr = $null; expand = $true }
|
||||
"RegisteredDocuments" = @{ tag = "xr:Item"; attr = 'xsi:type="xr:MDObjectRef"' }
|
||||
}
|
||||
|
||||
# Известные свойства объекта (union по корпусу acc+erp 8.3.24) — allowlist для modify-property.
|
||||
@@ -2812,6 +2819,7 @@ function Get-ComplexPropertyValues([System.Xml.XmlElement]$propEl) {
|
||||
function Add-ComplexPropertyItem([string]$propertyName, [string[]]$values) {
|
||||
$mapEntry = $script:complexPropertyMap[$propertyName]
|
||||
if (-not $mapEntry) { Warn "Unknown complex property: $propertyName"; return }
|
||||
if ($mapEntry.expand) { $values = @($values | ForEach-Object { Expand-DataPath "$_" }) }
|
||||
|
||||
$propEl = Find-PropertyElement $propertyName
|
||||
if (-not $propEl) {
|
||||
@@ -2859,6 +2867,8 @@ function Add-ComplexPropertyItem([string]$propertyName, [string[]]$values) {
|
||||
}
|
||||
|
||||
function Remove-ComplexPropertyItem([string]$propertyName, [string[]]$values) {
|
||||
$mapEntry = $script:complexPropertyMap[$propertyName]
|
||||
if ($mapEntry -and $mapEntry.expand) { $values = @($values | ForEach-Object { Expand-DataPath "$_" }) }
|
||||
$propEl = Find-PropertyElement $propertyName
|
||||
if (-not $propEl) {
|
||||
Warn "Property element '$propertyName' not found in Properties"
|
||||
@@ -2896,6 +2906,7 @@ function Remove-ComplexPropertyItem([string]$propertyName, [string[]]$values) {
|
||||
function Set-ComplexProperty([string]$propertyName, [string[]]$values) {
|
||||
$mapEntry = $script:complexPropertyMap[$propertyName]
|
||||
if (-not $mapEntry) { Warn "Unknown complex property: $propertyName"; return }
|
||||
if ($mapEntry.expand) { $values = @($values | ForEach-Object { Expand-DataPath "$_" }) }
|
||||
|
||||
$propEl = Find-PropertyElement $propertyName
|
||||
if (-not $propEl) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# meta-edit v1.17 — Edit existing 1C metadata object XML (+structural attr props Format/EditFormat/ToolTip/ChoiceForm/MinValue/MaxValue/LinkByType/ChoiceParameterLinks/ChoiceParameters/FillValue)
|
||||
# meta-edit v1.18 — Edit existing 1C metadata object XML (+свойства-списки DataLockFields/RegisteredDocuments)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -1430,6 +1430,8 @@ def convert_inline_to_definition(operation, value):
|
||||
"registerRecord": "RegisterRecords", "registerRecords": "RegisterRecords",
|
||||
"basedOn": "BasedOn",
|
||||
"inputByString": "InputByString",
|
||||
"dataLockField": "DataLockFields", "dataLockFields": "DataLockFields",
|
||||
"registeredDocument": "RegisteredDocuments", "registeredDocuments": "RegisteredDocuments",
|
||||
}
|
||||
|
||||
if target in complex_target_map:
|
||||
@@ -2191,6 +2193,8 @@ complex_property_map = {
|
||||
"RegisterRecords": {"tag": "xr:Item", "attr": 'xsi:type="xr:MDObjectRef"'},
|
||||
"BasedOn": {"tag": "xr:Item", "attr": 'xsi:type="xr:MDObjectRef"'},
|
||||
"InputByString": {"tag": "xr:Field", "attr": None},
|
||||
"DataLockFields": {"tag": "xr:Field", "attr": None, "expand": True},
|
||||
"RegisteredDocuments": {"tag": "xr:Item", "attr": 'xsi:type="xr:MDObjectRef"'},
|
||||
}
|
||||
|
||||
# Известные свойства объекта (union по корпусу acc+erp 8.3.24) — allowlist для modify-property.
|
||||
@@ -2724,6 +2728,8 @@ def add_complex_property_item(property_name, values):
|
||||
if not map_entry:
|
||||
warn(f"Unknown complex property: {property_name}")
|
||||
return
|
||||
if map_entry.get("expand"):
|
||||
values = [expand_data_path(str(v)) for v in values]
|
||||
|
||||
prop_el = find_property_element(property_name)
|
||||
if prop_el is None:
|
||||
@@ -2763,6 +2769,9 @@ def add_complex_property_item(property_name, values):
|
||||
def remove_complex_property_item(property_name, values):
|
||||
global remove_count
|
||||
|
||||
map_entry = complex_property_map.get(property_name)
|
||||
if map_entry and map_entry.get("expand"):
|
||||
values = [expand_data_path(str(v)) for v in values]
|
||||
prop_el = find_property_element(property_name)
|
||||
if prop_el is None:
|
||||
warn(f"Property element '{property_name}' not found in Properties")
|
||||
@@ -2793,6 +2802,8 @@ def set_complex_property(property_name, values):
|
||||
if not map_entry:
|
||||
warn(f"Unknown complex property: {property_name}")
|
||||
return
|
||||
if map_entry.get("expand"):
|
||||
values = [expand_data_path(str(v)) for v in values]
|
||||
|
||||
prop_el = find_property_element(property_name)
|
||||
if prop_el is None:
|
||||
@@ -2872,14 +2883,17 @@ def main():
|
||||
"add-attribute", "add-ts", "add-dimension", "add-resource",
|
||||
"add-enumValue", "add-column", "add-form", "add-template", "add-command",
|
||||
"add-owner", "add-registerRecord", "add-basedOn", "add-inputByString",
|
||||
"add-dataLockField", "add-registeredDocument",
|
||||
"remove-attribute", "remove-ts", "remove-dimension", "remove-resource",
|
||||
"remove-enumValue", "remove-column", "remove-form", "remove-template", "remove-command",
|
||||
"remove-owner", "remove-registerRecord", "remove-basedOn", "remove-inputByString",
|
||||
"remove-dataLockField", "remove-registeredDocument",
|
||||
"add-ts-attribute", "remove-ts-attribute", "modify-ts-attribute", "modify-ts",
|
||||
"modify-attribute", "modify-dimension", "modify-resource",
|
||||
"modify-enumValue", "modify-column",
|
||||
"modify-property",
|
||||
"set-owners", "set-registerRecords", "set-basedOn", "set-inputByString",
|
||||
"set-dataLockFields", "set-registeredDocuments",
|
||||
]
|
||||
|
||||
parser = argparse.ArgumentParser(description="Edit existing 1C metadata object XML", allow_abbrev=False)
|
||||
|
||||
Reference in New Issue
Block a user