Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6417531
Fix button loading icon position
stefashkaa Aug 1, 2020
9778d84
Update version
stefashkaa Aug 1, 2020
da4ec4e
Fix input v-model
stefashkaa Aug 1, 2020
fd7d4ff
Fix checkbox v-model
stefashkaa Aug 1, 2020
b5412c7
Add icon
stefashkaa Aug 2, 2020
269caba
Add breadcrumb components
stefashkaa Aug 2, 2020
6a11995
Fix stories config
stefashkaa Aug 2, 2020
709cf3a
Add stories for breadcrumbs
stefashkaa Aug 2, 2020
938fb8b
Merge pull request #32 from soramitsu/fix/button-loading
stefashkaa Aug 3, 2020
4dc726c
Merge branch 'develop' into feature/breadcrumbs
stefashkaa Aug 3, 2020
5db8d44
Merge pull request #35 from soramitsu/feature/breadcrumbs
stefashkaa Aug 3, 2020
5afaca7
Merge branch 'develop' into fix/input
stefashkaa Aug 3, 2020
5a37e8b
Add more visible results
stefashkaa Aug 3, 2020
3f3d315
Merge pull request #33 from soramitsu/fix/input
stefashkaa Aug 3, 2020
39a0ebe
Merge branch 'develop' into fix/checkbox
stefashkaa Aug 3, 2020
85ae8b9
Add more visible logs
stefashkaa Aug 3, 2020
c6d6e56
Merge pull request #34 from soramitsu/fix/checkbox
stefashkaa Aug 3, 2020
cb7e2eb
Add clickable prop to card component
stefashkaa Aug 4, 2020
752b70d
Fix change visible event for dropdown component
stefashkaa Aug 4, 2020
da5082f
Modify card story
stefashkaa Aug 4, 2020
e63eec1
Fix cursor style
stefashkaa Aug 4, 2020
25f324a
Merge pull request #36 from soramitsu/feature/clickable-card
stefashkaa Aug 4, 2020
893466c
Add table template
stefashkaa Aug 4, 2020
2742795
Add table column component
stefashkaa Aug 5, 2020
26bfcd1
Add story for table component
stefashkaa Aug 5, 2020
bb2f0e0
Modify table component
stefashkaa Aug 5, 2020
f5099f5
Add types for table component
stefashkaa Aug 5, 2020
d597cbc
Fix code style
stefashkaa Aug 5, 2020
e67f253
Modify styles
stefashkaa Aug 5, 2020
f13bfb6
Complete table component
stefashkaa Aug 5, 2020
f5bbe19
Fix issues
stefashkaa Aug 5, 2020
4e716a1
Finish story for table component
stefashkaa Aug 5, 2020
98c445e
Add new stories for Table component
stefashkaa Aug 5, 2020
0a0b217
Add docs
stefashkaa Aug 6, 2020
de3a3eb
Add table column stories
stefashkaa Aug 6, 2020
7aaa86f
Modify table component
stefashkaa Aug 6, 2020
325141c
Add exports
stefashkaa Aug 6, 2020
77af5ed
Merge pull request #37 from soramitsu/feature/table
stefashkaa Aug 6, 2020
8aa7c6a
Merge branch 'develop' into release/0.2.5
stefashkaa Aug 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@soramitsu/soramitsu-js-ui",
"version": "0.2.4",
"version": "0.2.5",
"private": false,
"publishConfig": {
"registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/"
Expand Down
25 changes: 25 additions & 0 deletions src/components/Breadcrumb/SBreadcrumb.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<el-breadcrumb :separator="separator">
<slot></slot>
</el-breadcrumb>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'

@Component
export default class SBreadcrumb extends Vue {
/**
* Separator character of the breadcrumb component
*/
@Prop({ default: '/', type: String }) readonly separator!: string
}
</script>

<style lang="scss">
@import "../../styles/variables.scss";
.el-breadcrumb__separator {
color: $color-neutral-secondary;
font-weight: normal;
}
</style>
40 changes: 40 additions & 0 deletions src/components/Breadcrumb/SBreadcrumbItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<el-breadcrumb-item
:to="to"
:replace="replace"
>
<slot></slot>
</el-breadcrumb-item>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'

@Component
export default class SBreadcrumbItem extends Vue {
/**
* Target route of the link, same as to of `vue-router`
*/
@Prop({ default: '' }) readonly to!: any
/**
* If `true`, the navigation will not leave a history record.
*
* `false` by default
*/
@Prop({ default: false, type: Boolean }) readonly replace!: boolean
}
</script>

<style lang="scss">
@import "../../styles/variables.scss";
.el-breadcrumb__inner {
color: $color-neutral-secondary;
&.is-link {
color: $color-neutral-secondary;
font-weight: normal;
}
}
.el-breadcrumb__item:last-child {
pointer-events: none;
}
</style>
4 changes: 4 additions & 0 deletions src/components/Breadcrumb/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import SBreadcrumb from './SBreadcrumb.vue'
import SBreadcrumbItem from './SBreadcrumbItem.vue'

export { SBreadcrumb, SBreadcrumbItem }
34 changes: 30 additions & 4 deletions src/components/Button/SButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:native-type="nativeType"
:size="computedSize"
:class="computedClasses"
:style="computedStyles"
:disabled="disabled"
:loading="isLoading"
:autofocus="autofocus"
Expand Down Expand Up @@ -84,6 +85,7 @@ export default class SButton extends Vue {
@Inject({ default: '', from: 'elForm' }) elForm!: ElForm
@Inject({ default: '', from: 'elFormItem' }) elFormItem!: ElFormItem

private iconLeftOffset = 0
elementIcon = ''

get computedSize (): string {
Expand Down Expand Up @@ -120,6 +122,14 @@ export default class SButton extends Vue {
return cssClasses
}

get computedStyles () {
const styles = {} as any
if (this.loading) {
styles['--s-button-loading-left'] = `${this.iconLeftOffset}px`
}
return styles
}

get availableIcon (): string {
if (!this.icon) {
return ''
Expand All @@ -143,6 +153,16 @@ export default class SButton extends Vue {
handleClick (): void {
this.$emit('click')
}

mounted (): void {
this.$watch('loading', (value) => {
if (!value) {
return
}
const el = this.$el.querySelector('span') as HTMLSpanElement
this.iconLeftOffset = el.offsetLeft + (el.offsetWidth / 2) - 10
}, { immediate: true })
}
}
</script>

Expand All @@ -151,12 +171,18 @@ export default class SButton extends Vue {

.loading {
padding: 12px 17.5px;
> :not(i) {
color: transparent;
}
i {
position: absolute;
left: 43%;
left: var(--s-button-loading-left);
}
&.small {
padding: 9px 15px;
i {
left: calc(var(--s-button-loading-left) + 2px);
}
}
> :not(i) {
color: transparent;
}
}

Expand Down
27 changes: 26 additions & 1 deletion src/components/Card/SCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<el-card
class="s-card"
:class="{ clickable }"
:header="header"
:body-style="bodyStyle"
:shadow="shadow"
Expand All @@ -11,7 +12,7 @@
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
import { Vue, Component, Prop } from 'vue-property-decorator'

import { CardShadow } from './consts'

Expand All @@ -33,6 +34,27 @@ export default class SCard extends Vue {
* By default, it's set to `"hover"`
*/
@Prop({ default: CardShadow.HOVER, type: String }) readonly shadow!: string
/**
* Clickable property of the Card component which means that the user can click on the card
*
* `false` by default
*/
@Prop({ default: false, type: Boolean }) readonly clickable!: boolean

handleClick (): void {
if (!this.clickable) {
return
}
this.$emit('click')
}

mounted (): void {
this.$el.addEventListener('click', this.handleClick)
}

destroyed (): void {
this.$el.removeEventListener('click', this.handleClick)
}
}
</script>

Expand All @@ -42,6 +64,9 @@ export default class SCard extends Vue {
.s-card {
border-radius: 8px;
border-color: $color-neutral-border;
&.clickable {
cursor: pointer;
}
&:hover, &:focus {
border-color: $color-basic-white;
}
Expand Down
17 changes: 15 additions & 2 deletions src/components/Checkbox/SCheckbox.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<el-checkbox
:class="computedClasses"
:value="value"
v-model="model"
:label="label"
:disabled="disabled"
:border="border"
Expand All @@ -16,7 +16,7 @@
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'

import { CheckboxSize } from './consts'

Expand Down Expand Up @@ -65,6 +65,19 @@ export default class SCheckbox extends Vue {
*/
@Prop({ default: false, type: Boolean }) readonly indeterminate!: boolean

model = this.value

@Watch('value')
private handlePropChange (value: string | number | boolean): void {
this.model = value
}

@Watch('model')
private handleValueChange (value: string | number | boolean): void {
this.$emit('input', value)
this.$emit('change', value)
}

get computedSize (): string {
if (this.size === CheckboxSize.BIG ||
!(Object.values(CheckboxSize) as Array<string>).includes(this.size)) {
Expand Down
9 changes: 7 additions & 2 deletions src/components/Dropdown/SDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@click="handleClick"
@command="handleSelect"
@visible-change="handleVisibleChange"
@click.native="handleVisibleEventChange"
>
<span v-if="type === DropdownType.DEFAULT || splitButton">
<slot></slot>
Expand Down Expand Up @@ -77,9 +78,9 @@ export default class SDropdown extends Vue {
/**
* A placement of the popup menu. You can use any value from `DropdownPlacement` enum.
*
* By default, it's set to `"bottom-end"`
* By default, it's set to `"bottom"`
*/
@Prop({ type: String, default: DropdownPlacement.BOTTOM_END }) readonly placement!: string
@Prop({ type: String, default: DropdownPlacement.BOTTOM }) readonly placement!: string
/**
* A trigger action of the dropdown component. Can be `"hover"` or `"click"`.
* When dropdown type is "ellipsis", `trigger = "click"`.
Expand Down Expand Up @@ -180,6 +181,10 @@ export default class SDropdown extends Vue {
handleVisibleChange (isAppear: boolean): void {
this.$emit('visible-change', isAppear)
}

handleVisibleEventChange (event: MouseEvent): void {
event.stopPropagation()
}
}
</script>

Expand Down
4 changes: 3 additions & 1 deletion src/components/Input/SInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/>
<template v-if="type === InputType.TEXT_FILE">
<i class="s-icon-file"></i>
<input type="file" :accept="accept" @change="handleTextFileChange">
<input :value="emptyValue" type="file" :accept="accept" @change="handleTextFileChange">
</template>
</div>
</template>
Expand All @@ -45,6 +45,7 @@ import { Autocomplete, InputType } from './consts'
@Component
export default class SInput extends Vue {
readonly InputType = InputType
readonly emptyValue = null
/**
* Type of input. It can be "text" or "textarea" or any native input type.
* `"text"` by default
Expand Down Expand Up @@ -129,6 +130,7 @@ export default class SInput extends Vue {

@Watch('model')
private handleValueChange (value: string | number): void {
this.$emit('input', value)
this.$emit('change', value)
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/Layout/App/SApp.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>
<s-container class="s-app">
<s-aside v-if="this.$slots.aside" :width="asideWidth">
<s-aside v-if="$slots.aside" :width="asideWidth">
<slot name="aside" />
</s-aside>
<s-container>
<s-header v-if="this.$slots.header" :height="headerHeight">
<s-header v-if="$slots.header" :height="headerHeight">
<slot name="header" />
</s-header>
<slot></slot>
<s-main v-if="this.$slots.main">
<s-main v-if="$slots.main">
<slot name="main" />
</s-main>
<s-footer v-if="this.$slots.footer" :height="footerHeight">
<s-footer v-if="$slots.footer" :height="footerHeight">
<slot name="footer" />
</s-footer>
</s-container>
Expand Down
Loading