@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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +1 -3
  3. package/src/components/index.ts +0 -26
  4. package/src/components/rws/line-splitter/component.ts +0 -117
  5. package/src/components/rws/line-splitter/styles/_tags.scss +0 -104
  6. package/src/components/rws/line-splitter/styles/layout.scss +0 -38
  7. package/src/components/rws/line-splitter/template.html +0 -1
  8. package/src/components/rws/loader/component.ts +0 -14
  9. package/src/components/rws/loader/styles/layout.scss +0 -14
  10. package/src/components/rws/loader/template.html +0 -1
  11. package/src/components/rws/progress/component.ts +0 -54
  12. package/src/components/rws/progress/styles/layout.scss +0 -91
  13. package/src/components/rws/progress/template.html +0 -25
  14. package/src/components/rws/reformer/component.ts +0 -58
  15. package/src/components/rws/reformer/fields/boolean/component.ts +0 -20
  16. package/src/components/rws/reformer/fields/boolean/styles/layout.scss +0 -5
  17. package/src/components/rws/reformer/fields/boolean/template.html +0 -6
  18. package/src/components/rws/reformer/fields/date/component.ts +0 -20
  19. package/src/components/rws/reformer/fields/date/styles/layout.scss +0 -5
  20. package/src/components/rws/reformer/fields/date/template.html +0 -7
  21. package/src/components/rws/reformer/fields/number/component.ts +0 -20
  22. package/src/components/rws/reformer/fields/number/styles/layout.scss +0 -5
  23. package/src/components/rws/reformer/fields/number/template.html +0 -7
  24. package/src/components/rws/reformer/fields/text/component.ts +0 -20
  25. package/src/components/rws/reformer/fields/text/styles/layout.scss +0 -5
  26. package/src/components/rws/reformer/fields/text/template.html +0 -7
  27. package/src/components/rws/reformer/styles/layout.scss +0 -16
  28. package/src/components/rws/reformer/template.html +0 -19
  29. package/src/components/rws/reformer/types/IReFormerTypes.ts +0 -5
  30. package/src/components/rws/rws-api-resource/component.ts +0 -53
  31. package/src/components/rws/rws-api-resource/styles/layout.scss +0 -7
  32. package/src/components/rws/rws-api-resource/template.html +0 -29
  33. package/src/components/rws/rws-api-resource/variants/form/component.ts +0 -37
  34. package/src/components/rws/rws-api-resource/variants/form/styles/layout.scss +0 -0
  35. package/src/components/rws/rws-api-resource/variants/form/template.html +0 -3
  36. package/src/components/rws/rws-api-resource/variants/list/component.ts +0 -44
  37. package/src/components/rws/rws-api-resource/variants/list/styles/layout.scss +0 -0
  38. package/src/components/rws/rws-api-resource/variants/list/template.html +0 -11
  39. package/src/components/rws/rws-modal/component.ts +0 -20
  40. package/src/components/rws/rws-modal/styles/layout.scss +0 -47
  41. package/src/components/rws/rws-modal/template.html +0 -11
  42. package/src/components/rws/rws-table/component.ts +0 -85
  43. package/src/components/rws/rws-table/styles/layout.scss +0 -73
  44. package/src/components/rws/rws-table/template.html +0 -27
  45. package/src/components/rws/uploader/component.ts +0 -86
  46. package/src/components/rws/uploader/styles/layout.scss +0 -131
  47. package/src/components/rws/uploader/template.html +0 -17
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.20.4",
4
+ "version": "2.21.0",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
package/src/index.ts CHANGED
@@ -18,7 +18,6 @@ import RWSViewComponent from './components/_component';
18
18
  import RWSContainer from './components/_container';
19
19
 
20
20
  import { RWSIgnore, RWSInject, RWSView } from './components/_decorator';
21
- import { declareRWSComponents } from './components';
22
21
 
23
22
  import type { DefaultRWSPluginOptionsType } from './plugins/_plugin';
24
23
  import type { IRWSPlugin, IStaticRWSPlugin, IPluginSpawnOption } from './types/IRWSPlugin';
@@ -69,8 +68,7 @@ export {
69
68
  ngAttr,
70
69
 
71
70
  RWSService,
72
- RWSViewComponent,
73
- declareRWSComponents,
71
+ RWSViewComponent,
74
72
 
75
73
  RWSContainer
76
74
  };
@@ -1,26 +0,0 @@
1
- import { RWSUploader } from './rws/uploader/component';
2
- import { RWSProgress } from './rws/progress/component';
3
- import { RWSLoader } from './rws/loader/component';
4
- import { RWSApiResource } from './rws/rws-api-resource/component';
5
- import { ReFormer } from './rws/reformer/component';
6
- import { RWSTable } from './rws/rws-table/component';
7
- import { RWSModal } from './rws/rws-modal/component';
8
- import { LineSplitter } from './rws/line-splitter/component';
9
-
10
-
11
- function declareRWSComponents(parted: boolean = false): void
12
- {
13
- if(!parted){
14
- RWSUploader;
15
- RWSProgress;
16
- RWSLoader;
17
- RWSTable;
18
- RWSModal;
19
- LineSplitter;
20
-
21
- RWSApiResource;
22
- ReFormer;
23
- }
24
- }
25
-
26
- export { declareRWSComponents };
@@ -1,117 +0,0 @@
1
- import { RWSViewComponent } from '../../../components/_component';
2
- import { RWSView } from '../../../components/_decorator';
3
- import { observable, attr } from '@microsoft/fast-element';
4
-
5
- import { ViewTemplate } from '@microsoft/fast-element';
6
-
7
- @RWSView('line-splitter', { debugPackaging: false })
8
- class LineSplitter extends RWSViewComponent {
9
- @observable text: string = '';
10
- @observable content: string | ViewTemplate = '<span class="dots">.</span>';
11
- @observable query: string = '';
12
-
13
- @observable callback?: () => void;
14
-
15
- @attr dots = false;
16
-
17
- @attr allowedTags = '';
18
- @attr addClass = '';
19
-
20
- private stopAnimation: () => void = () => {};
21
-
22
- private allowedHTMLTags: string[] = ['dl', 'dt', 'dd', 'br', 'blockquote', 'span', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'strong', 'i', 'small', 'u'];
23
-
24
- connectedCallback(): void {
25
- super.connectedCallback();
26
-
27
- if(this.dots){
28
- this.stopAnimation = this.animateLoadingDots();
29
- }
30
-
31
- if(this.text){
32
- this.splitLines();
33
- }
34
- }
35
-
36
- parseTags(line: string): string | ViewTemplate
37
- {
38
- const componentAllowedTags: string[] = this.allowedHTMLTags.concat(this.allowedTags.split(','));
39
-
40
- let output = this.domService.sanitizeHTML(line, { ADD_TAGS: [], ALLOWED_TAGS: componentAllowedTags });
41
-
42
- output = output.replace(/<.*>([\s\S]*?)<\/.*>/g, (match: string) => {
43
- return match.replace(/\n/g, '');
44
- });
45
- output = output.replace(/\n\n/g, '\n');
46
- output = output.replace(/\n/g, '<br/>');
47
- output = output.replace(/<\/p><br\/>/g, '</p>');
48
- output = output
49
- .replace(/<br\/><h([1-3])>/g, '<h$1>')
50
- .replace(/<\/h([1-3])><br\/>/g, '</h$1>');
51
-
52
- if(this.query !== null || this.query !== '') {
53
- const query: string[] = this.query ? this.query.split(',').map(word => word.trim()) : [];
54
-
55
- query.forEach(word => {
56
- // Create a regex for the word, ensuring it's case-insensitive and doesn't affect existing HTML tags
57
- const regex = new RegExp(`(${word})(?![^<]*>)`, 'gi');
58
- output = output.replace(regex, '<span class="tagged">$1</span>');
59
- });
60
- }
61
-
62
-
63
- return output;
64
- }
65
-
66
- splitLines(): void
67
- {
68
- if([". ", ". . ", ". . . "].includes(this.text)){
69
- this.content = `<span class="dots">${this.text}</span>`
70
- }else{
71
- this.stopAnimation();
72
- this.content = this.parseTags(this.text);
73
- }
74
- }
75
-
76
- textChanged(oldVal: string, newVal: string)
77
- {
78
- if(newVal){
79
- this.text = newVal;
80
- this.splitLines();
81
- }
82
- }
83
-
84
- contentChanged(){
85
- if(this.callback){
86
- this.callback();
87
- }
88
- }
89
-
90
- animateLoadingDots(): () => void {
91
- let counter = 1;
92
- const interval = setInterval(() => {
93
- counter = counter % 3 + 1;
94
- this.text = '. '.repeat(counter);
95
- }, 800);
96
-
97
- // Zwracamy funkcję do zatrzymania animacji
98
- return () => clearInterval(interval);
99
- }
100
-
101
- addClassChanged(oldVal: string, newVal: string)
102
- {
103
- if(newVal){
104
- this.addClass = newVal;
105
- }
106
- }
107
-
108
- queryChanged(oldVal: string, newVal: string){
109
- if(newVal){
110
- this.splitLines();
111
- }
112
- }
113
- }
114
-
115
- LineSplitter.defineComponent();
116
-
117
- export { LineSplitter };
@@ -1,104 +0,0 @@
1
-
2
-
3
- $bgcolor: var(--line-splitter-bgcolor, #CCC);
4
- $maincolor: var(--line-splitter-maincolor, #333);;
5
- $altcolor: #fff;
6
-
7
- blockquote {
8
- position: relative;
9
- font-family: 'Barlow Condensed', sans-serif;
10
- max-width: 620px;
11
- margin: 0 auto 80px auto;
12
- align-self: center;
13
- display: inline-block;
14
- width: 100%;
15
-
16
- .quote-cnt {
17
- font-family: 'Abril Fatface', cursive;
18
- position: relative; /* for pseudos */
19
- color: $maincolor;
20
- font-size: 1.4rem;
21
- line-height: 1;
22
- margin: 0;
23
- border: 2px solid #fff;
24
- border: solid 2px;
25
- border-radius:20px;
26
- padding: 25px;
27
- font-weight: bold;
28
-
29
- .native {
30
- font-weight: bold;
31
- }
32
-
33
- .native + .pronounciation {
34
- color: $altcolor;
35
-
36
- font-weight: normal;
37
- font-size: 0.9rem;
38
- margin-left: 15px;
39
- }
40
-
41
- &:after {
42
- content:"";
43
- position: absolute;
44
- border: 2px solid $maincolor;
45
- border-radius: 0 50px 0 0;
46
- width: 60px;
47
- height: 60px;
48
- bottom: -62px;
49
- left: 50px;
50
- border-bottom: none;
51
- border-left: none;
52
- z-index: 3;
53
- }
54
-
55
- &:before {
56
- content:"";
57
- position: absolute;
58
- width: 80px;
59
- border: 6px solid $bgcolor;
60
- bottom: -3px;
61
- left: 50px;
62
- z-index: 2;
63
- }
64
- }
65
- }
66
-
67
- dl{
68
-
69
- @include grid-container();
70
- @include grid-flex-align-items(center, center);
71
-
72
- dt{
73
- text-align: right;
74
- font-weight: bold;
75
- font-size: 1.2rem;
76
- padding: 0 15px;
77
- margin-bottom: 80px;
78
-
79
- @include grid-column(6);
80
-
81
- &:after{
82
- content: ":";
83
- font-weight: bold;
84
- font-size: 1.2rem;
85
- }
86
- }
87
-
88
- dd{
89
- margin-left: 0;
90
- @include grid-column(6);
91
- }
92
- }
93
-
94
- p{
95
- margin: 0 0 15px 0;
96
- }
97
-
98
- h1, h2, h3 {
99
- margin: 10px 0 15px 0;
100
- }
101
-
102
- ul, ol {
103
- margin: 0;
104
- }
@@ -1,38 +0,0 @@
1
- @import "@rws-mixins";
2
- @import "_tags";
3
-
4
- @keyframes blink {
5
- 0%, 100% { opacity: 1; }
6
- 50% { opacity: 0; }
7
- }
8
-
9
- .spacer {
10
- margin-right: 10px;
11
- }
12
-
13
-
14
- .text-splitter-area {
15
-
16
- .dots {
17
- font-weight: 700;
18
- }
19
-
20
- &.loading {
21
-
22
- p:last-child:after{
23
- content: '';
24
- display: inline-block;
25
- width: 5px;
26
- height: 1rem;
27
- height: 1.2rem;
28
- background: rgb(114, 106, 106);
29
- animation: 0.7s ease 0s infinite normal none running blink;
30
- transform: translateY(5px);
31
- margin-left: 5px;
32
- }
33
- }
34
- }
35
-
36
- .tagged {
37
- background-color: yellow;
38
- }
@@ -1 +0,0 @@
1
- <div class="text-splitter-area ${x => x.addClass}" :innerHTML="${(x) => x.content}"></div>
@@ -1,14 +0,0 @@
1
- import { RWSView } from '../../_decorator';
2
- import { RWSViewComponent } from '../../_component';
3
- import { attr } from '@microsoft/fast-element';
4
-
5
- @RWSView('rws-loader')
6
- class RWSLoader extends RWSViewComponent {
7
- connectedCallback(): void {
8
- super.connectedCallback();
9
- }
10
- }
11
-
12
- RWSLoader.defineComponent();
13
-
14
- export { RWSLoader };
@@ -1,14 +0,0 @@
1
- //loader
2
- //save
3
- $loader-color: var(--rws-loader-color, #eb7b13);
4
- $loader-size: 26px;
5
- $loader-height: 20px;
6
- $loader-border-size: 8px;
7
- $loader-gap: 12px;
8
- $loader-animation-duration: 1s;
9
-
10
- @import "~/scss-loading-animations/src/loaders";
11
-
12
- .loader {
13
- @include loader06;
14
- }
@@ -1 +0,0 @@
1
- <div><div class="loader"></div></div>
@@ -1,54 +0,0 @@
1
- import { observable, attr, nullableNumberConverter } from '@microsoft/fast-element';
2
- import { RWSView } from '../../_decorator';
3
- import { RWSViewComponent } from '../../_component';
4
-
5
- @RWSView('rws-progress', { debugPackaging: false })
6
- class RWSProgress extends RWSViewComponent {
7
-
8
- @attr({ converter: nullableNumberConverter })
9
- public value: number | null;
10
- protected valueChanged(): void {
11
- this.updatePercentComplete();
12
- }
13
-
14
-
15
- @attr({ converter: nullableNumberConverter })
16
- public min: number;
17
- protected minChanged(): void {
18
- if (this.$fastController.isConnected) {
19
- this.updatePercentComplete();
20
- }
21
- }
22
-
23
-
24
- @attr({ converter: nullableNumberConverter })
25
- public max: number;
26
- protected maxChanged(): void {
27
- if (this.$fastController.isConnected) {
28
- this.updatePercentComplete();
29
- }
30
- }
31
-
32
-
33
- @observable
34
- public percentComplete: number = 0;
35
-
36
- public connectedCallback(): void {
37
- super.connectedCallback();
38
- this.updatePercentComplete();
39
- }
40
-
41
- private updatePercentComplete(): void {
42
- const min: number = typeof this.min === 'number' ? this.min : 0;
43
- const max: number = typeof this.max === 'number' ? this.max : 100;
44
- const value: number = typeof this.value === 'number' ? this.value : 0;
45
- const range: number = max - min;
46
-
47
- this.percentComplete =
48
- range === 0 ? 0 : Math.fround(((value - min) / range) * 100);
49
- }
50
- }
51
-
52
- RWSProgress.defineComponent();
53
-
54
- export { RWSProgress };
@@ -1,91 +0,0 @@
1
- :host {
2
- align-items: center;
3
- display: flex;
4
- contain: content;
5
- outline: none;
6
- height: calc(var(--design-unit) * 1px);
7
- margin: calc(var(--design-unit) * 1px) 0;
8
- }
9
-
10
- .progress {
11
- background-color: var(--neutral-fill-rest);
12
- border-radius: calc(var(--design-unit) * 1px);
13
- width: 100%;
14
- height: 100%;
15
- display: flex;
16
- align-items: center;
17
- position: relative;
18
- }
19
-
20
- .determinate {
21
- background-color: var(--accent-foreground-rest);
22
- border-radius: calc(var(--design-unit) * 1px);
23
- height: 100%;
24
- transition: all 0.2s ease-in-out;
25
- display: flex;
26
- }
27
-
28
- .indeterminate {
29
- border-radius: calc(var(--design-unit) * 1px);
30
- display: flex;
31
- height: 100%;
32
- overflow: hidden;
33
- position: relative;
34
- width: 100%;
35
- }
36
-
37
- .indeterminate-indicator-1 {
38
- animation: indeterminate-1 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
39
- background-color: var(--accent-foreground-rest);
40
- border-radius: calc(var(--design-unit) * 1px);
41
- height: 100%;
42
- opacity: 0;
43
- position: absolute;
44
- width: 40%;
45
- }
46
-
47
- .indeterminate-indicator-2 {
48
- position: absolute;
49
- opacity: 0;
50
- height: 100%;
51
- background-color: var(--accent-foreground-rest);
52
- border-radius: calc(var(--design-unit) * 1px);
53
- width: 60%;
54
- animation: indeterminate-2 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
55
- }
56
-
57
- @keyframes indeterminate-1 {
58
- 0% {
59
- opacity: 1;
60
- transform: translateX(-100%);
61
- }
62
- 70% {
63
- opacity: 1;
64
- transform: translateX(300%);
65
- }
66
- 70.01% {
67
- opacity: 0;
68
- }
69
- 100% {
70
- opacity: 0;
71
- transform: translateX(300%);
72
- }
73
- }
74
-
75
- @keyframes indeterminate-2 {
76
- 0% {
77
- opacity: 0;
78
- transform: translateX(-150%);
79
- }
80
- 29.99% {
81
- opacity: 0;
82
- }
83
- 30% {
84
- opacity: 1;
85
- transform: translateX(-150%);
86
- }
87
- 100% {
88
- transform: translateX(166.66%);
89
- opacity: 1;
90
- }
91
- }
@@ -1,25 +0,0 @@
1
- <template
2
- role="progressbar"
3
- aria-valuenow="${x => x.value}"
4
- aria-valuemin="${x => x.min}"
5
- aria-valuemax="${x => x.max}"
6
- >
7
- ${T.when(
8
- x => typeof x.value === "number",
9
- T.html`
10
- <div class="progress rws-progress" part="progress" slot="determinate">
11
- <div
12
- class="determinate"
13
- part="determinate"
14
- style="width: ${x => x.percentComplete}%"
15
- ></div>
16
- </div>
17
- `,
18
- T.html`
19
- <div class="progress rws-progress" part="progress" slot="indeterminate">
20
- <slot name="indeterminate">
21
- </slot>
22
- </div>
23
- `
24
- )}
25
- </template>
@@ -1,58 +0,0 @@
1
- import { observable, attr } from '@microsoft/fast-element';
2
- import { IKDBTypeInfo, IKDBTypesResponse } from '../../../types/IBackendCore';
3
- import { RWSViewComponent} from '../../_component';
4
- import { RWSView} from '../../_decorator';
5
- import { ReFormerText } from './fields/text/component';
6
- import { ReFormerDate } from './fields/date/component';
7
- import { ReFormerNumber } from './fields/number/component';
8
- import { ReFormerBoolean } from './fields/boolean/component';
9
-
10
- ReFormerBoolean;
11
- ReFormerNumber;
12
- ReFormerText;
13
- ReFormerDate;
14
-
15
- @RWSView('rws-reformer')
16
- class ReFormer extends RWSViewComponent {
17
- @attr resource: string;
18
-
19
- @observable fields: string[] | null = null;
20
- @observable formFields: IKDBTypeInfo[];
21
-
22
- @observable modelTypes: IKDBTypesResponse;
23
- @observable setForm: (key: string, val: any) => void = this.setFormField.bind(this);
24
- @observable afterForm: (val: any) => Promise<void> = null;
25
-
26
- private payload: {[key: string]: any} = {};
27
-
28
- modelTypesChanged(oldVal:IKDBTypesResponse, newVal: IKDBTypesResponse)
29
- {
30
- if(newVal){
31
- this.formFields = newVal.data.types.filter((item) => !['id', 'created_at', 'updated_at'].includes(item.fieldName))
32
- }
33
- }
34
-
35
- setFormField(key: string, val: HTMLFormElement)
36
- {
37
- this.payload[key] = val.value;
38
- }
39
-
40
- paintLabel(input: string): string
41
- {
42
- return input;
43
- }
44
-
45
- async sendForm()
46
- {
47
- const resource = await this.apiService.back.post(`${this.resource}:create`, this.payload);
48
- this.payload = {};
49
-
50
- if(this.afterForm){
51
- this.afterForm(resource);
52
- }
53
- }
54
- }
55
-
56
- ReFormer.defineComponent();
57
-
58
- export { ReFormer };
@@ -1,20 +0,0 @@
1
- import RWSViewComponent from '../../../../_component';
2
- import { RWSView} from '../../../../_decorator';
3
- import { attr, observable } from '@microsoft/fast-element';
4
-
5
- @RWSView('reformer-boolean')
6
- class ReFormerBoolean extends RWSViewComponent {
7
- @attr name: string;
8
- @observable defaultValue: boolean = null;
9
- @observable value: boolean = 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
- ReFormerBoolean.defineComponent();
19
-
20
- export { ReFormerBoolean };
@@ -1,5 +0,0 @@
1
- @import "@rws-mixins";
2
-
3
- .re-former-boolean-input {
4
- display: flex;
5
- }
@@ -1,6 +0,0 @@
1
- <sl-switch
2
- name="${ x => x.name}"
3
- id="re-former-field-${x => x.name}"
4
- :value="${x => x.value}"
5
- @change="${(x,c) => x.setForm(x.name, c.event.target)}"
6
- ></sl-switch>
@@ -1,20 +0,0 @@
1
- import RWSViewComponent from '../../../../_component';
2
- import { RWSView} from '../../../../_decorator';
3
- import { attr, observable } from '@microsoft/fast-element';
4
-
5
- @RWSView('reformer-date')
6
- class ReFormerDate extends RWSViewComponent {
7
- @attr name: string;
8
- @observable defaultValue: Date = null;
9
- @observable value: Date = 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
- ReFormerDate.defineComponent();
19
-
20
- export { ReFormerDate };
@@ -1,5 +0,0 @@
1
- @import "@rws-mixins";
2
-
3
- .re-former-date-input {
4
- display: flex;
5
- }
@@ -1,7 +0,0 @@
1
- <sl-input
2
- type="date"
3
- name="${ x => x.name}"
4
- id="re-former-field-${x => x.name}"
5
- :value="${x => x.value}"
6
- @change="${(x,c) => x.setForm(x.name, c.event.target)}"
7
- ></sl-input>
@@ -1,20 +0,0 @@
1
- import RWSViewComponent from '../../../../_component';
2
- import { RWSView} from '../../../../_decorator';
3
- import { attr, observable } from '@microsoft/fast-element';
4
-
5
- @RWSView('reformer-number')
6
- class ReFormerNumber extends RWSViewComponent {
7
- @attr name: string;
8
- @observable defaultValue: number = null;
9
- @observable value: number = 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
- ReFormerNumber.defineComponent();
19
-
20
- export { ReFormerNumber };
@@ -1,5 +0,0 @@
1
- @import "@rws-mixins";
2
-
3
- .re-former-number-input {
4
- display: flex;
5
- }