@ozdao/prometheus-framework 0.2.102 → 0.2.103

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/dist/main-DfD5hLQo.mjs +13633 -0
  2. package/dist/main-DwyUYWFX.js +92 -0
  3. package/dist/orders.server.js +16 -0
  4. package/dist/orders.server.mjs +16 -0
  5. package/dist/products.server.js +7 -1
  6. package/dist/products.server.mjs +7 -1
  7. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  8. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +23 -21
  9. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +1 -36
  11. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
  12. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +36 -1
  13. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  14. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
  15. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -1
  16. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +66 -0
  17. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +1 -5
  18. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +0 -66
  19. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
  20. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
  21. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  22. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +1 -1
  23. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  24. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
  25. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  26. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  27. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  28. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +87 -67
  29. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +30 -31
  31. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +119 -87
  33. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  35. package/dist/prometheus-framework.cjs.js +1 -1
  36. package/dist/prometheus-framework.es.js +1 -1
  37. package/dist/style.css +1 -1
  38. package/dist/web-C0sFgeYh.mjs +54 -0
  39. package/dist/web-kg3KgbAF.js +1 -0
  40. package/package.json +1 -1
  41. package/src/components/Feed/Feed.vue +9 -10
  42. package/src/modules/orders/controllers/orders.controller.js +20 -1
  43. package/src/modules/products/components/blocks/CardPosition.vue +32 -7
  44. package/src/modules/products/components/pages/EditLeftover.vue +0 -3
  45. package/src/modules/products/components/pages/ProductEdit.vue +51 -15
  46. package/src/modules/products/controllers/products.controller.js +1 -2
  47. package/src/modules/products/models/product.model.js +6 -0
  48. package/src/modules/products/routes/products.routes.js +1 -10
@@ -350,6 +350,22 @@ const controllerFactory$1 = (db) => {
350
350
  comment: ""
351
351
  });
352
352
  }
353
+ if (req.body.status === "confirmed") {
354
+ try {
355
+ const leftover = await Leftover.create({
356
+ organization: order.organization,
357
+ type: "stock-out",
358
+ order: order._id,
359
+ comment: `Stock-out for order ${order._id}`,
360
+ positions: order.positions,
361
+ creator: order.creator,
362
+ owner: order.owner
363
+ });
364
+ console.log("Leftover created:", leftover);
365
+ } catch (err) {
366
+ console.error("Error creating Leftover:", err);
367
+ }
368
+ }
353
369
  try {
354
370
  await order.save();
355
371
  res.status(200).send(order);
@@ -349,6 +349,22 @@ const controllerFactory$1 = (db) => {
349
349
  comment: ""
350
350
  });
351
351
  }
352
+ if (req.body.status === "confirmed") {
353
+ try {
354
+ const leftover = await Leftover.create({
355
+ organization: order.organization,
356
+ type: "stock-out",
357
+ order: order._id,
358
+ comment: `Stock-out for order ${order._id}`,
359
+ positions: order.positions,
360
+ creator: order.creator,
361
+ owner: order.owner
362
+ });
363
+ console.log("Leftover created:", leftover);
364
+ } catch (err) {
365
+ console.error("Error creating Leftover:", err);
366
+ }
367
+ }
352
368
  try {
353
369
  await order.save();
354
370
  res.status(200).send(order);
@@ -45,12 +45,18 @@ var product_model = (mongoose) => {
45
45
  price: {
46
46
  type: Number,
47
47
  required: true,
48
+ default: 0,
48
49
  min: [0, "Price cannot be less than 0"]
49
50
  },
50
51
  quantity: {
51
52
  type: Number,
52
53
  required: true,
53
54
  min: [1, "Quantity cannot be less than 1"]
55
+ },
56
+ type: {
57
+ type: String,
58
+ required: true,
59
+ default: "g"
54
60
  }
55
61
  }],
56
62
  quantityDiscount: [{
@@ -296,7 +302,7 @@ const controllerFactory$5 = (db) => {
296
302
  }
297
303
  }
298
304
  console.log(query);
299
- const products = await Product.find(query, null, options);
305
+ const products = await Product.find(query, null, options).populate("ingredients._id");
300
306
  if (!products.length) {
301
307
  return res.status(200).json([]);
302
308
  }
@@ -43,12 +43,18 @@ var product_model = (mongoose) => {
43
43
  price: {
44
44
  type: Number,
45
45
  required: true,
46
+ default: 0,
46
47
  min: [0, "Price cannot be less than 0"]
47
48
  },
48
49
  quantity: {
49
50
  type: Number,
50
51
  required: true,
51
52
  min: [1, "Quantity cannot be less than 1"]
53
+ },
54
+ type: {
55
+ type: String,
56
+ required: true,
57
+ default: "g"
52
58
  }
53
59
  }],
54
60
  quantityDiscount: [{
@@ -294,7 +300,7 @@ const controllerFactory$5 = (db) => {
294
300
  }
295
301
  }
296
302
  console.log(query);
297
- const products = await Product.find(query, null, options);
303
+ const products = await Product.find(query, null, options).populate("ingredients._id");
298
304
  if (!products.length) {
299
305
  return res.status(200).json([]);
300
306
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue.cjs");const k=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const y=require("../../modules/globals/components/blocks/BlockSearch.vue.cjs"),g={__name:"Feed",props:{showLoadMore:{type:Boolean,default:!0},search:{type:[Boolean,Object],default:!1},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},external:{type:Boolean,default:!1},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(n){const l=n,s=e.ref([]),r=e.ref(!1);let i=e.ref(!0),m=e.ref(null),u=e.ref(l.options.skip?l.options.skip:0),o=e.ref(l.options.limit?l.options.limit:10),d=e.ref("");function h(t){d.value=t,c()}const p=async()=>{if(r.value){u.value+=o.value;const t=await l.store.read({skip:u.value,limit:o.value,search:d.value,...l.options});t.length===0||t.length<o.value?r.value=!1:r.value=!0,s.value=[...s.value,...t]}},c=async()=>{const t=await l.store.read({skip:u.value,limit:o.value,search:d.value,...l.options});t.length===0||t.length<o.value?r.value=!1:r.value=!0,s.value=t,i.value=!1};return e.watch(()=>l.external,t=>{}),e.watch(()=>l.external,(t,a)=>{t!==a&&c()},{deep:!0}),e.watch(()=>l.options,(t,a)=>{(t.organization!==a.organization||t.categories!==a.categories||t.prices!==a.prices||t.delivery!==a.delivery||t.search!==a.search||t.status!==a.status||t.hidden!==a.hidden||t.type!==a.type)&&c()},{deep:!0}),e.onMounted(async()=>{await c(),typeof window<"u"&&!l.showLoadMore&&new IntersectionObserver(a=>{a.some(f=>f.isIntersecting)&&p()}).observe(m.value)}),(t,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.search?(e.openBlock(),e.createBlock(y.default,{key:0,placeholder:n.search.placeholder||"Search...",class:e.normalizeClass(n.search.class||"bg-grey mn-b-thin"),onSearch:h},null,8,["placeholder","class"])):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:1,tag:"ul",name:"scaleTransition",class:e.normalizeClass(["o-hidden bg-grey radius-big",t.$attrs.class])},{default:e.withCtx(()=>[e.unref(i)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o),f=>(e.openBlock(),e.createBlock(v.default,{key:"skeleton-"+f}))),128)):e.createCommentVNode("",!0)]),_:1},8,["class"])):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!e.unref(i)&&s.value.length<1?(e.openBlock(),e.createBlock(k.default,{key:0,title:n.states.empty.title,description:n.states.empty.description,action:n.states.empty.action,callback:n.states.empty.callback,class:"pd-medium mn-b-thin bg-grey radius-big"},null,8,["title","description","action","callback"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:e.normalizeClass(t.$attrs.class)},{default:e.withCtx(()=>[!e.unref(i)&&s.value.length>0?e.renderSlot(t.$slots,"default",{key:0,items:s.value}):e.createCommentVNode("",!0),n.showLoadMore&&r.value&&s.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:p,class:"col-w-100 w-100 bg-main button"}," Load More ")):e.createCommentVNode("",!0),e.createElementVNode("div",{key:"sentinel",ref_key:"sentinel",ref:m,class:"sentinel"},null,512)]),_:3},8,["class"])],64))}};exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue.cjs");const y=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const g=require("../../modules/globals/components/blocks/BlockSearch.vue.cjs"),u=null,b={__name:"Feed",props:{showLoadMore:{type:Boolean,default:!0},search:{type:[Boolean,Object],default:!1},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},external:{type:Boolean,default:!1},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(n){const l=n,s=e.ref([]),r=e.ref(!1);let i=e.ref(!0),m=e.ref(null),d=e.ref(l.options.skip?l.options.skip:0),o=e.ref(l.options.limit?l.options.limit:10),f=e.ref("");function h(t){f.value=t,c()}const p=async()=>{if(r.value){d.value+=o.value;const t=await l.store.read({skip:d.value,limit:o.value,search:f.value,...l.options});t.length===0||t.length<o.value?r.value=!1:r.value=!0,s.value=[...s.value,...t]}},c=async()=>{const t=await l.store.read({skip:d.value,limit:o.value,search:f.value,...l.options});t.length===0||t.length<o.value?r.value=!1:r.value=!0,s.value=t,i.value=!1};return e.watch(()=>l.external,t=>{}),e.watch(()=>l.external,(t,a)=>{t!==a&&c()},{deep:!0}),e.watch(()=>l.options,(t,a)=>{(t.organization!==a.organization||t.categories!==a.categories||t.prices!==a.prices||t.delivery!==a.delivery||t.search!==a.search||t.status!==a.status||t.hidden!==a.hidden||t.type!==a.type)&&c()},{deep:!0}),e.onMounted(async()=>{await c(),typeof window<"u"&&!l.showLoadMore&&(u=new IntersectionObserver(t=>{t.some(a=>a.isIntersecting)&&p()}),u.observe(m.value))}),e.onUnmounted(()=>{u&&u.disconnect()}),(t,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.search?(e.openBlock(),e.createBlock(g.default,{key:0,placeholder:n.search.placeholder||"Search...",class:e.normalizeClass(n.search.class||"bg-grey mn-b-thin"),onSearch:h},null,8,["placeholder","class"])):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:1,tag:"ul",name:"scaleTransition",class:e.normalizeClass(["o-hidden bg-grey radius-big",t.$attrs.class])},{default:e.withCtx(()=>[e.unref(i)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o),v=>(e.openBlock(),e.createBlock(k.default,{key:"skeleton-"+v}))),128)):e.createCommentVNode("",!0)]),_:1},8,["class"])):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!e.unref(i)&&s.value.length<1?(e.openBlock(),e.createBlock(y.default,{key:0,title:n.states.empty.title,description:n.states.empty.description,action:n.states.empty.action,callback:n.states.empty.callback,class:"pd-medium mn-b-thin bg-grey radius-big"},null,8,["title","description","action","callback"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:e.normalizeClass(t.$attrs.class)},{default:e.withCtx(()=>[!e.unref(i)&&s.value.length>0?e.renderSlot(t.$slots,"default",{key:0,items:s.value}):e.createCommentVNode("",!0),n.showLoadMore&&r.value&&s.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:p,class:"col-w-100 w-100 bg-main button"}," Load More ")):e.createCommentVNode("",!0),e.createElementVNode("div",{key:"sentinel",ref_key:"sentinel",ref:m,class:"sentinel"},null,512)]),_:3},8,["class"])],64))}};exports.default=b;
@@ -1,10 +1,10 @@
1
- import { ref as i, watch as y, onMounted as j, openBlock as r, createElementBlock as g, Fragment as L, createBlock as f, normalizeClass as k, createCommentVNode as c, unref as d, TransitionGroup as M, withCtx as b, renderList as I, createVNode as B, Transition as T, renderSlot as $, createElementVNode as C } from "vue";
2
- import x from "../../modules/icons/skeletons/SkeletonEvent.vue.js";
1
+ import { ref as i, watch as y, onMounted as I, onUnmounted as T, openBlock as r, createElementBlock as g, Fragment as L, createBlock as f, normalizeClass as k, createCommentVNode as c, unref as d, TransitionGroup as M, withCtx as b, renderList as $, createVNode as B, Transition as C, renderSlot as x, createElementVNode as z } from "vue";
2
+ import E from "../../modules/icons/skeletons/SkeletonEvent.vue.js";
3
3
  import "../Loader/Loader.vue.js";
4
- import z from "../EmptyState/EmptyState.vue.js";
4
+ import F from "../EmptyState/EmptyState.vue.js";
5
5
  import "vue-i18n";
6
- import E from "../../modules/globals/components/blocks/BlockSearch.vue.js";
7
- const H = {
6
+ import N from "../../modules/globals/components/blocks/BlockSearch.vue.js";
7
+ const p = null, J = {
8
8
  __name: "Feed",
9
9
  props: {
10
10
  showLoadMore: {
@@ -52,15 +52,15 @@ const H = {
52
52
  },
53
53
  setup(s) {
54
54
  const a = s, n = i([]), l = i(!1);
55
- let u = i(!0), S = i(null), p = i(a.options.skip ? a.options.skip : 0), o = i(a.options.limit ? a.options.limit : 10), v = i("");
55
+ let u = i(!0), S = i(null), h = i(a.options.skip ? a.options.skip : 0), o = i(a.options.limit ? a.options.limit : 10), v = i("");
56
56
  function O(e) {
57
57
  v.value = e, m();
58
58
  }
59
59
  const w = async () => {
60
60
  if (l.value) {
61
- p.value += o.value;
61
+ h.value += o.value;
62
62
  const e = await a.store.read({
63
- skip: p.value,
63
+ skip: h.value,
64
64
  limit: o.value,
65
65
  search: v.value,
66
66
  ...a.options
@@ -69,7 +69,7 @@ const H = {
69
69
  }
70
70
  }, m = async () => {
71
71
  const e = await a.store.read({
72
- skip: p.value,
72
+ skip: h.value,
73
73
  limit: o.value,
74
74
  search: v.value,
75
75
  ...a.options
@@ -81,12 +81,14 @@ const H = {
81
81
  e !== t && m();
82
82
  }, { deep: !0 }), y(() => a.options, (e, t) => {
83
83
  (e.organization !== t.organization || e.categories !== t.categories || e.prices !== t.prices || e.delivery !== t.delivery || e.search !== t.search || e.status !== t.status || e.hidden !== t.hidden || e.type !== t.type) && m();
84
- }, { deep: !0 }), j(async () => {
85
- await m(), typeof window < "u" && !a.showLoadMore && new IntersectionObserver((t) => {
86
- t.some((h) => h.isIntersecting) && w();
87
- }).observe(S.value);
84
+ }, { deep: !0 }), I(async () => {
85
+ await m(), typeof window < "u" && !a.showLoadMore && (p = new IntersectionObserver((e) => {
86
+ e.some((t) => t.isIntersecting) && w();
87
+ }), p.observe(S.value));
88
+ }), T(() => {
89
+ p && p.disconnect();
88
90
  }), (e, t) => (r(), g(L, null, [
89
- s.search ? (r(), f(E, {
91
+ s.search ? (r(), f(N, {
90
92
  key: 0,
91
93
  placeholder: s.search.placeholder || "Search...",
92
94
  class: k(s.search.class || "bg-grey mn-b-thin"),
@@ -99,15 +101,15 @@ const H = {
99
101
  class: k(["o-hidden bg-grey radius-big", e.$attrs.class])
100
102
  }, {
101
103
  default: b(() => [
102
- d(u) ? (r(!0), g(L, { key: 0 }, I(d(o), (h) => (r(), f(x, {
103
- key: "skeleton-" + h
104
+ d(u) ? (r(!0), g(L, { key: 0 }, $(d(o), (j) => (r(), f(E, {
105
+ key: "skeleton-" + j
104
106
  }))), 128)) : c("", !0)
105
107
  ]),
106
108
  _: 1
107
109
  }, 8, ["class"])) : c("", !0),
108
- B(T, { name: "scaleTransition" }, {
110
+ B(C, { name: "scaleTransition" }, {
109
111
  default: b(() => [
110
- !d(u) && n.value.length < 1 ? (r(), f(z, {
112
+ !d(u) && n.value.length < 1 ? (r(), f(F, {
111
113
  key: 0,
112
114
  title: s.states.empty.title,
113
115
  description: s.states.empty.description,
@@ -124,7 +126,7 @@ const H = {
124
126
  class: k(e.$attrs.class)
125
127
  }, {
126
128
  default: b(() => [
127
- !d(u) && n.value.length > 0 ? $(e.$slots, "default", {
129
+ !d(u) && n.value.length > 0 ? x(e.$slots, "default", {
128
130
  key: 0,
129
131
  items: n.value
130
132
  }) : c("", !0),
@@ -133,7 +135,7 @@ const H = {
133
135
  onClick: w,
134
136
  class: "col-w-100 w-100 bg-main button"
135
137
  }, " Load More ")) : c("", !0),
136
- C("div", {
138
+ z("div", {
137
139
  key: "sentinel",
138
140
  ref_key: "sentinel",
139
141
  ref: S,
@@ -146,5 +148,5 @@ const H = {
146
148
  }
147
149
  };
148
150
  export {
149
- H as default
151
+ J as default
150
152
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Spoiler.vue2.cjs");const n={key:0,class:"spoiler"},a={__name:"Spoiler",props:{status:{type:Boolean,default:!1}},setup(r){const l=r,t=e.ref(!1);return l.status&&(t.value=l.status),(o,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{onClick:s[0]||(s[0]=u=>t.value=!t.value),class:"flex-v-center flex-nowrap flex"},[e.renderSlot(o.$slots,"header",{isOpen:t.value})]),e.createVNode(e.Transition,{name:"collapse"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",n,[e.renderSlot(o.$slots,"content")])):e.createCommentVNode("",!0)]),_:3})]))}};exports.default=a;
1
+ "use strict";
@@ -1,36 +1 @@
1
- import { ref as i, openBlock as s, createElementBlock as a, createElementVNode as p, renderSlot as n, createVNode as u, Transition as c, withCtx as d, createCommentVNode as f } from "vue";
2
- import "./Spoiler.vue2.js";
3
- const m = {
4
- key: 0,
5
- class: "spoiler"
6
- }, x = {
7
- __name: "Spoiler",
8
- props: {
9
- status: {
10
- type: Boolean,
11
- default: !1
12
- }
13
- },
14
- setup(r) {
15
- const t = r, e = i(!1);
16
- return t.status && (e.value = t.status), (o, l) => (s(), a("div", null, [
17
- p("div", {
18
- onClick: l[0] || (l[0] = (v) => e.value = !e.value),
19
- class: "flex-v-center flex-nowrap flex"
20
- }, [
21
- n(o.$slots, "header", { isOpen: e.value })
22
- ]),
23
- u(c, { name: "collapse" }, {
24
- default: d(() => [
25
- e.value ? (s(), a("div", m, [
26
- n(o.$slots, "content")
27
- ])) : f("", !0)
28
- ]),
29
- _: 3
30
- })
31
- ]));
32
- }
33
- };
34
- export {
35
- x as default
36
- };
1
+
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Spoiler.vue.cjs");const n={key:0,class:"spoiler"},a={__name:"Spoiler",props:{status:{type:Boolean,default:!1}},setup(r){const l=r,t=e.ref(!1);return l.status&&(t.value=l.status),(o,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{onClick:s[0]||(s[0]=u=>t.value=!t.value),class:"flex-v-center flex-nowrap flex"},[e.renderSlot(o.$slots,"header",{isOpen:t.value})]),e.createVNode(e.Transition,{name:"collapse"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",n,[e.renderSlot(o.$slots,"content")])):e.createCommentVNode("",!0)]),_:3})]))}};exports.default=a;
@@ -1 +1,36 @@
1
-
1
+ import { ref as i, openBlock as s, createElementBlock as a, createElementVNode as p, renderSlot as n, createVNode as u, Transition as c, withCtx as d, createCommentVNode as f } from "vue";
2
+ import "./Spoiler.vue.js";
3
+ const m = {
4
+ key: 0,
5
+ class: "spoiler"
6
+ }, x = {
7
+ __name: "Spoiler",
8
+ props: {
9
+ status: {
10
+ type: Boolean,
11
+ default: !1
12
+ }
13
+ },
14
+ setup(r) {
15
+ const t = r, e = i(!1);
16
+ return t.status && (e.value = t.status), (o, l) => (s(), a("div", null, [
17
+ p("div", {
18
+ onClick: l[0] || (l[0] = (v) => e.value = !e.value),
19
+ class: "flex-v-center flex-nowrap flex"
20
+ }, [
21
+ n(o.$slots, "header", { isOpen: e.value })
22
+ ]),
23
+ u(c, { name: "collapse" }, {
24
+ default: d(() => [
25
+ e.value ? (s(), a("div", m, [
26
+ n(o.$slots, "content")
27
+ ])) : f("", !0)
28
+ ]),
29
+ _: 3
30
+ })
31
+ ]));
32
+ }
33
+ };
34
+ export {
35
+ x as default
36
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("../../../constructor/components/elements/Textarea.vue2.cjs"),V=require("../../../constructor/components/sections/Constructor.vue.cjs"),y=require("../../../../components/Popup/Popup.vue.cjs");require("../../../../components/FieldTags/tag-input.vue.cjs");require("../../../../components/FieldTags/vue-tags-input.scss.cjs");const B=require("../../../../components/FieldTags/BlockTags.vue.cjs"),N=require("../../../../components/Checkbox/Checkbox.vue.cjs"),C=require("../../../../components/Field/Field.vue2.cjs"),P=require("../../../../components/SelectMulti/SelectMulti.vue.cjs"),x=require("../../../../components/Button/Button.vue2.cjs"),f=require("vue-router"),n=require("../../store/blogposts.cjs"),i=require("../../../auth/store/auth.cjs"),q=require("../../../organizations/store/organizations.cjs"),E={class:"pd-thin"},T={style:{"min-height":"100%"},class:"w-100 bg-grey pd-big radius-big"},z={class:"w-full h-full"},A={key:0,class:"pd-thin pos-sticky pos-l-0 pos-b-0 w-100"},O={class:"pd-thin radius-big bg-main w-100 flex-nowrap flex"},U=e.createElementVNode("h3",{class:"mn-b-small"},"Final Touches",-1),D=e.createElementVNode("h5",{class:"mn-b-thin"},"Add source:",-1),M=e.createElementVNode("h5",{class:"mn-b-thin"},"Add to public:",-1),S={key:0,class:"mn-b-thin"},F={key:1,class:"mn-b-medium br-grey br-2px br-solid pd-small radius-big"},R={__name:"CreateBlogPost",setup($){const s=f.useRoute(),u=f.useRouter();let t=e.ref(null),p=e.ref(null);const c=e.ref([]),r=e.ref(null);e.onMounted(async()=>{const o=await q.actions.read({user:i.state.user._id,postable:i.state.user._id,limit:100});if(p.value=o.map(a=>({name:a.profile.name,_id:a._id,photo:a.profile.photo})),s.params.url){const a=await n.read({user:i.state.user._id,url:s.params.url});t.value=a.pop()}else n.clean(),t.value=n.state.current;t.value.owner||(t.value.owner={target:i.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:i.state.user._id,type:"user",hidden:!1}),t.value.owner.type==="organization"&&(r.value={_id:t.value.owner.target._id,name:t.value.owner.target.profile.name,photo:t.value.owner.target.profile.photo}),console.log(o)});const g=e.ref(""),m=e.ref([{text:"story"},{text:"news"},{text:"guide"},{text:"discussion"},{text:"photos"}]);e.computed(()=>m.value.filter(o=>o.text.toLowerCase().includes(g.value.toLowerCase()))),e.computed(()=>m.value.filter(o=>!c.value.some(a=>a.text===o.text)));const d=e.ref(!1);function h(){d.value=!0}function v(){d.value=!1}function b(){c.value.length>0&&c.value.map(o=>o.text),t.value.status="draft",s.params.url?n.update(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.log(o)}):n.create(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.log(o)})}function k(){r.value&&(t.value.owner={target:r.value._id,type:"organization"}),r.value||(t.value.creator.hidden=!1),r.value||(t.value.organization=t.value.creator),t.value.status="published",console.log(t.value),s.params.url?n.update(t.value).then(o=>{console.log(t.value),u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.error(o)}):n.create(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.error(o)})}function _(){confirm("Are you sure you want to delete this post?")&&n.remove(t.value._id).then(o=>{u.push({name:"User Blogposts",params:{_id:t.value.creator.target._id}})}).catch(o=>{console.log(o)})}return(o,a)=>(e.openBlock(),e.createElementBlock("article",E,[e.createElementVNode("section",T,[e.createElementVNode("div",z,[e.unref(t)?(e.openBlock(),e.createBlock(w.default,{key:0,prop:e.unref(t),setFocus:!0,content:"name",placeholder:"Enter post title",class:"h2"},null,8,["prop"])):e.createCommentVNode("",!0)]),e.unref(t)?(e.openBlock(),e.createBlock(V.default,{key:0,content:e.unref(t).content,onUpdate:a[0]||(a[0]=l=>e.unref(t).content=l)},null,8,["content"])):e.createCommentVNode("",!0)]),e.createVNode(e.Transition,{name:"scaleIn"},{default:e.withCtx(()=>[e.unref(t)?(e.openBlock(),e.createElementBlock("section",A,[e.createElementVNode("div",O,[e.unref(s).params.url?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:a[1]||(a[1]=l=>_()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:a[2]||(a[2]=l=>b()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:a[3]||(a[3]=l=>h()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(y.default,{title:"Добавить участника",onClosePopup:v,isPopupOpen:d.value,class:"w-m-33r t-left pd-big bg-white radius-big"},{default:e.withCtx(()=>[U,e.createVNode(B.default,{onTagsChanged:a[4]||(a[4]=l=>e.unref(t).tags=l),tags:e.unref(t).tags},null,8,["tags"]),D,e.createVNode(C.default,{field:e.unref(t).source,"onUpdate:field":a[5]||(a[5]=l=>e.unref(t).source=l),placeholder:"Add full link to the source",class:"mn-b-medium bg-grey radius-medium pd-small"},null,8,["field"]),M,e.createVNode(P.default,{modelValue:r.value,"onUpdate:modelValue":a[6]||(a[6]=l=>r.value=l),options:e.unref(p),multiple:!1,taggable:!1,placeholder:"Type to search or add tag",label:"name","track-by":"_id",class:"mn-b-medium bg-grey radius-medium pd-small"},null,8,["modelValue","options"]),r.value?(e.openBlock(),e.createElementBlock("h5",S,"Options:")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",F,[e.createVNode(N.default,{label:"Hide Author",radio:e.unref(t).creator.hidden,"onUpdate:radio":a[7]||(a[7]=l=>e.unref(t).creator.hidden=l),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(x.default,{submit:k,callback:o.redirectTo,class:"w-100 bg-black t-white"},{default:e.withCtx(()=>[e.createTextVNode("Publish")]),_:1},8,["callback"])]),_:1},8,["isPopupOpen"])]))}};exports.default=R;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("../../../constructor/components/elements/Textarea.vue.cjs"),V=require("../../../constructor/components/sections/Constructor.vue.cjs"),y=require("../../../../components/Popup/Popup.vue.cjs");require("../../../../components/FieldTags/tag-input.vue.cjs");require("../../../../components/FieldTags/vue-tags-input.scss.cjs");const B=require("../../../../components/FieldTags/BlockTags.vue.cjs"),N=require("../../../../components/Checkbox/Checkbox.vue.cjs"),C=require("../../../../components/Field/Field.vue2.cjs"),P=require("../../../../components/SelectMulti/SelectMulti.vue.cjs"),x=require("../../../../components/Button/Button.vue2.cjs"),f=require("vue-router"),n=require("../../store/blogposts.cjs"),i=require("../../../auth/store/auth.cjs"),q=require("../../../organizations/store/organizations.cjs"),E={class:"pd-thin"},T={style:{"min-height":"100%"},class:"w-100 bg-grey pd-big radius-big"},z={class:"w-full h-full"},A={key:0,class:"pd-thin pos-sticky pos-l-0 pos-b-0 w-100"},O={class:"pd-thin radius-big bg-main w-100 flex-nowrap flex"},U=e.createElementVNode("h3",{class:"mn-b-small"},"Final Touches",-1),D=e.createElementVNode("h5",{class:"mn-b-thin"},"Add source:",-1),M=e.createElementVNode("h5",{class:"mn-b-thin"},"Add to public:",-1),S={key:0,class:"mn-b-thin"},F={key:1,class:"mn-b-medium br-grey br-2px br-solid pd-small radius-big"},R={__name:"CreateBlogPost",setup($){const s=f.useRoute(),u=f.useRouter();let t=e.ref(null),p=e.ref(null);const c=e.ref([]),r=e.ref(null);e.onMounted(async()=>{const o=await q.actions.read({user:i.state.user._id,postable:i.state.user._id,limit:100});if(p.value=o.map(a=>({name:a.profile.name,_id:a._id,photo:a.profile.photo})),s.params.url){const a=await n.read({user:i.state.user._id,url:s.params.url});t.value=a.pop()}else n.clean(),t.value=n.state.current;t.value.owner||(t.value.owner={target:i.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:i.state.user._id,type:"user",hidden:!1}),t.value.owner.type==="organization"&&(r.value={_id:t.value.owner.target._id,name:t.value.owner.target.profile.name,photo:t.value.owner.target.profile.photo}),console.log(o)});const g=e.ref(""),m=e.ref([{text:"story"},{text:"news"},{text:"guide"},{text:"discussion"},{text:"photos"}]);e.computed(()=>m.value.filter(o=>o.text.toLowerCase().includes(g.value.toLowerCase()))),e.computed(()=>m.value.filter(o=>!c.value.some(a=>a.text===o.text)));const d=e.ref(!1);function h(){d.value=!0}function v(){d.value=!1}function b(){c.value.length>0&&c.value.map(o=>o.text),t.value.status="draft",s.params.url?n.update(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.log(o)}):n.create(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.log(o)})}function k(){r.value&&(t.value.owner={target:r.value._id,type:"organization"}),r.value||(t.value.creator.hidden=!1),r.value||(t.value.organization=t.value.creator),t.value.status="published",console.log(t.value),s.params.url?n.update(t.value).then(o=>{console.log(t.value),u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.error(o)}):n.create(t.value).then(o=>{u.push({name:"BlogPost",params:{url:o.url}})}).catch(o=>{console.error(o)})}function _(){confirm("Are you sure you want to delete this post?")&&n.remove(t.value._id).then(o=>{u.push({name:"User Blogposts",params:{_id:t.value.creator.target._id}})}).catch(o=>{console.log(o)})}return(o,a)=>(e.openBlock(),e.createElementBlock("article",E,[e.createElementVNode("section",T,[e.createElementVNode("div",z,[e.unref(t)?(e.openBlock(),e.createBlock(w.default,{key:0,prop:e.unref(t),setFocus:!0,content:"name",placeholder:"Enter post title",class:"h2"},null,8,["prop"])):e.createCommentVNode("",!0)]),e.unref(t)?(e.openBlock(),e.createBlock(V.default,{key:0,content:e.unref(t).content,onUpdate:a[0]||(a[0]=l=>e.unref(t).content=l)},null,8,["content"])):e.createCommentVNode("",!0)]),e.createVNode(e.Transition,{name:"scaleIn"},{default:e.withCtx(()=>[e.unref(t)?(e.openBlock(),e.createElementBlock("section",A,[e.createElementVNode("div",O,[e.unref(s).params.url?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:a[1]||(a[1]=l=>_()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:a[2]||(a[2]=l=>b()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:a[3]||(a[3]=l=>h()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(y.default,{title:"Добавить участника",onClosePopup:v,isPopupOpen:d.value,class:"w-m-33r t-left pd-big bg-white radius-big"},{default:e.withCtx(()=>[U,e.createVNode(B.default,{onTagsChanged:a[4]||(a[4]=l=>e.unref(t).tags=l),tags:e.unref(t).tags},null,8,["tags"]),D,e.createVNode(C.default,{field:e.unref(t).source,"onUpdate:field":a[5]||(a[5]=l=>e.unref(t).source=l),placeholder:"Add full link to the source",class:"mn-b-medium bg-grey radius-medium pd-small"},null,8,["field"]),M,e.createVNode(P.default,{modelValue:r.value,"onUpdate:modelValue":a[6]||(a[6]=l=>r.value=l),options:e.unref(p),multiple:!1,taggable:!1,placeholder:"Type to search or add tag",label:"name","track-by":"_id",class:"mn-b-medium bg-grey radius-medium pd-small"},null,8,["modelValue","options"]),r.value?(e.openBlock(),e.createElementBlock("h5",S,"Options:")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",F,[e.createVNode(N.default,{label:"Hide Author",radio:e.unref(t).creator.hidden,"onUpdate:radio":a[7]||(a[7]=l=>e.unref(t).creator.hidden=l),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(x.default,{submit:k,callback:o.redirectTo,class:"w-100 bg-black t-white"},{default:e.withCtx(()=>[e.createTextVNode("Publish")]),_:1},8,["callback"])]),_:1},8,["isPopupOpen"])]))}};exports.default=R;
@@ -1,5 +1,5 @@
1
1
  import { ref as n, onMounted as A, computed as w, openBlock as i, createElementBlock as m, createElementVNode as r, unref as a, createBlock as k, createCommentVNode as c, createVNode as u, Transition as U, withCtx as v, createTextVNode as z } from "vue";
2
- import D from "../../../constructor/components/elements/Textarea.vue2.js";
2
+ import D from "../../../constructor/components/elements/Textarea.vue.js";
3
3
  import N from "../../../constructor/components/sections/Constructor.vue.js";
4
4
  import O from "../../../../components/Popup/Popup.vue.js";
5
5
  import "../../../../components/FieldTags/tag-input.vue.js";
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Textarea.vue2.cjs");const k=["placeholder"],x={__name:"Textarea",props:["prop","value","content","placeholder","index","setFocus"],emits:["deleteBlock","updateBlock","addBlock","focus"],setup(o,{emit:s}){const t=o,c=s;e.ref(t);const n=e.ref(null);e.ref(0);function d(a){let l=a.target.value.split(/\n+/);if(l.length>1){t.prop[t.content]=l[0],e.nextTick(()=>{r()});let i=l.slice(1).map(f=>({__name:"Textarea",content:f}));c("addBlock","Textarea","",t.index,{blocks:i,ref:n})}else a.target.value.trim()===""&&a.target.value.includes(`
2
+
3
+ `)&&(console.log("We are adding new block:"+t.index+newBlocks+n),c("addBlock","Textarea","",t.index,{blocks:newBlocks,ref:n})),r()}function p(a){(a.keyCode===8||a.keyCode===46)&&t.prop[t.content].trim()===""&&c("deleteBlock",t.prop)}function u(){e.nextTick(()=>{n.value.focus(),c("updateBlock",t.prop,{setFocus:!1})})}function r(){n.value.style.height="1rem",n.value.style.height=n.value.scrollHeight+"px"}return e.onUpdated(()=>{t.setFocus&&e.nextTick(()=>{u()}),r()}),e.onMounted(()=>{t.setFocus&&e.nextTick(()=>{u()}),r()}),(a,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":l[0]||(l[0]=i=>o.prop[o.content]=i),placeholder:o.placeholder?o.placeholder:"",onInput:d,onFocus:l[1]||(l[1]=i=>c("focus",n.value)),onKeyup:p,ref_key:"textarea",ref:n,tabindex:"-1",class:e.normalizeClass(["text-area mn-b-thin",{"t-main t-semi":o.prop.type==="Link"}])},`
4
+
5
+ `,42,k),[[e.vModelText,o.prop[o.content]]])]))}};exports.default=x;
@@ -1 +1,67 @@
1
+ import { ref as s, onUpdated as m, nextTick as i, onMounted as x, openBlock as h, createElementBlock as B, withDirectives as g, createElementVNode as v, normalizeClass as y, vModelText as T } from "vue";
2
+ import "./Textarea.vue2.js";
3
+ const b = ["placeholder"], C = {
4
+ __name: "Textarea",
5
+ props: ["prop", "value", "content", "placeholder", "index", "setFocus"],
6
+ emits: ["deleteBlock", "updateBlock", "addBlock", "focus"],
7
+ setup(o, { emit: u }) {
8
+ const e = o, a = u;
9
+ s(e);
10
+ const t = s(null);
11
+ s(0);
12
+ function p(l) {
13
+ let n = l.target.value.split(/\n+/);
14
+ if (n.length > 1) {
15
+ e.prop[e.content] = n[0], i(() => {
16
+ c();
17
+ });
18
+ let r = n.slice(1).map((k) => ({ __name: "Textarea", content: k }));
19
+ a("addBlock", "Textarea", "", e.index, { blocks: r, ref: t });
20
+ } else
21
+ l.target.value.trim() === "" && l.target.value.includes(`
1
22
 
23
+ `) && (console.log("We are adding new block:" + e.index + newBlocks + t), a("addBlock", "Textarea", "", e.index, { blocks: newBlocks, ref: t })), c();
24
+ }
25
+ function f(l) {
26
+ (l.keyCode === 8 || l.keyCode === 46) && e.prop[e.content].trim() === "" && a("deleteBlock", e.prop);
27
+ }
28
+ function d() {
29
+ i(() => {
30
+ t.value.focus(), a("updateBlock", e.prop, { setFocus: !1 });
31
+ });
32
+ }
33
+ function c() {
34
+ t.value.style.height = "1rem", t.value.style.height = t.value.scrollHeight + "px";
35
+ }
36
+ return m(() => {
37
+ e.setFocus && i(() => {
38
+ d();
39
+ }), c();
40
+ }), x(() => {
41
+ e.setFocus && i(() => {
42
+ d();
43
+ }), c();
44
+ }), (l, n) => (h(), B("div", null, [
45
+ g(v("textarea", {
46
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => o.prop[o.content] = r),
47
+ placeholder: o.placeholder ? o.placeholder : "",
48
+ onInput: p,
49
+ onFocus: n[1] || (n[1] = (r) => a("focus", t.value)),
50
+ onKeyup: f,
51
+ ref_key: "textarea",
52
+ ref: t,
53
+ tabindex: "-1",
54
+ class: y(["text-area mn-b-thin", {
55
+ "t-main t-semi": o.prop.type === "Link"
56
+ }])
57
+ }, `
58
+
59
+ `, 42, b), [
60
+ [T, o.prop[o.content]]
61
+ ])
62
+ ]));
63
+ }
64
+ };
65
+ export {
66
+ C as default
67
+ };
@@ -1,5 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Textarea.vue.cjs");const k=["placeholder"],x={__name:"Textarea",props:["prop","value","content","placeholder","index","setFocus"],emits:["deleteBlock","updateBlock","addBlock","focus"],setup(o,{emit:s}){const t=o,c=s;e.ref(t);const n=e.ref(null);e.ref(0);function d(a){let l=a.target.value.split(/\n+/);if(l.length>1){t.prop[t.content]=l[0],e.nextTick(()=>{r()});let i=l.slice(1).map(f=>({__name:"Textarea",content:f}));c("addBlock","Textarea","",t.index,{blocks:i,ref:n})}else a.target.value.trim()===""&&a.target.value.includes(`
2
-
3
- `)&&(console.log("We are adding new block:"+t.index+newBlocks+n),c("addBlock","Textarea","",t.index,{blocks:newBlocks,ref:n})),r()}function p(a){(a.keyCode===8||a.keyCode===46)&&t.prop[t.content].trim()===""&&c("deleteBlock",t.prop)}function u(){e.nextTick(()=>{n.value.focus(),c("updateBlock",t.prop,{setFocus:!1})})}function r(){n.value.style.height="1rem",n.value.style.height=n.value.scrollHeight+"px"}return e.onUpdated(()=>{t.setFocus&&e.nextTick(()=>{u()}),r()}),e.onMounted(()=>{t.setFocus&&e.nextTick(()=>{u()}),r()}),(a,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":l[0]||(l[0]=i=>o.prop[o.content]=i),placeholder:o.placeholder?o.placeholder:"",onInput:d,onFocus:l[1]||(l[1]=i=>c("focus",n.value)),onKeyup:p,ref_key:"textarea",ref:n,tabindex:"-1",class:e.normalizeClass(["text-area mn-b-thin",{"t-main t-semi":o.prop.type==="Link"}])},`
4
-
5
- `,42,k),[[e.vModelText,o.prop[o.content]]])]))}};exports.default=x;
1
+ "use strict";
@@ -1,67 +1 @@
1
- import { ref as s, onUpdated as m, nextTick as i, onMounted as x, openBlock as h, createElementBlock as B, withDirectives as g, createElementVNode as v, normalizeClass as y, vModelText as T } from "vue";
2
- import "./Textarea.vue.js";
3
- const b = ["placeholder"], C = {
4
- __name: "Textarea",
5
- props: ["prop", "value", "content", "placeholder", "index", "setFocus"],
6
- emits: ["deleteBlock", "updateBlock", "addBlock", "focus"],
7
- setup(o, { emit: u }) {
8
- const e = o, a = u;
9
- s(e);
10
- const t = s(null);
11
- s(0);
12
- function p(l) {
13
- let n = l.target.value.split(/\n+/);
14
- if (n.length > 1) {
15
- e.prop[e.content] = n[0], i(() => {
16
- c();
17
- });
18
- let r = n.slice(1).map((k) => ({ __name: "Textarea", content: k }));
19
- a("addBlock", "Textarea", "", e.index, { blocks: r, ref: t });
20
- } else
21
- l.target.value.trim() === "" && l.target.value.includes(`
22
1
 
23
- `) && (console.log("We are adding new block:" + e.index + newBlocks + t), a("addBlock", "Textarea", "", e.index, { blocks: newBlocks, ref: t })), c();
24
- }
25
- function f(l) {
26
- (l.keyCode === 8 || l.keyCode === 46) && e.prop[e.content].trim() === "" && a("deleteBlock", e.prop);
27
- }
28
- function d() {
29
- i(() => {
30
- t.value.focus(), a("updateBlock", e.prop, { setFocus: !1 });
31
- });
32
- }
33
- function c() {
34
- t.value.style.height = "1rem", t.value.style.height = t.value.scrollHeight + "px";
35
- }
36
- return m(() => {
37
- e.setFocus && i(() => {
38
- d();
39
- }), c();
40
- }), x(() => {
41
- e.setFocus && i(() => {
42
- d();
43
- }), c();
44
- }), (l, n) => (h(), B("div", null, [
45
- g(v("textarea", {
46
- "onUpdate:modelValue": n[0] || (n[0] = (r) => o.prop[o.content] = r),
47
- placeholder: o.placeholder ? o.placeholder : "",
48
- onInput: p,
49
- onFocus: n[1] || (n[1] = (r) => a("focus", t.value)),
50
- onKeyup: f,
51
- ref_key: "textarea",
52
- ref: t,
53
- tabindex: "-1",
54
- class: y(["text-area mn-b-thin", {
55
- "t-main t-semi": o.prop.type === "Link"
56
- }])
57
- }, `
58
-
59
- `, 42, b), [
60
- [T, o.prop[o.content]]
61
- ])
62
- ]));
63
- }
64
- };
65
- export {
66
- C as default
67
- };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../elements/Textarea.vue2.cjs"),V=require("../elements/H2.vue.cjs"),x=require("../elements/Caption.vue.cjs"),N=require("../elements/Bullets.vue.cjs"),A=require("../elements/ImageUpload.vue.cjs"),y=require("../elements/Embed.vue.cjs"),q=require("../elements/Audio.vue.cjs"),$=require("../elements/Video.vue.cjs"),D=require("../../../../../../node_modules/vue-draggable-next/dist/vue-draggable-next.esm-bundler.cjs"),M=["onMouseover"],T={key:0,class:"z-index-5 radius-thin pd-thin bg-white w-max mn-b-small flex-nowrap flex-column flex"},F=["onClick"],I=["onClick"],L=["onClick"],S=["onClick"],U=["onClick"],H=["onClick"],z=["onClick"],j={__name:"Constructor",props:["content"],emits:["update"],setup(v,{emit:f}){const b=v,u=f;let t=e.ref(null);e.ref(null),t.value={content:b.content};const h={Textarea:k.default,H2:V.default,Link:k.default,Bullets:N.default,Caption:x.default,ImageUpload:A.default,Embed:y.default,Audio:q.default,Video:$.default};function c(s="Textarea",a="",o,n){console.log("We are adding new block (functuin HandleAddBlock):"+s+a+o+n);let l={order:t.value.content.length+1,type:s,style:"",class:"",content:a,blocks:[],setFocus:!1};if(n&&n.blocks&&Array.isArray(n.blocks)){let m=n.blocks.map(E=>({...l,content:E.content})),B=[(n.index||o)+1,0].concat(m);t.value.content.splice.apply(t.value.content,B);const _=m[m.length-1];console.log("New block is"+_)}else o!==void 0?(t.value.content.splice(o+1,0,l),console.log("Latest block is"+l)):(console.log("Another block is"+l),t.value.content.push(l));i.value=null,u("update",t.value.content)}function g(s,a){const o=t.value.content.findIndex(n=>n===s);o!==-1&&(t.value.content[o]={...t.value.content[o],...a}),u("update",t.value.content)}function p(s){let a=t.value.content.findIndex(o=>o===s);a!==-1&&t.value.content.splice(a,1),t.value.content[a-1].setFocus=!0,u("update",t.value.content)}const i=e.ref(null),d=e.ref(!1),r=e.ref(!1);function w(){d.value=!0}function C(){d.value=!1}return e.watchEffect(()=>{t.value&&t.value.content.length===0&&c("Textarea",""),u("update",t.value.content)}),(s,a)=>(e.openBlock(),e.createElementBlock("section",null,[e.unref(t).content?(e.openBlock(),e.createBlock(e.unref(D.VueDraggableNext),{key:0,class:"w-full",list:e.unref(t).content,onStart:w,onEnd:C},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).content,(o,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"pos-relative"},[e.createElementVNode("div",{onMouseover:l=>(i.value=n,r.value=!1),class:"pos-relative w-full h-full"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(h[o.type]),{index:n,component:o,prop:o,class:e.normalizeClass(o.class),setFocus:o.setFocus,content:"content",onDeleteBlock:p,onAddBlock:c,onUpdateBlock:g},null,40,["index","component","prop","class","setFocus"]))],40,M),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[i.value===n?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pos-absolute z-index-4 i-semi",style:{right:"calc(100% + 0.5rem)",top:"calc(50% - 1.125rem)"},onMousedown:a[1]||(a[1]=e.withModifiers(l=>d.value=!0,["prevent"]))},[e.createElementVNode("button",{onClick:a[0]||(a[0]=l=>r.value=!r.value),class:"mn-b-small cursor-pointer w-100 i-semi bg-white radius-thin"},e.toDisplayString(o.content?"...":"+"),1),r.value?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("span",{onClick:l=>p(o),class:"mn-b-thin w-max t-red bg-white button-small button"}," Remove ",8,F),e.createElementVNode("span",{onClick:l=>c("ImageUpload","",n),class:"mn-b-thin w-max t-black bg-white button-small button"}," Add Image ",8,I),e.createElementVNode("span",{onClick:l=>c("H2","",n),class:"w-max button-small t-black bg-white button"}," Add Title ",8,L),e.createElementVNode("span",{onClick:l=>c("Embed","",n),class:"w-max button-small t-black bg-white button"}," Add Embed ",8,S),e.createElementVNode("span",{onClick:l=>c("Audio","",n),class:"w-max button-small t-black bg-white button"}," Add Audio ",8,U),e.createElementVNode("span",{onClick:l=>c("Video","",n),class:"w-max button-small t-black bg-white button"}," Add Video ",8,H),e.createElementVNode("span",{onClick:l=>c("Link","",n),class:"w-max button-small t-black bg-white button"}," Add Link ",8,z)])):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)]),_:2},1024)]))),128))]),_:1},8,["list"])):e.createCommentVNode("",!0)]))}};exports.default=j;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../elements/Textarea.vue.cjs"),V=require("../elements/H2.vue.cjs"),x=require("../elements/Caption.vue.cjs"),N=require("../elements/Bullets.vue.cjs"),A=require("../elements/ImageUpload.vue.cjs"),y=require("../elements/Embed.vue.cjs"),q=require("../elements/Audio.vue.cjs"),$=require("../elements/Video.vue.cjs"),D=require("../../../../../../node_modules/vue-draggable-next/dist/vue-draggable-next.esm-bundler.cjs"),M=["onMouseover"],T={key:0,class:"z-index-5 radius-thin pd-thin bg-white w-max mn-b-small flex-nowrap flex-column flex"},F=["onClick"],I=["onClick"],L=["onClick"],S=["onClick"],U=["onClick"],H=["onClick"],z=["onClick"],j={__name:"Constructor",props:["content"],emits:["update"],setup(v,{emit:f}){const b=v,u=f;let t=e.ref(null);e.ref(null),t.value={content:b.content};const h={Textarea:k.default,H2:V.default,Link:k.default,Bullets:N.default,Caption:x.default,ImageUpload:A.default,Embed:y.default,Audio:q.default,Video:$.default};function c(s="Textarea",a="",o,n){console.log("We are adding new block (functuin HandleAddBlock):"+s+a+o+n);let l={order:t.value.content.length+1,type:s,style:"",class:"",content:a,blocks:[],setFocus:!1};if(n&&n.blocks&&Array.isArray(n.blocks)){let m=n.blocks.map(E=>({...l,content:E.content})),B=[(n.index||o)+1,0].concat(m);t.value.content.splice.apply(t.value.content,B);const _=m[m.length-1];console.log("New block is"+_)}else o!==void 0?(t.value.content.splice(o+1,0,l),console.log("Latest block is"+l)):(console.log("Another block is"+l),t.value.content.push(l));i.value=null,u("update",t.value.content)}function g(s,a){const o=t.value.content.findIndex(n=>n===s);o!==-1&&(t.value.content[o]={...t.value.content[o],...a}),u("update",t.value.content)}function p(s){let a=t.value.content.findIndex(o=>o===s);a!==-1&&t.value.content.splice(a,1),t.value.content[a-1].setFocus=!0,u("update",t.value.content)}const i=e.ref(null),d=e.ref(!1),r=e.ref(!1);function w(){d.value=!0}function C(){d.value=!1}return e.watchEffect(()=>{t.value&&t.value.content.length===0&&c("Textarea",""),u("update",t.value.content)}),(s,a)=>(e.openBlock(),e.createElementBlock("section",null,[e.unref(t).content?(e.openBlock(),e.createBlock(e.unref(D.VueDraggableNext),{key:0,class:"w-full",list:e.unref(t).content,onStart:w,onEnd:C},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).content,(o,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"pos-relative"},[e.createElementVNode("div",{onMouseover:l=>(i.value=n,r.value=!1),class:"pos-relative w-full h-full"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(h[o.type]),{index:n,component:o,prop:o,class:e.normalizeClass(o.class),setFocus:o.setFocus,content:"content",onDeleteBlock:p,onAddBlock:c,onUpdateBlock:g},null,40,["index","component","prop","class","setFocus"]))],40,M),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[i.value===n?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pos-absolute z-index-4 i-semi",style:{right:"calc(100% + 0.5rem)",top:"calc(50% - 1.125rem)"},onMousedown:a[1]||(a[1]=e.withModifiers(l=>d.value=!0,["prevent"]))},[e.createElementVNode("button",{onClick:a[0]||(a[0]=l=>r.value=!r.value),class:"mn-b-small cursor-pointer w-100 i-semi bg-white radius-thin"},e.toDisplayString(o.content?"...":"+"),1),r.value?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("span",{onClick:l=>p(o),class:"mn-b-thin w-max t-red bg-white button-small button"}," Remove ",8,F),e.createElementVNode("span",{onClick:l=>c("ImageUpload","",n),class:"mn-b-thin w-max t-black bg-white button-small button"}," Add Image ",8,I),e.createElementVNode("span",{onClick:l=>c("H2","",n),class:"w-max button-small t-black bg-white button"}," Add Title ",8,L),e.createElementVNode("span",{onClick:l=>c("Embed","",n),class:"w-max button-small t-black bg-white button"}," Add Embed ",8,S),e.createElementVNode("span",{onClick:l=>c("Audio","",n),class:"w-max button-small t-black bg-white button"}," Add Audio ",8,U),e.createElementVNode("span",{onClick:l=>c("Video","",n),class:"w-max button-small t-black bg-white button"}," Add Video ",8,H),e.createElementVNode("span",{onClick:l=>c("Link","",n),class:"w-max button-small t-black bg-white button"}," Add Link ",8,z)])):e.createCommentVNode("",!0)],32)):e.createCommentVNode("",!0)]),_:2},1024)]))),128))]),_:1},8,["list"])):e.createCommentVNode("",!0)]))}};exports.default=j;
@@ -1,5 +1,5 @@
1
1
  import { ref as u, watchEffect as M, openBlock as i, createElementBlock as r, unref as p, createBlock as h, withCtx as g, Fragment as N, renderList as I, createElementVNode as s, resolveDynamicComponent as L, normalizeClass as T, createVNode as U, Transition as z, withModifiers as H, toDisplayString as S, createCommentVNode as b } from "vue";
2
- import w from "../elements/Textarea.vue2.js";
2
+ import w from "../elements/Textarea.vue.js";
3
3
  import R from "../elements/H2.vue.js";
4
4
  import W from "../elements/Caption.vue.js";
5
5
  import j from "../elements/Bullets.vue.js";