@openmfp/webcomponents 0.6.1 → 0.6.7
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/mfp-wc-dashboard.js +153 -0
- package/mfp-webcomponents.js +573 -0
- package/package.json +14 -68
- package/.github/workflows/pipeline.yaml +0 -41
- package/.storybook/main.ts +0 -34
- package/.storybook/preview.ts +0 -29
- package/.storybook/tsconfig.json +0 -11
- package/AGENTS.md +0 -153
- package/CODEOWNERS +0 -6
- package/CONTRIBUTING.md +0 -95
- package/LICENSE +0 -201
- package/LICENSES/Apache-2.0.txt +0 -73
- package/README.md +0 -91
- package/REUSE.toml +0 -9
- package/angular.json +0 -157
- package/docs/dashboard.md +0 -358
- package/docs/declarative-form.md +0 -178
- package/docs/declarative-table-card.md +0 -235
- package/docs/declarative-table.md +0 -315
- package/eslint.config.js +0 -41
- package/projects/ngx/cards/favorites/favorites.component.html +0 -12
- package/projects/ngx/cards/favorites/favorites.component.scss +0 -50
- package/projects/ngx/cards/favorites/favorites.component.ts +0 -19
- package/projects/ngx/cards/public-api.ts +0 -4
- package/projects/ngx/cards/service-status/service-status-card.component.html +0 -15
- package/projects/ngx/cards/service-status/service-status-card.component.scss +0 -87
- package/projects/ngx/cards/service-status/service-status-card.component.ts +0 -36
- package/projects/ngx/cards/stories/visited-service-card.stories.ts +0 -149
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.html +0 -17
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.scss +0 -34
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.ts +0 -22
- package/projects/ngx/cards/whats-new/whats-new.component.html +0 -10
- package/projects/ngx/cards/whats-new/whats-new.component.scss +0 -25
- package/projects/ngx/cards/whats-new/whats-new.component.ts +0 -46
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.html +0 -28
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.scss +0 -44
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.spec.ts +0 -85
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.ts +0 -58
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.html +0 -29
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.scss +0 -63
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.spec.ts +0 -255
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts +0 -75
- package/projects/ngx/declarative-ui/dashboard/card/utils/dashboard-card-registry.spec.ts +0 -76
- package/projects/ngx/declarative-ui/dashboard/card/utils/dashboard-card-registry.ts +0 -109
- package/projects/ngx/declarative-ui/dashboard/card/utils/index.ts +0 -4
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.spec.ts +0 -141
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.ts +0 -44
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-sap-card.spec.ts +0 -142
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-sap-card.ts +0 -52
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-wc-card.spec.ts +0 -107
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-wc-card.ts +0 -22
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.html +0 -134
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.scss +0 -88
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.spec.ts +0 -354
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts +0 -238
- package/projects/ngx/declarative-ui/dashboard/dashboard/index.ts +0 -1
- package/projects/ngx/declarative-ui/dashboard/index.ts +0 -5
- package/projects/ngx/declarative-ui/dashboard/models/constants.ts +0 -2
- package/projects/ngx/declarative-ui/dashboard/models/dashboard.model.ts +0 -50
- package/projects/ngx/declarative-ui/dashboard/models/index.ts +0 -1
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.html +0 -28
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.scss +0 -85
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.spec.ts +0 -104
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.ts +0 -23
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.html +0 -62
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.scss +0 -12
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.spec.ts +0 -301
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.ts +0 -166
- package/projects/ngx/declarative-ui/form/declarative-form/index.ts +0 -1
- package/projects/ngx/declarative-ui/form/index.ts +0 -2
- package/projects/ngx/declarative-ui/form/models/form-field-definition.ts +0 -15
- package/projects/ngx/declarative-ui/form/models/index.ts +0 -1
- package/projects/ngx/declarative-ui/form/utils/set-property-by-path.ts +0 -30
- package/projects/ngx/declarative-ui/models/index.ts +0 -2
- package/projects/ngx/declarative-ui/models/resource.ts +0 -5
- package/projects/ngx/declarative-ui/models/ui-definition.ts +0 -95
- package/projects/ngx/declarative-ui/public-api.ts +0 -4
- package/projects/ngx/declarative-ui/stories/add-card-dialog.stories.ts +0 -91
- package/projects/ngx/declarative-ui/stories/background-lightblue.png +0 -0
- package/projects/ngx/declarative-ui/stories/dashboard.cards.ts +0 -107
- package/projects/ngx/declarative-ui/stories/dashboard.stories.ts +0 -296
- package/projects/ngx/declarative-ui/stories/declarative-form.stories.ts +0 -149
- package/projects/ngx/declarative-ui/stories/declarative-table-card.stories.ts +0 -358
- package/projects/ngx/declarative-ui/stories/declarative-table.stories.ts +0 -363
- package/projects/ngx/declarative-ui/stories/pods-table.config.ts +0 -188
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.html +0 -138
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.scss +0 -21
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.spec.ts +0 -345
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.ts +0 -61
- package/projects/ngx/declarative-ui/table/declarative-table/index.ts +0 -1
- package/projects/ngx/declarative-ui/table/index.ts +0 -2
- package/projects/ngx/declarative-ui/table/models/index.ts +0 -14
- package/projects/ngx/declarative-ui/table/models/table.model.ts +0 -17
- package/projects/ngx/declarative-ui/table/utils/cssRules.engine.spec.ts +0 -146
- package/projects/ngx/declarative-ui/table/utils/cssRules.engine.ts +0 -69
- package/projects/ngx/declarative-ui/table/utils/field-definition.utils.spec.ts +0 -70
- package/projects/ngx/declarative-ui/table/utils/field-definition.utils.ts +0 -13
- package/projects/ngx/declarative-ui/table/utils/proccess-fields.spec.ts +0 -511
- package/projects/ngx/declarative-ui/table/utils/proccess-fields.ts +0 -71
- package/projects/ngx/declarative-ui/table/utils/resource-field-by-path.spec.ts +0 -372
- package/projects/ngx/declarative-ui/table/utils/resource-field-by-path.ts +0 -98
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-cell.constants.ts +0 -5
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.html +0 -1
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.scss +0 -0
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.spec.ts +0 -119
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.ts +0 -35
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.html +0 -7
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.scss +0 -0
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.spec.ts +0 -114
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.ts +0 -19
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.html +0 -7
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.scss +0 -10
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.spec.ts +0 -188
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.ts +0 -16
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.html +0 -59
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.scss +0 -33
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.spec.ts +0 -316
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.ts +0 -115
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.html +0 -156
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.scss +0 -123
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.spec.ts +0 -786
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts +0 -286
- package/projects/ngx/declarative-ui/table-card/index.ts +0 -2
- package/projects/ngx/declarative-ui/table-card/models/configs.ts +0 -46
- package/projects/ngx/declarative-ui/tsconfig.lib.json +0 -11
- package/projects/ngx/declarative-ui/tsconfig.lib.prod.json +0 -9
- package/projects/ngx/declarative-ui/tsconfig.spec.json +0 -9
- package/projects/ngx/ng-package.json +0 -8
- package/projects/ngx/package.json +0 -22
- package/projects/ngx/public-api.ts +0 -2
- package/projects/ngx/tsconfig.lib.json +0 -11
- package/projects/ngx/tsconfig.lib.prod.json +0 -9
- package/projects/webcomponents/main.ts +0 -92
- package/projects/webcomponents/tsconfig.app.json +0 -9
- package/projects/webcomponents-dashboard/main.ts +0 -15
- package/projects/webcomponents-dashboard/tsconfig.app.json +0 -9
- package/renovate.json +0 -6
- package/scripts/bundle-wc.mjs +0 -79
- package/tsconfig.json +0 -37
- package/tsconfig.spec.json +0 -8
- package/tsconfig.storybook.json +0 -16
- package/vitest.config.ts +0 -26
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { Favorites } from '../../cards/favorites/favorites.component';
|
|
2
|
-
import { ServiceStatusCard } from '../../cards/service-status/service-status-card.component';
|
|
3
|
-
import { VisitedServiceCard } from '../../cards/visited-service-card/visited-service-card.component';
|
|
4
|
-
import { Dashboard } from '../dashboard/dashboard/dashboard.component';
|
|
5
|
-
import type { CardConfig, DashboardConfig } from '../dashboard/models';
|
|
6
|
-
import { ButtonSettings } from '../models/ui-definition';
|
|
7
|
-
import { CARDS, SECTIONS } from './dashboard.cards';
|
|
8
|
-
import { TABLE_CARD_CONFIG, TABLE_RESOURCES } from './pods-table.config';
|
|
9
|
-
import type { Meta, StoryObj } from '@storybook/angular';
|
|
10
|
-
|
|
11
|
-
Dashboard.registerAngularComponents([
|
|
12
|
-
Favorites,
|
|
13
|
-
ServiceStatusCard,
|
|
14
|
-
VisitedServiceCard,
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Shared config
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
const CUSTOM_ACTIONS: ButtonSettings[] = [
|
|
22
|
-
{
|
|
23
|
-
action: 'download-config',
|
|
24
|
-
text: 'Download config',
|
|
25
|
-
icon: 'download',
|
|
26
|
-
design: 'Default',
|
|
27
|
-
tooltip: 'Download the current dashboard configuration',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
action: 'switch-account',
|
|
31
|
-
text: 'Switch account',
|
|
32
|
-
icon: 'customer',
|
|
33
|
-
design: 'Default',
|
|
34
|
-
tooltip: 'Switch to a different account',
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const SAMPLE_CONFIG: DashboardConfig = {
|
|
39
|
-
title: 'System Overview',
|
|
40
|
-
description:
|
|
41
|
-
'Monitor your platform metrics, traffic and service health in real time.',
|
|
42
|
-
backgroundImageUrl: '/background-lightblue.png',
|
|
43
|
-
customActions: CUSTOM_ACTIONS,
|
|
44
|
-
editable: true,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const AVAILABLE_CARDS: CardConfig[] = [
|
|
48
|
-
{
|
|
49
|
-
id: 'table-pods',
|
|
50
|
-
label: 'Pods Table',
|
|
51
|
-
w: 12,
|
|
52
|
-
h: 100,
|
|
53
|
-
component: 'mfp-wc-declarative-table-card',
|
|
54
|
-
componentInputs: {
|
|
55
|
-
config: TABLE_CARD_CONFIG,
|
|
56
|
-
resources: TABLE_RESOURCES,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 'whats-new',
|
|
61
|
-
label: "What's New",
|
|
62
|
-
w: 5,
|
|
63
|
-
h: 57,
|
|
64
|
-
component: 'mfp-whats-new',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 'favorites',
|
|
68
|
-
label: 'Favorites',
|
|
69
|
-
w: 4,
|
|
70
|
-
h: 21,
|
|
71
|
-
component: 'mfp-favorites',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: 'service-status',
|
|
75
|
-
label: 'Service Status',
|
|
76
|
-
w: 4,
|
|
77
|
-
h: 30,
|
|
78
|
-
component: 'mfp-service-status-card',
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
const REGISTRY_SECTIONS = [
|
|
83
|
-
{
|
|
84
|
-
id: 'angular-cards',
|
|
85
|
-
title: 'Angular cards',
|
|
86
|
-
editable: true,
|
|
87
|
-
w: 12,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: 'wc-cards',
|
|
91
|
-
title: 'Webcomponent cards',
|
|
92
|
-
editable: true,
|
|
93
|
-
w: 12,
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
const REGISTRY_CARDS: CardConfig[] = [
|
|
98
|
-
{
|
|
99
|
-
id: 'angular-visited-service',
|
|
100
|
-
w: 4,
|
|
101
|
-
h: 10,
|
|
102
|
-
sectionId: 'angular-cards',
|
|
103
|
-
component: 'mfp-visited-service-card',
|
|
104
|
-
componentInputs: {
|
|
105
|
-
serviceType: 'SAP HANA Cloud',
|
|
106
|
-
serviceName: 'orders-db',
|
|
107
|
-
serviceIcon: 'database',
|
|
108
|
-
serviceDescription: 'Registered Angular component',
|
|
109
|
-
path: '/hana/orders-db',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: 'angular-favorites',
|
|
114
|
-
sectionId: 'angular-cards',
|
|
115
|
-
x: 0,
|
|
116
|
-
y: 0,
|
|
117
|
-
w: 5,
|
|
118
|
-
h: 20,
|
|
119
|
-
component: 'mfp-favorites',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
id: 'webcomponent-table',
|
|
123
|
-
sectionId: 'wc-cards',
|
|
124
|
-
w: 12,
|
|
125
|
-
h: 50,
|
|
126
|
-
component: 'mfp-wc-declarative-table-card',
|
|
127
|
-
componentInputs: {
|
|
128
|
-
config: TABLE_CARD_CONFIG,
|
|
129
|
-
header: 'Pods rendered by web component',
|
|
130
|
-
headerTooltip:
|
|
131
|
-
'This card intentionally uses the existing custom-element render path.',
|
|
132
|
-
resources: TABLE_RESOURCES,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
const ANGULAR_REGISTRY_AVAILABLE_CARDS: CardConfig[] = [
|
|
138
|
-
{
|
|
139
|
-
id: 'angular-service-status-template',
|
|
140
|
-
label: 'Angular Service Status',
|
|
141
|
-
w: 4,
|
|
142
|
-
h: 29,
|
|
143
|
-
component: 'mfp-service-status-card',
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: 'webcomponent-whats-new-template',
|
|
147
|
-
label: "Web Component What's New",
|
|
148
|
-
w: 5,
|
|
149
|
-
h: 56,
|
|
150
|
-
component: 'mfp-whats-new',
|
|
151
|
-
},
|
|
152
|
-
];
|
|
153
|
-
|
|
154
|
-
// ---------------------------------------------------------------------------
|
|
155
|
-
// Meta
|
|
156
|
-
// ---------------------------------------------------------------------------
|
|
157
|
-
|
|
158
|
-
const meta: Meta<Dashboard> = {
|
|
159
|
-
title: 'Declarative UI / Dashboard',
|
|
160
|
-
component: Dashboard,
|
|
161
|
-
tags: ['autodocs'],
|
|
162
|
-
parameters: {
|
|
163
|
-
layout: 'fullscreen',
|
|
164
|
-
},
|
|
165
|
-
argTypes: {
|
|
166
|
-
config: { control: 'object' },
|
|
167
|
-
sections: { control: 'object' },
|
|
168
|
-
cards: { control: 'object' },
|
|
169
|
-
availableCards: { control: 'object' },
|
|
170
|
-
actionButtonClick: { action: 'actionButtonClick' },
|
|
171
|
-
},
|
|
172
|
-
args: {
|
|
173
|
-
config: SAMPLE_CONFIG,
|
|
174
|
-
sections: SECTIONS,
|
|
175
|
-
cards: CARDS,
|
|
176
|
-
availableCards: AVAILABLE_CARDS,
|
|
177
|
-
},
|
|
178
|
-
render: (args) => ({
|
|
179
|
-
props: args,
|
|
180
|
-
template: `<mfp-dashboard [config]="config" [sections]="sections" [cards]="cards" [availableCards]="availableCards" (actionButtonClick)="actionButtonClick($event)" />`,
|
|
181
|
-
}),
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export default meta;
|
|
185
|
-
type Story = StoryObj<Dashboard>;
|
|
186
|
-
|
|
187
|
-
// ---------------------------------------------------------------------------
|
|
188
|
-
// Stories
|
|
189
|
-
// ---------------------------------------------------------------------------
|
|
190
|
-
|
|
191
|
-
export const Default: Story = {};
|
|
192
|
-
|
|
193
|
-
export const WithSubheader: Story = {
|
|
194
|
-
render: (args) => ({
|
|
195
|
-
props: args,
|
|
196
|
-
template: `
|
|
197
|
-
<mfp-dashboard [config]="config" [sections]="sections" [cards]="cards" [availableCards]="availableCards">
|
|
198
|
-
<div slot="dashboard-subheader" style="display:flex;align-items:center;gap:1.5rem;width:100%">
|
|
199
|
-
<img src="https://platform-mesh.io/main/pm_logo.svg" alt="Platform Mesh logo" style="width:48px;height:48px;object-fit:contain;flex-shrink:0" />
|
|
200
|
-
<div style="display:flex;gap:2rem;flex-wrap:wrap">
|
|
201
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
202
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Workspace Path</span>
|
|
203
|
-
<span style="font-size:0.875rem">root:orgs:sub:a1</span>
|
|
204
|
-
</div>
|
|
205
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
206
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Description</span>
|
|
207
|
-
<span style="font-size:0.875rem">Platform Mesh sub-organization</span>
|
|
208
|
-
</div>
|
|
209
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
210
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Display Name</span>
|
|
211
|
-
<span style="font-size:0.875rem">a1</span>
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
</div>
|
|
215
|
-
</mfp-dashboard>
|
|
216
|
-
`,
|
|
217
|
-
}),
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export const CompactToolbar: Story = {
|
|
221
|
-
parameters: {
|
|
222
|
-
viewport: { defaultViewport: 'mobile1' },
|
|
223
|
-
chromatic: { viewports: [725] },
|
|
224
|
-
docs: {
|
|
225
|
-
description: {
|
|
226
|
-
story:
|
|
227
|
-
'Below 726 px the individual toolbar buttons collapse into a single menu2 burger button. Click it to see the custom actions and Edit View item separated by a MenuSeparator.',
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
render: (args) => ({
|
|
232
|
-
props: args,
|
|
233
|
-
template: `
|
|
234
|
-
<div style="width:725px;overflow:hidden">
|
|
235
|
-
<mfp-dashboard [config]="config" [sections]="sections" [cards]="cards" [availableCards]="availableCards">
|
|
236
|
-
<div slot="dashboard-subheader" style="display:flex;align-items:center;gap:1.5rem;width:100%">
|
|
237
|
-
<img src="https://platform-mesh.io/main/pm_logo.svg" alt="Platform Mesh logo" style="width:48px;height:48px;object-fit:contain;flex-shrink:0" />
|
|
238
|
-
<div style="display:flex;gap:2rem;flex-wrap:wrap">
|
|
239
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
240
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Workspace Path</span>
|
|
241
|
-
<span style="font-size:0.875rem">root:orgs:sub:a1</span>
|
|
242
|
-
</div>
|
|
243
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
244
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Description</span>
|
|
245
|
-
<span style="font-size:0.875rem">Platform Mesh sub-organization</span>
|
|
246
|
-
</div>
|
|
247
|
-
<div style="display:flex;flex-direction:column;gap:0.25rem">
|
|
248
|
-
<span style="font-size:0.75rem;color:var(--sapContent_LabelColor,#6a6d70)">Display Name</span>
|
|
249
|
-
<span style="font-size:0.875rem">a1</span>
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
252
|
-
</div>
|
|
253
|
-
</mfp-dashboard>
|
|
254
|
-
</div>
|
|
255
|
-
`,
|
|
256
|
-
}),
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
export const AngularComponentRegistry: Story = {
|
|
260
|
-
args: {
|
|
261
|
-
config: {
|
|
262
|
-
...SAMPLE_CONFIG,
|
|
263
|
-
title: 'Angular Component Registry',
|
|
264
|
-
description:
|
|
265
|
-
'This story mixes registered Angular card components with existing web components.',
|
|
266
|
-
},
|
|
267
|
-
sections: REGISTRY_SECTIONS,
|
|
268
|
-
cards: REGISTRY_CARDS,
|
|
269
|
-
availableCards: ANGULAR_REGISTRY_AVAILABLE_CARDS,
|
|
270
|
-
},
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
export const CustomButtonSettings: Story = {
|
|
274
|
-
args: {
|
|
275
|
-
config: {
|
|
276
|
-
...SAMPLE_CONFIG,
|
|
277
|
-
title: 'Custom Button Settings',
|
|
278
|
-
description:
|
|
279
|
-
'Edit View and Add Card buttons configured via buttonSettings — text labels, no icons.',
|
|
280
|
-
buttonsSettings: {
|
|
281
|
-
editViewButton: {
|
|
282
|
-
text: 'Edit View',
|
|
283
|
-
icon: '',
|
|
284
|
-
design: 'Default',
|
|
285
|
-
tooltip: '',
|
|
286
|
-
},
|
|
287
|
-
addCardButton: {
|
|
288
|
-
text: 'Add Card',
|
|
289
|
-
icon: '',
|
|
290
|
-
design: 'Emphasized',
|
|
291
|
-
tooltip: '',
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FormFieldChangeEvent,
|
|
3
|
-
FormFieldDefinition,
|
|
4
|
-
FormFieldErrors,
|
|
5
|
-
} from '../form/models';
|
|
6
|
-
import { CUSTOM_ELEMENTS_SCHEMA, Component, Input } from '@angular/core';
|
|
7
|
-
import type { Meta, StoryObj } from '@storybook/angular';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'mfp-declarative-form-story',
|
|
11
|
-
template: `
|
|
12
|
-
<mfp-wc-declarative-form
|
|
13
|
-
[editMode]="editMode"
|
|
14
|
-
[fieldErrors]="fieldErrors"
|
|
15
|
-
[fields]="fields"
|
|
16
|
-
[initialValues]="initialValues"
|
|
17
|
-
(fieldChange)="handleFormChange($event)"
|
|
18
|
-
/>
|
|
19
|
-
`,
|
|
20
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
21
|
-
})
|
|
22
|
-
class DeclarativeFormStory {
|
|
23
|
-
@Input() fields: FormFieldDefinition[] = [];
|
|
24
|
-
@Input() initialValues: Record<string, unknown> = {};
|
|
25
|
-
@Input() fieldErrors: FormFieldErrors = {};
|
|
26
|
-
@Input() editMode = false;
|
|
27
|
-
|
|
28
|
-
handleFormChange(event: CustomEvent<FormFieldChangeEvent>): void {
|
|
29
|
-
const { fieldProperty, value } = event.detail;
|
|
30
|
-
const field = this.fields.find((f) => f.name === fieldProperty);
|
|
31
|
-
const nextErrors = { ...this.fieldErrors };
|
|
32
|
-
nextErrors[fieldProperty] =
|
|
33
|
-
field?.required && !value
|
|
34
|
-
? `${field.label ?? fieldProperty} is required`
|
|
35
|
-
: null;
|
|
36
|
-
this.fieldErrors = nextErrors;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
// Meta
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
|
|
44
|
-
const meta: Meta<DeclarativeFormStory> = {
|
|
45
|
-
title: 'Declarative UI / DeclarativeForm',
|
|
46
|
-
component: DeclarativeFormStory,
|
|
47
|
-
tags: ['autodocs'],
|
|
48
|
-
parameters: {
|
|
49
|
-
layout: 'centered',
|
|
50
|
-
},
|
|
51
|
-
argTypes: {
|
|
52
|
-
fields: { control: 'object' },
|
|
53
|
-
fieldErrors: { control: 'object' },
|
|
54
|
-
initialValues: { control: 'object' },
|
|
55
|
-
editMode: { control: 'boolean' },
|
|
56
|
-
},
|
|
57
|
-
args: {
|
|
58
|
-
fields: [
|
|
59
|
-
{ name: 'metadata_name', label: 'Name' },
|
|
60
|
-
{ name: 'metadata_namespace', label: 'Namespace' },
|
|
61
|
-
],
|
|
62
|
-
fieldErrors: {},
|
|
63
|
-
initialValues: {},
|
|
64
|
-
editMode: false,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default meta;
|
|
69
|
-
type Story = StoryObj<DeclarativeFormStory>;
|
|
70
|
-
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
// Stories
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
|
|
75
|
-
/** Minimal setup: two plain text fields. */
|
|
76
|
-
export const Basic: Story = {
|
|
77
|
-
args: {
|
|
78
|
-
fields: [
|
|
79
|
-
{ name: 'metadata_name', label: 'Name' },
|
|
80
|
-
{ name: 'metadata_namespace', label: 'Namespace' },
|
|
81
|
-
] satisfies FormFieldDefinition[],
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Required markers are visual. This story validates in the host wrapper and
|
|
87
|
-
* passes a string error back after the field is dirty.
|
|
88
|
-
*/
|
|
89
|
-
export const WithHostValidation: Story = {
|
|
90
|
-
args: {
|
|
91
|
-
fields: [
|
|
92
|
-
{
|
|
93
|
-
name: 'metadata_name',
|
|
94
|
-
label: 'Name',
|
|
95
|
-
required: true,
|
|
96
|
-
validation: 'onChange',
|
|
97
|
-
},
|
|
98
|
-
{ name: 'metadata_namespace', label: 'Namespace' },
|
|
99
|
-
] satisfies FormFieldDefinition[],
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/** Static select — options provided as a plain string array via `values`. */
|
|
104
|
-
export const WithSelect: Story = {
|
|
105
|
-
args: {
|
|
106
|
-
fields: [
|
|
107
|
-
{ name: 'metadata_name', label: 'Name', required: true },
|
|
108
|
-
{
|
|
109
|
-
name: 'spec_scope',
|
|
110
|
-
label: 'Scope',
|
|
111
|
-
required: true,
|
|
112
|
-
values: ['ClusterScoped', 'Namespaced'],
|
|
113
|
-
},
|
|
114
|
-
] satisfies FormFieldDefinition[],
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Edit mode — form pre-populated with `initialValues`.
|
|
120
|
-
* The `editMode` flag is available for consumers to conditionally
|
|
121
|
-
* disable fields or adjust layout.
|
|
122
|
-
*/
|
|
123
|
-
export const EditMode: Story = {
|
|
124
|
-
args: {
|
|
125
|
-
editMode: true,
|
|
126
|
-
initialValues: {
|
|
127
|
-
metadata_name: 'my-resource',
|
|
128
|
-
metadata_namespace: 'default',
|
|
129
|
-
},
|
|
130
|
-
fields: [
|
|
131
|
-
{ name: 'metadata_name', label: 'Name', required: true },
|
|
132
|
-
{ name: 'metadata_namespace', label: 'Namespace' },
|
|
133
|
-
] satisfies FormFieldDefinition[],
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/** All field types combined: text input and select. */
|
|
138
|
-
export const AllFieldTypes: Story = {
|
|
139
|
-
args: {
|
|
140
|
-
fields: [
|
|
141
|
-
{ name: 'metadata_name', label: 'Name', required: true },
|
|
142
|
-
{
|
|
143
|
-
name: 'spec_scope',
|
|
144
|
-
label: 'Scope',
|
|
145
|
-
values: ['ClusterScoped', 'Namespaced'],
|
|
146
|
-
},
|
|
147
|
-
] satisfies FormFieldDefinition[],
|
|
148
|
-
},
|
|
149
|
-
};
|