@acorex/layout 4.1.4 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +9 -0
  3. package/package.json +11 -31
  4. package/src/lib/widget-board/editors/widget-size-editor/widget-size.editor.html +10 -0
  5. package/src/lib/widget-board/editors/widget-size-editor/widget-size.editor.ts +55 -0
  6. package/src/lib/widget-board/editors/widget-size-editor/widget-size.module.ts +19 -0
  7. package/src/lib/widget-board/widget-board.component.html +7 -0
  8. package/src/lib/widget-board/widget-board.component.scss +198 -0
  9. package/src/lib/widget-board/widget-board.component.ts +510 -0
  10. package/src/lib/widget-board/widget-board.module.ts +74 -0
  11. package/src/lib/widget-board/widget-config.component.html +16 -0
  12. package/src/lib/widget-board/widget-config.component.ts +99 -0
  13. package/src/lib/widget-board/widget-host.component.html +30 -0
  14. package/src/lib/widget-board/widget-host.component.ts +343 -0
  15. package/src/lib/widget-board/widget-save.component.html +43 -0
  16. package/src/lib/widget-board/widget-save.component.ts +88 -0
  17. package/src/lib/widget-board/widget.class.ts +178 -0
  18. package/{public-api.d.ts → src/public-api.ts} +0 -0
  19. package/src/test.ts +28 -0
  20. package/tsconfig.lib.json +23 -0
  21. package/tsconfig.lib.prod.json +6 -0
  22. package/tsconfig.spec.json +17 -0
  23. package/tslint.json +17 -0
  24. package/acorex-layout.d.ts +0 -5
  25. package/esm2020/acorex-layout.mjs +0 -5
  26. package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.editor.mjs +0 -46
  27. package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.module.mjs +0 -21
  28. package/esm2020/lib/widget-board/widget-board.component.mjs +0 -441
  29. package/esm2020/lib/widget-board/widget-board.module.mjs +0 -111
  30. package/esm2020/lib/widget-board/widget-config.component.mjs +0 -82
  31. package/esm2020/lib/widget-board/widget-host.component.mjs +0 -290
  32. package/esm2020/lib/widget-board/widget-save.component.mjs +0 -79
  33. package/esm2020/lib/widget-board/widget.class.mjs +0 -127
  34. package/esm2020/public-api.mjs +0 -7
  35. package/fesm2015/acorex-layout.mjs +0 -1166
  36. package/fesm2015/acorex-layout.mjs.map +0 -1
  37. package/fesm2020/acorex-layout.mjs +0 -1159
  38. package/fesm2020/acorex-layout.mjs.map +0 -1
  39. package/lib/widget-board/editors/widget-size-editor/widget-size.editor.d.ts +0 -19
  40. package/lib/widget-board/editors/widget-size-editor/widget-size.module.d.ts +0 -10
  41. package/lib/widget-board/widget-board.component.d.ts +0 -61
  42. package/lib/widget-board/widget-board.module.d.ts +0 -18
  43. package/lib/widget-board/widget-config.component.d.ts +0 -23
  44. package/lib/widget-board/widget-host.component.d.ts +0 -51
  45. package/lib/widget-board/widget-save.component.d.ts +0 -19
  46. package/lib/widget-board/widget.class.d.ts +0 -56
package/karma.conf.js ADDED
@@ -0,0 +1,32 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ coverageIstanbulReporter: {
19
+ dir: require('path').join(__dirname, '../../../coverage/acorex/layout'),
20
+ reports: ['html', 'lcovonly', 'text-summary'],
21
+ fixWebpackSourcePaths: true
22
+ },
23
+ reporters: ['progress', 'kjhtml'],
24
+ port: 9876,
25
+ colors: true,
26
+ logLevel: config.LOG_INFO,
27
+ autoWatch: true,
28
+ browsers: ['Chrome'],
29
+ singleRun: false,
30
+ restartOnFileChange: true
31
+ });
32
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/acorex/layout",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "allowedNonPeerDependencies": [
8
+ ]
9
+ }
package/package.json CHANGED
@@ -1,31 +1,11 @@
1
- {
2
- "name": "@acorex/layout",
3
- "version": "4.1.4",
4
- "peerDependencies": {
5
- "@angular/common": "^13.3.8",
6
- "@angular/core": "^13.3.8"
7
- },
8
- "dependencies": {
9
- "tslib": "^2.0.0"
10
- },
11
- "module": "fesm2015/acorex-layout.mjs",
12
- "es2020": "fesm2020/acorex-layout.mjs",
13
- "esm2020": "esm2020/acorex-layout.mjs",
14
- "fesm2020": "fesm2020/acorex-layout.mjs",
15
- "fesm2015": "fesm2015/acorex-layout.mjs",
16
- "typings": "acorex-layout.d.ts",
17
- "exports": {
18
- "./package.json": {
19
- "default": "./package.json"
20
- },
21
- ".": {
22
- "types": "./acorex-layout.d.ts",
23
- "esm2020": "./esm2020/acorex-layout.mjs",
24
- "es2020": "./fesm2020/acorex-layout.mjs",
25
- "es2015": "./fesm2015/acorex-layout.mjs",
26
- "node": "./fesm2015/acorex-layout.mjs",
27
- "default": "./fesm2020/acorex-layout.mjs"
28
- }
29
- },
30
- "sideEffects": false
31
- }
1
+ {
2
+ "name": "@acorex/layout",
3
+ "version": "4.2.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^13.3.8",
6
+ "@angular/core": "^13.3.8"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.0.0"
10
+ }
11
+ }
@@ -0,0 +1,10 @@
1
+ <div style="display: flex;">
2
+ <div style="margin-inline-end: 0.5em;flex: calc(50% - 0.25em);">
3
+ <ax-number-box (onValueChanged)="handleMinValueChange($event)" [value]="sizeX" [min]="minX" [max]="maxX">
4
+ </ax-number-box>
5
+ </div>
6
+ <div style="flex: calc(50% - 0.25em);">
7
+ <ax-number-box (onValueChanged)="handleMaxValueChange($event)" [value]="sizeY" [min]="minY" [max]="maxY">
8
+ </ax-number-box>
9
+ </div>
10
+ </div>
@@ -0,0 +1,55 @@
1
+ import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
2
+ import { AXProperyEditorComponent } from '@acorex/components';
3
+
4
+ @Component({
5
+ templateUrl: './widget-size.editor.html'
6
+ })
7
+ export class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent<number[]> {
8
+
9
+ sizeX: number;
10
+ sizeY: number;
11
+
12
+ minX: number = 1;
13
+ maxX: number = 10;
14
+
15
+ minY: number = 1;
16
+ maxY: number = 10;
17
+
18
+
19
+ constructor(protected cdr: ChangeDetectorRef) {
20
+ super(cdr);
21
+ }
22
+
23
+ ngOnInit() {
24
+ if (Array.isArray(this.value)) {
25
+ this.sizeX = this.value[0];
26
+ this.sizeY = this.value[1];
27
+ }
28
+ else {
29
+ this.sizeX = 2;
30
+ this.sizeY = 2;
31
+ }
32
+ }
33
+
34
+ handleMinValueChange(e: any) {
35
+ this.sizeX = e.value;
36
+
37
+ if (this.sizeY > 0) {
38
+ super.handleValueChange([this.sizeX, this.sizeY]);
39
+ }
40
+ }
41
+
42
+ handleMaxValueChange(e: any) {
43
+ this.sizeY = e.value;
44
+ if (this.sizeX > 0) {
45
+ super.handleValueChange([this.sizeX, this.sizeY]);
46
+ }
47
+ }
48
+
49
+
50
+
51
+ ngAfterViewInit() {
52
+ this.onRenderCompleted.emit();
53
+ }
54
+
55
+ }
@@ -0,0 +1,19 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+
5
+ import { AXWidgetSizePropertyEditorComponent } from './widget-size.editor';
6
+ import { AXNumberBoxModule } from '@acorex/components';
7
+
8
+
9
+
10
+
11
+ @NgModule({
12
+ declarations: [AXWidgetSizePropertyEditorComponent],
13
+ imports: [CommonModule, FormsModule, AXNumberBoxModule],
14
+ exports: [AXWidgetSizePropertyEditorComponent],
15
+ providers: []
16
+ })
17
+ export class AXWidgetSizePropertyEditorModule {
18
+
19
+ }
@@ -0,0 +1,7 @@
1
+ <div class="widgets-container" [class.rtl]="rtl" #container>
2
+ <ax-widget-host *ngFor="let w of widgets;trackBy: trackByFn" [config]='w' [sizeX]="w.sizeX"
3
+ [sizeY]="w.sizeY" [col]="w.col" [row]="w.row" (onRemove)="handleOnRemove($event)" (onSave)="handleOnSave($event)"
4
+ (onConfigChanged)="handleOnConfigChanged($event)" (onResized)="handleOnResizedChanged($event)"
5
+ [provideValue]="provideValue">
6
+ </ax-widget-host>
7
+ </div>
@@ -0,0 +1,198 @@
1
+ .widget-board {
2
+ display: inline-block;
3
+ margin: 15px 20px 15px 20px;
4
+ min-width: calc(100% - 40px);
5
+ min-height: calc(100% - 34px);
6
+ --animate-duration: 0.5s;
7
+ background-repeat: no-repeat;
8
+
9
+ &.grid-background {
10
+
11
+ background-repeat: repeat !important;
12
+ .widgets-container {
13
+ .widget-host {
14
+ touch-action: none;
15
+
16
+ .widget-edit-overlay {
17
+ display: block;
18
+ cursor: move;
19
+ }
20
+
21
+ &.widget-dragging {
22
+ z-index: 1000;
23
+ }
24
+
25
+ &:focus {
26
+ outline-width: 1px;
27
+ outline-style: solid;
28
+ outline-color: var(--ax-primary-color);
29
+ }
30
+
31
+ touch-action: none;
32
+ user-select: none;
33
+ }
34
+ }
35
+
36
+ .widget-blank-placeholder {
37
+ background: var(--ax-primary-trans-light-color);
38
+ position: absolute;
39
+ }
40
+ }
41
+
42
+ .widgets-container {
43
+ position: relative;
44
+ touch-action: none;
45
+
46
+
47
+ &.rtl {
48
+ .widget-host {
49
+ .widget-options-menu {
50
+ right: unset !important;
51
+ left: 0 !important;
52
+ }
53
+ }
54
+ }
55
+
56
+
57
+ .widget-host {
58
+ position: absolute;
59
+ background: #fff;
60
+ box-shadow: 2px 2px 3px #dadada;
61
+
62
+ .widget-content {
63
+ width: 100%;
64
+ height: 100%;
65
+ display: flex;
66
+ flex-direction: column;
67
+
68
+ .widget-title {
69
+ padding: var(--ax-size-md);
70
+ text-align: start;
71
+ font-size: 1.5em;
72
+ position: absolute;
73
+ }
74
+ }
75
+
76
+
77
+ .widget-edit-loading {
78
+ display: none;
79
+ background: rgba(255, 255, 255, .85);
80
+ position: absolute;
81
+ width: 100%;
82
+ height: 100%;
83
+ top: 0;
84
+ left: 0;
85
+ z-index: 2;
86
+ display: flex;
87
+ }
88
+
89
+ .widget-config-overlay {
90
+ position: absolute;
91
+ background: rgba(255, 255, 255, 1);
92
+ width: 100%;
93
+ height: 100%;
94
+ top: 0;
95
+ left: 0;
96
+ z-index: 1;
97
+ padding: var(--ax-size-md);
98
+ cursor: pointer;
99
+
100
+ &:hover {
101
+ .widget-title {
102
+ text-decoration: underline;
103
+ }
104
+ }
105
+
106
+
107
+
108
+ .widget-title {
109
+ text-align: start;
110
+ font-size: 1.5em;
111
+ }
112
+
113
+ .widget-config-box {
114
+ align-self: center;
115
+ text-align: center;
116
+ position: absolute;
117
+ top: 50%;
118
+ left: 50%;
119
+ transform: translate(-50%, -50%);
120
+ color: var(--ax-gray-dark-color);
121
+
122
+
123
+ .config-title {
124
+ font-size: 1.2em;
125
+ margin-bottom: var(--ax-size-md);
126
+ }
127
+
128
+ .config-icon {}
129
+ }
130
+ }
131
+
132
+ .widget-edit-overlay {
133
+ display: none;
134
+ background: rgba(255, 255, 255, .5);
135
+ position: absolute;
136
+ width: 100%;
137
+ height: 100%;
138
+ top: 0;
139
+ left: 0;
140
+ z-index: 10;
141
+
142
+ .widget-edit-menu {
143
+ margin: 6px;
144
+ text-align: end;
145
+ float: inline-end;
146
+ opacity: 1;
147
+ transition: opacity 1s ease;
148
+
149
+ .widget-edit-menu-button {
150
+ display: inline-block;
151
+ background-color: #f0f0f0;
152
+ border-radius: 1px;
153
+ border: 2px solid #fff;
154
+ box-sizing: border-box;
155
+ -webkit-box-sizing: border-box;
156
+ -moz-box-sizing: border-box;
157
+ padding: 0;
158
+ height: 32px;
159
+ width: 32px;
160
+ cursor: pointer;
161
+ color: #666;
162
+
163
+ &:hover {
164
+ border-color: #a6a6a6;
165
+ background-color: #c8c8c8;
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ .widget-options-menu {
172
+ display: none;
173
+ position: absolute;
174
+ top: 0;
175
+ right: 0;
176
+ z-index: 2;
177
+ cursor: pointer;
178
+ padding: 2px 5px;
179
+
180
+ &:hover {
181
+ background-color: #f0f0f0;
182
+ }
183
+ }
184
+
185
+ .widget-container {
186
+ padding: 1px;
187
+ height: 100%;
188
+
189
+ &:hover {
190
+ .widget-options-menu {
191
+ display: block;
192
+ }
193
+ }
194
+ }
195
+ }
196
+
197
+ }
198
+ }