UNPKG

vue-gantt-3

Version:

A gantt component for Vue 3

68 lines (67 loc) 2.78 kB
import { defineComponent, shallowRef, ref, createElementBlock, openBlock, normalizeStyle, createCommentVNode, createBlock, withModifiers, withDirectives, createElementVNode, vShow, resolveDynamicComponent, toDisplayString } from "vue"; import _imports_0 from "../../assets/images/shrink.svg.mjs"; import _imports_1 from "../../assets/images/spread.svg.mjs"; const _hoisted_1 = { class: "vg-cell-shrink-icon" }; const _hoisted_2 = { class: "vg-cell-spread-icon" }; const _hoisted_3 = { key: 2 }; const basePaddingLeft = 18; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "FirstColumnCellRender", props: { params: {} }, setup(__props) { var _a; const props = __props; const rowNode = shallowRef(props.params.rowNode); const level = ref(((_a = rowNode.value) == null ? void 0 : _a.level) || 0); const currentPaddingLeft = basePaddingLeft + level.value * 14; const positionLeft = currentPaddingLeft - 14; const setExpand = (event) => { const currentRowNode = rowNode.value; if (currentRowNode) { event.button === 0 && currentRowNode.setExpand(currentRowNode.id, !currentRowNode.expand); currentRowNode.setSelect(currentRowNode.id); } }; return (_ctx, _cache) => { var _a2; return openBlock(), createElementBlock("div", { class: "vg-cell-expandable", style: normalizeStyle({ paddingLeft: currentPaddingLeft + "px" }) }, [ ((_a2 = rowNode.value) == null ? void 0 : _a2.hasChildren) ? (openBlock(), createElementBlock("span", { key: 0, class: "vg-cell-expand-box", style: normalizeStyle({ left: positionLeft + "px" }), onMousedown: withModifiers(setExpand, ["stop"]) }, [ withDirectives(createElementVNode("span", _hoisted_1, _cache[0] || (_cache[0] = [ createElementVNode("img", { src: _imports_0, alt: "" }, null, -1) ]), 512), [ [vShow, rowNode.value.expand] ]), withDirectives(createElementVNode("span", _hoisted_2, _cache[1] || (_cache[1] = [ createElementVNode("img", { src: _imports_1, alt: "" }, null, -1) ]), 512), [ [vShow, !rowNode.value.expand] ]) ], 36)) : createCommentVNode("", true), _ctx.params.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.params.component), { key: 1, params: _ctx.params }, null, 8, ["params"])) : (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(props.params.value), 1)) ], 4); }; } }); export { _sfc_main as default }; //# sourceMappingURL=FirstColumnCellRender.vue.mjs.map