myio-js-library 0.1.162 → 0.1.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1274 -5
- package/dist/index.d.cts +74 -1
- package/dist/index.js +1273 -5
- package/dist/myio-js-library.umd.js +1271 -5
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2518,6 +2518,8 @@ interface Consumption7DaysColors {
|
|
|
2518
2518
|
/** Optional point colors for line charts */
|
|
2519
2519
|
pointBackground?: string;
|
|
2520
2520
|
pointBorder?: string;
|
|
2521
|
+
/** Colors for per-shopping datasets (separate mode) */
|
|
2522
|
+
shoppingColors?: string[];
|
|
2521
2523
|
}
|
|
2522
2524
|
/**
|
|
2523
2525
|
* Single data point for consumption
|
|
@@ -2897,6 +2899,77 @@ interface ConsumptionModalInstance {
|
|
|
2897
2899
|
*/
|
|
2898
2900
|
declare function createConsumptionModal(config: ConsumptionModalConfig): ConsumptionModalInstance;
|
|
2899
2901
|
|
|
2902
|
+
/**
|
|
2903
|
+
* RFC-0098: Consumption Chart Widget
|
|
2904
|
+
*
|
|
2905
|
+
* Creates an inline chart widget that injects all HTML structure into a container.
|
|
2906
|
+
* Unlike createConsumptionModal (which creates a modal overlay), this component
|
|
2907
|
+
* renders directly into a specified container element.
|
|
2908
|
+
*
|
|
2909
|
+
* @example
|
|
2910
|
+
* ```typescript
|
|
2911
|
+
* import { createConsumptionChartWidget } from 'myio-js-library';
|
|
2912
|
+
*
|
|
2913
|
+
* const widget = createConsumptionChartWidget({
|
|
2914
|
+
* domain: 'energy',
|
|
2915
|
+
* containerId: 'energy-chart-container',
|
|
2916
|
+
* title: 'Consumo dos últimos 7 dias',
|
|
2917
|
+
* unit: 'kWh',
|
|
2918
|
+
* fetchData: async (period) => fetchEnergyData(period),
|
|
2919
|
+
* });
|
|
2920
|
+
*
|
|
2921
|
+
* await widget.render();
|
|
2922
|
+
* ```
|
|
2923
|
+
*/
|
|
2924
|
+
|
|
2925
|
+
interface ConsumptionWidgetConfig extends Omit<Consumption7DaysConfig, 'containerId'> {
|
|
2926
|
+
/** ID of the container element where the widget will be rendered */
|
|
2927
|
+
containerId: string;
|
|
2928
|
+
/** Widget title (default: "Consumo dos últimos X dias") */
|
|
2929
|
+
title?: string;
|
|
2930
|
+
/** Show settings button (default: true) */
|
|
2931
|
+
showSettingsButton?: boolean;
|
|
2932
|
+
/** Show maximize button (default: true) */
|
|
2933
|
+
showMaximizeButton?: boolean;
|
|
2934
|
+
/** Show viz mode tabs (default: true) */
|
|
2935
|
+
showVizModeTabs?: boolean;
|
|
2936
|
+
/** Show chart type tabs (default: true) */
|
|
2937
|
+
showChartTypeTabs?: boolean;
|
|
2938
|
+
/** Chart height in pixels or CSS value (default: 300) */
|
|
2939
|
+
chartHeight?: number | string;
|
|
2940
|
+
/** Callback when settings button is clicked */
|
|
2941
|
+
onSettingsClick?: () => void;
|
|
2942
|
+
/** Callback when maximize button is clicked */
|
|
2943
|
+
onMaximizeClick?: () => void;
|
|
2944
|
+
/** Custom CSS class for the widget container */
|
|
2945
|
+
className?: string;
|
|
2946
|
+
}
|
|
2947
|
+
interface ConsumptionWidgetInstance {
|
|
2948
|
+
/** Renders the widget into the container */
|
|
2949
|
+
render: () => Promise<void>;
|
|
2950
|
+
/** Refreshes the chart data */
|
|
2951
|
+
refresh: (forceRefresh?: boolean) => Promise<void>;
|
|
2952
|
+
/** Sets the chart type */
|
|
2953
|
+
setChartType: (type: ChartType) => void;
|
|
2954
|
+
/** Sets the visualization mode */
|
|
2955
|
+
setVizMode: (mode: VizMode) => void;
|
|
2956
|
+
/** Sets the theme */
|
|
2957
|
+
setTheme: (theme: ThemeMode) => void;
|
|
2958
|
+
/** Sets the period in days */
|
|
2959
|
+
setPeriod: (days: number) => Promise<void>;
|
|
2960
|
+
/** Sets the ideal range */
|
|
2961
|
+
setIdealRange: (range: IdealRangeConfig | null) => void;
|
|
2962
|
+
/** Gets the internal chart instance */
|
|
2963
|
+
getChart: () => ReturnType<typeof createConsumption7DaysChart> | null;
|
|
2964
|
+
/** Gets the cached data */
|
|
2965
|
+
getCachedData: () => Consumption7DaysData | null;
|
|
2966
|
+
/** Exports data to CSV */
|
|
2967
|
+
exportCSV: (filename?: string) => void;
|
|
2968
|
+
/** Destroys the widget */
|
|
2969
|
+
destroy: () => void;
|
|
2970
|
+
}
|
|
2971
|
+
declare function createConsumptionChartWidget(config: ConsumptionWidgetConfig): ConsumptionWidgetInstance;
|
|
2972
|
+
|
|
2900
2973
|
/**
|
|
2901
2974
|
* RFC-0101: Export Data Smart Component Types
|
|
2902
2975
|
*
|
|
@@ -3170,4 +3243,4 @@ declare const EXPORT_DOMAIN_LABELS: Record<ExportDomain, string>;
|
|
|
3170
3243
|
/** Domain units */
|
|
3171
3244
|
declare const EXPORT_DOMAIN_UNITS: Record<ExportDomain, string>;
|
|
3172
3245
|
|
|
3173
|
-
export { type BuildTemplateExportParams, CHART_COLORS, DEFAULT_COLORS as CONSUMPTION_CHART_COLORS, DEFAULT_CONFIG as CONSUMPTION_CHART_DEFAULTS, THEME_COLORS as CONSUMPTION_THEME_COLORS, type ChartDomain, type ClampRange, ConnectionStatusType, type Consumption7DaysColors, type Consumption7DaysConfig, type Consumption7DaysData, type Consumption7DaysInstance, type ChartType as ConsumptionChartType, type ConsumptionDataPoint, type IdealRangeConfig as ConsumptionIdealRangeConfig, type ConsumptionModalConfig, type ConsumptionModalInstance, type TemperatureConfig as ConsumptionTemperatureConfig, type TemperatureReferenceLine as ConsumptionTemperatureReferenceLine, type ThemeColors as ConsumptionThemeColors, type ThemeMode as ConsumptionThemeMode, type VizMode as ConsumptionVizMode, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, DeviceStatusType, EXPORT_DEFAULT_COLORS, EXPORT_DOMAIN_ICONS, EXPORT_DOMAIN_LABELS, EXPORT_DOMAIN_UNITS, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, type ExportColorsPallet, type ExportComparisonData, type ExportConfigTemplate, type ExportCustomerData, type ExportCustomerInfo, type ExportData, type ExportDataInput, type ExportDataInstance, type ExportDataPoint, type ExportDeviceInfo, type ExportDomain, type ExportFormat, type ExportGroupData, type ExportOptions, type ExportProgressCallback, type ExportResult, type ExportStats, type ExportType, type ExportFormat$1 as ModalExportFormat, type ModalHeaderConfig, type ModalHeaderInstance, type ModalTheme, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, type PersistResult, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type ShoppingDataPoint, type StoreRow, type TbScope, type TelemetryFetcher, type TemperatureComparisonModalInstance, type TemperatureComparisonModalParams, type TemperatureDevice, type TemperatureGranularity, type TemperatureModalInstance, type TemperatureModalParams, type TemperatureSettingsInstance, type TemperatureSettingsParams, type TemperatureStats, type TemperatureTelemetry, type ThingsboardCustomerAttrsConfig, type TimedValue, type WaterRow, type WaterTankDataPoint, type WaterTankModalContext, type WaterTankModalError, type WaterTankModalI18n, type WaterTankModalStyleOverrides, type WaterTankTelemetryData, addDetectionContext, addNamespace, aggregateByDay, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildTemplateExport, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, calculateStats as calculateExportStats, calculateStats$1 as calculateStats, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createConsumption7DaysChart, createConsumptionModal, createDateRangePicker, createInputDateRangePickerInsideDIV, createModalHeader, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchTemperatureData, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, findValueWithDefault, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatDuration, formatEnergy, formatNumberReadable, formatRelativeTime, formatTankHeadFromCm, formatTemperature, formatWater, formatWaterByGroup, formatWaterVolumeM3, formatarDuracao, generateFilename as generateExportFilename, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDeviceStatusIcon, getDeviceStatusInfo, getModalHeaderStyles, getSaoPauloISOString, getSaoPauloISOStringFixed, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, interpolateTemperature, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapConnectionStatus, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, myioExportData, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, openRealTimeTelemetryModal, openTemperatureComparisonModal, openTemperatureModal, openTemperatureSettingsModal, parseInputDateToDate, renderCardComponent$2 as renderCardComponent, renderCardComponent$1 as renderCardComponentEnhanced, renderCardComponentHeadOffice, renderCardComponentLegacy, renderCardComponentV2, renderCardComponent as renderCardComponentV5, renderCardComponentV5 as renderCardV5, shouldFlashIcon, strings, timeWindowFromInputYMD, toCSV, toFixedSafe, waterDeviceStatusIcons };
|
|
3246
|
+
export { type BuildTemplateExportParams, CHART_COLORS, DEFAULT_COLORS as CONSUMPTION_CHART_COLORS, DEFAULT_CONFIG as CONSUMPTION_CHART_DEFAULTS, THEME_COLORS as CONSUMPTION_THEME_COLORS, type ChartDomain, type ClampRange, ConnectionStatusType, type Consumption7DaysColors, type Consumption7DaysConfig, type Consumption7DaysData, type Consumption7DaysInstance, type ChartType as ConsumptionChartType, type ConsumptionDataPoint, type IdealRangeConfig as ConsumptionIdealRangeConfig, type ConsumptionModalConfig, type ConsumptionModalInstance, type TemperatureConfig as ConsumptionTemperatureConfig, type TemperatureReferenceLine as ConsumptionTemperatureReferenceLine, type ThemeColors as ConsumptionThemeColors, type ThemeMode as ConsumptionThemeMode, type VizMode as ConsumptionVizMode, type ConsumptionWidgetConfig, type ConsumptionWidgetInstance, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, DeviceStatusType, EXPORT_DEFAULT_COLORS, EXPORT_DOMAIN_ICONS, EXPORT_DOMAIN_LABELS, EXPORT_DOMAIN_UNITS, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, type ExportColorsPallet, type ExportComparisonData, type ExportConfigTemplate, type ExportCustomerData, type ExportCustomerInfo, type ExportData, type ExportDataInput, type ExportDataInstance, type ExportDataPoint, type ExportDeviceInfo, type ExportDomain, type ExportFormat, type ExportGroupData, type ExportOptions, type ExportProgressCallback, type ExportResult, type ExportStats, type ExportType, type ExportFormat$1 as ModalExportFormat, type ModalHeaderConfig, type ModalHeaderInstance, type ModalTheme, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, type PersistResult, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type ShoppingDataPoint, type StoreRow, type TbScope, type TelemetryFetcher, type TemperatureComparisonModalInstance, type TemperatureComparisonModalParams, type TemperatureDevice, type TemperatureGranularity, type TemperatureModalInstance, type TemperatureModalParams, type TemperatureSettingsInstance, type TemperatureSettingsParams, type TemperatureStats, type TemperatureTelemetry, type ThingsboardCustomerAttrsConfig, type TimedValue, type WaterRow, type WaterTankDataPoint, type WaterTankModalContext, type WaterTankModalError, type WaterTankModalI18n, type WaterTankModalStyleOverrides, type WaterTankTelemetryData, addDetectionContext, addNamespace, aggregateByDay, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildTemplateExport, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, calculateStats as calculateExportStats, calculateStats$1 as calculateStats, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createConsumption7DaysChart, createConsumptionChartWidget, createConsumptionModal, createDateRangePicker, createInputDateRangePickerInsideDIV, createModalHeader, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchTemperatureData, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, findValueWithDefault, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatDuration, formatEnergy, formatNumberReadable, formatRelativeTime, formatTankHeadFromCm, formatTemperature, formatWater, formatWaterByGroup, formatWaterVolumeM3, formatarDuracao, generateFilename as generateExportFilename, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDeviceStatusIcon, getDeviceStatusInfo, getModalHeaderStyles, getSaoPauloISOString, getSaoPauloISOStringFixed, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, interpolateTemperature, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapConnectionStatus, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, myioExportData, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, openRealTimeTelemetryModal, openTemperatureComparisonModal, openTemperatureModal, openTemperatureSettingsModal, parseInputDateToDate, renderCardComponent$2 as renderCardComponent, renderCardComponent$1 as renderCardComponentEnhanced, renderCardComponentHeadOffice, renderCardComponentLegacy, renderCardComponentV2, renderCardComponent as renderCardComponentV5, renderCardComponentV5 as renderCardV5, shouldFlashIcon, strings, timeWindowFromInputYMD, toCSV, toFixedSafe, waterDeviceStatusIcons };
|