Added "column-span-all" property

This commit is contained in:
anoshenko 2023-01-03 14:56:57 +03:00
parent c7a7b3ed1e
commit 01e2e2e00b
8 changed files with 58 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# v.11.0
* Added "tabindex", "order", "column-fill", "background-blend-mode", and "mix-blend-mode" properties
* Added GetTabIndex, GetOrder, GetColumnFill, GetBackgroundBlendMode, and GetMixBlendMode functions
* Added "tabindex", "order", "column-fill", "column-span-all", "background-blend-mode", and "mix-blend-mode" properties
* Added GetTabIndex, GetOrder, GetColumnFill, IsColumnSpanAll, GetBackgroundBlendMode, and GetMixBlendMode functions
* ClientItem, SetClientItem, and RemoveAllClientItems method added to Session interface
* PropertyWithTag method of DataObject interface renamed to PropertyByTag

View File

@ -2603,6 +2603,20 @@ ViewBorder описана как
func GetAvoidBreak(view View, subviewID ...string) bool
### Свойство "column-span-all"
Свойство "column-span-all" (константа ColumnSpanAll) типа bool устанавливается для View помещенных в ColumnLayout.
Если данное свойство установлено в true, то View расширяется на всю ширину ColumnLayout, занимая все колонки.
Такое View будет как бы разрывать контейнер.
Обычно данное свойство используется для заголовков.
Значение по умолчанию "false".
Получить значение данного свойства можно с помощью функции
func IsColumnSpanAll(view View, subviewID ...string) bool
## StackLayout
StackLayout является контейнером, реализующим интерфейс ViewsContainer. Все дочерние View

View File

@ -2579,6 +2579,20 @@ You can get the value of this property using the function
func GetAvoidBreak(view View, subviewID ...string) bool
### "column-span-all" property
The "column-span-all" bool property (ColumnSpanAll constant) is set for Views placed in the ColumnLayout.
If this property is set to true, then the View expands to the full width of the ColumnLayout, covering all columns.
Such a View will, as it were, break the container.
Typically, this property is used for headers.
The default value is "false".
You can get the value of this property using the function
func IsColumnSpanAll(view View, subviewID ...string) bool
## StackLayout
StackLayout is a container that implements the ViewsContainer interface.

View File

@ -426,6 +426,7 @@ function mouseOutEvent(element, event) {
function clickEvent(element, event) {
mouseEvent(element, event, "click-event")
event.preventDefault();
event.stopPropagation();
}
function doubleClickEvent(element, event) {

View File

@ -46,6 +46,10 @@ const (
// * ColumnFillBalance (0) - Content is equally divided between columns (default value);
// * ColumnFillAuto (1) - Columns are filled sequentially. Content takes up only the room it needs, possibly resulting in some columns remaining empty.
ColumnFill = "column-fill"
// ColumnSpanAll is the constant for the "column-span-all" property tag.
// The "column-span-all" bool property makes it possible for a view to span across all columns when its value is set to true.
ColumnSpanAll = "column-span-all"
)
// ColumnLayout - grid-container of View
@ -226,3 +230,9 @@ func GetColumnSeparatorColor(view View, subviewID ...string) Color {
func GetColumnFill(view View, subviewID ...string) int {
return enumStyledProperty(view, subviewID, ColumnFill, ColumnFillBalance, true)
}
// IsColumnSpanAll returns a "column-span-all" property value of the subview.
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func IsColumnSpanAll(view View, subviewID ...string) bool {
return boolStyledProperty(view, subviewID, ColumnSpanAll, false)
}

View File

@ -63,6 +63,7 @@ var boolProperties = []string{
TabCloseButton,
Repeating,
UserSelect,
ColumnSpanAll,
}
var intProperties = []string{

View File

@ -626,6 +626,14 @@ func viewPropertyChanged(view *viewData, tag string) {
session.updateCSSProperty(htmlID, "user-select", "")
}
return
case ColumnSpanAll:
if spanAll, ok := boolProperty(view, ColumnSpanAll, session); ok && spanAll {
session.updateCSSProperty(htmlID, `column-span`, `all`)
} else {
session.updateCSSProperty(htmlID, `column-span`, `none`)
}
return
}
if cssTag, ok := sizeProperties[tag]; ok {

View File

@ -453,6 +453,14 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
builder.add(`animation-play-state`, `running`)
}
}
if spanAll, ok := boolProperty(style, ColumnSpanAll, session); ok {
if spanAll {
builder.add(`column-span`, `all`)
} else {
builder.add(`column-span`, `none`)
}
}
}
func valueToOrientation(value any, session Session) (int, bool) {