mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-17 16:25:16 +03:00
feat(meta-edit): структурные свойства MinValue/MaxValue (Фаза 2 Шаг 3a, v1.14)
modify-attribute/-dimension/-resource: типизированные MinValue/MaxValue (порт Emit-MinMaxValue — nil / xs:string / xs:decimal; xsi уже объявлен в Import-Fragment, app-namespace не нужен). Хелпер Build-MinMaxValueXml + 2 ветки switch, replace-or-create через Set-AttrPropertyElement. ps1+py. Cert: verify-snapshots --case modify-attribute-structural (расширен Number-реквизитом Сумма с MinValue=0/MaxValue=1000000) — грузится в 1С. meta-edit 14/14 ps1+py, byte-паритет. Остаток Шага 3 (fillValue явный, choiceParameters/choiceParameterLinks/linkByType) — тяжёлый порт fill-ref машинерии + фикс namespace app в Import-Fragment; карта зависимостей в плане. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -2260,6 +2260,16 @@ function Modify-ChildElements($modifyDef, [string]$childType) {
|
|||||||
Info "Set $xmlTag '$elemName'.ChoiceForm"; $script:modifyCount++
|
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 {
|
default {
|
||||||
# Scalar property change (Indexing, FillChecking, Use, etc.)
|
# Scalar property change (Indexing, FillChecking, Use, etc.)
|
||||||
$scalarEl = $null
|
$scalarEl = $null
|
||||||
@@ -2420,6 +2430,13 @@ function Set-AttrPropertyElement($propsEl, $propName, $fragmentXml) {
|
|||||||
return $true
|
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")</$tag>"
|
||||||
|
}
|
||||||
|
|
||||||
function Find-PropertyElement([string]$propName) {
|
function Find-PropertyElement([string]$propName) {
|
||||||
foreach ($child in $script:propertiesEl.ChildNodes) {
|
foreach ($child in $script:propertiesEl.ChildNodes) {
|
||||||
if ($child.NodeType -eq 'Element' -and $child.LocalName -eq $propName) {
|
if ($child.NodeType -eq 'Element' -and $child.LocalName -eq $propName) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -2105,6 +2105,14 @@ def modify_child_elements(modify_def, child_type):
|
|||||||
if set_attr_property_element(props_el, "ChoiceForm", f"<ChoiceForm>{esc_xml(str(change_value))}</ChoiceForm>"):
|
if set_attr_property_element(props_el, "ChoiceForm", f"<ChoiceForm>{esc_xml(str(change_value))}</ChoiceForm>"):
|
||||||
info(f"Set {xml_tag} '{elem_name}'.ChoiceForm")
|
info(f"Set {xml_tag} '{elem_name}'.ChoiceForm")
|
||||||
modify_count += 1
|
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:
|
else:
|
||||||
# Scalar property change (Indexing, FillChecking, Use, etc.)
|
# Scalar property change (Indexing, FillChecking, Use, etc.)
|
||||||
@@ -2250,6 +2258,14 @@ def set_attr_property_element(props_el, prop_name, fragment_xml):
|
|||||||
return True
|
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))}</{tag}>'
|
||||||
|
|
||||||
|
|
||||||
def find_property_element(prop_name):
|
def find_property_element(prop_name):
|
||||||
for child in properties_el:
|
for child in properties_el:
|
||||||
if localname(child) == prop_name:
|
if localname(child) == prop_name:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"preRun": [
|
"preRun": [
|
||||||
{
|
{
|
||||||
"script": "meta-compile/scripts/meta-compile",
|
"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}" }
|
"args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
"modify": {
|
"modify": {
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"Дата": { "Format": "ДФ=dd.MM.yyyy", "EditFormat": "ДФ=dd.MM.yyyy", "ToolTip": "Дата документа" },
|
"Дата": { "Format": "ДФ=dd.MM.yyyy", "EditFormat": "ДФ=dd.MM.yyyy", "ToolTip": "Дата документа" },
|
||||||
"Контр": { "ChoiceForm": "Catalog.Спр.Form.ФормаВыбора" }
|
"Контр": { "ChoiceForm": "Catalog.Спр.Form.ФормаВыбора" },
|
||||||
|
"Сумма": { "MinValue": 0, "MaxValue": 1000000 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,6 +185,51 @@
|
|||||||
<DataHistory>Use</DataHistory>
|
<DataHistory>Use</DataHistory>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Attribute>
|
</Attribute>
|
||||||
|
<Attribute uuid="UUID-014">
|
||||||
|
<Properties>
|
||||||
|
<Name>Сумма</Name>
|
||||||
|
<Synonym>
|
||||||
|
<v8:item>
|
||||||
|
<v8:lang>ru</v8:lang>
|
||||||
|
<v8:content>Сумма</v8:content>
|
||||||
|
</v8:item>
|
||||||
|
</Synonym>
|
||||||
|
<Comment />
|
||||||
|
<Type>
|
||||||
|
<v8:Type>xs:decimal</v8:Type>
|
||||||
|
<v8:NumberQualifiers>
|
||||||
|
<v8:Digits>15</v8:Digits>
|
||||||
|
<v8:FractionDigits>2</v8:FractionDigits>
|
||||||
|
<v8:AllowedSign>Any</v8:AllowedSign>
|
||||||
|
</v8:NumberQualifiers>
|
||||||
|
</Type>
|
||||||
|
<PasswordMode>false</PasswordMode>
|
||||||
|
<Format />
|
||||||
|
<EditFormat />
|
||||||
|
<ToolTip />
|
||||||
|
<MarkNegatives>false</MarkNegatives>
|
||||||
|
<Mask />
|
||||||
|
<MultiLine>false</MultiLine>
|
||||||
|
<ExtendedEdit>false</ExtendedEdit>
|
||||||
|
<MinValue xsi:type="xs:decimal">0</MinValue>
|
||||||
|
<MaxValue xsi:type="xs:decimal">1000000</MaxValue>
|
||||||
|
<FillFromFillingValue>false</FillFromFillingValue>
|
||||||
|
<FillValue xsi:type="xs:decimal">0</FillValue>
|
||||||
|
<FillChecking>DontCheck</FillChecking>
|
||||||
|
<ChoiceFoldersAndItems>Items</ChoiceFoldersAndItems>
|
||||||
|
<ChoiceParameterLinks />
|
||||||
|
<ChoiceParameters />
|
||||||
|
<QuickChoice>Auto</QuickChoice>
|
||||||
|
<CreateOnInput>Auto</CreateOnInput>
|
||||||
|
<ChoiceForm />
|
||||||
|
<LinkByType />
|
||||||
|
<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>
|
||||||
|
<Use>ForItem</Use>
|
||||||
|
<Indexing>DontIndex</Indexing>
|
||||||
|
<FullTextSearch>Use</FullTextSearch>
|
||||||
|
<DataHistory>Use</DataHistory>
|
||||||
|
</Properties>
|
||||||
|
</Attribute>
|
||||||
<Form>ФормаВыбора</Form>
|
<Form>ФормаВыбора</Form>
|
||||||
</ChildObjects>
|
</ChildObjects>
|
||||||
</Catalog>
|
</Catalog>
|
||||||
|
|||||||
Reference in New Issue
Block a user