ngx-wapp-components 3.4.2 → 3.4.3-alpha.2
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/fesm2022/ngx-wapp-components-home-preview.mjs +1041 -0
- package/fesm2022/ngx-wapp-components-home-preview.mjs.map +1 -0
- package/fesm2022/ngx-wapp-components-schema-form.mjs +1018 -0
- package/fesm2022/ngx-wapp-components-schema-form.mjs.map +1 -0
- package/fesm2022/ngx-wapp-components.mjs +825 -576
- package/fesm2022/ngx-wapp-components.mjs.map +1 -1
- package/home-preview/README.md +53 -0
- package/package.json +25 -2
- package/schema-form/README.md +151 -0
- package/types/ngx-wapp-components-home-preview.d.ts +572 -0
- package/types/ngx-wapp-components-schema-form.d.ts +253 -0
- package/types/ngx-wapp-components.d.ts +402 -338
- package/types/ngx-wapp-components.d.ts.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ngx-wapp-components/home-preview
|
|
2
|
+
|
|
3
|
+
Purely visual components that reproduce the Customer Wallet Home (`/main`) for previews in managers
|
|
4
|
+
(change `home-preview`, HP-002..HP-007). They receive already interpreted values, inject nothing
|
|
5
|
+
(no router, HTTP or translations) and do not depend on Formly, Ajv or Material.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {
|
|
9
|
+
WHomePageFrameComponent,
|
|
10
|
+
WHomePromotionsWidgetComponent,
|
|
11
|
+
WHomeActionWidgetComponent,
|
|
12
|
+
WHomeA1Component,
|
|
13
|
+
WHomeActionIconDirective,
|
|
14
|
+
WHomeUnsupportedWidgetComponent
|
|
15
|
+
} from 'ngx-wapp-components/home-preview';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<w-home-page-frame [pageStyle]="pageStyle" [labels]="frameLabels">
|
|
20
|
+
<w-home-promotions-widget
|
|
21
|
+
[state]="'loaded'"
|
|
22
|
+
[items]="items"
|
|
23
|
+
[totalCount]="items.length"
|
|
24
|
+
[widgetStyle]="widget.style"
|
|
25
|
+
[config]="widget.config"
|
|
26
|
+
[labels]="promotionsLabels"
|
|
27
|
+
(viewAll)="noop()" (itemSelect)="noop()" (retry)="noop()">
|
|
28
|
+
</w-home-promotions-widget>
|
|
29
|
+
<w-home-action-widget [label]="label" [description]="description" [widgetStyle]="widget.style" [config]="widget.config">
|
|
30
|
+
<span wHomeActionIcon class="material-icons">person</span>
|
|
31
|
+
</w-home-action-widget>
|
|
32
|
+
<w-home-a1 [label]="label" [description]="description" [widgetStyle]="widget.style" [config]="widget.config">
|
|
33
|
+
<span wHomeActionIcon class="material-icons">person</span>
|
|
34
|
+
</w-home-a1>
|
|
35
|
+
<w-home-unsupported-widget [message]="unsupportedText"></w-home-unsupported-widget>
|
|
36
|
+
</w-home-page-frame>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Component | Inputs | Outputs |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `w-home-page-frame` | `pageStyle` (`backgroundColor` Hex6, `contentMargin` 0..48, `widgetGap` 0..32, `maxContentWidth` 320..1440, `showHeader`/`showMenu`/`showFooter` default `true`, `showGreeting`/`enablePullToRefresh` default `false`, `emptyStateMessage`), `labels`, `hasWidgets` (`false` shows the empty state) | — |
|
|
42
|
+
| `w-home-promotions-widget` (D1) | `state` (`loading`/`loaded`/`empty`/`error`), `items`, `totalCount`, `widgetStyle`, `config` (`previewLimit` 1..5 default 5, `showCount`), `labels`, `borderRadius` 0..24 | `viewAll`, `itemSelect`, `retry` |
|
|
43
|
+
| `w-home-action-widget` (A1) | `label`, `description`, `widgetStyle` (default background `#d4f0dd`), `config.showDescription`, `borderRadius` 0..24 | `select` |
|
|
44
|
+
| `w-home-a1` (A1) | Same inputs and output as `w-home-action-widget`; named composition wrapper | `select` |
|
|
45
|
+
| `w-home-unsupported-widget` | `message` | — |
|
|
46
|
+
|
|
47
|
+
- Invalid colors and out-of-range numbers fall back to the default, as in the Wallet.
|
|
48
|
+
- All texts come through inputs; the English defaults only avoid empty output.
|
|
49
|
+
- Widths follow the frame through container queries (`w-home`): cards take 74%, 44% from 768px and 32% from
|
|
50
|
+
1024px, where the carousel controls appear. Give the frame the width to preview (390/768/1024).
|
|
51
|
+
- `w-schema-form` emits `valueChange` with a copy of the public configuration after each user edit (HP-001),
|
|
52
|
+
so the consumer can refresh the preview; it does not emit again when the public value is unchanged. Debounce and
|
|
53
|
+
reset per property belong to the consumer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-wapp-components",
|
|
3
|
-
"version": "3.4.2",
|
|
3
|
+
"version": "3.4.3-alpha.2",
|
|
4
4
|
"description": "This is a Wapping reusable component library published by Wapping.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"url": "https://www.wappingweb.com/"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
+
"@databricks/aibi-client": "^2.0.0",
|
|
18
19
|
"@angular/animations": "^21.1.1",
|
|
19
20
|
"@angular/cdk": "^21.1.1",
|
|
20
21
|
"@angular/cli": "^21.1.1",
|
|
@@ -27,6 +28,9 @@
|
|
|
27
28
|
"@angular/platform-browser": "^21.1.1",
|
|
28
29
|
"@angular/platform-browser-dynamic": "^21.1.1",
|
|
29
30
|
"@angular/router": "^21.1.1",
|
|
31
|
+
"@ngx-formly/core": "~10.0.1",
|
|
32
|
+
"@ngx-formly/primeng": "~10.0.1",
|
|
33
|
+
"ajv": "^8.18.0",
|
|
30
34
|
"chart.js": "^4.4.3",
|
|
31
35
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
32
36
|
"cron-parser": "^5.0.4",
|
|
@@ -44,6 +48,17 @@
|
|
|
44
48
|
"primeng": "^21.0.4",
|
|
45
49
|
"xlsx": "^0.18.5"
|
|
46
50
|
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@ngx-formly/core": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@ngx-formly/primeng": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"ajv": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
47
62
|
"dependencies": {
|
|
48
63
|
"tslib": "^2.3.0"
|
|
49
64
|
},
|
|
@@ -57,7 +72,15 @@
|
|
|
57
72
|
".": {
|
|
58
73
|
"types": "./types/ngx-wapp-components.d.ts",
|
|
59
74
|
"default": "./fesm2022/ngx-wapp-components.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./home-preview": {
|
|
77
|
+
"types": "./types/ngx-wapp-components-home-preview.d.ts",
|
|
78
|
+
"default": "./fesm2022/ngx-wapp-components-home-preview.mjs"
|
|
79
|
+
},
|
|
80
|
+
"./schema-form": {
|
|
81
|
+
"types": "./types/ngx-wapp-components-schema-form.d.ts",
|
|
82
|
+
"default": "./fesm2022/ngx-wapp-components-schema-form.mjs"
|
|
60
83
|
}
|
|
61
84
|
},
|
|
62
85
|
"type": "module"
|
|
63
|
-
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# ngx-wapp-components/schema-form
|
|
2
|
+
|
|
3
|
+
`w-schema-form` renders a closed subset of JSON Schema (draft-07 by default, or 2020-12) with Formly and
|
|
4
|
+
PrimeNG. It emits `{ configuration, secrets }` and never preloads, stores or reports secret values
|
|
5
|
+
(change `schema-form-component`, SF-001..SF-009).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { WSchemaFormComponent, WSchemaFormSubmit } from 'ngx-wapp-components/schema-form';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<w-schema-form
|
|
13
|
+
[schema]="schema"
|
|
14
|
+
[values]="values"
|
|
15
|
+
[secretStates]="secretStates"
|
|
16
|
+
[translations]="translations"
|
|
17
|
+
(stateChange)="onState($event)"
|
|
18
|
+
(validSubmit)="onSubmit($event)"
|
|
19
|
+
(valueChange)="onValue($event)">
|
|
20
|
+
</w-schema-form>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`valueChange` emits a copy of the public configuration after each user edit (not on initialization), without
|
|
24
|
+
secrets or materialized defaults (change `home-preview`, HP-001).
|
|
25
|
+
|
|
26
|
+
The public API is the inputs, the outputs and `submit()`. The Formly form, fields and model are internal.
|
|
27
|
+
|
|
28
|
+
## Optional peer dependencies
|
|
29
|
+
|
|
30
|
+
Install them only if you use this entry point: `@ngx-formly/core ~10.0.1`, `@ngx-formly/primeng ~10.0.1`
|
|
31
|
+
and `ajv ^8.18.0`. The primary entry point `ngx-wapp-components` does not import them.
|
|
32
|
+
|
|
33
|
+
## Formly types registered in your application
|
|
34
|
+
|
|
35
|
+
The component imports `FormlyPrimeNGModule` and an internal `FormlyModule.forChild(...)` module. Formly keeps
|
|
36
|
+
one `FormlyConfig` per application (provided in `root`), so the first time `w-schema-form` is created these
|
|
37
|
+
registrations are added to the root Formly configuration of the consumer application:
|
|
38
|
+
|
|
39
|
+
| Kind | Names | Origin |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| Types | `input`, `string`, `number`, `integer`, `checkbox`, `boolean`, `select`, `enum`, `radio`, `textarea`, `datepicker` | `@ngx-formly/primeng` |
|
|
42
|
+
| Wrapper | `form-field` | `@ngx-formly/primeng` |
|
|
43
|
+
| Type | `w-schema-form-secret` | this entry point (secret entry) |
|
|
44
|
+
| Type | `w-schema-form-color` | this entry point (text + color picker) |
|
|
45
|
+
| Type | `w-schema-form-image` | consumer integration (image upload + URL value) |
|
|
46
|
+
| Type | `w-schema-form-toggle` | this entry point (booleans, `w-edit-toggle`) |
|
|
47
|
+
| Type | `w-schema-form-multiselect` | this entry point (`uniqueItems` enum arrays, `w-edit-multiselect`) |
|
|
48
|
+
| Wrapper | `w-schema-form-field` | this entry point (label, required marker, description tooltip, errors) |
|
|
49
|
+
| Wrapper | `w-schema-form-group` | this entry point (`fieldset` with `legend` for presentation groups) |
|
|
50
|
+
|
|
51
|
+
If your application registers its own Formly types or wrappers with the same names, the last registration
|
|
52
|
+
wins for the whole application. Use other names for your own types, or register the same PrimeNG types.
|
|
53
|
+
The internal names are prefixed with `w-schema-form` to avoid collisions; the global `checkbox` and `select`
|
|
54
|
+
types are not replaced.
|
|
55
|
+
|
|
56
|
+
## Wapping controls
|
|
57
|
+
|
|
58
|
+
Booleans are rendered with `w-edit-toggle` and `uniqueItems` enum arrays with `w-edit-multiselect`
|
|
59
|
+
(change `schema-form-presentation`, SFP-002). An absent optional boolean or array stays absent until the user
|
|
60
|
+
edits it; schema `default` values are not materialized. The native control keeps the generated `id`, the
|
|
61
|
+
`label[for]`, `aria-describedby` and `aria-required`, and follows the disabled state of the form control.
|
|
62
|
+
|
|
63
|
+
## Presentation groups
|
|
64
|
+
|
|
65
|
+
A direct property of the root schema may declare `x-wapping-group` with one of `connector`, `connection`,
|
|
66
|
+
`capabilities` or `mapping` (`W_SCHEMA_FORM_GROUPS`). Groups are presentation only (SFP-001):
|
|
67
|
+
|
|
68
|
+
- They are shown in that fixed order, as a `fieldset` with a `legend`; empty groups are not shown.
|
|
69
|
+
- Ungrouped properties are shown first; a schema without annotations keeps the previous structure.
|
|
70
|
+
- The model, the control paths (`/account/shopDomain`), validation and `{ configuration, secrets }` do not change.
|
|
71
|
+
- An unknown value, a non-string value or the annotation on a nested property (or inside `$defs`) is a
|
|
72
|
+
configuration error: the component shows the error state and does not emit.
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{ "properties": { "account": { "type": "object", "x-wapping-group": "connection" } } }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Declared groups (since 3.9.0, SFP-007)
|
|
79
|
+
|
|
80
|
+
The root schema may instead declare its own groups with `x-wapping-groups`, an ordered non-empty array of
|
|
81
|
+
`{ "key", "title", "description"? }` (`key` matches `^[a-z][a-zA-Z0-9-]*$` and is unique; `title` is
|
|
82
|
+
required; no other members). Then `x-wapping-group` of a direct root property must be one of those keys:
|
|
83
|
+
|
|
84
|
+
- Groups are shown in the declared order with `title` as legend and `description` below it; empty groups are
|
|
85
|
+
not shown; ungrouped properties come first.
|
|
86
|
+
- The fixed connector groups do not apply to that schema (`connection` is then an unknown key).
|
|
87
|
+
- `x-wapping-groups` outside the root, a malformed list or an undeclared key is a configuration error.
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"x-wapping-groups": [{ "key": "colors", "title": "Colores" }],
|
|
92
|
+
"properties": { "colors": { "type": "object", "x-wapping-group": "colors" } }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Color fields
|
|
97
|
+
|
|
98
|
+
Add `"x-wapping-widget": "color"` to a `type: "string"` property (without `enum`, `const` or secret
|
|
99
|
+
annotations) to show a text entry with a PrimeNG color picker. The picker writes `#rrggbb`; validation still
|
|
100
|
+
comes from the schema (for example `"pattern": "^#[0-9A-Fa-f]{6}$"`). Clearing the text removes the property.
|
|
101
|
+
Any other value or placement of `x-wapping-widget` is a configuration error. Available since 3.7.0.
|
|
102
|
+
|
|
103
|
+
## Reference selectors
|
|
104
|
+
|
|
105
|
+
The consumer can render `menu-item`, `service-program`, `product-list` and `store` annotations as selects on
|
|
106
|
+
editable integer properties. Provide the current business's options through `referenceOptions`; the form keeps
|
|
107
|
+
numeric identifiers and never turns a reference into free text:
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<w-schema-form [schema]="schema" [values]="values" [referenceOptions]="referenceOptions"></w-schema-form>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
referenceOptions = {
|
|
115
|
+
'menu-item': [{ value: 12, label: 'Perfil' }]
|
|
116
|
+
};
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Reference annotations require `type: "integer"` and cannot use `enum` or `const`. Missing option lists render an
|
|
120
|
+
empty select; the owning application is responsible for loading options and validating that saved references are
|
|
121
|
+
still valid for the business.
|
|
122
|
+
|
|
123
|
+
## Image fields
|
|
124
|
+
|
|
125
|
+
Add `"x-wapping-widget": "image"` to an editable `type: "string"` property to render
|
|
126
|
+
the Formly type `w-schema-form-image`, which must be registered by the consumer and may reuse
|
|
127
|
+
`w-image-file-uploader`. Configure the consumer-owned endpoint with the `imageUpload` input:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
imageUpload: WSchemaFormImageUpload = {
|
|
131
|
+
uploadUrl,
|
|
132
|
+
headers,
|
|
133
|
+
imageUploadConfig
|
|
134
|
+
};
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The endpoint must return `{ "url": "https://..." }`. A successful upload replaces the form
|
|
138
|
+
control value; clearing the component removes the property without deleting the remote blob.
|
|
139
|
+
Upload errors and invalid responses block submission. URLs and storage routes are not owned by
|
|
140
|
+
the library.
|
|
141
|
+
|
|
142
|
+
## Translations
|
|
143
|
+
|
|
144
|
+
`W_SCHEMA_FORM_DEFAULT_TRANSLATIONS` (Spanish) is frozen. Pass your own `WSchemaFormTranslations` object;
|
|
145
|
+
`null` falls back to the defaults. `fields` overrides labels and descriptions by JSON Pointer (also for
|
|
146
|
+
objects reached through a local `$ref`). Descriptions are shown as a help tooltip next to the label.
|
|
147
|
+
`options` translates the shown label of `enum` options (single selects and `uniqueItems` enum arrays) by
|
|
148
|
+
technical value; the model and the emitted configuration keep the technical value, and a value without label
|
|
149
|
+
is shown as is.
|
|
150
|
+
`groups` translates the group legends by group key; a missing or empty label falls back to the default
|
|
151
|
+
(`Conector`, `Conexión`, `Capacidades`, `Mapeo`) or, for declared groups, to the schema `title`.
|