openstack-uicore-foundation 4.0.2 → 4.0.3
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/lib/components/clock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(function(){return(()=>{"use strict";var t={1186:(t,e,i)=>{function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,{default:()=>s});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(function(){return(()=>{"use strict";var t={1186:(t,e,i)=>{function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,{default:()=>s});class s{constructor(){this.originalHash="",this.hash={}}convertToHash(t){let e=(t=t.substr(1).toLowerCase()).split("&"),i={};for(let t of e){if(t=t.split("="),2!==t.length)continue;let e=t[1].trim();""!==e&&("true"!==e&&"false"!==e||(t[1]="true"==e),i[t[0]]=t[1])}return i}clearParams(){this.originalHash="",this.hash={}}getParam(t){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),this.hash.hasOwnProperty(t)?this.hash[t]:null}getParams(){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},this.hash)}deleteParam(t){var e=this.getParams();this.clearParams();for(let i in e)i!=t&&(this.hash[i]=e[i])}deleteParams(t){var e=this.getParams();this.clearParams();for(let i in e)t.includes(i)||(this.hash[i]=e[i])}setParam(t,e){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),null!==e&&""!==e?this.hash[t]=e:delete this.hash[t],this}serialize(){let t="";for(let e in this.hash){""!==t&&(t+="&"),t+=e+"="+this.hash[e]}return t}}}},e={};function i(r){var n=e[r];if(void 0!==n)return n.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,i),s.exports}(()=>{i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e}})(),(()=>{i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})}})(),(()=>{i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})();var r={};return(()=>{i.r(r),i.d(r,{default:()=>l});const t=require("react");var e=i.n(t);const n=require("moment-timezone");var s=i.n(n),o=i(1186);function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class h extends e().Component{constructor(t){super(t),a(this,"getServerTime",(async()=>{let t=await fetch("https://timeintervalsince1970.appspot.com/").catch((t=>(console.log(t),null)));return await t.json()})),a(this,"tick",(()=>{const{timestamp:t}=this.state;null!==t&&(this.props.onTick(t+1),this.setState({timestamp:t+1}))})),a(this,"now",(()=>this.state.timestamp)),this.fragmentParser=new o.default,this.interval=null,this.state={timestamp:null}}async componentDidMount(){const{timezone:t="UTC",now:e}=this.props,i=this.fragmentParser.getParam("now"),r=s().tz(i,"YYYY-MM-DD,hh:mm:ss",t);let n;if(r.isValid())n=r.valueOf()/1e3;else if(e)n=e;else{const t=s()().unix(),e=await this.getServerTime(),i=s()().unix();n=e?e.timestamp+(i-t):i}this.setState({timestamp:n}),this.props.onTick(n),this.interval=setInterval(this.tick,1e3)}componentWillUnmount(){clearInterval(this.interval)}render(){const{display:t,timezone:i="UTC"}=this.props,{timestamp:r}=this.state;return t&&r?e().createElement("div",{style:{marginTop:"50px",textAlign:"center",fontSize:"20px"}},s().tz(1e3*r,i).format("YYYY-MM-DD hh:mm:ss")):null}}const l=h})(),r})()}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(function(){return(()=>{"use strict";var t={};(()=>{t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})}})(),(()=>{t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})();var e={};function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}t.r(e),t.d(e,{default:()=>i});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(function(){return(()=>{"use strict";var t={};(()=>{t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})}})(),(()=>{t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})();var e={};function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}t.r(e),t.d(e,{default:()=>i});class i{constructor(){this.originalHash="",this.hash={}}convertToHash(t){let e=(t=t.substr(1).toLowerCase()).split("&"),r={};for(let t of e){if(t=t.split("="),2!==t.length)continue;let e=t[1].trim();""!==e&&("true"!==e&&"false"!==e||(t[1]="true"==e),r[t[0]]=t[1])}return r}clearParams(){this.originalHash="",this.hash={}}getParam(t){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),this.hash.hasOwnProperty(t)?this.hash[t]:null}getParams(){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},this.hash)}deleteParam(t){var e=this.getParams();this.clearParams();for(let r in e)r!=t&&(this.hash[r]=e[r])}deleteParams(t){var e=this.getParams();this.clearParams();for(let r in e)t.includes(r)||(this.hash[r]=e[r])}setParam(t,e){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),null!==e&&""!==e?this.hash[t]=e:delete this.hash[t],this}serialize(){let t="";for(let e in this.hash){""!==t&&(t+="&"),t+=e+"="+this.hash[e]}return t}}return e})()}));
|