-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] @prizm-ui/components - pass context as $implicit to templates #291
Labels
estimate:sp2
priority:middle
Tag: priority:middle — Denotes tasks or issues with a moderate level of importance. These items shou
source:idp
issue from IDP
state:ready
ready for release (pass tested)
term:2024
type:feature
Milestone
Comments
ZurabDev
modified the milestones:
2.1.3,
2.1.4-next.1,
2.1.4-next.2,
2.1.4-next.3,
next
Jul 31, 2023
ZurabDev
added
the
priority:low
"Tag: priority:low — Indicates tasks or issues that have a low urgency. These items are not critical
label
Oct 6, 2023
ZurabDev
added
type:bc
breacking_changes
term:2024
and removed
state:in_progress
We work on this issue
labels
Oct 6, 2023
alexhawkins94
added
priority:middle
Tag: priority:middle — Denotes tasks or issues with a moderate level of importance. These items shou
and removed
priority:low
"Tag: priority:low — Indicates tasks or issues that have a low urgency. These items are not critical
labels
Feb 5, 2024
ZurabDev
added a commit
that referenced
this issue
Mar 6, 2024
Merged
ZurabDev
changed the title
[BUG] @prizm-ui/components - prizmHint модифицирует переданный контекст при создании представления из шаблона
[FEATURE] @prizm-ui/components - pass context as $implicit to templates
Mar 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
estimate:sp2
priority:middle
Tag: priority:middle — Denotes tasks or issues with a moderate level of importance. These items shou
source:idp
issue from IDP
state:ready
ready for release (pass tested)
term:2024
type:feature
Библиотека
@prizm-ui/core
@prizm-ui/components
@prizm-ui/install
@prizm-ui/icons
@prizm-ui/flag-icons
@prizm-ui/theme
@prizm-ui/charts
@prizm-ui/ast
@prizm-ui/nx-plugin
Компонент
PrizmHint, PrzimTooltip
Описание проблемы
При передаче контекста в
[prizmHint]="someTemplate"
через[prizmHintContext]
шаблон создается с контекстом, отличным от того, который указал пользователь.Делаю задачу
Примерный реальный кейс - необходимо реализовать тултип для ячеек таблицы, содержимое зависит от значения в строке.
предположим, имеется
Array<Item>
,interface Item { name: string, description: string }
Создаем лист:
Ожидаю, что пример выше работает (контекст, переданный в шаблон - соответствует контексту, с которым шаблон инстанциирован)
Есть проблема следующего характера:
prizmHint
, а не при каждом открытии (не кейс для простого примера, представленного выше)$implicit
значение из контекста в переменнуюctx
шаблона. Шаблон создается со значением контекста специфичным для директивы (prizmHint
,prizmTooltip
) - эти данные, возможно, нужны для позиционирования overlay, но не для целевого шаблона (возможно, имеет смысл их присваивать в служебное поле контекста, но не наоборот) . Непосредственно переданный контекст содержится в поле "context", т.е. рабочий сетап мог бы быть<ng-template #hint let-ctx="context.$implicit">
, что выглядит неуклюже. Также, разработчик может не иметь доступа к шаблону чтобы модифицировать его, или же шаблон может использовать в разных контекстах (не внутри хинта) - что приводит к тому, что шаблон инстанциируется с различным значением контекста, в зависимости от директивы с которой он используется => приводит к ограничениям переиспользования пользовательских шаблонов\компонентовОжидание\предложение:
PolymorphContent
(PolymorphComponent
,TemplateRef
) должны создаваться точно с тем контекстом, переданным в поле контекст ([prizmHintContext]
в случаеprizmHint
).[prizmHintContext]
должен соответсвовать тому что в него передают (any\unknown
). Сейчас используетсяRecord<string, unknown>
что ограничивает пользователей.[prizmTooltip]
полеprizmHintContext
переименовано вprizmTooltipContext
(но доступно т.к. используется наследование)The text was updated successfully, but these errors were encountered: