Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@event-calendar/core

Package Overview
Dependencies
Maintainers
0
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/core - npm Package Compare versions

Comparing version 3.6.2 to 3.7.0

src/lib/payload.js

2

package.json
{
"name": "@event-calendar/core",
"version": "3.6.2",
"version": "3.7.0",
"title": "Event Calendar Core package",

@@ -5,0 +5,0 @@ "description": "Full-sized drag & drop event calendar with resource & timeline views",

@@ -8,2 +8,3 @@ export * from './lib/a11y.js';

export * from './lib/options.js';
export * from './lib/payload.js';
export * from './lib/resources.js';

@@ -10,0 +11,0 @@ export * from './lib/stores.js';

@@ -1,2 +0,2 @@

import {symbol} from './utils.js';
import {hasPayload} from './payload.js';

@@ -38,15 +38,2 @@ export function createElement(tag, className, content, attrs = []) {

let payloadProp = symbol();
export function setPayload(el, payload) {
el[payloadProp] = payload;
}
export function hasPayload(el) {
return !!el?.[payloadProp];
}
export function getPayload(el) {
return el[payloadProp];
}
export function getElementWithPayload(x, y, root = document) {

@@ -53,0 +40,0 @@ for (let el of root.elementsFromPoint(x, y)) {

@@ -0,11 +1,39 @@

import {setPayload} from './payload.js';
export function createResources(input) {
return input.map(resource => ({
id: String(resource.id),
title: resource.title || '',
eventBackgroundColor: resource.eventBackgroundColor,
eventTextColor: resource.eventTextColor,
extendedProps: resource.extendedProps ?? {}
}));
let result = [];
_createResources(input, 0, result);
return result;
}
function _createResources(input, level, flat) {
let result = [];
for (let item of input) {
let resource = createResource(item);
result.push(resource);
flat.push(resource);
let payload = {
level,
children: [],
expanded: true,
hidden: false
};
setPayload(resource, payload);
if (item.children) {
payload.children = _createResources(item.children, level + 1, flat);
}
}
return result;
}
export function createResource(input) {
return {
id: String(input.id),
title: input.title || '',
eventBackgroundColor: input.eventBackgroundColor,
eventTextColor: input.eventTextColor,
extendedProps: input.extendedProps ?? {}
};
}
export function resourceBackgroundColor(event, resources) {

@@ -12,0 +40,0 @@ return findResource(event, resources)?.eventBackgroundColor;

@@ -5,2 +5,3 @@ import {derived} from 'svelte/store';

import {createResources} from './resources.js';
import {getPayload} from './payload.js';

@@ -71,3 +72,3 @@ export function intl(locale, format) {

([$resources, $filterResourcesWithEvents, $_events, $_activeRange]) => {
let result = $resources;
let result = $resources.filter(resource => !getPayload(resource).hidden);

@@ -74,0 +75,0 @@ if ($filterResourcesWithEvents) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc