@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.
@@ -1,6 +1,6 @@
1
- import Simple from './Simple.vue';
1
+ import NotificationSimple from './NotificationSimple.vue';
2
2
  declare const _default: {
3
- Simple: import("vue").VueConstructor<Simple<globalThis.Record<string, any>, globalThis.Record<string, any>, never, never, (event: string, ...args: any[]) => Simple>>;
4
- Record: import("vue").VueConstructor<Simple<globalThis.Record<string, any>, globalThis.Record<string, any>, never, never, (event: string, ...args: any[]) => Simple>>;
3
+ NotificationSimple: import("vue").VueConstructor<NotificationSimple<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => NotificationSimple>>;
4
+ NotificationRecord: import("vue").VueConstructor<NotificationSimple<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => NotificationSimple>>;
5
5
  };
6
6
  export default _default;
package/dist/index.es.js CHANGED
@@ -7756,6 +7756,15 @@ var __vue_staticRenderFns__$14 = [];
7756
7756
  //
7757
7757
  //
7758
7758
  //
7759
+ //
7760
+ //
7761
+ //
7762
+ //
7763
+ //
7764
+ //
7765
+ //
7766
+ //
7767
+ //
7759
7768
 
7760
7769
  var script$17 = {
7761
7770
  name: 'CFormTableWrapper',
@@ -7785,6 +7794,11 @@ var script$17 = {
7785
7794
  type: String,
7786
7795
  default: '',
7787
7796
  },
7797
+
7798
+ loading: {
7799
+ type: Boolean,
7800
+ default: false,
7801
+ },
7788
7802
  },
7789
7803
  };
7790
7804
 
@@ -7792,17 +7806,17 @@ var script$17 = {
7792
7806
  const __vue_script__$17 = script$17;
7793
7807
 
7794
7808
  /* template */
7795
- 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)};
7809
+ 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)};
7796
7810
  var __vue_staticRenderFns__$13 = [];
7797
7811
 
7798
7812
  /* style */
7799
7813
  const __vue_inject_styles__$18 = function (inject) {
7800
7814
  if (!inject) return
7801
- inject("data-v-f9ac8e80_0", { source: ".list-background[data-v-f9ac8e80]{background-color:var(--body-bg)}", map: undefined, media: undefined });
7815
+ inject("data-v-7ae53668_0", { source: ".list-background[data-v-7ae53668]{background-color:var(--body-bg)}", map: undefined, media: undefined });
7802
7816
 
7803
7817
  };
7804
7818
  /* scoped */
7805
- const __vue_scope_id__$18 = "data-v-f9ac8e80";
7819
+ const __vue_scope_id__$18 = "data-v-7ae53668";
7806
7820
  /* module identifier */
7807
7821
  const __vue_module_identifier__$18 = undefined;
7808
7822
  /* functional template */
@@ -8044,7 +8058,7 @@ var script$16 = {
8044
8058
  const __vue_script__$16 = script$16;
8045
8059
 
8046
8060
  /* template */
8047
- 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)};
8061
+ 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)};
8048
8062
  var __vue_staticRenderFns__$12 = [];
8049
8063
 
8050
8064
  /* style */
@@ -20965,7 +20979,7 @@ var __vue_staticRenderFns__$a = [];
20965
20979
  /* style */
20966
20980
  const __vue_inject_styles__$a = undefined;
20967
20981
  /* scoped */
20968
- const __vue_scope_id__$a = "data-v-d140a564";
20982
+ const __vue_scope_id__$a = "data-v-92f5374e";
20969
20983
  /* module identifier */
20970
20984
  const __vue_module_identifier__$a = undefined;
20971
20985
  /* functional template */
@@ -21041,71 +21055,84 @@ var script$9 = {
21041
21055
  async handleRecordNavigation () {
21042
21056
  const { namespaceID, recordID, moduleID, openMode, edit } = this.notification.config;
21043
21057
 
21044
- const namespace = await this.$ComposeAPI.namespaceRead({ namespaceID });
21058
+ try {
21059
+ const namespace = await this.$ComposeAPI.namespaceRead({ namespaceID });
21045
21060
 
21046
- if (!namespace) {
21047
- return
21048
- }
21061
+ if (!namespace) {
21062
+ this.toastDanger(this.$t('namespaceNotFound'));
21063
+ return
21064
+ }
21049
21065
 
21050
- const slug = namespace.slug || namespace.namespaceID;
21066
+ const slug = namespace.slug || namespace.namespaceID;
21051
21067
 
21052
- const recordPages = await this.$ComposeAPI.pageList({ moduleID, namespaceID }).then(({ set = [] }) => set);
21068
+ const recordPages = await this.$ComposeAPI.pageList({ moduleID, namespaceID }).then(({ set = [] }) => set);
21053
21069
 
21054
- if (!recordPages || recordPages.length === 0) {
21055
- return
21056
- }
21057
-
21058
- const { pageID } = recordPages[0];
21070
+ if (!recordPages || recordPages.length === 0) {
21071
+ this.toastDanger(this.$t('pageNotFound'));
21072
+ return
21073
+ }
21059
21074
 
21060
- if (this.$router.app.$options.name !== 'compose') {
21061
- const u = new URL(window.location);
21062
- const url = `${u.origin}/compose/ns/${slug}/pages/${pageID}/record/${recordID}/${edit ? 'edit' : ''}`;
21075
+ const record = await this.$ComposeAPI.recordRead({ recordID, moduleID, namespaceID });
21063
21076
 
21064
- if (openMode === 'newTab') {
21065
- window.open(url, '_blank');
21066
- } else {
21067
- window.location = url;
21077
+ if (!record) {
21078
+ this.toastDanger(this.$t('recordNotFound'));
21079
+ return
21068
21080
  }
21069
21081
 
21070
- return
21071
- }
21082
+ const { pageID } = recordPages[0];
21072
21083
 
21073
- let routeName = 'page.record';
21084
+ if (this.$router.app.$options.name !== 'compose') {
21085
+ const u = new URL(window.location);
21086
+ const url = `${u.origin}/compose/ns/${slug}/pages/${pageID}/record/${recordID}/${edit ? 'edit' : ''}`;
21074
21087
 
21075
- if (!recordID || recordID === '0') {
21076
- routeName += '.create';
21077
- } else if (edit) {
21078
- routeName += '.edit';
21079
- }
21088
+ if (openMode === 'newTab') {
21089
+ window.open(url, '_blank');
21090
+ } else {
21091
+ window.location = url;
21092
+ }
21080
21093
 
21081
- const routeParams = {
21082
- name: routeName,
21083
- params: {
21084
- recordID,
21085
- pageID,
21086
- slug,
21087
- edit,
21088
- },
21089
- };
21094
+ return
21095
+ }
21096
+
21097
+ let routeName = 'page.record';
21098
+
21099
+ if (!recordID || recordID === '0') {
21100
+ routeName += '.create';
21101
+ } else if (edit) {
21102
+ routeName += '.edit';
21103
+ }
21090
21104
 
21091
- // If name and params match, make sure to refresh page instead of pushing
21092
- const sameRoute = routeName === this.$route.name &&
21093
- slug === this.$route.params.slug &&
21094
- pageID === this.$route.params.pageID &&
21095
- recordID === this.$route.params.recordID;
21096
-
21097
- if (openMode === 'newTab') {
21098
- window.open(this.$router.resolve(routeParams).href, '_blank');
21099
- } else if (this.isOnPagesRouteOrChild && !sameRoute && openMode === 'modal') {
21100
- this.$root.$emit('show-record-modal', {
21101
- recordID: !recordID || recordID === '0' ? '0' : recordID,
21102
- recordPageID: pageID,
21105
+ const routeParams = {
21106
+ name: routeName,
21107
+ params: {
21108
+ recordID,
21109
+ pageID,
21110
+ slug,
21103
21111
  edit,
21104
- });
21112
+ },
21113
+ };
21105
21114
 
21106
- return
21107
- } else {
21108
- this.$router.push(routeParams);
21115
+ // If name and params match, make sure to refresh page instead of pushing
21116
+ const sameRoute = routeName === this.$route.name &&
21117
+ slug === this.$route.params.slug &&
21118
+ pageID === this.$route.params.pageID &&
21119
+ recordID === this.$route.params.recordID;
21120
+
21121
+ if (openMode === 'newTab') {
21122
+ window.open(this.$router.resolve(routeParams).href, '_blank');
21123
+ } else if (this.isOnPagesRouteOrChild && !sameRoute && openMode === 'modal') {
21124
+ this.$root.$emit('show-record-modal', {
21125
+ recordID: !recordID || recordID === '0' ? '0' : recordID,
21126
+ recordPageID: pageID,
21127
+ edit,
21128
+ });
21129
+
21130
+ return
21131
+ } else {
21132
+ this.$router.push(routeParams);
21133
+ }
21134
+ } catch (error) {
21135
+ this.toastErrorHandler(this.$t('recordRedirectError'))(error);
21109
21136
  }
21110
21137
  },
21111
21138
  },
@@ -21145,8 +21172,8 @@ var __vue_staticRenderFns__$9 = [];
21145
21172
  undefined);
21146
21173
 
21147
21174
  var NotificationTypes = {
21148
- Simple: __vue_component__$a,
21149
- Record: __vue_component__$9,
21175
+ NotificationSimple: __vue_component__$a,
21176
+ NotificationRecord: __vue_component__$9,
21150
21177
  };
21151
21178
 
21152
21179
  //
@@ -21243,7 +21270,7 @@ var script$8 = {
21243
21270
  let { kind } = this.notification;
21244
21271
  kind = kind.charAt(0).toUpperCase() + kind.slice(1);
21245
21272
 
21246
- return NotificationTypes[kind]
21273
+ return NotificationTypes[`Notification${kind}`]
21247
21274
  },
21248
21275
  },
21249
21276
  };
@@ -21258,11 +21285,11 @@ var __vue_staticRenderFns__$8 = [];
21258
21285
  /* style */
21259
21286
  const __vue_inject_styles__$8 = function (inject) {
21260
21287
  if (!inject) return
21261
- 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 });
21288
+ 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 });
21262
21289
 
21263
21290
  };
21264
21291
  /* scoped */
21265
- const __vue_scope_id__$8 = "data-v-27eea3d6";
21292
+ const __vue_scope_id__$8 = "data-v-de33bfca";
21266
21293
  /* module identifier */
21267
21294
  const __vue_module_identifier__$8 = undefined;
21268
21295
  /* functional template */