Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
88
vendor/filament/widgets/resources/css/chart-widget.css
vendored
Normal file
88
vendor/filament/widgets/resources/css/chart-widget.css
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
.fi-wi-chart {
|
||||
& .fi-wi-chart-frame {
|
||||
@apply mx-auto flex w-full items-center justify-center;
|
||||
|
||||
&:not(.fi-wi-chart-frame-no-aspect-ratio) {
|
||||
@apply aspect-square;
|
||||
}
|
||||
}
|
||||
|
||||
@supports (container-type: inline-size) {
|
||||
& .fi-section-content {
|
||||
@apply @container;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-frame:not(.fi-wi-chart-frame-no-aspect-ratio) {
|
||||
@apply @sm:aspect-[1.5];
|
||||
}
|
||||
}
|
||||
|
||||
@supports not (container-type: inline-size) {
|
||||
& .fi-wi-chart-frame:not(.fi-wi-chart-frame-no-aspect-ratio) {
|
||||
@apply sm:aspect-[1.5];
|
||||
}
|
||||
}
|
||||
|
||||
& .fi-wi-chart-filter {
|
||||
&.fi-input-wrp {
|
||||
@apply w-max sm:-my-2;
|
||||
}
|
||||
|
||||
&.fi-dropdown {
|
||||
& .fi-wi-chart-filter-content {
|
||||
@apply grid gap-y-4 p-6;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-filter-content-actions-ctn {
|
||||
@apply flex gap-3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& .fi-color {
|
||||
& .fi-wi-chart-bg-color {
|
||||
@apply text-color-50 dark:text-color-400/10;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-border-color {
|
||||
@apply text-color-500 dark:text-color-400;
|
||||
}
|
||||
}
|
||||
|
||||
& .fi-wi-chart-bg-color {
|
||||
@apply text-gray-100 dark:text-gray-800;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-border-color {
|
||||
@apply text-gray-400;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-grid-color {
|
||||
@apply text-gray-200 dark:text-gray-800;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-text-color {
|
||||
@apply text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
/* Tooltips are painted onto the canvas, so these three elements are the only way to
|
||||
color them. Their values are Chart.js' own tooltip colors rather than Filament
|
||||
palette values, which is why they are written out longhand instead of `@apply`.
|
||||
The border only appears once `--chart-tooltip-border-width` is set, so its
|
||||
color defaults to a hairline that suits the background above it. */
|
||||
& .fi-wi-chart-tooltip-bg-color {
|
||||
color: rgb(0 0 0 / 0.8);
|
||||
}
|
||||
|
||||
& .fi-wi-chart-tooltip-text-color {
|
||||
color: rgb(255 255 255);
|
||||
}
|
||||
|
||||
& .fi-wi-chart-tooltip-border-color {
|
||||
color: rgb(255 255 255 / 0.2);
|
||||
}
|
||||
|
||||
& .fi-empty-state {
|
||||
@apply p-0;
|
||||
}
|
||||
}
|
||||
3
vendor/filament/widgets/resources/css/index.css
vendored
Normal file
3
vendor/filament/widgets/resources/css/index.css
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@import './chart-widget.css' layer(components);
|
||||
@import './stats-overview-widget.css' layer(components);
|
||||
@import './widget.css' layer(components);
|
||||
67
vendor/filament/widgets/resources/css/stats-overview-widget.css
vendored
Normal file
67
vendor/filament/widgets/resources/css/stats-overview-widget.css
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
.fi-wi-stats-overview-stat {
|
||||
@apply focus-visible:ring-primary-600 dark:focus-visible:ring-primary-500 relative block h-full rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5 outline-none focus-visible:ring-2 dark:bg-gray-900 dark:ring-white/10;
|
||||
|
||||
& .fi-icon {
|
||||
@apply shrink-0 text-gray-400 dark:text-gray-500;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-content {
|
||||
@apply grid gap-y-2;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-label-ctn {
|
||||
@apply flex items-center gap-x-2;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-label {
|
||||
@apply text-sm font-medium text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-value {
|
||||
/* Tabular figures: stat values are near-always numeric, and polled
|
||||
widgets would otherwise reflow as digit widths change. */
|
||||
@apply text-3xl font-semibold tracking-tight text-gray-950 tabular-nums dark:text-white;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-placeholder {
|
||||
@apply text-3xl font-medium text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-description {
|
||||
@apply flex items-center gap-x-1 text-sm text-gray-500 dark:text-gray-400;
|
||||
|
||||
&.fi-color {
|
||||
@apply text-(--text) dark:text-(--dark-text);
|
||||
|
||||
& .fi-icon {
|
||||
@apply text-color-500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-chart {
|
||||
@apply absolute inset-x-0 bottom-0 overflow-hidden rounded-b-xl;
|
||||
|
||||
& > canvas {
|
||||
@apply h-6;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-chart-bg-color {
|
||||
@apply text-gray-100 dark:text-gray-800;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-chart-border-color {
|
||||
@apply text-gray-400;
|
||||
}
|
||||
|
||||
&.fi-color {
|
||||
& .fi-wi-stats-overview-stat-chart-bg-color {
|
||||
@apply text-color-50 dark:text-color-400/10;
|
||||
}
|
||||
|
||||
& .fi-wi-stats-overview-stat-chart-border-color {
|
||||
@apply text-color-500 dark:text-color-400;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
vendor/filament/widgets/resources/css/widget.css
vendored
Normal file
3
vendor/filament/widgets/resources/css/widget.css
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.fi-wi {
|
||||
@apply gap-6;
|
||||
}
|
||||
434
vendor/filament/widgets/resources/js/components/chart.js
vendored
Normal file
434
vendor/filament/widgets/resources/js/components/chart.js
vendored
Normal file
|
|
@ -0,0 +1,434 @@
|
|||
import Chart from 'chart.js/auto'
|
||||
import { color } from 'chart.js/helpers'
|
||||
import 'chartjs-adapter-luxon'
|
||||
import readCustomProperties from '../custom-properties'
|
||||
|
||||
const darken = (value, amount) => {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((entry) => darken(entry, amount))
|
||||
}
|
||||
|
||||
const parsed = color(value)
|
||||
|
||||
return parsed.valid ? parsed.darken(amount).rgbString() : value
|
||||
}
|
||||
|
||||
if (
|
||||
window.filamentChartJsGlobalPlugins &&
|
||||
Array.isArray(window.filamentChartJsGlobalPlugins) &&
|
||||
window.filamentChartJsGlobalPlugins.length > 0
|
||||
) {
|
||||
Chart.register(...window.filamentChartJsGlobalPlugins)
|
||||
}
|
||||
|
||||
Chart.defaults.plugins.legend.position = 'bottom'
|
||||
|
||||
export default function chart({ cachedData, options, type }) {
|
||||
return {
|
||||
userBackgroundColor: options?.backgroundColor,
|
||||
userBorderColor: options?.borderColor,
|
||||
userTextColor: options?.color,
|
||||
userPointBackgroundColor: options?.pointBackgroundColor,
|
||||
userXGridColor: options?.scales?.x?.grid?.color,
|
||||
userYGridColor: options?.scales?.y?.grid?.color,
|
||||
userRadialGridColor: options?.scales?.r?.grid?.color,
|
||||
userRadialTicksColor: options?.scales?.r?.ticks?.color,
|
||||
userTooltipBackgroundColor: options?.plugins?.tooltip?.backgroundColor,
|
||||
userTooltipTitleColor: options?.plugins?.tooltip?.titleColor,
|
||||
userTooltipBodyColor: options?.plugins?.tooltip?.bodyColor,
|
||||
userTooltipBorderColor: options?.plugins?.tooltip?.borderColor,
|
||||
userLineTension: options?.tension,
|
||||
userPointStyle: options?.pointStyle,
|
||||
userBarBorderRadius: options?.borderRadius,
|
||||
userTooltipCornerRadius: options?.plugins?.tooltip?.cornerRadius,
|
||||
userTooltipBorderWidth: options?.plugins?.tooltip?.borderWidth,
|
||||
userLegendBorderRadius: options?.plugins?.legend?.labels?.borderRadius,
|
||||
userLegendUseBorderRadius:
|
||||
options?.plugins?.legend?.labels?.useBorderRadius,
|
||||
userLegendBoxWidth: options?.plugins?.legend?.labels?.boxWidth,
|
||||
userBorderWidth: options?.borderWidth,
|
||||
userPointRadius: options?.pointRadius,
|
||||
|
||||
init() {
|
||||
this.$wire.$on('updateChartData', ({ data }) =>
|
||||
this.updateChartData(data),
|
||||
)
|
||||
|
||||
Alpine.effect(() => {
|
||||
Alpine.store('theme')
|
||||
|
||||
this.$nextTick(() => this.updateChartTheme())
|
||||
})
|
||||
|
||||
this.systemThemeMediaQuery = window.matchMedia(
|
||||
'(prefers-color-scheme: dark)',
|
||||
)
|
||||
this.systemThemeListener = () => {
|
||||
if (Alpine.store('theme') !== 'system') {
|
||||
return
|
||||
}
|
||||
|
||||
this.$nextTick(() => this.updateChartTheme())
|
||||
}
|
||||
this.systemThemeMediaQuery.addEventListener(
|
||||
'change',
|
||||
this.systemThemeListener,
|
||||
)
|
||||
|
||||
// Defer `initChart()` to `$nextTick` so the `Alpine.effect` above runs its
|
||||
// mandatory first invocation before the chart exists. `updateChartTheme()` then
|
||||
// exits early on that first run; otherwise the effect would tear down and
|
||||
// recreate the chart on every mount.
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
|
||||
this.resizeObserver = new ResizeObserver(() =>
|
||||
this.getChart()?.resize(),
|
||||
)
|
||||
this.resizeObserver.observe(this.$el)
|
||||
|
||||
this.dprChangeHandler = Alpine.debounce(
|
||||
() => this.handleDprChange(),
|
||||
250,
|
||||
)
|
||||
window.addEventListener('resize', this.dprChangeHandler)
|
||||
})
|
||||
},
|
||||
|
||||
initChart() {
|
||||
if (
|
||||
!this.$refs.canvas ||
|
||||
!this.$refs.backgroundColorElement ||
|
||||
!this.$refs.borderColorElement ||
|
||||
!this.$refs.textColorElement ||
|
||||
!this.$refs.gridColorElement
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const fontFamily = getComputedStyle(this.$el).fontFamily
|
||||
const hasMaxHeight = this.$refs.canvas.style.maxHeight !== '100%'
|
||||
|
||||
options ??= {}
|
||||
options.animation ??= {}
|
||||
options.animation.duration ??= 0
|
||||
options.font ??= {}
|
||||
options.font.family ??= fontFamily
|
||||
options.responsive ??= false
|
||||
options.maintainAspectRatio ??= hasMaxHeight
|
||||
options.pointHitRadius ??= 4
|
||||
options.scales ??= {}
|
||||
options.scales.x ??= {}
|
||||
options.scales.x.border ??= {}
|
||||
options.scales.x.border.display ??= false
|
||||
options.scales.x.grid ??= {}
|
||||
options.scales.x.grid.display ??= false
|
||||
options.scales.y ??= {}
|
||||
options.scales.y.border ??= {}
|
||||
options.scales.y.border.display ??= false
|
||||
options.scales.y.grid ??= {}
|
||||
|
||||
if (['doughnut', 'pie', 'polarArea'].includes(type)) {
|
||||
options.scales.x.display ??= false
|
||||
options.scales.y.display ??= false
|
||||
options.scales.y.grid.display ??= false
|
||||
|
||||
options.elements ??= {}
|
||||
options.elements.arc ??= {}
|
||||
|
||||
options.plugins ??= {}
|
||||
options.plugins.legend ??= {}
|
||||
options.plugins.legend.labels ??= {}
|
||||
options.plugins.legend.labels.generateLabels ??= (chart) => {
|
||||
const labels =
|
||||
Chart.overrides[
|
||||
type
|
||||
].plugins.legend.labels.generateLabels(chart)
|
||||
|
||||
for (const label of labels) {
|
||||
label.strokeStyle = darken(label.fillStyle, 0.2)
|
||||
}
|
||||
|
||||
return labels
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'polarArea') {
|
||||
options.scales.r ??= {}
|
||||
options.scales.r.grid ??= {}
|
||||
options.scales.r.ticks ??= {}
|
||||
options.scales.r.ticks.backdropColor ??= 'transparent'
|
||||
}
|
||||
|
||||
this.applyChartColors(options)
|
||||
this.applyChartCustomProperties(options)
|
||||
this.normalizeDatasets(cachedData)
|
||||
|
||||
new Chart(this.$refs.canvas, {
|
||||
type,
|
||||
data: cachedData,
|
||||
options,
|
||||
plugins: window.filamentChartJsPlugins ?? [],
|
||||
})
|
||||
},
|
||||
|
||||
updateChartData(newData) {
|
||||
const chart = this.getChart()
|
||||
|
||||
if (!chart) {
|
||||
return
|
||||
}
|
||||
|
||||
this.normalizeDatasets(newData)
|
||||
chart.data = newData
|
||||
chart.update('resize')
|
||||
},
|
||||
|
||||
normalizeDatasets(data) {
|
||||
for (const dataset of data?.datasets ?? []) {
|
||||
if (type === 'bar' && dataset.backgroundColor !== undefined) {
|
||||
dataset.borderColor ??= darken(dataset.backgroundColor, 0.2)
|
||||
dataset.hoverBorderColor ??= darken(
|
||||
dataset.backgroundColor,
|
||||
0.3,
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
type === 'scatter' &&
|
||||
dataset.backgroundColor !== undefined
|
||||
) {
|
||||
dataset.borderColor ??= dataset.backgroundColor
|
||||
}
|
||||
|
||||
if (
|
||||
['line', 'scatter'].includes(type) &&
|
||||
dataset.borderColor !== undefined
|
||||
) {
|
||||
dataset.pointBackgroundColor ??= dataset.borderColor
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateChartTheme() {
|
||||
const chart = this.getChart()
|
||||
|
||||
if (!chart) {
|
||||
return
|
||||
}
|
||||
|
||||
this.applyChartColors(chart.options)
|
||||
this.applyChartCustomProperties(chart.options)
|
||||
|
||||
// Not `'none'`: that is one of Chart.js' "direct update" modes, which reuse a
|
||||
// cached snapshot of the options shared between a dataset's elements instead of
|
||||
// refreshing it. Every per-element option - bar and arc colors, point colors,
|
||||
// point radius and style - would keep the value it was built with. `'resize'`
|
||||
// refreshes them, and its transition is already zero-duration, so nothing
|
||||
// animates. It is the mode `updateChartData()` uses for the same reason.
|
||||
chart.update('resize')
|
||||
},
|
||||
|
||||
applyChartColors(options) {
|
||||
const {
|
||||
backgroundColor,
|
||||
borderColor,
|
||||
textColor,
|
||||
gridColor,
|
||||
tooltipBackgroundColor,
|
||||
tooltipTextColor,
|
||||
tooltipBorderColor,
|
||||
} = this.getChartColors()
|
||||
|
||||
const resolvedBorderColor = this.userBorderColor ?? borderColor
|
||||
|
||||
options.backgroundColor =
|
||||
this.userBackgroundColor ?? backgroundColor
|
||||
options.borderColor = resolvedBorderColor
|
||||
options.color = this.userTextColor ?? textColor
|
||||
options.pointBackgroundColor =
|
||||
this.userPointBackgroundColor ?? resolvedBorderColor
|
||||
|
||||
options.elements ??= {}
|
||||
options.elements.bar ??= {}
|
||||
options.elements.bar.borderColor = resolvedBorderColor
|
||||
|
||||
// The tooltip color elements arrived after the others, so a published copy of
|
||||
// the view may not have them; without them Chart.js keeps its own colors.
|
||||
if (this.$refs.tooltipBackgroundColorElement) {
|
||||
options.plugins ??= {}
|
||||
options.plugins.tooltip ??= {}
|
||||
options.plugins.tooltip.backgroundColor =
|
||||
this.userTooltipBackgroundColor ?? tooltipBackgroundColor
|
||||
options.plugins.tooltip.titleColor =
|
||||
this.userTooltipTitleColor ?? tooltipTextColor
|
||||
options.plugins.tooltip.bodyColor =
|
||||
this.userTooltipBodyColor ?? tooltipTextColor
|
||||
options.plugins.tooltip.borderColor =
|
||||
this.userTooltipBorderColor ?? tooltipBorderColor
|
||||
}
|
||||
|
||||
if (['doughnut', 'pie', 'polarArea'].includes(type)) {
|
||||
options.elements.arc ??= {}
|
||||
options.elements.arc.borderColor =
|
||||
this.getSurroundingBackgroundColor()
|
||||
}
|
||||
|
||||
options.scales.x.grid.color = this.userXGridColor ?? gridColor
|
||||
options.scales.y.grid.color = this.userYGridColor ?? gridColor
|
||||
|
||||
if (type === 'polarArea') {
|
||||
options.scales.r.grid.color =
|
||||
this.userRadialGridColor ?? gridColor
|
||||
options.scales.r.ticks.color =
|
||||
this.userRadialTicksColor ?? textColor
|
||||
}
|
||||
},
|
||||
|
||||
handleDprChange() {
|
||||
const chart = this.getChart()
|
||||
|
||||
if (!chart) {
|
||||
return
|
||||
}
|
||||
|
||||
if (chart.currentDevicePixelRatio !== window.devicePixelRatio) {
|
||||
chart.resize()
|
||||
}
|
||||
},
|
||||
|
||||
getChart() {
|
||||
if (!this.$refs.canvas) {
|
||||
return null
|
||||
}
|
||||
|
||||
return Chart.getChart(this.$refs.canvas)
|
||||
},
|
||||
|
||||
getSurroundingBackgroundColor() {
|
||||
let element = this.$el.parentElement
|
||||
|
||||
while (element) {
|
||||
const backgroundColor =
|
||||
getComputedStyle(element).backgroundColor
|
||||
|
||||
if (
|
||||
backgroundColor &&
|
||||
backgroundColor !== 'rgba(0, 0, 0, 0)' &&
|
||||
backgroundColor !== 'transparent'
|
||||
) {
|
||||
return backgroundColor
|
||||
}
|
||||
|
||||
element = element.parentElement
|
||||
}
|
||||
|
||||
return '#ffffff'
|
||||
},
|
||||
|
||||
getChartColors() {
|
||||
const sentinelColor = (element) =>
|
||||
element ? getComputedStyle(element).color : null
|
||||
|
||||
return {
|
||||
backgroundColor: getComputedStyle(
|
||||
this.$refs.backgroundColorElement,
|
||||
).color,
|
||||
borderColor: getComputedStyle(this.$refs.borderColorElement)
|
||||
.color,
|
||||
textColor: getComputedStyle(this.$refs.textColorElement).color,
|
||||
gridColor: getComputedStyle(this.$refs.gridColorElement).color,
|
||||
tooltipBackgroundColor: sentinelColor(
|
||||
this.$refs.tooltipBackgroundColorElement,
|
||||
),
|
||||
tooltipTextColor: sentinelColor(
|
||||
this.$refs.tooltipTextColorElement,
|
||||
),
|
||||
tooltipBorderColor: sentinelColor(
|
||||
this.$refs.tooltipBorderColorElement,
|
||||
),
|
||||
}
|
||||
},
|
||||
|
||||
applyChartCustomProperties(options) {
|
||||
const {
|
||||
lineTension,
|
||||
pointStyle,
|
||||
barBorderRadius,
|
||||
tooltipCornerRadius,
|
||||
tooltipBorderWidth,
|
||||
legendBorderRadius,
|
||||
legendBoxWidth,
|
||||
borderWidth,
|
||||
pointRadius,
|
||||
} = this.getChartCustomProperties()
|
||||
|
||||
options.borderWidth = this.userBorderWidth ?? borderWidth
|
||||
options.tension = this.userLineTension ?? lineTension
|
||||
options.pointStyle = this.userPointStyle ?? pointStyle
|
||||
options.pointRadius = this.userPointRadius ?? pointRadius
|
||||
|
||||
if (type === 'bar') {
|
||||
options.borderRadius =
|
||||
this.userBarBorderRadius ?? barBorderRadius
|
||||
}
|
||||
|
||||
options.plugins ??= {}
|
||||
options.plugins.tooltip ??= {}
|
||||
options.plugins.tooltip.cornerRadius =
|
||||
this.userTooltipCornerRadius ?? tooltipCornerRadius
|
||||
options.plugins.tooltip.borderWidth =
|
||||
this.userTooltipBorderWidth ?? tooltipBorderWidth
|
||||
|
||||
const resolvedLegendBorderRadius =
|
||||
this.userLegendBorderRadius ?? legendBorderRadius
|
||||
|
||||
options.plugins.legend ??= {}
|
||||
options.plugins.legend.labels ??= {}
|
||||
options.plugins.legend.labels.borderRadius =
|
||||
resolvedLegendBorderRadius
|
||||
// Chart.js ignores the radius unless this is on, and treats a radius of `0` as
|
||||
// "inherit from the data" rather than "square", so it is derived rather than
|
||||
// exposed as a property of its own.
|
||||
options.plugins.legend.labels.useBorderRadius =
|
||||
this.userLegendUseBorderRadius ?? resolvedLegendBorderRadius > 0
|
||||
options.plugins.legend.labels.boxWidth =
|
||||
this.userLegendBoxWidth ?? legendBoxWidth
|
||||
},
|
||||
|
||||
// The parts of a chart that a stylesheet cannot otherwise reach, since Chart.js
|
||||
// paints them onto a bare `<canvas>`. This covers the static appearance of what is
|
||||
// painted, including everything Filament pins to a value of its own; how a chart
|
||||
// behaves - animation, hit areas, which scales it shows - belongs in `getOptions()`.
|
||||
// Each fallback is the default it stands in for: Chart.js' own, except where the
|
||||
// panel's design language asks for something else. Bars and legend swatches are
|
||||
// slightly rounded, since nothing else in Filament has square corners, and the
|
||||
// tooltip's `4` is the radius `tippy.js` gives every other tooltip in a panel.
|
||||
getChartCustomProperties() {
|
||||
const { number, keyword } = readCustomProperties(this.$el)
|
||||
|
||||
return {
|
||||
lineTension: number('--chart-line-tension', 0),
|
||||
pointStyle: keyword('--chart-point-style', 'circle'),
|
||||
barBorderRadius: number('--chart-bar-border-radius', 2),
|
||||
tooltipCornerRadius: number('--chart-tooltip-corner-radius', 4),
|
||||
tooltipBorderWidth: number('--chart-tooltip-border-width', 0),
|
||||
legendBorderRadius: number('--chart-legend-border-radius', 2),
|
||||
legendBoxWidth: number('--chart-legend-box-width', 12),
|
||||
borderWidth: number('--chart-border-width', 2),
|
||||
pointRadius: number('--chart-point-radius', 2),
|
||||
}
|
||||
},
|
||||
|
||||
destroy() {
|
||||
this.resizeObserver?.disconnect()
|
||||
this.dprChangeHandler &&
|
||||
window.removeEventListener('resize', this.dprChangeHandler)
|
||||
this.systemThemeMediaQuery?.removeEventListener(
|
||||
'change',
|
||||
this.systemThemeListener,
|
||||
)
|
||||
this.getChart()?.destroy()
|
||||
},
|
||||
}
|
||||
}
|
||||
197
vendor/filament/widgets/resources/js/components/stats-overview/stat/chart.js
vendored
Normal file
197
vendor/filament/widgets/resources/js/components/stats-overview/stat/chart.js
vendored
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
import {
|
||||
CategoryScale,
|
||||
Chart,
|
||||
Filler,
|
||||
LineController,
|
||||
LineElement,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
} from 'chart.js'
|
||||
|
||||
import readCustomProperties from '../../../custom-properties'
|
||||
|
||||
Chart.register(
|
||||
CategoryScale,
|
||||
Filler,
|
||||
LineController,
|
||||
LineElement,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
)
|
||||
|
||||
export default function statsOverviewStatChart({ key, labels, values }) {
|
||||
return {
|
||||
key,
|
||||
|
||||
init() {
|
||||
this.$wire.$on('updateStatsOverviewChartData', (event) => {
|
||||
if (event.key === this.key) {
|
||||
this.updateChartData(event.data)
|
||||
}
|
||||
})
|
||||
|
||||
Alpine.effect(() => {
|
||||
Alpine.store('theme')
|
||||
|
||||
this.$nextTick(() => this.updateChartTheme())
|
||||
})
|
||||
|
||||
this.systemThemeMediaQuery = window.matchMedia(
|
||||
'(prefers-color-scheme: dark)',
|
||||
)
|
||||
this.systemThemeListener = () => {
|
||||
if (Alpine.store('theme') !== 'system') {
|
||||
return
|
||||
}
|
||||
|
||||
this.$nextTick(() => this.updateChartTheme())
|
||||
}
|
||||
this.systemThemeMediaQuery.addEventListener(
|
||||
'change',
|
||||
this.systemThemeListener,
|
||||
)
|
||||
|
||||
// Defer `initChart()` to `$nextTick` so the `Alpine.effect` above runs its
|
||||
// mandatory first invocation before the chart exists. `updateChartTheme()` then
|
||||
// exits early on that first run.
|
||||
this.$nextTick(() => this.initChart())
|
||||
},
|
||||
|
||||
initChart() {
|
||||
if (
|
||||
!this.$refs.canvas ||
|
||||
!this.$refs.backgroundColorElement ||
|
||||
!this.$refs.borderColorElement
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// Defensively tear down any pre-existing chart bound to this canvas before
|
||||
// constructing a new one (the canvas is reused if the component re-initializes).
|
||||
this.getChart()?.destroy()
|
||||
|
||||
const { backgroundColor, borderColor } = this.getChartColors()
|
||||
const { borderWidth, fill, lineTension } =
|
||||
this.getChartCustomProperties()
|
||||
|
||||
new Chart(this.$refs.canvas, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
data: values,
|
||||
borderWidth,
|
||||
fill,
|
||||
tension: lineTension,
|
||||
backgroundColor,
|
||||
borderColor,
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
animation: {
|
||||
duration: 0,
|
||||
},
|
||||
elements: {
|
||||
point: {
|
||||
radius: 0,
|
||||
},
|
||||
},
|
||||
maintainAspectRatio: false,
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
tooltip: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
display: false,
|
||||
},
|
||||
y: {
|
||||
display: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
updateChartData(newValues) {
|
||||
const chart = this.getChart()
|
||||
|
||||
if (!chart) {
|
||||
return
|
||||
}
|
||||
|
||||
chart.data.labels = newValues.map((value, index) => index)
|
||||
chart.data.datasets[0].data = newValues
|
||||
chart.update('none')
|
||||
},
|
||||
|
||||
updateChartTheme() {
|
||||
const chart = this.getChart()
|
||||
|
||||
if (!chart) {
|
||||
return
|
||||
}
|
||||
|
||||
const { backgroundColor, borderColor } = this.getChartColors()
|
||||
|
||||
// The custom properties are re-read too: a theme may legitimately give light
|
||||
// and dark mode a different line.
|
||||
const { borderWidth, fill, lineTension } =
|
||||
this.getChartCustomProperties()
|
||||
|
||||
chart.data.datasets[0].backgroundColor = backgroundColor
|
||||
chart.data.datasets[0].borderColor = borderColor
|
||||
chart.data.datasets[0].borderWidth = borderWidth
|
||||
chart.data.datasets[0].fill = fill
|
||||
chart.data.datasets[0].tension = lineTension
|
||||
|
||||
// `'resize'` rather than `'none'`, for the reason given in the chart widget.
|
||||
chart.update('resize')
|
||||
},
|
||||
|
||||
getChart() {
|
||||
if (!this.$refs.canvas) {
|
||||
return null
|
||||
}
|
||||
|
||||
return Chart.getChart(this.$refs.canvas)
|
||||
},
|
||||
|
||||
getChartColors() {
|
||||
return {
|
||||
backgroundColor: getComputedStyle(
|
||||
this.$refs.backgroundColorElement,
|
||||
).color,
|
||||
borderColor: getComputedStyle(this.$refs.borderColorElement)
|
||||
.color,
|
||||
}
|
||||
},
|
||||
|
||||
// The parts of the sparkline that a stylesheet cannot otherwise reach, since
|
||||
// Chart.js paints them onto a bare `<canvas>`. Each fallback is the value the
|
||||
// sparkline has always used.
|
||||
getChartCustomProperties() {
|
||||
const { number, keyword } = readCustomProperties(this.$el)
|
||||
|
||||
return {
|
||||
borderWidth: number('--stat-chart-border-width', 2),
|
||||
fill: keyword('--stat-chart-fill', 'start'),
|
||||
lineTension: number('--stat-chart-line-tension', 0.5),
|
||||
}
|
||||
},
|
||||
|
||||
destroy() {
|
||||
this.systemThemeMediaQuery?.removeEventListener(
|
||||
'change',
|
||||
this.systemThemeListener,
|
||||
)
|
||||
this.getChart()?.destroy()
|
||||
},
|
||||
}
|
||||
}
|
||||
28
vendor/filament/widgets/resources/js/custom-properties.js
vendored
Normal file
28
vendor/filament/widgets/resources/js/custom-properties.js
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Chart.js paints a chart onto a bare `<canvas>`, so its shape is unreachable from a
|
||||
// stylesheet. The `--chart-*` and `--stat-chart-*` custom properties bridge that
|
||||
// gap, and this is how the chart components read them.
|
||||
//
|
||||
// An unset property reads back as an empty string, so every call passes the default it
|
||||
// stands in for as a `fallback`. That keeps each default in one place, and leaves a value
|
||||
// Chart.js cannot use to be ignored by Chart.js rather than second-guessed here.
|
||||
export default function readCustomProperties(element) {
|
||||
const styles = getComputedStyle(element)
|
||||
|
||||
const read = (property) => styles.getPropertyValue(property).trim()
|
||||
|
||||
return {
|
||||
number: (property, fallback) => {
|
||||
const value = parseFloat(read(property))
|
||||
|
||||
return Number.isNaN(value) ? fallback : value
|
||||
},
|
||||
|
||||
// Chart.js switches a feature off with boolean `false`, and a custom property can
|
||||
// only ever yield the string `'false'`, which is truthy — hence the `none` keyword.
|
||||
keyword: (property, fallback) => {
|
||||
const value = read(property) || fallback
|
||||
|
||||
return value === 'none' ? false : value
|
||||
},
|
||||
}
|
||||
}
|
||||
13
vendor/filament/widgets/resources/lang/am/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/am/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'ማጣርያ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
31
vendor/filament/widgets/resources/lang/ar/chart.php
vendored
Normal file
31
vendor/filament/widgets/resources/lang/ar/chart.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
'filter' => [
|
||||
'label' => 'تصفية',
|
||||
],
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
'actions' => [
|
||||
'apply' => [
|
||||
'label' => 'تطبيق',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'إعادة تعيين',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'لا توجد بيانات للعرض',
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'تصفية بيانات الرسم البياني',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/bn/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/bn/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'ফিল্টার করুন',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/ca/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/ca/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Aplicar',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Reestablir',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/ckb/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/ckb/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'پاڵاوتن',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/cs/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/cs/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtr',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrovat data grafu',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Použít',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Resetovat',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Žádná data k zobrazení',
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/de/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/de/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtern',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Diagrammdaten filtern',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Anwenden',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Zurücksetzen',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Keine Daten vorhanden',
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/en/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/en/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter chart data',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Apply',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Reset',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'No data to display',
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/es/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/es/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrar los datos del gráfico',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Aplicar',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Restablecer',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'No hay datos para mostrar',
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/et/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/et/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtreeri',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtreeri andmed',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Rakenda',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Lähtesta',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Andmeid ei ole',
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/eu/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/eu/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Iragazki',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Aplikatu',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Berrezarri',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/widgets/resources/lang/fil/chart.php
vendored
Normal file
25
vendor/filament/widgets/resources/lang/fil/chart.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'actions' => [
|
||||
'filter' => [
|
||||
'label' => 'I-filter',
|
||||
],
|
||||
],
|
||||
'filter' => [
|
||||
'label' => 'I-filter ang data ng chart',
|
||||
],
|
||||
'filters' => [
|
||||
'actions' => [
|
||||
'apply' => [
|
||||
'label' => 'I-apply',
|
||||
],
|
||||
'reset' => [
|
||||
'label' => 'I-reset',
|
||||
],
|
||||
],
|
||||
],
|
||||
'empty' => [
|
||||
'heading' => 'Walang data na maipapakita',
|
||||
],
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/fr/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/fr/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrer',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/he/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/he/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'סינון',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'סינון נתוני התרשים',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'החל',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'איפוס',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'אין נתונים להצגה',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/hu/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/hu/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Szűrés',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/id/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/id/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Terapkan',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Atur ulang',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/it/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/it/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtra',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Applica',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Reimposta',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/ja/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/ja/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'フィルター',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => '適用',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'リセット',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/km/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/km/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'តម្រង',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'ត្រងទិន្នន័យគំនូសតាង',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'អនុវត្ត',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'កំណត់ឡើងវិញ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'គ្មានទិន្នន័យត្រូវបង្ហាញទេ',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/ko/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/ko/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => '필터',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/lt/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/lt/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtruoti',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Taikyti',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Atstatyti',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/lus/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/lus/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Thlit fîmna',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Chart data thlitfîmna',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Apply',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Tihṭhatna',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Data târchhuah tur a awm lo',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/mk/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/mk/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Филтер',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
25
vendor/filament/widgets/resources/lang/my/chart.php
vendored
Normal file
25
vendor/filament/widgets/resources/lang/my/chart.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'actions' => [
|
||||
'filter' => [
|
||||
'label' => 'စစ်ထုတ်ရန်',
|
||||
],
|
||||
],
|
||||
'filter' => [
|
||||
'label' => 'ဇယားဒေတာကို စစ်ထုတ်ရန်',
|
||||
],
|
||||
'filters' => [
|
||||
'actions' => [
|
||||
'apply' => [
|
||||
'label' => 'အသုံးပြုရန်',
|
||||
],
|
||||
'reset' => [
|
||||
'label' => 'မူလအတိုင်း ပြန်ထားရန်',
|
||||
],
|
||||
],
|
||||
],
|
||||
'empty' => [
|
||||
'heading' => 'ပြသရန် ဒေတာမရှိပါ',
|
||||
],
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/nb/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/nb/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/nl/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/nl/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filteren',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Toepassen',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Resetten',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/pl/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/pl/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtruj',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtruj dane wykresu',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Zastosuj',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Resetuj',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Brak danych do wyświetlenia',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/pt/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/pt/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrar',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/pt_BR/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/pt_BR/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtro',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrar dados do gráfico',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Aplicar',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Redefinir',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Sem dados para exibir',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/ro/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/ro/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtru',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/ru/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/ru/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Фильтр',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Применить',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Сбросить',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/sk/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/sk/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrovať dáta grafu',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Použiť',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Resetovať',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Žiadne dáta na zobrazenie',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/sr_Cyrl/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/sr_Cyrl/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Филтер',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/sr_Latn/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/sr_Latn/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/sv/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/sv/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filter',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtrera diagramdata',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Tillämpa',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Återställ',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Ingen data att visa',
|
||||
],
|
||||
|
||||
];
|
||||
31
vendor/filament/widgets/resources/lang/sw/chart.php
vendored
Normal file
31
vendor/filament/widgets/resources/lang/sw/chart.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
'filter' => [
|
||||
'label' => 'Chuja',
|
||||
],
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Chuja data ya chati',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
'actions' => [
|
||||
'apply' => [
|
||||
'label' => 'Tekeleza',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Weka upya',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Hakuna data ya kuonyesha',
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/tg/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/tg/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Филтр',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Татбиқ кардан',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Аз нав барқарор кардан',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
37
vendor/filament/widgets/resources/lang/tr/chart.php
vendored
Normal file
37
vendor/filament/widgets/resources/lang/tr/chart.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Filtre',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Grafik verilerini filtrele',
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => 'Uygula',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => 'Sıfırla',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'empty' => [
|
||||
'heading' => 'Görüntülenecek veri yok',
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/uk/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/uk/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Фільтр',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/ur/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/ur/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'فلٹر کریں',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
13
vendor/filament/widgets/resources/lang/vi/chart.php
vendored
Normal file
13
vendor/filament/widgets/resources/lang/vi/chart.php
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => 'Bộ lọc',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
29
vendor/filament/widgets/resources/lang/zh_CN/chart.php
vendored
Normal file
29
vendor/filament/widgets/resources/lang/zh_CN/chart.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'filter' => [
|
||||
'label' => '筛选',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filters' => [
|
||||
|
||||
'actions' => [
|
||||
|
||||
'apply' => [
|
||||
'label' => '应用',
|
||||
],
|
||||
|
||||
'reset' => [
|
||||
'label' => '重置',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
205
vendor/filament/widgets/resources/views/chart-widget.blade.php
vendored
Normal file
205
vendor/filament/widgets/resources/views/chart-widget.blade.php
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
@php
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Filament\Support\View\ComponentAttributeBag as FilamentComponentAttributeBag;
|
||||
use Filament\Widgets\View\Components\ChartWidgetComponent;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
$color = $this->getColor();
|
||||
$heading = $this->getHeading();
|
||||
$description = $this->getDescription();
|
||||
$filters = $this->getFilters();
|
||||
$isCollapsible = $this->isCollapsible();
|
||||
$type = $this->getType();
|
||||
$maxHeight = $this->getMaxHeight();
|
||||
$hasMaxHeight = filled($maxHeight) && $maxHeight !== '100%';
|
||||
$isEmpty = $this->isEmpty();
|
||||
|
||||
// The chart paints onto a bare `<canvas>`, which exposes no accessible name, so build a text
|
||||
// alternative from the widget's heading and description (WCAG 1.1.1) for `role="img"` + `aria-label`.
|
||||
$chartAccessibleLabel = trim(implode('. ', array_filter([
|
||||
$heading instanceof Htmlable ? strip_tags($heading->toHtml()) : $heading,
|
||||
$description instanceof Htmlable ? strip_tags($description->toHtml()) : $description,
|
||||
], fn ($value): bool => filled($value))));
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget class="fi-wi-chart">
|
||||
<x-filament::section
|
||||
:description="$description"
|
||||
:heading="$heading"
|
||||
:collapsible="$isCollapsible"
|
||||
>
|
||||
@if ($filters || method_exists($this, 'getFiltersSchema'))
|
||||
<x-slot name="afterHeader">
|
||||
@if ($filters)
|
||||
<x-filament::input.wrapper
|
||||
inline-prefix
|
||||
wire:target="filter"
|
||||
class="fi-wi-chart-filter"
|
||||
>
|
||||
<x-filament::input.select
|
||||
:aria-label="__('filament-widgets::chart.filter.label')"
|
||||
inline-prefix
|
||||
wire:model.live="filter"
|
||||
>
|
||||
@foreach ($filters as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</x-filament::input.select>
|
||||
</x-filament::input.wrapper>
|
||||
@endif
|
||||
|
||||
@if (method_exists($this, 'getFiltersSchema'))
|
||||
<x-filament::dropdown
|
||||
placement="bottom-end"
|
||||
shift
|
||||
width="xs"
|
||||
class="fi-wi-chart-filter"
|
||||
>
|
||||
<x-slot name="trigger">
|
||||
{{ $this->getFiltersTriggerAction() }}
|
||||
</x-slot>
|
||||
|
||||
<div class="fi-wi-chart-filter-content">
|
||||
{{ $this->getFiltersSchema() }}
|
||||
|
||||
@if (method_exists($this, 'hasDeferredFilters') && $this->hasDeferredFilters())
|
||||
<div
|
||||
class="fi-wi-chart-filter-content-actions-ctn"
|
||||
>
|
||||
{{ $this->getFiltersApplyAction() }}
|
||||
|
||||
{{ $this->getFiltersResetAction() }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</x-filament::dropdown>
|
||||
@endif
|
||||
</x-slot>
|
||||
@endif
|
||||
|
||||
<div
|
||||
@if ($pollingInterval = $this->getPollingInterval())
|
||||
wire:poll.{{ $pollingInterval }}="updateChartData"
|
||||
@endif
|
||||
@if ($isEmpty)
|
||||
style="display: none"
|
||||
@endif
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
x-load-src="{{ FilamentAsset::getAlpineComponentSrc('chart', 'filament/widgets') }}"
|
||||
wire:ignore
|
||||
data-chart-type="{{ $type }}"
|
||||
x-data="chart({
|
||||
cachedData: @js($this->getCachedData()),
|
||||
options: @js($this->getOptions()),
|
||||
type: @js($type),
|
||||
})"
|
||||
{{
|
||||
(new FilamentComponentAttributeBag)
|
||||
->color(ChartWidgetComponent::class, $color)
|
||||
->class([
|
||||
'fi-wi-chart-frame',
|
||||
'fi-wi-chart-canvas-ctn',
|
||||
'fi-wi-chart-frame-no-aspect-ratio' => $hasMaxHeight,
|
||||
])
|
||||
}}
|
||||
>
|
||||
<canvas
|
||||
x-ref="canvas"
|
||||
@if (filled($chartAccessibleLabel))
|
||||
role="img"
|
||||
aria-label="{{ $chartAccessibleLabel }}"
|
||||
@endif
|
||||
@style([
|
||||
'width: 100%',
|
||||
'height: 100%; max-height: 100%' => ! $hasMaxHeight,
|
||||
('max-height: ' . e($maxHeight)) => $hasMaxHeight,
|
||||
])
|
||||
></canvas>
|
||||
|
||||
{{--
|
||||
Chart.js paints the chart onto the canvas, where a stylesheet cannot reach it. These empty
|
||||
elements carry the colors it should use, so that a theme can set them with an ordinary
|
||||
`color` declaration and they follow light and dark mode like any other element.
|
||||
--}}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="backgroundColorElement"
|
||||
class="fi-wi-chart-bg-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="borderColorElement"
|
||||
class="fi-wi-chart-border-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="gridColorElement"
|
||||
class="fi-wi-chart-grid-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="textColorElement"
|
||||
class="fi-wi-chart-text-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="tooltipBackgroundColorElement"
|
||||
class="fi-wi-chart-tooltip-bg-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="tooltipTextColorElement"
|
||||
class="fi-wi-chart-tooltip-text-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="tooltipBorderColorElement"
|
||||
class="fi-wi-chart-tooltip-border-color"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($isEmpty)
|
||||
@if ($emptyState = $this->getEmptyState())
|
||||
{{ $emptyState }}
|
||||
@else
|
||||
<div
|
||||
@class([
|
||||
'fi-wi-chart-frame',
|
||||
'fi-wi-chart-frame-no-aspect-ratio' => $hasMaxHeight,
|
||||
])
|
||||
@style([
|
||||
('min-height: ' . e($maxHeight)) => $hasMaxHeight,
|
||||
])
|
||||
>
|
||||
<x-filament::empty-state
|
||||
:contained="false"
|
||||
:description="$this->getEmptyStateDescription()"
|
||||
:heading="$this->getEmptyStateHeading()"
|
||||
:icon="$this->getEmptyStateIcon()"
|
||||
icon-color="gray"
|
||||
>
|
||||
@if ($emptyStateActions = $this->getEmptyStateActions())
|
||||
<x-slot name="footer">
|
||||
<x-filament::actions
|
||||
:actions="$emptyStateActions"
|
||||
alignment="center"
|
||||
/>
|
||||
</x-slot>
|
||||
@endif
|
||||
</x-filament::empty-state>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</x-filament::section>
|
||||
</x-filament-widgets::widget>
|
||||
5
vendor/filament/widgets/resources/views/components/widget.blade.php
vendored
Normal file
5
vendor/filament/widgets/resources/views/components/widget.blade.php
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div
|
||||
{{ $attributes->gridColumn($this->getColumnSpan(), $this->getColumnStart())->class(['fi-wi-widget']) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
41
vendor/filament/widgets/resources/views/components/widgets.blade.php
vendored
Normal file
41
vendor/filament/widgets/resources/views/components/widgets.blade.php
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{{-- @deprecated Use a schema to render widgets. --}}
|
||||
|
||||
@props([
|
||||
'columns' => [
|
||||
'lg' => 2,
|
||||
],
|
||||
'data' => [],
|
||||
'widgets' => [],
|
||||
])
|
||||
|
||||
@php
|
||||
use Filament\Widgets\WidgetConfiguration;
|
||||
|
||||
if (is_array($columns)) {
|
||||
$columns['lg'] ??= ($columns ? (is_array($columns) ? null : $columns) : 2);
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div {{ $attributes->grid($columns)->class(['fi-wi']) }}>
|
||||
@php
|
||||
$normalizeWidgetClass = function (string | WidgetConfiguration $widget): string {
|
||||
if ($widget instanceof WidgetConfiguration) {
|
||||
return $widget->widget;
|
||||
}
|
||||
|
||||
return $widget;
|
||||
};
|
||||
@endphp
|
||||
|
||||
@foreach ($widgets as $widgetKey => $widget)
|
||||
@php
|
||||
$widgetClass = $normalizeWidgetClass($widget);
|
||||
@endphp
|
||||
|
||||
@livewire(
|
||||
$widgetClass,
|
||||
[...(($widget instanceof \Filament\Widgets\WidgetConfiguration) ? [...$widget->widget::getDefaultProperties(), ...$widget->getProperties()] : $widget::getDefaultProperties()), ...$data],
|
||||
key("{$widgetClass}-{$widgetKey}"),
|
||||
)
|
||||
@endforeach
|
||||
</div>
|
||||
25
vendor/filament/widgets/resources/views/stats-overview-widget.blade.php
vendored
Normal file
25
vendor/filament/widgets/resources/views/stats-overview-widget.blade.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@php
|
||||
use Filament\Support\View\ComponentAttributeBag;
|
||||
|
||||
$columns = $this->getColumns();
|
||||
$pollingInterval = $this->getPollingInterval();
|
||||
|
||||
$heading = $this->getHeading();
|
||||
$description = $this->getDescription();
|
||||
$hasHeading = filled($heading);
|
||||
$hasDescription = filled($description);
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget
|
||||
:attributes="
|
||||
(new ComponentAttributeBag)
|
||||
->merge([
|
||||
'wire:poll.' . $pollingInterval => $pollingInterval ? true : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-wi-stats-overview',
|
||||
])
|
||||
"
|
||||
>
|
||||
{{ $this->content }}
|
||||
</x-filament-widgets::widget>
|
||||
100
vendor/filament/widgets/resources/views/stats-overview-widget/stat.blade.php
vendored
Normal file
100
vendor/filament/widgets/resources/views/stats-overview-widget/stat.blade.php
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
@php
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Filament\Support\View\ComponentAttributeBag as FilamentComponentAttributeBag;
|
||||
use Filament\Widgets\View\Components\StatsOverviewWidgetComponent\StatComponent\DescriptionComponent;
|
||||
use Filament\Widgets\View\Components\StatsOverviewWidgetComponent\StatComponent\StatsOverviewWidgetStatChartComponent;
|
||||
|
||||
$chartColor = $getChartColor() ?? 'gray';
|
||||
$descriptionColor = $getDescriptionColor() ?? 'gray';
|
||||
$descriptionIcon = $getDescriptionIcon();
|
||||
$descriptionIconPosition = $getDescriptionIconPosition();
|
||||
$url = $getUrl();
|
||||
$tag = $url ? 'a' : 'div';
|
||||
@endphp
|
||||
|
||||
<{!! $tag !!}
|
||||
@if ($url)
|
||||
{{ \Filament\Support\generate_href_html($url, $shouldOpenUrlInNewTab()) }}
|
||||
@endif
|
||||
{{
|
||||
$getExtraAttributeBag()
|
||||
->class([
|
||||
'fi-wi-stats-overview-stat',
|
||||
])
|
||||
}}
|
||||
>
|
||||
<div class="fi-wi-stats-overview-stat-content">
|
||||
<div class="fi-wi-stats-overview-stat-label-ctn">
|
||||
{{ \Filament\Support\generate_icon_html($getIcon()) }}
|
||||
|
||||
<span class="fi-wi-stats-overview-stat-label">
|
||||
{{ $getLabel() }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@if (filled($value = $getValue()))
|
||||
<div class="fi-wi-stats-overview-stat-value">
|
||||
{{ $value }}
|
||||
</div>
|
||||
@else
|
||||
<div class="fi-wi-stats-overview-stat-placeholder">
|
||||
{{ $getPlaceholder() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($description = $getDescription())
|
||||
<div
|
||||
{{ (new FilamentComponentAttributeBag)->color(DescriptionComponent::class, $descriptionColor)->class(['fi-wi-stats-overview-stat-description']) }}
|
||||
>
|
||||
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::Before, 'before']))
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: (new FilamentComponentAttributeBag)) }}
|
||||
@endif
|
||||
|
||||
<span>
|
||||
{{ $description }}
|
||||
</span>
|
||||
|
||||
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::After, 'after']))
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: (new FilamentComponentAttributeBag)) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($chart = $getChart())
|
||||
{{-- An empty function to initialize the Alpine component with until it's loaded with `x-load`. --}}
|
||||
<div x-data="{ statsOverviewStatChart() {} }">
|
||||
<div
|
||||
x-load
|
||||
x-load-src="{{ FilamentAsset::getAlpineComponentSrc('stats-overview/stat/chart', 'filament/widgets') }}"
|
||||
wire:ignore
|
||||
x-data="statsOverviewStatChart({
|
||||
key: @js($getKey(false)),
|
||||
labels: @js(array_keys($chart)),
|
||||
values: @js(array_values($chart)),
|
||||
})"
|
||||
{{ (new FilamentComponentAttributeBag)->color(StatsOverviewWidgetStatChartComponent::class, $chartColor)->class(['fi-wi-stats-overview-stat-chart']) }}
|
||||
>
|
||||
{{-- The label and value are already exposed as text, so the trend sparkline is decorative. --}}
|
||||
<canvas x-ref="canvas" aria-hidden="true"></canvas>
|
||||
|
||||
{{--
|
||||
These empty elements carry the colors the chart should be painted in, so that a theme
|
||||
can set them with an ordinary `color` declaration.
|
||||
--}}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="backgroundColorElement"
|
||||
class="fi-wi-stats-overview-stat-chart-bg-color"
|
||||
></span>
|
||||
|
||||
<span
|
||||
aria-hidden="true"
|
||||
x-ref="borderColorElement"
|
||||
class="fi-wi-stats-overview-stat-chart-border-color"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</{!! $tag !!}>
|
||||
12
vendor/filament/widgets/resources/views/table-widget.blade.php
vendored
Normal file
12
vendor/filament/widgets/resources/views/table-widget.blade.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
@php
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Filament\Widgets\View\WidgetsRenderHook;
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget class="fi-wi-table">
|
||||
{{ FilamentView::renderHook(WidgetsRenderHook::TABLE_WIDGET_START, scopes: static::class) }}
|
||||
|
||||
{{ $this->table ?? null }}
|
||||
|
||||
{{ FilamentView::renderHook(WidgetsRenderHook::TABLE_WIDGET_END, scopes: static::class) }}
|
||||
</x-filament-widgets::widget>
|
||||
Loading…
Add table
Add a link
Reference in a new issue