feat(grid): add select/combo editor types for category products inline edit#157
Open
Ibochkarev wants to merge 2 commits intobetafrom
Open
feat(grid): add select/combo editor types for category products inline edit#157Ibochkarev wants to merge 2 commits intobetafrom
Ibochkarev wants to merge 2 commits intobetafrom
Conversation
…e edit - Add editor_type: select with editor_options for static options (e.g. made_in) - Add editor_type: combo with editor_combo_endpoint for API-loaded options (e.g. vendor_id) - Validate editor_combo_endpoint when combo type is selected - Add showClear for combo Select to allow clearing nullable fields - Toast notification on combo options load failure - Lexicons: editor_type_select, editor_type_combo, editor_options, editor_combo_endpoint, editor_combo_endpoint_required, combo_options_load_failed Refs #155
e54131b to
c534194
Compare
…ons API
- API: getVendors adds options [{value,label}], keeps vendors for BC
- GridEditorReferenceRegistry + GridColumnEditorType; GridConfigService validation
- GET grid-config: editor_references for category-products
- Vue: useCategoryProductsInlineEdit, gridEditorOptions, gridColumnEditorTypes
- GridFieldsConfig: editor_reference + allowlisted override URL; lexicons ru/en
- CHANGELOG
Refs #155
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Добавлена поддержка select и combo для inline-редактирования в таблице товаров категории (closes #155). Базовая реализация расширяет PR #134; поверх первоначального коммита выполнен архитектурный рефакторинг (единый контракт опций, реестр справочников, composable).
Select (статические опции)
editor_type: 'select'в конфиге колонкиeditor_options: [{ label, value }, ...]Selectсoption-value="value"/option-label="label"Combo (опции из API)
editor_type: 'combo'editor_reference— ключ из серверного реестра (напримерvendors→ путь к API)editor_combo_endpoint(опционально) — переопределение URL только если путь в белом списке (префикс/api/mgr/references/)editor_reference. Должен быть задан reference или allowlisted endpoint (валидация при сохранении вGridFieldsConfigи на бэкенде)API и контракт данных
GET .../references/vendorsдополняет ответ массивомoptions: [{ value, label }]; полеvendorsсохранено для обратной совместимости{ value, label }[](toSelectOptionsFromReferencesResponse)Бэкенд
GridEditorReferenceRegistry— whitelist ключ → путь, проверка allowlist для overrideGridColumnEditorType— константы типов редактора (text,number,select,combo)GridConfigService— сохранениеeditor_reference,editor_combo_endpoint, очистка combo-полей при смене типаGridConfigController— в ответе конфига дляcategory-productsпередаётсяeditor_referencesдля UIФронтенд (vueManager)
useCategoryProductsInlineEdit— состояние inline-edit, загрузка combo, сохранениеutils/gridEditorOptions.js— чистые функции: allowlist URL, резолв URL, маппинг ответа API → опцииconstants/gridColumnEditorTypes.js— замороженный объект +normalizeGridColumnEditorType/ хелперыCategoryProductsGrid— подключение composable, одинSelectдля select+comboGridFieldsConfig— выбор reference, поле override URL, лексиконы ru/enТип изменений
editor_combo_endpointпродолжают работать как override)Связанные Issues
Closes #155
Как протестировано
Сценарии:
editor_type: selectи JSONeditor_optionseditor_reference: vendorsбез overrideeditor_combo_endpointshowClearдля nullable combo-полейЧеклист
Дополнительно
ProductDataService::$allowedUpdateFieldsпо-прежнему должен включать редактируемые поля (напримерvendor_id,made_in).