Skip to content

Commit

Permalink
Fixed the issue where changing headerRowHeight was not reflected. (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Jul 12, 2024
1 parent 38635b9 commit 3fe6f36
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 43 deletions.
4 changes: 2 additions & 2 deletions packages/cheetah-grid/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cheetah-grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cheetah-grid",
"version": "1.13.2",
"version": "1.13.3",
"description": "Cheetah Grid is a high performance grid engine that works on canvas",
"keywords": [
"spreadsheet",
Expand Down
13 changes: 13 additions & 0 deletions packages/cheetah-grid/src/js/ListGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,19 @@ export class ListGrid<T> extends DrawGrid implements ListGridAPI<T> {
this[_].layout = layout;
_refreshHeader(this);
}
/**
* Gets the define of the headerRowHeight.
*/
get headerRowHeight(): number | number[] {
return this[_].headerRowHeight;
}
/**
* Sets the define of the headerRowHeight with the given data.
*/
set headerRowHeight(headerRowHeight: number | number[]) {
this[_].headerRowHeight = headerRowHeight || [];
_refreshHeader(this);
}
/**
* Get the row count per record
*/
Expand Down
1 change: 1 addition & 0 deletions packages/cheetah-grid/src/js/ts-types/grid-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export interface ListGridAPI<T> extends DrawGridAPI {
dataSource: DataSourceAPI<T>;
theme: RequiredThemeDefine | null;
allowRangePaste: boolean;
headerRowHeight: number[] | number;
sortState: SortState | null;
headerValues: HeaderValues;
recordRowCount: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-cheetah-grid/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true,
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
}
}
79 changes: 44 additions & 35 deletions packages/vue-cheetah-grid/lib/CGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ function _buildGridProps (vm) {
}
return extend(
{
frozenColCount: vm.frozenColCount - 0,
theme: vm.theme || null
},
headerLayoutOptions,
Expand Down Expand Up @@ -453,6 +452,48 @@ export default {
this.rawGrid.frozenColCount = frozenColCount
}
},
allowRangePaste (allowRangePaste) {
if (this.rawGrid) {
this.rawGrid.allowRangePaste = !!allowRangePaste
}
},
trimOnPaste (trimOnPaste) {
if (this.rawGrid) {
this.rawGrid.trimOnPaste = !!trimOnPaste
}
},
headerRowHeight (headerRowHeight) {
if (this.rawGrid) {
this.rawGrid.headerRowHeight = headerRowHeight
}
},
defaultRowHeight (defaultRowHeight) {
if (this.rawGrid && defaultRowHeight != null) {
this.rawGrid.defaultRowHeight = defaultRowHeight
}
},
defaultColWidth (defaultColWidth) {
if (this.rawGrid && defaultColWidth != null) {
this.rawGrid.defaultColWidth = defaultColWidth
}
},
font (font) {
if (this.rawGrid) {
this.rawGrid.font = font
this.$_CGrid_nextTickInvalidate()
}
},
underlayBackgroundColor (underlayBackgroundColor) {
if (this.rawGrid) {
this.rawGrid.underlayBackgroundColor = underlayBackgroundColor
this.$_CGrid_nextTickInvalidate()
}
},
disableColumnResize (disableColumnResize) {
if (this.rawGrid) {
this.rawGrid.disableColumnResize = disableColumnResize
}
},
options: gridUpdateWatcher,
headerValues: {
handler (headerValues) {
Expand Down Expand Up @@ -593,57 +634,25 @@ export default {
delete newProps.header
delete beforeGridProps.layout
delete newProps.layout
delete beforeGridProps.frozenColCount
delete newProps.frozenColCount
delete beforeGridProps.theme
delete newProps.theme
delete beforeGridProps.allowRangePaste
delete newProps.allowRangePaste
delete beforeGridProps.trimOnPaste
delete newProps.trimOnPaste
delete beforeGridProps.defaultRowHeight
delete newProps.defaultRowHeight
delete beforeGridProps.defaultColWidth
delete newProps.defaultColWidth
delete beforeGridProps.underlayBackgroundColor
delete newProps.underlayBackgroundColor
delete beforeGridProps.font
delete newProps.font
if (deepObjectEquals(beforeGridProps, newProps)) {
// 操作可能なoptionのみの変更。インスタンス再作成はしない
const options = _buildGridOption(this)
const {
header,
layout,
frozenColCount,
theme,
allowRangePaste,
trimOnPaste,
defaultRowHeight,
defaultColWidth,
font,
underlayBackgroundColor
theme
} = options
if (!deepObjectEquals(this._beforeGridProps.header, gridProps.header)) {
this.rawGrid.header = header
}
if (!deepObjectEquals(this._beforeGridProps.layout, gridProps.layout)) {
this.rawGrid.layout = layout
}
this.rawGrid.frozenColCount = frozenColCount
this.rawGrid.theme = theme
this.rawGrid.allowRangePaste = !!allowRangePaste
this.rawGrid.trimOnPaste = !!trimOnPaste
if (defaultRowHeight != null) {
this.rawGrid.defaultRowHeight = defaultRowHeight
}
if (defaultColWidth != null) {
this.rawGrid.defaultColWidth = defaultColWidth
}
this.rawGrid.font = font
this.rawGrid.underlayBackgroundColor = underlayBackgroundColor
this.rawGrid.invalidate()
this.rawGrid.$_CGrid_nextTickInvalidate()
this._beforeGridProps = extend({}, gridProps)
return
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-cheetah-grid/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vue-cheetah-grid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-cheetah-grid",
"version": "1.13.2",
"version": "1.13.3",
"description": "Cheetah Grid for Vue.js",
"main": "lib/index.js",
"unpkg": "dist/vueCheetahGrid.js",
Expand Down

0 comments on commit 3fe6f36

Please sign in to comment.