From 2b45955b699040efab42bfd7fa807cff0484e84b Mon Sep 17 00:00:00 2001 From: lizairong Date: Tue, 8 Sep 2020 10:23:11 +0800 Subject: [PATCH 1/3] props of options.column.style can be a function with param task --- src/components/TaskList/ItemColumn.vue | 27 +++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/components/TaskList/ItemColumn.vue b/src/components/TaskList/ItemColumn.vue index a9f78676..0e7e5374 100644 --- a/src/components/TaskList/ItemColumn.vue +++ b/src/components/TaskList/ItemColumn.vue @@ -71,7 +71,21 @@ export default { this.column.events[eventName]({ event, data: this.task, column: this.column }); } this.root.$emit(`taskList-${this.task.type}-${eventName}`, { event, data: this.task, column: this.column }); - } + }, + + /** + * Get column style object + * + * @returns {object} + */ + columnStyle () { + // the column style can be a function type with a param 'task' + // user can render a diff column style depend on some task attr + if (typeof this.column.style === 'function') { + return this.column.style(this.task) + } + return this.column.style + }, }, computed: { /** @@ -101,7 +115,7 @@ export default { itemColumnStyle() { return { ...this.root.style['task-list-item-column'], - ...this.column.style['task-list-item-column'], + ...this.columnStyle()['task-list-item-column'], width: this.column.finalWidth + 'px', height: this.column.height + 'px' }; @@ -110,19 +124,22 @@ export default { wrapperStyle() { return { ...this.root.style['task-list-item-value-wrapper'], - ...this.column.style['task-list-item-value-wrapper'] + ...this.columnStyle()['task-list-item-value-wrapper'] }; }, containerStyle() { return { ...this.root.style['task-list-item-value-container'], - ...this.column.style['task-list-item-value-container'] + ...this.columnStyle()['task-list-item-value-container'] }; }, valueStyle() { - return { ...this.root.style['task-list-item-value'], ...this.column.style['task-list-item-value'] }; + return { + ...this.root.style['task-list-item-value'], + ...this.columnStyle()['task-list-item-value'] + }; } } }; From 5a32be416a3f7f7610e0835fa34a96967f2fbdc0 Mon Sep 17 00:00:00 2001 From: lizairong Date: Mon, 28 Sep 2020 10:00:55 +0800 Subject: [PATCH 2/3] update desc --- README.md | 378 +-------------------------------------------------- package.json | 12 +- 2 files changed, 11 insertions(+), 379 deletions(-) diff --git a/README.md b/README.md index ce658988..4db04464 100644 --- a/README.md +++ b/README.md @@ -1,378 +1,12 @@ -

Gantt-elastic - Javascript Gantt Chart (editable, responsive)

-

Javascript Gantt Chart for vue, jquery, vanilla js and other frameworks

+## gantt-elastic-style 扩展了 gantt-elastic 对task样式style的支持 -
-

Project moved as next major version to gantt-schedule-timeline-calendar



+[gantt-elastic](https://www.npmjs.com/package/gantt-elastic) +[demo](http://www.huili.cool/gantt) +### install -
- - - - - - -Twitter -
- -

-Keywords: [ gantt, javascript gantt, gantt chart,js gantt,vue gantt,project manager,gantt project manager,responsive gantt ] -

- -

Gantt-elastic demo here

- -![preview img](https://github.com/neuronetio/gantt-elastic/raw/master/gantt-elastic.jpg) -![preview gif](https://github.com/neuronetio/gantt-elastic/raw/master/gantt-elastic.gif) -![preview gif](https://github.com/neuronetio/gantt-elastic/raw/master/grab-scroll.gif) - -## Gantt-elastic - -is a vue component but it could be used in other frameworks or even with jQuery (vue is kind of elastic and lightweight framework). - -[WIKI](https://github.com/neuronetio/gantt-elastic/wiki) - -[Vue Example](https://github.com/neuronetio/vue-gantt-elastic) - -### Installation - -`npm install --save gantt-elastic` or download zip from github / clone repo - -and if you want default header - -`npm install --save gantt-elastic-header` - -### Usage - -```html - - - - - - GanttElastic editor demo - - - - - - - - -
-
- - - - -
-
- - - - -``` - -### gantt-elastic as vue component - -Take a look at the `vue.html` inside [examples folder](https://github.com/neuronetio/gantt-elastic/tree/master/examples) file to see how you could add gantt-elastic inside `