ganttmingo
Version:
```bash npm install --save ganttmingo ``` ## Usage ### Config angular.json file > angular.json > projects > {angular-project} > architect > build > options > scripts ```json "scripts": [ "node_modules/ganttmingo/dist/index.js" ] ``` ### De
1,527 lines (1,509 loc) • 43.8 kB
JavaScript
(() => {
// node_modules/svelte/src/runtime/internal/utils.js
function noop() {
}
function assign(tar, src) {
for (const k in src) tar[k] = src[k];
return (
/** @type {T & S} */
tar
);
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function create_slot(definition, ctx, $$scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, $$scope, fn) {
return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;
}
function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($$scope.dirty === void 0) {
return lets;
}
if (typeof lets === "object") {
const merged = [];
const len = Math.max($$scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $$scope.dirty[i] | lets[i];
}
return merged;
}
return $$scope.dirty | lets;
}
return $$scope.dirty;
}
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
function get_all_dirty_from_scope($$scope) {
if ($$scope.ctx.length > 32) {
const dirty = [];
const length = $$scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
// node_modules/svelte/src/runtime/internal/globals.js
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : (
// @ts-ignore Node typings have this
global
);
// node_modules/svelte/src/runtime/internal/ResizeObserverSingleton.js
var ResizeObserverSingleton = class _ResizeObserverSingleton {
/**
* @private
* @readonly
* @type {WeakMap<Element, import('./private.js').Listener>}
*/
_listeners = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
/**
* @private
* @type {ResizeObserver}
*/
_observer = void 0;
/** @type {ResizeObserverOptions} */
options;
/** @param {ResizeObserverOptions} options */
constructor(options) {
this.options = options;
}
/**
* @param {Element} element
* @param {import('./private.js').Listener} listener
* @returns {() => void}
*/
observe(element2, listener) {
this._listeners.set(element2, listener);
this._getObserver().observe(element2, this.options);
return () => {
this._listeners.delete(element2);
this._observer.unobserve(element2);
};
}
/**
* @private
*/
_getObserver() {
return this._observer ?? (this._observer = new ResizeObserver((entries) => {
for (const entry of entries) {
_ResizeObserverSingleton.entries.set(entry.target, entry);
this._listeners.get(entry.target)?.(entry);
}
}));
}
};
ResizeObserverSingleton.entries = "WeakMap" in globals ? /* @__PURE__ */ new WeakMap() : void 0;
// node_modules/svelte/src/runtime/internal/dom.js
var is_hydrating = false;
function start_hydrating() {
is_hydrating = true;
}
function end_hydrating() {
is_hydrating = false;
}
function append(target, node) {
target.appendChild(node);
}
function append_styles(target, style_sheet_id, styles) {
const append_styles_to = get_root_for_style(target);
if (!append_styles_to.getElementById(style_sheet_id)) {
const style = element("style");
style.id = style_sheet_id;
style.textContent = styles;
append_stylesheet(append_styles_to, style);
}
}
function get_root_for_style(node) {
if (!node) return document;
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
if (root && /** @type {ShadowRoot} */
root.host) {
return (
/** @type {ShadowRoot} */
root
);
}
return node.ownerDocument;
}
function append_stylesheet(node, style) {
append(
/** @type {Document} */
node.head || node,
style
);
return style.sheet;
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i]) iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(" ");
}
function empty() {
return text("");
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
if (value == null) node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
}
function children(element2) {
return Array.from(element2.childNodes);
}
function set_data(text2, data) {
data = "" + data;
if (text2.data === data) return;
text2.data = /** @type {string} */
data;
}
function get_custom_elements_slots(element2) {
const result = {};
element2.childNodes.forEach(
/** @param {Element} node */
(node) => {
result[node.slot || "default"] = true;
}
);
return result;
}
// node_modules/svelte/src/runtime/internal/lifecycle.js
var current_component;
function set_current_component(component) {
current_component = component;
}
// node_modules/svelte/src/runtime/internal/scheduler.js
var dirty_components = [];
var binding_callbacks = [];
var render_callbacks = [];
var flush_callbacks = [];
var resolved_promise = /* @__PURE__ */ Promise.resolve();
var update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
var seen_callbacks = /* @__PURE__ */ new Set();
var flushidx = 0;
function flush() {
if (flushidx !== 0) {
return;
}
const saved_component = current_component;
do {
try {
while (flushidx < dirty_components.length) {
const component = dirty_components[flushidx];
flushidx++;
set_current_component(component);
update(component.$$);
}
} catch (e) {
dirty_components.length = 0;
flushidx = 0;
throw e;
}
set_current_component(null);
dirty_components.length = 0;
flushidx = 0;
while (binding_callbacks.length) binding_callbacks.pop()();
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
seen_callbacks.clear();
set_current_component(saved_component);
}
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
function flush_render_callbacks(fns) {
const filtered = [];
const targets = [];
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
targets.forEach((c) => c());
render_callbacks = filtered;
}
// node_modules/svelte/src/runtime/internal/transitions.js
var outroing = /* @__PURE__ */ new Set();
var outros;
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
function transition_out(block, local, detach2, callback) {
if (block && block.o) {
if (outroing.has(block)) return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach2) block.d(1);
callback();
}
});
block.o(local);
} else if (callback) {
callback();
}
}
// node_modules/svelte/src/runtime/internal/each.js
function ensure_array_like(array_like_or_iterator) {
return array_like_or_iterator?.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
}
// node_modules/svelte/src/shared/boolean_attributes.js
var _boolean_attributes = (
/** @type {const} */
[
"allowfullscreen",
"allowpaymentrequest",
"async",
"autofocus",
"autoplay",
"checked",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"inert",
"ismap",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected"
]
);
var boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);
// node_modules/svelte/src/runtime/internal/Component.js
function create_component(block) {
block && block.c();
}
function mount_component(component, target, anchor) {
const { fragment, after_update } = component.$$;
fragment && fragment.m(target, anchor);
add_render_callback(() => {
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
if (component.$$.on_destroy) {
component.$$.on_destroy.push(...new_on_destroy);
} else {
run_all(new_on_destroy);
}
component.$$.on_mount = [];
});
after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
flush_render_callbacks($$.after_update);
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
$$.on_destroy = $$.fragment = null;
$$.ctx = [];
}
}
function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
}
function init(component, options, instance6, create_fragment6, not_equal, props, append_styles2 = null, dirty = [-1]) {
const parent_component = current_component;
set_current_component(component);
const $$ = component.$$ = {
fragment: null,
ctx: [],
// state
props,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
// everything else
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
};
append_styles2 && append_styles2($$.root);
let ready = false;
$$.ctx = instance6 ? instance6(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
if (ready) make_dirty(component, i);
}
return ret;
}) : [];
$$.update();
ready = true;
run_all($$.before_update);
$$.fragment = create_fragment6 ? create_fragment6($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
start_hydrating();
const nodes = children(options.target);
$$.fragment && $$.fragment.l(nodes);
nodes.forEach(detach);
} else {
$$.fragment && $$.fragment.c();
}
if (options.intro) transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor);
end_hydrating();
flush();
}
set_current_component(parent_component);
}
var SvelteElement;
if (typeof HTMLElement === "function") {
SvelteElement = class extends HTMLElement {
/** The Svelte component constructor */
$$ctor;
/** Slots */
$$s;
/** The Svelte component instance */
$$c;
/** Whether or not the custom element is connected */
$$cn = false;
/** Component props data */
$$d = {};
/** `true` if currently in the process of reflecting component props back to attributes */
$$r = false;
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
$$p_d = {};
/** @type {Record<string, Function[]>} Event listeners */
$$l = {};
/** @type {Map<Function, Function>} Event listener unsubscribe functions */
$$l_u = /* @__PURE__ */ new Map();
constructor($$componentCtor, $$slots, use_shadow_dom) {
super();
this.$$ctor = $$componentCtor;
this.$$s = $$slots;
if (use_shadow_dom) {
this.attachShadow({ mode: "open" });
}
}
addEventListener(type, listener, options) {
this.$$l[type] = this.$$l[type] || [];
this.$$l[type].push(listener);
if (this.$$c) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
super.addEventListener(type, listener, options);
}
removeEventListener(type, listener, options) {
super.removeEventListener(type, listener, options);
if (this.$$c) {
const unsub = this.$$l_u.get(listener);
if (unsub) {
unsub();
this.$$l_u.delete(listener);
}
}
}
async connectedCallback() {
this.$$cn = true;
if (!this.$$c) {
let create_slot2 = function(name) {
return () => {
let node;
const obj = {
c: function create() {
node = element("slot");
if (name !== "default") {
attr(node, "name", name);
}
},
/**
* @param {HTMLElement} target
* @param {HTMLElement} [anchor]
*/
m: function mount(target, anchor) {
insert(target, node, anchor);
},
d: function destroy(detaching) {
if (detaching) {
detach(node);
}
}
};
return obj;
};
};
await Promise.resolve();
if (!this.$$cn || this.$$c) {
return;
}
const $$slots = {};
const existing_slots = get_custom_elements_slots(this);
for (const name of this.$$s) {
if (name in existing_slots) {
$$slots[name] = [create_slot2(name)];
}
}
for (const attribute of this.attributes) {
const name = this.$$g_p(attribute.name);
if (!(name in this.$$d)) {
this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
}
}
for (const key in this.$$p_d) {
if (!(key in this.$$d) && this[key] !== void 0) {
this.$$d[key] = this[key];
delete this[key];
}
}
this.$$c = new this.$$ctor({
target: this.shadowRoot || this,
props: {
...this.$$d,
$$slots,
$$scope: {
ctx: []
}
}
});
const reflect_attributes = () => {
this.$$r = true;
for (const key in this.$$p_d) {
this.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];
if (this.$$p_d[key].reflect) {
const attribute_value = get_custom_element_value(
key,
this.$$d[key],
this.$$p_d,
"toAttribute"
);
if (attribute_value == null) {
this.removeAttribute(this.$$p_d[key].attribute || key);
} else {
this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
}
}
}
this.$$r = false;
};
this.$$c.$$.after_update.push(reflect_attributes);
reflect_attributes();
for (const type in this.$$l) {
for (const listener of this.$$l[type]) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
}
this.$$l = {};
}
}
// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
// and setting attributes through setAttribute etc, this is helpful
attributeChangedCallback(attr2, _oldValue, newValue) {
if (this.$$r) return;
attr2 = this.$$g_p(attr2);
this.$$d[attr2] = get_custom_element_value(attr2, newValue, this.$$p_d, "toProp");
this.$$c?.$set({ [attr2]: this.$$d[attr2] });
}
disconnectedCallback() {
this.$$cn = false;
Promise.resolve().then(() => {
if (!this.$$cn && this.$$c) {
this.$$c.$destroy();
this.$$c = void 0;
}
});
}
$$g_p(attribute_name) {
return Object.keys(this.$$p_d).find(
(key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name
) || attribute_name;
}
};
}
function get_custom_element_value(prop, value, props_definition, transform) {
const type = props_definition[prop]?.type;
value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
if (!transform || !props_definition[prop]) {
return value;
} else if (transform === "toAttribute") {
switch (type) {
case "Object":
case "Array":
return value == null ? null : JSON.stringify(value);
case "Boolean":
return value ? "" : null;
case "Number":
return value == null ? null : value;
default:
return value;
}
} else {
switch (type) {
case "Object":
case "Array":
return value && JSON.parse(value);
case "Boolean":
return value;
// conversion already handled above
case "Number":
return value != null ? +value : value;
default:
return value;
}
}
}
function create_custom_element(Component, props_definition, slots, accessors, use_shadow_dom, extend) {
let Class = class extends SvelteElement {
constructor() {
super(Component, slots, use_shadow_dom);
this.$$p_d = props_definition;
}
static get observedAttributes() {
return Object.keys(props_definition).map(
(key) => (props_definition[key].attribute || key).toLowerCase()
);
}
};
Object.keys(props_definition).forEach((prop) => {
Object.defineProperty(Class.prototype, prop, {
get() {
return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
},
set(value) {
value = get_custom_element_value(prop, value, props_definition);
this.$$d[prop] = value;
this.$$c?.$set({ [prop]: value });
}
});
});
accessors.forEach((accessor) => {
Object.defineProperty(Class.prototype, accessor, {
get() {
return this.$$c?.[accessor];
}
});
});
if (extend) {
Class = extend(Class);
}
Component.element = /** @type {any} */
Class;
return Class;
}
var SvelteComponent = class {
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
$$ = void 0;
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
$$set = void 0;
/** @returns {void} */
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
/**
* @template {Extract<keyof Events, string>} K
* @param {K} type
* @param {((e: Events[K]) => void) | null | undefined} callback
* @returns {() => void}
*/
$on(type, callback) {
if (!is_function(callback)) {
return noop;
}
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1) callbacks.splice(index, 1);
};
}
/**
* @param {Partial<Props>} props
* @returns {void}
*/
$set(props) {
if (this.$$set && !is_empty(props)) {
this.$$.skip_bound = true;
this.$$set(props);
this.$$.skip_bound = false;
}
}
};
// node_modules/svelte/src/shared/version.js
var PUBLIC_VERSION = "4";
// node_modules/svelte/src/runtime/internal/disclose-version/index.js
if (typeof window !== "undefined")
(window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
// src/lib/components/layout.svelte
function add_css(target) {
append_styles(target, "svelte-4fkhbp", ".gantt-container.svelte-4fkhbp{width:calc(100%);background-color:aqua;display:flex}.gantt-info.svelte-4fkhbp{height:inherit;width:180px;background-color:blueviolet}");
}
var get_gantt_chart_slot_changes = (dirty) => ({});
var get_gantt_chart_slot_context = (ctx) => ({});
var get_gantt_info_slot_changes = (dirty) => ({});
var get_gantt_info_slot_context = (ctx) => ({});
function create_fragment(ctx) {
let div2;
let div0;
let t;
let div1;
let current;
const gantt_info_slot_template = (
/*#slots*/
ctx[2]["gantt-info"]
);
const gantt_info_slot = create_slot(
gantt_info_slot_template,
ctx,
/*$$scope*/
ctx[1],
get_gantt_info_slot_context
);
const gantt_chart_slot_template = (
/*#slots*/
ctx[2]["gantt-chart"]
);
const gantt_chart_slot = create_slot(
gantt_chart_slot_template,
ctx,
/*$$scope*/
ctx[1],
get_gantt_chart_slot_context
);
return {
c() {
div2 = element("div");
div0 = element("div");
if (gantt_info_slot) gantt_info_slot.c();
t = space();
div1 = element("div");
if (gantt_chart_slot) gantt_chart_slot.c();
attr(div0, "class", "gantt-info svelte-4fkhbp");
attr(div1, "class", "gantt-chart");
attr(div2, "class", "gantt-container svelte-4fkhbp");
},
m(target, anchor) {
insert(target, div2, anchor);
append(div2, div0);
if (gantt_info_slot) {
gantt_info_slot.m(div0, null);
}
append(div2, t);
append(div2, div1);
if (gantt_chart_slot) {
gantt_chart_slot.m(div1, null);
}
current = true;
},
p(ctx2, [dirty]) {
if (gantt_info_slot) {
if (gantt_info_slot.p && (!current || dirty & /*$$scope*/
2)) {
update_slot_base(
gantt_info_slot,
gantt_info_slot_template,
ctx2,
/*$$scope*/
ctx2[1],
!current ? get_all_dirty_from_scope(
/*$$scope*/
ctx2[1]
) : get_slot_changes(
gantt_info_slot_template,
/*$$scope*/
ctx2[1],
dirty,
get_gantt_info_slot_changes
),
get_gantt_info_slot_context
);
}
}
if (gantt_chart_slot) {
if (gantt_chart_slot.p && (!current || dirty & /*$$scope*/
2)) {
update_slot_base(
gantt_chart_slot,
gantt_chart_slot_template,
ctx2,
/*$$scope*/
ctx2[1],
!current ? get_all_dirty_from_scope(
/*$$scope*/
ctx2[1]
) : get_slot_changes(
gantt_chart_slot_template,
/*$$scope*/
ctx2[1],
dirty,
get_gantt_chart_slot_changes
),
get_gantt_chart_slot_context
);
}
}
},
i(local) {
if (current) return;
transition_in(gantt_info_slot, local);
transition_in(gantt_chart_slot, local);
current = true;
},
o(local) {
transition_out(gantt_info_slot, local);
transition_out(gantt_chart_slot, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div2);
}
if (gantt_info_slot) gantt_info_slot.d(detaching);
if (gantt_chart_slot) gantt_chart_slot.d(detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { rows = 15 } = $$props;
const maxlength = rows;
$$self.$$set = ($$props2) => {
if ("rows" in $$props2) $$invalidate(0, rows = $$props2.rows);
if ("$$scope" in $$props2) $$invalidate(1, $$scope = $$props2.$$scope);
};
return [rows, $$scope, slots];
}
var Layout = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { rows: 0 }, add_css);
}
get rows() {
return this.$$.ctx[0];
}
set rows(rows) {
this.$$set({ rows });
flush();
}
};
create_custom_element(Layout, { "rows": {} }, ["gantt-info", "gantt-chart"], [], true);
var layout_default = Layout;
// src/lib/components/gantt-info.svelte
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[6] = list[i];
return child_ctx;
}
function create_each_block(ctx) {
let div;
let t_value = (
/*item*/
ctx[6].displayName + ""
);
let t;
let mounted;
let dispose;
return {
c() {
div = element("div");
t = text(t_value);
attr(div, "role", "button");
attr(div, "tabindex", "0");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, t);
if (!mounted) {
dispose = [
listen(
div,
"click",
/*click_handler*/
ctx[4]
),
listen(
div,
"keypress",
/*handleKeyPress*/
ctx[2]
)
];
mounted = true;
}
},
p(ctx2, dirty) {
if (dirty & /*information*/
1 && t_value !== (t_value = /*item*/
ctx2[6].displayName + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) {
detach(div);
}
mounted = false;
run_all(dispose);
}
};
}
function create_fragment2(ctx) {
let div;
let each_value = ensure_array_like(
/*information*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
return {
c() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
},
p(ctx2, [dirty]) {
if (dirty & /*actionTest, handleKeyPress, information*/
7) {
each_value = ensure_array_like(
/*information*/
ctx2[0]
);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(div);
}
destroy_each(each_blocks, detaching);
}
};
}
function instance2($$self, $$props, $$invalidate) {
let { information = [] } = $$props;
let { rows = 15 } = $$props;
let { actionTest = (event) => {
} } = $$props;
const maxlength = rows;
function handleKeyPress(event) {
if (event.key === "Enter" || event.key === " ") {
actionTest();
}
}
const click_handler = (e) => actionTest(123);
$$self.$$set = ($$props2) => {
if ("information" in $$props2) $$invalidate(0, information = $$props2.information);
if ("rows" in $$props2) $$invalidate(3, rows = $$props2.rows);
if ("actionTest" in $$props2) $$invalidate(1, actionTest = $$props2.actionTest);
};
return [information, actionTest, handleKeyPress, rows, click_handler];
}
var Gantt_info = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance2, create_fragment2, safe_not_equal, { information: 0, rows: 3, actionTest: 1 });
}
get information() {
return this.$$.ctx[0];
}
set information(information) {
this.$$set({ information });
flush();
}
get rows() {
return this.$$.ctx[3];
}
set rows(rows) {
this.$$set({ rows });
flush();
}
get actionTest() {
return this.$$.ctx[1];
}
set actionTest(actionTest) {
this.$$set({ actionTest });
flush();
}
};
create_custom_element(Gantt_info, { "information": {}, "rows": {}, "actionTest": {} }, [], [], true);
var gantt_info_default = Gantt_info;
// src/lib/components/gantt-chart.svelte
function get_each_context2(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[1] = list[i];
return child_ctx;
}
function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[4] = list[i];
child_ctx[6] = i;
return child_ctx;
}
function create_if_block(ctx) {
let t;
return {
c() {
t = text("-");
},
m(target, anchor) {
insert(target, t, anchor);
},
d(detaching) {
if (detaching) {
detach(t);
}
}
};
}
function create_each_block_1(ctx) {
let span;
let t0_value = (
/*stage*/
ctx[4].label + ""
);
let t0;
let t1;
let if_block_anchor;
let if_block = (
/*index*/
ctx[6] !== /*item*/
ctx[1].stages.length - 1 && create_if_block(ctx)
);
return {
c() {
span = element("span");
t0 = text(t0_value);
t1 = space();
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
insert(target, span, anchor);
append(span, t0);
insert(target, t1, anchor);
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx2, dirty) {
if (dirty & /*information*/
1 && t0_value !== (t0_value = /*stage*/
ctx2[4].label + "")) set_data(t0, t0_value);
if (
/*index*/
ctx2[6] !== /*item*/
ctx2[1].stages.length - 1
) {
if (if_block) {
} else {
if_block = create_if_block(ctx2);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d(detaching) {
if (detaching) {
detach(span);
detach(t1);
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function create_each_block2(ctx) {
let div;
let t;
let each_value_1 = ensure_array_like(
/*item*/
ctx[1].stages
);
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
return {
c() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
},
m(target, anchor) {
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
append(div, t);
},
p(ctx2, dirty) {
if (dirty & /*information*/
1) {
each_value_1 = ensure_array_like(
/*item*/
ctx2[1].stages
);
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1(ctx2, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_1(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, t);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
},
d(detaching) {
if (detaching) {
detach(div);
}
destroy_each(each_blocks, detaching);
}
};
}
function create_fragment3(ctx) {
let div;
let each_value = ensure_array_like(
/*information*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block2(get_each_context2(ctx, each_value, i));
}
return {
c() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
},
p(ctx2, [dirty]) {
if (dirty & /*information*/
1) {
each_value = ensure_array_like(
/*information*/
ctx2[0]
);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context2(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(div);
}
destroy_each(each_blocks, detaching);
}
};
}
function instance3($$self, $$props, $$invalidate) {
let { information = [] } = $$props;
$$self.$$set = ($$props2) => {
if ("information" in $$props2) $$invalidate(0, information = $$props2.information);
};
return [information];
}
var Gantt_chart = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance3, create_fragment3, safe_not_equal, { information: 0 });
}
get information() {
return this.$$.ctx[0];
}
set information(information) {
this.$$set({ information });
flush();
}
};
create_custom_element(Gantt_chart, { "information": {} }, [], [], true);
var gantt_chart_default = Gantt_chart;
// src/lib/components/dummy.ts
var dummy_default = [
{
displayName: "Project A",
stages: [
{ startDate: "2024-01-01", endDate: "2024-01-31", label: "Design" },
{ startDate: "2024-02-01", endDate: "2024-03-31", label: "Development" },
{ startDate: "2024-04-01", endDate: "2024-05-15", label: "Testing" }
]
},
{
displayName: "Project B",
stages: [
{ startDate: "2024-06-01", endDate: "2024-06-30", label: "Planning" },
{ startDate: "2024-07-01", endDate: "2024-08-31", label: "Execution" },
{ startDate: "2024-09-01", endDate: "2024-10-15", label: "Closure" }
]
}
];
// src/lib/components/root.svelte
function create_gantt_info_slot(ctx) {
let ganttinfo;
let current;
ganttinfo = new gantt_info_default({
props: {
slot: "gantt-info",
information: dummy_default,
actionTest: (
/*apis*/
ctx[0].actionTest
)
}
});
return {
c() {
create_component(ganttinfo.$$.fragment);
},
m(target, anchor) {
mount_component(ganttinfo, target, anchor);
current = true;
},
p(ctx2, dirty) {
const ganttinfo_changes = {};
if (dirty & /*apis*/
1) ganttinfo_changes.actionTest = /*apis*/
ctx2[0].actionTest;
ganttinfo.$set(ganttinfo_changes);
},
i(local) {
if (current) return;
transition_in(ganttinfo.$$.fragment, local);
current = true;
},
o(local) {
transition_out(ganttinfo.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(ganttinfo, detaching);
}
};
}
function create_gantt_chart_slot(ctx) {
let ganttchart;
let current;
ganttchart = new gantt_chart_default({
props: { slot: "gantt-chart", information: dummy_default }
});
return {
c() {
create_component(ganttchart.$$.fragment);
},
m(target, anchor) {
mount_component(ganttchart, target, anchor);
current = true;
},
p: noop,
i(local) {
if (current) return;
transition_in(ganttchart.$$.fragment, local);
current = true;
},
o(local) {
transition_out(ganttchart.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(ganttchart, detaching);
}
};
}
function create_fragment4(ctx) {
let layout;
let current;
layout = new layout_default({
props: {
$$slots: {
"gantt-chart": [create_gantt_chart_slot],
"gantt-info": [create_gantt_info_slot]
},
$$scope: { ctx }
}
});
return {
c() {
create_component(layout.$$.fragment);
},
m(target, anchor) {
mount_component(layout, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const layout_changes = {};
if (dirty & /*$$scope, apis*/
9) {
layout_changes.$$scope = { dirty, ctx: ctx2 };
}
layout.$set(layout_changes);
},
i(local) {
if (current) return;
transition_in(layout.$$.fragment, local);
current = true;
},
o(local) {
transition_out(layout.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(layout, detaching);
}
};
}
function instance4($$self, $$props, $$invalidate) {
let { props = {} } = $$props;
let { apis = {
actionTest: () => {
}
} } = $$props;
let type = props?.type || "test";
$$self.$$set = ($$props2) => {
if ("props" in $$props2) $$invalidate(1, props = $$props2.props);
if ("apis" in $$props2) $$invalidate(0, apis = $$props2.apis);
};
return [apis, props];
}
var Root = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance4, create_fragment4, safe_not_equal, { props: 1, apis: 0 });
}
get props() {
return this.$$.ctx[1];
}
set props(props) {
this.$$set({ props });
flush();
}
get apis() {
return this.$$.ctx[0];
}
set apis(apis) {
this.$$set({ apis });
flush();
}
};
create_custom_element(Root, { "props": {}, "apis": {} }, [], [], true);
var root_default = Root;
// src/lib/main.svelte
function create_fragment5(ctx) {
let ganttmingo;
let current;
ganttmingo = new root_default({
props: { props: { .../*props*/
ctx[0] } }
});
return {
c() {
create_component(ganttmingo.$$.fragment);
},
m(target, anchor) {
mount_component(ganttmingo, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const ganttmingo_changes = {};
if (dirty & /*props*/
1) ganttmingo_changes.props = { .../*props*/
ctx2[0] };
ganttmingo.$set(ganttmingo_changes);
},
i(local) {
if (current) return;
transition_in(ganttmingo.$$.fragment, local);
current = true;
},
o(local) {
transition_out(ganttmingo.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(ganttmingo, detaching);
}
};
}
function instance5($$self, $$props, $$invalidate) {
let { props = {} } = $$props;
$$self.$$set = ($$props2) => {
if ("props" in $$props2) $$invalidate(0, props = $$props2.props);
};
return [props];
}
var Main = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance5, create_fragment5, safe_not_equal, { props: 0 });
}
get props() {
return this.$$.ctx[0];
}
set props(props) {
this.$$set({ props });
flush();
}
};
customElements.define("gantt-mingo", create_custom_element(Main, { "props": {} }, [], [], true));
var main_default = Main;
})();