mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 08:39:40 +03:00
feat(meta-compile,meta-decompile): поддержка типов Constant + DefinedType (v1.53/v0.44)
16-й/17-й типы, 2692 объекта acc+erp. ПОЛНЫЙ КОРПУС 2692/2692 match, TOTAL 0 — byte-exact order-preserved. Регресс 54/54 ps1+py, ps1==py identical. - Constant — «богатый одиночный реквизит»: рерайт Emit-ConstantProperties на общие leaf-хелперы (Emit-MinMaxValue/ChoiceParameterLinks/ChoiceParameters/LinkByType/MLText), был легаси-хардкод всех свойств. Декомпилятор: захват valueType + свойств значения (passwordMode/format/tooltip/mask/min-maxValue/fillChecking/choiceFoldersAndItems/ choiceParameter*/quickChoice[enum]/choiceForm/linkByType) + object-уровень. QuickChoice у Constant — ENUM (Auto), не bool → гард общего bool-хендлера. - DefinedType — тип-псевдоним: рерайт Emit-DefinedTypeProperties на единый Emit-ValueType (был дубль-эмиттер типа; составной через ' + '). Декомпилятор: valueType. - Class-2: Constant DataLockControlMode Automatic→Managed (корпус 965/78). - Общий фикс: cfg_object_kinds +ConstantValue — тип ConstantValueManager.X (менеджер значения константы, 321) терял cfg:-префикс (regex greedy бил ConstantValue+Manager). Дефолт UseStandardCommands true (как Report/DataProcessor). spec §7.4/§7.7, кейсы constant-full/defined-type-full. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# meta-compile v1.52 — Compile 1C metadata object from JSON
|
||||
# meta-compile v1.53 — Compile 1C metadata object from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -466,7 +466,7 @@ $script:typeNamespaceMap = @{
|
||||
$script:cfgBareTypes = @("ConstantsSet", "ReportBuilder", "FilterCriterion")
|
||||
$script:cfgObjectKinds = @("Catalog","Document","Enum","ChartOfAccounts","ChartOfCharacteristicTypes",
|
||||
"ChartOfCalculationTypes","ExchangePlan","BusinessProcess","Task","InformationRegister","AccumulationRegister",
|
||||
"AccountingRegister","CalculationRegister","DataProcessor","Report","DocumentJournal","Constant")
|
||||
"AccountingRegister","CalculationRegister","DataProcessor","Report","DocumentJournal","Constant","ConstantValue")
|
||||
$script:typeSynonyms["таблицазначений"] = "ValueTable"
|
||||
$script:typeSynonyms["деревозначений"] = "ValueTree"
|
||||
$script:typeSynonyms["списокзначений"] = "ValueListType"
|
||||
@@ -2331,41 +2331,42 @@ function Emit-ConstantProperties {
|
||||
|
||||
X "$i<Name>$(Esc-Xml $objName)</Name>"
|
||||
Emit-MLText $i "Synonym" $synonym
|
||||
X "$i<Comment/>"
|
||||
if ($def.comment) { X "$i<Comment>$(Esc-XmlText $def.comment)</Comment>" } else { X "$i<Comment/>" }
|
||||
|
||||
# Type
|
||||
# Type — valueType (пустой явный '' → <Type/>, реквизит без типа; отсутствие → String дефолт).
|
||||
$valueType = Build-TypeStr $def
|
||||
if (-not $valueType) { $valueType = "String" }
|
||||
Emit-ValueType $i $valueType
|
||||
$typeEmpty = ($null -ne $def.valueType -and "$($def.valueType)".Trim() -eq '') -or ($null -ne $def.type -and "$($def.type)".Trim() -eq '')
|
||||
if ($typeEmpty) { X "$i<Type/>" }
|
||||
else { if (-not $valueType) { $valueType = "String" }; Emit-ValueType $i $valueType }
|
||||
|
||||
X "$i<UseStandardCommands>true</UseStandardCommands>"
|
||||
X "$i<DefaultForm/>"
|
||||
X "$i<ExtendedPresentation/>"
|
||||
X "$i<Explanation/>"
|
||||
X "$i<PasswordMode>false</PasswordMode>"
|
||||
X "$i<Format/>"
|
||||
X "$i<EditFormat/>"
|
||||
X "$i<ToolTip/>"
|
||||
X "$i<MarkNegatives>false</MarkNegatives>"
|
||||
X "$i<Mask/>"
|
||||
X "$i<MultiLine>false</MultiLine>"
|
||||
X "$i<ExtendedEdit>false</ExtendedEdit>"
|
||||
X "$i<MinValue xsi:nil=`"true`"/>"
|
||||
X "$i<MaxValue xsi:nil=`"true`"/>"
|
||||
X "$i<FillChecking>DontCheck</FillChecking>"
|
||||
X "$i<ChoiceFoldersAndItems>Items</ChoiceFoldersAndItems>"
|
||||
X "$i<ChoiceParameterLinks/>"
|
||||
X "$i<ChoiceParameters/>"
|
||||
X "$i<QuickChoice>Auto</QuickChoice>"
|
||||
X "$i<ChoiceForm/>"
|
||||
X "$i<LinkByType/>"
|
||||
X "$i<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>"
|
||||
$useStdCmds = if (Get-BoolProp "useStandardCommands" $true) { "true" } else { "false" }
|
||||
X "$i<UseStandardCommands>$useStdCmds</UseStandardCommands>"
|
||||
Emit-VerbatimRef $i "DefaultForm" $def.defaultForm
|
||||
Emit-MLText $i "ExtendedPresentation" $def.extendedPresentation
|
||||
Emit-MLText $i "Explanation" $def.explanation
|
||||
X "$i<PasswordMode>$(if (Get-BoolProp 'passwordMode' $false) { 'true' } else { 'false' })</PasswordMode>"
|
||||
Emit-MLText $i "Format" $def.format
|
||||
Emit-MLText $i "EditFormat" $def.editFormat
|
||||
Emit-MLText $i "ToolTip" $def.tooltip
|
||||
X "$i<MarkNegatives>$(if (Get-BoolProp 'markNegatives' $false) { 'true' } else { 'false' })</MarkNegatives>"
|
||||
if ($def.mask) { X "$i<Mask>$(Esc-XmlText $def.mask)</Mask>" } else { X "$i<Mask/>" }
|
||||
X "$i<MultiLine>$(if (Get-BoolProp 'multiLine' $false) { 'true' } else { 'false' })</MultiLine>"
|
||||
X "$i<ExtendedEdit>$(if (Get-BoolProp 'extendedEdit' $false) { 'true' } else { 'false' })</ExtendedEdit>"
|
||||
Emit-MinMaxValue $i "MinValue" $def.minValue
|
||||
Emit-MinMaxValue $i "MaxValue" $def.maxValue
|
||||
X "$i<FillChecking>$(Get-EnumProp 'FillChecking' 'fillChecking' 'DontCheck')</FillChecking>"
|
||||
X "$i<ChoiceFoldersAndItems>$(Get-EnumProp 'ChoiceFoldersAndItems' 'choiceFoldersAndItems' 'Items')</ChoiceFoldersAndItems>"
|
||||
Emit-ChoiceParameterLinks $i $def.choiceParameterLinks
|
||||
Emit-ChoiceParameters $i $def.choiceParameters
|
||||
X "$i<QuickChoice>$(Get-EnumProp 'QuickChoice' 'quickChoice' 'Auto')</QuickChoice>"
|
||||
if ($def.choiceForm) { X "$i<ChoiceForm>$(Esc-Xml "$($def.choiceForm)")</ChoiceForm>" } else { X "$i<ChoiceForm/>" }
|
||||
Emit-LinkByType $i $def.linkByType
|
||||
X "$i<ChoiceHistoryOnInput>$(Get-EnumProp 'ChoiceHistoryOnInput' 'choiceHistoryOnInput' 'Auto')</ChoiceHistoryOnInput>"
|
||||
|
||||
$dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic"
|
||||
X "$i<DataLockControlMode>$dataLockControlMode</DataLockControlMode>"
|
||||
X "$i<DataHistory>DontUse</DataHistory>"
|
||||
X "$i<UpdateDataHistoryImmediatelyAfterWrite>false</UpdateDataHistoryImmediatelyAfterWrite>"
|
||||
X "$i<ExecuteAfterWriteDataHistoryVersionProcessing>false</ExecuteAfterWriteDataHistoryVersionProcessing>"
|
||||
X "$i<DataLockControlMode>$(Get-EnumProp 'DataLockControlMode' 'dataLockControlMode' 'Managed')</DataLockControlMode>"
|
||||
X "$i<DataHistory>$(Get-EnumProp 'DataHistory' 'dataHistory' 'DontUse')</DataHistory>"
|
||||
X "$i<UpdateDataHistoryImmediatelyAfterWrite>$(if (Get-BoolProp 'updateDataHistoryImmediatelyAfterWrite' $false) { 'true' } else { 'false' })</UpdateDataHistoryImmediatelyAfterWrite>"
|
||||
X "$i<ExecuteAfterWriteDataHistoryVersionProcessing>$(if (Get-BoolProp 'executeAfterWriteDataHistoryVersionProcessing' $false) { 'true' } else { 'false' })</ExecuteAfterWriteDataHistoryVersionProcessing>"
|
||||
}
|
||||
|
||||
function Emit-InformationRegisterProperties {
|
||||
@@ -2461,37 +2462,14 @@ function Emit-DefinedTypeProperties {
|
||||
|
||||
X "$i<Name>$(Esc-Xml $objName)</Name>"
|
||||
Emit-MLText $i "Synonym" $synonym
|
||||
X "$i<Comment/>"
|
||||
if ($def.comment) { X "$i<Comment>$(Esc-XmlText $def.comment)</Comment>" } else { X "$i<Comment/>" }
|
||||
|
||||
# Type — composite type with multiple v8:Type entries (accept both valueType and valueTypes)
|
||||
$valueTypes = @()
|
||||
if ($def.valueTypes) {
|
||||
$valueTypes = @($def.valueTypes)
|
||||
} elseif ($def.valueType) {
|
||||
$valueTypes = @($def.valueType)
|
||||
}
|
||||
if ($valueTypes.Count -gt 0) {
|
||||
X "$i<Type>"
|
||||
foreach ($vt in $valueTypes) {
|
||||
$resolved = Resolve-TypeStr "$vt"
|
||||
if ($resolved -match '^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef|ChartOfCalculationTypesRef|ExchangePlanRef|BusinessProcessRef|TaskRef)\.') {
|
||||
X "$i`t<v8:Type xmlns:d5p1=`"http://v8.1c.ru/8.1/data/enterprise/current-config`">d5p1:$resolved</v8:Type>"
|
||||
} elseif ($resolved -eq "Boolean") {
|
||||
X "$i`t<v8:Type>xs:boolean</v8:Type>"
|
||||
} elseif ($resolved -match '^String') {
|
||||
X "$i`t<v8:Type>xs:string</v8:Type>"
|
||||
X "$i`t<v8:StringQualifiers>"
|
||||
X "$i`t`t<v8:Length>0</v8:Length>"
|
||||
X "$i`t`t<v8:AllowedLength>Variable</v8:AllowedLength>"
|
||||
X "$i`t</v8:StringQualifiers>"
|
||||
} else {
|
||||
X "$i`t<v8:Type>cfg:$resolved</v8:Type>"
|
||||
}
|
||||
}
|
||||
X "$i</Type>"
|
||||
} else {
|
||||
X "$i<Type/>"
|
||||
}
|
||||
# Type — тип-значение (составной через ' + '); принимаем valueType (строка) или valueTypes (массив).
|
||||
# Единый эмиттер Emit-ValueType/Emit-TypeContent (refs d5p1, cfg:, платформенные, квалификаторы). Пусто → <Type/>.
|
||||
$vt = if ($def.valueType) { "$($def.valueType)" }
|
||||
elseif ($def.valueTypes) { (@($def.valueTypes) | ForEach-Object { "$_" }) -join ' + ' }
|
||||
else { '' }
|
||||
if ($vt) { Emit-ValueType $i $vt } else { X "$i<Type/>" }
|
||||
}
|
||||
|
||||
function Emit-CommonModuleProperties {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# meta-compile v1.52 — Compile 1C metadata object from JSON
|
||||
# meta-compile v1.53 — Compile 1C metadata object from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -539,7 +539,7 @@ cfg_bare_types = {"ConstantsSet", "ReportBuilder", "FilterCriterion"}
|
||||
cfg_object_kinds = {"Catalog", "Document", "Enum", "ChartOfAccounts", "ChartOfCharacteristicTypes",
|
||||
"ChartOfCalculationTypes", "ExchangePlan", "BusinessProcess", "Task", "InformationRegister",
|
||||
"AccumulationRegister", "AccountingRegister", "CalculationRegister", "DataProcessor", "Report",
|
||||
"DocumentJournal", "Constant"}
|
||||
"DocumentJournal", "Constant", "ConstantValue"}
|
||||
|
||||
def resolve_type_str(type_str):
|
||||
if not type_str:
|
||||
@@ -2331,37 +2331,51 @@ def emit_constant_properties(indent):
|
||||
i = indent
|
||||
X(f'{i}<Name>{esc_xml(obj_name)}</Name>')
|
||||
emit_mltext(i, 'Synonym', synonym)
|
||||
X(f'{i}<Comment/>')
|
||||
# Type
|
||||
value_type = build_type_str(defn) or 'String'
|
||||
emit_value_type(i, value_type)
|
||||
X(f'{i}<UseStandardCommands>true</UseStandardCommands>')
|
||||
X(f'{i}<DefaultForm/>')
|
||||
X(f'{i}<ExtendedPresentation/>')
|
||||
X(f'{i}<Explanation/>')
|
||||
X(f'{i}<PasswordMode>false</PasswordMode>')
|
||||
X(f'{i}<Format/>')
|
||||
X(f'{i}<EditFormat/>')
|
||||
X(f'{i}<ToolTip/>')
|
||||
X(f'{i}<MarkNegatives>false</MarkNegatives>')
|
||||
X(f'{i}<Mask/>')
|
||||
X(f'{i}<MultiLine>false</MultiLine>')
|
||||
X(f'{i}<ExtendedEdit>false</ExtendedEdit>')
|
||||
X(f'{i}<MinValue xsi:nil="true"/>')
|
||||
X(f'{i}<MaxValue xsi:nil="true"/>')
|
||||
X(f'{i}<FillChecking>DontCheck</FillChecking>')
|
||||
X(f'{i}<ChoiceFoldersAndItems>Items</ChoiceFoldersAndItems>')
|
||||
X(f'{i}<ChoiceParameterLinks/>')
|
||||
X(f'{i}<ChoiceParameters/>')
|
||||
X(f'{i}<QuickChoice>Auto</QuickChoice>')
|
||||
X(f'{i}<ChoiceForm/>')
|
||||
X(f'{i}<LinkByType/>')
|
||||
X(f'{i}<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>')
|
||||
data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic')
|
||||
X(f'{i}<DataLockControlMode>{data_lock_control_mode}</DataLockControlMode>')
|
||||
X(f'{i}<DataHistory>DontUse</DataHistory>')
|
||||
X(f'{i}<UpdateDataHistoryImmediatelyAfterWrite>false</UpdateDataHistoryImmediatelyAfterWrite>')
|
||||
X(f'{i}<ExecuteAfterWriteDataHistoryVersionProcessing>false</ExecuteAfterWriteDataHistoryVersionProcessing>')
|
||||
if defn.get('comment'):
|
||||
X(f'{i}<Comment>{esc_xml_text(str(defn["comment"]))}</Comment>')
|
||||
else:
|
||||
X(f'{i}<Comment/>')
|
||||
# Type — valueType (явный '' → <Type/>, реквизит без типа; отсутствие → String дефолт).
|
||||
value_type = build_type_str(defn)
|
||||
type_empty = (defn.get('valueType') is not None and str(defn.get('valueType')).strip() == '') or \
|
||||
(defn.get('type') is not None and str(defn.get('type')).strip() == '')
|
||||
if type_empty:
|
||||
X(f'{i}<Type/>')
|
||||
else:
|
||||
emit_value_type(i, value_type or 'String')
|
||||
use_std_cmds = 'true' if get_bool_prop('useStandardCommands', True) else 'false'
|
||||
X(f'{i}<UseStandardCommands>{use_std_cmds}</UseStandardCommands>')
|
||||
emit_verbatim_ref(i, 'DefaultForm', defn.get('defaultForm'))
|
||||
emit_mltext(i, 'ExtendedPresentation', defn.get('extendedPresentation'))
|
||||
emit_mltext(i, 'Explanation', defn.get('explanation'))
|
||||
X(f'{i}<PasswordMode>{"true" if get_bool_prop("passwordMode", False) else "false"}</PasswordMode>')
|
||||
emit_mltext(i, 'Format', defn.get('format'))
|
||||
emit_mltext(i, 'EditFormat', defn.get('editFormat'))
|
||||
emit_mltext(i, 'ToolTip', defn.get('tooltip'))
|
||||
X(f'{i}<MarkNegatives>{"true" if get_bool_prop("markNegatives", False) else "false"}</MarkNegatives>')
|
||||
if defn.get('mask'):
|
||||
X(f'{i}<Mask>{esc_xml_text(str(defn["mask"]))}</Mask>')
|
||||
else:
|
||||
X(f'{i}<Mask/>')
|
||||
X(f'{i}<MultiLine>{"true" if get_bool_prop("multiLine", False) else "false"}</MultiLine>')
|
||||
X(f'{i}<ExtendedEdit>{"true" if get_bool_prop("extendedEdit", False) else "false"}</ExtendedEdit>')
|
||||
emit_min_max_value(i, 'MinValue', defn.get('minValue'))
|
||||
emit_min_max_value(i, 'MaxValue', defn.get('maxValue'))
|
||||
X(f'{i}<FillChecking>{get_enum_prop("FillChecking", "fillChecking", "DontCheck")}</FillChecking>')
|
||||
X(f'{i}<ChoiceFoldersAndItems>{get_enum_prop("ChoiceFoldersAndItems", "choiceFoldersAndItems", "Items")}</ChoiceFoldersAndItems>')
|
||||
emit_choice_parameter_links(i, defn.get('choiceParameterLinks'))
|
||||
emit_choice_parameters(i, defn.get('choiceParameters'))
|
||||
X(f'{i}<QuickChoice>{get_enum_prop("QuickChoice", "quickChoice", "Auto")}</QuickChoice>')
|
||||
if defn.get('choiceForm'):
|
||||
X(f'{i}<ChoiceForm>{esc_xml(str(defn["choiceForm"]))}</ChoiceForm>')
|
||||
else:
|
||||
X(f'{i}<ChoiceForm/>')
|
||||
emit_link_by_type(i, defn.get('linkByType'))
|
||||
X(f'{i}<ChoiceHistoryOnInput>{get_enum_prop("ChoiceHistoryOnInput", "choiceHistoryOnInput", "Auto")}</ChoiceHistoryOnInput>')
|
||||
X(f'{i}<DataLockControlMode>{get_enum_prop("DataLockControlMode", "dataLockControlMode", "Managed")}</DataLockControlMode>')
|
||||
X(f'{i}<DataHistory>{get_enum_prop("DataHistory", "dataHistory", "DontUse")}</DataHistory>')
|
||||
X(f'{i}<UpdateDataHistoryImmediatelyAfterWrite>{"true" if get_bool_prop("updateDataHistoryImmediatelyAfterWrite", False) else "false"}</UpdateDataHistoryImmediatelyAfterWrite>')
|
||||
X(f'{i}<ExecuteAfterWriteDataHistoryVersionProcessing>{"true" if get_bool_prop("executeAfterWriteDataHistoryVersionProcessing", False) else "false"}</ExecuteAfterWriteDataHistoryVersionProcessing>')
|
||||
|
||||
def emit_information_register_properties(indent):
|
||||
i = indent
|
||||
@@ -2439,29 +2453,19 @@ def emit_defined_type_properties(indent):
|
||||
i = indent
|
||||
X(f'{i}<Name>{esc_xml(obj_name)}</Name>')
|
||||
emit_mltext(i, 'Synonym', synonym)
|
||||
X(f'{i}<Comment/>')
|
||||
# Accept both valueType and valueTypes
|
||||
value_types = list(defn.get('valueTypes', []))
|
||||
if not value_types and defn.get('valueType'):
|
||||
vt_raw = defn['valueType']
|
||||
value_types = list(vt_raw) if isinstance(vt_raw, list) else [vt_raw]
|
||||
if value_types:
|
||||
X(f'{i}<Type>')
|
||||
for vt in value_types:
|
||||
resolved = resolve_type_str(str(vt))
|
||||
if re.match(r'^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef|ChartOfCalculationTypesRef|ExchangePlanRef|BusinessProcessRef|TaskRef)\.', resolved):
|
||||
X(f'{i}\t<v8:Type xmlns:d5p1="http://v8.1c.ru/8.1/data/enterprise/current-config">d5p1:{resolved}</v8:Type>')
|
||||
elif resolved == 'Boolean':
|
||||
X(f'{i}\t<v8:Type>xs:boolean</v8:Type>')
|
||||
elif re.match(r'^String', resolved):
|
||||
X(f'{i}\t<v8:Type>xs:string</v8:Type>')
|
||||
X(f'{i}\t<v8:StringQualifiers>')
|
||||
X(f'{i}\t\t<v8:Length>0</v8:Length>')
|
||||
X(f'{i}\t\t<v8:AllowedLength>Variable</v8:AllowedLength>')
|
||||
X(f'{i}\t</v8:StringQualifiers>')
|
||||
else:
|
||||
X(f'{i}\t<v8:Type>cfg:{resolved}</v8:Type>')
|
||||
X(f'{i}</Type>')
|
||||
if defn.get('comment'):
|
||||
X(f'{i}<Comment>{esc_xml_text(str(defn["comment"]))}</Comment>')
|
||||
else:
|
||||
X(f'{i}<Comment/>')
|
||||
# Type — единый эмиттер emit_value_type/emit_type_content (составной через ' + '); valueType или valueTypes.
|
||||
if defn.get('valueType'):
|
||||
vt = str(defn['valueType'])
|
||||
elif defn.get('valueTypes'):
|
||||
vt = ' + '.join(str(x) for x in defn['valueTypes'])
|
||||
else:
|
||||
vt = ''
|
||||
if vt:
|
||||
emit_value_type(i, vt)
|
||||
else:
|
||||
X(f'{i}<Type/>')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# meta-decompile v0.43 — XML объекта метаданных 1С → JSON-черновик формата meta-compile
|
||||
# meta-decompile v0.44 — XML объекта метаданных 1С → JSON-черновик формата meta-compile
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
#
|
||||
# Поддержаны: Catalog, ExchangePlan, ChartOfCharacteristicTypes, ChartOfAccounts, ChartOfCalculationTypes, Document,
|
||||
@@ -92,8 +92,8 @@ foreach ($c in $rootEl.ChildNodes) { if ($c.NodeType -eq 'Element') { $objNode =
|
||||
if (-not $objNode) { [Console]::Error.WriteLine("meta-decompile: пустой MetaDataObject"); exit 3 }
|
||||
$objType = $objNode.LocalName
|
||||
|
||||
if ($objType -notin @('Catalog', 'ExchangePlan', 'ChartOfCharacteristicTypes', 'ChartOfAccounts', 'ChartOfCalculationTypes', 'Document', 'InformationRegister', 'AccumulationRegister', 'AccountingRegister', 'CalculationRegister', 'BusinessProcess', 'Task', 'Enum', 'Report', 'DataProcessor')) {
|
||||
[Console]::Error.WriteLine("meta-decompile: тип '$objType' пока не поддержан (Catalog, ExchangePlan, ChartOfCharacteristicTypes, ChartOfAccounts, ChartOfCalculationTypes, Document, InformationRegister, AccumulationRegister, AccountingRegister, CalculationRegister, BusinessProcess, Task, Enum, Report, DataProcessor)"); exit 3
|
||||
if ($objType -notin @('Catalog', 'ExchangePlan', 'ChartOfCharacteristicTypes', 'ChartOfAccounts', 'ChartOfCalculationTypes', 'Document', 'InformationRegister', 'AccumulationRegister', 'AccountingRegister', 'CalculationRegister', 'BusinessProcess', 'Task', 'Enum', 'Report', 'DataProcessor', 'Constant', 'DefinedType')) {
|
||||
[Console]::Error.WriteLine("meta-decompile: тип '$objType' пока не поддержан (Catalog, ExchangePlan, ChartOfCharacteristicTypes, ChartOfAccounts, ChartOfCalculationTypes, Document, InformationRegister, AccumulationRegister, AccountingRegister, CalculationRegister, BusinessProcess, Task, Enum, Report, DataProcessor, Constant, DefinedType)"); exit 3
|
||||
}
|
||||
|
||||
$props = $objNode.SelectSingleNode('md:Properties', $nsm)
|
||||
@@ -433,7 +433,7 @@ Add-BoolProp 'autonumbering' 'Autonumbering' $true
|
||||
Add-BoolProp 'checkUnique' 'CheckUnique' $checkUniqueDef
|
||||
Add-EnumProp 'codeSeries' 'CodeSeries' $codeSeriesDef
|
||||
Add-EnumProp 'defaultPresentation' 'DefaultPresentation' $defPresDef
|
||||
Add-BoolProp 'quickChoice' 'QuickChoice' $(if ($objType -eq 'Enum') { $true } else { $false }) # Enum дефолт true (компилятор+корпус); прочие false
|
||||
if ($objType -ne 'Constant') { Add-BoolProp 'quickChoice' 'QuickChoice' $(if ($objType -eq 'Enum') { $true } else { $false }) } # Enum дефолт true; прочие false. Constant: QuickChoice — ENUM (Auto), не bool → ловим отдельно ниже
|
||||
Add-EnumProp 'choiceMode' 'ChoiceMode' 'BothWays'
|
||||
Add-EnumProp 'dataLockControlMode' 'DataLockControlMode' $dataLockDef
|
||||
Add-EnumProp 'fullTextSearch' 'FullTextSearch' 'Use'
|
||||
@@ -594,6 +594,53 @@ if ($objType -eq 'DataProcessor') {
|
||||
$afm = P 'AuxiliaryForm'; if ($afm) { $dsl['auxiliaryForm'] = $afm }
|
||||
$ep = Get-MLValue ($props.SelectSingleNode('md:ExtendedPresentation', $nsm)); if ($null -ne $ep) { $dsl['extendedPresentation'] = $ep }
|
||||
}
|
||||
# DefinedType — тип-псевдоним: только Name/Synonym/Comment/Type. valueType (составной через ' + ').
|
||||
if ($objType -eq 'DefinedType') {
|
||||
$vt = Get-TypeShorthand ($props.SelectSingleNode('md:Type', $nsm))
|
||||
if ($vt) { $dsl['valueType'] = $vt }
|
||||
}
|
||||
# Constant — богатый одиночный реквизит: Type + свойства значения (как у реквизита) + object-уровень.
|
||||
if ($objType -eq 'Constant') {
|
||||
$vt = Get-TypeShorthand ($props.SelectSingleNode('md:Type', $nsm))
|
||||
if ($vt) { $dsl['valueType'] = $vt } else { $dsl['valueType'] = '' }
|
||||
$dfm = P 'DefaultForm'; if ($dfm) { $dsl['defaultForm'] = $dfm }
|
||||
$ep = Get-MLValue ($props.SelectSingleNode('md:ExtendedPresentation', $nsm)); if ($null -ne $ep) { $dsl['extendedPresentation'] = $ep }
|
||||
Add-BoolProp 'passwordMode' 'PasswordMode' $false
|
||||
$fmt = Get-MLValue ($props.SelectSingleNode('md:Format', $nsm)); if ($null -ne $fmt) { $dsl['format'] = $fmt }
|
||||
$efmt = Get-MLValue ($props.SelectSingleNode('md:EditFormat', $nsm)); if ($null -ne $efmt) { $dsl['editFormat'] = $efmt }
|
||||
$tt = Get-MLValue ($props.SelectSingleNode('md:ToolTip', $nsm)); if ($null -ne $tt) { $dsl['tooltip'] = $tt }
|
||||
Add-BoolProp 'markNegatives' 'MarkNegatives' $false
|
||||
$msk = P 'Mask'; if ($msk) { $dsl['mask'] = $msk }
|
||||
Add-BoolProp 'multiLine' 'MultiLine' $false
|
||||
Add-BoolProp 'extendedEdit' 'ExtendedEdit' $false
|
||||
# MinValue/MaxValue (дефолт nil) — типизированное значение при наличии.
|
||||
foreach ($mm in @(@('MinValue','minValue'), @('MaxValue','maxValue'))) {
|
||||
$mn = $props.SelectSingleNode("md:$($mm[0])", $nsm)
|
||||
if ($mn -and $mn.GetAttribute('nil', 'http://www.w3.org/2001/XMLSchema-instance') -ne 'true') {
|
||||
$mxt = $mn.GetAttribute('type', 'http://www.w3.org/2001/XMLSchema-instance')
|
||||
if ($mxt -match 'decimal$') { $dsl[$mm[1]] = if ($mn.InnerText -match '^-?\d+$') { [long]$mn.InnerText } else { [double]$mn.InnerText } }
|
||||
else { $dsl[$mm[1]] = $mn.InnerText }
|
||||
}
|
||||
}
|
||||
Add-EnumProp 'fillChecking' 'FillChecking' 'DontCheck'
|
||||
Add-EnumProp 'choiceFoldersAndItems' 'ChoiceFoldersAndItems' 'Items'
|
||||
$cpl = Parse-ChoiceParameterLinks $props 'md:ChoiceParameterLinks'; if ($null -ne $cpl) { $dsl['choiceParameterLinks'] = $cpl }
|
||||
$cp = Parse-ChoiceParameters $props 'md:ChoiceParameters'; if ($null -ne $cp) { $dsl['choiceParameters'] = $cp }
|
||||
Add-EnumProp 'quickChoice' 'QuickChoice' 'Auto'
|
||||
$cf = P 'ChoiceForm'; if ($cf) { $dsl['choiceForm'] = $cf }
|
||||
$lbtNode = $props.SelectSingleNode('md:LinkByType', $nsm)
|
||||
if ($lbtNode) {
|
||||
$dpN = $lbtNode.SelectSingleNode('md:DataPath', $nsm)
|
||||
if ($dpN -and $dpN.InnerText) {
|
||||
$liN = $lbtNode.SelectSingleNode('md:LinkItem', $nsm)
|
||||
$li = if ($liN -and $liN.InnerText) { [int]$liN.InnerText } else { 0 }
|
||||
$dsl['linkByType'] = if ($li -eq 0) { $dpN.InnerText } else { [ordered]@{ dataPath = $dpN.InnerText; linkItem = $li } }
|
||||
}
|
||||
}
|
||||
Add-EnumProp 'dataHistory' 'DataHistory' 'DontUse'
|
||||
Add-BoolProp 'updateDataHistoryImmediatelyAfterWrite' 'UpdateDataHistoryImmediatelyAfterWrite' $false
|
||||
Add-BoolProp 'executeAfterWriteDataHistoryVersionProcessing' 'ExecuteAfterWriteDataHistoryVersionProcessing' $false
|
||||
}
|
||||
|
||||
# Короткая форма поля: <Type>.<Name>.StandardAttribute.X / .Attribute.X → StandardAttribute.X / Attribute.X
|
||||
# (Expand-DataPath компилятора разворачивает частичную форму обратно — dogfood резолвера).
|
||||
|
||||
Reference in New Issue
Block a user