@cortezaproject/corteza-vue 2024.9.3-dev.1 → 2024.9.3-dev.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
@@ -7778,6 +7778,15 @@ var __vue_staticRenderFns__$14 = [];
7778
7778
  //
7779
7779
  //
7780
7780
  //
7781
+ //
7782
+ //
7783
+ //
7784
+ //
7785
+ //
7786
+ //
7787
+ //
7788
+ //
7789
+ //
7781
7790
 
7782
7791
  var script$17 = {
7783
7792
  name: 'CFormTableWrapper',
@@ -7807,6 +7816,11 @@ var script$17 = {
7807
7816
  type: String,
7808
7817
  default: '',
7809
7818
  },
7819
+
7820
+ loading: {
7821
+ type: Boolean,
7822
+ default: false,
7823
+ },
7810
7824
  },
7811
7825
  };
7812
7826
 
@@ -7814,17 +7828,17 @@ var script$17 = {
7814
7828
  const __vue_script__$17 = script$17;
7815
7829
 
7816
7830
  /* template */
7817
- var __vue_render__$13 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"list-background w-100 p-3 rounded border border-light"},[_vm._t("default"),_vm._v(" "),(!_vm.hideAddButton)?_c('b-button',{class:_vm.addButtonClass,attrs:{"variant":"primary","size":"sm","data-test-id":_vm.testID,"disabled":_vm.disableAddButton},on:{"click":function($event){return _vm.$emit('add-item')}}},[_c('font-awesome-icon',{staticClass:"mr-1",attrs:{"icon":['fas', 'plus']}}),_vm._v("\n\n "+_vm._s(_vm.labels.addButton || '')+"\n ")],1):_vm._e()],2)};
7831
+ var __vue_render__$13 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"list-background w-100 p-3 rounded border border-light"},[(_vm.loading)?_c('div',{staticClass:"d-flex justify-content-center align-items-center w-100"},[_c('b-spinner')],1):_vm._t("default"),_vm._v(" "),(!_vm.hideAddButton && !_vm.loading)?_c('b-button',{class:_vm.addButtonClass,attrs:{"variant":"primary","size":"sm","data-test-id":_vm.testID,"disabled":_vm.disableAddButton},on:{"click":function($event){return _vm.$emit('add-item')}}},[_c('font-awesome-icon',{staticClass:"mr-1",attrs:{"icon":['fas', 'plus']}}),_vm._v("\n\n "+_vm._s(_vm.labels.addButton || '')+"\n ")],1):_vm._e()],2)};
7818
7832
  var __vue_staticRenderFns__$13 = [];
7819
7833
 
7820
7834
  /* style */
7821
7835
  const __vue_inject_styles__$18 = function (inject) {
7822
7836
  if (!inject) return
7823
- inject("data-v-f9ac8e80_0", { source: ".list-background[data-v-f9ac8e80]{background-color:var(--body-bg)}", map: undefined, media: undefined });
7837
+ inject("data-v-7ae53668_0", { source: ".list-background[data-v-7ae53668]{background-color:var(--body-bg)}", map: undefined, media: undefined });
7824
7838
 
7825
7839
  };
7826
7840
  /* scoped */
7827
- const __vue_scope_id__$18 = "data-v-f9ac8e80";
7841
+ const __vue_scope_id__$18 = "data-v-7ae53668";
7828
7842
  /* module identifier */
7829
7843
  const __vue_module_identifier__$18 = undefined;
7830
7844
  /* functional template */
@@ -8066,7 +8080,7 @@ var script$16 = {
8066
8080
  const __vue_script__$16 = script$16;
8067
8081
 
8068
8082
  /* template */
8069
- var __vue_render__$12 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('c-form-table-wrapper',{attrs:{"labels":{ addButton: _vm.labels.addButton },"hide-add-button":_vm.textInput},on:{"add-item":function($event){return _vm.items.push({ field: undefined, descending: false })}}},[(!_vm.textInput)?_c('b-form-group',{attrs:{"label":_vm.labels.title,"label-class":"text-primary"}},[_c('b-table-simple',{staticClass:"mb-0",attrs:{"borderless":"","small":"","responsive":"lg"}},[_c('draggable',{attrs:{"list":_vm.items,"group":"sort","handle":".grab","tag":"tbody"},on:{"update:list":function($event){_vm.items=$event;}}},_vm._l((_vm.items),function(column,index){return _c('tr',{key:index},[_c('td',{staticClass:"grab text-center align-middle",staticStyle:{"width":"40px"}},[_c('font-awesome-icon',{staticClass:"text-secondary",attrs:{"icon":['fas', 'bars']}})],1),_vm._v(" "),_c('td',{staticClass:"align-middle",staticStyle:{"min-width":"250px"}},[_c('c-input-select',{staticClass:"rounded",attrs:{"options":_vm.availableFields,"reduce":function (o) { return o.name; },"placeholder":_vm.labels.none},model:{value:(column.field),callback:function ($$v) {_vm.$set(column, "field", $$v);},expression:"column.field"}})],1),_vm._v(" "),_c('td',{staticClass:"text-center align-middle",staticStyle:{"min-width":"200px"}},[_c('b-form-radio-group',{staticClass:"bg-white",attrs:{"options":_vm.sortDirections,"buttons":"","button-variant":"outline-primary"},model:{value:(column.descending),callback:function ($$v) {_vm.$set(column, "descending", $$v);},expression:"column.descending"}})],1),_vm._v(" "),_c('td',{staticClass:"align-middle text-right",staticStyle:{"min-width":"80px","width":"80px"}},[_c('c-input-confirm',{attrs:{"show-icon":""},on:{"confirmed":function($event){return _vm.items.splice(index, 1)}}})],1)])}),0)],1)],1):_c('div',[_c('b-form-textarea',{attrs:{"placeholder":_vm.labels.placeholder},model:{value:(_vm.presortValue),callback:function ($$v) {_vm.presortValue=$$v;},expression:"presortValue"}}),_vm._v(" "),_c('b-form-text',[_vm._v("\n "+_vm._s(_vm.labels.footnote)+"\n ")])],1),_vm._v(" "),(_vm.allowTextInput)?_c('div',{staticClass:"d-flex align-items-center mt-1"},[_c('b-button',{staticClass:"text-decoration-none ml-auto",attrs:{"variant":"link","size":"sm"},on:{"click":function($event){_vm.textInput = !_vm.textInput;}}},[_vm._v("\n "+_vm._s(_vm.labels.toggleInput)+"\n ")])],1):_vm._e()],1)};
8083
+ var __vue_render__$12 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('c-form-table-wrapper',{attrs:{"labels":{ addButton: _vm.labels.addButton },"hide-add-button":_vm.textInput},on:{"add-item":function($event){return _vm.items.push({ field: undefined, descending: false })}}},[(!_vm.textInput)?_c('b-form-group',{attrs:{"label":_vm.labels.title,"label-class":"text-primary"}},[_c('b-table-simple',{staticClass:"mb-0",attrs:{"borderless":"","small":"","responsive":""}},[_c('draggable',{attrs:{"list":_vm.items,"group":"sort","handle":".grab","tag":"tbody"},on:{"update:list":function($event){_vm.items=$event;}}},_vm._l((_vm.items),function(column,index){return _c('tr',{key:index},[_c('td',{staticClass:"grab text-center align-middle",staticStyle:{"width":"40px"}},[_c('font-awesome-icon',{staticClass:"text-secondary",attrs:{"icon":['fas', 'bars']}})],1),_vm._v(" "),_c('td',{staticClass:"align-middle",staticStyle:{"min-width":"250px"}},[_c('c-input-select',{staticClass:"rounded",attrs:{"options":_vm.availableFields,"reduce":function (o) { return o.name; },"placeholder":_vm.labels.none},model:{value:(column.field),callback:function ($$v) {_vm.$set(column, "field", $$v);},expression:"column.field"}})],1),_vm._v(" "),_c('td',{staticClass:"text-center align-middle",staticStyle:{"min-width":"200px"}},[_c('b-form-radio-group',{staticClass:"bg-white",attrs:{"options":_vm.sortDirections,"buttons":"","button-variant":"outline-primary"},model:{value:(column.descending),callback:function ($$v) {_vm.$set(column, "descending", $$v);},expression:"column.descending"}})],1),_vm._v(" "),_c('td',{staticClass:"align-middle text-right",staticStyle:{"min-width":"80px","width":"80px"}},[_c('c-input-confirm',{attrs:{"show-icon":""},on:{"confirmed":function($event){return _vm.items.splice(index, 1)}}})],1)])}),0)],1)],1):_c('div',[_c('b-form-textarea',{attrs:{"placeholder":_vm.labels.placeholder},model:{value:(_vm.presortValue),callback:function ($$v) {_vm.presortValue=$$v;},expression:"presortValue"}}),_vm._v(" "),_c('b-form-text',[_vm._v("\n "+_vm._s(_vm.labels.footnote)+"\n ")])],1),_vm._v(" "),(_vm.allowTextInput)?_c('div',{staticClass:"d-flex align-items-center mt-1"},[_c('b-button',{staticClass:"text-decoration-none ml-auto",attrs:{"variant":"link","size":"sm"},on:{"click":function($event){_vm.textInput = !_vm.textInput;}}},[_vm._v("\n "+_vm._s(_vm.labels.toggleInput)+"\n ")])],1):_vm._e()],1)};
8070
8084
  var __vue_staticRenderFns__$12 = [];
8071
8085
 
8072
8086
  /* style */
@@ -20987,7 +21001,7 @@ var __vue_staticRenderFns__$a = [];
20987
21001
  /* style */
20988
21002
  const __vue_inject_styles__$a = undefined;
20989
21003
  /* scoped */
20990
- const __vue_scope_id__$a = "data-v-d140a564";
21004
+ const __vue_scope_id__$a = "data-v-92f5374e";
20991
21005
  /* module identifier */
20992
21006
  const __vue_module_identifier__$a = undefined;
20993
21007
  /* functional template */
@@ -21063,71 +21077,84 @@ var script$9 = {
21063
21077
  async handleRecordNavigation () {
21064
21078
  const { namespaceID, recordID, moduleID, openMode, edit } = this.notification.config;
21065
21079
 
21066
- const namespace = await this.$ComposeAPI.namespaceRead({ namespaceID });
21080
+ try {
21081
+ const namespace = await this.$ComposeAPI.namespaceRead({ namespaceID });
21067
21082
 
21068
- if (!namespace) {
21069
- return
21070
- }
21083
+ if (!namespace) {
21084
+ this.toastDanger(this.$t('namespaceNotFound'));
21085
+ return
21086
+ }
21071
21087
 
21072
- const slug = namespace.slug || namespace.namespaceID;
21088
+ const slug = namespace.slug || namespace.namespaceID;
21073
21089
 
21074
- const recordPages = await this.$ComposeAPI.pageList({ moduleID, namespaceID }).then(({ set = [] }) => set);
21090
+ const recordPages = await this.$ComposeAPI.pageList({ moduleID, namespaceID }).then(({ set = [] }) => set);
21075
21091
 
21076
- if (!recordPages || recordPages.length === 0) {
21077
- return
21078
- }
21079
-
21080
- const { pageID } = recordPages[0];
21092
+ if (!recordPages || recordPages.length === 0) {
21093
+ this.toastDanger(this.$t('pageNotFound'));
21094
+ return
21095
+ }
21081
21096
 
21082
- if (this.$router.app.$options.name !== 'compose') {
21083
- const u = new URL(window.location);
21084
- const url = `${u.origin}/compose/ns/${slug}/pages/${pageID}/record/${recordID}/${edit ? 'edit' : ''}`;
21097
+ const record = await this.$ComposeAPI.recordRead({ recordID, moduleID, namespaceID });
21085
21098
 
21086
- if (openMode === 'newTab') {
21087
- window.open(url, '_blank');
21088
- } else {
21089
- window.location = url;
21099
+ if (!record) {
21100
+ this.toastDanger(this.$t('recordNotFound'));
21101
+ return
21090
21102
  }
21091
21103
 
21092
- return
21093
- }
21104
+ const { pageID } = recordPages[0];
21094
21105
 
21095
- let routeName = 'page.record';
21106
+ if (this.$router.app.$options.name !== 'compose') {
21107
+ const u = new URL(window.location);
21108
+ const url = `${u.origin}/compose/ns/${slug}/pages/${pageID}/record/${recordID}/${edit ? 'edit' : ''}`;
21096
21109
 
21097
- if (!recordID || recordID === '0') {
21098
- routeName += '.create';
21099
- } else if (edit) {
21100
- routeName += '.edit';
21101
- }
21110
+ if (openMode === 'newTab') {
21111
+ window.open(url, '_blank');
21112
+ } else {
21113
+ window.location = url;
21114
+ }
21102
21115
 
21103
- const routeParams = {
21104
- name: routeName,
21105
- params: {
21106
- recordID,
21107
- pageID,
21108
- slug,
21109
- edit,
21110
- },
21111
- };
21116
+ return
21117
+ }
21118
+
21119
+ let routeName = 'page.record';
21120
+
21121
+ if (!recordID || recordID === '0') {
21122
+ routeName += '.create';
21123
+ } else if (edit) {
21124
+ routeName += '.edit';
21125
+ }
21112
21126
 
21113
- // If name and params match, make sure to refresh page instead of pushing
21114
- const sameRoute = routeName === this.$route.name &&
21115
- slug === this.$route.params.slug &&
21116
- pageID === this.$route.params.pageID &&
21117
- recordID === this.$route.params.recordID;
21118
-
21119
- if (openMode === 'newTab') {
21120
- window.open(this.$router.resolve(routeParams).href, '_blank');
21121
- } else if (this.isOnPagesRouteOrChild && !sameRoute && openMode === 'modal') {
21122
- this.$root.$emit('show-record-modal', {
21123
- recordID: !recordID || recordID === '0' ? '0' : recordID,
21124
- recordPageID: pageID,
21127
+ const routeParams = {
21128
+ name: routeName,
21129
+ params: {
21130
+ recordID,
21131
+ pageID,
21132
+ slug,
21125
21133
  edit,
21126
- });
21134
+ },
21135
+ };
21127
21136
 
21128
- return
21129
- } else {
21130
- this.$router.push(routeParams);
21137
+ // If name and params match, make sure to refresh page instead of pushing
21138
+ const sameRoute = routeName === this.$route.name &&
21139
+ slug === this.$route.params.slug &&
21140
+ pageID === this.$route.params.pageID &&
21141
+ recordID === this.$route.params.recordID;
21142
+
21143
+ if (openMode === 'newTab') {
21144
+ window.open(this.$router.resolve(routeParams).href, '_blank');
21145
+ } else if (this.isOnPagesRouteOrChild && !sameRoute && openMode === 'modal') {
21146
+ this.$root.$emit('show-record-modal', {
21147
+ recordID: !recordID || recordID === '0' ? '0' : recordID,
21148
+ recordPageID: pageID,
21149
+ edit,
21150
+ });
21151
+
21152
+ return
21153
+ } else {
21154
+ this.$router.push(routeParams);
21155
+ }
21156
+ } catch (error) {
21157
+ this.toastErrorHandler(this.$t('recordRedirectError'))(error);
21131
21158
  }
21132
21159
  },
21133
21160
  },
@@ -21167,8 +21194,8 @@ var __vue_staticRenderFns__$9 = [];
21167
21194
  undefined);
21168
21195
 
21169
21196
  var NotificationTypes = {
21170
- Simple: __vue_component__$a,
21171
- Record: __vue_component__$9,
21197
+ NotificationSimple: __vue_component__$a,
21198
+ NotificationRecord: __vue_component__$9,
21172
21199
  };
21173
21200
 
21174
21201
  //
@@ -21265,7 +21292,7 @@ var script$8 = {
21265
21292
  let { kind } = this.notification;
21266
21293
  kind = kind.charAt(0).toUpperCase() + kind.slice(1);
21267
21294
 
21268
- return NotificationTypes[kind]
21295
+ return NotificationTypes[`Notification${kind}`]
21269
21296
  },
21270
21297
  },
21271
21298
  };
@@ -21280,11 +21307,11 @@ var __vue_staticRenderFns__$8 = [];
21280
21307
  /* style */
21281
21308
  const __vue_inject_styles__$8 = function (inject) {
21282
21309
  if (!inject) return
21283
- inject("data-v-27eea3d6_0", { source: ".notification-item-container[data-v-27eea3d6]:hover{background-color:var(--light)!important}.notification-item-container .notification-item[data-v-27eea3d6]{transition:background-color .2s ease;cursor:pointer}.notification-item-container .notification-item.read .notification-item-content[data-v-27eea3d6]{opacity:.5!important}.notification-item-container:hover .action-menu[data-v-27eea3d6]{opacity:1!important;pointer-events:auto}.notification-item-container .action-menu[data-v-27eea3d6]{position:absolute;top:.5rem;right:.5rem;z-index:2;opacity:0;pointer-events:none;transition:opacity .2s ease}", map: undefined, media: undefined });
21310
+ inject("data-v-de33bfca_0", { source: ".notification-item-container[data-v-de33bfca]:hover{background-color:var(--light)!important}.notification-item-container .notification-item[data-v-de33bfca]{transition:background-color .2s ease;cursor:pointer}.notification-item-container .notification-item.read .notification-item-content[data-v-de33bfca]{opacity:.5!important}.notification-item-container:hover .action-menu[data-v-de33bfca]{opacity:1!important;pointer-events:auto}.notification-item-container .action-menu[data-v-de33bfca]{position:absolute;top:.5rem;right:.5rem;z-index:2;opacity:0;pointer-events:none;transition:opacity .2s ease}", map: undefined, media: undefined });
21284
21311
 
21285
21312
  };
21286
21313
  /* scoped */
21287
- const __vue_scope_id__$8 = "data-v-27eea3d6";
21314
+ const __vue_scope_id__$8 = "data-v-de33bfca";
21288
21315
  /* module identifier */
21289
21316
  const __vue_module_identifier__$8 = undefined;
21290
21317
  /* functional template */