@ozdao/prometheus-framework 0.2.58 → 0.2.60
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/community.server.js +1 -1
- package/dist/community.server.mjs +1 -1
- package/dist/events.server.js +23 -3
- package/dist/events.server.mjs +23 -3
- package/dist/metadata.schema-CjpDDEnW.mjs +210 -0
- package/dist/metadata.schema-doiYQfuO.js +209 -0
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +1 -373
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.js +51 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.js +1 -51
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +36 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +1 -36
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +1 -5
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +0 -66
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +5 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +66 -0
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +44 -44
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +31 -31
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +1 -13
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +13 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +166 -123
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +56 -45
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +19 -24
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +15 -15
- package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +8 -8
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/modules/events/components/elements/ButtonCheck.vue +106 -0
- package/src/modules/events/components/pages/Event.vue +10 -1
- package/src/modules/events/controllers/tickets.controller.js +31 -2
- package/src/modules/events/models/ticket.model.js +8 -0
- package/src/modules/globals/components/blocks/CardHeader.vue +1 -1
- package/src/modules/globals/models/ownership.schema.js +1 -1
- package/src/modules/orders/components/pages/EditOrder.vue +84 -29
- package/src/modules/orders/components/pages/Order.vue +10 -9
- package/src/modules/orders/components/pages/Orders.vue +30 -21
- package/src/modules/orders/controllers/orders.controller.js +1 -1
- package/src/modules/orders/models/order.model.js +10 -1
- package/src/modules/orders/store/orders.js +1 -6
- package/src/modules/products/components/blocks/CardPosition.vue +1 -1
- package/src/modules/products/components/pages/EditLeftover.vue +2 -2
package/dist/community.server.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
3
3
|
const require$$0 = require("mongoose");
|
4
|
-
const metadata_schema = require("./metadata.schema-
|
4
|
+
const metadata_schema = require("./metadata.schema-doiYQfuO.js");
|
5
5
|
require("util");
|
6
6
|
require("uuid");
|
7
7
|
const index = require("./index-CL9l0HRS.js");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
2
|
import require$$0 from "mongoose";
|
3
|
-
import { q as queryProcessor$3, c as common_schema, e as engagement_schema, o as ownership_schema, m as metadata_schema } from "./metadata.schema-
|
3
|
+
import { q as queryProcessor$3, c as common_schema, e as engagement_schema, o as ownership_schema, m as metadata_schema } from "./metadata.schema-CjpDDEnW.mjs";
|
4
4
|
import "util";
|
5
5
|
import "uuid";
|
6
6
|
import { s as server$1 } from "./index-CGIn4v5E.mjs";
|
package/dist/events.server.js
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
4
4
|
const require$$0 = require("mongoose");
|
5
|
-
const metadata_schema = require("./metadata.schema-
|
5
|
+
const metadata_schema = require("./metadata.schema-doiYQfuO.js");
|
6
6
|
const index = require("./index-CL9l0HRS.js");
|
7
|
+
const require$$0$1 = require("qrcode");
|
7
8
|
const ObjectId = require$$0.Types.ObjectId;
|
8
9
|
function getDateConditions(date) {
|
9
10
|
if (date) {
|
@@ -425,6 +426,7 @@ var events_routes = function(app, db, origins) {
|
|
425
426
|
);
|
426
427
|
};
|
427
428
|
const events_routes$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(events_routes);
|
429
|
+
const QRCode = require$$0$1;
|
428
430
|
const controllerFactory$1 = (db) => {
|
429
431
|
const Ticket = db.ticket;
|
430
432
|
const read = async (req, res) => {
|
@@ -461,6 +463,11 @@ const controllerFactory$1 = (db) => {
|
|
461
463
|
});
|
462
464
|
try {
|
463
465
|
const data = await newTicket.save();
|
466
|
+
const qrData = data._id.toString();
|
467
|
+
const qrCode = await QRCode.toDataURL(qrData);
|
468
|
+
data.status = "unused";
|
469
|
+
data.qrcode = qrCode;
|
470
|
+
await data.save();
|
464
471
|
res.send(data);
|
465
472
|
} catch (err) {
|
466
473
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
@@ -468,11 +475,16 @@ const controllerFactory$1 = (db) => {
|
|
468
475
|
};
|
469
476
|
const update = async (req, res) => {
|
470
477
|
try {
|
471
|
-
const
|
478
|
+
const { _id } = req.body;
|
479
|
+
const ticket = await Ticket.findById(_id);
|
472
480
|
if (!ticket) {
|
473
481
|
return res.status(404).send({ errorCode: "TICKET_NOT_FOUND" });
|
474
482
|
}
|
475
|
-
|
483
|
+
if (ticket.status === "used") {
|
484
|
+
return res.status(500).send({ errorCode: "TICKET_ALREADY_USED" });
|
485
|
+
}
|
486
|
+
const updatedTicket = await Ticket.findByIdAndUpdate(_id, req.body, { new: true });
|
487
|
+
res.send(updatedTicket);
|
476
488
|
} catch (err) {
|
477
489
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
478
490
|
}
|
@@ -640,6 +652,14 @@ var ticket_model = (mongoose) => {
|
|
640
652
|
role: {
|
641
653
|
type: String,
|
642
654
|
default: "participant"
|
655
|
+
},
|
656
|
+
qrcode: {
|
657
|
+
type: String
|
658
|
+
},
|
659
|
+
status: {
|
660
|
+
type: String,
|
661
|
+
enum: ["unused", "used"],
|
662
|
+
deafult: "unused"
|
643
663
|
}
|
644
664
|
});
|
645
665
|
TicketSchema.index({ user: 1, type: 1, target: 1 });
|
package/dist/events.server.mjs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
2
|
import require$$0 from "mongoose";
|
3
|
-
import { q as queryProcessor$2, c as common_schema, e as engagement_schema, o as ownership_schema, m as metadata_schema } from "./metadata.schema-
|
3
|
+
import { q as queryProcessor$2, c as common_schema, e as engagement_schema, o as ownership_schema, m as metadata_schema } from "./metadata.schema-CjpDDEnW.mjs";
|
4
4
|
import { s as server$1 } from "./index-CGIn4v5E.mjs";
|
5
|
+
import require$$0$1 from "qrcode";
|
5
6
|
const ObjectId = require$$0.Types.ObjectId;
|
6
7
|
function getDateConditions(date) {
|
7
8
|
if (date) {
|
@@ -423,6 +424,7 @@ var events_routes = function(app, db, origins) {
|
|
423
424
|
);
|
424
425
|
};
|
425
426
|
const events_routes$1 = /* @__PURE__ */ getDefaultExportFromCjs(events_routes);
|
427
|
+
const QRCode = require$$0$1;
|
426
428
|
const controllerFactory$1 = (db) => {
|
427
429
|
const Ticket = db.ticket;
|
428
430
|
const read = async (req, res) => {
|
@@ -459,6 +461,11 @@ const controllerFactory$1 = (db) => {
|
|
459
461
|
});
|
460
462
|
try {
|
461
463
|
const data = await newTicket.save();
|
464
|
+
const qrData = data._id.toString();
|
465
|
+
const qrCode = await QRCode.toDataURL(qrData);
|
466
|
+
data.status = "unused";
|
467
|
+
data.qrcode = qrCode;
|
468
|
+
await data.save();
|
462
469
|
res.send(data);
|
463
470
|
} catch (err) {
|
464
471
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
@@ -466,11 +473,16 @@ const controllerFactory$1 = (db) => {
|
|
466
473
|
};
|
467
474
|
const update = async (req, res) => {
|
468
475
|
try {
|
469
|
-
const
|
476
|
+
const { _id } = req.body;
|
477
|
+
const ticket = await Ticket.findById(_id);
|
470
478
|
if (!ticket) {
|
471
479
|
return res.status(404).send({ errorCode: "TICKET_NOT_FOUND" });
|
472
480
|
}
|
473
|
-
|
481
|
+
if (ticket.status === "used") {
|
482
|
+
return res.status(500).send({ errorCode: "TICKET_ALREADY_USED" });
|
483
|
+
}
|
484
|
+
const updatedTicket = await Ticket.findByIdAndUpdate(_id, req.body, { new: true });
|
485
|
+
res.send(updatedTicket);
|
474
486
|
} catch (err) {
|
475
487
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
476
488
|
}
|
@@ -638,6 +650,14 @@ var ticket_model = (mongoose) => {
|
|
638
650
|
role: {
|
639
651
|
type: String,
|
640
652
|
default: "participant"
|
653
|
+
},
|
654
|
+
qrcode: {
|
655
|
+
type: String
|
656
|
+
},
|
657
|
+
status: {
|
658
|
+
type: String,
|
659
|
+
enum: ["unused", "used"],
|
660
|
+
deafult: "unused"
|
641
661
|
}
|
642
662
|
});
|
643
663
|
TicketSchema.index({ user: 1, type: 1, target: 1 });
|
@@ -0,0 +1,210 @@
|
|
1
|
+
import require$$0 from "mongoose";
|
2
|
+
const ObjectId = require$$0.Types.ObjectId;
|
3
|
+
function getBasicOptions(query) {
|
4
|
+
const { _id, url, status, owner, creator } = query;
|
5
|
+
const conditions = [];
|
6
|
+
if (_id) {
|
7
|
+
conditions.push({ _id: new ObjectId(_id) });
|
8
|
+
}
|
9
|
+
if (url) {
|
10
|
+
conditions.push({ url });
|
11
|
+
}
|
12
|
+
if (status) {
|
13
|
+
conditions.push({ status });
|
14
|
+
}
|
15
|
+
if (owner) {
|
16
|
+
conditions.push({ "owner.target": new ObjectId(owner) });
|
17
|
+
}
|
18
|
+
if (creator) {
|
19
|
+
conditions.push({ "creator.target": new ObjectId(creator) });
|
20
|
+
}
|
21
|
+
if (conditions.length > 0) {
|
22
|
+
return [{ $match: { $and: conditions } }];
|
23
|
+
} else {
|
24
|
+
return [];
|
25
|
+
}
|
26
|
+
}
|
27
|
+
function getTagsOptions(tags) {
|
28
|
+
if (tags && tags.length > 0) {
|
29
|
+
[{ $in: tags.split(",") }];
|
30
|
+
} else {
|
31
|
+
return [];
|
32
|
+
}
|
33
|
+
}
|
34
|
+
function getSortingOptions(param = "createdAt", order = "desc") {
|
35
|
+
let sort = {
|
36
|
+
[param]: order === "desc" ? -1 : 1,
|
37
|
+
"_id": 1
|
38
|
+
};
|
39
|
+
return [{ $sort: sort }];
|
40
|
+
}
|
41
|
+
function getPaginationOptions(skip, limit) {
|
42
|
+
let pagination = {
|
43
|
+
skip: parseInt(skip) || 0,
|
44
|
+
limit: parseInt(limit) || 20
|
45
|
+
};
|
46
|
+
return [{ $skip: pagination.skip }, { $limit: pagination.limit }];
|
47
|
+
}
|
48
|
+
function getCreatorUserLookupStage() {
|
49
|
+
return {
|
50
|
+
$lookup: {
|
51
|
+
from: "users",
|
52
|
+
localField: "creator.target",
|
53
|
+
foreignField: "_id",
|
54
|
+
as: "creatorUser"
|
55
|
+
}
|
56
|
+
};
|
57
|
+
}
|
58
|
+
function getCreatorOrganizationLookupStage() {
|
59
|
+
return {
|
60
|
+
$lookup: {
|
61
|
+
from: "organizations",
|
62
|
+
localField: "creator.target",
|
63
|
+
foreignField: "_id",
|
64
|
+
as: "creatorOrganization"
|
65
|
+
}
|
66
|
+
};
|
67
|
+
}
|
68
|
+
function getOwnerUserLookupStage() {
|
69
|
+
return {
|
70
|
+
$lookup: {
|
71
|
+
from: "users",
|
72
|
+
localField: "owner.target",
|
73
|
+
foreignField: "_id",
|
74
|
+
as: "ownerUser"
|
75
|
+
}
|
76
|
+
};
|
77
|
+
}
|
78
|
+
function getOwnerOrganizationLookupStage() {
|
79
|
+
return {
|
80
|
+
$lookup: {
|
81
|
+
from: "organizations",
|
82
|
+
localField: "owner.target",
|
83
|
+
foreignField: "_id",
|
84
|
+
as: "ownerOrganization"
|
85
|
+
}
|
86
|
+
};
|
87
|
+
}
|
88
|
+
function getAddFieldsCreatorOwnerStage() {
|
89
|
+
return {
|
90
|
+
$addFields: {
|
91
|
+
"creator.target": {
|
92
|
+
$cond: [
|
93
|
+
{ $eq: ["$creator.type", "user"] },
|
94
|
+
{ $arrayElemAt: ["$creatorUser", 0] },
|
95
|
+
{ $arrayElemAt: ["$creatorOrganization", 0] }
|
96
|
+
]
|
97
|
+
},
|
98
|
+
"owner.target": {
|
99
|
+
$cond: [
|
100
|
+
{ $eq: ["$owner.type", "user"] },
|
101
|
+
{ $arrayElemAt: ["$ownerUser", 0] },
|
102
|
+
{ $arrayElemAt: ["$ownerOrganization", 0] }
|
103
|
+
]
|
104
|
+
}
|
105
|
+
}
|
106
|
+
};
|
107
|
+
}
|
108
|
+
var queryProcessor = {
|
109
|
+
getBasicOptions,
|
110
|
+
getSortingOptions,
|
111
|
+
getPaginationOptions,
|
112
|
+
getTagsOptions,
|
113
|
+
// Creator and Owner
|
114
|
+
getCreatorUserLookupStage,
|
115
|
+
getCreatorOrganizationLookupStage,
|
116
|
+
getOwnerUserLookupStage,
|
117
|
+
getOwnerOrganizationLookupStage,
|
118
|
+
getAddFieldsCreatorOwnerStage
|
119
|
+
};
|
120
|
+
var common_schema = function applyCommonSchema(schema, db) {
|
121
|
+
schema.add({
|
122
|
+
status: {
|
123
|
+
type: String,
|
124
|
+
enum: ["draft", "published", "removed"],
|
125
|
+
default: "draft",
|
126
|
+
required: true
|
127
|
+
}
|
128
|
+
});
|
129
|
+
};
|
130
|
+
var engagement_schema = function applyEngagementSchema(schema, db) {
|
131
|
+
schema.add({ views: { type: Number, default: 0 } });
|
132
|
+
schema.post("aggregate", async function(docs) {
|
133
|
+
if (docs.length === 0)
|
134
|
+
return;
|
135
|
+
console.log("Post-aggregate hook in engagement schema triggered");
|
136
|
+
const model = this._model;
|
137
|
+
if (!model) {
|
138
|
+
console.error("No model is associated with this schema!");
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
try {
|
142
|
+
await updateDocumentViews(docs, model);
|
143
|
+
} catch (error) {
|
144
|
+
console.error("Error updating views:", error);
|
145
|
+
}
|
146
|
+
});
|
147
|
+
async function updateDocumentViews(docs, model) {
|
148
|
+
const updateViewsPromises = docs.map((doc) => model.findOneAndUpdate(
|
149
|
+
{ _id: doc._id },
|
150
|
+
{ $inc: { views: 1 } }
|
151
|
+
).exec());
|
152
|
+
await Promise.all(updateViewsPromises);
|
153
|
+
}
|
154
|
+
};
|
155
|
+
var ownership_schema = function applyOwnershipSchema(schema, db) {
|
156
|
+
schema.add({
|
157
|
+
owner: {
|
158
|
+
type: {
|
159
|
+
type: String,
|
160
|
+
required: true
|
161
|
+
},
|
162
|
+
target: {
|
163
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
164
|
+
refPath: "owner.type",
|
165
|
+
required: true
|
166
|
+
}
|
167
|
+
},
|
168
|
+
creator: {
|
169
|
+
hidden: {
|
170
|
+
type: Boolean,
|
171
|
+
default: false
|
172
|
+
},
|
173
|
+
type: {
|
174
|
+
type: String,
|
175
|
+
required: true
|
176
|
+
},
|
177
|
+
target: {
|
178
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
179
|
+
refPath: "creator.type",
|
180
|
+
required: true
|
181
|
+
}
|
182
|
+
}
|
183
|
+
});
|
184
|
+
schema.index({
|
185
|
+
"owner.target": 1,
|
186
|
+
"creator.target": 1
|
187
|
+
});
|
188
|
+
};
|
189
|
+
var metadata_schema = function applyMetadataSchema(schema, db) {
|
190
|
+
schema.add({
|
191
|
+
url: {
|
192
|
+
type: String,
|
193
|
+
required: true
|
194
|
+
},
|
195
|
+
tags: [{
|
196
|
+
type: String
|
197
|
+
}]
|
198
|
+
});
|
199
|
+
schema.index({
|
200
|
+
"url": 1,
|
201
|
+
"tags": 1
|
202
|
+
});
|
203
|
+
};
|
204
|
+
export {
|
205
|
+
common_schema as c,
|
206
|
+
engagement_schema as e,
|
207
|
+
metadata_schema as m,
|
208
|
+
ownership_schema as o,
|
209
|
+
queryProcessor as q
|
210
|
+
};
|
@@ -0,0 +1,209 @@
|
|
1
|
+
"use strict";
|
2
|
+
const require$$0 = require("mongoose");
|
3
|
+
const ObjectId = require$$0.Types.ObjectId;
|
4
|
+
function getBasicOptions(query) {
|
5
|
+
const { _id, url, status, owner, creator } = query;
|
6
|
+
const conditions = [];
|
7
|
+
if (_id) {
|
8
|
+
conditions.push({ _id: new ObjectId(_id) });
|
9
|
+
}
|
10
|
+
if (url) {
|
11
|
+
conditions.push({ url });
|
12
|
+
}
|
13
|
+
if (status) {
|
14
|
+
conditions.push({ status });
|
15
|
+
}
|
16
|
+
if (owner) {
|
17
|
+
conditions.push({ "owner.target": new ObjectId(owner) });
|
18
|
+
}
|
19
|
+
if (creator) {
|
20
|
+
conditions.push({ "creator.target": new ObjectId(creator) });
|
21
|
+
}
|
22
|
+
if (conditions.length > 0) {
|
23
|
+
return [{ $match: { $and: conditions } }];
|
24
|
+
} else {
|
25
|
+
return [];
|
26
|
+
}
|
27
|
+
}
|
28
|
+
function getTagsOptions(tags) {
|
29
|
+
if (tags && tags.length > 0) {
|
30
|
+
[{ $in: tags.split(",") }];
|
31
|
+
} else {
|
32
|
+
return [];
|
33
|
+
}
|
34
|
+
}
|
35
|
+
function getSortingOptions(param = "createdAt", order = "desc") {
|
36
|
+
let sort = {
|
37
|
+
[param]: order === "desc" ? -1 : 1,
|
38
|
+
"_id": 1
|
39
|
+
};
|
40
|
+
return [{ $sort: sort }];
|
41
|
+
}
|
42
|
+
function getPaginationOptions(skip, limit) {
|
43
|
+
let pagination = {
|
44
|
+
skip: parseInt(skip) || 0,
|
45
|
+
limit: parseInt(limit) || 20
|
46
|
+
};
|
47
|
+
return [{ $skip: pagination.skip }, { $limit: pagination.limit }];
|
48
|
+
}
|
49
|
+
function getCreatorUserLookupStage() {
|
50
|
+
return {
|
51
|
+
$lookup: {
|
52
|
+
from: "users",
|
53
|
+
localField: "creator.target",
|
54
|
+
foreignField: "_id",
|
55
|
+
as: "creatorUser"
|
56
|
+
}
|
57
|
+
};
|
58
|
+
}
|
59
|
+
function getCreatorOrganizationLookupStage() {
|
60
|
+
return {
|
61
|
+
$lookup: {
|
62
|
+
from: "organizations",
|
63
|
+
localField: "creator.target",
|
64
|
+
foreignField: "_id",
|
65
|
+
as: "creatorOrganization"
|
66
|
+
}
|
67
|
+
};
|
68
|
+
}
|
69
|
+
function getOwnerUserLookupStage() {
|
70
|
+
return {
|
71
|
+
$lookup: {
|
72
|
+
from: "users",
|
73
|
+
localField: "owner.target",
|
74
|
+
foreignField: "_id",
|
75
|
+
as: "ownerUser"
|
76
|
+
}
|
77
|
+
};
|
78
|
+
}
|
79
|
+
function getOwnerOrganizationLookupStage() {
|
80
|
+
return {
|
81
|
+
$lookup: {
|
82
|
+
from: "organizations",
|
83
|
+
localField: "owner.target",
|
84
|
+
foreignField: "_id",
|
85
|
+
as: "ownerOrganization"
|
86
|
+
}
|
87
|
+
};
|
88
|
+
}
|
89
|
+
function getAddFieldsCreatorOwnerStage() {
|
90
|
+
return {
|
91
|
+
$addFields: {
|
92
|
+
"creator.target": {
|
93
|
+
$cond: [
|
94
|
+
{ $eq: ["$creator.type", "user"] },
|
95
|
+
{ $arrayElemAt: ["$creatorUser", 0] },
|
96
|
+
{ $arrayElemAt: ["$creatorOrganization", 0] }
|
97
|
+
]
|
98
|
+
},
|
99
|
+
"owner.target": {
|
100
|
+
$cond: [
|
101
|
+
{ $eq: ["$owner.type", "user"] },
|
102
|
+
{ $arrayElemAt: ["$ownerUser", 0] },
|
103
|
+
{ $arrayElemAt: ["$ownerOrganization", 0] }
|
104
|
+
]
|
105
|
+
}
|
106
|
+
}
|
107
|
+
};
|
108
|
+
}
|
109
|
+
var queryProcessor = {
|
110
|
+
getBasicOptions,
|
111
|
+
getSortingOptions,
|
112
|
+
getPaginationOptions,
|
113
|
+
getTagsOptions,
|
114
|
+
// Creator and Owner
|
115
|
+
getCreatorUserLookupStage,
|
116
|
+
getCreatorOrganizationLookupStage,
|
117
|
+
getOwnerUserLookupStage,
|
118
|
+
getOwnerOrganizationLookupStage,
|
119
|
+
getAddFieldsCreatorOwnerStage
|
120
|
+
};
|
121
|
+
var common_schema = function applyCommonSchema(schema, db) {
|
122
|
+
schema.add({
|
123
|
+
status: {
|
124
|
+
type: String,
|
125
|
+
enum: ["draft", "published", "removed"],
|
126
|
+
default: "draft",
|
127
|
+
required: true
|
128
|
+
}
|
129
|
+
});
|
130
|
+
};
|
131
|
+
var engagement_schema = function applyEngagementSchema(schema, db) {
|
132
|
+
schema.add({ views: { type: Number, default: 0 } });
|
133
|
+
schema.post("aggregate", async function(docs) {
|
134
|
+
if (docs.length === 0)
|
135
|
+
return;
|
136
|
+
console.log("Post-aggregate hook in engagement schema triggered");
|
137
|
+
const model = this._model;
|
138
|
+
if (!model) {
|
139
|
+
console.error("No model is associated with this schema!");
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
try {
|
143
|
+
await updateDocumentViews(docs, model);
|
144
|
+
} catch (error) {
|
145
|
+
console.error("Error updating views:", error);
|
146
|
+
}
|
147
|
+
});
|
148
|
+
async function updateDocumentViews(docs, model) {
|
149
|
+
const updateViewsPromises = docs.map((doc) => model.findOneAndUpdate(
|
150
|
+
{ _id: doc._id },
|
151
|
+
{ $inc: { views: 1 } }
|
152
|
+
).exec());
|
153
|
+
await Promise.all(updateViewsPromises);
|
154
|
+
}
|
155
|
+
};
|
156
|
+
var ownership_schema = function applyOwnershipSchema(schema, db) {
|
157
|
+
schema.add({
|
158
|
+
owner: {
|
159
|
+
type: {
|
160
|
+
type: String,
|
161
|
+
required: true
|
162
|
+
},
|
163
|
+
target: {
|
164
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
165
|
+
refPath: "owner.type",
|
166
|
+
required: true
|
167
|
+
}
|
168
|
+
},
|
169
|
+
creator: {
|
170
|
+
hidden: {
|
171
|
+
type: Boolean,
|
172
|
+
default: false
|
173
|
+
},
|
174
|
+
type: {
|
175
|
+
type: String,
|
176
|
+
required: true
|
177
|
+
},
|
178
|
+
target: {
|
179
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
180
|
+
refPath: "creator.type",
|
181
|
+
required: true
|
182
|
+
}
|
183
|
+
}
|
184
|
+
});
|
185
|
+
schema.index({
|
186
|
+
"owner.target": 1,
|
187
|
+
"creator.target": 1
|
188
|
+
});
|
189
|
+
};
|
190
|
+
var metadata_schema = function applyMetadataSchema(schema, db) {
|
191
|
+
schema.add({
|
192
|
+
url: {
|
193
|
+
type: String,
|
194
|
+
required: true
|
195
|
+
},
|
196
|
+
tags: [{
|
197
|
+
type: String
|
198
|
+
}]
|
199
|
+
});
|
200
|
+
schema.index({
|
201
|
+
"url": 1,
|
202
|
+
"tags": 1
|
203
|
+
});
|
204
|
+
};
|
205
|
+
exports.common_schema = common_schema;
|
206
|
+
exports.engagement_schema = engagement_schema;
|
207
|
+
exports.metadata_schema = metadata_schema;
|
208
|
+
exports.ownership_schema = ownership_schema;
|
209
|
+
exports.queryProcessor = queryProcessor;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue2.cjs");const g=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const k=require("../../modules/globals/components/blocks/BlockSearch.vue.cjs"),v={__name:"Feed",props:{search:{type:Boolean,default:!1},showLoadMore:{type:Boolean,default:!0},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(s){const a=s,r=e.ref([]),o=e.ref(!1);let i=e.ref(!0),u=e.ref(a.options.skip?a.options.skip:0),l=e.ref(a.options.limit?a.options.limit:10);const d=async()=>{if(o.value){u.value+=l.value;const t=await a.store.read({skip:u.value,limit:l.value,...a.options});t.length===0||t.length<l.value?o.value=!1:o.value=!0,r.value=[...r.value,...t]}},c=async()=>{const t=await a.store.read({skip:u.value,limit:l.value,...a.options});t.length===0||t.length<l.value?o.value=!1:o.value=!0,console.log(t),r.value=t,i.value=!1};e.watch(()=>a.options,(t,n)=>{(t.organization!==n.organization||t.categories!==n.categories||t.prices!==n.prices||t.delivery!==n.delivery||t.search!==n.search||t.status!==n.status)&&c()},{deep:!0});function m(t){a.options.search=t,console.log(t),c()}return e.onMounted(async()=>{await c()}),(t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition"},{default:e.withCtx(()=>[s.search?(e.openBlock(),e.createBlock(k.default,{key:0,onSearch:m,placeholder:"Enter product name",class:"bg-white mn-b-thin"})):e.createCommentVNode("",!0)]),_:1}),e.unref(i)?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:0,tag:"ul",name:"scaleTransition",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[e.unref(i)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(l),p=>(e.openBlock(),e.createBlock(f.default,{key:p}))),128)):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!e.unref(i)&&r.value.length<1?(e.openBlock(),e.createBlock(g.default,{key:0,title:s.states.empty.title,description:s.states.empty.description,class:"pd-medium mn-b-thin bg-grey radius-big"},null,8,["title","description"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:e.normalizeClass(t.$attrs.class)},{default:e.withCtx(()=>[!e.unref(i)&&r.value.length>0?e.renderSlot(t.$slots,"default",{key:0,items:r.value,user:t.user}):e.createCommentVNode("",!0),s.showLoadMore&&o.value&&r.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:d,class:"col-w-100 w-100 bg-main button"}," Load more ")):e.createCommentVNode("",!0)]),_:3},8,["class"])],64))}};exports.default=v;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ref as c, watch as w, onMounted as T, openBlock as l, createElementBlock as v, Fragment as k, createVNode as h, TransitionGroup as y, withCtx as p, createBlock as d, createCommentVNode as o, unref as m, renderList as B, Transition as M, normalizeClass as j, renderSlot as C } from "vue";
|
2
2
|
import O from "../../modules/icons/skeletons/SkeletonEvent.vue.js";
|
3
|
-
import "../Loader/Loader.
|
3
|
+
import "../Loader/Loader.vue2.js";
|
4
4
|
import $ from "../EmptyState/EmptyState.vue.js";
|
5
5
|
import "vue-i18n";
|
6
6
|
import z from "../../modules/globals/components/blocks/BlockSearch.vue.js";
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("./click-outside.cjs"),re=require("./all-countries.cjs");require("./FieldPhone2.vue2.cjs");const ue=require("../../../../_virtual/_plugin-vue_export-helper.cjs"),w=require("../../../node_modules/libphonenumber-js/min/exports/parsePhoneNumber.cjs"),ie=["tabindex"],se={class:"flex-nowrap flex flex-v-center p-medium vti__selection"},de=["innerHTML"],ce={key:1,class:"vti__country-code"},fe=["onClick","onMousemove"],ve=["innerHTML"],pe={key:1},ye=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex"],me={key:0,class:"mn-t-thin mn-b-thin invalid-feedback"},he={__name:"FieldPhone2",props:{modelValue:{type:String,default:""},badClass:{type:[String,Array,Object],default:""},goodClass:{type:[String,Array,Object],default:""},badStyle:{type:[String,Array,Object],default:""},goodStyle:{type:[String,Array,Object],default:""},badInputClass:{type:[String,Array,Object],default:""},goodInputClass:{type:[String,Array,Object],default:""},badInputStyle:{type:[String,Array,Object],default:""},goodInputStyle:{type:[String,Array,Object],default:""},allCountries:{type:Array,default:()=>re.default},autoFormat:{type:Boolean,default:()=>!0},validation:{type:[Boolean,Object],default:!1},customValidate:{type:[Boolean,RegExp],default:()=>!1},defaultCountry:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},autoDefaultCountry:{type:Boolean,default:()=>!0},ignoredCountries:{type:Array,default:()=>[]},invalidMsg:{type:String,default:()=>""},mode:{type:String,default:()=>"auto"},onlyCountries:{type:Array,default:()=>[]},preferredCountries:{type:Array,default:()=>[]},validCharactersOnly:{type:Boolean,default:()=>!1},rootClass:{type:[String,Array,Object],default:()=>""},inputClass:{type:[String,Array,Object],default:()=>""},divInputClass:{type:[String,Array,Object],default:()=>""},rootStyle:{type:[String,Array,Object],default:()=>""},dropdownStyle:{type:[String,Array,Object],default:()=>""},listStyle:{type:[String,Array,Object],default:()=>""},inputStyle:{type:[String,Array,Object],default:()=>""},inputId:{type:[String,Array,Object],default:()=>""},Placeholder:{type:[String,Object,Function],default:()=>""},dropdownOptions:{type:Object,default:()=>({showDialCodeInList:!0,showDialCodeInSelection:!1,showFlags:!0,tabindex:0})},inputOptions:{type:Object,default:()=>({autocomplete:"on",autofocus:!1,id:"",maxlength:25,name:"telephone",placeholder:"Enter a phone number",readonly:!1,required:!1,tabindex:0,type:"tel",styleClasses:""})}},emits:["update:modelValue","validate","country-changed","open","close","blur","focus","enter","space"],setup(a,{emit:V}){let N=oe.default;const n=a,c=V;e.ref(5),e.ref(5),e.reactive({action:null,amount:null});const r=e.ref(n.modelValue?n.modelValue:""),v=e.ref(""),f=e.ref(!1),P=e.ref(!1),s=e.ref(null),S=e.ref(""),x=e.ref(null),T=e.ref("below"),I=e.ref(n.Placeholder!==""?n.Placeholder:n.inputOptions.placeholder),B=e.ref(null),d=e.ref(null),O=e.ref(null);e.onMounted(async()=>{n.modelValue&&(r.value=n.modelValue),G(),U().then(()=>{var t;!r.value&&((t=n.inputOptions)!=null&&t.showDialCode)&&v.value&&(r.value=`+${v.value}`),c("validate",u.value)}).catch(console.error).then(()=>{P.value=!0})});const p=e.computed(()=>C(v.value)),M=e.computed(()=>p.value?p.value.flag:null),F=e.computed(()=>n.mode==="auto"?!r.value||r.value[0]!=="+"?"national":"international":["international","national"].includes(n.mode)?n.mode:(console.error('Invalid value of prop "mode"'),"international")),k=e.computed(()=>n.onlyCountries&&n.onlyCountries.length?n.allCountries.filter(({iso2:t})=>n.onlyCountries.includes(t.toUpperCase())):n.ignoredCountries&&n.ignoredCountries.length?n.allCountries.filter(({iso2:t})=>!n.ignoredCountries.includes(t.toUpperCase())&&!n.ignoredCountries.includes(t.toLowerCase())):n.allCountries),y=e.computed(()=>[...K(n.preferredCountries).map(l=>({...l,preferred:!0})),...k.value]),u=e.computed(()=>{var b,D,A;let t={};((b=r.value)==null?void 0:b[0])==="+"?t=w.parsePhoneNumber(r.value)||{}:t=w.parsePhoneNumber(r.value,v.value)||{};const{metadata:l,...o}=t;let i=(D=t.isValid)==null?void 0:D.call(t),h=r.value;return i&&(h=(A=t.format)==null?void 0:A.call(t,F.value.toUpperCase(),{nationalPrefix:!1})),t.country&&(n.ignoredCountries.length||n.onlyCountries.length)&&(C(t.country)||(i=!1,t={...t,country:null})),{...o,countryCode:t.country,valid:i,country:p.value,formatted:h}}),H=e.computed(()=>u.value.valid===!0?n.goodClass:u.value.valid===!1?n.badClass:void 0),q=e.computed(()=>u.value.valid===!0?n.goodStyle:u.value.valid===!1?n.badStyle:void 0),z=e.computed(()=>u.value.valid===!0?n.goodInputClass:u.value.valid===!1?n.badInputClass:void 0),L=e.computed(()=>u.value.valid===!0?n.goodInputStyle:u.value.valid===!1?n.badInputStyle:void 0);e.watch(p,(t,l)=>{if(!t&&(l!=null&&l.iso2)){v.value=l.iso2;return}t!=null&&t.iso2&&(c("country-changed",t),E())}),e.watch(()=>u.value.countryCode,t=>{v.value=t}),e.watch(()=>u.value.valid,()=>{c("validate",u.value)}),e.watch(()=>u.value.formatted,t=>{!n.autoFormat||n.customValidate||(g(t),e.nextTick(()=>{t&&!n.modelValue&&(r.value=t)}))}),e.watch(()=>n.inputOptions.placeholder,()=>{E()}),e.watch(()=>n.modelValue,(t,l)=>{J()?r.value=t:e.nextTick(()=>{r.value=l,j()})}),e.watch(f,t=>{t?(ae(),c("open")):c("close")});function R(){return fetch("https://ip2c.org/s").then(t=>t.text()).then(t=>{const l=(t||"").toString();if(!l||l[0]!=="1")throw new Error("unable to fetch the country");return l.substr(2,2)})}function $(t,l){if(t.setSelectionRange)t.focus(),t.setSelectionRange(l,l);else if(t.createTextRange){const o=t.createTextRange();o.collapse(!0),o.moveEnd("character",l),o.moveStart("character",l),o.select()}}function E(){I.value=n.inputOptions.placeholder}function U(){return new Promise(t=>{var o;if(((o=r.value)==null?void 0:o[0])==="+"){t();return}if(n.defaultCountry){m(n.defaultCountry),t();return}const l=n.preferredCountries[0]||k.value[0];n.autoDefaultCountry?R().then(i=>{m(i||v.value)}).catch(i=>{console.warn(i),m(l)}).finally(()=>{t()}):(m(l),t())})}function K(t=[]){return t.map(l=>C(l)).filter(Boolean)}function C(t=""){return k.value.find(l=>l.iso2===t.toUpperCase())}function W(t,l){const o=s.value===t,i=t===n.preferredCountries.length-1,h=n.preferredCountries.some(b=>b.toUpperCase()===l);return{highlighted:o,"last-preferred":i,preferred:h}}function m(t){var o,i;let l=typeof t=="string"?C(t):t;if(l){if(((o=r.value)==null?void 0:o[0])==="+"&&l.iso2&&u.value.nationalNumber){v.value=l.iso2,r.value=w.parsePhoneNumber(u.value.nationalNumber,l.iso2).formatInternational();return}if((i=n.inputOptions)!=null&&i.showDialCode&&l){r.value=`+${l.dialCode}`;return}v.value=l.iso2,g(r.value)}}function G(){const t=r.value;if(n.validCharactersOnly){const l=r.value.match(/[()\-+0-9\s]*/g);r.value=l.join("")}if(n.customValidate&&n.customValidate instanceof RegExp){const l=r.value.match(n.customValidate);r.value=l?l.join(""):""}t!==r.value&&g(r.value)}function J(){return n.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(r.value)?!1:n.customValidate?Q():!0}function Q(){return n.customValidate instanceof RegExp?n.customValidate.test(r.value):!1}function j(){O.value.setCustomValidity(u.valid?"":n.invalidMsg),g(r.value)}function g(t){c("update:modelValue",t),u.value.valid?c("country",u.value.number):c("country",null)}function X(){c("blur")}function Y(){$(O.value,r.value.length),c("focus")}function Z(){c("enter")}function _(){c("space")}function ee(){n.disabled||(f.value=!f.value)}function te(){f.value=!1}function ne(t){t.keyCode===40?(t.preventDefault(),f.value=!0,s.value=s.value===null?0:Math.min(y.value.length-1,s.value+1),e.nextTick(()=>{const l=d.value.children[s.value];l.offsetTop+l.clientHeight>d.value.scrollTop+d.value.clientHeight&&(d.value.scrollTop=l.offsetTop-d.value.clientHeight+l.clientHeight)})):t.keyCode===38?(t.preventDefault(),f.value=!0,s.value=s.value===null?y.value.length-1:Math.max(0,s.value-1),e.nextTick(()=>{const l=d.value.children[s.value];l.offsetTop<d.value.scrollTop&&(d.value.scrollTop=l.offsetTop)})):t.keyCode===13?(t.preventDefault(),s.value!==null&&m(y.value[s.value]),f.value=!f.value):(S.value+=t.key,clearTimeout(x),x=setTimeout(()=>{S.value=""},700),e.nextTick(()=>{const l=y.value.slice(n.preferredCountries.length).findIndex(o=>o.name.toLowerCase().startsWith(S.value));if(l>=0){s.value=n.preferredCountries.length+l;const o=d.value.children[s.value];(o.offsetTop<d.value.scrollTop||o.offsetTop+o.clientHeight>d.value.scrollTop+d.value.clientHeight)&&(d.value.scrollTop=o.offsetTop-d.value.clientHeight/2)}}))}function le(){s.value=y.value.map(t=>t.iso2).indexOf(v.value),f.value=!1}function ae(){const l=window.innerHeight-B.value.getBoundingClientRect().bottom>200;T.value=l?"below":"above"}return(t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass([[a.rootClass,H.value,t.$attrs.class,{"bg-fourth-nano":a.validation},{disabled:a.disabled}],"vue3-reactive-tel-input"]),style:e.normalizeStyle([a.rootStyle,q.value]),ref_key:"rootElement",ref:B},[e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([["vti__dropdown",{open:f.value}],"br-solid br-black-transp br-1px radius-medium"]),style:e.normalizeStyle([a.dropdownStyle]),tabindex:a.dropdownOptions.tabindex,onKeydown:[ne,e.withKeys(le,["esc"])],onClick:ee},[e.createElementVNode("span",se,[a.dropdownOptions.showFlags?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:M.value,class:"mn-r-thin"},null,8,de)):e.createCommentVNode("",!0),a.dropdownOptions.showDialCodeInSelection?(e.openBlock(),e.createElementBlock("span",ce," +"+e.toDisplayString(p.value&&p.value.dialCode),1)):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("ul",{ref_key:"list",ref:d,class:e.normalizeClass(["bs-black radius-small vti__dropdown-list",T.value]),style:e.normalizeStyle([a.listStyle])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,i)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["flex-nowrap flex w-max",["vti__dropdown-item",W(i,o.iso2)]]),key:o.iso2+(o.preferred?"-preferred":""),onClick:h=>m(o),onMousemove:h=>s.value=i},[a.dropdownOptions.showFlags?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:o.flag,class:"mn-r-thin"},null,8,ve)):e.createCommentVNode("",!0),e.createElementVNode("strong",null,e.toDisplayString(o.name),1),a.dropdownOptions.showDialCodeInList?(e.openBlock(),e.createElementBlock("span",pe," +"+e.toDisplayString(o.dialCode),1)):e.createCommentVNode("",!0)],42,fe))),128))],6),[[e.vShow,f.value]])],46,ie)),[[e.unref(N),te]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=o=>r.value=o),inputmode:"numeric",pattern:"\\d*",ref_key:"input",ref:O,type:a.inputOptions.type,autocomplete:a.inputOptions.autocomplete,autofocus:a.inputOptions.autofocus,class:e.normalizeClass(["vti__input",a.inputOptions.styleClasses,a.inputClass,z.value]),style:e.normalizeStyle([a.inputStyle,L.value]),disabled:a.disabled,id:a.inputId!==""?a.inputId:a.inputOptions.id,maxlength:a.inputOptions.maxlength,name:a.inputId!==""?a.inputId:a.inputOptions.name,placeholder:I.value,readonly:a.inputOptions.readonly,required:a.inputOptions.required,tabindex:a.inputOptions.tabindex,onBlur:X,onFocus:Y,onInput:j,onKeyup:[e.withKeys(Z,["enter"]),e.withKeys(_,["space"])]},null,46,ye),[[e.vModelDynamic,r.value]]),e.renderSlot(t.$slots,"default",{},void 0,!0)],6),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.validation?(e.openBlock(),e.createElementBlock("div",me," * "+e.toDisplayString(a.validation.message),1)):e.createCommentVNode("",!0)]),_:1})],64))}},Ce=ue.default(he,[["__scopeId","data-v-0ab16817"]]);exports.default=Ce;
|
1
|
+
"use strict";
|