@cortezaproject/corteza-vue 2022.3.0 → 2022.3.2

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.js CHANGED
@@ -2013,8 +2013,6 @@ class Auth {
2013
2013
  return __awaiter(this, void 0, void 0, function* () {
2014
2014
  this.log.info('handling authentication');
2015
2015
  // State management
2016
- // - duplication checking
2017
- // - management handlers
2018
2016
  const dup = this.handleStateManagement();
2019
2017
  if (dup) {
2020
2018
  this.log.debug('duplicate tab: unauthorized');
@@ -2051,14 +2049,25 @@ class Auth {
2051
2049
  handleStateManagement() {
2052
2050
  // See if this is a duplicate
2053
2051
  const dup = this.sessionStorage.getItem(storeKeyFinalState) !== null;
2054
- // Bind listeners to cleanup
2055
- this.registerEventListener('beforeunload', function () {
2056
- this.sessionStorage.removeItem(storeKeyFinalState);
2057
- });
2058
- // Set state
2059
- this.sessionStorage.setItem(storeKeyFinalState, Date.now().toString());
2052
+ window.sessionStorage.setItem(storeKeyFinalState, Date.now().toString());
2060
2053
  return dup;
2061
2054
  }
2055
+ bindListeners() {
2056
+ // binding multiple listeners for cases where some browser refuser
2057
+ // to emit one of them.
2058
+ this.registerEventListener('pagehide', () => {
2059
+ this.cleanFlags();
2060
+ });
2061
+ this.registerEventListener('unload', () => {
2062
+ this.cleanFlags();
2063
+ });
2064
+ this.registerEventListener('beforeunload', () => {
2065
+ this.cleanFlags();
2066
+ });
2067
+ }
2068
+ cleanFlags() {
2069
+ this.sessionStorage.removeItem(storeKeyFinalState);
2070
+ }
2062
2071
  /**
2063
2072
  * Called when refresh token is re-fetched.
2064
2073
  *
@@ -2104,6 +2113,7 @@ class Auth {
2104
2113
  this.log.info('authorization code received', code);
2105
2114
  const rsp = yield this.exchangeCode(code);
2106
2115
  this.log.info('redirecting back to final destination', finalLocation);
2116
+ this.cleanFlags();
2107
2117
  this.location.assign(finalLocation);
2108
2118
  return rsp;
2109
2119
  });
@@ -2139,6 +2149,7 @@ class Auth {
2139
2149
  authUser.meta.preferredLanguage = data.preferred_language || 'en';
2140
2150
  }
2141
2151
  this[user] = authUser;
2152
+ this.bindListeners();
2142
2153
  return data;
2143
2154
  }).catch((error) => {
2144
2155
  this.log.error('data fetch form info endpoint failed', { oauth2InfoURL, headers, error });
@@ -2161,7 +2172,11 @@ class Auth {
2161
2172
  * Refresh token found in the storage,
2162
2173
  * let's use it to get new access token
2163
2174
  */
2164
- return this.exchangeRefresh(refreshToken);
2175
+ return this.exchangeRefresh(refreshToken)
2176
+ .then(r => {
2177
+ this.bindListeners();
2178
+ return r;
2179
+ });
2165
2180
  }
2166
2181
  throw new Error('Unauthenticated');
2167
2182
  });
@@ -2181,6 +2196,7 @@ class Auth {
2181
2196
  */
2182
2197
  startAuthenticationFlow() {
2183
2198
  this.log.debug('starting new authentication flow');
2199
+ this.cleanFlags();
2184
2200
  this.incFlowCounter();
2185
2201
  const state = Math.random().toString(36).substring(2);
2186
2202
  this.sessionStorage.setItem(`auth.state.${state}.location`, this.getRedirect(this.location.toString()));
@@ -71260,13 +71276,13 @@ var script$a = {
71260
71276
  const __vue_script__$a = script$a;
71261
71277
 
71262
71278
  /* template */
71263
- var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-input-group',{staticClass:"position-static"},[(!_vm.noDate)?_c('b-form-datepicker',{staticClass:"text-nowrap",attrs:{"placeholder":_vm.labels.none,"date-format-options":{ year: 'numeric', month: 'numeric', day: 'numeric' },"min":_vm.minDate,"max":_vm.maxDate,"label-reset-button":_vm.labels.clear,"label-today-button":_vm.labels.today,"label-help":"","today-variant":"info","selected-variant":"secondary","boundary":"window","hide-header":"","reset-button":"","today-button":""},model:{value:(_vm.date),callback:function ($$v) {_vm.date=$$v;},expression:"date"}}):_vm._e(),_vm._v(" "),(!_vm.noTime)?_c('b-form-timepicker',{staticClass:"text-nowrap",attrs:{"placeholder":_vm.labels.none,"label-reset-button":_vm.labels.clear,"label-now-button":_vm.labels.now,"boundary":"window","hide-header":"","no-close-button":"","reset-button":"","now-button":""},model:{value:(_vm.time),callback:function ($$v) {_vm.time=$$v;},expression:"time"}}):_vm._e()],1)};
71279
+ var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-row',{staticClass:"c-input-date-time",attrs:{"align-v":"stretch","no-gutters":""}},[_c('b-col',{staticClass:"position-static overflow-hidden",attrs:{"lg":_vm.noTime ? 12 : 6}},[(!_vm.noDate)?_c('b-form-datepicker',{staticClass:"h-100 overflow-hidden",attrs:{"placeholder":_vm.labels.none,"date-format-options":{ year: 'numeric', month: 'numeric', day: 'numeric' },"min":_vm.minDate,"max":_vm.maxDate,"label-reset-button":_vm.labels.clear,"label-today-button":_vm.labels.today,"label-help":"","today-variant":"info","selected-variant":"secondary","boundary":"window","hide-header":"","reset-button":"","today-button":""},model:{value:(_vm.date),callback:function ($$v) {_vm.date=$$v;},expression:"date"}}):_vm._e()],1),_vm._v(" "),_c('b-col',{staticClass:"position-static overflow-hidden",class:{ 'mt-1 mt-lg-0 pl-lg-1': !_vm.noDate },attrs:{"lg":_vm.noDate ? 12 : 6}},[(!_vm.noTime)?_c('b-form-timepicker',{staticClass:"h-100 overflow-hidden",attrs:{"placeholder":_vm.labels.none,"label-reset-button":_vm.labels.clear,"label-now-button":_vm.labels.now,"boundary":"window","hide-header":"","no-close-button":"","reset-button":"","now-button":""},model:{value:(_vm.time),callback:function ($$v) {_vm.time=$$v;},expression:"time"}}):_vm._e()],1)],1)};
71264
71280
  var __vue_staticRenderFns__$9 = [];
71265
71281
 
71266
71282
  /* style */
71267
71283
  const __vue_inject_styles__$b = function (inject) {
71268
71284
  if (!inject) return
71269
- inject("data-v-2876e522_0", { source: ".b-calendar-inner{background-color:#fff}", map: undefined, media: undefined });
71285
+ inject("data-v-1bc6bb72_0", { source: ".c-input-date-time{min-width:120px}.c-input-date-time .btn{padding:.25rem .5rem}.c-input-date-time label{font-family:Poppins-Regular;color:#495057!important}.b-calendar-inner{background-color:#fff}@media (min-width:992px){.c-input-date-time{min-width:250px}}", map: undefined, media: undefined });
71270
71286
 
71271
71287
  };
71272
71288
  /* scoped */
@@ -82159,12 +82175,20 @@ var script$G = {
82159
82175
 
82160
82176
  watch: {
82161
82177
  items: {
82162
- handler: function (items) {
82163
- for (const i of items) {
82164
- this.setState(i.page, this.startExpanded);
82165
- }
82166
- },
82167
- immediate: true
82178
+ immediate: true,
82179
+
82180
+ handler(items = []) {
82181
+ items.forEach(({
82182
+ page
82183
+ }) => {
82184
+ const px = this.pageIndex(page); // Apply startExpanded only if page isn't currently expanded
82185
+
82186
+ if (!this.collapses[px]) {
82187
+ this.$set(this.collapses, px, this.startExpanded);
82188
+ }
82189
+ });
82190
+ }
82191
+
82168
82192
  }
82169
82193
  },
82170
82194
  methods: {
@@ -82183,11 +82207,6 @@ var script$G = {
82183
82207
  this.$set(this.collapses, px, !this.collapses[px]);
82184
82208
  },
82185
82209
 
82186
- setState(p, state = false) {
82187
- const px = this.pageIndex(p);
82188
- this.$set(this.collapses, px, state);
82189
- },
82190
-
82191
82210
  // Recursively check for child pages that are open, so that parents can open aswell
82192
82211
  showChildren({
82193
82212
  params = {},
@@ -82211,21 +82230,21 @@ var script$G = {
82211
82230
  const __vue_script__$G = script$G;
82212
82231
 
82213
82232
  /* template */
82214
- var __vue_render__$C = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"nav-sidebar"},_vm._l((_vm.items),function(ref,index){
82233
+ var __vue_render__$C = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"nav-sidebar"},_vm._l((_vm.items),function(ref){
82215
82234
  var page = ref.page; if ( page === void 0 ) page = {};
82216
82235
  var params = ref.params; if ( params === void 0 ) params = {};
82217
82236
  var children = ref.children; if ( children === void 0 ) children = [];
82218
- return _c('b-button',{key:index,staticClass:"w-100 text-dark text-decoration-none p-0 pt-2 nav-item",attrs:{"variant":"link","active-class":"nav-active","exact-active-class":"nav-active","to":{ name: page.name || _vm.defaultRouteName, params: params }}},[_c('span',{staticClass:"d-inline-block w-75 text-nowrap text-truncate",on:{"click":function($event){return _vm.closeSidebar()}}},[(page.icon)?_c('font-awesome-icon',{staticClass:"icon",attrs:{"icon":page.icon}}):_vm._e(),_vm._v(" "),_c('span',{staticClass:"title"},[_vm._v("\n "+_vm._s(page.title)+"\n ")])],1),_vm._v(" "),(children.length)?[_c('b-button',{staticClass:"p-0 float-right",attrs:{"variant":"link","disabled":_vm.showChildren({ params: params, children: children })},on:{"click":function($event){if($event.target !== $event.currentTarget){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.toggle(page)}}},[(!_vm.collapses[_vm.pageIndex(page)])?_c('font-awesome-icon',{staticClass:"pointer-none",attrs:{"icon":['fas', 'chevron-down']}}):_c('font-awesome-icon',{staticClass:"pointer-none",attrs:{"icon":['fas', 'chevron-up']}})],1),_vm._v(" "),_c('b-collapse',{attrs:{"visible":_vm.collapses[_vm.pageIndex(page)] || _vm.showChildren({ params: params, children: children })},on:{"click":function($event){$event.stopPropagation();$event.preventDefault();}}},[_c('c-sidebar-nav-items',_vm._g({staticClass:"ml-2",attrs:{"items":children,"start-expanded":_vm.startExpanded,"default-route-name":_vm.defaultRouteName}},_vm.$listeners))],1)]:_vm._e()],2)}),1)};
82237
+ return _c('b-button',{key:_vm.pageIndex(page),staticClass:"w-100 text-dark text-decoration-none p-0 pt-2 nav-item",attrs:{"variant":"link","active-class":"nav-active","exact-active-class":"nav-active","to":{ name: page.name || _vm.defaultRouteName, params: params }}},[_c('span',{staticClass:"d-inline-block w-75 text-nowrap text-truncate",on:{"click":function($event){return _vm.closeSidebar()}}},[(page.icon)?_c('font-awesome-icon',{staticClass:"icon",attrs:{"icon":page.icon}}):_vm._e(),_vm._v(" "),_c('span',{staticClass:"title"},[_vm._v("\n "+_vm._s(page.title)+"\n ")])],1),_vm._v(" "),(children.length)?[_c('b-button',{staticClass:"p-0 float-right",attrs:{"variant":"link","disabled":_vm.showChildren({ params: params, children: children })},on:{"click":function($event){if($event.target !== $event.currentTarget){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.toggle(page)}}},[(!_vm.collapses[_vm.pageIndex(page)])?_c('font-awesome-icon',{staticClass:"pointer-none",attrs:{"icon":['fas', 'chevron-down']}}):_c('font-awesome-icon',{staticClass:"pointer-none",attrs:{"icon":['fas', 'chevron-up']}})],1),_vm._v(" "),_c('b-collapse',{attrs:{"visible":_vm.collapses[_vm.pageIndex(page)] || _vm.showChildren({ params: params, children: children })},on:{"click":function($event){$event.stopPropagation();$event.preventDefault();}}},[_c('c-sidebar-nav-items',_vm._g({staticClass:"ml-2",attrs:{"items":children,"start-expanded":_vm.startExpanded,"default-route-name":_vm.defaultRouteName}},_vm.$listeners))],1)]:_vm._e()],2)}),1)};
82219
82238
  var __vue_staticRenderFns__$C = [];
82220
82239
 
82221
82240
  /* style */
82222
82241
  const __vue_inject_styles__$H = function (inject) {
82223
82242
  if (!inject) return
82224
- inject("data-v-16ceb9b5_0", { source: ".pointer-none[data-v-16ceb9b5]{pointer-events:none}.svg-inline--fa[data-v-16ceb9b5]{width:30px}.nav-item>span>.title[data-v-16ceb9b5]{font-family:Poppins-Regular}.nav-active>span>.icon[data-v-16ceb9b5]{color:#4d7281}.nav-active>span>.title[data-v-16ceb9b5]{font-family:Poppins-SemiBold}.nav-item[data-v-16ceb9b5]{text-align:left}[dir=rtl] .nav-item[data-v-16ceb9b5]{text-align:right}", map: undefined, media: undefined });
82243
+ inject("data-v-bae441da_0", { source: ".pointer-none[data-v-bae441da]{pointer-events:none}.svg-inline--fa[data-v-bae441da]{width:30px}.nav-item>span>.title[data-v-bae441da]{font-family:Poppins-Regular}.nav-active>span>.icon[data-v-bae441da]{color:#4d7281}.nav-active>span>.title[data-v-bae441da]{font-family:Poppins-SemiBold}.nav-item[data-v-bae441da]{text-align:left}[dir=rtl] .nav-item[data-v-bae441da]{text-align:right}", map: undefined, media: undefined });
82225
82244
 
82226
82245
  };
82227
82246
  /* scoped */
82228
- const __vue_scope_id__$H = "data-v-16ceb9b5";
82247
+ const __vue_scope_id__$H = "data-v-bae441da";
82229
82248
  /* module identifier */
82230
82249
  const __vue_module_identifier__$H = undefined;
82231
82250
  /* functional template */
@@ -83222,7 +83241,11 @@ var script$R = {
83222
83241
  if (this.disabledSorting) {
83223
83242
  this.selected = this.frozen().filter(i => !this.available.includes(i));
83224
83243
  } else {
83225
- this.selected.push(item);
83244
+ if (!this.selected.some(({
83245
+ value = ''
83246
+ }) => value === item.value)) {
83247
+ this.selected.push(item);
83248
+ }
83226
83249
  }
83227
83250
  }, 300),
83228
83251