@cortezaproject/corteza-vue 2024.9.5-dev.2 → 2024.9.6-dev.1

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,7 +1,7 @@
1
1
  export { CExtendSession, } from './auth';
2
2
  export { CCorredorManualButtons, } from './corredor';
3
3
  export { CPreviewInline, CPreviewLightbox, canPreview, } from './filePreview';
4
- export { CInputConfirm, CInputProcessing, CInputDateTime, CInputPresort, CInputSearch, CRichTextInput, CInputCheckbox, CInputColorPicker, CAceEditor, CInputExpression, CButtonSubmit, CInputSelect, CInputRole, CInputUser, CInputUserGroup, } from './input';
4
+ export { CInputConfirm, CInputProcessing, CInputDateTime, CInputPresort, CInputSearch, CRichTextInput, CInputCheckbox, CInputColorPicker, CAceEditor, CInputExpression, CButtonSubmit, CInputSelect, CInputRole, CInputUser, } from './input';
5
5
  export { CLightbox, } from './lightbox';
6
6
  export { CPermissionsButton, CPermissionsModal, } from './permissions';
7
7
  export * from './prompts';
@@ -12,4 +12,3 @@ export { CButtonSubmit, } from './button';
12
12
  export { default as CInputSelect } from './CInputSelect.vue';
13
13
  export { default as CInputRole } from './CInputRole.vue';
14
14
  export { default as CInputUser } from './CInputUser.vue';
15
- export { default as CInputUserGroup } from './CInputUserGroup.vue';
package/dist/index.cjs CHANGED
@@ -5111,44 +5111,45 @@ function intervalToMS(from, to) {
5111
5111
  return to - from;
5112
5112
  }
5113
5113
  var ReminderService = /*#__PURE__*/function () {
5114
- function ReminderService() {
5115
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
5114
+ function ReminderService(Vue) {
5115
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
5116
5116
  api = _ref.api,
5117
5117
  _ref$fetchOffset = _ref.fetchOffset,
5118
5118
  fetchOffset = _ref$fetchOffset === void 0 ? 1000 * 60 * 5 : _ref$fetchOffset,
5119
5119
  _ref$resource = _ref.resource,
5120
- resource = _ref$resource === void 0 ? null : _ref$resource,
5121
- emitter = _ref.emitter;
5120
+ resource = _ref$resource === void 0 ? null : _ref$resource;
5122
5121
  _classCallCheck$1(this, ReminderService);
5123
5122
  if (!api) {
5124
5123
  throw new Error('reminderService.invalidParams');
5125
5124
  }
5126
- this.emitter = emitter;
5125
+ this.vue = Vue;
5127
5126
  this.api = api;
5128
5127
  this.fetchOffset = fetchOffset;
5129
5128
  this.resource = resource;
5129
+ this.rootInstance = null;
5130
5130
  this.set = [];
5131
5131
  this.nextRemindAt = null;
5132
5132
  this.tHandle = null;
5133
5133
  }
5134
5134
  return _createClass(ReminderService, [{
5135
5135
  key: "init",
5136
- value: function init(emitter, _ref2) {
5136
+ value: function init(_ref2) {
5137
5137
  var _this = this;
5138
5138
  var _ref2$filter = _ref2.filter,
5139
5139
  filter = _ref2$filter === void 0 ? {} : _ref2$filter;
5140
- if (emitter) {
5141
- this.emitter = emitter;
5142
- }
5143
5140
  this.filter = _objectSpread2({
5144
5141
  scheduledOnly: true,
5145
5142
  excludeDismissed: true
5146
5143
  }, filter);
5147
5144
  this.prefetch().then(function (rr) {
5148
- _this.enqueue.apply(_this, _toConsumableArray(rr));
5149
- _this.emitter.$emit('reminders.pull');
5145
+ _this.enqueue(rr);
5150
5146
  });
5151
5147
  }
5148
+ }, {
5149
+ key: "setRootInstance",
5150
+ value: function setRootInstance(rootInstance) {
5151
+ this.rootInstance = rootInstance;
5152
+ }
5152
5153
 
5153
5154
  /**
5154
5155
  * Fetches all reminders that are supposed to go off to date (time)
@@ -5165,7 +5166,7 @@ var ReminderService = /*#__PURE__*/function () {
5165
5166
  return _context.abrupt("return", this.api.reminderList(_objectSpread2({
5166
5167
  limit: 0,
5167
5168
  resource: this.resource,
5168
- toTime: moment().add(this.fetchOffset, 'min').toISOString()
5169
+ scheduledUntil: moment().add(this.fetchOffset, 'min').toISOString()
5169
5170
  }, this.filter)).then(function (_ref3) {
5170
5171
  var set = _ref3.set;
5171
5172
  return (set || []).map(function (r) {
@@ -5186,7 +5187,7 @@ var ReminderService = /*#__PURE__*/function () {
5186
5187
  }, {
5187
5188
  key: "enqueueRaw",
5188
5189
  value: function enqueueRaw(raw) {
5189
- this.enqueue(new cortezaJs.system.Reminder(raw));
5190
+ this.enqueue([new cortezaJs.system.Reminder(raw)]);
5190
5191
  }
5191
5192
 
5192
5193
  /**
@@ -5195,11 +5196,8 @@ var ReminderService = /*#__PURE__*/function () {
5195
5196
  */
5196
5197
  }, {
5197
5198
  key: "enqueue",
5198
- value: function enqueue() {
5199
+ value: function enqueue(set) {
5199
5200
  var _this2 = this;
5200
- for (var _len = arguments.length, set = new Array(_len), _key = 0; _key < _len; _key++) {
5201
- set[_key] = arguments[_key];
5202
- }
5203
5201
  set.forEach(function (r) {
5204
5202
  // New or replace
5205
5203
  var i = _this2.set.findIndex(function (_ref4) {
@@ -5259,7 +5257,7 @@ var ReminderService = /*#__PURE__*/function () {
5259
5257
  var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
5260
5258
  var changed = false;
5261
5259
  set.forEach(function (r) {
5262
- if (!time || r.remindAt < time) {
5260
+ if (!r.dismissedAt && (!time || r.remindAt < time)) {
5263
5261
  time = r.remindAt;
5264
5262
  changed = true;
5265
5263
  }
@@ -5301,11 +5299,11 @@ var ReminderService = /*#__PURE__*/function () {
5301
5299
  var now = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
5302
5300
  var nextRemindAt = null;
5303
5301
  this.set.forEach(function (r) {
5304
- if (now >= r.remindAt) {
5305
- if (_this3.emitter) {
5306
- _this3.emitter.$emit('reminder.show', r);
5302
+ if (!r.dismissedAt && now >= r.remindAt) {
5303
+ if (_this3.rootInstance) {
5304
+ _this3.rootInstance.$emit('reminder.show', r);
5307
5305
  } else {
5308
- throw new Error('pool.noEmitter');
5306
+ console.warn('ReminderService: No root instance available to emit reminder.show event');
5309
5307
  }
5310
5308
  r.processed = true;
5311
5309
  } else if (now < r.remindAt && (!nextRemindAt || r.remindAt < nextRemindAt)) {
@@ -5327,7 +5325,18 @@ var ReminderService = /*#__PURE__*/function () {
5327
5325
  }();
5328
5326
  var reminder = {
5329
5327
  install: function install(Vue, opts) {
5330
- Vue.prototype.$Reminder = new ReminderService(opts);
5328
+ var reminderService = new ReminderService(this, opts);
5329
+ Vue.prototype.$Reminder = reminderService;
5330
+
5331
+ // Set the root instance when Vue app is created
5332
+ Vue.mixin({
5333
+ created: function created() {
5334
+ if (this.$root === this) {
5335
+ // This is the root instance
5336
+ reminderService.setRootInstance(this);
5337
+ }
5338
+ }
5339
+ });
5331
5340
  }
5332
5341
  };
5333
5342
 
@@ -14906,7 +14915,7 @@ var script$q = {
14906
14915
  const __vue_script__$q = script$q;
14907
14916
 
14908
14917
  /* template */
14909
- var __vue_render__$q = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.toasts),function(t){return _c('b-toast',_vm._b({key:t.id,attrs:{"visible":"","title":t.payload.title,"no-close-button":!t.actions.hide,"toast-class":"overflow-unset"},on:{"hide":function($event){t.actions.hide ? t.actions.hide.cb(t) : _vm.evtSink;}}},'b-toast',t.options || {},false),[_c('b-card',{staticClass:"border-0",attrs:{"header-bg-variant":"transparent","bg-variant":"transparent","body-class":"p-0"}},[_c('b-card-text',[_vm._v("\n "+_vm._s(t.payload.notes)+"\n ")]),_vm._v(" "),(t.payload.link)?_c('b-card-text',[_c('c-toaster-link',{attrs:{"link":t.payload.link}})],1):_vm._e(),_vm._v(" "),_vm._l((_vm.extraActions(t)),function(ref){
14918
+ var __vue_render__$q = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.toasts),function(t){return _c('b-toast',_vm._b({key:t.id,attrs:{"visible":"","title":t.payload.title,"no-close-button":!t.actions.hide,"toast-class":"overflow-unset"},on:{"hide":function($event){t.actions.hide ? t.actions.hide.cb(t) : _vm.evtSink;}}},'b-toast',t.options || {},false),[_c('b-card',{staticClass:"border-0",attrs:{"header-bg-variant":"transparent","bg-variant":"transparent","body-class":"p-0"}},[(t.payload.notes)?_c('b-card-text',[_vm._v("\n "+_vm._s(t.payload.notes)+"\n ")]):_vm._e(),_vm._v(" "),(t.payload.link)?_c('b-card-text',[_c('c-toaster-link',{attrs:{"link":t.payload.link}})],1):_vm._e(),_vm._v(" "),_vm._l((_vm.extraActions(t)),function(ref){
14910
14919
  var name = ref[0];
14911
14920
  var act = ref[1];
14912
14921
  return _c(_vm.actComponent(act),_vm._b({key:name,tag:"component",staticClass:"mr-1",on:{"action":function($event){act.cb ? act.cb(t, $event) : _vm.evtSink;}}},'component',act,false))})],2)],1)}),1)};
@@ -14915,7 +14924,7 @@ var __vue_staticRenderFns__$q = [];
14915
14924
  /* style */
14916
14925
  const __vue_inject_styles__$r = function (inject) {
14917
14926
  if (!inject) return
14918
- inject("data-v-6fbe9c62_0", { source: ".toast.overflow-unset{overflow:unset!important}", map: undefined, media: undefined });
14927
+ inject("data-v-1244b576_0", { source: ".toast.overflow-unset{overflow:unset!important}", map: undefined, media: undefined });
14919
14928
 
14920
14929
  };
14921
14930
  /* scoped */