@supersoniks/concorde 3.2.0 → 3.2.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/build-infos.json +1 -1
- package/concorde-core.bundle.js +101 -101
- package/concorde-core.es.js +187 -182
- package/dist/concorde-core.bundle.js +101 -101
- package/dist/concorde-core.es.js +187 -182
- package/index.html +0 -0
- package/package.json +1 -1
- package/scripts/create-search.js +0 -0
- package/scripts/generate-routes.js +0 -0
- package/src/core/_types/types.ts +0 -0
- package/src/core/components/functional/date/date.ts +0 -0
- package/src/core/components/functional/functional.ts +0 -0
- package/src/core/components/functional/if/if.md +0 -0
- package/src/core/components/functional/if/if.test.ts +0 -0
- package/src/core/components/functional/list/list.spec.ts +0 -0
- package/src/core/components/functional/queue/queue.demo.ts +0 -0
- package/src/core/components/functional/router/router.demo.ts +0 -0
- package/src/core/components/functional/router/router.md +0 -0
- package/src/core/components/functional/router/router.spec.ts +0 -0
- package/src/core/components/functional/router/router.ts +0 -0
- package/src/core/components/functional/sonic-scope/sonic-scope.ts +0 -0
- package/src/core/components/functional/states/states.demo.ts +0 -0
- package/src/core/components/functional/states/states.md +0 -0
- package/src/core/components/functional/states/states.spec.ts +0 -0
- package/src/core/components/functional/states/states.ts +0 -0
- package/src/core/components/functional/submit/submit.ts +0 -0
- package/src/core/components/functional/translation/translation.ts +0 -0
- package/src/core/components/ui/_css/scroll.ts +0 -0
- package/src/core/components/ui/_css/shadow.ts +0 -0
- package/src/core/components/ui/_css/size.ts +0 -0
- package/src/core/components/ui/_css/type.ts +0 -0
- package/src/core/components/ui/alert/alert.md +0 -0
- package/src/core/components/ui/alert/alert.ts +0 -0
- package/src/core/components/ui/alert-messages/alert-messages.md +0 -0
- package/src/core/components/ui/badge/badge.md +0 -0
- package/src/core/components/ui/badge/badge.ts +0 -0
- package/src/core/components/ui/button/button.md +0 -0
- package/src/core/components/ui/button/button.ts +0 -0
- package/src/core/components/ui/captcha/captcha.md +0 -0
- package/src/core/components/ui/captcha/captcha.ts +0 -0
- package/src/core/components/ui/card/card-footer.ts +0 -0
- package/src/core/components/ui/card/card-header-descripton.ts +0 -0
- package/src/core/components/ui/card/card-header.ts +0 -0
- package/src/core/components/ui/card/card-main.ts +0 -0
- package/src/core/components/ui/card/card.md +0 -0
- package/src/core/components/ui/card/card.ts +0 -0
- package/src/core/components/ui/divider/divider.ts +0 -0
- package/src/core/components/ui/form/checkbox/checkbox.md +0 -0
- package/src/core/components/ui/form/checkbox/checkbox.ts +0 -0
- package/src/core/components/ui/form/css/form-control.ts +0 -0
- package/src/core/components/ui/form/fieldset/fieldset.ts +0 -0
- package/src/core/components/ui/form/fieldset/legend-description.ts +0 -0
- package/src/core/components/ui/form/fieldset/legend.ts +0 -0
- package/src/core/components/ui/form/form-layout/form-layout.md +0 -0
- package/src/core/components/ui/form/input/input.md +0 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -0
- package/src/core/components/ui/form/radio/radio.md +0 -0
- package/src/core/components/ui/form/radio/radio.ts +0 -0
- package/src/core/components/ui/form/select/select.md +0 -0
- package/src/core/components/ui/form/switch/switch.md +0 -0
- package/src/core/components/ui/form/switch/switch.ts +0 -0
- package/src/core/components/ui/form/textarea/textarea.ts +0 -0
- package/src/core/components/ui/icon/icons.ts +14 -3
- package/src/core/components/ui/image/image.md +0 -0
- package/src/core/components/ui/image/image.ts +0 -0
- package/src/core/components/ui/loader/loader.md +0 -0
- package/src/core/components/ui/loader/loader.ts +0 -0
- package/src/core/components/ui/loader/styles/fixed.ts +0 -0
- package/src/core/components/ui/loader/styles/inline.ts +0 -0
- package/src/core/components/ui/menu/menu.ts +0 -0
- package/src/core/components/ui/modal/modal-actions.ts +0 -0
- package/src/core/components/ui/modal/modal-close.ts +0 -0
- package/src/core/components/ui/modal/modal-subtitle.ts +0 -0
- package/src/core/components/ui/modal/modal-title.ts +0 -0
- package/src/core/components/ui/modal/modal.md +0 -0
- package/src/core/components/ui/pop/pop.md +0 -0
- package/src/core/components/ui/progress/progress.ts +0 -0
- package/src/core/components/ui/table/table-tbody.ts +0 -0
- package/src/core/components/ui/table/table-th.ts +0 -0
- package/src/core/components/ui/table/table.ts +0 -0
- package/src/core/components/ui/theme/theme-collection/core-variables.ts +0 -0
- package/src/core/components/ui/theme/theme-collection/dark.ts +0 -0
- package/src/core/components/ui/theme/theme-collection/light.ts +0 -0
- package/src/core/components/ui/theme/theme.ts +0 -0
- package/src/core/components/ui/toast/toast-item.ts +0 -0
- package/src/core/components/ui/tooltip/tooltip.ts +0 -0
- package/src/core/components/ui/ui.ts +0 -0
- package/src/core/directives/DataProvider.ts +0 -0
- package/src/core/directives/Wording.ts +0 -0
- package/src/core/mixins/Fetcher.ts +0 -0
- package/src/core/mixins/FormCheckable.ts +0 -0
- package/src/core/mixins/TemplatesContainer.ts +0 -0
- package/src/core/utils/HTML.ts +0 -0
- package/src/core/utils/LocationHandler.ts +0 -0
- package/src/core/utils/Objects.ts +0 -0
- package/src/core/utils/Utils.ts +0 -0
- package/src/core/utils/api.ts +0 -0
- package/src/core/utils/route.spec.ts +0 -0
- package/src/core/utils/route.ts +0 -0
- package/src/docs/code.ts +0 -0
- package/src/docs/docs.ts +0 -0
- package/src/docs/header/header.ts +0 -0
- package/src/docs/layout.ts +0 -0
- package/src/docs/navigation/navigation.ts +0 -0
- package/src/docs/search/docs-search.json +0 -0
- package/src/docs/search/markdown-renderer.ts +0 -0
- package/src/docs/search/page.ts +0 -0
- package/src/docs/search/search.ts +0 -0
- package/src/docs/tailwind/css/tailwind.css +0 -0
- package/src/docs/tailwind/css.d.ts +0 -0
- package/src/index.ts +0 -0
- package/src/test-utils/TestUtils.ts +0 -0
- package/src/tsconfig-model.json +0 -0
- package/src/tsconfig.json +294 -294
- package/tailwind.config.js +0 -0
- package/templates-test.html +0 -0
- package/vite/config.js +0 -0
- package/docs/assets/index-C0K6xugr.css +0 -1
- package/docs/assets/index-Dgl1lJQo.js +0 -4861
- package/docs/css/docs.css +0 -0
- package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
- package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
- package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
- package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Light.eot +0 -0
- package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Light.woff +0 -0
- package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
- package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
- package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
- package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
- package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
- package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
- package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
- package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
- package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
- package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
- package/docs/img/concorde-icon.svg +0 -5
- package/docs/img/concorde-logo.svg +0 -1
- package/docs/img/concorde.png +0 -0
- package/docs/img/concorde_def.png +0 -0
- package/docs/img/concorde_seuil.png.webp +0 -0
- package/docs/img/concorde_seuil_invert.png +0 -0
- package/docs/img/paul_metrand.jpg +0 -0
- package/docs/img/paul_metrand_xs.jpg +0 -0
- package/docs/index.html +0 -93
- package/docs/src/core/components/functional/date/date.md +0 -290
- package/docs/src/core/components/functional/fetch/fetch.md +0 -117
- package/docs/src/core/components/functional/if/if.md +0 -16
- package/docs/src/core/components/functional/list/list.md +0 -199
- package/docs/src/core/components/functional/mix/mix.md +0 -41
- package/docs/src/core/components/functional/queue/queue.md +0 -87
- package/docs/src/core/components/functional/router/router.md +0 -129
- package/docs/src/core/components/functional/sdui/default-library.json +0 -108
- package/docs/src/core/components/functional/sdui/example.json +0 -99
- package/docs/src/core/components/functional/sdui/sdui.md +0 -356
- package/docs/src/core/components/functional/states/states.md +0 -87
- package/docs/src/core/components/functional/submit/submit.md +0 -83
- package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
- package/docs/src/core/components/functional/value/value.md +0 -35
- package/docs/src/core/components/ui/alert/alert.md +0 -121
- package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
- package/docs/src/core/components/ui/badge/badge.md +0 -127
- package/docs/src/core/components/ui/button/button.md +0 -182
- package/docs/src/core/components/ui/captcha/captcha.md +0 -24
- package/docs/src/core/components/ui/card/card.md +0 -97
- package/docs/src/core/components/ui/divider/divider.md +0 -35
- package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -104
- package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
- package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
- package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
- package/docs/src/core/components/ui/form/input/input.md +0 -167
- package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -131
- package/docs/src/core/components/ui/form/radio/radio.md +0 -84
- package/docs/src/core/components/ui/form/select/select.md +0 -97
- package/docs/src/core/components/ui/form/switch/switch.md +0 -84
- package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
- package/docs/src/core/components/ui/group/group.md +0 -75
- package/docs/src/core/components/ui/icon/icon.md +0 -125
- package/docs/src/core/components/ui/icon/icons.json +0 -1
- package/docs/src/core/components/ui/image/image.md +0 -107
- package/docs/src/core/components/ui/link/link.md +0 -43
- package/docs/src/core/components/ui/loader/loader.md +0 -67
- package/docs/src/core/components/ui/menu/menu.md +0 -288
- package/docs/src/core/components/ui/modal/modal.md +0 -123
- package/docs/src/core/components/ui/pop/pop.md +0 -96
- package/docs/src/core/components/ui/progress/progress.md +0 -63
- package/docs/src/core/components/ui/table/table.md +0 -455
- package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
- package/docs/src/docs/_core-concept/overview.md +0 -57
- package/docs/src/docs/_core-concept/subscriber.md +0 -76
- package/docs/src/docs/_getting-started/concorde-outside.md +0 -143
- package/docs/src/docs/_getting-started/create-a-component.md +0 -137
- package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -174
- package/docs/src/docs/_getting-started/pubsub.md +0 -150
- package/docs/src/docs/_getting-started/start.md +0 -39
- package/docs/src/docs/_getting-started/theming.md +0 -91
- package/docs/src/docs/search/docs-search.json +0 -3917
- package/docs/src/tag-list.json +0 -1
- package/docs/src/tsconfig-model.json +0 -23
- package/docs/src/tsconfig.json +0 -918
- package/docs/svg/regular/plane.svg +0 -1
- package/docs/svg/solid/plane.svg +0 -1
- package/php/get-challenge.php +0 -34
- package/php/some-service.php +0 -42
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# List
|
|
2
|
-
|
|
3
|
-
The **sonic-list** component creates list items.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
List extends the mixins [Subscriber](#docs/_core-concept/subscriber.md/subscriber) and Fetcher :
|
|
7
|
-
* As a Subscriber it as a **props** reactive property (basically an array of data) and its data is associated to a publisher via its dataProvider attribute.
|
|
8
|
-
* List doesn't Fetch by default (see below for activation).
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Template
|
|
12
|
-
|
|
13
|
-
The list component loops over its template children to render each items of its props data.
|
|
14
|
-
Consider the following example using **2 templates** and **9 items** :
|
|
15
|
-
- First template will render the first item.
|
|
16
|
-
- Second template will render the second item.
|
|
17
|
-
- Then back to the first template and so on and so forth.
|
|
18
|
-
|
|
19
|
-
Note that for each line there is a dataProvider found at *[list dataProvider name]/liste-item/[line index or key]*
|
|
20
|
-
You can hover the list items in the examples to see it.
|
|
21
|
-
|
|
22
|
-
<sonic-code>
|
|
23
|
-
<template>
|
|
24
|
-
<sonic-list dataProvider="listTemplateExample" class="grid grid-cols-3 gap-4" props='[{"id": "1"}, {"id": "2"}, {"id": "3"}, {"id": "4"}, {"id": "5"}, {"id": "6"}, {"id": "7"}, {"id": "8"}, {"id": "9"}]' debug>
|
|
25
|
-
<template>
|
|
26
|
-
<div class="bg-neutral-100 text-center p-3">
|
|
27
|
-
<sonic-value key="id"></sonic-value>
|
|
28
|
-
<div class="text-xs">1st template</div>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
<template>
|
|
32
|
-
<div class="bg-neutral-100 text-info text-center p-3">
|
|
33
|
-
<sonic-value key="id"></sonic-value>
|
|
34
|
-
<div class="text-xs">2nd template</div>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
</sonic-list>
|
|
38
|
-
</template>
|
|
39
|
-
</sonic-code>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## TemplateKey / data-value
|
|
44
|
-
|
|
45
|
-
The **templateKey** attribute allows you to bind a template to a props item.
|
|
46
|
-
Consider the following example :
|
|
47
|
-
- The list **templateKey** attribute is set to the value **tpl** (any name would do)
|
|
48
|
-
- Items 4,5 and 6 are each one **referencing** a templates with a matching **data-value** attribute
|
|
49
|
-
|
|
50
|
-
<sonic-code>
|
|
51
|
-
<template>
|
|
52
|
-
<sonic-list
|
|
53
|
-
templateKey="tpl"
|
|
54
|
-
class="grid gap-3"
|
|
55
|
-
dataProvider="TemplateKeyExample"
|
|
56
|
-
props='[
|
|
57
|
-
{"id":"1", "default": "The first template with no data-value is used"},
|
|
58
|
-
{"id":"2", "default": "The second template with no data-value is used"},
|
|
59
|
-
{"id":"3", "default": "Back to the first template with no data-value"},
|
|
60
|
-
{"id":"4", "tpl":"custom-tpl-danger"},
|
|
61
|
-
{"id":"5", "tpl":"custom-tpl-info"},
|
|
62
|
-
{"id":"6", "tpl":"custom-tpl-success"},
|
|
63
|
-
{"id":"7", "tpl": "Non-valid tpl name, Back to the first template with no data-value"}
|
|
64
|
-
]'
|
|
65
|
-
debug
|
|
66
|
-
>
|
|
67
|
-
<template>
|
|
68
|
-
<div class="p-2 border rounded text-neutral-900">
|
|
69
|
-
<sonic-value key="id"> : </sonic-value>
|
|
70
|
-
<b>First</b> template with no <b>data-value</b> attribute
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
<template data-value="custom-tpl-danger">
|
|
74
|
-
<div class="p-2 border rounded text-danger">
|
|
75
|
-
<sonic-value key="id"> : </sonic-value>
|
|
76
|
-
data-value : <b>custom-tpl-danger</b>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
<template data-value="custom-tpl-info">
|
|
80
|
-
<div class="p-2 border rounded text-info">
|
|
81
|
-
<sonic-value key="id"> : </sonic-value>
|
|
82
|
-
data-value : <b>custom-tpl-info</b>
|
|
83
|
-
</div>
|
|
84
|
-
</template>
|
|
85
|
-
<template data-value="custom-tpl-success">
|
|
86
|
-
<div class="p-2 border rounded text-success">
|
|
87
|
-
<sonic-value key="id"> : </sonic-value>
|
|
88
|
-
data-value : <b>custom-tpl-success</b>
|
|
89
|
-
</div>
|
|
90
|
-
</template>
|
|
91
|
-
<template>
|
|
92
|
-
<div class="p-2 border rounded text-neutral-400">
|
|
93
|
-
<sonic-value key="id"> : </sonic-value>
|
|
94
|
-
<b>Second</b> template with no <b>data-value</b> attribute <br>
|
|
95
|
-
This one is used if it <b>follows another data-item</b> with <b>no tpl</b> specified in the props
|
|
96
|
-
</div>
|
|
97
|
-
</template>
|
|
98
|
-
</sonic-list>
|
|
99
|
-
</template>
|
|
100
|
-
</sonic-code>
|
|
101
|
-
|
|
102
|
-
## Special templates : list item separator / empty list view
|
|
103
|
-
|
|
104
|
-
A special template with attribute **data-value="separator"** will act as a separator between each list item
|
|
105
|
-
|
|
106
|
-
<sonic-code>
|
|
107
|
-
<template>
|
|
108
|
-
<sonic-list props='[{"id":"1"},{"id":"2"},{"id":"3"}]' dataProvider="ListSeparatorDemo">
|
|
109
|
-
<template><sonic-value key="id"></sonic-value></template>
|
|
110
|
-
<template data-value="separator"> 🤜 </template>
|
|
111
|
-
</sonic-list>
|
|
112
|
-
</template>
|
|
113
|
-
</sonic-code>
|
|
114
|
-
|
|
115
|
-
The same principle can be used to handle empty lists using a template with attribute **data-value="no-item"**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Fetch
|
|
119
|
-
|
|
120
|
-
Enables the list to get data from an external API in order to fill its **props** attribute with an **array of items**
|
|
121
|
-
See the [Fetch] web component(#core/components/functional/fetch/fetch.md/fetch)
|
|
122
|
-
<sonic-code>
|
|
123
|
-
<template>
|
|
124
|
-
<sonic-list
|
|
125
|
-
props='["a", "b", "c"]' fetch
|
|
126
|
-
serviceURL="https://reqres.in"
|
|
127
|
-
dataProvider="api/users"
|
|
128
|
-
key="data"
|
|
129
|
-
class="grid grid-cols-1" debug>
|
|
130
|
-
<template>
|
|
131
|
-
<docs-user></docs-user>
|
|
132
|
-
</template>
|
|
133
|
-
</sonic-list>
|
|
134
|
-
</template>
|
|
135
|
-
</sonic-code>
|
|
136
|
-
|
|
137
|
-
## Extract Values
|
|
138
|
-
|
|
139
|
-
Example of using the `extractValues` attribute with a service.
|
|
140
|
-
As in the previous example, the `fetch` attribute indicates that a service call should be made.
|
|
141
|
-
Note that we use:
|
|
142
|
-
* the property `_metadata_` added by the list component to display the key of the extracted value
|
|
143
|
-
* the special property `_self_` that allows targeting the item itself. This is useful here because there is no sub-property; we are directly dealing with a string.
|
|
144
|
-
<sonic-code>
|
|
145
|
-
<template>
|
|
146
|
-
<sonic-list
|
|
147
|
-
debug
|
|
148
|
-
fetch
|
|
149
|
-
serviceURL="https://reqres.in"
|
|
150
|
-
dataProvider="list-extract-values-test"
|
|
151
|
-
endPoint="api/users/2"
|
|
152
|
-
key="data"
|
|
153
|
-
extractValues
|
|
154
|
-
>
|
|
155
|
-
<template>
|
|
156
|
-
<div class="flex items-center">
|
|
157
|
-
<span data-bind ::inner-html="$_metadata_.key : " class="bold w-24"></span>
|
|
158
|
-
<span data-bind ::inner-html="$_self_"></span>
|
|
159
|
-
<sonic-if data-bind ::condition="|'$_metadata_.key' == 'avatar'">
|
|
160
|
-
<sonic-image data-bind ::src="$_self_" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
|
|
161
|
-
</sonic-if>
|
|
162
|
-
</div>
|
|
163
|
-
</template>
|
|
164
|
-
</sonic-list>
|
|
165
|
-
</template>
|
|
166
|
-
</sonic-code>
|
|
167
|
-
|
|
168
|
-
## Additionnal tips
|
|
169
|
-
|
|
170
|
-
* If the result of the request is an object, it is nested within an array to ensure functionality.
|
|
171
|
-
* The invalidate() method can be called on its publisher to trigger data reloading.
|
|
172
|
-
* Each list item publisher has a "_parent_" property pointing to the list publisher
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<!--
|
|
177
|
-
## FormDataProvider
|
|
178
|
-
|
|
179
|
-
<sonic-alert status="error" background>À déplacer dans la bonne doc</sonic-alert>
|
|
180
|
-
|
|
181
|
-
<sonic-code>
|
|
182
|
-
<template>
|
|
183
|
-
<div formDataProvider="profileInfos">
|
|
184
|
-
<form>
|
|
185
|
-
<sonic-fieldset label="Edit profile">
|
|
186
|
-
<sonic-form-layout>
|
|
187
|
-
<sonic-input label="First name" type="text" name="first_name" value="Sponge" size="sm"></sonic-input>
|
|
188
|
-
<sonic-input label="Last name" type="text" name="last_name" value="Bob" size="sm"></sonic-input>
|
|
189
|
-
<sonic-input label="email" type="email" name="email" value="bob@krustykrab.com" size="sm"></sonic-input>
|
|
190
|
-
<sonic-input label="Image url" type="text" name="avatar" value="http://www.bobleponge.fr/goodies/avatars/avatar-bob-eponge_Bob-Eponge-coiffure.jpg" size="sm"></sonic-input>
|
|
191
|
-
</sonic-form-layout>
|
|
192
|
-
</sonic-fieldset>
|
|
193
|
-
</form>
|
|
194
|
-
</div>
|
|
195
|
-
<sonic-card dataProvider="profileInfos">
|
|
196
|
-
<docs-user ></docs-user>
|
|
197
|
-
</sonic-card>
|
|
198
|
-
</template>
|
|
199
|
-
</sonic-code> -->
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Mix
|
|
2
|
-
|
|
3
|
-
Mix allows you to mix several subsets of dataProvider in a new key/value structure which is itself associated with a new dataProvider. The data update is then bidirectional.
|
|
4
|
-
|
|
5
|
-
Dot notation is supported to extract a sub-part of the data.
|
|
6
|
-
|
|
7
|
-
For example, if we declare dataproviders as follows :
|
|
8
|
-
<sonic-code>
|
|
9
|
-
<template>
|
|
10
|
-
<sonic-subscriber dataProvider="dataToMixA" props='{"foo":{"bar":2}}'></sonic-subscriber>
|
|
11
|
-
<sonic-subscriber dataProvider="dataToMixB" props='{"baz":3}'></sonic-subscriber>
|
|
12
|
-
</template>
|
|
13
|
-
</sonic-code>
|
|
14
|
-
We can rearrange the data as follows
|
|
15
|
-
<sonic-code>
|
|
16
|
-
<template>
|
|
17
|
-
<sonic-mix dataProvider="mixedData" composition='{"either":"dataToMixB","orThat":"dataToMixA.foo.bar"}'>
|
|
18
|
-
<div>Value of dataToMixA.foo.bar and mixedData.orThat : <sonic-value key="orThat"></sonic-value></div>
|
|
19
|
-
<div>Value of dataToMixB.baz and mixedData.either.baz : <sonic-value key="either.baz"></sonic-value></div>
|
|
20
|
-
</sonic-mix>
|
|
21
|
-
</template>
|
|
22
|
-
</sonic-code>
|
|
23
|
-
Then we can change values in both dataProviders programaticaly this way, they will stay in sync
|
|
24
|
-
<sonic-code language="javascript">
|
|
25
|
-
<template>
|
|
26
|
-
SonicPublisherManager.get("mixedData").either.baz=6;
|
|
27
|
-
SonicPublisherManager.get("dataToMixB").baz=8;
|
|
28
|
-
SonicPublisherManager.get("dataToMixA").foo.bar=8;
|
|
29
|
-
SonicPublisherManager.get("mixedData").orThat=6;
|
|
30
|
-
</template>
|
|
31
|
-
</sonic-code>
|
|
32
|
-
Or by using a form element
|
|
33
|
-
<sonic-code>
|
|
34
|
-
<template>
|
|
35
|
-
<sonic-input label="mixedData.orThat" formDataProvider="mixedData" name="orThat"></sonic-input>
|
|
36
|
-
</template>
|
|
37
|
-
</sonic-code>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Queue
|
|
2
|
-
|
|
3
|
-
**sonic-queue** loads content in batches based on the expression provided in the dataProviderExpression attribute.
|
|
4
|
-
|
|
5
|
-
* Each batch is loaded by a [List component](#core/components/functional/list/list.md/list) whose dataProvider is created from the dataProviderExpression attribute.
|
|
6
|
-
* Upon initialization, it looks at the dataFilterProvider attribute, which provides the address of a publisher.
|
|
7
|
-
If this attribute is found, Queue listens to the provided publisher and resets itself whenever the content of the publisher is modified.
|
|
8
|
-
The values provided in this publisher are added as parameters to each request.
|
|
9
|
-
* The key property can be used to target a specific property in the API response as fetch does.
|
|
10
|
-
|
|
11
|
-
List extends the mixin [Subscriber](#docs/_core-concept/subscriber.md/subscriber)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<sonic-code>
|
|
15
|
-
<template>
|
|
16
|
-
<sonic-queue
|
|
17
|
-
class="grid grid-cols-3 gap-3"
|
|
18
|
-
dataProviderExpression="communes?limit=$limit"
|
|
19
|
-
limit="30"
|
|
20
|
-
serviceURL="https://geo.api.gouv.fr/"
|
|
21
|
-
debug
|
|
22
|
-
>
|
|
23
|
-
<template>
|
|
24
|
-
<div data-bind ::inner-html="$nom" class="bg-neutral-100 p-2">
|
|
25
|
-
queue
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
</sonic-queue>
|
|
29
|
-
</template>
|
|
30
|
-
</sonic-code>
|
|
31
|
-
|
|
32
|
-
<sonic-code>
|
|
33
|
-
<template>
|
|
34
|
-
<sonic-queue
|
|
35
|
-
lazyload
|
|
36
|
-
dataProviderExpression="api/users?page=$offset&per_page=$limit"
|
|
37
|
-
offset="2"
|
|
38
|
-
limit="5"
|
|
39
|
-
dataFilterProvider="filter"
|
|
40
|
-
targetRequestDuration="500"
|
|
41
|
-
serviceURL="https://reqres.in"
|
|
42
|
-
key="data"
|
|
43
|
-
debug
|
|
44
|
-
>
|
|
45
|
-
<template>
|
|
46
|
-
<div class="flex px-4 py-3 items-center gap-4">
|
|
47
|
-
<sonic-image data-bind ::src="$avatar" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
|
|
48
|
-
<div>
|
|
49
|
-
<div class="text-bold text-2xl mb-2">
|
|
50
|
-
<span data-bind ::inner-html="$first_name"></span>
|
|
51
|
-
<span data-bind ::inner-html="$last_name"></span>
|
|
52
|
-
</div>
|
|
53
|
-
<sonic-button data-bind ::href="mailto|$email" size="xs" variant="outline"> Contact </sonic-button>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="border-0 border-t-2 border-t-neutral-200 w-full border-solid"></div>
|
|
57
|
-
</template>
|
|
58
|
-
</sonic-queue>
|
|
59
|
-
</template>
|
|
60
|
-
</sonic-code>
|
|
61
|
-
|
|
62
|
-
<sonic-code>
|
|
63
|
-
<template>
|
|
64
|
-
<sonic-list
|
|
65
|
-
lazyload
|
|
66
|
-
fetch
|
|
67
|
-
dataProvider="api/users?page=2&per_page=5"
|
|
68
|
-
serviceURL="https://reqres.in"
|
|
69
|
-
key="data"
|
|
70
|
-
debug
|
|
71
|
-
>
|
|
72
|
-
<template>
|
|
73
|
-
<div class="flex px-4 py-3 items-center gap-4">
|
|
74
|
-
<sonic-image data-bind ::src="$avatar" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
|
|
75
|
-
<div>
|
|
76
|
-
<div class="text-bold text-2xl mb-2">
|
|
77
|
-
<span data-bind ::inner-html="$first_name"></span>
|
|
78
|
-
<span data-bind ::inner-html="$last_name"></span>
|
|
79
|
-
</div>
|
|
80
|
-
<sonic-button data-bind ::href="mailto|$email" size="xs" variant="outline"> Contact </sonic-button>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
<div class="border-0 border-t-2 border-t-neutral-200 w-full border-solid"></div>
|
|
84
|
-
</template>
|
|
85
|
-
</sonic-list>
|
|
86
|
-
</template>
|
|
87
|
-
</sonic-code>
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Router
|
|
2
|
-
|
|
3
|
-
The router observes the document.location changes and updates its view as follows
|
|
4
|
-
|
|
5
|
-
## Data-route / Basic
|
|
6
|
-
|
|
7
|
-
When the data-route attribute of a template matches the current url, the content of this template is rendered
|
|
8
|
-
|
|
9
|
-
<sonic-code>
|
|
10
|
-
<template>
|
|
11
|
-
<div class="flex gap-2 items-center">
|
|
12
|
-
<sonic-button href="#core/components/functional/router/router.md/router#home" size="xs">Home</sonic-button>
|
|
13
|
-
<sonic-button href="#core/components/functional/router/router.md/router#about" size="xs">About</sonic-button>
|
|
14
|
-
<sonic-button href="#core/components/functional/router/router.md/router#work" size="xs">Work</sonic-button>
|
|
15
|
-
<sonic-button href="#core/components/functional/router/router.md/router#contact" size="xs">Contact</sonic-button>
|
|
16
|
-
</div>
|
|
17
|
-
<sonic-router>
|
|
18
|
-
<template data-route="#home">
|
|
19
|
-
<div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Home</div>
|
|
20
|
-
</template>
|
|
21
|
-
<template data-route="#about">
|
|
22
|
-
<div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">About</div>
|
|
23
|
-
</template>
|
|
24
|
-
<template data-route="#work">
|
|
25
|
-
<div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Work</div>
|
|
26
|
-
</template>
|
|
27
|
-
<template data-route="#contact">
|
|
28
|
-
<div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Contact</div>
|
|
29
|
-
</template>
|
|
30
|
-
</sonic-router>
|
|
31
|
-
</template>
|
|
32
|
-
</sonic-code>
|
|
33
|
-
|
|
34
|
-
## Data-route / Regexp
|
|
35
|
-
|
|
36
|
-
You can use any RegExp in the data-route attribute of your templates to match the current location and to extract variables from it using capturing groups.
|
|
37
|
-
A dataProvider attribute is generated using the dataProviderExpression where $1, $2... are replaced with this variables.
|
|
38
|
-
|
|
39
|
-
**e.g.**, data-route="#couleur_<b class="text-danger">(\d+)</b>" => dataProviderExpression="api/unknown/<b class="text-danger">$1</b>"
|
|
40
|
-
|
|
41
|
-
The rendered content of the matching template is scoped with this **dataProvider**.
|
|
42
|
-
You can make creative usage on this feature to generate dynamic content based on services.
|
|
43
|
-
|
|
44
|
-
<sonic-code>
|
|
45
|
-
<template>
|
|
46
|
-
<sonic-list fetch dataProvider="api/unknown" key="data" class="flex gap-2 items-center" >
|
|
47
|
-
<template>
|
|
48
|
-
<sonic-button radio size="xs" data-bind ::href="#core/components/functional/router/router.md/router#couleur_$id">
|
|
49
|
-
<span data-bind ::inner-html="ucFirst|$name"></span>
|
|
50
|
-
</sonic-button>
|
|
51
|
-
</template>
|
|
52
|
-
</sonic-list>
|
|
53
|
-
<sonic-router>
|
|
54
|
-
<template data-route="#couleur_(\d+)" dataProviderExpression="api/unknown/$1">
|
|
55
|
-
<sonic-fetch>
|
|
56
|
-
<input type="color" disabled data-bind ::value="$data.color" class=" w-full h-10 my-3" />
|
|
57
|
-
</sonic-fetch>
|
|
58
|
-
</template>
|
|
59
|
-
</sonic-router>
|
|
60
|
-
</template>
|
|
61
|
-
</sonic-code>
|
|
62
|
-
|
|
63
|
-
## Data-route / Url-pattern
|
|
64
|
-
|
|
65
|
-
Same as RegExp but using <a href="https://www.npmjs.com/package/url-pattern" target="_blank">url patterns</a>
|
|
66
|
-
**e.g.**, data-route="#couleur_<b class="text-danger">:id</b>" => dataProviderExpression="api/unknown/<b class="text-danger">:id</b>"
|
|
67
|
-
|
|
68
|
-
<sonic-code>
|
|
69
|
-
<template>
|
|
70
|
-
<sonic-list fetch dataProvider="api/unknown" key="data" class="flex gap-2 items-center" >
|
|
71
|
-
<template>
|
|
72
|
-
<sonic-button radio size="xs" data-bind ::href="#core/components/functional/router/router.md/router#couleur_$id">
|
|
73
|
-
<span data-bind ::inner-html="ucFirst|$name"></span>
|
|
74
|
-
</sonic-button>
|
|
75
|
-
</template>
|
|
76
|
-
</sonic-list>
|
|
77
|
-
<sonic-router>
|
|
78
|
-
<template data-route="/*#couleur_:id" dataProviderExpression="api/unknown/:id">
|
|
79
|
-
<sonic-fetch>
|
|
80
|
-
<input type="color" disabled data-bind ::value="$data.color" class=" w-full h-10 my-3" />
|
|
81
|
-
</sonic-fetch>
|
|
82
|
-
</template>
|
|
83
|
-
</sonic-router>
|
|
84
|
-
</template>
|
|
85
|
-
</sonic-code>
|
|
86
|
-
|
|
87
|
-
## Redirect
|
|
88
|
-
|
|
89
|
-
Redirect allows to redirect to a url when a data is provided.
|
|
90
|
-
Here Redirect waits that a data is available in the property *theData* of the dataProvider *stupid-data-set-id*
|
|
91
|
-
We are then redirected to the url *#data-is-set* which does nothing in itself.
|
|
92
|
-
|
|
93
|
-
<sonic-code>
|
|
94
|
-
<template>
|
|
95
|
-
<sonic-redirect to="#core/components/functional/router/router.md/router#data-is-set" dataProvider="stupid-data-set-id" onData="theData"></sonic-redirect>
|
|
96
|
-
<div class="flex gap-2 mb-4" formDataProvider="stupid-data-set-id">
|
|
97
|
-
<sonic-button radio name="theData" value="Some Data" size="xs">
|
|
98
|
-
Enter data
|
|
99
|
-
</sonic-button>
|
|
100
|
-
<sonic-button radio name="theData" value="" href="javascript:history.back();" size="xs">
|
|
101
|
-
Delete the data and do a history.back()
|
|
102
|
-
</sonic-button>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
</template>
|
|
106
|
-
</sonic-code>
|
|
107
|
-
|
|
108
|
-
Example of use : use with a router and a submit to manage the steps of login/logout, display of user info.
|
|
109
|
-
|
|
110
|
-
## Fallback
|
|
111
|
-
|
|
112
|
-
The fallback route is rendered when no other route matches the current location.
|
|
113
|
-
|
|
114
|
-
<sonic-code>
|
|
115
|
-
<sonic-router>
|
|
116
|
-
<template data-route="#home">
|
|
117
|
-
<div>Home</div>
|
|
118
|
-
</template>
|
|
119
|
-
<template data-route="#fallback">
|
|
120
|
-
<div>Fallback</div>
|
|
121
|
-
</template>
|
|
122
|
-
</sonic-router>
|
|
123
|
-
</sonic-code>
|
|
124
|
-
|
|
125
|
-
## Programmatic routes
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"checkbox": {
|
|
3
|
-
"tagName": "sonic-checkbox"
|
|
4
|
-
},
|
|
5
|
-
"date": {
|
|
6
|
-
"tagName": "sonic-input",
|
|
7
|
-
"attributes": {
|
|
8
|
-
"type": "date"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"fieldset": {
|
|
12
|
-
"tagName": "sonic-fieldset",
|
|
13
|
-
"nodes":[{"libraryKey":"formLayout"}],
|
|
14
|
-
"contentElementSelector":"sonic-form-layout"
|
|
15
|
-
},
|
|
16
|
-
"managed_file": {
|
|
17
|
-
"tagName": "sonic-input",
|
|
18
|
-
"attributes": {
|
|
19
|
-
"variant":"ghost",
|
|
20
|
-
"type": "file"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"password": {
|
|
24
|
-
"tagName": "sonic-input",
|
|
25
|
-
"attributes": {
|
|
26
|
-
"type": "password"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"radio": {
|
|
30
|
-
"tagName": "sonic-radio"
|
|
31
|
-
},
|
|
32
|
-
"select": {
|
|
33
|
-
"tagName": "sonic-select"
|
|
34
|
-
},
|
|
35
|
-
"textarea": {
|
|
36
|
-
"tagName": "sonic-textarea"
|
|
37
|
-
},
|
|
38
|
-
"textfield": {
|
|
39
|
-
"tagName": "sonic-input",
|
|
40
|
-
"attributes": {
|
|
41
|
-
"type": "text"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"hidden": {
|
|
45
|
-
"tagName": "sonic-input",
|
|
46
|
-
"attributes": {
|
|
47
|
-
"type": "hidden"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"button": {
|
|
51
|
-
"tagName": "sonic-button"
|
|
52
|
-
},
|
|
53
|
-
"form": {
|
|
54
|
-
"tagName": "sonic-submit",
|
|
55
|
-
"attributes": {
|
|
56
|
-
"onEnterKey": true
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"submit": {
|
|
60
|
-
"tagName": "sonic-submit",
|
|
61
|
-
"attributes": {
|
|
62
|
-
"onClick": true
|
|
63
|
-
},
|
|
64
|
-
"contentElementSelector":"sonic-button",
|
|
65
|
-
"nodes":[
|
|
66
|
-
{
|
|
67
|
-
"libraryKey":"button",
|
|
68
|
-
"attributes":{"type":"success"},
|
|
69
|
-
"nodes":[
|
|
70
|
-
{
|
|
71
|
-
"tagName":"sonic-icon",
|
|
72
|
-
"attributes":{
|
|
73
|
-
"name":"check",
|
|
74
|
-
"slot":"prefix"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
"email": {
|
|
82
|
-
"tagName": "sonic-input",
|
|
83
|
-
"attributes": {
|
|
84
|
-
"type": "email"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"formItemContainer": {
|
|
88
|
-
"tagName": "div",
|
|
89
|
-
"attributes": {
|
|
90
|
-
"class": "form-item-container"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
"formLayout": {
|
|
94
|
-
"tagName": "sonic-form-layout"
|
|
95
|
-
},
|
|
96
|
-
"formActions": {
|
|
97
|
-
"tagName": "sonic-form-actions"
|
|
98
|
-
},
|
|
99
|
-
"passwordHelper": {
|
|
100
|
-
"tagName": "sonic-password-helper"
|
|
101
|
-
},
|
|
102
|
-
"sameValueHelper": {
|
|
103
|
-
"tagName": "sonic-same-value-helper"
|
|
104
|
-
},
|
|
105
|
-
"divider": {
|
|
106
|
-
"tagName": "sonic-divider"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nodes": [
|
|
3
|
-
{
|
|
4
|
-
"tagName": "div",
|
|
5
|
-
"attributes": {
|
|
6
|
-
"class": "flex gap-2 items-center",
|
|
7
|
-
"formdataprovider": "states-basic-example"
|
|
8
|
-
},
|
|
9
|
-
"nodes": [
|
|
10
|
-
{
|
|
11
|
-
"tagName": "sonic-button",
|
|
12
|
-
"attributes": {
|
|
13
|
-
"radio": "",
|
|
14
|
-
"name": "selection",
|
|
15
|
-
"value": "#home",
|
|
16
|
-
"checked": "",
|
|
17
|
-
"size": "xs"
|
|
18
|
-
},
|
|
19
|
-
"innerHTML": "Home"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"tagName": "sonic-button",
|
|
23
|
-
"attributes": {
|
|
24
|
-
"radio": "",
|
|
25
|
-
"name": "selection",
|
|
26
|
-
"value": "#about",
|
|
27
|
-
"size": "xs"
|
|
28
|
-
},
|
|
29
|
-
"innerHTML": "About"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"tagName": "sonic-button",
|
|
33
|
-
"attributes": {
|
|
34
|
-
"radio": "",
|
|
35
|
-
"name": "selection",
|
|
36
|
-
"value": "#work",
|
|
37
|
-
"size": "xs"
|
|
38
|
-
},
|
|
39
|
-
"innerHTML": "Work"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"tagName": "sonic-button",
|
|
43
|
-
"attributes": {
|
|
44
|
-
"radio": "",
|
|
45
|
-
"name": "selection",
|
|
46
|
-
"value": "#contact",
|
|
47
|
-
"size": "xs"
|
|
48
|
-
},
|
|
49
|
-
"innerHTML": "Contact"
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"tagName": "div",
|
|
55
|
-
"attributes": {
|
|
56
|
-
"class": "text-center text-neutral-700 border rounded text-4xl my-6 p-3 "
|
|
57
|
-
},
|
|
58
|
-
"nodes": [
|
|
59
|
-
{
|
|
60
|
-
"tagName": "sonic-states",
|
|
61
|
-
"attributes": {
|
|
62
|
-
"dataprovider": "states-basic-example",
|
|
63
|
-
"data-path": "selection"
|
|
64
|
-
},
|
|
65
|
-
"nodes": [
|
|
66
|
-
{
|
|
67
|
-
"tagName": "template",
|
|
68
|
-
"attributes": {
|
|
69
|
-
"data-value": "#home"
|
|
70
|
-
},
|
|
71
|
-
"innerHTML": "Home"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"tagName": "template",
|
|
75
|
-
"attributes": {
|
|
76
|
-
"data-value": "#about"
|
|
77
|
-
},
|
|
78
|
-
"innerHTML": "About"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"tagName": "template",
|
|
82
|
-
"attributes": {
|
|
83
|
-
"data-value": "#work"
|
|
84
|
-
},
|
|
85
|
-
"innerHTML": "Work"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"tagName": "template",
|
|
89
|
-
"attributes": {
|
|
90
|
-
"data-value": "#contact"
|
|
91
|
-
},
|
|
92
|
-
"innerHTML": "Contact"
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}
|