diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 64efc660..040b2367 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.32 — Compile 1C managed form from JSON or object metadata +# form-compile v1.33 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -1982,6 +1982,8 @@ function Emit-Element { "excludedCommands"=1 "choiceMode"=1;"initialTreeView"=1;"enableDrag"=1;"enableStartDrag"=1 "rowPictureDataPath"=1;"tableAutofill"=1 + # calendar-specific + "selectionMode"=1;"showCurrentDate"=1;"widthInMonths"=1;"heightInMonths"=1;"showMonthsPanel"=1 # pages-specific "pagesRepresentation"=1 # button-specific @@ -2862,8 +2864,29 @@ function Emit-Calendar { Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path) Emit-CommonFlags -el $el -indent $inner + + if ($el.titleLocation) { + $loc = switch ("$($el.titleLocation)") { + "none" { "None" } + "left" { "Left" } + "right" { "Right" } + "top" { "Top" } + "bottom" { "Bottom" } + "auto" { "Auto" } + default { "$($el.titleLocation)" } + } + X "$inner$loc" + } + Emit-Layout -el $el -indent $inner + # Календарно-специфичные свойства (порядок схемы: после layout, до companions) + if ($el.selectionMode) { X "$inner$($el.selectionMode)" } + if ($null -ne $el.showCurrentDate) { $v = if ($el.showCurrentDate) { "true" } else { "false" }; X "$inner$v" } + if ($null -ne $el.widthInMonths) { X "$inner$($el.widthInMonths)" } + if ($null -ne $el.heightInMonths) { X "$inner$($el.heightInMonths)" } + if ($null -ne $el.showMonthsPanel) { $v = if ($el.showMonthsPanel) { "true" } else { "false" }; X "$inner$v" } + # Companions Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 47c34a45..7f8f86d8 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.32 — Compile 1C managed form from JSON or object metadata +# form-compile v1.33 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1357,6 +1357,7 @@ KNOWN_KEYS = { "name", "path", "title", "visible", "hidden", "enabled", "disabled", "readOnly", "userVisible", "events", "on", "handlers", + "selectionMode", "showCurrentDate", "widthInMonths", "heightInMonths", "showMonthsPanel", "titleLocation", "representation", "width", "height", "horizontalStretch", "verticalStretch", "autoMaxWidth", "autoMaxHeight", "maxWidth", "maxHeight", @@ -2494,8 +2495,26 @@ def emit_calendar(lines, el, name, eid, indent): emit_title(lines, el, name, inner, auto=not el.get('path')) emit_common_flags(lines, el, inner) + + if el.get('titleLocation'): + loc_map = {'none': 'None', 'left': 'Left', 'right': 'Right', 'top': 'Top', 'bottom': 'Bottom', 'auto': 'Auto'} + loc = loc_map.get(str(el['titleLocation']), str(el['titleLocation'])) + lines.append(f'{inner}{loc}') + emit_layout(lines, el, inner) + # \u041a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u043e-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0445\u0435\u043c\u044b: \u043f\u043e\u0441\u043b\u0435 layout, \u0434\u043e companions) + if el.get('selectionMode'): + lines.append(f'{inner}{el["selectionMode"]}') + if el.get('showCurrentDate') is not None: + lines.append(f'{inner}{"true" if el["showCurrentDate"] else "false"}') + if el.get('widthInMonths') is not None: + lines.append(f'{inner}{el["widthInMonths"]}') + if el.get('heightInMonths') is not None: + lines.append(f'{inner}{el["heightInMonths"]}') + if el.get('showMonthsPanel') is not None: + lines.append(f'{inner}{"true" if el["showMonthsPanel"] else "false"}') + # Companions emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner) emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner) diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index b4e0da35..309a93de 100644 --- a/.claude/skills/form-decompile/scripts/form-decompile.ps1 +++ b/.claude/skills/form-decompile/scripts/form-decompile.ps1 @@ -1,4 +1,4 @@ -# form-decompile v0.12 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.13 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -422,6 +422,12 @@ function Decompile-Element { $obj[$key] = $name $dp = Get-Child $node 'DataPath'; if ($dp) { $obj['path'] = $dp } Add-CommonProps $obj $node $name + $tl = Get-Child $node 'TitleLocation'; if ($tl) { $obj['titleLocation'] = $tl.ToLower() } + $sm = Get-Child $node 'SelectionMode'; if ($sm) { $obj['selectionMode'] = $sm } + $scd = Get-Child $node 'ShowCurrentDate'; if ($null -ne $scd) { $obj['showCurrentDate'] = ($scd -eq 'true') } + $wim = Get-Child $node 'WidthInMonths'; if ($null -ne $wim) { $obj['widthInMonths'] = [int]$wim } + $him = Get-Child $node 'HeightInMonths'; if ($null -ne $him) { $obj['heightInMonths'] = [int]$him } + $smp = Get-Child $node 'ShowMonthsPanel'; if ($null -ne $smp) { $obj['showMonthsPanel'] = ($smp -eq 'true') } } 'Table' { $obj[$key] = $name diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index fd841016..793924fd 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -410,9 +410,20 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs #### calendar — CalendarField ```json -{ "calendar": "Дата", "path": "ДатаОтчета" } +{ "calendar": "Дата", "path": "ДатаОтчета", + "selectionMode": "Interval", "showCurrentDate": false, "widthInMonths": 2 } ``` +| Свойство | XML | Значения | +|----------|-----|----------| +| `selectionMode` | `` | `Single`, `Multiple`, `Interval` | +| `showCurrentDate` | `` | bool (выводится при наличии ключа) | +| `widthInMonths` | `` | число месяцев по ширине | +| `heightInMonths` | `` | число месяцев по высоте | +| `showMonthsPanel` | `` | bool | + +Также поддерживается общий `titleLocation` (`none`/`left`/`right`/`top`/`bottom`/`auto`). + #### cmdBar — CommandBar ```json diff --git a/tests/skills/cases/form-compile/calendar.json b/tests/skills/cases/form-compile/calendar.json new file mode 100644 index 00000000..9c290809 --- /dev/null +++ b/tests/skills/cases/form-compile/calendar.json @@ -0,0 +1,28 @@ +{ + "name": "Форма с полем календаря", + "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { "type": "DataProcessor", "name": "Календарь" }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, + { + "script": "form-add/scripts/form-add", + "args": { "-ObjectPath": "{workDir}/DataProcessors/Календарь.xml", "-FormName": "Форма" } + } + ], + "params": { "outputPath": "DataProcessors/Календарь/Forms/Форма/Ext/Form.xml" }, + "validatePath": "DataProcessors/Календарь/Forms/Форма/Ext/Form.xml", + "input": { + "title": "Календарь", + "elements": [ + { "calendar": "Календарь", "path": "Дата", "titleLocation": "none", "selectionMode": "Interval", "showCurrentDate": false, "widthInMonths": 2, "events": { "OnActivateDate": "КалендарьПриАктивизацииДаты" } }, + { "calendar": "КалендарьМесяцы", "path": "ДатаМесяцы", "showMonthsPanel": true, "heightInMonths": 0 } + ], + "attributes": [ + { "name": "Объект", "type": "DataProcessorObject.Календарь", "main": true }, + { "name": "Дата", "type": "date" }, + { "name": "ДатаМесяцы", "type": "date" } + ] + } +} diff --git a/tests/skills/cases/form-compile/snapshots/calendar/Configuration.xml b/tests/skills/cases/form-compile/snapshots/calendar/Configuration.xml new file mode 100644 index 00000000..dc482e2b --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/Configuration.xml @@ -0,0 +1,252 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + UUID-014 + UUID-015 + + + + TestConfig + + + ru + TestConfig + + + + + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + + + + false + false + false + + + + + + + + + + + + + + + + + + + + + + Biometrics + true + + + Location + false + + + BackgroundLocation + false + + + BluetoothPrinters + false + + + WiFiPrinters + false + + + Contacts + false + + + Calendars + false + + + PushNotifications + false + + + LocalNotifications + false + + + InAppPurchases + false + + + PersonalComputerFileExchange + false + + + Ads + false + + + NumberDialing + false + + + CallProcessing + false + + + CallLog + false + + + AutoSendSMS + false + + + ReceiveSMS + false + + + SMSLog + false + + + Camera + false + + + Microphone + false + + + MusicLibrary + false + + + PictureAndVideoLibraries + false + + + AudioPlaybackAndVibration + false + + + BackgroundAudioPlaybackAndVibration + false + + + InstallPackages + false + + + OSBackup + true + + + ApplicationUsageStatistics + false + + + BarcodeScanning + false + + + BackgroundAudioRecording + false + + + AllFilesAccess + false + + + Videoconferences + false + + + NFC + false + + + DocumentScanning + false + + + SpeechToText + false + + + Geofences + false + + + IncomingShareRequests + false + + + AllIncomingShareRequestsTypesProcessing + false + + + + + + Normal + + + Language.Русский + + + + + + Managed + NotAutoFree + DontUse + DontUse + TaxiEnableVersion8_2 + DontUse + Version8_3_24 + + + + Русский + Календарь + + + \ No newline at end of file diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь.xml b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь.xml new file mode 100644 index 00000000..fb32a906 --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь.xml @@ -0,0 +1,34 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + + Календарь + + + ru + Календарь + + + + false + DataProcessor.Календарь.Form.Форма + + false + + + + +
Форма
+
+
+
diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Ext/ManagerModule.bsl b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Ext/ManagerModule.bsl new file mode 100644 index 00000000..e69de29b diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Ext/ObjectModule.bsl b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Ext/ObjectModule.bsl new file mode 100644 index 00000000..e69de29b diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма.xml b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма.xml new file mode 100644 index 00000000..dffeea01 --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма.xml @@ -0,0 +1,22 @@ + + +
+ + Форма + + + ru + Форма + + + + Managed + false + + PlatformApplication + MobilePlatformApplication + + + +
+
\ No newline at end of file diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form.xml new file mode 100644 index 00000000..a1a5b1bb --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form.xml @@ -0,0 +1,68 @@ + +
+ + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Календарь</v8:content> + </v8:item> + + false + + + + Дата + None + Interval + false + 2 + + + + КалендарьПриАктивизацииДаты + + + + ДатаМесяцы + 0 + true + + + + + + + + cfg:DataProcessorObject.Календарь + + true + + + + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Дата</v8:content> + </v8:item> + + + xs:dateTime + + Date + + + + + + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Дата месяцы</v8:content> + </v8:item> + + + xs:dateTime + + Date + + + + + diff --git a/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form/Module.bsl b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form/Module.bsl new file mode 100644 index 00000000..8ead4cec --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/DataProcessors/Календарь/Forms/Форма/Ext/Form/Module.bsl @@ -0,0 +1,19 @@ +#Область ОбработчикиСобытийФормы + +#КонецОбласти + +#Область ОбработчикиСобытийЭлементовФормы + +#КонецОбласти + +#Область ОбработчикиКомандФормы + +#КонецОбласти + +#Область ОбработчикиОповещений + +#КонецОбласти + +#Область СлужебныеПроцедурыИФункции + +#КонецОбласти \ No newline at end of file diff --git a/tests/skills/cases/form-compile/snapshots/calendar/Ext/ClientApplicationInterface.xml b/tests/skills/cases/form-compile/snapshots/calendar/Ext/ClientApplicationInterface.xml new file mode 100644 index 00000000..3c1161b2 --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/form-compile/snapshots/calendar/Languages/Русский.xml b/tests/skills/cases/form-compile/snapshots/calendar/Languages/Русский.xml new file mode 100644 index 00000000..37c60d78 --- /dev/null +++ b/tests/skills/cases/form-compile/snapshots/calendar/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file