@rws-framework/client 2.20.4 → 2.21.0
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/package.json +1 -1
- package/src/index.ts +1 -3
- package/src/components/index.ts +0 -26
- package/src/components/rws/line-splitter/component.ts +0 -117
- package/src/components/rws/line-splitter/styles/_tags.scss +0 -104
- package/src/components/rws/line-splitter/styles/layout.scss +0 -38
- package/src/components/rws/line-splitter/template.html +0 -1
- package/src/components/rws/loader/component.ts +0 -14
- package/src/components/rws/loader/styles/layout.scss +0 -14
- package/src/components/rws/loader/template.html +0 -1
- package/src/components/rws/progress/component.ts +0 -54
- package/src/components/rws/progress/styles/layout.scss +0 -91
- package/src/components/rws/progress/template.html +0 -25
- package/src/components/rws/reformer/component.ts +0 -58
- package/src/components/rws/reformer/fields/boolean/component.ts +0 -20
- package/src/components/rws/reformer/fields/boolean/styles/layout.scss +0 -5
- package/src/components/rws/reformer/fields/boolean/template.html +0 -6
- package/src/components/rws/reformer/fields/date/component.ts +0 -20
- package/src/components/rws/reformer/fields/date/styles/layout.scss +0 -5
- package/src/components/rws/reformer/fields/date/template.html +0 -7
- package/src/components/rws/reformer/fields/number/component.ts +0 -20
- package/src/components/rws/reformer/fields/number/styles/layout.scss +0 -5
- package/src/components/rws/reformer/fields/number/template.html +0 -7
- package/src/components/rws/reformer/fields/text/component.ts +0 -20
- package/src/components/rws/reformer/fields/text/styles/layout.scss +0 -5
- package/src/components/rws/reformer/fields/text/template.html +0 -7
- package/src/components/rws/reformer/styles/layout.scss +0 -16
- package/src/components/rws/reformer/template.html +0 -19
- package/src/components/rws/reformer/types/IReFormerTypes.ts +0 -5
- package/src/components/rws/rws-api-resource/component.ts +0 -53
- package/src/components/rws/rws-api-resource/styles/layout.scss +0 -7
- package/src/components/rws/rws-api-resource/template.html +0 -29
- package/src/components/rws/rws-api-resource/variants/form/component.ts +0 -37
- package/src/components/rws/rws-api-resource/variants/form/styles/layout.scss +0 -0
- package/src/components/rws/rws-api-resource/variants/form/template.html +0 -3
- package/src/components/rws/rws-api-resource/variants/list/component.ts +0 -44
- package/src/components/rws/rws-api-resource/variants/list/styles/layout.scss +0 -0
- package/src/components/rws/rws-api-resource/variants/list/template.html +0 -11
- package/src/components/rws/rws-modal/component.ts +0 -20
- package/src/components/rws/rws-modal/styles/layout.scss +0 -47
- package/src/components/rws/rws-modal/template.html +0 -11
- package/src/components/rws/rws-table/component.ts +0 -85
- package/src/components/rws/rws-table/styles/layout.scss +0 -73
- package/src/components/rws/rws-table/template.html +0 -27
- package/src/components/rws/uploader/component.ts +0 -86
- package/src/components/rws/uploader/styles/layout.scss +0 -131
- package/src/components/rws/uploader/template.html +0 -17
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { attr, observable } from '@microsoft/fast-element';
|
|
2
|
-
import RWSViewComponent from '../../../../_component';
|
|
3
|
-
import { RWSView} from '../../../../_decorator';
|
|
4
|
-
|
|
5
|
-
@RWSView('reformer-text')
|
|
6
|
-
class ReFormerText extends RWSViewComponent {
|
|
7
|
-
@attr name: string;
|
|
8
|
-
@observable defaultValue: string = null;
|
|
9
|
-
@observable value: string = null;
|
|
10
|
-
@observable setForm: (field: string, value: any) => Promise<void>;
|
|
11
|
-
|
|
12
|
-
connectedCallback(): void {
|
|
13
|
-
super.connectedCallback();
|
|
14
|
-
this.value = this.defaultValue;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
ReFormerText.defineComponent();
|
|
19
|
-
|
|
20
|
-
export { ReFormerText };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<form class="re-former-container">
|
|
2
|
-
${T.repeat(x => x.formFields, T.html`<div class="form-field">
|
|
3
|
-
<label for="re-former-field-${x => x.fieldName}">${ (x, c) => c.parent.paintLabel(x.fieldName)}</label>
|
|
4
|
-
${T.when(x => x.type === 'String', T.html`
|
|
5
|
-
<reformer-text class="reformer-field-input" :value="${ (x, c) => !!c.parent.payload[x.fieldName] ? c.parent.payload[x.fieldName] : null}" :setForm="${(x, c) => c.parent.setForm}" name="${x => x.fieldName}"></re-former-text>
|
|
6
|
-
`)}
|
|
7
|
-
${T.when(x => x.type === 'Date', T.html`
|
|
8
|
-
<reformer-date class="reformer-field-input" :value="${ (x, c) => !!c.parent.payload[x.fieldName] ? c.parent.payload[x.fieldName] : null}" :setForm="${(x, c) => c.parent.setForm}" name="${x => x.fieldName}"></re-former-date>
|
|
9
|
-
`)}
|
|
10
|
-
${T.when(x => x.type === 'Number', T.html`
|
|
11
|
-
<reformer-number class="reformer-field-input" :value="${ (x, c) => !!c.parent.payload[x.fieldName] ? c.parent.payload[x.fieldName] : null}" :setForm="${(x, c) => c.parent.setForm}" name="${x => x.fieldName}"></re-former-number>
|
|
12
|
-
`)}
|
|
13
|
-
${T.when(x => x.type === 'Boolean', T.html`
|
|
14
|
-
<reformer-boolean class="reformer-field-input" :value="${ (x, c) => !!c.parent.payload[x.fieldName] ? c.parent.payload[x.fieldName] : null}" :setForm="${(x, c) => c.parent.setForm}" name="${x => x.fieldName}"></re-former-boolean>
|
|
15
|
-
`)}
|
|
16
|
-
</div>`)}
|
|
17
|
-
|
|
18
|
-
<sl-button @click="${ (x, c) => x.sendForm() }" variant="primary" >Save</sl-button>
|
|
19
|
-
</div>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { IKDBTypesResponse } from '../../../types/IBackendCore';
|
|
2
|
-
import { observable, attr } from '@microsoft/fast-element';
|
|
3
|
-
import { RWSView } from '../../_decorator';
|
|
4
|
-
import { RWSViewComponent } from '../../_component';
|
|
5
|
-
import { RWSResourceListComponent } from './variants/list/component';
|
|
6
|
-
import { RWSResourceFormComponent } from './variants/form/component';
|
|
7
|
-
import { IRWSResourceQuery } from '../../../types/IRWSResource';
|
|
8
|
-
import { ActionType, IExtraColumnFormatter, IFlexTableColumn } from '../rws-table/component';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
RWSResourceListComponent;
|
|
12
|
-
RWSResourceFormComponent;
|
|
13
|
-
|
|
14
|
-
@RWSView('rws-resource')
|
|
15
|
-
class RWSApiResource extends RWSViewComponent {
|
|
16
|
-
@attr resource: string;
|
|
17
|
-
@attr resourceLabel: string = null;
|
|
18
|
-
|
|
19
|
-
@attr createEntryLabel = 'Create entry';
|
|
20
|
-
@attr listEntryLabel = 'Entries list';
|
|
21
|
-
|
|
22
|
-
@attr createEnabled = 'true';
|
|
23
|
-
@attr emptyLabel: string = 'No records';
|
|
24
|
-
|
|
25
|
-
@observable dbModelData: IKDBTypesResponse = null;
|
|
26
|
-
|
|
27
|
-
@observable viewType: 'list' | 'form' = 'list';
|
|
28
|
-
|
|
29
|
-
@observable fields: string[] = [];
|
|
30
|
-
@observable extraFormatters: {[header_key: string] : IExtraColumnFormatter} = {};
|
|
31
|
-
@observable headerTranslations: {[header_key: string] : string} = {};
|
|
32
|
-
|
|
33
|
-
@observable listActions: ActionType[] = [];
|
|
34
|
-
|
|
35
|
-
@observable back: (resource: any) => Promise<void> = async (resource: any) => {
|
|
36
|
-
this.viewType = 'list';
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
async connectedCallback(): Promise<void>
|
|
40
|
-
{
|
|
41
|
-
super.connectedCallback();
|
|
42
|
-
this.dbModelData = await this.apiService.getResource(this.resource);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
toggleForm()
|
|
46
|
-
{
|
|
47
|
-
this.viewType = this.viewType === 'form' ? 'list' : 'form';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
RWSApiResource.defineComponent();
|
|
52
|
-
|
|
53
|
-
export { RWSApiResource };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<div class="rws-api-container">
|
|
2
|
-
${T.when(x => x.resourceLabel, T.html`<h3>${x => x.resourceLabel}</h3>`)}
|
|
3
|
-
|
|
4
|
-
<div class="rws-api-controls">
|
|
5
|
-
${T.when(x => x.createEnabled === 'true', T.html`<sl-button @click="${ (x, c) => x.toggleForm() }" variant="secondary" >
|
|
6
|
-
${T.when(x => x.viewType === 'list', T.html`<span>${ x => x.createEntryLabel }</span>`)}
|
|
7
|
-
${T.when(x => x.viewType === 'form', T.html`<span>${ x => x.listEntryLabel }</span>`)}
|
|
8
|
-
</sl-button>`)}
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div class="rws-api-content">
|
|
12
|
-
${T.when(x => x.dbModelData && x.viewType === 'list', T.html`<rws-resource-list
|
|
13
|
-
resource="${x => x.resource}"
|
|
14
|
-
emptyLabel="${x => x.emptyLabel}"
|
|
15
|
-
:dbModelData="${x => x.dbModelData}"
|
|
16
|
-
:fields="${x => x.fields}"
|
|
17
|
-
:actions="${x => x.listActions}"
|
|
18
|
-
:extraFormatters="${x => x.extraFormatters}"
|
|
19
|
-
:headerTranslations="${x => x.headerTranslations}"
|
|
20
|
-
>
|
|
21
|
-
</rws-resource-list>`)}
|
|
22
|
-
|
|
23
|
-
${T.when(x => x.viewType === 'form', T.html`<rws-resource-form
|
|
24
|
-
resource="${x => x.resource}"
|
|
25
|
-
:dbModelData="${x => x.dbModelData}"
|
|
26
|
-
:back="${x => x.back}"
|
|
27
|
-
></rws-resource-form> `)}
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { attr, observable } from '@microsoft/fast-element';
|
|
2
|
-
import { IKDBTypesResponse } from '../../../../../types/IBackendCore';
|
|
3
|
-
import { RWSViewComponent} from '../../../../_component';
|
|
4
|
-
import { RWSView} from '../../../../_decorator';
|
|
5
|
-
import { IReFormerMassOrdering } from '../../../reformer/types/IReFormerTypes';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@RWSView('rws-resource-form')
|
|
9
|
-
class RWSResourceFormComponent extends RWSViewComponent {
|
|
10
|
-
@attr resource: string;
|
|
11
|
-
|
|
12
|
-
@observable dbModelData: IKDBTypesResponse = null;
|
|
13
|
-
@observable formOrdering: IReFormerMassOrdering = [];
|
|
14
|
-
@observable back: (resource: any) => Promise<void>;
|
|
15
|
-
|
|
16
|
-
connectedCallback(): void
|
|
17
|
-
{
|
|
18
|
-
super.connectedCallback();
|
|
19
|
-
this.createOrdering();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
setForm()
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
createOrdering()
|
|
28
|
-
{
|
|
29
|
-
for(const type of this.dbModelData.data.types){
|
|
30
|
-
this.formOrdering.push(type as unknown as IReFormerMassOrdering);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
RWSResourceFormComponent.defineComponent();
|
|
36
|
-
|
|
37
|
-
export { RWSResourceFormComponent };
|
|
File without changes
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { RWSViewComponent} from '../../../../_component';
|
|
2
|
-
import { RWSView} from '../../../../_decorator';
|
|
3
|
-
import { observable, attr } from '@microsoft/fast-element';
|
|
4
|
-
import { ActionType, IExtraColumnFormatter, IFlexTableColumn } from '../../../rws-table/component';
|
|
5
|
-
import { IKDBTypeInfo, IKDBTypesResponse } from '../../../../../types/IBackendCore';
|
|
6
|
-
|
|
7
|
-
@RWSView('rws-resource-list')
|
|
8
|
-
class RWSResourceListComponent extends RWSViewComponent {
|
|
9
|
-
@attr resource: string;
|
|
10
|
-
@attr emptyLabel: string = 'No records';
|
|
11
|
-
|
|
12
|
-
@observable dbModelData: IKDBTypesResponse = null;
|
|
13
|
-
@observable resourceList: any[] = [];
|
|
14
|
-
@observable columns: IFlexTableColumn[] = [];
|
|
15
|
-
|
|
16
|
-
@observable fields: string[] = [];
|
|
17
|
-
@observable extraFormatters: {[header_key: string] : IExtraColumnFormatter} = {};
|
|
18
|
-
@observable headerTranslations: {[header_key: string] : string} = {};
|
|
19
|
-
|
|
20
|
-
@observable actions: ActionType[] = [];
|
|
21
|
-
|
|
22
|
-
async connectedCallback()
|
|
23
|
-
{
|
|
24
|
-
super.connectedCallback();
|
|
25
|
-
const makeColumns: IFlexTableColumn[] = [];
|
|
26
|
-
|
|
27
|
-
for(const key in Object.keys(this.dbModelData.data.types)){
|
|
28
|
-
const responseObject: IKDBTypeInfo = this.dbModelData.data.types[key];
|
|
29
|
-
|
|
30
|
-
makeColumns.push({
|
|
31
|
-
key: responseObject.fieldName,
|
|
32
|
-
header: responseObject.fieldName,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
this.columns = makeColumns;
|
|
37
|
-
|
|
38
|
-
this.resourceList = await this.apiService.back.get(`${this.resource}:list`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
RWSResourceListComponent.defineComponent();
|
|
43
|
-
|
|
44
|
-
export { RWSResourceListComponent };
|
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="resource-list">
|
|
2
|
-
${T.when(x => x.columns.length, T.html`<rws-table
|
|
3
|
-
emptyLabel="${x => x.emptyLabel}"
|
|
4
|
-
:columns="${x => x.columns}"
|
|
5
|
-
:data="${x => x.resourceList}"
|
|
6
|
-
:fields="${x => x.fields}"
|
|
7
|
-
:actions="${x => x.actions}"
|
|
8
|
-
:extraFormatters="${x => x.extraFormatters}"
|
|
9
|
-
:headerTranslations="${x => x.headerTranslations}">
|
|
10
|
-
</rws-table>`)}
|
|
11
|
-
</div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { observable } from '@microsoft/fast-element';
|
|
2
|
-
import { RWSViewComponent} from '../../_component';
|
|
3
|
-
import { RWSView} from '../../_decorator';
|
|
4
|
-
|
|
5
|
-
@RWSView('rws-modal')
|
|
6
|
-
class RWSModal extends RWSViewComponent {
|
|
7
|
-
@observable closeModal: () => void
|
|
8
|
-
@observable onShowModal: ($: ShadowRoot) => void
|
|
9
|
-
|
|
10
|
-
connectedCallback(): void {
|
|
11
|
-
super.connectedCallback();
|
|
12
|
-
if(this.onShowModal){
|
|
13
|
-
this.onShowModal(this.shadowRoot);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
RWSModal.defineComponent();
|
|
19
|
-
|
|
20
|
-
export { RWSModal };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
@import "@rws-mixins";
|
|
2
|
-
|
|
3
|
-
.backdrop {
|
|
4
|
-
position: fixed;
|
|
5
|
-
width: 100vw;
|
|
6
|
-
height: 100vh;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
background-color: rgba(0,0,0,0.8);
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
z-index: 1001;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.rws-modal {
|
|
15
|
-
position: fixed;
|
|
16
|
-
width: 100vw;
|
|
17
|
-
height: 100vh;
|
|
18
|
-
top: 0;
|
|
19
|
-
left: 0;
|
|
20
|
-
z-index: 1000;
|
|
21
|
-
|
|
22
|
-
.rws-modal-wrapper{
|
|
23
|
-
background: #FFF;
|
|
24
|
-
border-radius: 20px;
|
|
25
|
-
padding: 20px;
|
|
26
|
-
max-width: 70vw;
|
|
27
|
-
max-height: 80vh;
|
|
28
|
-
min-height: 40vh;
|
|
29
|
-
transform: translate(50%, 50%);
|
|
30
|
-
left: -15%;
|
|
31
|
-
margin-left: 30px;
|
|
32
|
-
color: #000;
|
|
33
|
-
position: relative;
|
|
34
|
-
z-index: 1002;
|
|
35
|
-
overflow-y: auto;
|
|
36
|
-
|
|
37
|
-
@include customScrollbars();
|
|
38
|
-
|
|
39
|
-
.rws-modal-header{
|
|
40
|
-
display: flex;
|
|
41
|
-
|
|
42
|
-
justify-content: end;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.rws-modal-body{}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="rws-modal">
|
|
2
|
-
<div @click="${ (x, c) => x.closeModal() }" class="backdrop"></div>
|
|
3
|
-
<div class="rws-modal-wrapper">
|
|
4
|
-
<div class="rws-modal-header">
|
|
5
|
-
<sl-button @click="${ (x, c) => x.closeModal() }" variant="secondary" >Close</sl-button>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="rws-modal-body">
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { observable, attr } from '@microsoft/fast-element';
|
|
2
|
-
import { RWSViewComponent} from '../../_component';
|
|
3
|
-
import { RWSView} from '../../_decorator';
|
|
4
|
-
|
|
5
|
-
export interface IFlexTableColumn {
|
|
6
|
-
key: string;
|
|
7
|
-
header: string;
|
|
8
|
-
formatter?: (value: any) => string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type IExtraColumnFormatter<T = unknown> = (inputType: T) => string;
|
|
12
|
-
|
|
13
|
-
export type ActionType = {
|
|
14
|
-
key: string,
|
|
15
|
-
label: string,
|
|
16
|
-
variant: string,
|
|
17
|
-
handler: (id: string) => Promise<void>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@RWSView('rws-table')
|
|
21
|
-
class RWSTable extends RWSViewComponent {
|
|
22
|
-
@attr emptyLabel: string = 'No records';
|
|
23
|
-
@observable columns: IFlexTableColumn[] = [];
|
|
24
|
-
|
|
25
|
-
@observable dataColumns: IFlexTableColumn[] = [];
|
|
26
|
-
@observable data: any[] = [];
|
|
27
|
-
@observable fields: string[] = [];
|
|
28
|
-
|
|
29
|
-
@observable actions: ActionType[] = [];
|
|
30
|
-
|
|
31
|
-
@observable extraFormatters: {[header_key: string] : IExtraColumnFormatter} = {};
|
|
32
|
-
@observable headerTranslations: { [sourceKey: string]: string } = {};
|
|
33
|
-
|
|
34
|
-
connectedCallback(): void {
|
|
35
|
-
super.connectedCallback();
|
|
36
|
-
|
|
37
|
-
this.orderFields();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
headerTranslationsChanged(oldValue: { [sourceKey: string]: string }, newValue: { [sourceKey: string]: string })
|
|
41
|
-
{
|
|
42
|
-
this.orderFields();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
fieldsChanged(oldValue: string[], newValue: string[])
|
|
46
|
-
{
|
|
47
|
-
this.orderFields();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
columnsChanged(oldValue: IFlexTableColumn[], newValue: IFlexTableColumn[])
|
|
51
|
-
{
|
|
52
|
-
this.orderFields();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
orderFields(): void
|
|
56
|
-
{
|
|
57
|
-
if(this.columns && this.fields && this.fields.length && this.columns.length){
|
|
58
|
-
const orderedColumns: IFlexTableColumn[] = [];
|
|
59
|
-
|
|
60
|
-
for(const fieldKey of this.fields){
|
|
61
|
-
const found = this.columns.find(item => item.key === fieldKey);
|
|
62
|
-
|
|
63
|
-
if(found){
|
|
64
|
-
if(Object.keys(this.extraFormatters).includes(fieldKey)){
|
|
65
|
-
found.formatter = this.extraFormatters[fieldKey];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if(this.headerTranslations && Object.keys(this.headerTranslations).includes(fieldKey)){
|
|
69
|
-
found.header = this.headerTranslations[fieldKey];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
orderedColumns.push(found);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
this.dataColumns = orderedColumns;
|
|
77
|
-
}else{
|
|
78
|
-
this.dataColumns = this.columns;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
RWSTable.defineComponent();
|
|
84
|
-
|
|
85
|
-
export { RWSTable };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
.flex-table {
|
|
2
|
-
width: 100%;
|
|
3
|
-
border: 1px solid #e2e8f0;
|
|
4
|
-
border-radius: 8px;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
background: white;
|
|
7
|
-
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
8
|
-
|
|
9
|
-
.flex-table-row {
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
border-bottom: 1px solid #e2e8f0;
|
|
13
|
-
|
|
14
|
-
&:last-child {
|
|
15
|
-
border-bottom: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.table-header {
|
|
19
|
-
background-color: #f8fafc;
|
|
20
|
-
font-weight: 600;
|
|
21
|
-
color: #475569;
|
|
22
|
-
text-transform: capitalize;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.table-body {
|
|
26
|
-
&:hover {
|
|
27
|
-
background-color: #f1f5f9;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&.flex-table-empty {
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: center;
|
|
34
|
-
align-items: center;
|
|
35
|
-
min-height: 100px;
|
|
36
|
-
background-color: #f8fafc;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.flex-table-cell {
|
|
41
|
-
flex: 1;
|
|
42
|
-
padding: 12px 16px;
|
|
43
|
-
overflow: hidden;
|
|
44
|
-
text-overflow: ellipsis;
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
min-width: 0;
|
|
47
|
-
|
|
48
|
-
sl-button {
|
|
49
|
-
margin: 0 4px;
|
|
50
|
-
|
|
51
|
-
&:first-child {
|
|
52
|
-
margin-left: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&:last-child {
|
|
56
|
-
margin-right: 0;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Add styles for the full-row cell
|
|
61
|
-
&.full-row {
|
|
62
|
-
flex: 1 1 100%;
|
|
63
|
-
text-align: center;
|
|
64
|
-
color: #64748b; // Slate-500 color
|
|
65
|
-
padding: 24px 16px;
|
|
66
|
-
|
|
67
|
-
strong {
|
|
68
|
-
font-weight: 600;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<div class="flex-table">
|
|
2
|
-
<div class="flex-table-row table-header">
|
|
3
|
-
${T.repeat(x => x.dataColumns, T.html`<div class="flex-table-cell">${x => x.header}</div>`)}
|
|
4
|
-
${T.when(x => x.actions.length, T.html`<div class="flex-table-cell" data-field="_actions">Actions</div>`)}
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
${T.repeat((x, dataContext) => x.data, T.html`<div class="flex-table-row table-body">
|
|
8
|
-
${T.repeat((x, columnContext) => columnContext.parent.dataColumns, T.html`<div class="flex-table-cell" data-field="${x => x.key}">
|
|
9
|
-
${(column, ctx) => {
|
|
10
|
-
const value = ctx.parent[column.key];
|
|
11
|
-
return column.formatter ? column.formatter(value) : value;
|
|
12
|
-
}}
|
|
13
|
-
</div>
|
|
14
|
-
`)}
|
|
15
|
-
${T.when((x,c) => c.parent.actions && c.parent.actions.length, T.html`<div class="flex-table-cell" data-field="_actions">
|
|
16
|
-
${T.repeat((x, c) => c.parent.actions, T.html`
|
|
17
|
-
<sl-button @click="${ (x, c) => x.handler(c.parent.id) }" variant="${x => x.variant}" >${x => x.label}</sl-button>
|
|
18
|
-
`)}
|
|
19
|
-
</div>`)}
|
|
20
|
-
</div>
|
|
21
|
-
`)}
|
|
22
|
-
|
|
23
|
-
${T.when(x => !x.data.length, T.html`<div class="flex-table-row flex-table-empty table-body">
|
|
24
|
-
<div class="flex-table-cell full-row"><strong>${ x => x.emptyLabel }</strong></div>
|
|
25
|
-
</div>`)}
|
|
26
|
-
|
|
27
|
-
</div>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { observable, attr } from '@microsoft/fast-element';
|
|
2
|
-
import { RWSView } from '../../_decorator';
|
|
3
|
-
import { RWSViewComponent } from '../../_component';
|
|
4
|
-
|
|
5
|
-
@RWSView('rws-uploader')
|
|
6
|
-
class RWSUploader extends RWSViewComponent {
|
|
7
|
-
|
|
8
|
-
@observable uploadProgress: number;
|
|
9
|
-
|
|
10
|
-
@observable uploadedFile: File;
|
|
11
|
-
@observable chosenFile: File;
|
|
12
|
-
@observable uploadParams: any;
|
|
13
|
-
|
|
14
|
-
@attr onFinish: (uploadResponse: any) => void;
|
|
15
|
-
@attr onStart: (chosenFile: File, context: any) => Promise<unknown> = async (chosenFile: File) => chosenFile;
|
|
16
|
-
@attr onProgress: (progress: number) => void = (progress: number) => null;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
async onUploadStart(): Promise<void>
|
|
20
|
-
{
|
|
21
|
-
if(!this.uploadProgress){
|
|
22
|
-
this.uploadProgress = 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const response = await this.onStart(this.chosenFile, this);
|
|
26
|
-
|
|
27
|
-
if(response === null){
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.onFinish(response);
|
|
32
|
-
|
|
33
|
-
this.uploadedFile = this.chosenFile;
|
|
34
|
-
this.chosenFile = null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onChoose(): void
|
|
38
|
-
{
|
|
39
|
-
const _self = this;
|
|
40
|
-
const fileInput = this.createFileInput();
|
|
41
|
-
|
|
42
|
-
this.triggerUpload(fileInput);
|
|
43
|
-
|
|
44
|
-
fileInput.addEventListener('change', () => {
|
|
45
|
-
_self.chosenFile = fileInput.files[0];
|
|
46
|
-
|
|
47
|
-
_self.uploadedFile = null;
|
|
48
|
-
|
|
49
|
-
_self.removeFileInput(fileInput);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
removeFile(){
|
|
54
|
-
this.chosenFile = null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private createFileInput(): HTMLInputElement
|
|
58
|
-
{
|
|
59
|
-
const fileInput: HTMLInputElement = document.createElement('input');
|
|
60
|
-
fileInput.type = 'file';
|
|
61
|
-
fileInput.style.display = 'none';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.shadowRoot.appendChild(fileInput);
|
|
65
|
-
return fileInput;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private triggerUpload(fileInput: HTMLInputElement): void
|
|
69
|
-
{
|
|
70
|
-
fileInput.click();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private removeFileInput(fileInput: HTMLInputElement): void
|
|
74
|
-
{
|
|
75
|
-
this.shadowRoot.removeChild(fileInput);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
uploadProgressChanged(oldV: any, newV: any)
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
RWSUploader.defineComponent();
|
|
85
|
-
|
|
86
|
-
export { RWSUploader };
|