@motifx-community/ui 0.1.0-beta.0 → 0.1.0-beta.1
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.
Potentially problematic release.
This version of @motifx-community/ui might be problematic. Click here for more details.
- package/CHANGELOG.md +18 -0
- package/dist/components/dropdown/DropDown.d.ts +14 -0
- package/dist/components/dropdown/drop-down-props.d.ts +5 -0
- package/dist/components/scheduler/view/AgendaView.d.ts +1 -1
- package/dist/core/ui-strings.d.ts +2 -0
- package/dist/generated/tokens.d.ts +40 -0
- package/dist/index.js +133 -15
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/parts/data/DataItems.d.ts +5 -0
- package/dist/parts/data/KeyedItems.d.ts +2 -0
- package/dist/styles.css +87 -3
- package/dist/tokens/index.d.ts +40 -0
- package/dist/tokens/index.js +40 -0
- package/dist/tokens/index.js.map +1 -1
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +1 -1
- package/docs/control.md +1 -1
- package/docs/datagrid-api.md +1 -1
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +1 -1
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +1 -1
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +11 -5
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +1 -1
- package/docs/lookup.md +86 -2
- package/docs/menus.md +1 -1
- package/docs/numberbox.md +1 -1
- package/docs/pagination.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/showcase.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +1 -1
- package/docs/textarea.md +1 -1
- package/docs/textbox.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +9 -1
- package/docs/toolbar.md +1 -1
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +1 -1
- package/docs/window.md +1 -1
- package/llms-full.txt +181 -83
- package/llms.txt +1 -1
- package/package.json +2 -2
package/docs/accordion.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Accordion
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
An accordion opens and closes sections under their headers: one at a time or several, kept open, with icons, three looks and sections built when they are first opened.
|
|
6
6
|
|
package/docs/actionsheet.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ActionSheet
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A list of commands that comes up from the bottom, made of the kit's menu items and large enough for a finger, with a title, a message and a cancel button apart. A context menu opens its items here on a touch screen.
|
|
6
6
|
|
package/docs/avatar.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Avatar and AvatarGroup
|
|
2
2
|
|
|
3
|
-
> Display · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Display · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Someone’s picture, or their initials, or a person icon, with their presence on its corner. A group stacks or spreads them and counts the ones it does not show.
|
|
6
6
|
|
package/docs/badge.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Badge
|
|
2
2
|
|
|
3
|
-
> Display · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Display · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A short text, a count or a dot: in a line of text, or on a corner of a button, an avatar or an icon. A count over its maximum shows “99+”, a count of zero hides.
|
|
6
6
|
|
package/docs/bottomsheet.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BottomSheet
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A panel that comes up from the bottom of the page or of a container and stops at a few heights: a peek, half, full, as tall as its content, or heights of your own. Dragged by its handle and its title, flicked, swiped down to close; modal or not, with the browser's back closing it on a phone.
|
|
6
6
|
|
package/docs/breadcrumb.md
CHANGED
package/docs/button.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Button
|
|
2
2
|
|
|
3
|
-
> Buttons · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Buttons · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A native `<button>` drawn from the design tokens: three variants, three tones, three sizes, an icon, an `&` access key. It can be a toggle, show that work is running, and open a menu or any content — from the whole button, or with `split` from an arrow next to it while the button keeps its own action.
|
|
6
6
|
|
package/docs/buttongroup.md
CHANGED
package/docs/calendar.md
CHANGED
package/docs/card.md
CHANGED
package/docs/checkbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CheckBox
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A checkbox with its caption: checked, unchecked or indeterminate, three states on request, read-only, required and checked with its group. A native checkbox underneath, drawn from the design tokens.
|
|
6
6
|
|
package/docs/chip.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Chip and ChipGroup
|
|
2
2
|
|
|
3
|
-
> Display · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Display · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A short text with an icon or an avatar before it: a filter to turn on, a choice among a few, or something picked that can be removed. A group selects one or several and moves between them with the arrow keys.
|
|
6
6
|
|
package/docs/colorbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ColorBox and ColorPicker
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A colour as a field, with a picker in a popup; or the picker on its own. The picker has an area of saturation and brightness, a hue strip, an opacity strip, inputs for the channels and preset colours.
|
|
6
6
|
|
package/docs/combobox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ComboBox and Autocomplete
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A text field with a list that follows what is typed. The items come from memory or from a data source of the data layer, searched on the server. `Autocomplete` is the free-text kind: the value is the text.
|
|
6
6
|
|
package/docs/control.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Control
|
|
2
2
|
|
|
3
|
-
> Foundations · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Foundations · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
The base of every control in the package. It gives each one the same `text`, `enabled`, `visible` and `tabStop`, and the same focus methods, whether the control is written in JSX and bound to state or created with `new` and changed from code.
|
|
6
6
|
|
package/docs/datagrid-api.md
CHANGED
package/docs/datagrid-bands.md
CHANGED
package/docs/datagrid-drag.md
CHANGED
package/docs/datagrid-editing.md
CHANGED
package/docs/datagrid-forms.md
CHANGED
package/docs/datagrid-layout.md
CHANGED
package/docs/datagrid-lookups.md
CHANGED
package/docs/datagrid.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DataGrid
|
|
2
2
|
|
|
3
|
-
> DataGrid · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> DataGrid · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A grid for data entry and large data: rows in memory or from any adapter of the data layer, a virtual list or pages, sorting, column layout, editing with the kit's editors, new rows with the Tab chain, three save modes, row actions, selection, filters, a search panel, grouping, summaries, a toolbar, lookup columns from other services, copy and paste, export and a layout that is kept — and every feature can be turned off, for the grid or for one column.
|
|
6
6
|
|
package/docs/datebox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DateBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A date, a time or both. It is typed in the order of the locale through a mask, or picked from a calendar and a list of times; `min`, `max` and `disabledDates` limit both ways.
|
|
6
6
|
|
package/docs/drawer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Drawer
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A panel that slides in from an edge of the page or of a container, over the content or pushing it aside. A finger swipes it in from the edge and back again; Escape, the scrim and the browser's back close it.
|
|
6
6
|
|
package/docs/dropdown.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DropDown
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Picks one item from a list. The field shows the chosen item; the list opens below it with the keyboard or a press, can be searched, grouped and drawn your way, and stays fast with thousands of items.
|
|
6
6
|
|
|
@@ -148,10 +148,11 @@ export const cities = ['Ankara', 'Antalya', 'Bursa', 'İstanbul', 'İzmir', 'Kon
|
|
|
148
148
|
| `Groups` | Each group is `role="group"` named by its header. |
|
|
149
149
|
| `Long lists` | Only the rows in view are drawn; each option says where it is with `aria-posinset` and `aria-setsize`. |
|
|
150
150
|
| `Search` | The search box controls the list and names the highlighted option the same way. |
|
|
151
|
+
| `Waiting` | While the value's item is asked for, the combobox is `aria-busy` and its text says "Loading…" to screen readers; a key the source does not have carries the reason as its title. |
|
|
151
152
|
|
|
152
153
|
## Localization
|
|
153
154
|
|
|
154
|
-
The search box, the clear button
|
|
155
|
+
The search box, the clear button, the empty list text, the wait (`loading`) and the reason a key is marked (`notInList`, `loadFailed`) come from `uiLocale.strings`.
|
|
155
156
|
|
|
156
157
|
```tsx
|
|
157
158
|
import { reactive } from '@motifx/core';
|
|
@@ -177,8 +178,9 @@ export default function Localization() {
|
|
|
177
178
|
|
|
178
179
|
| Hook | What it is |
|
|
179
180
|
| --- | --- |
|
|
180
|
-
| `.mx-drop-down` | Added to the field. `data-open` while the list is open; the field attributes of TextBox. |
|
|
181
|
-
| `.mx-drop-down__display, .mx-drop-down__text, .mx-drop-down__chevron` | The combobox, the chosen text (`data-placeholder` when empty), the arrow. |
|
|
181
|
+
| `.mx-drop-down` | Added to the field. `data-open` while the list is open, `data-loading` while the value's item is asked for; the field attributes of TextBox. |
|
|
182
|
+
| `.mx-drop-down__display, .mx-drop-down__text, .mx-drop-down__chevron` | The combobox, the chosen text (`data-placeholder` when empty, `data-missing` for a key the source does not have), the arrow. |
|
|
183
|
+
| `.mx-drop-down__spinner` | The spinner in the arrow's place while the value's item is asked for. |
|
|
182
184
|
| `.mx-drop-down__popup, .mx-drop-down__search` | The popup and its search box. |
|
|
183
185
|
| `.mx-list, .mx-list__item, .mx-list__header` | The list (shared), its options (`data-active`, `data-selected`) and group headers. |
|
|
184
186
|
|
|
@@ -187,6 +189,7 @@ export default function Localization() {
|
|
|
187
189
|
| Token | What it sets |
|
|
188
190
|
| --- | --- |
|
|
189
191
|
| `field.*` | The field, as for TextBox. |
|
|
192
|
+
| `drop-down.value, drop-down.chevron, drop-down.spinner, drop-down.spinner-shape` | Units: the chosen text (`placeholder`, `missing`, `disabled`), the arrow (`open`, `disabled`), the ring that turns while the value's item is asked for and the shape a language may draw instead (with the spinner's shapes and timing). |
|
|
190
193
|
| `list.item-height, list.item` | The options: their row height, and the item unit in each state (`hover`, `pressed`, `active`, `selected`, `selected-hover`, `selected-pressed`, `disabled`, `next`, `select-all`). |
|
|
191
194
|
| `list.indicator, list.check, list.mark, list.icon, list.text` | Units: the bar on the chosen option (`multiple`), the check of a list of several choices and its mark, an icon, the text. |
|
|
192
195
|
| `list.container, list.group, list.header, list.select-all-divider, list.empty` | Units: the list (its space and most height), a group, group headers, the line under "Select all", the empty text. |
|
|
@@ -199,6 +202,9 @@ export default function Localization() {
|
|
|
199
202
|
| --- | --- | --- | --- |
|
|
200
203
|
| `value` | `Bind<V \| null>` | `null` | The value of the chosen item. `x-model` binds it two-way. |
|
|
201
204
|
| `items` | `Bind<readonly T[]>` | `[]` | Plain values, `DropDownItem`s (`{ value, text, icon?, group?, enabled? }`) or objects of your own. A function is followed; items changed in place show after `refresh()`. |
|
|
205
|
+
| `dataSource` | `Bind<DataSource<T> \| null>` | `null` | Items from the data layer, loaded where the list is scrolled to and searched on its `searchFields`. Wins over `items`. A value on no loaded page is asked for by key; meanwhile the field waits (see Lookup). |
|
|
206
|
+
| `valueText` | `Bind<string>` | `''` | The value's text while its item is asked for from `dataSource`, shown at once instead of waiting (a record that carries the name: `valueText={() => order.customerName}`). |
|
|
207
|
+
| `searchDelay` | `Bind<number>` | `250` with a data source, else `0` | Milliseconds between the last key in the search box and the search. |
|
|
202
208
|
| `textField / valueField` | `Bind<ItemField<T>>` | `'text'` / `'value'` | A property name or a function `(item) => …`. Without `valueField` an object with a `value` gives that, anything else is its own value. |
|
|
203
209
|
| `iconField, groupField, enabledField` | `Bind<ItemField<T>>` | — | An icon per option; options with the same group follow each other under its name; options that cannot be chosen. |
|
|
204
210
|
| `placeholder` | `Bind<string>` | `''` | Shown while nothing is chosen. |
|
|
@@ -224,7 +230,7 @@ A prop whose value is a function of its own (`textField`, a template) takes the
|
|
|
224
230
|
|
|
225
231
|
| Method | Returns | Description |
|
|
226
232
|
| --- | --- | --- |
|
|
227
|
-
| `open(search?)` | `boolean` | Opens the list; `search` starts the search box with that text. `false` when disabled
|
|
233
|
+
| `open(search?)` | `boolean` | Opens the list; `search` starts the search box with that text. `false` when disabled, read-only, or while the value's item is asked for. |
|
|
228
234
|
| `close()` | `void` | Closes it; focus goes back to the field. |
|
|
229
235
|
| `clear()` | `void` | Empties the value. |
|
|
230
236
|
| `refresh()` | `void` | Your items may be plain or reactive; the drop-down reads them as they are. After changing them in place, call `refresh()`. The field's text and the open list follow. |
|
package/docs/filterbuilder.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FilterBuilder
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A filter builder lets people put a filter together by hand: groups joined by And, Or, Not And or Not Or, and conditions of a field, an operation and a value. Its value is the data layer's filter expression, so it goes to rows in memory and to every adapter as it is. The DataGrid opens it from its filter panel; on its own it serves a report screen or a saved search.
|
|
6
6
|
|
package/docs/formlayout.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FormLayout
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Lays out the fields of a data object on a grid. Each field gets an editor — by name, or by the type of its value — bound to the object both ways; groups, spans and buttons arrange them; sending the form checks every field first.
|
|
6
6
|
|
package/docs/home.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @motifx-community/ui
|
|
2
2
|
|
|
3
|
-
> Get started · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Get started · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Components for MotifJS that work the way desktop UI does — created when needed, shown anywhere, closed and disposed like windows — drawn from the MotifJS design system's tokens.
|
|
6
6
|
|
package/docs/keyboard.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Keyboard and focus
|
|
2
2
|
|
|
3
|
-
> Foundations · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Foundations · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
The rules every control follows: Tab order, the active control of a container, focus that never falls to `<body>`, `&File` access keys and app-wide shortcuts.
|
|
6
6
|
|
package/docs/layout.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Layout
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Containers that place controls: `Stack` (a row or a column), `Grid` (rows and columns), `Panel` (a plain box that can scroll), `GroupBox` (a titled frame), `DockPanel` (children stuck to its edges) and `SplitContainer` (two panes and a splitter). All of them are controls: they disable and hide what is inside, and lay out children added at any time.
|
|
6
6
|
|
package/docs/listbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ListBox
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A list that stays on the page. One item or several are chosen with the keys or the pointer; items come from memory or from a data source, can be searched and grouped, and long lists draw only the rows in view.
|
|
6
6
|
|
package/docs/lookup.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lookup
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Picks one row of a table-like list, typically from a data source searched on the server: a customer by its company, contact and city. The field shows the chosen row's text; everything else works as in DropDown.
|
|
6
6
|
|
|
@@ -33,6 +33,29 @@ export class SlowAdapter<T extends object, K> extends data.ArrayAdapter<T, K> {
|
|
|
33
33
|
}
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## A value on no loaded page
|
|
37
|
+
|
|
38
|
+
A value whose row is not loaded is asked for by key, in one request with the keys other fields and grids over the same source need at that moment. Meanwhile the field waits: a spinner in the arrow's place, the list closed, never the key as its text. A record that carries the name too gives it as `valueText`, and the field shows it at once. A key the server does not have shows itself, muted and underlined, and its title says why; when the request failed, opening the list asks again.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { data } from '@motifx-community/data';
|
|
42
|
+
|
|
43
|
+
/** Rows in memory that answer a little later, the way a server does; for the examples. */
|
|
44
|
+
export class SlowAdapter<T extends object, K> extends data.ArrayAdapter<T, K> {
|
|
45
|
+
constructor(
|
|
46
|
+
options: data.ArrayAdapterOptions<T>,
|
|
47
|
+
private readonly delayMs = 300,
|
|
48
|
+
) {
|
|
49
|
+
super(options);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override async load(options: data.LoadOptions = {}): Promise<data.LoadResult<T>> {
|
|
53
|
+
await new Promise((done) => setTimeout(done, this.delayMs));
|
|
54
|
+
return super.load(options);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
36
59
|
## API reference
|
|
37
60
|
|
|
38
61
|
| Prop | Type | Default | Description |
|
|
@@ -41,7 +64,7 @@ export class SlowAdapter<T extends object, K> extends data.ArrayAdapter<T, K> {
|
|
|
41
64
|
| `showColumnHeaders` | `Bind<boolean>` | `true` | The header above the rows. |
|
|
42
65
|
| `popupWidth` | `Bind<string>` | `lookup.popup-width` | The least width of the list. |
|
|
43
66
|
| `searchEnabled` | `Bind<boolean>` | `true` | A search box above the list (DropDown has it off by default). |
|
|
44
|
-
| `everything of DropDown` | | | `items`, `dataSource`, `textField`, `valueField`, `searchDelay`, `clearButton`, validation, keyboard… |
|
|
67
|
+
| `everything of DropDown` | | | `items`, `dataSource`, `valueText`, `textField`, `valueField`, `searchDelay`, `clearButton`, validation, keyboard… |
|
|
45
68
|
| `refresh()` | | | Your items and columns may be plain or reactive; the lookup reads them as they are. After changing them in place, call `refresh()`. |
|
|
46
69
|
|
|
47
70
|
## Example files
|
|
@@ -126,3 +149,64 @@ export class SlowAdapter<T extends object, K> extends data.ArrayAdapter<T, K> {
|
|
|
126
149
|
}
|
|
127
150
|
}
|
|
128
151
|
```
|
|
152
|
+
|
|
153
|
+
`ByKey.tsx`
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import { reactive } from '@motifx/core';
|
|
157
|
+
import { data } from '@motifx-community/data';
|
|
158
|
+
import { Button, Lookup } from '@motifx-community/ui';
|
|
159
|
+
import { SlowAdapter } from '../../../shared/slow-adapter';
|
|
160
|
+
|
|
161
|
+
interface Customer {
|
|
162
|
+
id: number;
|
|
163
|
+
company: string;
|
|
164
|
+
city: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const companyOf = (id: number) => `${['Alfreds', 'Bon app', 'Ernst', 'Hanari', 'Island', 'Lehmanns'][id % 6]} ${['Trading', 'Handel', 'Markt', 'Foods'][id % 4]} ${id}`;
|
|
168
|
+
const rows: Customer[] = Array.from({ length: 2000 }, (_, i) => ({ id: i + 1, company: companyOf(i + 1), city: ['Berlin', 'Paris', 'İstanbul', 'Madrid'][i % 4] }));
|
|
169
|
+
|
|
170
|
+
/** Values on no loaded page of a server that answers after 1.2 s: one field waits for its row, one shows the name its record carries, one has a key the server does not have. */
|
|
171
|
+
export default function ByKey() {
|
|
172
|
+
const customers = new data.DataSource<Customer, number>({
|
|
173
|
+
adapter: new SlowAdapter<Customer, number>({ data: rows, key: 'id' }, 1200),
|
|
174
|
+
loadMode: 'blocks',
|
|
175
|
+
pageSize: 50,
|
|
176
|
+
searchFields: ['company', 'city'],
|
|
177
|
+
});
|
|
178
|
+
const columns = [
|
|
179
|
+
{ field: 'company', caption: 'Company' },
|
|
180
|
+
{ field: 'city', caption: 'City', width: '7rem' },
|
|
181
|
+
];
|
|
182
|
+
const waiting = reactive({ customer: 1500 as number | null });
|
|
183
|
+
// A record as it came from the server: the customer's key and, beside it, the name.
|
|
184
|
+
const order = reactive({ customer: 1500 as number | null, customerName: companyOf(1500) });
|
|
185
|
+
|
|
186
|
+
const another = () => {
|
|
187
|
+
const id = 100 + Math.floor(Math.random() * 1900);
|
|
188
|
+
waiting.customer = id;
|
|
189
|
+
order.customer = id;
|
|
190
|
+
order.customerName = companyOf(id);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
<Lookup class="lk-waits" label="Waits for its row" dataSource={customers} textField="company" valueField="id" columns={columns} x-model={() => waiting.customer} stretch />
|
|
196
|
+
<Lookup
|
|
197
|
+
class="lk-given"
|
|
198
|
+
label="Shows the name it is given"
|
|
199
|
+
dataSource={customers}
|
|
200
|
+
textField="company"
|
|
201
|
+
valueField="id"
|
|
202
|
+
columns={columns}
|
|
203
|
+
valueText={() => order.customerName}
|
|
204
|
+
x-model={() => order.customer}
|
|
205
|
+
stretch
|
|
206
|
+
/>
|
|
207
|
+
<Lookup class="lk-missing" label="A key the server does not have" dataSource={customers} textField="company" valueField="id" columns={columns} value={9999} stretch />
|
|
208
|
+
<Button class="lk-another" text="Another customer" variant="outline" onclick={another} />
|
|
209
|
+
</>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
```
|
package/docs/menus.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MenuBar and ContextMenu
|
|
2
2
|
|
|
3
|
-
> Buttons · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Buttons · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A menu bar of an app (File, Edit, View) and the menu that opens on a right-click. Both show the same menu items: submenus, check and radio items, shortcuts, access keys.
|
|
6
6
|
|
package/docs/numberbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NumberBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A number field: arrow keys, PageUp / PageDown and spin buttons that repeat while held, bounds, a step without float noise, a format for display (currency, percent) and typing in the locale’s own way.
|
|
6
6
|
|
package/docs/pagination.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pagination
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Moving through pages of items: the sizes to choose from, where the page stands, the steps and a button per page around the current one. It turns compact when it does not fit. It looks and works as the grid’s pager.
|
|
6
6
|
|
package/docs/progress.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ProgressBar and Spinner
|
|
2
2
|
|
|
3
|
-
> Feedback · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
ProgressBar shows how far some work is, as a line or a circle, or that it runs when that is not known. Spinner says "busy, wait": a turning ring, alone or over a panel while it loads, shown only after a delay so quick work does not flash it.
|
|
6
6
|
|
package/docs/radiogroup.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RadioGroup
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
A set of options of which one is chosen: from plain values, from your own objects or from a live list; one under the other, side by side or in columns; options that are disabled, hidden or carry a help line; one Tab stop and the arrow keys.
|
|
6
6
|
|
package/docs/rating.md
CHANGED
package/docs/scheduler-agenda.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scheduler: Editing
|
|
2
2
|
|
|
3
|
-
> Scheduler · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Scheduler · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Appointments are added, moved, resized, copied and deleted with the pointer, the keys and code; every change asks its event first, can wait for a server, and goes back when saving fails.
|
|
6
6
|
|
package/docs/scheduler-form.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scheduler: The appointment form
|
|
2
2
|
|
|
3
|
-
> Scheduler · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Scheduler · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
The appointment form set up without events: which fields, in which order, in groups and tabs; editors of your own; checks per field; fields shown or locked for one appointment only. Or a form of your own.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scheduler: iCalendar and print
|
|
2
2
|
|
|
3
|
-
> Scheduler · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Scheduler · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Appointments out to an iCalendar file and back in (RFC 5545), for Outlook, Google Calendar and Apple Calendar; and the scheduler on paper.
|
|
6
6
|
|
package/docs/scheduler-mobile.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scheduler: Tablet and phone
|
|
2
2
|
|
|
3
|
-
> Scheduler · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Scheduler · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
On a tablet and a phone the scheduler keeps its appointments, views and date and shows them another way: a phone gets the agenda, a compact bar and sheets from the bottom; a finger lifts, resizes, swipes and pinches.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scheduler: Recurrence and time zones
|
|
2
2
|
|
|
3
|
-
> Scheduler · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Scheduler · @motifx-community/ui 0.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
Appointments that repeat by an RFC 5545 rule, with times left out and occurrences changed apart; a question on what a change reaches; an editor of the rule; and the days on the clock of any time zone, summer time included.
|
|
6
6
|
|