diff --git a/package.json b/package.json index e35b80cd..08febb60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soramitsu/soramitsu-js-ui", - "version": "0.7.6", + "version": "0.7.7", "private": false, "publishConfig": { "registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/" diff --git a/src/components/Card/SCard.vue b/src/components/Card/SCard.vue index 81810fbc..ccc9ed4b 100644 --- a/src/components/Card/SCard.vue +++ b/src/components/Card/SCard.vue @@ -16,6 +16,7 @@ import { Component, Mixins, Prop } from 'vue-property-decorator' import BorderRadiusMixin from '../../mixins/BorderRadiusMixin' import { CardShadow } from './consts' +import { BorderRadius } from '@/types' @Component export default class SCard extends Mixins(BorderRadiusMixin) { @@ -42,6 +43,8 @@ export default class SCard extends Mixins(BorderRadiusMixin) { */ @Prop({ default: false, type: Boolean }) readonly clickable!: boolean + @Prop({ default: BorderRadius.MEDIUM }) borderRadius!: string + get computedClasses (): Array { const cssClasses: Array = [] if (this.isStandardBorderRadius) { diff --git a/src/components/DatePicker/SDatePicker.vue b/src/components/DatePicker/SDatePicker.vue index deb95519..b000da54 100644 --- a/src/components/DatePicker/SDatePicker.vue +++ b/src/components/DatePicker/SDatePicker.vue @@ -8,6 +8,7 @@ :unlink-panels="unlinkPanels" :readonly="readonly" :disabled="disabled" + :size="size" :editable="editable" :clearable="willHaveClearButton" :placeholder="placeholder" @@ -35,15 +36,18 @@ diff --git a/src/components/Table/STableColumn.vue b/src/components/Table/STableColumn.vue index 1ca47e3a..f66436e2 100644 --- a/src/components/Table/STableColumn.vue +++ b/src/components/Table/STableColumn.vue @@ -5,7 +5,7 @@ :label="label" :column-key="columnKey" :prop="prop" - :width="width" + :width="computedWidth" :min-width="minWidth" :fixed="fixedPosition || false" :render-header="renderHeader" @@ -18,7 +18,7 @@ :show-overflow-tooltip="showOverflowTooltip" :align="align" :header-align="headerAlign" - :class-name="headerAlign" + :class-name="className" :label-class-name="labelClassName" :selectable="selectable" :reserve-selection="reserveSelection" @@ -34,9 +34,11 @@ diff --git a/src/index.ts b/src/index.ts index 425c8e9b..21cf9d37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,6 +54,7 @@ import { Directives } from './types/directives' import { modules, Modules } from './store' import { setTheme } from './utils' import { Loading, Message, MessageBox, Notification } from './plugins/elementUI' +import { SDialogMixin } from './mixins' const components = [ { component: SApp, name: Components.SApp }, @@ -177,6 +178,7 @@ export { STabs, STable, STableColumn, - STooltip + STooltip, + SDialogMixin } export default SoramitsuElements diff --git a/src/mixins/SDialogMixin.ts b/src/mixins/SDialogMixin.ts new file mode 100644 index 00000000..17782ba5 --- /dev/null +++ b/src/mixins/SDialogMixin.ts @@ -0,0 +1,23 @@ +import { Vue, Component, Prop, Watch } from 'vue-property-decorator' + +@Component +export default class SDialogMixin extends Vue { + /** + * Dialog visibility + * + * `false` by default + */ + @Prop({ type: Boolean, default: false, required: true }) readonly visible!: boolean + + isVisible = this.visible + + @Watch('visible') + public handleVisibleChange (value: boolean): void { + this.isVisible = value + } + + @Watch('isVisible') + public handleIsVisibleChange (value: boolean): void { + this.$emit('update:visible', value) + } +} diff --git a/src/mixins/index.ts b/src/mixins/index.ts new file mode 100644 index 00000000..a6a993ad --- /dev/null +++ b/src/mixins/index.ts @@ -0,0 +1,9 @@ +import SDialogMixin from './SDialogMixin' +import BorderRadiusMixin from './BorderRadiusMixin' +import SizeMixin from './SizeMixin' + +export { + SDialogMixin, + BorderRadiusMixin, + SizeMixin +} diff --git a/src/stories/SDatePicker.stories.ts b/src/stories/SDatePicker.stories.ts index 59fb117a..5926fca6 100644 --- a/src/stories/SDatePicker.stories.ts +++ b/src/stories/SDatePicker.stories.ts @@ -1,7 +1,7 @@ import { withKnobs, select, boolean } from '@storybook/addon-knobs' import { SDatePicker, SRow, SCol } from '../components' -import { BorderRadius } from '../types' +import { Size, BorderRadius } from '../types' import { PickerAlignment, PickerTypes, InputTypes } from '../components/DatePicker' export default { @@ -20,6 +20,7 @@ export const configurable = () => ({ :type="type" :readonly="readonly" :disabled="disabled" + :size="size" :clearable="clearable" :align="align" :border-radius="borderRadius" @@ -58,6 +59,9 @@ export const configurable = () => ({ disabled: { default: boolean('Disabled', false) }, + size: { + default: select('Size', Object.values(Size), Size.BIG) + }, clearable: { default: boolean('Clearable', true) }, diff --git a/src/stories/Select/SSelect.stories.ts b/src/stories/Select/SSelect.stories.ts index b901094f..55959c2c 100644 --- a/src/stories/Select/SSelect.stories.ts +++ b/src/stories/Select/SSelect.stories.ts @@ -1,7 +1,7 @@ import { text, withKnobs, boolean, number, select } from '@storybook/addon-knobs' import { SSelect, SRow, SCol, SOption } from '../../components' -import { BorderRadius } from '../../types' +import { Size, BorderRadius } from '../../types' import { InputTypes } from '../../components/Select' export default { @@ -28,6 +28,7 @@ export const configurable = () => ({ :disabled="disabled" :border-radius="borderRadius" :loading="loading" + :size="size" :multiple="multiple" :input-type="item.inputType" :clearable="clearable" @@ -63,6 +64,9 @@ export const configurable = () => ({ loading: { default: boolean('Loading', false) }, + size: { + default: select('Size', Object.values(Size), Size.BIG) + }, multiple: { default: boolean('Multiple', false) }, diff --git a/src/styles/datepicker.scss b/src/styles/datepicker.scss index ccaca164..b2cfe8e3 100644 --- a/src/styles/datepicker.scss +++ b/src/styles/datepicker.scss @@ -15,10 +15,30 @@ } } +$date-picker-padding: 8px; + .s-date-picker { font-family: $s-font-family-default; width: 100%; position: relative; + &.s-big .el-input__inner { + height: $s-size-big; + .el-range-separator { + line-height: $s-size-big - $date-picker-padding; + } + } + &.s-medium .el-input__inner { + height: $s-size-medium; + .el-range-separator { + line-height: $s-size-medium - $date-picker-padding; + } + } + &.s-small .el-input__inner { + height: $s-size-small; + .el-range-separator { + line-height: $s-size-small - $date-picker-padding; + } + } .el-date-editor { width: 100%; &.el-input, @@ -52,9 +72,7 @@ } } &.s-input-type { - min-height: $s-size-big; .el-input__inner { - height: $s-size-big; padding: 0 15px; border: 1px solid var(--s-color-base-background); background-color: var(--s-color-base-background); @@ -134,7 +152,7 @@ .s-icon-chevron-bottom { position: absolute; right: 10px; - top: 30%; + top: calc(50% - 8px); pointer-events: none; color: var(--s-color-base-content-tertiary); transition: transform 0.3s; diff --git a/src/styles/select.scss b/src/styles/select.scss index bc9cdce0..e1e1db04 100644 --- a/src/styles/select.scss +++ b/src/styles/select.scss @@ -27,6 +27,15 @@ $select-prefix-height: $s-size-mini; @include select-border-radius("medium", var(--s-border-radius-medium)); @include select-border-radius("small", var(--s-border-radius-small)); @include select-border-radius("mini", var(--s-border-radius-mini)); + &.s-big .el-input__inner { + height: $s-size-big; + } + &.s-medium .el-input__inner { + height: $s-size-medium; + } + &.s-small .el-input__inner { + height: $s-size-small; + } .el-select { width: 100%; i.el-icon-arrow-up { diff --git a/src/styles/table.scss b/src/styles/table.scss index 9c85d481..921f210a 100644 --- a/src/styles/table.scss +++ b/src/styles/table.scss @@ -22,6 +22,14 @@ } } } +.el-table:not(.el-table--border) th > .cell, +.el-table:not(.el-table--border) td > .cell { + padding-left: 16px; + padding-right: 16px; +} +.el-table:not(.el-table--border) .el-table-column--selection > .cell { + padding-right: 0; +} .el-table--border th:first-child .cell, .el-table--border td:first-child .cell { padding-left: 13px; @@ -108,6 +116,11 @@ border-color: var(--s-color-theme-accent); } .el-table__expand-icon { + position: absolute; + height: 100%; + width: 100%; + left: 0; + top: 0; > .el-icon.el-icon-arrow-right { font-family: $s-font-family-icons; @extend .s-icon-chevron-bottom;