iobroker.sql 4.1.4 → 4.1.6

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.
Files changed (67) hide show
  1. package/README.md +11 -17
  2. package/admin/custom/assets/Components-BdA5LPyZ.js +1 -0
  3. package/admin/custom/assets/DataBrowser-B58dmY7z.js +1 -0
  4. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-Ck14nhXC.js +1 -0
  5. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js +1217 -0
  6. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare__shared-CW0J4wsL.js +2 -0
  7. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-rYhVwVDZ.js +122 -0
  8. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js +1 -0
  9. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DdEgwb91.js +9 -0
  10. package/admin/custom/assets/dist-CcO6wD-W.js +1 -0
  11. package/admin/custom/assets/helpers-Cn4fdICb.js +1 -0
  12. package/admin/custom/assets/hostInit-BcHgEp_u.js +1 -0
  13. package/admin/custom/assets/iconLibraryData-B5fiyl1C.js +1 -0
  14. package/admin/custom/assets/index-CPb0o_Am.js +1 -0
  15. package/admin/custom/assets/lib-Bm71NwS-.js +3 -0
  16. package/admin/custom/assets/{mf-entry-bootstrap-0-9382e792.js → mf-entry-bootstrap-0-75c1e504.js} +14 -2
  17. package/admin/custom/assets/pendingShares-B0rqjI4o.js +2 -0
  18. package/admin/custom/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  19. package/admin/custom/assets/utils-BH7Z2GoV.js +4 -0
  20. package/admin/custom/assets/vite-preload-helper-DjNwdemH.js +1 -0
  21. package/admin/custom/customComponents.js +2 -2
  22. package/admin/custom/i18n/de.json +29 -29
  23. package/admin/custom/i18n/en.json +1 -1
  24. package/admin/custom/i18n/es.json +29 -29
  25. package/admin/custom/i18n/fr.json +29 -29
  26. package/admin/custom/i18n/it.json +29 -29
  27. package/admin/custom/i18n/nl.json +29 -29
  28. package/admin/custom/i18n/pl.json +29 -29
  29. package/admin/custom/i18n/pt.json +29 -29
  30. package/admin/custom/i18n/ru.json +29 -29
  31. package/admin/custom/i18n/zh-cn.json +29 -29
  32. package/admin/custom/mf-manifest.json +1 -1
  33. package/admin/i18n/de.json +1 -1
  34. package/admin/i18n/en.json +1 -1
  35. package/admin/i18n/es.json +1 -1
  36. package/admin/i18n/fr.json +1 -1
  37. package/admin/i18n/it.json +1 -1
  38. package/admin/i18n/nl.json +1 -1
  39. package/admin/i18n/pl.json +1 -1
  40. package/admin/i18n/pt.json +1 -1
  41. package/admin/i18n/ru.json +1 -1
  42. package/admin/i18n/zh-cn.json +1 -1
  43. package/build/lib/mssql.js +10 -7
  44. package/build/lib/mssql.js.map +1 -1
  45. package/build/lib/mysql.js +12 -8
  46. package/build/lib/mysql.js.map +1 -1
  47. package/build/lib/postgresql.js +16 -13
  48. package/build/lib/postgresql.js.map +1 -1
  49. package/build/lib/sqlite.js +13 -8
  50. package/build/lib/sqlite.js.map +1 -1
  51. package/io-package.json +27 -27
  52. package/package.json +12 -12
  53. package/admin/custom/assets/Components-nTLElZ7y.js +0 -1
  54. package/admin/custom/assets/DataBrowser-CyjKP_L-.js +0 -1
  55. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-BKlHk-3o.js +0 -1
  56. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-1_ecMmwM.js +0 -1243
  57. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BJcL2b_b.js +0 -1494
  58. package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DOWbo5mU.js +0 -9
  59. package/admin/custom/assets/hostInit-CJsaB1F7.js +0 -1
  60. package/admin/custom/assets/index-D4ovp6PK.js +0 -1
  61. package/admin/custom/assets/lib-B-9Z42f0.js +0 -3
  62. package/admin/custom/assets/rolldown-runtime-C0FnF6B9.js +0 -1
  63. package/admin/custom/assets/virtualExposes-C4J_LR3_.js +0 -1
  64. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__SqlComponentsSet__customComponents_js-C7xpzcn4.js +0 -1
  65. package/admin/custom/assets/virtual_mf-exposes___mfe_internal__SqlComponentsSet__customComponents_js-DBI8_iGe.js +0 -2
  66. package/admin/custom/assets/vite-preload-helper-B7qeedMF.js +0 -1
  67. package/admin/words.js +0 -76
package/README.md CHANGED
@@ -618,34 +618,28 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
618
618
  -->
619
619
 
620
620
  ## Changelog
621
+ ### 4.1.6 (2026-10-01)
622
+ * (@DutchmanNL) Fixed `getCounter` on PostgreSQL: the queries used MySQL-style backtick quoting
623
+ * (@DutchmanNL) Fixed `getCounter` on SQLite: `ORDER BY`/`LIMIT` is not allowed on a compound-select member
624
+ * (@DutchmanNL) Fixed `getCounter` on MS SQL: the counter subquery filtered on `ts_number` instead of `ts_counter`
625
+ * (@GermanBluefox) `getCounter` now sorts in the outer query on all dialects, so the row order no longer depends on the query plan
626
+ * (@DutchmanNL) Added `getCounter` test coverage for all four dialects
627
+
628
+ ### 4.1.5 (2026-08-28)
629
+ * (@GermanBluefox) Updated packages
630
+
621
631
  ### 4.1.4 (2026-08-27)
622
632
  * (@GermanBluefox) Connection errors no longer start with the useless class name `AggregateError`: the log now shows only the real reason, e.g. `connect ECONNREFUSED 127.0.0.1:3306; connect ECONNREFUSED ::1:3306`
623
633
 
624
634
  ### 4.1.3 (2026-08-27)
625
635
  * (@GermanBluefox) Connection errors are logged with the real reason again: Node reports a failed TCP connect as an `AggregateError` whose own message is empty, so the log only showed the word `AggregateError` instead of e.g. `connect ECONNREFUSED 127.0.0.1:3306`
626
- * (@GermanBluefox) The reconnect loop no longer repeats the same connection error every 30 seconds: the first occurrence is logged as error, repetitions go to debug and once an hour a reminder is logged
636
+ * (@GermanBluefox) The reconnection loop no longer repeats the same connection error every 30 seconds: the first occurrence is logged as error, repetitions go to debug and once an hour a reminder is logged
627
637
 
628
638
  ### 4.1.2 (2026-08-27)
629
639
  * (@GermanBluefox) Fixed `enableHistory` being answered with `success: true` but silently doing nothing when it arrived while the adapter was still starting up: the adapter subscribed to object changes only after it had read the logging settings, so a message that landed in that gap activated no logging
630
640
  * (@joltcoke) Fixed average and total returning null for every interval that contains a null value: parseFloat(null) is NaN and poisoned the sum of the whole interval (thanks to @joltcoke, ioBroker/ioBroker.sql#526). As the result was NaN and not null, ignoreNull could not act on it either
631
641
  * (@joltcoke) Fixed min returning a wrong value if the interval contains a null, minmax losing the minimum if the interval starts with a null, and percentile/quantile counting a null as 0
632
642
 
633
- ### 4.1.0 (2026-08-26)
634
- * (@ipod86) Added a button to the datapoint settings to delete all logged values of this datapoint
635
- * (@GermanBluefox) The messages `delete`, `deleteRange` and `deleteAll` now report errors back to the caller instead of always answering with success
636
- * (@GermanBluefox) The messages `delete`, `deleteRange` and `deleteAll` work now also for datapoints whose logging is disabled
637
- * (@GermanBluefox) The messages `delete`, `deleteRange` and `deleteAll` delete the counter values of a numeric datapoint (table `ts_counter`) too
638
- * (@GermanBluefox) Fixed `NaN` as a result of the aggregation `percentile` with 100 or `quantile` with 1
639
- * (@GermanBluefox) Fixed the last value of the `integralTotal` aggregation: it was interpolated onto the start instead of the end of the requested range
640
- * (@GermanBluefox) Added the message `getRawEntries` to read the stored values of one datapoint page by page (with the total number of entries) for tools that show or edit the raw data
641
- * (@GermanBluefox) The message `update` works now also for datapoints whose logging is disabled and reports errors back to the caller
642
- * (@GermanBluefox) `storeState` uses the data type stored in the database for known datapoints instead of deriving it from the value
643
- * (@GermanBluefox) Added the tab `Data browser` to the instance settings: show, edit, delete and insert the stored values of a datapoint
644
- * (@GermanBluefox) Added the message `getDatapoints` that returns all datapoints of the database immediately
645
-
646
- ### 4.0.4 (2026-08-11)
647
- * (@GermanBluefox) Fixed that nothing was stored for datapoints with an `aliasId`: the adapter subscribed to the alias name instead of the real state ID, so no state change ever arrived
648
-
649
643
  [Older changelogs can be found there](CHANGELOG_OLD.md)
650
644
 
651
645
  ## License
@@ -0,0 +1 @@
1
+ import{t as e}from"./DataBrowser-B58dmY7z.js";var t={DataBrowser:e};export{t as default};
@@ -0,0 +1 @@
1
+ import{$t as e,An as t,Cn as n,En as r,Et as i,F as a,Fn as o,Gr as s,Gt as c,Ht as l,I as u,Kr as d,Kt as f,L as p,Mn as m,Mt as h,On as g,Qt as _,Rn as v,U as y,Ut as b,V as x,Vn as S,Vt as C,Yt as w,an as T,b as E,dn as D,f as O,fn as k,kn as A,kt as j,mn as M,mt as N,qr as P,rn as F,tn as I,un as L,ut as R,wn as z}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js";import{t as B}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare__shared-CW0J4wsL.js";var V={root:{display:`flex`,width:`100%`,height:`calc(100vh - 220px)`,minHeight:400,gap:8},list:{width:320,minWidth:220,display:`flex`,flexDirection:`column`,overflow:`hidden`},filterField:{padding:8,flexShrink:0},listItems:{overflowY:`auto`,flexGrow:1,minHeight:0},data:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},toolbar:{display:`flex`,alignItems:`center`,flexWrap:`nowrap`,gap:8,padding:8,overflow:`hidden`,flexShrink:0},title:{display:`flex`,flexDirection:`column`,flexGrow:1,minWidth:60,overflow:`hidden`},titleId:{fontWeight:`bold`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},titleName:{fontSize:`smaller`,opacity:.7,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},dateField:{width:200,flexShrink:0},table:{overflowY:`auto`,flexGrow:1,minHeight:0},nowrap:{whiteSpace:`nowrap`},pageInfo:{whiteSpace:`nowrap`,flexShrink:0},grow:{flexGrow:1}},H=e=>({"& input::-webkit-calendar-picker-indicator":{filter:e.palette.mode===`dark`?`invert(1)`:`none`,cursor:`pointer`}});function U(e){let t=new Date(e);if(isNaN(t.getTime()))return String(e);let n=(e,t)=>e.toString().padStart(t||2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`}function W(e){let t=e=>e.toString().padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function G(e){let t=e=>e.toString().padStart(2,`0`);return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function K(e){if(!e)return;let t=new Date(e).getTime();return isNaN(t)?void 0:t}var q=class extends B{constructor(e){super(e),this.state={...this.state,points:null,names:{},filter:``,selected:null,rows:[],total:0,page:0,rowsPerPage:100,sort:`desc`,start:``,end:``,checked:[],loadingPoints:!1,loadingRows:!1,errorText:``,entryDialog:null,confirmText:``,confirmAction:null}}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.loadDatapoints()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.points&&await this.loadDatapoints()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async loadDatapoints(){this.setState({loadingPoints:!0,errorText:``});try{let e=await this.sendToInstance(`getDatapoints`,{}),t=(e==null?void 0:e.result)||[];this.setState({points:t,loadingPoints:!1},()=>void this.loadNames(t))}catch(e){this.setState({loadingPoints:!1,points:[],errorText:e.message})}}async loadNames(e){if(e.length)try{let t=await this.props.oContext.socket.getObjectsById(e.map(e=>e.id)),n={};for(let r of e){let e=t==null?void 0:t[r.id],i=e?E.getObjectNameFromObj(e,null,{language:O.getLanguage()}):``;i&&i!==r.id&&(n[r.id]=i)}this.setState({names:n})}catch(e){console.warn(`Cannot read the names of the objects: ${e.message}`)}}async loadRows(){let e=this.state.selected;if(e){this.setState({loadingRows:!0,errorText:``});try{let t=await this.sendToInstance(`getRawEntries`,{id:e.id,start:K(this.state.start),end:K(this.state.end),limit:this.state.rowsPerPage,offset:this.state.page*this.state.rowsPerPage,sort:this.state.sort});this.setState({rows:(t==null?void 0:t.result)||[],total:(t==null?void 0:t.total)||0,checked:[],loadingRows:!1})}catch(e){this.setState({rows:[],total:0,loadingRows:!1,errorText:e.message})}}}selectDatapoint(e){this.setState({selected:e,page:0,rows:[],total:0,checked:[]},()=>void this.loadRows())}parseValue(e){var t,n;if(e===``)return null;if(((t=this.state.selected)==null?void 0:t.type)===`Number`){let t=parseFloat(e.replace(`,`,`.`));return isNaN(t)?0:t}return((n=this.state.selected)==null?void 0:n.type)===`Boolean`?e===`true`||e===`1`:e}async saveEntry(){let e=this.state.entryDialog,t=this.state.selected;if(!e||!t)return;let n=parseInt(e.ts,10);if(!n){this.setState({errorText:`Invalid timestamp`});return}let r={ts:n,val:this.parseValue(e.val),ack:e.ack,q:parseInt(e.q,10)||0};this.setState({entryDialog:null,loadingRows:!0});try{e.original?await this.sendToInstance(`update`,{id:t.id,state:r}):await this.sendToInstance(`storeState`,{id:t.id,state:r})}catch(e){this.setState({errorText:e.message})}await this.loadRows()}async deleteEntries(e){let t=this.state.selected;if(t&&e.length){this.setState({loadingRows:!0});try{e.length===1?await this.sendToInstance(`delete`,{id:t.id,ts:e[0]}):await this.sendToInstance(`delete`,e.map(e=>({id:t.id,ts:e})))}catch(e){this.setState({errorText:e.message})}await this.loadRows()}}renderDatapoints(){let n=this.state.filter.toLowerCase(),i=(this.state.points||[]).filter(e=>{var t;return!n||e.id.toLowerCase().includes(n)||((t=this.state.names[e.id])==null?void 0:t.toLowerCase().includes(n))});return P(v,{style:V.list,children:[d(w,{variant:`standard`,style:V.filterField,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),placeholder:O.t(`sql_filter`),slotProps:{input:{startAdornment:d(r,{position:`start`,children:d(j,{})}),endAdornment:this.state.filter?d(r,{position:`end`,children:d(z,{size:`small`,onClick:()=>this.setState({filter:``}),children:d(p,{})})}):null}}}),this.state.loadingPoints?d(g,{}):null,P(A,{dense:!0,style:V.listItems,children:[i.map(e=>{var n;return d(t,{selected:((n=this.state.selected)==null?void 0:n.id)===e.id,onClick:()=>this.selectDatapoint(e),sx:e=>({"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"& .MuiListItemText-secondary":{color:e.palette.primary.contrastText,opacity:.8},"&:hover":{backgroundColor:e.palette.primary.dark}}}),children:d(m,{primary:e.id,secondary:P(s,{children:[this.state.names[e.id]?d(`b`,{children:this.state.names[e.id]}):null,this.state.names[e.id]?` `:``,`[${e.type||`?`}]`]}),slotProps:{primary:{style:{wordBreak:`break-all`}},secondary:{style:{wordBreak:`break-word`}}}})},e.id)}),!i.length&&!this.state.loadingPoints?d(e,{style:{padding:16,opacity:.7},children:O.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)}):null]})]})}renderToolbar(){var t,n;let{page:r,rowsPerPage:s,total:c}=this.state,l=c?r*s+1:0,f=Math.min((r+1)*s,c);return P(`div`,{style:V.toolbar,children:[P(`div`,{style:V.title,children:[d(_,{title:((t=this.state.selected)==null?void 0:t.id)||``,children:d(`span`,{style:V.titleId,children:(n=this.state.selected)==null?void 0:n.id})}),this.state.selected&&this.state.names[this.state.selected.id]?d(`span`,{style:V.titleName,children:this.state.names[this.state.selected.id]}):null]}),d(_,{title:O.t(`sql_range_start`),children:d(w,{variant:`outlined`,size:`small`,style:V.dateField,sx:H,type:`datetime-local`,value:this.state.start,onChange:e=>this.setState({start:e.target.value,page:0},()=>void this.loadRows())})}),d(_,{title:O.t(`sql_range_end`),children:d(w,{variant:`outlined`,size:`small`,style:V.dateField,sx:H,type:`datetime-local`,value:this.state.end,onChange:e=>this.setState({end:e.target.value,page:0},()=>void this.loadRows())})}),d(S,{variant:`outlined`,size:`small`,value:s,onChange:e=>this.setState({rowsPerPage:Number(e.target.value),page:0},()=>void this.loadRows()),children:[50,100,500,1e3].map(e=>d(o,{value:e,children:e},e))}),d(_,{title:O.t(this.state.sort===`desc`?`sql_sort_desc`:`sql_sort_asc`),children:d(z,{size:`small`,onClick:()=>this.setState({sort:this.state.sort===`desc`?`asc`:`desc`,page:0},()=>void this.loadRows()),children:this.state.sort===`desc`?d(R,{}):d(N,{})})}),d(e,{style:V.pageInfo,children:O.t(`sql_page`,l.toString(),f.toString(),c.toString())}),d(z,{size:`small`,disabled:!r,onClick:()=>this.setState({page:r-1},()=>void this.loadRows()),children:d(a,{})}),d(z,{size:`small`,disabled:f>=c,onClick:()=>this.setState({page:r+1},()=>void this.loadRows()),children:d(u,{})}),d(_,{title:O.t(`sql_refresh`),children:d(z,{size:`small`,onClick:()=>void this.loadRows(),children:d(i,{})})}),d(_,{title:O.t(`sql_add`),children:d(z,{size:`small`,color:`primary`,onClick:()=>this.setState({entryDialog:{original:null,ts:Date.now().toString(),val:``,ack:!0,q:`0`}}),children:d(h,{})})}),d(_,{title:O.t(`sql_delete_selected`),children:d(`span`,{children:d(z,{size:`small`,disabled:!this.state.checked.length,onClick:()=>this.setState({confirmText:O.t(`sql_confirm_delete`,this.state.checked.length.toString()),confirmAction:()=>void this.deleteEntries(this.state.checked)}),children:d(x,{})})})})]})}renderTable(){return P(`div`,{style:V.table,children:[P(C,{size:`small`,stickyHeader:!0,children:[d(c,{children:P(f,{children:[d(b,{padding:`checkbox`,children:d(T,{indeterminate:!!this.state.checked.length&&this.state.checked.length<this.state.rows.length,checked:!!this.state.rows.length&&this.state.checked.length===this.state.rows.length,onChange:e=>this.setState({checked:e.target.checked?this.state.rows.map(e=>e.ts):[]})})}),d(b,{children:O.t(`sql_time`)}),d(b,{children:O.t(`sql_value`)}),d(b,{children:O.t(`sql_ack`)}),d(b,{children:O.t(`sql_quality`)}),d(b,{children:O.t(`sql_from`)}),d(b,{})]})}),d(l,{children:this.state.rows.map(e=>P(f,{hover:!0,children:[d(b,{padding:`checkbox`,children:d(T,{checked:this.state.checked.includes(e.ts),onChange:t=>this.setState({checked:t.target.checked?[...this.state.checked,e.ts]:this.state.checked.filter(t=>t!==e.ts)})})}),d(b,{style:V.nowrap,children:d(_,{title:e.ts.toString(),children:d(`span`,{children:U(e.ts)})})}),d(b,{style:{wordBreak:`break-all`},children:e.val===null||e.val===void 0?d(`span`,{style:{opacity:.5},children:`null`}):e.val.toString()}),d(b,{children:e.ack?`✓`:``}),d(b,{children:e.q??``}),d(b,{style:{opacity:.7},children:e.from||``}),P(b,{padding:`none`,children:[d(z,{size:`small`,onClick:()=>this.setState({entryDialog:{original:e,ts:e.ts.toString(),val:e.val===null||e.val===void 0?``:e.val.toString(),ack:!!e.ack,q:(e.q??0).toString()}}),children:d(y,{fontSize:`small`})}),d(z,{size:`small`,onClick:()=>this.setState({confirmText:O.t(`sql_confirm_delete_one`,U(e.ts)),confirmAction:()=>void this.deleteEntries([e.ts])}),children:d(x,{fontSize:`small`})})]})]},e.ts))})]}),!this.state.rows.length&&!this.state.loadingRows?d(e,{style:{padding:16,opacity:.7},children:O.t(`sql_no_data`)}):null]})}renderTimeSelector(t){let n=parseInt(t.ts,10),r=!isNaN(n),i=!!t.original,a=(e,i)=>{let a=new Date(r?n:Date.now()),o=W(a),s=G(a),c=a.getMilliseconds();if(e===`date`){if(!i)return;o=i}else if(e===`time`){if(!i)return;s=i.length===5?`${i}:00`:i}else c=Math.min(999,Math.max(0,parseInt(i,10)||0));let l=new Date(`${o}T${s}.${c.toString().padStart(3,`0`)}`).getTime();isNaN(l)||this.setState({entryDialog:{...t,ts:l.toString()}})};return P(`div`,{children:[P(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[d(w,{label:O.t(`sql_date`),type:`date`,value:r?W(new Date(n)):``,disabled:i,style:{flexGrow:1},sx:H,slotProps:{inputLabel:{shrink:!0}},onChange:e=>a(`date`,e.target.value)}),d(w,{label:O.t(`sql_time`),type:`time`,value:r?G(new Date(n)):``,disabled:i,style:{flexGrow:1},sx:H,slotProps:{inputLabel:{shrink:!0},htmlInput:{step:1}},onChange:e=>a(`time`,e.target.value)}),d(w,{label:O.t(`sql_ms`),type:`number`,value:r?new Date(n).getMilliseconds():``,disabled:i,style:{width:100},slotProps:{inputLabel:{shrink:!0},htmlInput:{min:0,max:999}},onChange:e=>a(`ms`,e.target.value)})]}),d(e,{variant:`caption`,style:{opacity:.7},children:r?`${U(n)} · ${n}`:``})]})}renderEntryDialog(){var t;let n=this.state.entryDialog;return n?P(L,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({entryDialog:null}),children:[d(M,{children:O.t(n.original?`sql_save`:`sql_add`)}),P(k,{style:{display:`flex`,flexDirection:`column`,gap:16,paddingTop:8},children:[this.renderTimeSelector(n),((t=this.state.selected)==null?void 0:t.type)===`Boolean`?P(S,{value:n.val===`true`||n.val===`1`?`true`:`false`,onChange:e=>this.setState({entryDialog:{...n,val:e.target.value}}),children:[d(o,{value:`true`,children:`true`}),d(o,{value:`false`,children:`false`})]}):d(w,{label:O.t(`sql_value`),value:n.val,autoFocus:!0,onChange:e=>this.setState({entryDialog:{...n,val:e.target.value}})}),P(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[d(T,{checked:n.ack,onChange:e=>this.setState({entryDialog:{...n,ack:e.target.checked}})}),d(e,{children:O.t(`sql_ack`)}),d(w,{label:O.t(`sql_quality`),value:n.q,type:`number`,onChange:e=>this.setState({entryDialog:{...n,q:e.target.value}})})]})]}),P(D,{children:[d(F,{variant:`contained`,color:`primary`,onClick:()=>void this.saveEntry(),children:O.t(`sql_save`)}),d(F,{variant:`outlined`,onClick:()=>this.setState({entryDialog:null}),children:O.t(`sql_cancel`)})]})]}):null}renderConfirmDialog(){return this.state.confirmAction?P(L,{open:!0,onClose:()=>this.setState({confirmText:``,confirmAction:null}),children:[d(M,{children:O.t(`sql_delete`)}),d(k,{children:this.state.confirmText}),P(D,{children:[d(F,{variant:`contained`,color:`error`,startIcon:d(x,{}),onClick:()=>{let e=this.state.confirmAction;this.setState({confirmText:``,confirmAction:null},()=>e==null?void 0:e())},children:O.t(`sql_delete`)}),d(F,{variant:`outlined`,onClick:()=>this.setState({confirmText:``,confirmAction:null}),children:O.t(`sql_cancel`)})]})]}):null}renderItem(){return this.props.alive?P(I,{style:V.root,children:[this.renderDatapoints(),P(v,{style:V.data,children:[this.state.errorText?d(n,{severity:`error`,style:{flexShrink:0},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}):null,this.state.selected?P(s,{children:[this.renderToolbar(),this.state.loadingRows?d(g,{}):null,this.renderTable()]}):d(e,{style:{padding:16,opacity:.7},children:O.t(`sql_select_datapoint`)})]}),this.renderEntryDialog(),this.renderConfirmDialog()]}):d(n,{severity:`info`,children:O.t(`sql_instance_not_alive`)})}};export{q as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./vite-preload-helper-DjNwdemH.js";import"./dist-CcO6wD-W.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t==null?void 0:t.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t},n=(e,t,n,r)=>{var i,a;let o=(i=globalThis.__mf_module_cache__)==null?void 0:i.share,s=t.map(e=>o==null?void 0:o[e]).find(e=>e!==void 0),c=(s==null?void 0:s.version)??(s==null||(a=s.default)==null?void 0:a.version),l=String(c||``).split(/[^0-9]+/).map(Number),u=String(n||``).split(/[^0-9]+/).map(Number);for(let e=0;e<Math.max(l.length,u.length);e++){if((l[e]||0)<(u[e]||0))return;if((l[e]||0)>(u[e]||0))break}for(let t of e){var d;let e=o==null?void 0:o[t];if(e!==void 0&&(!r||typeof(e==null?void 0:e[r])==`function`||typeof(e==null||(d=e.default)==null?void 0:d[r])==`function`))return e}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js`).then(e=>e.vi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js`),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js`).then(e=>e.pr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DdEgwb91.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js`).then(e=>e.Wn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js`).then(e=>e.Lt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhkczXIL.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__45000407818393__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-rYhVwVDZ.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react/jsx-runtime`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react/jsx-runtime`,`react/jsx-runtime`],[`default:react`,`react`],`19.3.0`,void 0);return a===void 0?(e.loading=(async()=>{try{let{"react/jsx-runtime":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"react-dom":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom/client":{name:`react-dom/client`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom/client`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react-dom/client`,`react-dom/client`,`default:react-dom`,`react-dom`],[`default:react`,`react`],`19.3.0`,`createRoot`);return a===void 0?(e.loading=(async()=>{try{let{"react-dom/client":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.4.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/icons-material":{name:`@mui/icons-material`,version:`9.4.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/icons-material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/icons-material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.7`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/gui-components`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/gui-components":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/json-config":{name:`@iobroker/json-config`,version:`10.0.9`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/json-config`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/json-config":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},a=[];export{a as usedRemotes,i as usedShared};