Skip to content

Commit

Permalink
fix(datepicker, table, theme): fix datepicker style bug, update theme…
Browse files Browse the repository at this point in the history
… and table

update theme setting for now version, fix datepicker style bug and daterange co
  • Loading branch information
luchunyu committed Sep 27, 2018
1 parent 5985142 commit 4588185
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 9 deletions.
5 changes: 2 additions & 3 deletions docs/content/component/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Clair 使用的完整 CSS 变量列表,请 [查看 github 代码](https://gith
在你的项目 CSS 入口文件(比如 `main.css`)中,引入 Clair 及其组件样式。

```css
@import url('clair/src/css/main.css');
@import url('clair/src/components/**/*.css');
@import url('clair/src/styles/main.css');
```

### 3. 配置 PostCSS 插件
Expand All @@ -57,7 +56,7 @@ module.exports = {
const cwd = process.cwd()
// 将 theme.css 指向你的项目中的 CSS 变量配置文件
if (id === './theme.css') return resolve(cwd, 'src/css/theme.css')
if (/^clair/.test(id)) return glob.sync(join(cwd, 'node_modules', id))
if (/\*\*/.test(id)) return glob.sync(join(cwd, 'node_modules/clair/src/styles/', id))
return id
}
},
Expand Down
7 changes: 5 additions & 2 deletions src/components/datepicker/daterange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ export default {
this.$emit('change', this.value)
},
confirmRange () {
this.end = this.end || this.rangeObj.endDate
this.$emit('change', [this.start, this.end])
if (this.start && this.end) {
this.$emit('change', [this.start, this.end])
} else {
this.cancel()
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/datepicker/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
}

.c-datepicker__panel {
border: 1px solid rgb(214, 217, 219);
box-shadow: 2px 2px 0.5em 0 color(var(--gray) l(95%));
overflow: hidden;

&.withBorder {
border: 1px solid rgb(214, 217, 219);
border-radius: 0.2em;
}

& .c-calendar {
border: 0;
box-shadow: none;
Expand Down
2 changes: 1 addition & 1 deletion src/components/datepicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

.c-datepicker__panel(
ref="datepickerPanel"
:class="{'withSidebar': (optionList.length > 0 || hasSidebarSlot) }")
:class="{'withSidebar': (optionList.length > 0 || hasSidebarSlot) && isOpen == true, 'withBorder': isOpen == true }")
.c-datepicker__sidebar(v-if="(hasSidebarSlot || optionList.length > 0 )&& isOpen")
slot(name="dateSideBar"
:datepicker="datepicker")
Expand Down
5 changes: 3 additions & 2 deletions src/components/table/base-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ table
v-for="columnsItem,colIndex in allColumns"
:style="getCellStyle(columnsItem)"
:class="getColumnClassName(columnsItem)"
@click="openExpand(dataItem, columnsItem)"
@click="openExpand(dataItem, columnsItem, index, colIndex)"
:colspan="tdSpanMethod(dataItem, columnItem, index, colIndex).colspan"
:rowspan="tdSpanMethod(dataItem, columnItem, index, colIndex).rowspan"
v-if="tdSpanMethod(dataItem, columnItem, index, colIndex).rowspan && tdSpanMethod(dataItem, columnItem, index, colIndex).colspan"
Expand Down Expand Up @@ -165,9 +165,10 @@ export default {
colspan
}
},
openExpand (dataItem, columnsItem) {
openExpand (dataItem, columnsItem, index, colIndex) {
if (columnsItem.type !== 'expand') return
dataItem._showExpand = !dataItem._showExpand
this.$emit('openExpand', dataItem, index)
},
getRowClassName (row, rowIndex) {
const classes = []
Expand Down
7 changes: 7 additions & 0 deletions src/components/table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,20 @@ p {
:columns="columns"
:datasource="datasource"
:expand="hasExpand"
@openExpand="openExpand"
>
<p slot="expand" slot-scope="props">
32324--{{props.row.type}}
</p>
</c-table>
<script>
export default {
methods: {
openExpand (item, index) {
alert(index)
console.log(item)
}
},
data () {
return {
hasExpand: true,
Expand Down
4 changes: 4 additions & 0 deletions src/components/table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mixin Table(columns, onlyhead, onlybody)
@selectAllChange="onSelectAllChange"
@rowEnter="rowEnter"
@rowLeave="rowLeave"
@openExpand="onOpenExpand"
:expand="expand"
:spanMethod="spanMethod"
)
Expand Down Expand Up @@ -217,6 +218,9 @@ export default {
},
methods: {
onOpenExpand (item, index) {
this.$emit('openExpand', item, index)
},
updateSelectAll (status) {
this.allChecked = status
this.dataList = this.dataList.map(item => {
Expand Down

0 comments on commit 4588185

Please sign in to comment.