@dataloop-ai/components 0.16.6 → 0.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -26
- package/package.json +2 -2
- package/src/components/basic/DlKpi/DlKpi.vue +17 -9
- package/src/components/compound/DlCounters/DlCounters.vue +9 -2
- package/src/components/compound/DlItem/index.ts +1 -1
- package/src/components/essential/DlTypography/DlTypography.vue +3 -0
- package/src/demo/DlCounterDemo.vue +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,38 @@
|
|
|
1
1
|
# [Dataloop Components Library](https://dataloop-ai.github.io/components/)  
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Welcome to the Dataloop Components Library, which contains custom-made Vue components for the Dataloop platform and apps use. The Vue components are written using the Vue3 composition API and can be used in Vue2 projects as well, as long as you install vue-demi. You can find our documentation with our Storybook link [here](https://dataloop-ai.github.io/components/).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
You can see our documentation with our storybook link [here](https://dataloop-ai.github.io/components/)
|
|
5
|
+
## Release Status
|
|
6
|
+
The current release status is beta. You can check the latest library version by looking at the shield above or by visiting our npm page.
|
|
8
7
|
|
|
9
8
|
## Development
|
|
10
9
|
|
|
11
|
-
Working
|
|
12
|
-
|
|
13
|
-
The repository has automatic lint on staged files and run tests. if any were to fail then the commit itself will fail too.
|
|
10
|
+
Working with this repository is straightforward, as it already has hooks set up to guarantee high code quality. The repository has automatic linting on staged files and runs tests. If any tests fail, the commit itself will fail too
|
|
14
11
|
|
|
15
12
|
### Using Components in other projects
|
|
16
|
-
|
|
13
|
+
Using our components is simple: just install the npm package and import them normally into your Vue app. If you're working on a Vue2 project, make sure to install @vue/composition-api.
|
|
17
14
|
|
|
18
|
-
make sure you if you are on vue2 project to install @vue/composition-api
|
|
19
15
|
|
|
20
16
|
### Adding new Components
|
|
21
|
-
|
|
22
|
-
the pull request must contain the following in order for it to be approved
|
|
17
|
+
To add new components, you are required to open a pull request. The pull request must contain the following to be approved:
|
|
23
18
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
19
|
+
- The component Vue file
|
|
20
|
+
- The story relating to the component (for Storybook integration)
|
|
21
|
+
- Tests for the component
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
Any pull requests with missing requirements will not be approved.
|
|
29
24
|
|
|
30
25
|
## Scripts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
the launch.json file contains 3 main configs
|
|
26
|
+
The work environment is set up to be used on Visual Studio Code.
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
2. running a storybook server to view the stories
|
|
37
|
-
3. running tests
|
|
28
|
+
The launch.json file contains three main configurations:
|
|
38
29
|
|
|
39
|
-
|
|
30
|
+
1. Running a Vite server to simulate the Vue3 environment
|
|
31
|
+
2. Running a Storybook server to view the stories
|
|
32
|
+
3. Running tests
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
2. npm run storybook ( for storybook server )
|
|
43
|
-
3. npm run test ( for tests )
|
|
34
|
+
You can also access these commands by running the following:
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
1. npm run dev (for the Vite server)
|
|
37
|
+
2. npm run storybook (for the Storybook server)
|
|
38
|
+
3. npm run test (for running tests)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataloop-ai/components",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.8",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./index.ts",
|
|
6
6
|
"./models": "./models.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dataloop-ai/icons": "^3.0.
|
|
25
|
+
"@dataloop-ai/icons": "^3.0.6",
|
|
26
26
|
"@types/lodash": "^4.14.184",
|
|
27
27
|
"chart.js": "^3.9.1",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
@@ -72,8 +72,8 @@ export default defineComponent({
|
|
|
72
72
|
},
|
|
73
73
|
props: {
|
|
74
74
|
counter: {
|
|
75
|
-
type: Object as PropType<DlKpiCounterType
|
|
76
|
-
default: () => ({})
|
|
75
|
+
type: Object as PropType<DlKpiCounterType>,
|
|
76
|
+
default: () => ({} as DlKpiCounterType)
|
|
77
77
|
},
|
|
78
78
|
counterFontSize: {
|
|
79
79
|
type: String,
|
|
@@ -107,7 +107,7 @@ export default defineComponent({
|
|
|
107
107
|
},
|
|
108
108
|
progress: {
|
|
109
109
|
type: Object as PropType<DlKpiProgressType>,
|
|
110
|
-
default: () => ({})
|
|
110
|
+
default: () => ({} as DlKpiProgressType)
|
|
111
111
|
},
|
|
112
112
|
withBorder: {
|
|
113
113
|
type: Boolean,
|
|
@@ -119,7 +119,7 @@ export default defineComponent({
|
|
|
119
119
|
default: false,
|
|
120
120
|
required: false
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
small: {
|
|
123
123
|
type: Boolean,
|
|
124
124
|
default: false,
|
|
125
125
|
required: false
|
|
@@ -132,17 +132,25 @@ export default defineComponent({
|
|
|
132
132
|
|
|
133
133
|
const emptyString = '---'
|
|
134
134
|
|
|
135
|
+
const isSingleWord = (text: string) => text.split(' ').length === 1
|
|
136
|
+
|
|
135
137
|
const cssVars = computed(() => {
|
|
136
138
|
return {
|
|
137
|
-
'--dl-kpi-border': props.withBorder ? '1px solid #e4e4e4' : ''
|
|
139
|
+
'--dl-kpi-border': props.withBorder ? '1px solid #e4e4e4' : '',
|
|
140
|
+
'--dl-kpi-title-max-width': isSingleWord(props.title)
|
|
141
|
+
? '100%'
|
|
142
|
+
: '90%', // todo: caused a bug with single words
|
|
143
|
+
'--dl-kpi-sub-title-max-width': isSingleWord(props.subtitle)
|
|
144
|
+
? '100%'
|
|
145
|
+
: '90%'
|
|
138
146
|
}
|
|
139
147
|
})
|
|
140
148
|
|
|
141
149
|
const counterFontSizeComputed = computed(() =>
|
|
142
|
-
props.
|
|
150
|
+
props.small ? '20px' : props.counterFontSize
|
|
143
151
|
)
|
|
144
152
|
const titleFontSizeComputed = computed(() =>
|
|
145
|
-
props.
|
|
153
|
+
props.small ? '14px' : props.titleFontSize
|
|
146
154
|
)
|
|
147
155
|
|
|
148
156
|
const formatCounter = (counter: DlKpiCounterType) => {
|
|
@@ -243,7 +251,7 @@ export default defineComponent({
|
|
|
243
251
|
&__text {
|
|
244
252
|
display: flex;
|
|
245
253
|
flex-direction: row;
|
|
246
|
-
max-width:
|
|
254
|
+
max-width: var(--dl-kpi-title-max-width);
|
|
247
255
|
max-height: 40px;
|
|
248
256
|
font-style: normal;
|
|
249
257
|
font-weight: 400;
|
|
@@ -255,7 +263,7 @@ export default defineComponent({
|
|
|
255
263
|
gap: 10px;
|
|
256
264
|
}
|
|
257
265
|
&__subtext {
|
|
258
|
-
max-width:
|
|
266
|
+
max-width: var(--dl-kpi-sub-title-max-width);
|
|
259
267
|
max-height: 40px;
|
|
260
268
|
font-style: normal;
|
|
261
269
|
font-weight: 400;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
>
|
|
13
13
|
<div :class="computeClass('item-content')">
|
|
14
14
|
<dl-kpi
|
|
15
|
-
:counter="item.value"
|
|
15
|
+
:counter="kpiValue(item.value)"
|
|
16
16
|
counter-font-size="30px"
|
|
17
17
|
:title="capitalize(item.text)"
|
|
18
18
|
title-font-size="16px"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
subtitle-font-size="12px"
|
|
21
21
|
:info-message="null"
|
|
22
22
|
:progress="null"
|
|
23
|
-
:
|
|
23
|
+
:small="small"
|
|
24
24
|
/>
|
|
25
25
|
</div>
|
|
26
26
|
<div class="divider" />
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import { v4 } from 'uuid'
|
|
34
34
|
import { defineComponent, PropType } from 'vue-demi'
|
|
35
35
|
import { DlKpi } from '../../basic'
|
|
36
|
+
import { DlKpiCounterFormat } from '../../types'
|
|
36
37
|
|
|
37
38
|
interface CounterItem {
|
|
38
39
|
value?: number
|
|
@@ -84,6 +85,12 @@ export default defineComponent({
|
|
|
84
85
|
},
|
|
85
86
|
computeClass(value: string): (string | boolean)[] {
|
|
86
87
|
return [value, this.small && `${value}--small`]
|
|
88
|
+
},
|
|
89
|
+
kpiValue(value: string | number) {
|
|
90
|
+
return {
|
|
91
|
+
value: value ?? 0,
|
|
92
|
+
format: DlKpiCounterFormat.long
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import DlItem from './DlItem.vue'
|
|
2
|
-
export
|
|
2
|
+
export { DlItem }
|