@corvina/web-components-library 1.0.0-beta.8 → 1.0.0-beta.9

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/CHANGELOG.md CHANGED
@@ -36,6 +36,10 @@ Breaking changes:
36
36
  its container with a white area (`style="height: 100%"` on the root and on the `v-data-table-server` are gone).
37
37
  A container that sizes the table with `height` keeps working; a flex container needs `min-height: 0` on its
38
38
  items. With `infiniteScroll` the table still fills its container.
39
+ - `CvSelect` is a form field like `CvTextField`: `v-model` on `modelValue` (`update:modelValue`; were `model` and
40
+ `update:model`), `label`, room for the error messages below it unless `hideDetails` (it always hid them), the
41
+ frontend-new look instead of the app's Vuetify defaults. `items` that are `CORVINA.FIELD.ITEM` can be `disabled`; the
42
+ only option of an empty select is selected (INPUT-4, `autoSelect` `false` to keep it empty).
39
43
 
40
44
  Added:
41
45
 
@@ -72,6 +76,22 @@ Added:
72
76
  reports a failure: the title in alert, the error illustration, one button that emits `update:open`, and the `details`
73
77
  and `actions` slots. `title`, `message` (or the default slot), `confirmLabel`, `cancelLabel`, `maxWidth` (290 and 550
74
78
  by default). In the web components the dialog stays in the shadow root.
79
+ - `CvSnackbar` (`<cv-snackbar>`): frontend-new's snackbar, `open` owned by the parent. `type` (`CORVINA.SNACKBAR.TYPE`)
80
+ `success`, `warning` or `error` sets the colour, `position` (`CORVINA.SNACKBAR.POSITION`) `bottom` or `top`; `title`,
81
+ `message`, a default slot below them. The close button (`closeLabel`) and the end of `timeout` (5000 ms, `-1` to stay)
82
+ emit `update:open` with `false`. In the web components it stays in the shadow root.
83
+ - Form fields, the look of frontend-new's side panel fields: `CvTextField` (`<cv-text-field>`; `type`
84
+ `CORVINA.FIELD.TYPE` `text`, `password` with the button that shows it, or `number`, which holds a number; `loading`,
85
+ `clearable`, `min`, `max`), `CvTextarea` (`<cv-textarea>`; `rows`, `autoGrow`, `noResize`), `CvCheckbox`
86
+ (`<cv-checkbox>`), `CvSwitch` (`<cv-switch>`) and `CvRadioGroup` (`<cv-radio-group>`; `items`
87
+ `CORVINA.FIELD.ITEM[]`, `inline`). Each has `modelValue` (`v-model`), `label`, `placeholder` (text fields), `help`
88
+ (the (?) with its tooltip), `disabled` (g4) with `disabledReason` (the tooltip that says why), `readonly`, `rules`
89
+ (`CORVINA.FIELD.RULE[]`), `errorMessages` and `hideDetails`. A `v-form` of the page sees them (Vue); in the web
90
+ components each field emits `update:valid` and has the methods `validate()`, `reset()` and `resetValidation()`.
91
+ `CvSelect` has them too (see the breaking changes), with `multiple` and `clearable`.
92
+ - `CvAutocomplete` (`<cv-autocomplete>`): a `CvSelect` that filters its `items` on what is typed (INPUT-2), or with a
93
+ `searchFunction` (`CORVINA.FIELD.SEARCH`, `(search, page) => items`, as the breadcrumb's autocomplete filters) searches
94
+ on the server, the next pages at the end of the menu. `noDataText`, `loadingText`.
75
95
  - `CvBreadcrumb` sort, as in frontend-new: `allowedSorts` (`CORVINA.BREADCRUMB.SORT_BY[]`) shows a sort dropdown
76
96
  and the direction button after the slot, `sort` (`CORVINA.BREADCRUMB.SORT`, `key` and `desc`) owned by the parent
77
97
  (`update:sort`), `sortPlaceholder`. Without `allowedSorts` there is no sort.
@@ -80,6 +100,7 @@ Added:
80
100
 
81
101
  Fixed:
82
102
 
103
+ - The icon buttons of `CvTable` and `CvBreadcrumb` no longer submit a form they are in (`type="button"`).
83
104
  - `CvBreadcrumb`: a filter key selected in the dropdown is dropped when `allowedFilters` no longer contain it.
84
105
  - `CvBreadcrumb` looks like frontend-new's breadcrumb: full-height light dividers (`CvBreadcrumbDivider` too,
85
106
  was a 25px dark line), the filter area 860px wide and starting with a divider, the filter key dropdown 13em on the
@@ -109,9 +130,15 @@ Fixed:
109
130
  bundled (JS -23 KB, gzip -7 KB).
110
131
  - `loadFonts()` adds a `<link>` to the Google Fonts css2 API (Roboto, Material Symbols) instead of using
111
132
  webfontloader: the `wf-loading`/`wf-active` classes are no longer set on `<html>`.
133
+ - Types: the props with a default are optional (`CvTable` `headers`, `items`, `itemsPerPage`, `currentPage`,
134
+ `itemsLength`; `CvTabs` `tabs`; `CvBreadcrumb` `icon`, `path`; `CvIcon` `icon`). The `searchFunction` of the
135
+ breadcrumb filters and `CORVINA.FIELD.SEARCH` return `unknown[]`, the `props` of the custom cell, header and filter
136
+ components are `Record<string, unknown>` (were `any`): the app's own types fit them as before.
112
137
 
113
138
  ### `@corvina/web-components-library` (from 0.2.4)
114
139
 
140
+ - `<cv-select>`: `modelValue` and `update:modelValue` (were `model` and `update:model`), and the other changes of
141
+ `CvSelect` in the Vue package.
115
142
  - The elements are `<cv-table>`, `<cv-button>`, ... (were `<corvina-table>`, ...): the fourth parameter of
116
143
  `initCorvinaComponents(locale, shouldLoadTheme, shouldLoadFonts, prefix)` is the start of the tags, `'corvina'` for
117
144
  the 0.x ones. The VS Code custom data lists the `cv-` tags.
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Corvina Components Library
2
+
2
3
  This library is a collection of web components aimed to be used in the Corvina App.
3
4
 
4
5
  # Documentation
@@ -6,7 +7,7 @@ This library is a collection of web components aimed to be used in the Corvina A
6
7
  The components documentation and live examples are available in the [Storybook for web components](https://docs.components.corvina.cloud/).
7
8
  The Vue components version is available [here](https://docs.components.corvina.cloud/vue/).
8
9
 
9
- # Installation
10
+ # Installation
10
11
 
11
12
  To install the package run the following command:
12
13
 
@@ -19,15 +20,16 @@ npm install @corvina/web-components-library
19
20
  Add the following code to your main.js file:
20
21
 
21
22
  ```js
22
- import CorvinaComponents from "@corvina/web-components-library";
23
- import "@corvina/web-components-library/web-components-library.css"
24
- // locale: string = 'en', shouldLoadTheme: boolean = false, shouldLoadFonts: boolean = false, prefix: string = 'cv'
25
- CorvinaComponents.initCorvinaComponents('en')
23
+ import CorvinaComponents from '@corvina/web-components-library';
24
+ import '@corvina/web-components-library/web-components-library.css';
25
+ // locale: string = 'en', shouldLoadTheme: boolean = false, shouldLoadFonts: boolean = false, prefix: string = 'cv'
26
+ CorvinaComponents.initCorvinaComponents('en');
26
27
  ```
28
+
27
29
  The elements are `<cv-table>`, `<cv-button>`, ...: `prefix` changes the start of the tags, e.g. `'corvina'` for the
28
30
  0.x tags (`<corvina-table>`). The components are defined once per page, with the prefix of the first call.
29
31
  If you use Vuetify in the hosting app set shouldLoadTheme to false otherwise to true.
30
- If you already load the fonts in the hosting app (Roboto, MaterialSymbols, ExorFontIcon) set shouldLoadFonts to false otherwise to true.
32
+ If you already load the fonts in the hosting app (Roboto, MaterialSymbols, ExorFontIcon) set shouldLoadFonts to false otherwise to true.
31
33
 
32
34
  The components draw the Corvina icons with ligatures, so they do not need `icons-corvina-classes-font-face.css`:
33
35
  that file is only for Corvina icons used as CSS classes (`<i class="ecc-T-Add"></i>`) in the hosting app markup.
@@ -57,4 +59,4 @@ Add it to the `.vscode/settings.json` of your project:
57
59
  ```
58
60
 
59
61
  Reload the VS Code window after changing the setting.
60
- Attributes marked as *complex value* (arrays and objects, e.g. the table `headers` and `items`) must be set as JavaScript properties, not as HTML attributes.
62
+ Attributes marked as _complex value_ (arrays and objects, e.g. the table `headers` and `items`) must be set as JavaScript properties, not as HTML attributes.
package/index.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare namespace CORVINA {
56
56
  * Return an empty array to tell there is no more data.
57
57
  * Required if type is FILTER_BY_ENUM.AUTOCOMPLETE.
58
58
  */
59
- searchFunction?: (search: string, page: number) => Array<any> | Promise<Array<any>>;
59
+ searchFunction?: (search: string, page: number) => unknown[] | Promise<unknown[]>;
60
60
  /** Property on the items returned by the `searchFunction` that contains the title, shown in the options and in the chip (`FILTER.title`). Required if type is FILTER_BY_ENUM.AUTOCOMPLETE. */
61
61
  itemsTitleKey?: string;
62
62
  /** Property on the items returned by the `searchFunction` that contains the identifier, used as `FILTER.value` of the selected item. Required if type is FILTER_BY_ENUM.AUTOCOMPLETE. */
@@ -91,7 +91,7 @@ export declare namespace CORVINA {
91
91
  /** Name of the Vue component or Vue component definition */
92
92
  component: string | Component;
93
93
  /** Vue component's props */
94
- props?: Record<string, any>;
94
+ props?: Record<string, unknown>;
95
95
  /** Name of the prop that will contain the row item */
96
96
  itemPropName?: string;
97
97
  /** Name of the prop that indicates where the component should be positioned */
@@ -151,6 +151,47 @@ export declare namespace CORVINA {
151
151
  INFORM = "inform"
152
152
  }
153
153
  }
154
+ namespace FIELD {
155
+ /** A validation rule of a field (Vuetify's): `true`, or the message of the error. */
156
+ type RULE = ((value: any) => true | string) | ((value: any) => Promise<true | string>);
157
+ /** What a CvTextField holds. */
158
+ enum TYPE {
159
+ TEXT = "text",
160
+ /** Hidden, with a button that shows it */
161
+ PASSWORD = "password",
162
+ /** A number: `modelValue` is a number, `null` when empty */
163
+ NUMBER = "number"
164
+ }
165
+ /** A choice of a CvRadioGroup, CvSelect or CvAutocomplete (which also take other objects, see `itemTitle`). */
166
+ interface ITEM {
167
+ title: string;
168
+ value: string | number | boolean;
169
+ disabled?: boolean;
170
+ }
171
+ /**
172
+ * The search of a CvAutocomplete on the server: the items matching `search`, page `page` (from 0). An empty page
173
+ * ends the list. As the `searchFunction` of a CORVINA.BREADCRUMB.FILTER_BY.
174
+ */
175
+ type SEARCH = (search: string, page: number) => unknown[] | Promise<unknown[]>;
176
+ }
177
+ namespace SNACKBAR {
178
+ /** What a CvSnackbar reports, which sets its colour. */
179
+ enum TYPE {
180
+ /** An operation succeeded (design system FEEDBACK-2) */
181
+ SUCCESS = "success",
182
+ /** Something the user should know, that blocks nothing */
183
+ WARNING = "warning",
184
+ /** A minor failure; an operation that failed is reported with an informing CvDialog (FEEDBACK-3) */
185
+ ERROR = "error"
186
+ }
187
+ /** Where a CvSnackbar appears. */
188
+ enum POSITION {
189
+ /** Centred at the bottom of the window */
190
+ BOTTOM = "bottom",
191
+ /** Centred at the top, below the bars of the page */
192
+ TOP = "top"
193
+ }
194
+ }
154
195
  namespace PANEL {
155
196
  /** Where a CvPanel slides in from. */
156
197
  enum POSITION {
@@ -258,7 +299,7 @@ export declare namespace CORVINA {
258
299
  /** Name of the Vue component or Vue component definition */
259
300
  component: string | Component;
260
301
  /** Vue component's props */
261
- props?: Record<string, any>;
302
+ props?: Record<string, unknown>;
262
303
  /** Name of the prop that will contain the row item */
263
304
  itemPropName?: string;
264
305
  }
@@ -278,7 +319,7 @@ export declare namespace CORVINA {
278
319
  /** Name of the Vue component or Vue component definition */
279
320
  component: string | Component;
280
321
  /** Vue component's props */
281
- props?: Record<string, any>;
322
+ props?: Record<string, unknown>;
282
323
  }
283
324
  /**
284
325
  * Interface representing a table header entry.
package/package.json CHANGED
@@ -1,20 +1,16 @@
1
1
  {
2
- "name": "@corvina/web-components-library",
3
- "version": "1.0.0-beta.8",
4
- "private": false,
5
- "description": "Corvina web components (custom elements)",
6
- "homepage": "https://docs.components.corvina.cloud/",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/Corvina-R-D/corvina-components-library.git"
10
- },
11
- "keywords": ["corvina", "web-components", "custom-elements", "vuetify"],
12
- "main": "web-components-library.umd.js",
13
- "module": "web-components-library.es.js",
14
- "types": "web-components-library.es.d.ts",
15
- "files": [
16
- "*",
17
- "**/*"
18
- ]
19
- }
20
-
2
+ "name": "@corvina/web-components-library",
3
+ "version": "1.0.0-beta.9",
4
+ "private": false,
5
+ "description": "Corvina web components (custom elements)",
6
+ "homepage": "https://docs.components.corvina.cloud/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Corvina-R-D/corvina-components-library.git"
10
+ },
11
+ "keywords": ["corvina", "web-components", "custom-elements", "vuetify"],
12
+ "main": "web-components-library.umd.js",
13
+ "module": "web-components-library.es.js",
14
+ "types": "web-components-library.es.d.ts",
15
+ "files": ["*", "**/*"]
16
+ }