@webitel/ui-sdk 3.1.6 → 3.1.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/dist/ui-sdk.common.js +5761 -1
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +5761 -1
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +27 -4
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/index.js +2 -0
- package/src/components/organisms/wt-page-header/__tests__/wt-page-header.spec.js +9 -0
- package/src/components/organisms/wt-page-header/wt-page-header.vue +74 -0
- package/src/modules/CardStoreModule/composables/useCardStore.js +40 -0
- package/src/modules/TableStoreModule/composables/useTableStore.js +68 -0
- /package/src/{store/BaseStoreModules → modules/CardStoreModule/store}/CardStoreModule.js +0 -0
- /package/src/{store/BaseStoreModules → modules/TableStoreModule/store}/TableStoreModule.js +0 -0
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import WtTable from './organisms/wt-table/wt-table.vue';
|
|
|
53
53
|
import WtTableActions from './organisms/wt-table-actions/wt-table-actions.vue';
|
|
54
54
|
import WtTableColumnSelect from './organisms/wt-table-column-select/wt-table-column-select.vue';
|
|
55
55
|
import WtIconAction from './organisms/wt-icon-action/wt-icon-action.vue';
|
|
56
|
+
import WtPageHeader from './organisms/wt-page-header/wt-page-header.vue';
|
|
56
57
|
|
|
57
58
|
const Components = {
|
|
58
59
|
WtAvatar,
|
|
@@ -107,6 +108,7 @@ const Components = {
|
|
|
107
108
|
WtCopyAction,
|
|
108
109
|
WtLoadBar,
|
|
109
110
|
WtIconAction,
|
|
111
|
+
WtPageHeader,
|
|
110
112
|
};
|
|
111
113
|
|
|
112
114
|
export default Components;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import WtPageHeader from '../wt-page-header.vue';
|
|
3
|
+
|
|
4
|
+
describe('WtPageHeader', () => {
|
|
5
|
+
it('renders a component', () => {
|
|
6
|
+
const wrapper = shallowMount(WtPageHeader);
|
|
7
|
+
expect(wrapper.isVisible()).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-headline>
|
|
3
|
+
<template v-slot:title-wrapper>
|
|
4
|
+
<slot>
|
|
5
|
+
<template slot="title">
|
|
6
|
+
<slot name="title"></slot>
|
|
7
|
+
</template>
|
|
8
|
+
</slot>
|
|
9
|
+
</template>
|
|
10
|
+
<template v-slot:actions>
|
|
11
|
+
<slot name="actions"></slot>
|
|
12
|
+
<slot name="primary-action">
|
|
13
|
+
<wt-button
|
|
14
|
+
v-if="!hidePrimary"
|
|
15
|
+
:disabled="primaryDisabled"
|
|
16
|
+
@click="primaryAction"
|
|
17
|
+
>
|
|
18
|
+
{{ primaryText || t('reusable.add') }}
|
|
19
|
+
</wt-button>
|
|
20
|
+
</slot>
|
|
21
|
+
<wt-button
|
|
22
|
+
v-if="!hideSecondary"
|
|
23
|
+
color="secondary"
|
|
24
|
+
@click="secondaryAction"
|
|
25
|
+
>
|
|
26
|
+
{{ t('reusable.delete') }}
|
|
27
|
+
</wt-button>
|
|
28
|
+
</template>
|
|
29
|
+
</wt-headline>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup>
|
|
33
|
+
import { useI18n } from 'vue-i18n';
|
|
34
|
+
import { computed } from 'vue';
|
|
35
|
+
|
|
36
|
+
const { t } = useI18n();
|
|
37
|
+
|
|
38
|
+
const props = defineProps({
|
|
39
|
+
hidePrimary: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
primaryText: {
|
|
44
|
+
type: String,
|
|
45
|
+
},
|
|
46
|
+
primaryAction: {
|
|
47
|
+
type: Function,
|
|
48
|
+
},
|
|
49
|
+
primaryDisabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
secondaryText: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
secondaryAction: {
|
|
57
|
+
type: Function,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const hideSecondary = computed(() => !(props.secondaryAction || props.secondaryText));
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
.wt-headline {
|
|
66
|
+
.wt-button {
|
|
67
|
+
margin-left: var(--spacing-sm);
|
|
68
|
+
|
|
69
|
+
&:first-child {
|
|
70
|
+
margin-left: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useStore } from 'vuex';
|
|
3
|
+
import getNamespacedState
|
|
4
|
+
from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
7
|
+
export const useCardStore = (namespace) => {
|
|
8
|
+
const store = useStore();
|
|
9
|
+
|
|
10
|
+
const cardNamespace = `${namespace}/card`;
|
|
11
|
+
|
|
12
|
+
const id = computed(() => getNamespacedState(store.state, cardNamespace).itemId);
|
|
13
|
+
const itemInstance = computed(() => getNamespacedState(store.state, cardNamespace).itemInstance);
|
|
14
|
+
|
|
15
|
+
function loadItem(payload) {
|
|
16
|
+
return store.dispatch(`${cardNamespace}/LOAD_ITEM`, payload);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function addItem(payload) {
|
|
20
|
+
return store.dispatch(`${cardNamespace}/ADD_ITEM`, payload);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function updateItem(payload) {
|
|
24
|
+
return store.dispatch(`${cardNamespace}/UPDATE_ITEM`, payload);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function setId(payload) {
|
|
28
|
+
return store.dispatch(`${cardNamespace}/SET_ITEM_ID`, payload);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
id,
|
|
33
|
+
itemInstance,
|
|
34
|
+
|
|
35
|
+
loadItem,
|
|
36
|
+
addItem,
|
|
37
|
+
updateItem,
|
|
38
|
+
setId,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useStore } from 'vuex';
|
|
3
|
+
import getNamespacedState
|
|
4
|
+
from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
7
|
+
export const useTableStore = (namespace) => {
|
|
8
|
+
const store = useStore();
|
|
9
|
+
|
|
10
|
+
const tableNamespace = `${namespace}/table`;
|
|
11
|
+
|
|
12
|
+
const dataList = computed(() => getNamespacedState(store.state, tableNamespace).dataList);
|
|
13
|
+
|
|
14
|
+
const isLoaded = computed(() => getNamespacedState(store.state, tableNamespace).isLoading);
|
|
15
|
+
|
|
16
|
+
const headers = computed(() => getNamespacedState(store.state, tableNamespace).headers);
|
|
17
|
+
|
|
18
|
+
const isNext = computed(() => getNamespacedState(store.state, tableNamespace).isNext);
|
|
19
|
+
|
|
20
|
+
const page = computed(() => getNamespacedState(store.state, tableNamespace).page);
|
|
21
|
+
|
|
22
|
+
const size = computed(() => getNamespacedState(store.state, tableNamespace).size);
|
|
23
|
+
|
|
24
|
+
async function loadData() {
|
|
25
|
+
await store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function setSize(payload) {
|
|
29
|
+
await store.dispatch(`${tableNamespace}/SET_SIZE`, payload);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function nextPage() {
|
|
33
|
+
await store.dispatch(`${tableNamespace}/SET_NEXT_PAGE`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function prevPage() {
|
|
37
|
+
await store.dispatch(`${tableNamespace}/PREV_PAGE`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function patchProperty(payload) {
|
|
41
|
+
await store.dispatch(`${tableNamespace}/PATCH_ITEM_PROPERTY`, payload);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function deleteItem(payload) {
|
|
45
|
+
await store.dispatch(`${tableNamespace}/DELETE_ITEM`, payload);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function sort(...params) {
|
|
49
|
+
await store.dispatch(`${tableNamespace}/SORT`, { header: params[0], nextSortOrder: params[1] });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
dataList,
|
|
54
|
+
isLoaded,
|
|
55
|
+
headers,
|
|
56
|
+
isNext,
|
|
57
|
+
page,
|
|
58
|
+
size,
|
|
59
|
+
|
|
60
|
+
loadData,
|
|
61
|
+
setSize,
|
|
62
|
+
nextPage,
|
|
63
|
+
prevPage,
|
|
64
|
+
patchProperty,
|
|
65
|
+
deleteItem,
|
|
66
|
+
sort,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
File without changes
|
|
File without changes
|