Skip to content

Commit afed7c9

Browse files
committed
feat(grid): [grid] grid custom panel adapt to x-design
1 parent 577d509 commit afed7c9

File tree

10 files changed

+41
-87
lines changed

10 files changed

+41
-87
lines changed

examples/sites/demos/pc/app/grid/fixed/group-header-fixed-composition-api.vue

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
<tiny-grid-column :renderer="rendererCellOperate" width="100"></tiny-grid-column>
1515
</tiny-grid-column>
1616
</tiny-grid-column>
17-
<tiny-grid-column :title="renderHeaderDescription" header-align="center">
17+
<tiny-grid-column title="描述" header-align="center">
1818
<tiny-grid-column field="name" title="名称" show-tip sortable width="600"></tiny-grid-column>
1919
<tiny-grid-column
2020
field="area"
21-
:title="renderHeaderArea"
21+
title="分区"
2222
:editor="{ component: 'select', options }"
2323
sortable
2424
width="600"
@@ -27,7 +27,7 @@
2727
<tiny-grid-column :title="renderHeaderRelation" header-align="center">
2828
<tiny-grid-column
2929
field="address"
30-
:title="renderHeaderAddress"
30+
title="地区"
3131
:editor="{ component: 'input', autoselect: true }"
3232
sortable
3333
width="600"
@@ -44,7 +44,7 @@
4444
<tiny-grid-column title="右冻结分组" header-align="center" fixed="right">
4545
<tiny-grid-column
4646
field="address"
47-
:title="renderHeaderAddress"
47+
title="地区"
4848
:editor="{ component: 'input', autoselect: true }"
4949
sortable
5050
width="150"
@@ -165,15 +165,6 @@ const options = ref([
165165
{ label: '华南区', value: '华南区' }
166166
])
167167
168-
function renderHeaderDescription(h) {
169-
return (
170-
<span>
171-
{' '}
172-
<TinyIconAdministrator />
173-
Description
174-
</span>
175-
)
176-
}
177168
function renderHeaderRelation(h) {
178169
return (
179170
<span>
@@ -182,24 +173,6 @@ function renderHeaderRelation(h) {
182173
)
183174
}
184175
185-
function renderHeaderArea(h) {
186-
return (
187-
<span>
188-
<TinyIconMarkOn />
189-
Description
190-
</span>
191-
)
192-
}
193-
194-
function renderHeaderAddress(h) {
195-
return (
196-
<span>
197-
<TinyIconUser />
198-
Description
199-
</span>
200-
)
201-
}
202-
203176
function rendererCellOperate(h) {
204177
return (
205178
<div style="text-align: center; font-size: 16px;">

examples/sites/demos/pc/app/grid/fixed/group-header-fixed.vue

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
<tiny-grid-column :renderer="rendererCellOperate" width="100"></tiny-grid-column>
1515
</tiny-grid-column>
1616
</tiny-grid-column>
17-
<tiny-grid-column :title="renderHeaderDescription" header-align="center">
17+
<tiny-grid-column title="描述" header-align="center">
1818
<tiny-grid-column field="name" title="名称" show-tip sortable width="600"></tiny-grid-column>
1919
<tiny-grid-column
2020
field="area"
21-
:title="renderHeaderArea"
21+
title="分区"
2222
:editor="{ component: 'select', options }"
2323
sortable
2424
width="600"
@@ -27,7 +27,7 @@
2727
<tiny-grid-column :title="renderHeaderRelation" header-align="center">
2828
<tiny-grid-column
2929
field="address"
30-
:title="renderHeaderAddress"
30+
title="地区"
3131
:editor="{ component: 'input', autoselect: true }"
3232
sortable
3333
width="600"
@@ -44,7 +44,7 @@
4444
<tiny-grid-column title="右冻结分组" header-align="center" fixed="right">
4545
<tiny-grid-column
4646
field="address"
47-
:title="renderHeaderAddress"
47+
title="地区"
4848
:editor="{ component: 'input', autoselect: true }"
4949
sortable
5050
width="150"
@@ -172,17 +172,6 @@ export default {
172172
}
173173
},
174174
methods: {
175-
renderHeaderDescription(h) {
176-
const IconAdministrator = this.IconAdministrator
177-
178-
return (
179-
<span>
180-
{' '}
181-
<IconAdministrator />
182-
Description
183-
</span>
184-
)
185-
},
186175
renderHeaderRelation(h) {
187176
const IconVersiontree = this.IconVersiontree
188177
@@ -193,28 +182,6 @@ export default {
193182
)
194183
},
195184
196-
renderHeaderArea(h) {
197-
const IconMarkOn = this.IconMarkOn
198-
199-
return (
200-
<span>
201-
<IconMarkOn />
202-
Description
203-
</span>
204-
)
205-
},
206-
207-
renderHeaderAddress(h) {
208-
const IconUser = this.IconUser
209-
210-
return (
211-
<span>
212-
<IconUser />
213-
Description
214-
</span>
215-
)
216-
},
217-
218185
rendererCellOperate(h) {
219186
const IconAssociation = this.IconAssociation
220187
const IconHelpful = this.IconHelpful

examples/sites/demos/pc/app/grid/header/custom-grid-header-composition-api.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function renderHeaderRelation() {
120120
121121
function renderHeaderArea() {
122122
return (
123-
<span>
123+
<span style="order: -1">
124124
<IconMarkOn />
125125
Description
126126
</span>
@@ -129,7 +129,7 @@ function renderHeaderArea() {
129129
130130
function renderHeaderAddress() {
131131
return (
132-
<span>
132+
<span style="order: -1">
133133
<IconUser />
134134
Description
135135
</span>

examples/sites/demos/pc/app/grid/header/custom-grid-header.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default {
132132
const IconMarkOn = this.IconMarkOn
133133
134134
return (
135-
<span>
135+
<span style="order: -1">
136136
<IconMarkOn />
137137
Description
138138
</span>
@@ -143,7 +143,7 @@ export default {
143143
const IconUser = this.IconUser
144144
145145
return (
146-
<span>
146+
<span style="order: -1">
147147
<IconUser />
148148
Description
149149
</span>

examples/sites/demos/pc/app/grid/tree-table/tree-grid-data-composition-api.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div>
33
<tiny-grid :data="tableData" :tree-config="{ children: 'children' }">
4-
<tiny-grid-column field="name" title="公司名称" tree-node></tiny-grid-column>
4+
<tiny-grid-column field="index" width="60" tree-node></tiny-grid-column>
5+
<tiny-grid-column field="name" title="公司名称"></tiny-grid-column>
56
<tiny-grid-column field="area" title="区域"></tiny-grid-column>
67
<tiny-grid-column field="employees" title="员工数"></tiny-grid-column>
78
</tiny-grid>

examples/sites/demos/pc/app/grid/tree-table/tree-grid-data.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div>
33
<tiny-grid :data="tableData" :tree-config="{ children: 'children' }">
4-
<tiny-grid-column field="name" title="公司名称" tree-node></tiny-grid-column>
4+
<tiny-grid-column field="index" width="60" tree-node></tiny-grid-column>
5+
<tiny-grid-column field="name" title="公司名称"></tiny-grid-column>
56
<tiny-grid-column field="area" title="区域"></tiny-grid-column>
67
<tiny-grid-column field="employees" title="员工数"></tiny-grid-column>
78
</tiny-grid>

packages/theme/src/grid/custom.less

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
.@{grid-custom-prefix-cls} {
2121
width: 100%;
2222

23+
.tiny-modal__header {
24+
margin-bottom: 16px;
25+
}
26+
2327
& &__tabs {
2428
.@{css-prefix}tabs__content {
2529
margin: 0;
@@ -35,7 +39,7 @@
3539
}
3640

3741
.@{grid-custom-prefix-cls}__setting {
38-
border-bottom: 1px solid var(--ti-grid-border-color);
42+
border-bottom: 1px solid transparent;
3943
padding: 12px 0 24px;
4044

4145
.setting-item {
@@ -44,7 +48,7 @@
4448
overflow: hidden;
4549
position: relative;
4650
display: flex;
47-
align-items: flex-start;
51+
align-items: center;
4852
justify-content: space-between;
4953

5054
.setting-icon {
@@ -122,9 +126,9 @@
122126
}
123127

124128
& &__footer {
125-
margin: 12px;
129+
margin-bottom: 32px;
126130
text-align: center;
127131
display: flex;
128-
justify-content: center;
132+
justify-content: flex-end;
129133
}
130134
}

packages/theme/src/grid/radio.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
& + .@{grid-radio-prefix-cls}__icon {
3838
position: relative;
3939
display: inline-block;
40-
width: 1em;
41-
height: 1em;
40+
line-height: 1;
4241
vertical-align: middle;
4342
border-radius: 50%;
4443
font-size: var(--ti-common-font-size-2);

packages/theme/src/grid/table.less

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@
464464
.CellEllipsis();
465465
}
466466

467+
&.col__selection {
468+
.tiny-grid-cell {
469+
&:has(> .@{grid-prefix-cls}-checkbox) {
470+
line-height: 1;
471+
}
472+
}
473+
}
474+
467475
border-bottom: 1px solid var(--ti-grid-body-td-border-color);
468476
}
469477

@@ -1113,13 +1121,12 @@
11131121
height: 72px;
11141122

11151123
.@{grid-prefix-cls}-cell__valid {
1116-
--td-padding-x: 8px;
11171124
position: absolute;
11181125
top: auto;
11191126
right: auto;
11201127
bottom: 1px;
1121-
left: var(--td-padding-x);
1122-
width: calc(100% - 2 * var(--td-padding-x));
1128+
left: var(--ti-grid-td-padding-horizontal);
1129+
width: calc(100% - 2 * var(--ti-grid-td-padding-horizontal));
11231130
height: 16px;
11241131
line-height: 1;
11251132
transform: translate(0, 0);
@@ -1128,10 +1135,12 @@
11281135
overflow: hidden;
11291136
text-overflow: ellipsis;
11301137
white-space: nowrap;
1131-
color: #f5222d;
1138+
color: var(--ti-grid-error-color);
11321139

11331140
.@{grid-prefix-cls}-cell__valid-icon {
11341141
margin-right: 8px;
1142+
fill: var(--ti-grid-error-color);
1143+
font-size: 16px;
11351144
}
11361145

11371146
.@{grid-prefix-cls}-cell__valid-msg {

packages/vue/src/grid-toolbar/src/custom.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@
136136
class="tiny-grid-custom__footer"
137137
:dir="TinyTheme === 'saas' ? 'rtl' : 'ltr'"
138138
>
139-
<tiny-button type="primary" @click="saveSettings" :disabled="saveDisabled">
140-
{{ t('ui.grid.individuation.saveBtn') }}
141-
</tiny-button>
142139
<tiny-button @click="handleReset">
143140
{{ t('ui.grid.individuation.resetBtn') }}
144141
</tiny-button>
@@ -148,6 +145,9 @@
148145
<tiny-button @click="cancelSettings">
149146
{{ t('ui.grid.individuation.cancelBtn') }}
150147
</tiny-button>
148+
<tiny-button type="primary" @click="saveSettings" :disabled="saveDisabled">
149+
{{ t('ui.grid.individuation.saveBtn') }}
150+
</tiny-button>
151151
</div>
152152
</div>
153153
</template>

0 commit comments

Comments
 (0)