@corvina/web-components-library 1.0.0-beta.1 → 1.0.0-beta.10

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
@@ -6,12 +6,22 @@ Both packages are built from the same sources and released with the same version
6
6
 
7
7
  Vue 3.5 and Vuetify 4.
8
8
 
9
- ### `@corvina/vue-components-library` (from 0.2.3)
9
+ Browsers: the JS and CSS are built for Vite 8's default target (`baseline-widely-available`: Chrome and
10
+ Edge 111, Firefox 114, Safari and iOS 16.4), with no transpiling to ES2016 anymore (`?.`, `??` and `async`
11
+ are kept).
12
+
13
+ ### `@corvina/vue-components-library` (from 0.2.4)
10
14
 
11
15
  Breaking changes:
12
16
 
17
+ - The components are registered as `CvTable`, `CvButton`, ... (were `CorvinaTable`, `CorvinaButton`, ...), and the named
18
+ exports and the files are renamed the same way. `app.use(components, { prefix: 'corvina' })` keeps registering the
19
+ 0.x names (`<CorvinaTable>`, `<corvina-table>` in templates) while the app renames its templates; `GlobalComponents`
20
+ types both.
13
21
  - `vue` (^3.5) and `vuetify` (^4.3) are peer dependencies, provided by the app: the package no longer
14
- bundles Vuetify 3 (JS 554 → 205 KB, gzip 160 → 76 KB; the ExorFontIcon font is in it as a data URL).
22
+ bundles Vuetify 3 (JS 554 → 188 KB, gzip 160 → 71 KB; the ExorFontIcon font is in it as a data URL).
23
+ - Modern syntax (see Browsers above): an app that targets older browsers transpiles the package with its
24
+ bundler (Vite does it by itself in the build).
15
25
  - ESM only: the CommonJS and UMD builds are gone (`exports` has no `require` condition).
16
26
  - The library CSS no longer contains the Vuetify CSS (132 → 20 KB): the app imports `vuetify/styles`.
17
27
  To get the Corvina look, build the Vuetify styles with the exported settings:
@@ -20,35 +30,144 @@ Breaking changes:
20
30
  CSS is in CSS layers and the first CSS loaded sets their order.
21
31
  - The components use the Vuetify defaults of the app (e.g. the `variant` of fields), not the library ones.
22
32
  - `--color-*` variables: the package CSS now has the components' palette (`--color-primary` #496177,
23
- `--color-highlight` #01a3dd, ...). 0.2.3 ended with an older palette (#004688, #00b0c7, ...).
33
+ `--color-highlight` #01a3dd, ...). 0.2.4 ended with an older palette (#004688, #00b0c7, ...).
34
+ - `CvTable` (paginated) is as tall as its rows, at most as its container, as in frontend-new: with few rows the
35
+ footer follows the last one, with more than fit it stays at the bottom while the rows scroll. It no longer fills
36
+ its container with a white area (`style="height: 100%"` on the root and on the `v-data-table-server` are gone).
37
+ A container that sizes the table with `height` keeps working; a flex container needs `min-height: 0` on its
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).
43
+ - A disabled `CvButton` is `--color-g4` (text, icon, border; the background of `filled`), without Vuetify's opacity
44
+ (STATE-3): it was g2 at 26% opacity. Disabled menu entries of `CvTable` are g4 too (were Vuetify's 60% opacity).
24
45
 
25
46
  Added:
26
47
 
27
48
  - `./settings.scss` export (Vuetify Sass settings of the library).
49
+ - `CvTable` cell slots `item.<key>` (as in Vuetify's tables): a column's cells written in the template,
50
+ with `item`, `value`, `index` and `column` (`CORVINA.TABLE.CellSlotProps`). The slot replaces the content of the
51
+ column's `type`, now optional in `TableHeaderEntry`. Columns without a slot render as before.
52
+ - `CvTabs` (`<cv-tabs>`): the tabs of a page with the Corvina look, `tabs` (`CORVINA.TABS.TAB[]`) and
53
+ `selected` owned by the parent (`update:selected` on a click), a content for each tab in the `tab.<value>` slots
54
+ (only the selected one is shown; web components: `slot="tab.<value>"` children), or one in the default slot, and
55
+ actions on the right of the bar in the `append` slot.
56
+ - `CvDateRange` (`<cv-date-range>`): a range of days for the breadcrumb, `model` (`CORVINA.DATE_RANGE.RANGE`,
57
+ ISO days) owned by the parent (`update:model` from the accept button), `presets` (`CORVINA.DATE_RANGE.PRESET[]`) and
58
+ the start and end calendars; highlighted while a range is set, underlined as frontend-new's field (highlight color
59
+ on hover; the text from the start of the underline, both 16px in while a range is set).
60
+ - `CvPanel` (`<cv-panel>`): the panels of frontend-new, `open` owned by the parent. `position` (`CORVINA.PANEL.POSITION`)
61
+ `right` (full height, `width` 340 by default, at most 75% of the window) or `bottom` (the lower half of the window).
62
+ `type` (`CORVINA.PANEL.TYPE`) `edit` creates or edits: a fixed header with the icon, `operation` over `title`, the
63
+ help button, cancel and confirm (OperationalComponent), the body scrolling under it; `confirm` leaves it open,
64
+ cancel emits `cancel` and `update:open`; `confirmDisabled`, `loading` (cancel and the body locked), `collapsed` (only
65
+ the header, in the bottom corner); the `help` slot opens on the left of the panel, the `actions` slot adds buttons to
66
+ the header. `type` `help` explains: the help icon, `title` and Close (`update:open`), the help in the default slot
67
+ with the docs look (in the web components the slotted content keeps the page's styles). Replaces `CvHelpPanel`
68
+ (`<cv-help-panel>`) of the betas: `<CvPanel position="bottom" type="help">`, same `title`, `closeLabel` and
69
+ `data-qa`.
70
+ - `CvInfiniteLoader` (`<cv-infinite-loader>`): the infinite scroll of the autocomplete filters, for the app's
71
+ own lists. It emits `infinite` (`$state`: `CORVINA.INFINITE_LOADER.StateHandler`) when it is visible in its scrolling
72
+ container, not again while a page loads; `loaded()`, `complete()` (stops it) and `error()` (retry button, `retryLabel`);
73
+ `identifier` starts it again from the first page. Slots `spinner`, `complete` and `error` (Vue: with `retry`).
74
+ - `CvDialog` (`<cv-dialog>`): the dialogs of frontend-new's ConfirmedModal and ErrorModal, `open` owned by the
75
+ parent. `type` `confirm` (`CORVINA.DIALOG.TYPE`) asks before an action: Cancel then the confirm button, highlight or
76
+ alert with `destructive` (the title too), `loading` while the operation runs (both buttons disabled), `confirmationValue`
77
+ for a text to type before confirming; `confirm` leaves it open, Cancel emits `cancel` and `update:open`. `type` `inform`
78
+ reports a failure: the title in alert, the error illustration, one button that emits `update:open`, and the `details`
79
+ and `actions` slots. `title`, `message` (or the default slot), `confirmLabel`, `cancelLabel`, `maxWidth` (290 and 550
80
+ by default). In the web components the dialog stays in the shadow root.
81
+ - `CvSnackbar` (`<cv-snackbar>`): frontend-new's snackbar, `open` owned by the parent. `type` (`CORVINA.SNACKBAR.TYPE`)
82
+ `success`, `warning` or `error` sets the colour, `position` (`CORVINA.SNACKBAR.POSITION`) `bottom` or `top`; `title`,
83
+ `message`, a default slot below them. The close button (`closeLabel`) and the end of `timeout` (5000 ms, `-1` to stay)
84
+ emit `update:open` with `false`. In the web components it stays in the shadow root.
85
+ - Form fields, the look of frontend-new's side panel fields: `CvTextField` (`<cv-text-field>`; `type`
86
+ `CORVINA.FIELD.TYPE` `text`, `password` with the button that shows it, or `number`, which holds a number; `loading`,
87
+ `clearable`, `min`, `max`), `CvTextarea` (`<cv-textarea>`; `rows`, `autoGrow`, `noResize`), `CvCheckbox`
88
+ (`<cv-checkbox>`), `CvSwitch` (`<cv-switch>`) and `CvRadioGroup` (`<cv-radio-group>`; `items`
89
+ `CORVINA.FIELD.ITEM[]`, `inline`). Each has `modelValue` (`v-model`), `label`, `placeholder` (text fields), `help`
90
+ (the (?) with its tooltip), `disabled` (g4) with `disabledReason` (the tooltip that says why), `readonly`, `rules`
91
+ (`CORVINA.FIELD.RULE[]`), `errorMessages` and `hideDetails`. A `v-form` of the page sees them (Vue); in the web
92
+ components each field emits `update:valid` and has the methods `validate()`, `reset()` and `resetValidation()`.
93
+ `CvSelect` has them too (see the breaking changes), with `multiple` and `clearable`.
94
+ - `CvAutocomplete` (`<cv-autocomplete>`): a `CvSelect` that filters its `items` on what is typed (INPUT-2), or with a
95
+ `searchFunction` (`CORVINA.FIELD.SEARCH`, `(search, page) => items`, as the breadcrumb's autocomplete filters) searches
96
+ on the server, the next pages at the end of the menu. `noDataText`, `loadingText`.
97
+ - `CvButton` `disabledReason`: while the button is disabled, its tooltip says why (STATE-2), in place of `tooltip`.
98
+ - `CvTable` row buttons (`CORVINA.TABLE.PropButtonEntry`): `disabled`, with `disabledReason` for the tooltip, and
99
+ `dataQa`. Menu entries (`MenuPropEntry`) have `disabledReason` too. Each row has its own buttons: the `ROW_ACTIONS`
100
+ stories leave out what the user may never do (STATE-1), disable with the reason what the row does not allow
101
+ (STATE-2), and put View in the slot of Edit for a read-only user (STATE-4).
102
+ - `CvBreadcrumb` sort, as in frontend-new: `allowedSorts` (`CORVINA.BREADCRUMB.SORT_BY[]`) shows a sort dropdown
103
+ and the direction button after the slot, `sort` (`CORVINA.BREADCRUMB.SORT`, `key` and `desc`) owned by the parent
104
+ (`update:sort`), `sortPlaceholder`. Without `allowedSorts` there is no sort.
105
+ - `CvBreadcrumb` `filterBy`: the `key` of the filter selected in the filter key dropdown, selected again when
106
+ `allowedFilters` change (e.g. on another tab).
28
107
 
29
108
  Fixed:
30
109
 
110
+ - The icon buttons of `CvTable` and `CvBreadcrumb` no longer submit a form they are in (`type="button"`).
111
+ - `CvBreadcrumb`: a filter key selected in the dropdown is dropped when `allowedFilters` no longer contain it.
112
+ - `CvBreadcrumb` looks like frontend-new's breadcrumb: full-height light dividers (`CvBreadcrumbDivider` too,
113
+ was a 25px dark line), the filter area 860px wide and starting with a divider, the filter key dropdown 13em on the
114
+ g1 background without the underline, the filter value field 16px from it.
115
+ - `CvTable` rows are highlighted on hover (Vuetify's standard `hover`), the expanded content is not, as in
116
+ frontend-new; the items-per-page select of the footer is underlined, with "Rows per page:" (Vuetify's
117
+ `dataTable.itemsPerPageText`, translated) and the selected value of its menu in the highlight color, as in
118
+ frontend-new.
119
+ - Scrollbars as in frontend-new: thin, a highlight thumb on g1, in every component (the `custom-scrollbars` class
120
+ on their root, also in the package CSS for the app's own containers).
31
121
  - Type declarations: relative imports have the `.js` extension, so they resolve with TypeScript
32
122
  `moduleResolution` `node16`/`nodenext` too (the package is now `"type": "module"`).
33
123
  - `AutocompleteFilter` (breadcrumb and table filters) threw on focus (Vuetify 2 API): the menu now opens on focus.
124
+ - Infinite scroll of the autocomplete filters (breadcrumb and table): no page is requested while one is loading. Two
125
+ pages requested together became one fetch (it is debounced) and a page of results was skipped. The next page is
126
+ requested when the end of the menu is visible, while scrolling: all the pages were requested one after the other
127
+ when the menu opened (the end of the list was checked against the window). The spinner has the primary color in the
128
+ web components too (was black).
129
+ - `AutocompleteFilter` imports `VCombobox` from `vuetify/components/VCombobox`, not from the `vuetify/components`
130
+ barrel: an app whose Vite dev server does not pre-bundle Vuetify loaded every Vuetify component (a Log page with
131
+ the breadcrumb: 777 → 484 module requests).
34
132
  - Breadcrumb filter chip arrows are 25px as in the web components (the Vuetify 52px rule won before).
35
133
  - The package only contains the files it needs (61 → 27): no type declarations of internal modules or of the web
36
134
  components entry, no favicon and logo.
135
+ - No dependencies besides the peer ones: the infinite scroll of the autocomplete filters no longer uses
136
+ `v3-infinite-loading` (declared, and bundled too), `lodash-es` (for `debounce`) and `webfontloader` are no longer
137
+ bundled (JS -23 KB, gzip -7 KB).
138
+ - `loadFonts()` adds a `<link>` to the Google Fonts css2 API (Roboto, Material Symbols) instead of using
139
+ webfontloader: the `wf-loading`/`wf-active` classes are no longer set on `<html>`.
140
+ - Types: the props with a default are optional (`CvTable` `headers`, `items`, `itemsPerPage`, `currentPage`,
141
+ `itemsLength`; `CvTabs` `tabs`; `CvBreadcrumb` `icon`, `path`; `CvIcon` `icon`). The `searchFunction` of the
142
+ breadcrumb filters and `CORVINA.FIELD.SEARCH` return `unknown[]`, the `props` of the custom cell, header and filter
143
+ components are `Record<string, unknown>` (were `any`): the app's own types fit them as before.
37
144
 
38
- ### `@corvina/web-components-library` (from 0.2.3)
145
+ ### `@corvina/web-components-library` (from 0.2.4)
39
146
 
40
- - Vuetify 4 and Vue 3.5 bundled (were Vuetify 3.7 and Vue 3.5). JS 1.06 → 1.27 MB (gzip 265 → 322 KB),
41
- mostly Vuetify 4 itself.
42
- - No dependencies declared: Vue, Vuetify and the other libraries are bundled (0.2.3 declared `vue` and
147
+ - `<cv-select>`: `modelValue` and `update:modelValue` (were `model` and `update:model`), and the other changes of
148
+ `CvSelect` in the Vue package.
149
+ - The elements are `<cv-table>`, `<cv-button>`, ... (were `<corvina-table>`, ...): the fourth parameter of
150
+ `initCorvinaComponents(locale, shouldLoadTheme, shouldLoadFonts, prefix)` is the start of the tags, `'corvina'` for
151
+ the 0.x ones. The VS Code custom data lists the `cv-` tags.
152
+ - Vuetify 4 and Vue 3.5 bundled (were Vuetify 3.7 and Vue 3.5). JS 1.06 → 1.38 MB (gzip 265 → 344 KB),
153
+ mostly Vuetify 4 itself (its date picker for `CvDateRange` included).
154
+ - Runs on the browsers listed above (Browsers): 0.2.4 was transpiled to ES2016.
155
+ - No dependencies declared: Vue, Vuetify and the other libraries are bundled (0.2.4 declared `vue` and
43
156
  `vuetify` 3, installed without being used).
44
157
  - The bundle runs without a bundler (`<script type="module">`): `process` is no longer referenced.
158
+ - `v3-infinite-loading`, `lodash-es` and `webfontloader` are no longer bundled (ES build -31 KB, gzip -8 KB): the infinite
159
+ scroll and `loadFonts()` changed as in the Vue package.
45
160
  - `web-components-library.css` (the page CSS) only has the `--color-*` variables (108 KB → 0.6 KB): no Vuetify
46
161
  reset, base or component CSS on the host page anymore (they changed e.g. the `html` font and line height,
47
162
  `box-sizing`, buttons and inputs of the page). The palette changed as in the Vue package (#004688 → #496177, ...).
48
163
  - The components set their base typography on their host instead of inheriting it from that page CSS:
49
164
  `box-sizing: border-box`, `font-family: var(--v-font-body, "Roboto", sans-serif)`, `line-height: 1.5`.
50
165
  On a page with its own `body` font the components now use Roboto; to change it, style the element
51
- (e.g. `corvina-table { font-family: ... }`).
166
+ (e.g. `cv-table { font-family: ... }`).
167
+ - A prop set to `false`, `0` or `''` keeps that value: the element replaced it with the prop's default (e.g.
168
+ `.autoSelect=${false}` on `<cv-select>` gave `true`).
169
+ - `<cv-table>`: its Vuetify CSS is regenerated from the installed Vuetify; `.v-table` had an invalid
170
+ `font-size: .75rrem` (now `.75rem`, 12px, as the cells).
52
171
  - Table footer items-per-page menu attached inside the shadow root without patching Vuetify.
53
172
  - The package only contains the files it needs (37 → 13): no type declarations of internal modules, no
54
173
  favicon and logo.
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,13 +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
- // 3 parameters: locale: string = 'en', shouldLoadTheme: boolean = false, shouldLoadFonts: boolean = false) {
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
+
29
+ The elements are `<cv-table>`, `<cv-button>`, ...: `prefix` changes the start of the tags, e.g. `'corvina'` for the
30
+ 0.x tags (`<corvina-table>`). The components are defined once per page, with the prefix of the first call.
27
31
  If you use Vuetify in the hosting app set shouldLoadTheme to false otherwise to true.
28
- 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.
29
33
 
30
34
  The components draw the Corvina icons with ligatures, so they do not need `icons-corvina-classes-font-face.css`:
31
35
  that file is only for Corvina icons used as CSS classes (`<i class="ecc-T-Add"></i>`) in the hosting app markup.
@@ -39,7 +43,7 @@ import "@corvina/web-components-library/icons-corvina-classes-font-face.css"
39
43
 
40
44
  Vue and Vuetify 4 are bundled: the package has no dependencies. `web-components-library.css` only defines the
41
45
  `--color-*` variables: the page keeps its own styles. The components use Roboto (`--v-font-body`) and line
42
- height 1.5 whatever the page font; style the element to change them (e.g. `corvina-table { font-family: ... }`). The bundle also runs without a bundler
46
+ height 1.5 whatever the page font; style the element to change them (e.g. `cv-table { font-family: ... }`). The bundle also runs without a bundler
43
47
  (`<script type="module">` importing `web-components-library.es.js`).
44
48
 
45
49
  # VS Code IntelliSense
@@ -55,4 +59,4 @@ Add it to the `.vscode/settings.json` of your project:
55
59
  ```
56
60
 
57
61
  Reload the VS Code window after changing the setting.
58
- 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.
@@ -25,6 +25,8 @@
25
25
  font-variant: normal;
26
26
  text-transform: none;
27
27
  line-height: 1;
28
+ /* override the vertical-align: middle that the :before inherits from .v-icon (vuetify reset), which pushes the glyph down */
29
+ vertical-align: top;
28
30
 
29
31
  /* Better Font Rendering =========== */
30
32
  -webkit-font-smoothing: antialiased;
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. */
@@ -73,11 +73,25 @@ export declare namespace CORVINA {
73
73
  /** Text shown in the chip instead of the value: the `itemsTitleKey` property of the selected item for FILTER_BY_ENUM.AUTOCOMPLETE */
74
74
  title?: string;
75
75
  }
76
+ /** An array of this structure defines what the user can sort by. */
77
+ interface SORT_BY {
78
+ /** Unique key of the sort, `SORT.key` when selected */
79
+ key: string;
80
+ /** Title shown in the sort dropdown */
81
+ title: string;
82
+ }
83
+ /** The sort selected by the user. */
84
+ interface SORT {
85
+ /** Key of the selected `SORT_BY` */
86
+ key: string;
87
+ /** Descending order */
88
+ desc: boolean;
89
+ }
76
90
  interface CUSTOM_VUE_COMPONENT {
77
91
  /** Name of the Vue component or Vue component definition */
78
92
  component: string | Component;
79
93
  /** Vue component's props */
80
- props?: Record<string, any>;
94
+ props?: Record<string, unknown>;
81
95
  /** Name of the prop that will contain the row item */
82
96
  itemPropName?: string;
83
97
  /** Name of the prop that indicates where the component should be positioned */
@@ -101,6 +115,115 @@ export declare namespace CORVINA {
101
115
  X_LARGE = "x-large"
102
116
  }
103
117
  }
118
+ namespace TABS {
119
+ /** A tab of CvTabs. */
120
+ interface TAB {
121
+ /** Unique value of the tab: `selected` and the `update:selected` event use it */
122
+ value: string | number;
123
+ /** Text shown in the tab */
124
+ title: string;
125
+ /** The data-qa attribute of the tab, for testing and automation */
126
+ dataQa?: string;
127
+ }
128
+ }
129
+ namespace DATE_RANGE {
130
+ /** A range of days of CvDateRange, both days included. */
131
+ interface RANGE {
132
+ /** First day, ISO `yyyy-MM-dd` */
133
+ start: string;
134
+ /** Last day, ISO `yyyy-MM-dd` */
135
+ end: string;
136
+ }
137
+ /** A preset of CvDateRange: a button above the calendars that selects its range. */
138
+ interface PRESET {
139
+ /** Text of the button */
140
+ title: string;
141
+ /** The range it selects, `null` to clear the selection */
142
+ range: RANGE | null;
143
+ }
144
+ }
145
+ namespace DIALOG {
146
+ /** What a CvDialog is for (design system FEEDBACK-1, FEEDBACK-3). */
147
+ enum TYPE {
148
+ /** Asks: Cancel and a confirm button, before an important or destructive action */
149
+ CONFIRM = "confirm",
150
+ /** Informs: the failure of an operation, with one button to acknowledge it */
151
+ INFORM = "inform"
152
+ }
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
+ }
195
+ namespace PANEL {
196
+ /** Where a CvPanel slides in from. */
197
+ enum POSITION {
198
+ /** The right edge, full height (design system PANEL-1) */
199
+ RIGHT = "right",
200
+ /** The lower half of the window, full width (the help of a page, HELP-3) */
201
+ BOTTOM = "bottom"
202
+ }
203
+ /** What a CvPanel is for, which sets its header. */
204
+ enum TYPE {
205
+ /** Creates or edits: the header holds cancel and confirm (PANEL-1, PANEL-3) */
206
+ EDIT = "edit",
207
+ /** Explains: the help icon, a title and Close (HELP-3, HELP-5) */
208
+ HELP = "help"
209
+ }
210
+ }
211
+ namespace INFINITE_LOADER {
212
+ /**
213
+ * Argument of the `infinite` event of CvInfiniteLoader: when the page is fetched call `loaded()` (more pages may
214
+ * follow), `complete()` (no more pages) or `error()` (the loader shows a retry button).
215
+ */
216
+ interface StateHandler {
217
+ /** The page is loading: the loader shows the spinner (it already does before emitting `infinite`) */
218
+ loading: () => void;
219
+ /** The page was added: the loader requests the next one if it is still visible */
220
+ loaded: () => void;
221
+ /** There are no more pages: the loader stops until `identifier` changes */
222
+ complete: () => void;
223
+ /** The page could not be loaded: the loader shows the retry button */
224
+ error: () => void;
225
+ }
226
+ }
104
227
  namespace TABLE {
105
228
  /** Horizontal alignment of a column (applied as `text-*` and `justify-*` classes) */
106
229
  enum ALIGN {
@@ -155,10 +278,15 @@ export declare namespace CORVINA {
155
278
  type PropIconEntries = PropIconEntry[];
156
279
  interface PropButtonEntry {
157
280
  label?: string;
281
+ dataQa?: string;
158
282
  tooltip?: string;
159
283
  icon?: string;
160
284
  /** If true the button becomes a spinner */
161
285
  loading?: boolean;
286
+ /** The user may do it, but not on this row now (STATE-1): shown in g4. Leave the entry out if they may never do it. */
287
+ disabled?: boolean;
288
+ /** While disabled, the tooltip says why (STATE-2) */
289
+ disabledReason?: string;
162
290
  function: (item: any) => void;
163
291
  }
164
292
  type PropButtonEntries = PropButtonEntry[];
@@ -166,6 +294,8 @@ export declare namespace CORVINA {
166
294
  title: string;
167
295
  icon?: string;
168
296
  disabled?: boolean;
297
+ /** While disabled, the tooltip says why (STATE-2) */
298
+ disabledReason?: string;
169
299
  tooltip?: string;
170
300
  alignTooltip?: TOOLTIP_LOCATION;
171
301
  function: (item: any) => void;
@@ -176,16 +306,27 @@ export declare namespace CORVINA {
176
306
  /** Name of the Vue component or Vue component definition */
177
307
  component: string | Component;
178
308
  /** Vue component's props */
179
- props?: Record<string, any>;
309
+ props?: Record<string, unknown>;
180
310
  /** Name of the prop that will contain the row item */
181
311
  itemPropName?: string;
182
312
  }
313
+ /** Props of the `item.<key>` cell slot */
314
+ interface CellSlotProps {
315
+ /** The row item */
316
+ item: any;
317
+ /** `item[key]` */
318
+ value: any;
319
+ /** Index of the row in the page */
320
+ index: number;
321
+ /** The column's header entry */
322
+ column: TableHeaderEntry;
323
+ }
183
324
  /** Use it with `HEADER_CELL_TYPE.VUE_COMPONENT` */
184
325
  interface HeaderVueComponent {
185
326
  /** Name of the Vue component or Vue component definition */
186
327
  component: string | Component;
187
328
  /** Vue component's props */
188
- props?: Record<string, any>;
329
+ props?: Record<string, unknown>;
189
330
  }
190
331
  /**
191
332
  * Interface representing a table header entry.
@@ -221,8 +362,8 @@ export declare namespace CORVINA {
221
362
  customHeaderCellGeneratorFunction?: () => HTMLElement;
222
363
  /** The `HeaderVueComponent` describing the vuejs component to use */
223
364
  headerVueComponent?: HeaderVueComponent;
224
- /** Type of the row cells */
225
- type: CELL_TYPE;
365
+ /** Type of the row cells. Not needed when the table has the column's `item.<key>` slot. */
366
+ type?: CELL_TYPE;
226
367
  /** Function that generates the cell virtual dom */
227
368
  customCellGeneratorFunction?: (item: any, header: TableHeaderEntry) => HTMLElement;
228
369
  /** Name of the property of the item object containing the `VueComponent` data */
package/package.json CHANGED
@@ -1,20 +1,16 @@
1
1
  {
2
- "name": "@corvina/web-components-library",
3
- "version": "1.0.0-beta.1",
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.10",
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
+ }