diff --git a/.claude/skills/meta-edit/scripts/meta-edit.ps1 b/.claude/skills/meta-edit/scripts/meta-edit.ps1 index 5ede0194..cad03079 100644 --- a/.claude/skills/meta-edit/scripts/meta-edit.ps1 +++ b/.claude/skills/meta-edit/scripts/meta-edit.ps1 @@ -1,4 +1,4 @@ -# meta-edit v1.13 — Edit existing 1C metadata object XML (inline + complex props + TS ops + modify-ts + create-if-missing + structural attr props Format/EditFormat/ToolTip/ChoiceForm) +# meta-edit v1.14 — Edit existing 1C metadata object XML (+structural attr props Format/EditFormat/ToolTip/ChoiceForm/MinValue/MaxValue) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -2260,6 +2260,16 @@ function Modify-ChildElements($modifyDef, [string]$childType) { Info "Set $xmlTag '$elemName'.ChoiceForm"; $script:modifyCount++ } } + "MinValue" { + if (Set-AttrPropertyElement $propsEl "MinValue" (Build-MinMaxValueXml "MinValue" $changeValue)) { + Info "Set $xmlTag '$elemName'.MinValue"; $script:modifyCount++ + } + } + "MaxValue" { + if (Set-AttrPropertyElement $propsEl "MaxValue" (Build-MinMaxValueXml "MaxValue" $changeValue)) { + Info "Set $xmlTag '$elemName'.MaxValue"; $script:modifyCount++ + } + } default { # Scalar property change (Indexing, FillChecking, Use, etc.) $scalarEl = $null @@ -2420,6 +2430,13 @@ function Set-AttrPropertyElement($propsEl, $propName, $fragmentXml) { return $true } +# MinValue/MaxValue — типизированное значение (порт Emit-MinMaxValue): nil / xs:string / xs:decimal. +function Build-MinMaxValueXml([string]$tag, $val) { + if ($null -eq $val -or "$val" -eq '') { return "<$tag xsi:nil=`"true`"/>" } + $t = if ($val -is [string]) { 'xs:string' } else { 'xs:decimal' } + return "<$tag xsi:type=`"$t`">$(Esc-Xml "$val")" +} + function Find-PropertyElement([string]$propName) { foreach ($child in $script:propertiesEl.ChildNodes) { if ($child.NodeType -eq 'Element' -and $child.LocalName -eq $propName) { diff --git a/.claude/skills/meta-edit/scripts/meta-edit.py b/.claude/skills/meta-edit/scripts/meta-edit.py index 5c290b4a..713a08c7 100644 --- a/.claude/skills/meta-edit/scripts/meta-edit.py +++ b/.claude/skills/meta-edit/scripts/meta-edit.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# meta-edit v1.13 — Edit existing 1C metadata object XML (inline + complex props + TS ops + modify-ts + create-if-missing + structural attr props Format/EditFormat/ToolTip/ChoiceForm) +# meta-edit v1.14 — Edit existing 1C metadata object XML (+structural attr props Format/EditFormat/ToolTip/ChoiceForm/MinValue/MaxValue) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -2105,6 +2105,14 @@ def modify_child_elements(modify_def, child_type): if set_attr_property_element(props_el, "ChoiceForm", f"{esc_xml(str(change_value))}"): info(f"Set {xml_tag} '{elem_name}'.ChoiceForm") modify_count += 1 + elif change_prop == "MinValue": + if set_attr_property_element(props_el, "MinValue", build_min_max_value_xml("MinValue", change_value)): + info(f"Set {xml_tag} '{elem_name}'.MinValue") + modify_count += 1 + elif change_prop == "MaxValue": + if set_attr_property_element(props_el, "MaxValue", build_min_max_value_xml("MaxValue", change_value)): + info(f"Set {xml_tag} '{elem_name}'.MaxValue") + modify_count += 1 else: # Scalar property change (Indexing, FillChecking, Use, etc.) @@ -2250,6 +2258,14 @@ def set_attr_property_element(props_el, prop_name, fragment_xml): return True +def build_min_max_value_xml(tag, val): + """MinValue/MaxValue — типизированное значение (порт Emit-MinMaxValue): nil / xs:string / xs:decimal.""" + if val is None or str(val) == '': + return f'<{tag} xsi:nil="true"/>' + t = 'xs:string' if isinstance(val, str) else 'xs:decimal' + return f'<{tag} xsi:type="{t}">{esc_xml(str(val))}' + + def find_property_element(prop_name): for child in properties_el: if localname(child) == prop_name: diff --git a/tests/skills/cases/meta-edit/modify-attribute-structural.json b/tests/skills/cases/meta-edit/modify-attribute-structural.json index 595cd2b6..758d0c3d 100644 --- a/tests/skills/cases/meta-edit/modify-attribute-structural.json +++ b/tests/skills/cases/meta-edit/modify-attribute-structural.json @@ -4,7 +4,7 @@ "preRun": [ { "script": "meta-compile/scripts/meta-compile", - "input": { "type": "Catalog", "name": "Спр", "attributes": ["Дата: Date", "Контр: CatalogRef.Спр"] }, + "input": { "type": "Catalog", "name": "Спр", "attributes": ["Дата: Date", "Контр: CatalogRef.Спр", "Сумма: Number(15,2)"] }, "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } }, { @@ -17,7 +17,8 @@ "modify": { "attributes": { "Дата": { "Format": "ДФ=dd.MM.yyyy", "EditFormat": "ДФ=dd.MM.yyyy", "ToolTip": "Дата документа" }, - "Контр": { "ChoiceForm": "Catalog.Спр.Form.ФормаВыбора" } + "Контр": { "ChoiceForm": "Catalog.Спр.Form.ФормаВыбора" }, + "Сумма": { "MinValue": 0, "MaxValue": 1000000 } } } } diff --git a/tests/skills/cases/meta-edit/snapshots/modify-attribute-structural/Catalogs/Спр.xml b/tests/skills/cases/meta-edit/snapshots/modify-attribute-structural/Catalogs/Спр.xml index e5300451..a081af85 100644 --- a/tests/skills/cases/meta-edit/snapshots/modify-attribute-structural/Catalogs/Спр.xml +++ b/tests/skills/cases/meta-edit/snapshots/modify-attribute-structural/Catalogs/Спр.xml @@ -185,6 +185,51 @@ Use + + + Сумма + + + ru + Сумма + + + + + xs:decimal + + 15 + 2 + Any + + + false + + + + false + + false + false + 0 + 1000000 + false + 0 + DontCheck + Items + + + Auto + Auto + + + Auto + ForItem + DontIndex + Use + Use + +
ФормаВыбора