feat(Storybook): Simple checkBox-based selector useful in SB pages

This commit is contained in:
Michał Cieślak 2024-06-13 13:59:15 +02:00 committed by Michał
parent 6cfef32204
commit 3aa48b0549
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Core.Utils 0.1
import utils 1.0
Flow {
id: root
property alias model: repeater.model
property var selection: []
property bool initialSelection
Repeater {
id: repeater
function update() {
const selection = []
for (let i = 0; i < repeater.count; i++) {
const item = repeater.itemAt(i)
if (!!item && item.checked)
selection.push(item.text)
}
root.selection = selection
}
CheckBox {
text: modelData
checked: root.initialSelection
onToggled: repeater.update()
}
onItemAdded: update()
}
}

View File

@ -1,3 +1,4 @@
CheckBoxFlowSelector 1.0 CheckBoxFlowSelector.qml
CompilationErrorsBox 1.0 CompilationErrorsBox.qml CompilationErrorsBox 1.0 CompilationErrorsBox.qml
FigmaImagesProxyModel 1.0 FigmaImagesProxyModel.qml FigmaImagesProxyModel 1.0 FigmaImagesProxyModel.qml
FigmaLinksCache 1.0 FigmaLinksCache.qml FigmaLinksCache 1.0 FigmaLinksCache.qml