Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
build v0.6.11
Browse files Browse the repository at this point in the history
perf: GridViewDelegate
  • Loading branch information
Arenukvern committed Feb 16, 2021
1 parent 5f91cac commit a4a89aa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@xsoulspace/vue_flutter_tailwind",
"description": "Vue3 styled like Flutter with Tailwind CSS",
"version": "0.6.10",
"version": "0.6.11",
"private": false,
"author": {
"name": "Anton Malofeev",
Expand Down
16 changes: 8 additions & 8 deletions src/abstract/Grid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, h, Ref, ref } from 'vue'
import { Component, h, reactive } from 'vue'
import { Maybe } from './BasicTypes'
import { ItemBuilderContext } from './ItemBuilder'

Expand Down Expand Up @@ -29,27 +29,27 @@ export interface GridViewItemPreBuidler {
position: GridViewItemPosition
}
export class GridViewDelegate {
private _reactVal: Ref<GridViewItemPreBuidler[]> = ref([])
private _reactVal: GridViewItemPreBuidler[] = reactive([])
constructor({ gridViewItems }: { gridViewItems: GridViewItemPreBuidler[] }) {
this.value = gridViewItems
this.value.push(...gridViewItems)
}
static use(arg: { gridViewItems: GridViewItemPreBuidler[] }) {
return new GridViewDelegate(arg)
}
itemBuilder({ index }: ItemBuilderContext): Maybe<Component> {
return this._reactVal.value.find((el) => el.position.index == index)?.widget
return this._reactVal.find((el) => el.position.index == index)?.widget
}
get widgets(): Maybe<Component>[] {
return this._reactVal.value.map((el) => h(el.widget)) ?? []
return this._reactVal.map((el) => h(el.widget)) ?? []
}
get layoutMatrix(): GridViewItemPosition[] {
return this._reactVal.value.map((el) => el.position) ?? []
return this._reactVal.map((el) => el.position) ?? []
}
set value(val: GridViewItemPreBuidler[]) {
this._reactVal.value = val
this._reactVal = val
}
get value() {
return this._reactVal.value
return this._reactVal
}

get css(): string {
Expand Down
1 change: 0 additions & 1 deletion src/components/GridView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class GridView {
GridViewBuilder,
},
setup() {
console.log('init gridview')
const resolvedIsDraggable = computed(() =>
isDraggable?.value == false ? false : true
)
Expand Down
2 changes: 0 additions & 2 deletions src/components/GridViewBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export default {
* with vue-grid. AllChanges must go on from it or be written to it.
*/
const internalLayoutMatrix = reactive<PackageGridItemPosition[]>([])
console.log('init')
/**
* Sending changes up
*/
Expand Down Expand Up @@ -144,7 +143,6 @@ export default {
oldArr: internalLayoutMatrix,
idPropertyName: 'i',
})
console.log({ created, updated, removed })
for (const removedPosition of removed) {
const index = internalLayoutMapOfIndexes.value.get(removedPosition.i)
if (index) internalLayoutMatrix.splice(index, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export const WrapperApp = () => {
const i = layoutMatrix.findIndex(
(el) => el.index == newPosition.index
)
console.log({ i })
// console.log({ i })
layoutMatrix.splice(i, 1, newPosition)
},
delegate: gridViewDelegate,
Expand Down

0 comments on commit a4a89aa

Please sign in to comment.