@blackcube/aurelia2-bleet 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blackcube-aurelia2-bleet-1.0.0.tgz +0 -0
- package/dist/index.es.js +193 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +194 -0
- package/dist/index.js.map +1 -1
- package/dist/types/attributes/index.d.ts +2 -0
- package/dist/types/attributes/index.d.ts.map +1 -1
- package/dist/types/attributes/popover-trigger.d.ts +15 -0
- package/dist/types/attributes/popover-trigger.d.ts.map +1 -0
- package/dist/types/attributes/popover.d.ts +19 -0
- package/dist/types/attributes/popover.d.ts.map +1 -0
- package/dist/types/enums/event-aggregator.d.ts +14 -1
- package/dist/types/enums/event-aggregator.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/event-aggregator.d.ts +10 -1
- package/dist/types/interfaces/event-aggregator.d.ts.map +1 -1
- package/doc/bleet-api-reference.md +1 -1
- package/doc/bleet-model-api-reference.md +1 -1
- package/doc/bleet-typescript-api-reference.md +53 -0
- package/package.json +1 -1
- package/src/attributes/index.ts +3 -1
- package/src/attributes/popover-trigger.ts +48 -0
- package/src/attributes/popover.ts +104 -0
- package/src/enums/event-aggregator.ts +14 -0
- package/src/index.ts +17 -3
- package/src/interfaces/event-aggregator.ts +11 -1
package/dist/index.js
CHANGED
|
@@ -1035,6 +1035,8 @@ exports.Channels = void 0;
|
|
|
1035
1035
|
Channels["Profile"] = "bleet:profile";
|
|
1036
1036
|
Channels["ProfileStatus"] = "bleet:profile:status";
|
|
1037
1037
|
Channels["Ajaxify"] = "bleet:ajaxify";
|
|
1038
|
+
Channels["Popover"] = "bleet:popover";
|
|
1039
|
+
Channels["PopoverStatus"] = "bleet:popover:status";
|
|
1038
1040
|
})(exports.Channels || (exports.Channels = {}));
|
|
1039
1041
|
exports.OverlayAction = void 0;
|
|
1040
1042
|
(function (OverlayAction) {
|
|
@@ -1119,6 +1121,19 @@ exports.MenuStatus = void 0;
|
|
|
1119
1121
|
MenuStatus["Opened"] = "opened";
|
|
1120
1122
|
MenuStatus["Closed"] = "closed";
|
|
1121
1123
|
})(exports.MenuStatus || (exports.MenuStatus = {}));
|
|
1124
|
+
exports.PopoverAction = void 0;
|
|
1125
|
+
(function (PopoverAction) {
|
|
1126
|
+
PopoverAction["Open"] = "open";
|
|
1127
|
+
PopoverAction["Close"] = "close";
|
|
1128
|
+
PopoverAction["Toggle"] = "toggle";
|
|
1129
|
+
})(exports.PopoverAction || (exports.PopoverAction = {}));
|
|
1130
|
+
exports.PopoverStatus = void 0;
|
|
1131
|
+
(function (PopoverStatus) {
|
|
1132
|
+
PopoverStatus["Opening"] = "opening";
|
|
1133
|
+
PopoverStatus["Closing"] = "closing";
|
|
1134
|
+
PopoverStatus["Opened"] = "opened";
|
|
1135
|
+
PopoverStatus["Closed"] = "closed";
|
|
1136
|
+
})(exports.PopoverStatus || (exports.PopoverStatus = {}));
|
|
1122
1137
|
exports.UiColor = void 0;
|
|
1123
1138
|
(function (UiColor) {
|
|
1124
1139
|
UiColor["Primary"] = "primary";
|
|
@@ -3162,6 +3177,181 @@ let BleetAjaxifyTriggerCustomAttribute = (() => {
|
|
|
3162
3177
|
return _classThis;
|
|
3163
3178
|
})();
|
|
3164
3179
|
|
|
3180
|
+
let BleetPopoverCustomAttribute = (() => {
|
|
3181
|
+
let _classDecorators = [aurelia.customAttribute({ name: 'bleet-popover', defaultProperty: 'id' })];
|
|
3182
|
+
let _classDescriptor;
|
|
3183
|
+
let _classExtraInitializers = [];
|
|
3184
|
+
let _classThis;
|
|
3185
|
+
let _id_decorators;
|
|
3186
|
+
let _id_initializers = [];
|
|
3187
|
+
let _id_extraInitializers = [];
|
|
3188
|
+
(class {
|
|
3189
|
+
static { _classThis = this; }
|
|
3190
|
+
static {
|
|
3191
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3192
|
+
_id_decorators = [aurelia.bindable];
|
|
3193
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
3194
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
3195
|
+
_classThis = _classDescriptor.value;
|
|
3196
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
3197
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3198
|
+
}
|
|
3199
|
+
logger;
|
|
3200
|
+
element;
|
|
3201
|
+
ea;
|
|
3202
|
+
id = __runInitializers(this, _id_initializers, '');
|
|
3203
|
+
isOpen = (__runInitializers(this, _id_extraInitializers), false);
|
|
3204
|
+
subscription = null;
|
|
3205
|
+
constructor(logger = aurelia.resolve(aurelia.ILogger).scopeTo('bleet-popover'), element = aurelia.resolve(aurelia.INode), ea = aurelia.resolve(aurelia.IEventAggregator)) {
|
|
3206
|
+
this.logger = logger;
|
|
3207
|
+
this.element = element;
|
|
3208
|
+
this.ea = ea;
|
|
3209
|
+
this.logger.trace('constructor');
|
|
3210
|
+
}
|
|
3211
|
+
attaching() {
|
|
3212
|
+
this.logger.trace('attaching');
|
|
3213
|
+
this.subscription = this.ea.subscribe(exports.Channels.Popover, this.onPopover);
|
|
3214
|
+
}
|
|
3215
|
+
attached() {
|
|
3216
|
+
this.logger.trace('attached');
|
|
3217
|
+
}
|
|
3218
|
+
detaching() {
|
|
3219
|
+
this.logger.trace('detaching');
|
|
3220
|
+
this.subscription?.dispose();
|
|
3221
|
+
}
|
|
3222
|
+
dispose() {
|
|
3223
|
+
this.logger.trace('dispose');
|
|
3224
|
+
this.subscription?.dispose();
|
|
3225
|
+
}
|
|
3226
|
+
onPopover = (payload) => {
|
|
3227
|
+
if (payload.id !== this.id)
|
|
3228
|
+
return;
|
|
3229
|
+
switch (payload.action) {
|
|
3230
|
+
case exports.PopoverAction.Open:
|
|
3231
|
+
this.open(payload.rect);
|
|
3232
|
+
break;
|
|
3233
|
+
case exports.PopoverAction.Close:
|
|
3234
|
+
this.close();
|
|
3235
|
+
break;
|
|
3236
|
+
case exports.PopoverAction.Toggle:
|
|
3237
|
+
if (this.isOpen) {
|
|
3238
|
+
this.close();
|
|
3239
|
+
}
|
|
3240
|
+
else {
|
|
3241
|
+
this.open(payload.rect);
|
|
3242
|
+
}
|
|
3243
|
+
break;
|
|
3244
|
+
}
|
|
3245
|
+
};
|
|
3246
|
+
open(rect) {
|
|
3247
|
+
this.isOpen = true;
|
|
3248
|
+
this.element.classList.add('is-open');
|
|
3249
|
+
if (rect) {
|
|
3250
|
+
this.positionAt(rect);
|
|
3251
|
+
}
|
|
3252
|
+
this.ea.publish(exports.Channels.PopoverStatus, {
|
|
3253
|
+
status: exports.PopoverStatus.Opened,
|
|
3254
|
+
id: this.id,
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
close() {
|
|
3258
|
+
this.isOpen = false;
|
|
3259
|
+
this.element.classList.remove('is-open');
|
|
3260
|
+
this.ea.publish(exports.Channels.PopoverStatus, {
|
|
3261
|
+
status: exports.PopoverStatus.Closed,
|
|
3262
|
+
id: this.id,
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
positionAt(rect) {
|
|
3266
|
+
this.element.style.visibility = 'hidden';
|
|
3267
|
+
this.element.style.display = 'block';
|
|
3268
|
+
const popoverRect = this.element.getBoundingClientRect();
|
|
3269
|
+
// Center above trigger
|
|
3270
|
+
let top = rect.top - popoverRect.height - 10;
|
|
3271
|
+
let left = rect.left + (rect.width / 2) - (popoverRect.width / 2);
|
|
3272
|
+
// Fallback below if not enough space above
|
|
3273
|
+
if (top < 4)
|
|
3274
|
+
top = rect.bottom + 10;
|
|
3275
|
+
// Clamp to viewport
|
|
3276
|
+
if (left < 4)
|
|
3277
|
+
left = 4;
|
|
3278
|
+
if (left + popoverRect.width > window.innerWidth - 4) {
|
|
3279
|
+
left = window.innerWidth - popoverRect.width - 4;
|
|
3280
|
+
}
|
|
3281
|
+
this.element.style.top = `${top}px`;
|
|
3282
|
+
this.element.style.left = `${left}px`;
|
|
3283
|
+
this.element.style.visibility = '';
|
|
3284
|
+
this.element.style.display = '';
|
|
3285
|
+
}
|
|
3286
|
+
});
|
|
3287
|
+
return _classThis;
|
|
3288
|
+
})();
|
|
3289
|
+
|
|
3290
|
+
let BleetPopoverTriggerCustomAttribute = (() => {
|
|
3291
|
+
let _classDecorators = [aurelia.customAttribute({ name: 'bleet-popover-trigger', defaultProperty: 'id' })];
|
|
3292
|
+
let _classDescriptor;
|
|
3293
|
+
let _classExtraInitializers = [];
|
|
3294
|
+
let _classThis;
|
|
3295
|
+
let _id_decorators;
|
|
3296
|
+
let _id_initializers = [];
|
|
3297
|
+
let _id_extraInitializers = [];
|
|
3298
|
+
let _absolute_decorators;
|
|
3299
|
+
let _absolute_initializers = [];
|
|
3300
|
+
let _absolute_extraInitializers = [];
|
|
3301
|
+
(class {
|
|
3302
|
+
static { _classThis = this; }
|
|
3303
|
+
static {
|
|
3304
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3305
|
+
_id_decorators = [aurelia.bindable];
|
|
3306
|
+
_absolute_decorators = [aurelia.bindable()];
|
|
3307
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
3308
|
+
__esDecorate(null, null, _absolute_decorators, { kind: "field", name: "absolute", static: false, private: false, access: { has: obj => "absolute" in obj, get: obj => obj.absolute, set: (obj, value) => { obj.absolute = value; } }, metadata: _metadata }, _absolute_initializers, _absolute_extraInitializers);
|
|
3309
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
3310
|
+
_classThis = _classDescriptor.value;
|
|
3311
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
3312
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3313
|
+
}
|
|
3314
|
+
logger;
|
|
3315
|
+
element;
|
|
3316
|
+
ea;
|
|
3317
|
+
id = __runInitializers(this, _id_initializers, '');
|
|
3318
|
+
absolute = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _absolute_initializers, true));
|
|
3319
|
+
constructor(logger = aurelia.resolve(aurelia.ILogger).scopeTo('bleet-popover-trigger'), element = aurelia.resolve(aurelia.INode), ea = aurelia.resolve(aurelia.IEventAggregator)) {
|
|
3320
|
+
this.logger = logger;
|
|
3321
|
+
this.element = element;
|
|
3322
|
+
this.ea = ea;
|
|
3323
|
+
this.logger.trace('constructor');
|
|
3324
|
+
}
|
|
3325
|
+
attached() {
|
|
3326
|
+
this.logger.trace('attached');
|
|
3327
|
+
this.element.addEventListener('mouseenter', this.onMouseEnter);
|
|
3328
|
+
this.element.addEventListener('mouseleave', this.onMouseLeave);
|
|
3329
|
+
}
|
|
3330
|
+
detaching() {
|
|
3331
|
+
this.logger.trace('detaching');
|
|
3332
|
+
this.element.removeEventListener('mouseenter', this.onMouseEnter);
|
|
3333
|
+
this.element.removeEventListener('mouseleave', this.onMouseLeave);
|
|
3334
|
+
}
|
|
3335
|
+
dispose() {
|
|
3336
|
+
this.logger.trace('dispose');
|
|
3337
|
+
}
|
|
3338
|
+
onMouseEnter = (__runInitializers(this, _absolute_extraInitializers), () => {
|
|
3339
|
+
this.ea.publish(exports.Channels.Popover, {
|
|
3340
|
+
id: this.id,
|
|
3341
|
+
action: exports.PopoverAction.Open,
|
|
3342
|
+
rect: this.absolute ? this.element.getBoundingClientRect() : undefined,
|
|
3343
|
+
});
|
|
3344
|
+
});
|
|
3345
|
+
onMouseLeave = () => {
|
|
3346
|
+
this.ea.publish(exports.Channels.Popover, {
|
|
3347
|
+
id: this.id,
|
|
3348
|
+
action: exports.PopoverAction.Close,
|
|
3349
|
+
});
|
|
3350
|
+
};
|
|
3351
|
+
});
|
|
3352
|
+
return _classThis;
|
|
3353
|
+
})();
|
|
3354
|
+
|
|
3165
3355
|
let BleetOverlay = (() => {
|
|
3166
3356
|
let _classDecorators = [aurelia.customElement({
|
|
3167
3357
|
name: 'bleet-overlay',
|
|
@@ -4481,6 +4671,8 @@ const DefaultComponents = [
|
|
|
4481
4671
|
BleetToasterTriggerCustomAttribute,
|
|
4482
4672
|
BleetUploadCustomAttribute,
|
|
4483
4673
|
BleetAjaxifyTriggerCustomAttribute,
|
|
4674
|
+
BleetPopoverCustomAttribute,
|
|
4675
|
+
BleetPopoverTriggerCustomAttribute,
|
|
4484
4676
|
// components
|
|
4485
4677
|
BleetOverlay,
|
|
4486
4678
|
BleetToast,
|
|
@@ -4528,6 +4720,8 @@ exports.BleetModalTriggerCustomAttribute = BleetModalTriggerCustomAttribute;
|
|
|
4528
4720
|
exports.BleetOverlay = BleetOverlay;
|
|
4529
4721
|
exports.BleetPagerCustomAttribute = BleetPagerCustomAttribute;
|
|
4530
4722
|
exports.BleetPasswordCustomAttribute = BleetPasswordCustomAttribute;
|
|
4723
|
+
exports.BleetPopoverCustomAttribute = BleetPopoverCustomAttribute;
|
|
4724
|
+
exports.BleetPopoverTriggerCustomAttribute = BleetPopoverTriggerCustomAttribute;
|
|
4531
4725
|
exports.BleetProfileCustomAttribute = BleetProfileCustomAttribute;
|
|
4532
4726
|
exports.BleetQuilljs = Quilljs;
|
|
4533
4727
|
exports.BleetSelectCustomAttribute = BleetSelectCustomAttribute;
|