@api-client/ui 0.5.39 → 0.5.40
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/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/.aiexclude +0 -3
- package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
- package/.cursor/rules/lit-best-practices.mdc +0 -89
- package/.editorconfig +0 -29
- package/.github/CONTRIBUTING.md +0 -24
- package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
- package/.github/instructions/lit-best-practices.instructions.md +0 -90
- package/.github/release.yml +0 -14
- package/.github/stale.yml +0 -23
- package/.github/workflows/auto-release.yml +0 -182
- package/.github/workflows/release.yml +0 -82
- package/.prettierrc.js +0 -14
- package/.vscode/settings.json +0 -18
- package/RELEASE.md +0 -163
- package/RELEASE_SETUP.md +0 -235
- package/build/src/demo/DemoPage.d.ts +0 -81
- package/build/src/demo/DemoPage.d.ts.map +0 -1
- package/build/src/demo/DemoPage.js +0 -175
- package/build/src/demo/DemoPage.js.map +0 -1
- package/build/src/demo/DemoStyles.d.ts +0 -3
- package/build/src/demo/DemoStyles.d.ts.map +0 -1
- package/build/src/demo/DemoStyles.js +0 -60
- package/build/src/demo/DemoStyles.js.map +0 -1
- package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
- package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
- package/build/test/elements/navigation/Navigation.test.js +0 -113
- package/build/test/elements/navigation/Navigation.test.js.map +0 -1
- package/commitlint.config.cjs +0 -2
- package/demo/elements/authorization/AuthPlugin.js +0 -57
- package/demo/elements/authorization/AuthProxy.js +0 -215
- package/demo/elements/authorization/api-key.html +0 -27
- package/demo/elements/authorization/api-key.ts +0 -44
- package/demo/elements/authorization/basic.html +0 -27
- package/demo/elements/authorization/basic.ts +0 -43
- package/demo/elements/authorization/bearer.html +0 -27
- package/demo/elements/authorization/bearer.ts +0 -43
- package/demo/elements/authorization/env.js +0 -8
- package/demo/elements/authorization/index.html +0 -44
- package/demo/elements/authorization/ntlm.html +0 -27
- package/demo/elements/authorization/ntlm.ts +0 -43
- package/demo/elements/authorization/oauth-authorize.html +0 -75
- package/demo/elements/authorization/oauth-authorize.ts +0 -40
- package/demo/elements/authorization/oauth-error.html +0 -18
- package/demo/elements/authorization/oauth-error.ts +0 -10
- package/demo/elements/authorization/oauth-popup.html +0 -36
- package/demo/elements/authorization/oauth2.html +0 -27
- package/demo/elements/authorization/oauth2.ts +0 -100
- package/demo/elements/authorization/oidc.html +0 -27
- package/demo/elements/authorization/oidc.ts +0 -139
- package/demo/elements/authorization/private.crt +0 -31
- package/demo/elements/authorization/private.csr +0 -28
- package/demo/elements/authorization/private.key +0 -51
- package/demo/elements/authorization/private.pem +0 -31
- package/demo/elements/authorization/redirect.html +0 -20
- package/demo/elements/authorization/ssl-commands.sh +0 -30
- package/demo/elements/authorization/ssl.conf +0 -24
- package/demo/elements/autocomplete/index.html +0 -64
- package/demo/elements/autocomplete/index.ts +0 -171
- package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
- package/demo/elements/code-editor/index.html +0 -19
- package/demo/elements/context-menu/DemoIcons.ts +0 -21
- package/demo/elements/context-menu/basic.html +0 -25
- package/demo/elements/context-menu/basic.ts +0 -119
- package/demo/elements/context-menu/custom-data.html +0 -25
- package/demo/elements/context-menu/custom-data.ts +0 -62
- package/demo/elements/context-menu/demo.css +0 -28
- package/demo/elements/context-menu/enabled-state.html +0 -25
- package/demo/elements/context-menu/enabled-state.ts +0 -73
- package/demo/elements/context-menu/icons.html +0 -25
- package/demo/elements/context-menu/icons.ts +0 -64
- package/demo/elements/context-menu/index.html +0 -43
- package/demo/elements/context-menu/nested.html +0 -25
- package/demo/elements/context-menu/nestedt.ts +0 -152
- package/demo/elements/context-menu/no-execute.html +0 -25
- package/demo/elements/context-menu/no-execute.ts +0 -134
- package/demo/elements/context-menu/radio-menu.html +0 -25
- package/demo/elements/context-menu/radio-menu.ts +0 -83
- package/demo/elements/context-menu/separators.html +0 -25
- package/demo/elements/context-menu/separators.ts +0 -172
- package/demo/elements/currency/index.html +0 -91
- package/demo/elements/currency/index.ts +0 -352
- package/demo/elements/environment/environment-editor.html +0 -20
- package/demo/elements/environment/environment-editor.ts +0 -49
- package/demo/elements/environment/index.html +0 -33
- package/demo/elements/environment/server-editor.html +0 -20
- package/demo/elements/environment/server-editor.ts +0 -67
- package/demo/elements/environment/variables-editor.html +0 -20
- package/demo/elements/environment/variables-editor.ts +0 -94
- package/demo/elements/har/har-viewer.html +0 -20
- package/demo/elements/har/har-viewer.ts +0 -76
- package/demo/elements/har/har1.har +0 -3044
- package/demo/elements/har/har2.json +0 -439
- package/demo/elements/har/index.html +0 -26
- package/demo/elements/highlight/example.md +0 -27
- package/demo/elements/highlight/index.html +0 -31
- package/demo/elements/highlight/marked-highlight.html +0 -132
- package/demo/elements/highlight/marked-highlight.ts +0 -22
- package/demo/elements/highlight/prism-highlight.html +0 -62
- package/demo/elements/highlight/prism-highlight.ts +0 -17
- package/demo/elements/http/body-editor.html +0 -17
- package/demo/elements/http/body-editor.ts +0 -115
- package/demo/elements/http/headers.html +0 -17
- package/demo/elements/http/headers.ts +0 -59
- package/demo/elements/http/http-assertions.html +0 -20
- package/demo/elements/http/http-assertions.ts +0 -89
- package/demo/elements/http/http-flows.html +0 -23
- package/demo/elements/http/http-flows.ts +0 -89
- package/demo/elements/http/index.html +0 -45
- package/demo/elements/http/request-editor.html +0 -26
- package/demo/elements/http/request-editor.ts +0 -197
- package/demo/elements/http/request-log.html +0 -16
- package/demo/elements/http/request-log.ts +0 -136
- package/demo/elements/http/url-editing.html +0 -17
- package/demo/elements/http/url-editing.ts +0 -112
- package/demo/elements/icons/index.html +0 -81
- package/demo/elements/icons/index.ts +0 -52
- package/demo/elements/index.html +0 -72
- package/demo/elements/mention-textarea/index.html +0 -19
- package/demo/elements/mention-textarea/index.ts +0 -205
- package/demo/elements/navigation/navigation-item.html +0 -49
- package/demo/elements/navigation/navigation-item.ts +0 -131
- package/demo/elements/navigation/navigation.html +0 -20
- package/demo/elements/navigation/navigation.ts +0 -45
- package/demo/elements/project/index.html +0 -29
- package/demo/elements/project/project-run-report.html +0 -20
- package/demo/elements/project/project-run-report.ts +0 -132
- package/demo/elements/project/request-editor.html +0 -23
- package/demo/elements/project/request-editor.ts +0 -232
- package/demo/elements/user/user-avatar.html +0 -17
- package/demo/elements/user/user-avatar.ts +0 -60
- package/demo/env.js +0 -4
- package/demo/index.html +0 -34
- package/demo/layout/index.html +0 -94
- package/demo/layout/index.ts +0 -190
- package/demo/md/DemoStyles.ts +0 -61
- package/demo/md/UiDemoPage.ts +0 -6
- package/demo/md/buttons/button.html +0 -121
- package/demo/md/buttons/button.ts +0 -246
- package/demo/md/buttons/group.html +0 -36
- package/demo/md/buttons/group.ts +0 -171
- package/demo/md/checkbox/index.html +0 -39
- package/demo/md/checkbox/index.ts +0 -220
- package/demo/md/chip/chip.html +0 -70
- package/demo/md/chip/chip.ts +0 -219
- package/demo/md/chip/pawel6c9a.jpg +0 -0
- package/demo/md/collapse/CustomDetail.ts +0 -89
- package/demo/md/collapse/collapse.html +0 -21
- package/demo/md/collapse/collapse.ts +0 -78
- package/demo/md/date-picker/date-picker.ts +0 -336
- package/demo/md/date-picker/index.html +0 -171
- package/demo/md/dialog/confirm-dialog.html +0 -49
- package/demo/md/dialog/confirm-dialog.ts +0 -121
- package/demo/md/dialog/dialog.html +0 -25
- package/demo/md/dialog/dialog.ts +0 -468
- package/demo/md/dropdown-list/index.html +0 -31
- package/demo/md/dropdown-list/index.ts +0 -158
- package/demo/md/icon-button/index.html +0 -122
- package/demo/md/icon-button/index.ts +0 -132
- package/demo/md/index.html +0 -73
- package/demo/md/inputs/input.html +0 -73
- package/demo/md/inputs/input.ts +0 -278
- package/demo/md/inputs/radio.html +0 -39
- package/demo/md/inputs/radio.ts +0 -156
- package/demo/md/inputs/switch.html +0 -45
- package/demo/md/inputs/switch.ts +0 -144
- package/demo/md/list/list.html +0 -65
- package/demo/md/list/list.ts +0 -204
- package/demo/md/listbox/listbox.html +0 -31
- package/demo/md/listbox/listbox.ts +0 -27
- package/demo/md/menu/index.html +0 -19
- package/demo/md/menu/index.ts +0 -514
- package/demo/md/notification/snack.html +0 -21
- package/demo/md/notification/snack.ts +0 -70
- package/demo/md/progress/progress.html +0 -46
- package/demo/md/progress/progress.ts +0 -161
- package/demo/md/segmented-button/index.html +0 -21
- package/demo/md/segmented-button/index.ts +0 -55
- package/demo/md/select/index.html +0 -16
- package/demo/md/select/index.ts +0 -217
- package/demo/md/tabs/tabs.html +0 -40
- package/demo/md/tabs/tabs.ts +0 -214
- package/demo/oauth-popup.html +0 -36
- package/demo/page.css +0 -8
- package/demo/resources/calendar-month.png +0 -0
- package/demo/resources/favorite.png +0 -0
- package/demo/resources/fingerprint.png +0 -0
- package/demo/resources/home-work.png +0 -0
- package/demo/resources/mood.png +0 -0
- package/demo/resources/print.png +0 -0
- package/demo/resources/stars.png +0 -0
- package/demo/resources/theaters.png +0 -0
- package/demo/tsconfig.json +0 -4
- package/eslint.config.js +0 -97
- package/scripts/copy-assets.js +0 -21
- package/scripts/release.js +0 -66
- package/src/demo/DemoPage.ts +0 -169
- package/src/demo/DemoStyles.ts +0 -60
- package/test/README.md +0 -375
- package/test/contextual-menu/ContextMenu.test.ts +0 -760
- package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
- package/test/core/activity.spec.ts +0 -413
- package/test/core/activity_manager.spec.ts +0 -544
- package/test/core/application.spec.ts +0 -218
- package/test/core/fragment.spec.ts +0 -565
- package/test/core/fragment_manager.spec.ts +0 -404
- package/test/core/live_data.spec.ts +0 -558
- package/test/core/renderer.spec.ts +0 -113
- package/test/dom-assertions.test.ts +0 -182
- package/test/elements/MonacoSetup.ts +0 -65
- package/test/elements/authorization/basic-method.test.ts +0 -177
- package/test/elements/authorization/bearer-method.test.ts +0 -143
- package/test/elements/authorization/ntlm-method.test.ts +0 -219
- package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
- package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
- package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
- package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
- package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
- package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
- package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
- package/test/elements/authorization/openid-method.test.ts +0 -591
- package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
- package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
- package/test/elements/code-editor/code-editor.test.ts +0 -574
- package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
- package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
- package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
- package/test/elements/currency/CurrencyPicker.test.ts +0 -486
- package/test/elements/data-table/DataTable.browser.test.ts +0 -649
- package/test/elements/har/HarUtils.test.ts +0 -45
- package/test/elements/har/HarViewerElement.test.ts +0 -687
- package/test/elements/har/test-data/har1.har +0 -3044
- package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
- package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
- package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
- package/test/elements/highlight/remoteSanitization.md +0 -1
- package/test/elements/highlight/test.md +0 -3
- package/test/elements/highlight/test1.md +0 -3
- package/test/elements/highlight/test2.md +0 -1
- package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
- package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
- package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
- package/test/elements/http/CertificateAdd.test.ts +0 -457
- package/test/elements/http/HttpAssertions.test.ts +0 -994
- package/test/elements/http/HttpFlows.test.ts +0 -502
- package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
- package/test/elements/layout/SplitItem.test.ts +0 -440
- package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
- package/test/elements/layout/SplitPanel.test.ts +0 -1109
- package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
- package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
- package/test/elements/navigation/Navigation.test.ts +0 -120
- package/test/env.ts +0 -15
- package/test/events/EventTypes.test.ts +0 -363
- package/test/events/EventsTestHelpers.ts +0 -16
- package/test/helpers/TestUtils.ts +0 -243
- package/test/helpers/UiMock.ts +0 -185
- package/test/lib/Dom.test.ts +0 -231
- package/test/md/button/UiButton.test.ts +0 -347
- package/test/md/button/UiIconButton.test.ts +0 -155
- package/test/md/chip/UiChip.test.ts +0 -219
- package/test/md/collapse/UiCollapse.test.ts +0 -250
- package/test/md/collapse/flex-layout.test.ts +0 -105
- package/test/md/date-time/DateTime.test.ts +0 -348
- package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
- package/test/md/dialog/UiDialog.test.ts +0 -759
- package/test/md/menu/Menu.test.ts +0 -855
- package/test/md/menu/MenuIntegration.test.ts +0 -426
- package/test/md/menu/MenuItem.test.ts +0 -652
- package/test/md/menu/SubMenu.test.ts +0 -410
- package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
- package/test/md/progress/UiProgressElement.test.ts +0 -117
- package/test/md/progress/UiRangeElement.test.ts +0 -156
- package/test/md/select/Select.test.ts +0 -925
- package/test/plugins/takeScreenshotPlugin.js +0 -35
- package/test/setup.test.ts +0 -217
- package/test/setup.ts +0 -117
- package/test/tsconfig.json +0 -7
- package/web-dev-server.config.js +0 -21
- package/web-test-runner.config.js +0 -90
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
3
|
-
import { ContextualMenu } from '../../../src/elements/contextual-menu/internals/ContextualMenu.js'
|
|
4
|
-
import { ContextMenuCommand, CommandExecuteOptions } from '../../../src/elements/contextual-menu/internals/types.js'
|
|
5
|
-
import { formatSize, copy, paste, title, fontDownload } from './DemoIcons.js'
|
|
6
|
-
|
|
7
|
-
class ComponentPage extends DemoPage {
|
|
8
|
-
override accessor componentName = 'Using separators'
|
|
9
|
-
|
|
10
|
-
override firstRender(): void {
|
|
11
|
-
super.firstRender()
|
|
12
|
-
this.initContextMenu()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
initContextMenu(): void {
|
|
16
|
-
const container = document.body.querySelector('#workspace') as HTMLElement
|
|
17
|
-
const instance = new ContextualMenu(container)
|
|
18
|
-
const commands: ContextMenuCommand[] = [
|
|
19
|
-
{
|
|
20
|
-
target: 'root',
|
|
21
|
-
label: 'Font size',
|
|
22
|
-
icon: formatSize,
|
|
23
|
-
execute: (args: CommandExecuteOptions): void => {
|
|
24
|
-
console.log('Selected option:', args.item.id)
|
|
25
|
-
},
|
|
26
|
-
children: [
|
|
27
|
-
{
|
|
28
|
-
label: '0.75 rem',
|
|
29
|
-
id: '0.75rem',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: '1 rem',
|
|
33
|
-
id: '1rem',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: '1.25 rem',
|
|
37
|
-
id: '1.25rem',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: '1.5 rem',
|
|
41
|
-
id: '1.5rem',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: '2 rem',
|
|
45
|
-
id: '2rem',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
target: 'root',
|
|
51
|
-
label: 'Font family',
|
|
52
|
-
icon: title,
|
|
53
|
-
execute: (args: CommandExecuteOptions): void => {
|
|
54
|
-
console.log('Selected font:', args.item.id)
|
|
55
|
-
},
|
|
56
|
-
children: [
|
|
57
|
-
{
|
|
58
|
-
label: 'Arial',
|
|
59
|
-
id: 'Arial',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: 'Calibri',
|
|
63
|
-
id: 'Calibri',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: 'Consolas',
|
|
67
|
-
id: 'Consolas',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: 'Courier New',
|
|
71
|
-
id: 'Courier New',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
label: 'Open Sans',
|
|
75
|
-
id: 'Open Sans',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
label: 'Roboto',
|
|
79
|
-
id: 'Roboto',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
label: 'Times New Roman',
|
|
83
|
-
id: 'Times New Roman',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: 'separator',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: 'Custom font',
|
|
90
|
-
id: 'custom-font',
|
|
91
|
-
icon: fontDownload,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
type: 'separator',
|
|
97
|
-
target: 'root',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
target: 'root',
|
|
101
|
-
label: 'Paste',
|
|
102
|
-
title: 'Paste the value',
|
|
103
|
-
icon: paste,
|
|
104
|
-
execute: (args: CommandExecuteOptions): void => {
|
|
105
|
-
console.log(args)
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
target: 'root',
|
|
110
|
-
label: 'Copy',
|
|
111
|
-
title: 'Copies the object',
|
|
112
|
-
icon: copy,
|
|
113
|
-
execute: (args: CommandExecuteOptions): void => {
|
|
114
|
-
console.log(args)
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: 'separator',
|
|
119
|
-
target: 'root',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
target: 'root',
|
|
123
|
-
label: 'Add',
|
|
124
|
-
children: [
|
|
125
|
-
{
|
|
126
|
-
label: 'Event',
|
|
127
|
-
children: [
|
|
128
|
-
{
|
|
129
|
-
type: 'label',
|
|
130
|
-
label: 'Notification',
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
label: 'Resource updated',
|
|
134
|
-
id: 'event-updated',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
label: 'Resource deleted',
|
|
138
|
-
id: 'event-deleted',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
type: 'label',
|
|
142
|
-
label: 'Mutation',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
label: 'Create resource',
|
|
146
|
-
id: 'event-create',
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
execute: (args: CommandExecuteOptions): void => {
|
|
152
|
-
console.log(args)
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
]
|
|
156
|
-
instance.registerCommands(commands)
|
|
157
|
-
instance.connect()
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
contentTemplate(): TemplateResult {
|
|
161
|
-
return html`
|
|
162
|
-
<a href="./">Back</a>
|
|
163
|
-
<section class="demo-section">
|
|
164
|
-
<h2 class="title-large">Contextual menu with separators</h2>
|
|
165
|
-
<div id="workspace"></div>
|
|
166
|
-
</section>
|
|
167
|
-
`
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const instance = new ComponentPage()
|
|
172
|
-
instance.render()
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
|
|
7
|
-
<title>Currency Picker</title>
|
|
8
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
-
<link
|
|
11
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
12
|
-
rel="stylesheet"
|
|
13
|
-
/>
|
|
14
|
-
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" rel="stylesheet" />
|
|
15
|
-
<link href="../../../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
|
|
16
|
-
<link href="../../../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
|
|
17
|
-
<link href="../../page.css" rel="stylesheet" type="text/css" />
|
|
18
|
-
<style>
|
|
19
|
-
.demo-section {
|
|
20
|
-
margin: 2rem 0;
|
|
21
|
-
padding: 1.5rem;
|
|
22
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
23
|
-
border-radius: 12px;
|
|
24
|
-
background: var(--md-sys-color-surface-container-lowest);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.demo-section h3 {
|
|
28
|
-
margin-top: 0;
|
|
29
|
-
color: var(--md-sys-color-on-surface);
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.demo-section p {
|
|
34
|
-
margin-bottom: 1rem;
|
|
35
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.output-section {
|
|
39
|
-
margin-top: 1rem;
|
|
40
|
-
padding: 1rem;
|
|
41
|
-
background: var(--md-sys-color-surface-container);
|
|
42
|
-
border-radius: 8px;
|
|
43
|
-
border-left: 4px solid var(--md-sys-color-primary);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.output-section h4 {
|
|
47
|
-
margin: 0 0 0.5rem 0;
|
|
48
|
-
font-size: 0.875rem;
|
|
49
|
-
font-weight: 500;
|
|
50
|
-
color: var(--md-sys-color-primary);
|
|
51
|
-
text-transform: uppercase;
|
|
52
|
-
letter-spacing: 0.1em;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.output-content {
|
|
56
|
-
font-family: 'Roboto Mono', monospace;
|
|
57
|
-
font-size: 0.875rem;
|
|
58
|
-
color: var(--md-sys-color-on-surface);
|
|
59
|
-
white-space: pre-wrap;
|
|
60
|
-
word-wrap: break-word;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.demo-controls {
|
|
64
|
-
display: flex;
|
|
65
|
-
flex-wrap: wrap;
|
|
66
|
-
gap: 1rem;
|
|
67
|
-
margin-bottom: 1rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.demo-controls currency-picker {
|
|
71
|
-
min-width: 200px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media (max-width: 768px) {
|
|
75
|
-
.demo-controls {
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.demo-controls currency-picker {
|
|
80
|
-
min-width: unset;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</style>
|
|
84
|
-
</head>
|
|
85
|
-
|
|
86
|
-
<body>
|
|
87
|
-
<div id="app"></div>
|
|
88
|
-
<script type="module" src="/.tmp/demo/elements/currency/index.js"></script>
|
|
89
|
-
</body>
|
|
90
|
-
|
|
91
|
-
</html>
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
3
|
-
import reactive from '../../../src/decorators/reactive.js'
|
|
4
|
-
import type { Currency, CurrencyPickerError } from '../../../src/elements/currency/internals/Picker.js'
|
|
5
|
-
|
|
6
|
-
import '../../../src/elements/currency/currency-picker.js'
|
|
7
|
-
import '../../../src/md/button/ui-button.js'
|
|
8
|
-
import '../../../src/md/checkbox/ui-checkbox.js'
|
|
9
|
-
import '../../../src/md/dialog/ui-dialog.js'
|
|
10
|
-
|
|
11
|
-
class CurrencyPickerDemoPage extends DemoPage {
|
|
12
|
-
override accessor componentName = 'Currency Picker'
|
|
13
|
-
|
|
14
|
-
@reactive() accessor singleSelected: string[] = []
|
|
15
|
-
@reactive() accessor multiSelected: string[] = ['USD', 'EUR']
|
|
16
|
-
@reactive() accessor limitedSelected: string[] = []
|
|
17
|
-
@reactive() accessor formSelected: string[] = []
|
|
18
|
-
@reactive() accessor disabledSelected: string[] = ['GBP']
|
|
19
|
-
|
|
20
|
-
@reactive() accessor lastChangeEvent = 'No changes yet'
|
|
21
|
-
@reactive() accessor lastErrorEvent = 'No errors yet'
|
|
22
|
-
@reactive() accessor dialogOpen = false
|
|
23
|
-
@reactive() accessor dialogFormSelected: string[] = []
|
|
24
|
-
|
|
25
|
-
private readonly allowedCurrencies = ['USD', 'EUR', 'GBP', 'JPY', 'CAD']
|
|
26
|
-
|
|
27
|
-
handleSingleChange(event: CustomEvent<{ currencies: Currency[]; codes: string[] }>): void {
|
|
28
|
-
this.singleSelected = event.detail.codes
|
|
29
|
-
this.lastChangeEvent = `Single Select: ${JSON.stringify(event.detail, null, 2)}`
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
handleMultiChange(event: CustomEvent<{ currencies: Currency[]; codes: string[] }>): void {
|
|
33
|
-
this.multiSelected = event.detail.codes
|
|
34
|
-
this.lastChangeEvent = `Multi Select: ${JSON.stringify(event.detail, null, 2)}`
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
handleLimitedChange(event: CustomEvent<{ currencies: Currency[]; codes: string[] }>): void {
|
|
38
|
-
this.limitedSelected = event.detail.codes
|
|
39
|
-
this.lastChangeEvent = `Limited Currencies: ${JSON.stringify(event.detail, null, 2)}`
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
handleFormChange(event: CustomEvent<{ currencies: Currency[]; codes: string[] }>): void {
|
|
43
|
-
this.formSelected = event.detail.codes
|
|
44
|
-
this.lastChangeEvent = `Form Element: ${JSON.stringify(event.detail, null, 2)}`
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
handleError(event: CustomEvent<{ error: CurrencyPickerError }>): void {
|
|
48
|
-
this.lastErrorEvent = `Error: ${JSON.stringify(event.detail, null, 2)}`
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
handleDialogFormChange(event: CustomEvent<{ currencies: Currency[]; codes: string[] }>): void {
|
|
52
|
-
this.dialogFormSelected = event.detail.codes
|
|
53
|
-
this.lastChangeEvent = `Dialog Form: ${JSON.stringify(event.detail, null, 2)}`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
handleOpenDialog(): void {
|
|
57
|
-
this.dialogOpen = true
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
handleCloseDialog(): void {
|
|
61
|
-
this.dialogOpen = false
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
handleDialogFormSubmit(event: Event): void {
|
|
65
|
-
event.preventDefault()
|
|
66
|
-
const formData = new FormData(event.target as HTMLFormElement)
|
|
67
|
-
console.log('Dialog form submitted:', Object.fromEntries(formData.entries()))
|
|
68
|
-
|
|
69
|
-
if (this.dialogFormSelected.length === 0) {
|
|
70
|
-
alert('Please select a currency before submitting.')
|
|
71
|
-
} else {
|
|
72
|
-
alert(`Dialog form submitted with currency: ${this.dialogFormSelected.join(', ')}`)
|
|
73
|
-
this.dialogOpen = false
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
handleClearSingle(): void {
|
|
78
|
-
const picker = document.querySelector('#single-picker') as HTMLElement & { clearSelection(): void }
|
|
79
|
-
picker?.clearSelection()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
handleClearMulti(): void {
|
|
83
|
-
const picker = document.querySelector('#multi-picker') as HTMLElement & { clearSelection(): void }
|
|
84
|
-
picker?.clearSelection()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
handleClearLimited(): void {
|
|
88
|
-
const picker = document.querySelector('#limited-picker') as HTMLElement & { clearSelection(): void }
|
|
89
|
-
picker?.clearSelection()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
handleTriggerValidationError(): void {
|
|
93
|
-
const picker = document.querySelector('#error-demo-picker') as HTMLElement & { selected: string[] }
|
|
94
|
-
if (picker) {
|
|
95
|
-
// Try to set invalid currency codes
|
|
96
|
-
picker.selected = ['INVALID', 'FAKE', 'USD']
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
handleTriggerSelectionError(): void {
|
|
101
|
-
const picker = document.querySelector('#single-error-picker') as HTMLElement & { selected: string[] }
|
|
102
|
-
if (picker) {
|
|
103
|
-
// Try to set multiple currencies on single-select picker
|
|
104
|
-
picker.selected = ['USD', 'EUR', 'GBP']
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
override contentTemplate(): TemplateResult {
|
|
109
|
-
return html`
|
|
110
|
-
<section class="demo-section">
|
|
111
|
-
<h3>Single Currency Selection</h3>
|
|
112
|
-
<p>Select one currency at a time. When a new currency is selected, it replaces the previous selection.</p>
|
|
113
|
-
|
|
114
|
-
<div class="demo-controls">
|
|
115
|
-
<currency-picker
|
|
116
|
-
id="single-picker"
|
|
117
|
-
label="Select Currency"
|
|
118
|
-
.selected="${this.singleSelected}"
|
|
119
|
-
@change="${this.handleSingleChange}"
|
|
120
|
-
@error="${this.handleError}"
|
|
121
|
-
></currency-picker>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<ui-button @click="${this.handleClearSingle}">Clear Selection</ui-button>
|
|
125
|
-
|
|
126
|
-
<div class="output-section">
|
|
127
|
-
<h4>Selected Currency</h4>
|
|
128
|
-
<div class="output-content">${this.singleSelected.join(', ') || 'None'}</div>
|
|
129
|
-
</div>
|
|
130
|
-
</section>
|
|
131
|
-
|
|
132
|
-
<section class="demo-section">
|
|
133
|
-
<h3>Multiple Currency Selection</h3>
|
|
134
|
-
<p>Select multiple currencies. Selected currencies appear as chips that can be removed individually.</p>
|
|
135
|
-
|
|
136
|
-
<div class="demo-controls">
|
|
137
|
-
<currency-picker
|
|
138
|
-
id="multi-picker"
|
|
139
|
-
label="Add Currency"
|
|
140
|
-
multi
|
|
141
|
-
.selected="${this.multiSelected}"
|
|
142
|
-
@change="${this.handleMultiChange}"
|
|
143
|
-
@error="${this.handleError}"
|
|
144
|
-
></currency-picker>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<ui-button @click="${this.handleClearMulti}">Clear All</ui-button>
|
|
148
|
-
|
|
149
|
-
<div class="output-section">
|
|
150
|
-
<h4>Selected Currencies</h4>
|
|
151
|
-
<div class="output-content">${this.multiSelected.join(', ') || 'None'}</div>
|
|
152
|
-
</div>
|
|
153
|
-
</section>
|
|
154
|
-
|
|
155
|
-
<section class="demo-section">
|
|
156
|
-
<h3>Limited Currency Options</h3>
|
|
157
|
-
<p>Restrict available currencies to a specific subset using the allowedCurrencies property.</p>
|
|
158
|
-
|
|
159
|
-
<div class="demo-controls">
|
|
160
|
-
<currency-picker
|
|
161
|
-
id="limited-picker"
|
|
162
|
-
label="Select from Limited Options"
|
|
163
|
-
multi
|
|
164
|
-
.selected="${this.limitedSelected}"
|
|
165
|
-
.allowedCurrencies="${this.allowedCurrencies}"
|
|
166
|
-
supportingText="Only major currencies available"
|
|
167
|
-
@change="${this.handleLimitedChange}"
|
|
168
|
-
@error="${this.handleError}"
|
|
169
|
-
></currency-picker>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
<ui-button @click="${this.handleClearLimited}">Clear Selection</ui-button>
|
|
173
|
-
|
|
174
|
-
<div class="output-section">
|
|
175
|
-
<h4>Available Currencies</h4>
|
|
176
|
-
<div class="output-content">${this.allowedCurrencies.join(', ')}</div>
|
|
177
|
-
<h4>Selected Currencies</h4>
|
|
178
|
-
<div class="output-content">${this.limitedSelected.join(', ') || 'None'}</div>
|
|
179
|
-
</div>
|
|
180
|
-
</section>
|
|
181
|
-
|
|
182
|
-
<section class="demo-section">
|
|
183
|
-
<h3>Form Integration</h3>
|
|
184
|
-
<p>Use the currency picker in forms with proper name and required attributes.</p>
|
|
185
|
-
|
|
186
|
-
<form @submit="${this.handleFormSubmit}">
|
|
187
|
-
<div class="demo-controls">
|
|
188
|
-
<currency-picker
|
|
189
|
-
label="Required Currency"
|
|
190
|
-
name="currency"
|
|
191
|
-
required
|
|
192
|
-
.selected="${this.formSelected}"
|
|
193
|
-
supportingText="This field is required"
|
|
194
|
-
@change="${this.handleFormChange}"
|
|
195
|
-
@error="${this.handleError}"
|
|
196
|
-
></currency-picker>
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
<ui-button type="submit">Submit Form</ui-button>
|
|
200
|
-
<ui-button color="text" type="reset">Reset Form</ui-button>
|
|
201
|
-
</form>
|
|
202
|
-
|
|
203
|
-
<div class="output-section">
|
|
204
|
-
<h4>Form Value</h4>
|
|
205
|
-
<div class="output-content">${this.formSelected.join(', ') || 'None'}</div>
|
|
206
|
-
</div>
|
|
207
|
-
</section>
|
|
208
|
-
|
|
209
|
-
<section class="demo-section">
|
|
210
|
-
<h3>Disabled State</h3>
|
|
211
|
-
<p>Currency picker in disabled state with pre-selected currencies.</p>
|
|
212
|
-
|
|
213
|
-
<div class="demo-controls">
|
|
214
|
-
<currency-picker
|
|
215
|
-
label="Disabled Picker"
|
|
216
|
-
disabled
|
|
217
|
-
.selected="${this.disabledSelected}"
|
|
218
|
-
supportingText="This picker is disabled"
|
|
219
|
-
></currency-picker>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<div class="output-section">
|
|
223
|
-
<h4>Disabled Selection</h4>
|
|
224
|
-
<div class="output-content">${this.disabledSelected.join(', ')}</div>
|
|
225
|
-
</div>
|
|
226
|
-
</section>
|
|
227
|
-
|
|
228
|
-
<section class="demo-section">
|
|
229
|
-
<h3>Error Handling Demonstration</h3>
|
|
230
|
-
<p>Test various error scenarios to see how the component handles and displays errors.</p>
|
|
231
|
-
|
|
232
|
-
<h4>Validation Errors</h4>
|
|
233
|
-
<p>This picker demonstrates validation errors when invalid currency codes are set programmatically.</p>
|
|
234
|
-
|
|
235
|
-
<div class="demo-controls">
|
|
236
|
-
<currency-picker
|
|
237
|
-
id="error-demo-picker"
|
|
238
|
-
label="Validation Error Demo"
|
|
239
|
-
multi
|
|
240
|
-
@error="${this.handleError}"
|
|
241
|
-
></currency-picker>
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
<ui-button @click="${this.handleTriggerValidationError}">Trigger Validation Error</ui-button>
|
|
245
|
-
|
|
246
|
-
<h4>Selection Constraint Errors</h4>
|
|
247
|
-
<p>This single-select picker demonstrates selection constraint errors.</p>
|
|
248
|
-
|
|
249
|
-
<div class="demo-controls">
|
|
250
|
-
<currency-picker
|
|
251
|
-
id="single-error-picker"
|
|
252
|
-
label="Single Select Error Demo"
|
|
253
|
-
@error="${this.handleError}"
|
|
254
|
-
></currency-picker>
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
<ui-button @click="${this.handleTriggerSelectionError}">Trigger Selection Error</ui-button>
|
|
258
|
-
|
|
259
|
-
<div class="output-section">
|
|
260
|
-
<h4>Error Event Output</h4>
|
|
261
|
-
<div class="output-content">${this.lastErrorEvent}</div>
|
|
262
|
-
</div>
|
|
263
|
-
</section>
|
|
264
|
-
|
|
265
|
-
<section class="demo-section">
|
|
266
|
-
<h3>Event Output</h3>
|
|
267
|
-
<p>View the latest change event data in real-time.</p>
|
|
268
|
-
|
|
269
|
-
<div class="output-section">
|
|
270
|
-
<h4>Last Change Event</h4>
|
|
271
|
-
<div class="output-content">${this.lastChangeEvent}</div>
|
|
272
|
-
</div>
|
|
273
|
-
</section>
|
|
274
|
-
|
|
275
|
-
<section class="demo-section">
|
|
276
|
-
<h3>Error Handling</h3>
|
|
277
|
-
<p>View the latest error event data in real-time.</p>
|
|
278
|
-
|
|
279
|
-
<div class="output-section">
|
|
280
|
-
<h4>Last Error Event</h4>
|
|
281
|
-
<div class="output-content">${this.lastErrorEvent}</div>
|
|
282
|
-
</div>
|
|
283
|
-
</section>
|
|
284
|
-
|
|
285
|
-
<section class="demo-section">
|
|
286
|
-
<h3>Dialog Form Integration</h3>
|
|
287
|
-
<p>Test currency picker rendering inside a dialog that's inside a form.</p>
|
|
288
|
-
|
|
289
|
-
<ui-button @click="${this.handleOpenDialog}">Open Currency Selection Dialog</ui-button>
|
|
290
|
-
|
|
291
|
-
<ui-dialog ?open="${this.dialogOpen}" modal @close="${this.handleCloseDialog}">
|
|
292
|
-
<span slot="title">Select Currency</span>
|
|
293
|
-
|
|
294
|
-
<form @submit="${this.handleDialogFormSubmit}">
|
|
295
|
-
<div class="demo-controls">
|
|
296
|
-
<currency-picker
|
|
297
|
-
id="dialog-picker"
|
|
298
|
-
label="Choose Currency"
|
|
299
|
-
name="dialogCurrency"
|
|
300
|
-
required
|
|
301
|
-
multi
|
|
302
|
-
.selected="${this.dialogFormSelected}"
|
|
303
|
-
supportingText="Select currencies for your account"
|
|
304
|
-
@change="${this.handleDialogFormChange}"
|
|
305
|
-
@error="${this.handleError}"
|
|
306
|
-
></currency-picker>
|
|
307
|
-
</div>
|
|
308
|
-
|
|
309
|
-
<div slot="button">
|
|
310
|
-
<ui-button type="button" color="text" value="dismiss">Cancel</ui-button>
|
|
311
|
-
<ui-button type="submit" color="text" value="confirm">Save Selection</ui-button>
|
|
312
|
-
</div>
|
|
313
|
-
</form>
|
|
314
|
-
</ui-dialog>
|
|
315
|
-
|
|
316
|
-
<div class="output-section">
|
|
317
|
-
<h4>Dialog Form Selection</h4>
|
|
318
|
-
<div class="output-content">${this.dialogFormSelected.join(', ') || 'None'}</div>
|
|
319
|
-
</div>
|
|
320
|
-
</section>
|
|
321
|
-
|
|
322
|
-
<section class="demo-section">
|
|
323
|
-
<h3>Complex Dialog Scenario</h3>
|
|
324
|
-
<p>Additional test with multiple layers to identify potential z-index or stacking context issues.</p>
|
|
325
|
-
|
|
326
|
-
<div
|
|
327
|
-
style="position: relative; z-index: 1; background: var(--md-sys-color-surface-variant); padding: 16px; border-radius: 8px;"
|
|
328
|
-
>
|
|
329
|
-
<h4>Container with relative positioning</h4>
|
|
330
|
-
<p>This container has position: relative and z-index: 1 to test stacking context issues.</p>
|
|
331
|
-
|
|
332
|
-
<ui-button @click="${this.handleOpenDialog}">Open Dialog from Positioned Container</ui-button>
|
|
333
|
-
</div>
|
|
334
|
-
</section>
|
|
335
|
-
`
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
private handleFormSubmit(event: Event): void {
|
|
339
|
-
event.preventDefault()
|
|
340
|
-
const formData = new FormData(event.target as HTMLFormElement)
|
|
341
|
-
console.log('Form submitted:', Object.fromEntries(formData.entries()))
|
|
342
|
-
|
|
343
|
-
if (this.formSelected.length === 0) {
|
|
344
|
-
alert('Please select a currency before submitting the form.')
|
|
345
|
-
} else {
|
|
346
|
-
alert(`Form submitted with currency: ${this.formSelected.join(', ')}`)
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const instance = new CurrencyPickerDemoPage()
|
|
352
|
-
instance.render()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
|
|
6
|
-
<title>Environment editor</title>
|
|
7
|
-
<link
|
|
8
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
9
|
-
rel="stylesheet"
|
|
10
|
-
/>
|
|
11
|
-
<link href="../../../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
|
|
12
|
-
<link href="../../../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
|
|
13
|
-
<link href="../../page.css" rel="stylesheet" type="text/css" />
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<div id="app"></div>
|
|
17
|
-
|
|
18
|
-
<script type="module" src="/.tmp/demo/elements/environment/environment-editor.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
import { IEnvironment, Environment } from '@api-client/core/models/Environment.js'
|
|
3
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
4
|
-
import '../../../src/define/environment/environment-editor.js'
|
|
5
|
-
import { reactive } from '../../../src/decorators/index.js'
|
|
6
|
-
import EnvironmentEditor from '../../../src/elements/environment/EnvironmentEditor.js'
|
|
7
|
-
|
|
8
|
-
const storeKey = 'api-client.demo.elements.environment.environment-editor'
|
|
9
|
-
|
|
10
|
-
class ComponentDemoPage extends DemoPage {
|
|
11
|
-
override accessor componentName = 'Environment editor'
|
|
12
|
-
|
|
13
|
-
@reactive() accessor environment: IEnvironment = new Environment().toJSON()
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
super()
|
|
17
|
-
this.restoreValues()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
restoreValues(): void {
|
|
21
|
-
const data = localStorage.getItem(storeKey)
|
|
22
|
-
if (!data) {
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
this.environment = JSON.parse(data) as IEnvironment
|
|
27
|
-
} catch {
|
|
28
|
-
// ...
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
_changedHandler(): void {
|
|
33
|
-
const editor = document.querySelector('environment-editor') as EnvironmentEditor
|
|
34
|
-
localStorage.setItem(storeKey, JSON.stringify(editor.environment))
|
|
35
|
-
console.log('change')
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
contentTemplate(): TemplateResult {
|
|
39
|
-
return html`
|
|
40
|
-
<a href="./">Back</a>
|
|
41
|
-
<section class="demo-section">
|
|
42
|
-
<environment-editor .environment="${this.environment}" @change="${this._changedHandler}"></environment-editor>
|
|
43
|
-
</section>
|
|
44
|
-
`
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const instance = new ComponentDemoPage()
|
|
49
|
-
instance.render()
|