Skip to content

2.0 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

2.0 #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions =0.52.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[email protected] /Users/billy/vue/vue-clusterize
├─┬ [email protected]
│ └── [email protected]
├── [email protected] extraneous
└── UNMET PEER DEPENDENCY [email protected]

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ example:

There are two ways clusterize can be used, either use a fixed height:
```html
<clusterize :data="rowsData" :height="400" v-ref:clusterize>
<clusterize :data="rowsData" :height="400" ref="clusterize">
```

Or use autoheight:
Expand Down
5 changes: 2 additions & 3 deletions clusterize-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
frags: []
};
},
ready: function() {
mounted: function() {
var key, ref, results, val;
this.end = this.Vue.util.createAnchor('clusterize-cluster-end');
this.$el.appendChild(this.end);
Expand All @@ -58,7 +58,6 @@ module.exports = {
parentScope = this.parentVm;
scope = Object.create(parentScope);
scope.$refs = Object.create(parentScope.$refs);
scope.$els = Object.create(parentScope.$els);
scope.$parent = parentScope;
scope.$forContext = this;
this.Vue.util.defineReactive(scope, this.bindingName, this.data[i]);
Expand Down Expand Up @@ -163,4 +162,4 @@ module.exports = {
};

if (module.exports.__esModule) module.exports = module.exports.default
;(typeof module.exports === "function"? module.exports.options: module.exports).template = "<div class=clusterize-cluster :class={loading:loading} :style=\"{height:height+'px',overflow:'visible',position:'relative',margin:0,padding:0}\"><div class=clusterize-cluster-loading v-el:loading=v-el:loading v-show=loading><slot>loading...</slot></div></div>"
;(typeof module.exports === "function"? module.exports.options: module.exports).template = "<div class=clusterize-cluster :class={loading:loading} :style=\"{height:height+'px',overflow:'visible',position:'relative',margin:0,padding:0}\"><div class=clusterize-cluster-loading v-ref='loading'=v-ref='loading' v-show=loading><slot>loading...</slot></div></div>"
8 changes: 4 additions & 4 deletions clusterize.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ module.exports = {
relI = absI % 3;
if (this.clusters[relI].nr !== absI || repaint) {
if (down) {
this.clusters[relI].$before(this.$els.lastRow);
this.clusters[relI].$before(this.$refs.lastRow);
} else {
this.clusters[relI].$after(this.$els.firstRow);
this.clusters[relI].$after(this.$refs.firstRow);
}
this.clusters[relI].nr = absI;
this.clusters[relI].index = absI * this.clusterSize;
Expand Down Expand Up @@ -486,7 +486,7 @@ module.exports = {
}
}
},
ready: function() {
mounted: function() {
var child, l, len, ref;
ref = this.$children;
for (l = 0, len = ref.length; l < len; l++) {
Expand Down Expand Up @@ -521,4 +521,4 @@ module.exports = {
};

if (module.exports.__esModule) module.exports = module.exports.default
;(typeof module.exports === "function"? module.exports.options: module.exports).template = "<div class=clusterize :style=computedStyle :class=\"{'loading':state.loading, 'not-started':!state.started}\" @scroll=onScroll><div class=clusterize-first-row v-el:first-row=v-el:first-row v-bind:style=\"{height:firstRowHeight+'px'}\"></div><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><div class=clusterize-last-row v-el:last-row=v-el:last-row v-bind:style=\"{height:lastRowHeight+'px'}\"></div></div>"
;(typeof module.exports === "function"? module.exports.options: module.exports).template = "<div class=clusterize :style=computedStyle :class=\"{'loading':state.loading, 'not-started':!state.started}\" @scroll=onScroll><div class=clusterize-first-row v-ref='first-row'=v-ref='first-row' v-bind:style=\"{height:firstRowHeight+'px'}\"></div><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><clusterize-cluster v-bind:binding-name=bindingName v-bind:row-watchers=rowWatchers v-bind:parent-vm=parentVm><slot name=loading></slot></clusterize-cluster><div class=clusterize-last-row v-el:last-row=v-el:last-row v-bind:style=\"{height:lastRowHeight+'px'}\"></div></div>"
6 changes: 3 additions & 3 deletions dev/autoheight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
p resize the window
p rows per cluster: {{clusterSize}}
.scrollcontainer(style="height:80%;position:relative")
clusterize(v-ref:clusterize v-bind:data="rowsData" auto-height v-bind:style="{width:'200px',border:'solid 1px black'}")
clusterize(ref="clusterize" v-bind:data="rowsData" auto-height v-bind:style="{width:'200px',border:'solid 1px black'}")
div.clusterize-row {{data}}
</template>

Expand All @@ -19,12 +19,12 @@ module.exports =
rowsData: (x for x in [1..10000])
clusterSize: 0
timer: null
attached: ->
mounted: ->
@timer = setInterval (=> @clusterSize = @$refs.clusterize.clusterSize),500
document.body.setAttribute "style","height:100%"
@setCss document.body, "height", "100%"
@setCss document.documentElement, "height", "100%"
detached: ->
destroyed: ->
clearInterval(@timer) if @timer?
@setCss document.body, "height"
@setCss document.documentElement, "height"
Expand Down
2 changes: 1 addition & 1 deletion dev/basic.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.container
a(href="https://vue-comps.github.io/vue-clusterize/blob/master/dev/basic.vue") source
clusterize(v-ref:clusterize v-bind:data="rowsData" v-bind:height="400" v-bind:style="{width:'200px'}")
clusterize(ref="clusterize" v-bind:data="rowsData" v-bind:height="400" v-bind:style="{width:'200px'}")
div.clusterize-row {{data}} - index: {{index}}
</template>

Expand Down
8 changes: 4 additions & 4 deletions dev/flex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
p Same size // items per cluster: {{clusterSize}}
p(style="margin-left:50%") Different size with display:flex // items per cluster: {{clusterSize2}}
.scrollcontainer(style="height:80%;position:relative;width:40%;float:left")
clusterize(v-ref:clusterize v-bind:data="rowsData" flex v-bind:flex-initial="100" auto-height v-bind:style="{border:'solid 1px black'}")
clusterize(ref="clusterize" v-bind:data="rowsData" flex v-bind:flex-initial="100" auto-height v-bind:style="{border:'solid 1px black'}")
div.clusterize-row(style="clear:both")
span(style="float:left;padding:5px" v-for="d in data") {{d}}
.flexcontainer(style="height:80%;position:relative;width:40%;float:left")
clusterize(v-ref:clusterize2 @get-data="getData" @get-data-count="getDataCount" flex v-bind:flex-fac=0.96 v-bind:flex-initial="40" auto-height v-bind:style="{border:'solid 1px black'}")
clusterize(ref="clusterize2" @get-data="getData" @get-data-count="getDataCount" flex v-bind:flex-fac=0.96 v-bind:flex-initial="40" auto-height v-bind:style="{border:'solid 1px black'}")
div.clusterize-row(style="display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between")
div(style="text-align:center;margin:5px",v-bind:style="{background:d.color,height:d.height,width:d.width}",v-for="d in data") {{d.i}}
</template>
Expand All @@ -27,13 +27,13 @@ module.exports =
clusterSize2: 2
timer: null
timer2: null
attached: ->
mounted: ->
@timer = setInterval (=> @clusterSize = @$refs.clusterize.clusterSize),500
@timer2 = setInterval (=> @clusterSize2 = @$refs.clusterize2.clusterSize),500
document.body.setAttribute "style","height:100%"
@setCss document.body, "height", "100%"
@setCss document.documentElement, "height", "100%"
detached: ->
destroyed: ->
clearInterval(@timer) if @timer?
@setCss document.body, "height"
@setCss document.documentElement, "height"
Expand Down
2 changes: 1 addition & 1 deletion dev/loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.container
a(href="https://vue-comps.github.io/vue-clusterize/blob/master/dev/loading.vue") source
p 0.5 sec delay for data
clusterize(v-ref:clusterize @get-data="getData" @get-data-count="getDataCount" v-bind:height="400" v-bind:style="{width:'200px'}")
clusterize(ref="clusterize" @get-data="getData" @get-data-count="getDataCount" v-bind:height="400" v-bind:style="{width:'200px'}")
div.clusterize-row(v-if="!loading") {{data}}
p(slot="loading") loading
</template>
Expand Down
2 changes: 1 addition & 1 deletion dev/presetRowHeight.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.container
a(href="https://vue-comps.github.io/vue-clusterize/blob/master/dev/basic.vue") source
clusterize(v-ref:clusterize v-bind:data="rowsData" v-bind:row-height="25" v-bind:height="400" v-bind:style="{width:'200px'}")
clusterize(ref="clusterize" v-bind:data="rowsData" v-bind:row-height="25" v-bind:height="400" v-bind:style="{width:'200px'}")
div.clusterize-row(v-bind:style="{height:height+'px'}") {{data}}
</template>

Expand Down
2 changes: 1 addition & 1 deletion dev/withOtherComponentInside.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.container
a(href="https://vue-comps.github.io/vue-clusterize/blob/master/dev/basic.vue") source
clusterize(v-ref:clusterize v-bind:data="rowsData" v-bind:height="400" v-bind:style="{width:'200px'}")
clusterize(ref="clusterize" v-bind:data="rowsData" v-bind:height="400" v-bind:style="{width:'200px'}")
div.clusterize-row {{data}}
tooltip(position="body") index: {{index}}
</template>
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = (config) ->
config.set
preprocessors:
"**/*.coffee": ["webpack",'sourcemap']
"**/:.coffee+": ["webpack",'sourcemap']
webpack:
devtool: 'inline-source-map'
resolve:
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"node": "*"
},
"dependencies": {
"vue": "^2.0.7",
"vue-mixins": "^0.2.10"
},
"devDependencies": {
Expand All @@ -39,13 +40,14 @@
"karma-webpack": "^1.7.0",
"mocha": "^2.5.3",
"pug": "^2.0.0-beta3",
"stylus-loader": "^2.3.1",
"template-html-loader": "0.0.3",
"vue": "^1.0.25",
"vue": "^2.0.7",
"vue-compiler": "^0.3.0",
"vue-comps-tooltip": "^0.2.0",
"vue-dev-server": "^0.2.10",
"vue-html-loader": "^1.2.2",
"vue-loader": "^8.5.2",
"vue-loader": "^9.0.0",
"webpack": "^1.13.1"
},
"keywords": [
Expand All @@ -55,7 +57,7 @@
],
"readmeFilename": "README.md",
"scripts": {
"build": "NODE_ENV=production vue-compiler --out . src/*.vue",
"build": "NODE_ENV=production vue-compiler --out . src/:.vue+",
"dev": "vue-dev-server",
"watch": "karma start --browsers Chrome --auto-watch --reporters spec",
"test": "karma start --single-run",
Expand Down
5 changes: 2 additions & 3 deletions src/clusterize-cluster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:style="{height:height+'px',overflow:'visible',position:'relative',margin:0,padding:0}"
)
.clusterize-cluster-loading(
v-el:loading,
ref="loading",
v-show="loading"
)
slot loading...
Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports =
end: null
frags: []

ready: ->
mounted: ->
@end = @Vue.util.createAnchor('clusterize-cluster-end')
@$el.appendChild(@end)
for key,val of @rowWatchers
Expand All @@ -57,7 +57,6 @@ module.exports =
parentScope = @parentVm
scope = Object.create(parentScope)
scope.$refs = Object.create(parentScope.$refs)
scope.$els = Object.create(parentScope.$els)
scope.$parent = parentScope
scope.$forContext = @
@Vue.util.defineReactive(scope,@bindingName,@data[i])
Expand Down
6 changes: 3 additions & 3 deletions src/clusterize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
:class="{'loading':state.loading, 'not-started':!state.started}",
@scroll="onScroll"
)
.clusterize-first-row(v-el:first-row v-bind:style="{height:firstRowHeight+'px'}")
.clusterize-first-row(ref="first-row" v-bind:style="{height:firstRowHeight+'px'}")
clusterize-cluster(v-bind:binding-name="bindingName" v-bind:row-watchers="rowWatchers" v-bind:parent-vm="parentVm")
slot(name="loading")
clusterize-cluster(v-bind:binding-name="bindingName" v-bind:row-watchers="rowWatchers" v-bind:parent-vm="parentVm")
slot(name="loading")
clusterize-cluster(v-bind:binding-name="bindingName" v-bind:row-watchers="rowWatchers" v-bind:parent-vm="parentVm")
slot(name="loading")
.clusterize-last-row(v-el:last-row v-bind:style="{height:lastRowHeight+'px'}")
.clusterize-last-row(ref="last-row" v-bind:style="{height:lastRowHeight+'px'}")
</template>

<script lang="coffee">
Expand Down Expand Up @@ -354,7 +354,7 @@ module.exports =
for cluster in @clusters
cluster.factory = factory

ready: ->
mounted: ->
for child in @$children
if child.isCluster
@clusters.push child
Expand Down