@supersoniks/concorde 2.0.7 → 3.0.0
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 -0
- package/index.html +44 -0
- package/notes de migration.md +21 -0
- package/package.json +23 -290
- package/scripts/prebuild.mjs +22 -0
- package/{components.js → src/components.ts} +5 -2
- package/src/concorde-loaded.ts +3 -0
- package/src/core/_types/types.ts +55 -0
- package/src/core/components/functional/date/date.md +290 -0
- package/src/core/components/functional/date/date.ts +206 -0
- package/src/core/components/functional/example/example.ts +11 -0
- package/src/core/components/functional/fetch/fetch.md +117 -0
- package/{core/components/functional/fetch/fetch.js → src/core/components/functional/fetch/fetch.ts} +33 -37
- package/src/core/components/functional/if/if.md +16 -0
- package/src/core/components/functional/if/if.test.ts +40 -0
- package/src/core/components/functional/if/if.ts +23 -0
- package/src/core/components/functional/list/list.md +194 -0
- package/src/core/components/functional/list/list.ts +236 -0
- package/src/core/components/functional/mix/mix.md +41 -0
- package/src/core/components/functional/mix/mix.ts +95 -0
- package/src/core/components/functional/queue/queue.md +87 -0
- package/src/core/components/functional/queue/queue.ts +279 -0
- package/src/core/components/functional/router/redirect.ts +44 -0
- package/src/core/components/functional/router/router.md +112 -0
- package/src/core/components/functional/router/router.ts +108 -0
- package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +229 -0
- package/{core → src/core}/components/functional/sdui/default-library.json +13 -13
- package/src/core/components/functional/sdui/example.json +99 -0
- package/src/core/components/functional/sdui/sdui-utils.ts +62 -0
- package/src/core/components/functional/sdui/sdui.md +356 -0
- package/src/core/components/functional/sdui/sdui.ts +230 -0
- package/src/core/components/functional/sdui/types.ts +34 -0
- package/src/core/components/functional/sonic-scope/sonic-scope.ts +13 -0
- package/src/core/components/functional/states/states.md +87 -0
- package/src/core/components/functional/states/states.ts +121 -0
- package/src/core/components/functional/submit/submit.md +48 -0
- package/src/core/components/functional/submit/submit.ts +265 -0
- package/src/core/components/functional/subscriber/subscriber.md +91 -0
- package/src/core/components/functional/subscriber/subscriber.ts +28 -0
- package/src/core/components/functional/value/value.md +35 -0
- package/src/core/components/functional/value/value.ts +18 -0
- package/{core/components/ui/_css/scroll.js → src/core/components/ui/_css/scroll.ts} +3 -2
- package/{core/components/ui/_css/size.js → src/core/components/ui/_css/size.ts} +5 -2
- package/{core/components/ui/_css/type.js → src/core/components/ui/_css/type.ts} +5 -3
- package/src/core/components/ui/alert/alert.md +121 -0
- package/src/core/components/ui/alert/alert.ts +177 -0
- package/src/core/components/ui/badge/badge.md +102 -0
- package/{core/components/ui/badge/badge.js → src/core/components/ui/badge/badge.ts} +36 -51
- package/src/core/components/ui/button/button.md +184 -0
- package/{core/components/ui/button/button.js → src/core/components/ui/button/button.ts} +258 -302
- package/src/core/components/ui/captcha/captcha.md +12 -0
- package/src/core/components/ui/captcha/captcha.ts +88 -0
- package/src/core/components/ui/card/card-footer.ts +19 -0
- package/src/core/components/ui/card/card-header-descripton.ts +24 -0
- package/{core/components/ui/card/card-header.js → src/core/components/ui/card/card-header.ts} +28 -38
- package/src/core/components/ui/card/card-main.ts +24 -0
- package/src/core/components/ui/card/card.md +96 -0
- package/{core/components/ui/card/card.js → src/core/components/ui/card/card.ts} +23 -34
- package/src/core/components/ui/divider/divider.md +35 -0
- package/{core/components/ui/divider/divider.js → src/core/components/ui/divider/divider.ts} +35 -65
- package/src/core/components/ui/form/checkbox/checkbox.md +96 -0
- package/{core/components/ui/form/checkbox/checkbox.js → src/core/components/ui/form/checkbox/checkbox.ts} +79 -98
- package/{core/components/ui/form/css/form-control.js → src/core/components/ui/form/css/form-control.ts} +9 -5
- package/src/core/components/ui/form/fieldset/fieldset.md +129 -0
- package/src/core/components/ui/form/fieldset/fieldset.ts +96 -0
- package/src/core/components/ui/form/fieldset/legend-description.ts +23 -0
- package/src/core/components/ui/form/fieldset/legend.ts +90 -0
- package/src/core/components/ui/form/form-actions/form-actions.md +77 -0
- package/src/core/components/ui/form/form-actions/form-actions.ts +32 -0
- package/src/core/components/ui/form/form-layout/form-layout.md +43 -0
- package/src/core/components/ui/form/form-layout/form-layout.ts +71 -0
- package/src/core/components/ui/form/input/input.md +168 -0
- package/src/core/components/ui/form/input/input.ts +227 -0
- package/src/core/components/ui/form/input/password-helper.ts +68 -0
- package/src/core/components/ui/form/input/same-value-helper.ts +48 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +285 -0
- package/src/core/components/ui/form/radio/radio.md +86 -0
- package/src/core/components/ui/form/radio/radio.ts +44 -0
- package/src/core/components/ui/form/select/select.md +99 -0
- package/src/core/components/ui/form/select/select.ts +310 -0
- package/src/core/components/ui/form/textarea/textarea.md +66 -0
- package/src/core/components/ui/form/textarea/textarea.ts +119 -0
- package/src/core/components/ui/group/group.md +75 -0
- package/src/core/components/ui/group/group.ts +101 -0
- package/src/core/components/ui/icon/icon.md +125 -0
- package/src/core/components/ui/icon/icon.stories.ts +100 -0
- package/src/core/components/ui/icon/icon.ts +106 -0
- package/src/core/components/ui/icon/icons.json +1 -0
- package/src/core/components/ui/icon/icons.ts +130 -0
- package/src/core/components/ui/icon/svgs/cancel.svg +3 -0
- package/src/core/components/ui/icon/svgs/check-circled-outline.svg +4 -0
- package/src/core/components/ui/icon/svgs/check.svg +3 -0
- package/src/core/components/ui/icon/svgs/emoji-puzzled.svg +1 -0
- package/src/core/components/ui/icon/svgs/info-empty.svg +5 -0
- package/src/core/components/ui/icon/svgs/loader.svg +1 -0
- package/src/core/components/ui/icon/svgs/minus-small.svg +3 -0
- package/src/core/components/ui/icon/svgs/more-horiz.svg +5 -0
- package/src/core/components/ui/icon/svgs/more-vert.svg +5 -0
- package/src/core/components/ui/icon/svgs/nav-arrow-down.svg +3 -0
- package/src/core/components/ui/icon/svgs/warning-circled-outline.svg +5 -0
- package/src/core/components/ui/image/image.md +107 -0
- package/src/core/components/ui/image/image.ts +117 -0
- package/src/core/components/ui/link/link.md +43 -0
- package/src/core/components/ui/link/link.ts +108 -0
- package/src/core/components/ui/loader/loader.md +37 -0
- package/src/core/components/ui/loader/loader.stories.ts +25 -0
- package/src/core/components/ui/loader/loader.ts +81 -0
- package/{core/components/ui/loader/styles/fixed.js → src/core/components/ui/loader/styles/fixed.ts} +2 -1
- package/{core/components/ui/loader/styles/inline.js → src/core/components/ui/loader/styles/inline.ts} +3 -2
- package/src/core/components/ui/menu/menu-item.ts +30 -0
- package/src/core/components/ui/menu/menu.md +288 -0
- package/src/core/components/ui/menu/menu.ts +292 -0
- package/src/core/components/ui/modal/modal-actions.ts +35 -0
- package/src/core/components/ui/modal/modal-close.ts +36 -0
- package/src/core/components/ui/modal/modal-content.ts +19 -0
- package/src/core/components/ui/modal/modal-subtitle.ts +23 -0
- package/src/core/components/ui/modal/modal-title.ts +22 -0
- package/src/core/components/ui/modal/modal.md +123 -0
- package/src/core/components/ui/modal/modal.stories.ts +140 -0
- package/src/core/components/ui/modal/modal.ts +386 -0
- package/src/core/components/ui/pop/pop.md +79 -0
- package/src/core/components/ui/pop/pop.ts +291 -0
- package/src/core/components/ui/progress/progress.md +65 -0
- package/{core/components/ui/progress/progress.js → src/core/components/ui/progress/progress.ts} +31 -50
- package/src/core/components/ui/table/table-caption.ts +21 -0
- package/src/core/components/ui/table/table-tbody.ts +32 -0
- package/src/core/components/ui/table/table-td.ts +47 -0
- package/src/core/components/ui/table/table-tfoot.ts +20 -0
- package/src/core/components/ui/table/table-th.ts +56 -0
- package/src/core/components/ui/table/table-thead.ts +18 -0
- package/src/core/components/ui/table/table-tr.ts +48 -0
- package/src/core/components/ui/table/table.md +467 -0
- package/{core/components/ui/table/table.js → src/core/components/ui/table/table.ts} +32 -53
- package/{core/components/ui/theme/theme-collection/core-variables.js → src/core/components/ui/theme/theme-collection/core-variables.ts} +3 -2
- package/{core/components/ui/theme/theme-collection/dark.js → src/core/components/ui/theme/theme-collection/dark.ts} +5 -3
- package/{core/components/ui/theme/theme-collection/light.js → src/core/components/ui/theme/theme-collection/light.ts} +3 -2
- package/src/core/components/ui/theme/theme.ts +118 -0
- package/src/core/components/ui/toast/message-subscriber.stories.ts +43 -0
- package/src/core/components/ui/toast/message-subscriber.ts +37 -0
- package/{core/components/ui/toast/toast-item.js → src/core/components/ui/toast/toast-item.ts} +86 -113
- package/src/core/components/ui/toast/toast.ts +237 -0
- package/src/core/components/ui/toast/types.ts +14 -0
- package/src/core/components/ui/tooltip/tooltip.md +37 -0
- package/{core/components/ui/tooltip/tooltip.js → src/core/components/ui/tooltip/tooltip.ts} +26 -47
- package/{core/components/ui/ui.js → src/core/components/ui/ui.ts} +2 -0
- package/src/core/core.ts +22 -0
- package/src/core/decorators/Subscriber.ts +187 -0
- package/src/core/directives/DataProvider.ts +113 -0
- package/src/core/directives/Wording.ts +220 -0
- package/src/core/mixins/Fetcher.ts +258 -0
- package/src/core/mixins/FormCheckable.ts +287 -0
- package/src/core/mixins/FormElement.ts +275 -0
- package/src/core/mixins/FormInput.ts +135 -0
- package/src/core/mixins/Subscriber.ts +352 -0
- package/src/core/mixins/TemplatesContainer.ts +70 -0
- package/{core/mixins/mixins.d.ts → src/core/mixins/mixins.ts} +1 -1
- package/src/core/utils/Arrays.ts +161 -0
- package/src/core/utils/DataBindObserver.ts +286 -0
- package/src/core/utils/Electron.ts +15 -0
- package/src/core/utils/Format.ts +58 -0
- package/src/core/utils/HTML.ts +126 -0
- package/src/core/utils/LocationHandler.ts +139 -0
- package/src/core/utils/Objects.ts +103 -0
- package/src/core/utils/PublisherProxy.ts +786 -0
- package/src/core/utils/Utils.ts +12 -0
- package/src/core/utils/api.ts +456 -0
- package/{core/utils/url-pattern.d.ts → src/core/utils/url-pattern.ts} +1 -0
- package/{decorators.js → src/decorators.ts} +6 -2
- package/{directives.js → src/directives.ts} +11 -6
- package/src/docs/_core-concept/overview.md +57 -0
- package/src/docs/_core-concept/subscriber.md +76 -0
- package/src/docs/_getting-started/concorde-outside.md +141 -0
- package/src/docs/_getting-started/create-a-component.md +137 -0
- package/src/docs/_getting-started/pubsub.md +150 -0
- package/src/docs/_getting-started/start.md +37 -0
- package/src/docs/_getting-started/theming.md +91 -0
- package/src/docs/code.ts +281 -0
- package/src/docs/docs.ts +6 -0
- package/src/docs/example/users.ts +64 -0
- package/src/docs/navigation/navigation.ts +101 -0
- package/src/docs/prism/index.ts +6 -0
- package/src/docs/prism/prism.css +158 -0
- package/src/docs/prism/prism.js +1022 -0
- package/src/docs/search/docs-search.json +3767 -0
- package/src/docs/search/markdown-renderer.ts +40 -0
- package/src/docs/search/page.ts +40 -0
- package/src/docs/search/search.ts +184 -0
- package/src/docs.ts +2 -0
- package/src/index.ts +7 -0
- package/{mixins.js → src/mixins.ts} +10 -6
- package/src/tag-list.json +1 -0
- package/src/test-utils/TestUtils.ts +13 -0
- package/src/tsconfig.json +113 -0
- package/{utils.js → src/utils.ts} +15 -11
- package/test-utils/TestUtils.ts +13 -0
- package/vite/config.js +136 -0
- package/vite.config.mts +87 -0
- package/README.md +0 -27
- package/cli.js +0 -75
- package/components.d.ts +0 -4
- package/concorde-core.bundle.js +0 -3427
- package/concorde-core.es.js +0 -14372
- package/core/_types/types.d.ts +0 -28
- package/core/_types/types.js +0 -2
- package/core/components/functional/date/date.d.ts +0 -45
- package/core/components/functional/date/date.js +0 -243
- package/core/components/functional/example/example.d.ts +0 -7
- package/core/components/functional/example/example.js +0 -26
- package/core/components/functional/fetch/fetch.d.ts +0 -93
- package/core/components/functional/functional.js +0 -15
- package/core/components/functional/if/if.d.ts +0 -12
- package/core/components/functional/if/if.js +0 -38
- package/core/components/functional/if/if.test.d.ts +0 -1
- package/core/components/functional/if/if.test.js +0 -35
- package/core/components/functional/list/list.d.ts +0 -117
- package/core/components/functional/list/list.js +0 -214
- package/core/components/functional/mix/mix.d.ts +0 -22
- package/core/components/functional/mix/mix.js +0 -102
- package/core/components/functional/queue/queue.d.ts +0 -67
- package/core/components/functional/queue/queue.js +0 -310
- package/core/components/functional/router/redirect.d.ts +0 -18
- package/core/components/functional/router/redirect.js +0 -53
- package/core/components/functional/router/router.d.ts +0 -27
- package/core/components/functional/router/router.js +0 -119
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -58
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +0 -215
- package/core/components/functional/sdui/sdui-utils.d.ts +0 -5
- package/core/components/functional/sdui/sdui-utils.js +0 -63
- package/core/components/functional/sdui/sdui.d.ts +0 -136
- package/core/components/functional/sdui/sdui.js +0 -254
- package/core/components/functional/sdui/types.d.ts +0 -37
- package/core/components/functional/sdui/types.js +0 -1
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -5
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -21
- package/core/components/functional/states/states.d.ts +0 -29
- package/core/components/functional/states/states.js +0 -134
- package/core/components/functional/submit/submit.d.ts +0 -30
- package/core/components/functional/submit/submit.js +0 -236
- package/core/components/functional/subscriber/subscriber.d.ts +0 -12
- package/core/components/functional/subscriber/subscriber.js +0 -38
- package/core/components/functional/value/value.d.ts +0 -7
- package/core/components/functional/value/value.js +0 -27
- package/core/components/ui/_css/scroll.d.ts +0 -1
- package/core/components/ui/_css/size.d.ts +0 -2
- package/core/components/ui/_css/type.d.ts +0 -2
- package/core/components/ui/alert/alert.d.ts +0 -34
- package/core/components/ui/alert/alert.js +0 -202
- package/core/components/ui/badge/badge.d.ts +0 -26
- package/core/components/ui/button/button.d.ts +0 -171
- package/core/components/ui/captcha/captcha.d.ts +0 -30
- package/core/components/ui/captcha/captcha.js +0 -93
- package/core/components/ui/card/card-footer.d.ts +0 -4
- package/core/components/ui/card/card-footer.js +0 -24
- package/core/components/ui/card/card-header-descripton.d.ts +0 -5
- package/core/components/ui/card/card-header-descripton.js +0 -32
- package/core/components/ui/card/card-header.d.ts +0 -8
- package/core/components/ui/card/card-main.d.ts +0 -4
- package/core/components/ui/card/card-main.js +0 -28
- package/core/components/ui/card/card.d.ts +0 -12
- package/core/components/ui/divider/divider.d.ts +0 -15
- package/core/components/ui/form/checkbox/checkbox.d.ts +0 -181
- package/core/components/ui/form/css/form-control.d.ts +0 -4
- package/core/components/ui/form/fieldset/fieldset.d.ts +0 -23
- package/core/components/ui/form/fieldset/fieldset.js +0 -118
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -5
- package/core/components/ui/form/fieldset/legend-description.js +0 -30
- package/core/components/ui/form/fieldset/legend.d.ts +0 -16
- package/core/components/ui/form/fieldset/legend.js +0 -112
- package/core/components/ui/form/form-actions/form-actions.d.ts +0 -7
- package/core/components/ui/form/form-actions/form-actions.js +0 -46
- package/core/components/ui/form/form-layout/form-layout.d.ts +0 -12
- package/core/components/ui/form/form-layout/form-layout.js +0 -83
- package/core/components/ui/form/input/input.d.ts +0 -106
- package/core/components/ui/form/input/input.js +0 -268
- package/core/components/ui/form/input/password-helper.d.ts +0 -25
- package/core/components/ui/form/input/password-helper.js +0 -119
- package/core/components/ui/form/input/same-value-helper.d.ts +0 -16
- package/core/components/ui/form/input/same-value-helper.js +0 -77
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +0 -136
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +0 -296
- package/core/components/ui/form/radio/radio.d.ts +0 -12
- package/core/components/ui/form/radio/radio.js +0 -50
- package/core/components/ui/form/select/select.d.ts +0 -58
- package/core/components/ui/form/select/select.js +0 -298
- package/core/components/ui/form/textarea/textarea.d.ts +0 -84
- package/core/components/ui/form/textarea/textarea.js +0 -150
- package/core/components/ui/group/group.d.ts +0 -16
- package/core/components/ui/group/group.js +0 -118
- package/core/components/ui/icon/icon.d.ts +0 -26
- package/core/components/ui/icon/icon.js +0 -113
- package/core/components/ui/icon/icons.d.ts +0 -10
- package/core/components/ui/icon/icons.js +0 -126
- package/core/components/ui/icon/icons.json +0 -1
- package/core/components/ui/image/image.d.ts +0 -15
- package/core/components/ui/image/image.js +0 -153
- package/core/components/ui/link/link.d.ts +0 -29
- package/core/components/ui/link/link.js +0 -124
- package/core/components/ui/loader/loader.d.ts +0 -23
- package/core/components/ui/loader/loader.js +0 -97
- package/core/components/ui/loader/styles/fixed.d.ts +0 -1
- package/core/components/ui/loader/styles/inline.d.ts +0 -1
- package/core/components/ui/menu/menu-item.d.ts +0 -5
- package/core/components/ui/menu/menu-item.js +0 -34
- package/core/components/ui/menu/menu.d.ts +0 -41
- package/core/components/ui/menu/menu.js +0 -313
- package/core/components/ui/modal/modal-actions.d.ts +0 -7
- package/core/components/ui/modal/modal-actions.js +0 -42
- package/core/components/ui/modal/modal-close.d.ts +0 -7
- package/core/components/ui/modal/modal-close.js +0 -43
- package/core/components/ui/modal/modal-content.d.ts +0 -5
- package/core/components/ui/modal/modal-content.js +0 -26
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -5
- package/core/components/ui/modal/modal-subtitle.js +0 -30
- package/core/components/ui/modal/modal-title.d.ts +0 -5
- package/core/components/ui/modal/modal-title.js +0 -29
- package/core/components/ui/modal/modal.d.ts +0 -58
- package/core/components/ui/modal/modal.js +0 -401
- package/core/components/ui/pop/pop.d.ts +0 -37
- package/core/components/ui/pop/pop.js +0 -299
- package/core/components/ui/progress/progress.d.ts +0 -10
- package/core/components/ui/table/table-caption.d.ts +0 -5
- package/core/components/ui/table/table-caption.js +0 -28
- package/core/components/ui/table/table-tbody.d.ts +0 -5
- package/core/components/ui/table/table-tbody.js +0 -39
- package/core/components/ui/table/table-td.d.ts +0 -12
- package/core/components/ui/table/table-td.js +0 -68
- package/core/components/ui/table/table-tfoot.d.ts +0 -5
- package/core/components/ui/table/table-tfoot.js +0 -27
- package/core/components/ui/table/table-th.d.ts +0 -11
- package/core/components/ui/table/table-th.js +0 -73
- package/core/components/ui/table/table-thead.d.ts +0 -5
- package/core/components/ui/table/table-thead.js +0 -25
- package/core/components/ui/table/table-tr.d.ts +0 -13
- package/core/components/ui/table/table-tr.js +0 -66
- package/core/components/ui/table/table.d.ts +0 -17
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -1
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -1
- package/core/components/ui/theme/theme.d.ts +0 -19
- package/core/components/ui/theme/theme.js +0 -124
- package/core/components/ui/toast/message-subscriber.d.ts +0 -18
- package/core/components/ui/toast/message-subscriber.js +0 -40
- package/core/components/ui/toast/toast-item.d.ts +0 -19
- package/core/components/ui/toast/toast.d.ts +0 -25
- package/core/components/ui/toast/toast.js +0 -226
- package/core/components/ui/toast/types.d.ts +0 -11
- package/core/components/ui/toast/types.js +0 -1
- package/core/components/ui/tooltip/tooltip.d.ts +0 -10
- package/core/components/ui/ui.d.ts +0 -32
- package/core/core.d.ts +0 -4
- package/core/core.js +0 -19
- package/core/decorators/Subscriber.d.ts +0 -4
- package/core/decorators/Subscriber.js +0 -166
- package/core/directives/DataProvider.d.ts +0 -23
- package/core/directives/DataProvider.js +0 -102
- package/core/directives/Wording.d.ts +0 -42
- package/core/directives/Wording.js +0 -202
- package/core/mixins/Fetcher.d.ts +0 -90
- package/core/mixins/Fetcher.js +0 -242
- package/core/mixins/FormCheckable.d.ts +0 -88
- package/core/mixins/FormCheckable.js +0 -306
- package/core/mixins/FormElement.d.ts +0 -32
- package/core/mixins/FormElement.js +0 -272
- package/core/mixins/FormInput.d.ts +0 -70
- package/core/mixins/FormInput.js +0 -81
- package/core/mixins/Subscriber.d.ts +0 -36
- package/core/mixins/Subscriber.js +0 -333
- package/core/mixins/TemplatesContainer.d.ts +0 -13
- package/core/mixins/TemplatesContainer.js +0 -69
- package/core/mixins/mixins.js +0 -6
- package/core/utils/Arrays.d.ts +0 -97
- package/core/utils/Arrays.js +0 -140
- package/core/utils/DataBindObserver.d.ts +0 -83
- package/core/utils/DataBindObserver.js +0 -264
- package/core/utils/Electron.d.ts +0 -7
- package/core/utils/Electron.js +0 -11
- package/core/utils/Format.d.ts +0 -12
- package/core/utils/Format.js +0 -38
- package/core/utils/HTML.d.ts +0 -42
- package/core/utils/HTML.js +0 -119
- package/core/utils/LocationHandler.d.ts +0 -46
- package/core/utils/LocationHandler.js +0 -133
- package/core/utils/Objects.d.ts +0 -28
- package/core/utils/Objects.js +0 -102
- package/core/utils/PublisherProxy.d.ts +0 -176
- package/core/utils/PublisherProxy.js +0 -709
- package/core/utils/Utils.d.ts +0 -4
- package/core/utils/Utils.js +0 -12
- package/core/utils/api.d.ts +0 -139
- package/core/utils/api.js +0 -391
- package/core/utils/url-pattern.js +0 -2
- package/decorators.d.ts +0 -3
- package/directives.d.ts +0 -40
- package/img/concorde-logo.svg +0 -1
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +0 -181
- package/svg/regular/plane.svg +0 -1
- package/svg/solid/plane.svg +0 -1
- package/test-utils/TestUtils.d.ts +0 -4
- package/test-utils/TestUtils.js +0 -12
- package/utils.d.ts +0 -20
- /package/{core/components/functional/functional.d.ts → src/core/components/functional/functional.ts} +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.css +0 -0
- /package/{core → src/core}/components/ui/theme/css/tailwind.d.ts +0 -0
package/core/mixins/Fetcher.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import "@supersoniks/concorde/core/components/ui/button/button";
|
|
8
|
-
import { SonicToast } from "@supersoniks/concorde/core/components/ui/toast/toast";
|
|
9
|
-
import API from "@supersoniks/concorde/core/utils/api";
|
|
10
|
-
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
11
|
-
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
12
|
-
import { property } from "lit/decorators.js";
|
|
13
|
-
const fetchersInError = new Set();
|
|
14
|
-
export const invalidateFetchersInError = () => {
|
|
15
|
-
const fetchersInErrorCopy = new Set(fetchersInError);
|
|
16
|
-
fetchersInError.clear();
|
|
17
|
-
for (const fetcher of fetchersInErrorCopy) {
|
|
18
|
-
fetcher._fetchData();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const errorsListeners = new Set();
|
|
22
|
-
export const onFetchError = (errorListener) => {
|
|
23
|
-
errorsListeners.add(errorListener);
|
|
24
|
-
};
|
|
25
|
-
export const offFetchError = (errorListener) => {
|
|
26
|
-
errorsListeners.delete(errorListener);
|
|
27
|
-
};
|
|
28
|
-
const dispatchFetchError = (apiResponse) => {
|
|
29
|
-
for (const listener of errorsListeners) {
|
|
30
|
-
listener(apiResponse);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const Fetcher = (superClass, propsType) => {
|
|
34
|
-
propsType;
|
|
35
|
-
class FetcherElement extends superClass {
|
|
36
|
-
constructor(...args) {
|
|
37
|
-
super();
|
|
38
|
-
this.api = null;
|
|
39
|
-
/**
|
|
40
|
-
* Après le chargement des données on traverse l'objet reçu en fonctione de la cible exprimées dans cette propriété avec la dot syntaxe.
|
|
41
|
-
* C'est cette donnée cible qui est injectée dans les pros et donc disponible via le publisher disponible globalement via PublisherManager.get(dataProvider)
|
|
42
|
-
*/
|
|
43
|
-
this.key = "";
|
|
44
|
-
/**
|
|
45
|
-
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
46
|
-
*/
|
|
47
|
-
this.isFirstLoad = true;
|
|
48
|
-
/**
|
|
49
|
-
* isLoading vaut true pendant le chargement des données
|
|
50
|
-
*/
|
|
51
|
-
this.isLoading = false;
|
|
52
|
-
/**
|
|
53
|
-
* IObserver est l'intersection observer qui permet de charger les données au scroll si l'attribut lazyload est renseigné
|
|
54
|
-
*/
|
|
55
|
-
this.iObserver = null;
|
|
56
|
-
/**
|
|
57
|
-
* On peut désactiver le fetch programmatiquement via cette propriété.
|
|
58
|
-
* Cela est le cas pour le composant sonic-list qui ne fetch que si l'attribut fetch est renseigné
|
|
59
|
-
*/
|
|
60
|
-
this.isFetchEnabled = true;
|
|
61
|
-
/**
|
|
62
|
-
* Result of the fetch
|
|
63
|
-
*/
|
|
64
|
-
this.fetchedData = null;
|
|
65
|
-
this._endPoint = "";
|
|
66
|
-
this.requestId = 0;
|
|
67
|
-
this.refetchEveryMs = 0;
|
|
68
|
-
args;
|
|
69
|
-
this.dataProvider = "";
|
|
70
|
-
}
|
|
71
|
-
get props() {
|
|
72
|
-
return super.props;
|
|
73
|
-
}
|
|
74
|
-
set props(value) {
|
|
75
|
-
super.props = value;
|
|
76
|
-
}
|
|
77
|
-
set endPoint(value) {
|
|
78
|
-
this._endPoint = value;
|
|
79
|
-
if (this.isConnected)
|
|
80
|
-
this._fetchData();
|
|
81
|
-
}
|
|
82
|
-
get endPoint() {
|
|
83
|
-
return this._endPoint;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
* C'est ici que les données sont chargées via l'utilitaire API
|
|
88
|
-
* Elles sont ensuite injectées dans le publisher en accord avec la cible définie dans la propriété key
|
|
89
|
-
* Un Toast est affiché si le chargement échoue
|
|
90
|
-
*/
|
|
91
|
-
async _fetchData() {
|
|
92
|
-
this.requestUpdate();
|
|
93
|
-
if (!this.isFetchEnabled)
|
|
94
|
-
return;
|
|
95
|
-
this.api = new API(this.getApiConfiguration());
|
|
96
|
-
if (!this.api)
|
|
97
|
-
return;
|
|
98
|
-
// if (!this.dataProvider) return;
|
|
99
|
-
this.dispatchEvent(new CustomEvent("loading", { detail: this }));
|
|
100
|
-
if (this.getAttribute("localStorage") === "enabled") {
|
|
101
|
-
await PublisherManager.getInstance().isLocalStrorageReady;
|
|
102
|
-
}
|
|
103
|
-
if (!this.isConnected)
|
|
104
|
-
return;
|
|
105
|
-
const headerData = PublisherManager.getInstance().get(this.getAncestorAttributeValue("headersDataProvider")).get();
|
|
106
|
-
this.isLoading = true;
|
|
107
|
-
if (Objects.isObject(this.props) && Object.keys(this.props || {}).length > 0 && this.isFirstLoad) {
|
|
108
|
-
window.requestAnimationFrame(() => {
|
|
109
|
-
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
110
|
-
this.isFirstLoad = false;
|
|
111
|
-
this.isLoading = false;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
let data = await this.api.get(this.endPoint || this.dataProvider || "", headerData);
|
|
115
|
-
this.fetchedData = data;
|
|
116
|
-
if (this.api.lastResult && !this.api.lastResult.ok) {
|
|
117
|
-
fetchersInError.add(this);
|
|
118
|
-
dispatchFetchError(this.api.lastResult);
|
|
119
|
-
}
|
|
120
|
-
if (!this.isConnected) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (!data) {
|
|
124
|
-
// Cela n'arrive normalement que lorsque l'on quitte une page pendant un fetch on n'affiche donc pas de message
|
|
125
|
-
this.isLoading = false;
|
|
126
|
-
if (this.refetchEveryMs && this.isConnected) {
|
|
127
|
-
this.refetchTimeOutId = setTimeout(() => this._fetchData(), this.refetchEveryMs);
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
else if (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1) {
|
|
132
|
-
// Si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
|
|
133
|
-
SonicToast.add({ text: "Network Error", status: "error" });
|
|
134
|
-
}
|
|
135
|
-
if (this.key) {
|
|
136
|
-
const response = data._sonic_http_response_;
|
|
137
|
-
/* preserveOtherKeys s'exprime lorsque le paramètre "key" est défini
|
|
138
|
-
* Conserve les autres propriétés de l'objet reçu, en plus des propriétés définies sous "key"
|
|
139
|
-
*/
|
|
140
|
-
const path = this.key.split(".");
|
|
141
|
-
data = Objects.traverse(data, path, this.hasAttribute("preserveOtherKeys"));
|
|
142
|
-
if (data && Objects.isObject(data) && response)
|
|
143
|
-
data._sonic_http_response_ = response;
|
|
144
|
-
}
|
|
145
|
-
this.props = data;
|
|
146
|
-
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
147
|
-
this.isFirstLoad = false;
|
|
148
|
-
this.isLoading = false;
|
|
149
|
-
if (this.refetchEveryMs && this.isConnected) {
|
|
150
|
-
this.refetchTimeOutId = setTimeout(() => this._fetchData(), this.refetchEveryMs);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
disconnectedCallback() {
|
|
154
|
-
super.disconnectedCallback();
|
|
155
|
-
this.publisher?.offInvalidate(this.onInvalidate);
|
|
156
|
-
clearTimeout(this.refetchTimeOutId);
|
|
157
|
-
this.isFirstLoad = false;
|
|
158
|
-
}
|
|
159
|
-
connectedCallback() {
|
|
160
|
-
// this.noShadowDom = "";
|
|
161
|
-
this.lazyLoad = this.lazyLoad !== undefined ? this.lazyLoad : this.hasAttribute("lazyload");
|
|
162
|
-
super.connectedCallback();
|
|
163
|
-
if (!this.isFetchEnabled) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
this.key = this.key != "" ? this.key : this.getAttribute("key");
|
|
167
|
-
if (this.props) {
|
|
168
|
-
this.publisher.set(this.props);
|
|
169
|
-
}
|
|
170
|
-
this.onInvalidate = () => this._fetchData();
|
|
171
|
-
this.publisher?.onInvalidate(this.onInvalidate);
|
|
172
|
-
if (!this.lazyLoad) {
|
|
173
|
-
this._fetchData();
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
this.handleLazyLoad();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
handleLazyLoad() {
|
|
180
|
-
if (!this.lazyLoad) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const rect = this.getBoundingClientRect();
|
|
184
|
-
if (rect.x < window.innerWidth && rect.right > 0 && rect.y < window.innerHeight && rect.right > 0) {
|
|
185
|
-
this._fetchData();
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const boundsRatio = parseFloat(this.getAttribute("lazyBoundsRatio") || "1");
|
|
189
|
-
const options = {
|
|
190
|
-
root: null,
|
|
191
|
-
rootMargin: Math.max(window.innerWidth * boundsRatio, window.innerHeight * boundsRatio) + "px",
|
|
192
|
-
threshold: 0.9,
|
|
193
|
-
};
|
|
194
|
-
this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
|
|
195
|
-
let elt = (this.shadowRoot ? this.shadowRoot.children[0] : this.children[0]);
|
|
196
|
-
if (elt?.nodeName.toLocaleLowerCase() == "slot")
|
|
197
|
-
elt = elt.children[0];
|
|
198
|
-
if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
|
|
199
|
-
elt = document.createElement("span");
|
|
200
|
-
const style = elt.style;
|
|
201
|
-
/**
|
|
202
|
-
* !!! Pas de position absolute ici si on veut que le composant soit au bon endroit dans la page pour l'intersection observer
|
|
203
|
-
* En effest sinon il vpeut remonter en congugaison avec le style display="contents"
|
|
204
|
-
*/
|
|
205
|
-
style.pointerEvents = "none";
|
|
206
|
-
this.lazyLoadSpan = elt;
|
|
207
|
-
this.appendChild(elt);
|
|
208
|
-
}
|
|
209
|
-
if (elt) {
|
|
210
|
-
this.iObserver.observe(elt);
|
|
211
|
-
}
|
|
212
|
-
else if (this.isFirstLoad) {
|
|
213
|
-
this._fetchData();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
onIntersection(entries) {
|
|
217
|
-
for (const e of entries) {
|
|
218
|
-
if (e.isIntersecting && this.isFirstLoad) {
|
|
219
|
-
this._fetchData();
|
|
220
|
-
this.lazyLoadSpan?.remove();
|
|
221
|
-
this.lazyLoadSpan = undefined;
|
|
222
|
-
this.iObserver?.disconnect();
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
__decorate([
|
|
229
|
-
property()
|
|
230
|
-
], FetcherElement.prototype, "props", null);
|
|
231
|
-
__decorate([
|
|
232
|
-
property({ type: String })
|
|
233
|
-
], FetcherElement.prototype, "endPoint", null);
|
|
234
|
-
__decorate([
|
|
235
|
-
property()
|
|
236
|
-
], FetcherElement.prototype, "requestId", void 0);
|
|
237
|
-
__decorate([
|
|
238
|
-
property({ type: Number })
|
|
239
|
-
], FetcherElement.prototype, "refetchEveryMs", void 0);
|
|
240
|
-
return FetcherElement; //as Constructor<SubscriberInterface> & T;
|
|
241
|
-
};
|
|
242
|
-
export default Fetcher;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { FormElementInterface } from "@supersoniks/concorde/core/mixins/FormElement";
|
|
2
|
-
import { MixinArgsType } from "../_types/types";
|
|
3
|
-
type Constructor<T> = new (...args: MixinArgsType[]) => T;
|
|
4
|
-
declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T) => {
|
|
5
|
-
new (...args: MixinArgsType[]): {
|
|
6
|
-
/**
|
|
7
|
-
* Voir la mixin FormElement.
|
|
8
|
-
*/
|
|
9
|
-
_value: string | null;
|
|
10
|
-
value: string | null;
|
|
11
|
-
forceAutoFill: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* comme radio,mais peut être désélectionné après sélection
|
|
14
|
-
*/
|
|
15
|
-
unique: true | null;
|
|
16
|
-
/**
|
|
17
|
-
Active le mode radio
|
|
18
|
-
*/
|
|
19
|
-
radio: true | null;
|
|
20
|
-
unCheckOnDisconnect: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* propriété checked avec des caractéristiques similaire à un input html classique.
|
|
23
|
-
*/
|
|
24
|
-
_checked: true | null | "indeterminate";
|
|
25
|
-
checked: true | "indeterminate" | null;
|
|
26
|
-
validateFormElement(): void;
|
|
27
|
-
checksAll(): boolean;
|
|
28
|
-
setCheckedValue(checked: true | null | "indeterminate"): void;
|
|
29
|
-
handleChange(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Voir la mixin FormElement
|
|
32
|
-
* Le comportement est ici modifié fonction de son mode (checkbox, radio, unique)
|
|
33
|
-
*/
|
|
34
|
-
getValueForFormPublisher(): any;
|
|
35
|
-
/**
|
|
36
|
-
* Voir la mixin FormElement
|
|
37
|
-
* Le comportement est modifié de la manière suivante :
|
|
38
|
-
* L'état du composant (checked) est mis à jour en fonction de la valeur fournie par le publisher associé au composant / en fonction de sont mode (radio, unique)
|
|
39
|
-
*/
|
|
40
|
-
setFormValueFromPublisher(value: string | Array<string | null> | null): void;
|
|
41
|
-
getCheckAllPublisher(): any;
|
|
42
|
-
updateAllChecked: () => void;
|
|
43
|
-
onChecksAllRequest: (value: string) => void;
|
|
44
|
-
disconnectedCallback(): void;
|
|
45
|
-
connectedCallback(): void;
|
|
46
|
-
getFormPublisher(): any;
|
|
47
|
-
updateDataValue(): void;
|
|
48
|
-
handleBlur(e?: Event | undefined): void;
|
|
49
|
-
setValueFromPublisher(value: string | object | string[] | null | undefined): void;
|
|
50
|
-
focus?: (() => void) | undefined;
|
|
51
|
-
shadowRoot?: ShadowRoot | undefined;
|
|
52
|
-
error: boolean;
|
|
53
|
-
autofocus: boolean;
|
|
54
|
-
required: boolean;
|
|
55
|
-
disabled: true | null;
|
|
56
|
-
formDataProvider: string;
|
|
57
|
-
ariaLabelledby?: string | undefined;
|
|
58
|
-
ariaLabel?: string | undefined;
|
|
59
|
-
_name: string;
|
|
60
|
-
name: string;
|
|
61
|
-
props: import("../_types/types").CoreJSType;
|
|
62
|
-
propertyMap: object;
|
|
63
|
-
isConnected: boolean;
|
|
64
|
-
children: HTMLCollection;
|
|
65
|
-
appendChild(node: Node): Node;
|
|
66
|
-
getAncestorAttributeValue(attributeName: string): string;
|
|
67
|
-
hasAncestorAttribute(attributeName: string): boolean;
|
|
68
|
-
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
69
|
-
publisher: any;
|
|
70
|
-
dataProvider: string | null;
|
|
71
|
-
noShadowDom: string | null;
|
|
72
|
-
debug: HTMLElement | null;
|
|
73
|
-
defferedDebug: boolean | null;
|
|
74
|
-
displayContents: boolean;
|
|
75
|
-
dispatchEvent(event: Event): void;
|
|
76
|
-
setAttribute(name: string, value: string): void;
|
|
77
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
78
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
79
|
-
removeAttribute(name: string): void;
|
|
80
|
-
initPublisher(): void;
|
|
81
|
-
getApiConfiguration(): import("../utils/api").APIConfiguration;
|
|
82
|
-
requestUpdate(): void;
|
|
83
|
-
getAttribute(name: string): string;
|
|
84
|
-
hasAttribute(attributeName: string): boolean;
|
|
85
|
-
getBoundingClientRect(): DOMRect;
|
|
86
|
-
};
|
|
87
|
-
} & T;
|
|
88
|
-
export default Form;
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { property } from "lit/decorators.js";
|
|
8
|
-
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
9
|
-
const Form = (superClass) => {
|
|
10
|
-
/**
|
|
11
|
-
* FormCheckable ajoute un comportement de sélection (checked) a tout FormElement qui utilise cette mixin.
|
|
12
|
-
* Il est notamment utilisé par sonic-checkbox, sonic-radio et sonic-button
|
|
13
|
-
* * Par défaut le fonctionnement est celui d'une checkbox classique.
|
|
14
|
-
* * Dans ce cas, a la sélection, formPublisher[this.name] = [this.value, ...autres valeurs d'élémen,ts sélectionnés ayant le même nom];
|
|
15
|
-
* * En activant le mode radio à l'aide du flag dédié, un seul FormElement ayant la même propriété name peut être sélectionné à la fois.
|
|
16
|
-
* * Dans ce cas, a la sélection, formPublisher[this.name] = this.value;
|
|
17
|
-
*/
|
|
18
|
-
class FormCheckable extends superClass {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
/**
|
|
22
|
-
* Voir la mixin FormElement.
|
|
23
|
-
*/
|
|
24
|
-
this._value = "";
|
|
25
|
-
this.forceAutoFill = false;
|
|
26
|
-
/**
|
|
27
|
-
* comme radio,mais peut être désélectionné après sélection
|
|
28
|
-
*/
|
|
29
|
-
this.unique = null;
|
|
30
|
-
/**
|
|
31
|
-
Active le mode radio
|
|
32
|
-
*/
|
|
33
|
-
this.radio = null;
|
|
34
|
-
this.unCheckOnDisconnect = false;
|
|
35
|
-
/**
|
|
36
|
-
* propriété checked avec des caractéristiques similaire à un input html classique.
|
|
37
|
-
*/
|
|
38
|
-
this._checked = null;
|
|
39
|
-
this.updateAllChecked = () => {
|
|
40
|
-
const name = this.getAttribute("name");
|
|
41
|
-
const checkAllPublisher = this.getCheckAllPublisher();
|
|
42
|
-
const formPublisher = this.getFormPublisher();
|
|
43
|
-
if (!checkAllPublisher?.hasCheckAll.get()) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!this.checksAll() && checkAllPublisher && formPublisher && name) {
|
|
47
|
-
if (!formPublisher[this.name].get().length) {
|
|
48
|
-
checkAllPublisher.checkMode = "noneChecked";
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
else if (this.checked === null) {
|
|
52
|
-
checkAllPublisher.checkMode = "someUnchecked";
|
|
53
|
-
}
|
|
54
|
-
else if (checkAllPublisher.checkMode.get() == "noneChecked" || checkAllPublisher.checkMode.get() == null) {
|
|
55
|
-
checkAllPublisher.checkMode = "someUnchecked";
|
|
56
|
-
}
|
|
57
|
-
const currentValues = formPublisher[name].get();
|
|
58
|
-
const allValues = checkAllPublisher.values.get();
|
|
59
|
-
if (allValues && allValues.length) {
|
|
60
|
-
let checkedCount = allValues.length;
|
|
61
|
-
for (const p of allValues) {
|
|
62
|
-
if (currentValues.indexOf(p) == -1) {
|
|
63
|
-
checkedCount -= 1;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (checkedCount == allValues.length) {
|
|
67
|
-
checkAllPublisher.checkMode = "allChecked";
|
|
68
|
-
}
|
|
69
|
-
if (checkedCount == 0) {
|
|
70
|
-
checkAllPublisher.checkMode = "noneChecked";
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (allValues.indexOf(this.value) == -1) {
|
|
74
|
-
this.checked = null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
this.onChecksAllRequest = (value) => {
|
|
79
|
-
this.removeAttribute("allChecked");
|
|
80
|
-
this.removeAttribute("indeterminate");
|
|
81
|
-
if (value == "allChecked") {
|
|
82
|
-
this.checked = true;
|
|
83
|
-
this.setAttribute("allChecked", "");
|
|
84
|
-
}
|
|
85
|
-
if (value == "noneChecked") {
|
|
86
|
-
this.checked = null;
|
|
87
|
-
}
|
|
88
|
-
if (value == "someUnchecked") {
|
|
89
|
-
if (this.checksAll())
|
|
90
|
-
this.checked = "indeterminate";
|
|
91
|
-
this.setAttribute("indeterminate", "");
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
get value() {
|
|
96
|
-
return this._value;
|
|
97
|
-
}
|
|
98
|
-
set value(newValue) {
|
|
99
|
-
if (this.value == newValue)
|
|
100
|
-
return;
|
|
101
|
-
if (this.hasAttribute("value") && !this.forceAutoFill)
|
|
102
|
-
newValue = this.getAttribute("value");
|
|
103
|
-
if (this._value == newValue)
|
|
104
|
-
return;
|
|
105
|
-
if (newValue == null)
|
|
106
|
-
return;
|
|
107
|
-
this._value = newValue;
|
|
108
|
-
if (!this.value)
|
|
109
|
-
return;
|
|
110
|
-
// On check l'élément si il est cheched dans le formPublisher
|
|
111
|
-
const formPublisher = this.getFormPublisher();
|
|
112
|
-
if (formPublisher && this.name) {
|
|
113
|
-
let currentValue = formPublisher[this.name].get();
|
|
114
|
-
if (this.radio || this.unique) {
|
|
115
|
-
this.checked = currentValue == newValue ? true : null;
|
|
116
|
-
}
|
|
117
|
-
if (!Array.isArray(currentValue)) {
|
|
118
|
-
currentValue = [];
|
|
119
|
-
}
|
|
120
|
-
if (currentValue.indexOf(newValue) != -1)
|
|
121
|
-
this.checked = true;
|
|
122
|
-
}
|
|
123
|
-
//On mets à jour la valeur dans la donnée si l'élément est checked
|
|
124
|
-
if (this.checked == true)
|
|
125
|
-
this.updateDataValue();
|
|
126
|
-
this.requestUpdate();
|
|
127
|
-
}
|
|
128
|
-
get checked() {
|
|
129
|
-
return this._checked;
|
|
130
|
-
}
|
|
131
|
-
set checked(checked) {
|
|
132
|
-
this.setCheckedValue(checked);
|
|
133
|
-
if (this.checksAll()) {
|
|
134
|
-
const checkAllPublisher = this.getCheckAllPublisher();
|
|
135
|
-
if (checkAllPublisher) {
|
|
136
|
-
if (this.checked === true)
|
|
137
|
-
checkAllPublisher.checkMode = "allChecked";
|
|
138
|
-
else if (this.checked === null) {
|
|
139
|
-
checkAllPublisher.checkMode = "noneChecked";
|
|
140
|
-
const formPublisher = this.getFormPublisher();
|
|
141
|
-
if (formPublisher) {
|
|
142
|
-
formPublisher[this.name] = [];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
this.requestUpdate();
|
|
148
|
-
}
|
|
149
|
-
validateFormElement() {
|
|
150
|
-
const input = this.shadowRoot?.querySelector("input");
|
|
151
|
-
if (!input || input.checkValidity())
|
|
152
|
-
return;
|
|
153
|
-
const formPublisher = this.getFormPublisher();
|
|
154
|
-
if (formPublisher) {
|
|
155
|
-
const value = formPublisher[this.name].get();
|
|
156
|
-
if ((this.unique || this.radio) && value !== null && value.toString().length > 0)
|
|
157
|
-
return;
|
|
158
|
-
formPublisher.isFormValid = false;
|
|
159
|
-
input.reportValidity();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
checksAll() {
|
|
163
|
-
return this.hasAttribute("checksAll");
|
|
164
|
-
}
|
|
165
|
-
setCheckedValue(checked) {
|
|
166
|
-
if (this._checked == checked)
|
|
167
|
-
return;
|
|
168
|
-
this._checked = checked;
|
|
169
|
-
this.updateDataValue();
|
|
170
|
-
this.requestUpdate();
|
|
171
|
-
setTimeout(() => this.updateAllChecked(), 1);
|
|
172
|
-
// Désactivation du checked sur le publisher
|
|
173
|
-
// Pas sur de l'utilité mais provoque un bug
|
|
174
|
-
// if (this.publisher && !this.radio && !this.unique) {
|
|
175
|
-
// this.publisher.checked = this._checked;
|
|
176
|
-
// }
|
|
177
|
-
}
|
|
178
|
-
handleChange() {
|
|
179
|
-
const newCheckedValue = this.checked === true ? (!this.radio ? null : true) : true;
|
|
180
|
-
this.checked = newCheckedValue;
|
|
181
|
-
const event = new Event("change");
|
|
182
|
-
this.dispatchEvent(event);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Voir la mixin FormElement
|
|
186
|
-
* Le comportement est ici modifié fonction de son mode (checkbox, radio, unique)
|
|
187
|
-
*/
|
|
188
|
-
getValueForFormPublisher() {
|
|
189
|
-
const formPublisher = this.getFormPublisher();
|
|
190
|
-
if (!formPublisher)
|
|
191
|
-
return null;
|
|
192
|
-
let currentValue = formPublisher[this.name].get();
|
|
193
|
-
if (this.radio) {
|
|
194
|
-
return this.checked === true && this.value != null ? this.value : currentValue;
|
|
195
|
-
}
|
|
196
|
-
if (this.unique) {
|
|
197
|
-
return this.checked === true && this.value != null ? this.value : null;
|
|
198
|
-
}
|
|
199
|
-
if (!Array.isArray(currentValue)) {
|
|
200
|
-
currentValue = [];
|
|
201
|
-
}
|
|
202
|
-
currentValue = currentValue.slice(0);
|
|
203
|
-
const idx = currentValue.indexOf(this.value);
|
|
204
|
-
if (this.checked === true && idx === -1 && !this.checksAll())
|
|
205
|
-
currentValue.push(this.value);
|
|
206
|
-
if (this.checked === null && idx !== -1) {
|
|
207
|
-
currentValue.splice(idx, 1);
|
|
208
|
-
}
|
|
209
|
-
return currentValue;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Voir la mixin FormElement
|
|
213
|
-
* Le comportement est modifié de la manière suivante :
|
|
214
|
-
* L'état du composant (checked) est mis à jour en fonction de la valeur fournie par le publisher associé au composant / en fonction de sont mode (radio, unique)
|
|
215
|
-
*/
|
|
216
|
-
setFormValueFromPublisher(value) {
|
|
217
|
-
if (this.unique || this.radio) {
|
|
218
|
-
this.checked = this.value == value ? true : null;
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
if (!Array.isArray(value))
|
|
222
|
-
value = [];
|
|
223
|
-
if (this.checksAll()) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
this.checked = value.indexOf(this.value) !== -1 ? true : null;
|
|
227
|
-
}
|
|
228
|
-
getCheckAllPublisher() {
|
|
229
|
-
if (!this.formDataProvider)
|
|
230
|
-
this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
231
|
-
const formDataProvider = this.formDataProvider;
|
|
232
|
-
const name = this.getAttribute("name");
|
|
233
|
-
if (!formDataProvider || !name) {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
return PublisherManager.get(formDataProvider + "/" + name + "/_available_values_");
|
|
237
|
-
}
|
|
238
|
-
disconnectedCallback() {
|
|
239
|
-
super.disconnectedCallback();
|
|
240
|
-
const checkAllPublisher = this.getCheckAllPublisher();
|
|
241
|
-
if (checkAllPublisher) {
|
|
242
|
-
checkAllPublisher.checkMode.offAssign(this.onChecksAllRequest);
|
|
243
|
-
if (!this.checksAll()) {
|
|
244
|
-
const values = checkAllPublisher.values.get().slice(0);
|
|
245
|
-
const idx = values.indexOf(this.value);
|
|
246
|
-
if (idx != -1) {
|
|
247
|
-
values.splice(idx, 1);
|
|
248
|
-
checkAllPublisher.values = values;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
setTimeout(() => this.updateAllChecked(), 1);
|
|
253
|
-
}
|
|
254
|
-
connectedCallback() {
|
|
255
|
-
super.connectedCallback();
|
|
256
|
-
const formPublisher = this.getFormPublisher();
|
|
257
|
-
if (formPublisher && this.name) {
|
|
258
|
-
const publisherValueForName = formPublisher[this.name].get();
|
|
259
|
-
if (publisherValueForName &&
|
|
260
|
-
Array.isArray(publisherValueForName) &&
|
|
261
|
-
publisherValueForName.indexOf(this.value) !== -1) {
|
|
262
|
-
this.checked = true;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const checkAllPublisher = this.getCheckAllPublisher();
|
|
266
|
-
if (checkAllPublisher) {
|
|
267
|
-
checkAllPublisher.checkMode.onAssign(this.onChecksAllRequest);
|
|
268
|
-
if (this.checksAll()) {
|
|
269
|
-
checkAllPublisher.hasCheckAll = true;
|
|
270
|
-
}
|
|
271
|
-
if (!checkAllPublisher.values.get()) {
|
|
272
|
-
checkAllPublisher.values = [];
|
|
273
|
-
}
|
|
274
|
-
if (!this.checksAll()) {
|
|
275
|
-
checkAllPublisher.values = [...checkAllPublisher.values.get(), this.value];
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (!this.hasAttribute("checked")) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
if (!this.publisher || this.publisher.get().checked !== false) {
|
|
282
|
-
setTimeout(() => (this.checked = true), 1);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
__decorate([
|
|
287
|
-
property()
|
|
288
|
-
], FormCheckable.prototype, "value", null);
|
|
289
|
-
__decorate([
|
|
290
|
-
property()
|
|
291
|
-
], FormCheckable.prototype, "forceAutoFill", void 0);
|
|
292
|
-
__decorate([
|
|
293
|
-
property({ type: Boolean })
|
|
294
|
-
], FormCheckable.prototype, "unique", void 0);
|
|
295
|
-
__decorate([
|
|
296
|
-
property({ type: Boolean })
|
|
297
|
-
], FormCheckable.prototype, "radio", void 0);
|
|
298
|
-
__decorate([
|
|
299
|
-
property({ type: Boolean })
|
|
300
|
-
], FormCheckable.prototype, "unCheckOnDisconnect", void 0);
|
|
301
|
-
__decorate([
|
|
302
|
-
property()
|
|
303
|
-
], FormCheckable.prototype, "checked", null);
|
|
304
|
-
return FormCheckable;
|
|
305
|
-
};
|
|
306
|
-
export default Form;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { SubscriberInterface } from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
2
|
-
import { PublisherInterface, CoreJSType } from "../_types/types";
|
|
3
|
-
import { MixinArgsType } from "../_types/types";
|
|
4
|
-
type Constructor<T> = new (...args: MixinArgsType[]) => T;
|
|
5
|
-
type FormElementValue = string | string[] | object | null | undefined;
|
|
6
|
-
export interface FormElementInterface extends SubscriberInterface {
|
|
7
|
-
getFormPublisher(): PublisherInterface;
|
|
8
|
-
updateDataValue(): void;
|
|
9
|
-
handleChange(e?: Event): void;
|
|
10
|
-
handleBlur(e?: Event): void;
|
|
11
|
-
getValueForFormPublisher(): FormElementValue;
|
|
12
|
-
setValueFromPublisher(value: FormElementValue): void;
|
|
13
|
-
validateFormElement(): void;
|
|
14
|
-
focus?: () => void;
|
|
15
|
-
forceAutoFill: boolean;
|
|
16
|
-
shadowRoot?: ShadowRoot;
|
|
17
|
-
error: boolean;
|
|
18
|
-
autofocus: boolean;
|
|
19
|
-
required: boolean;
|
|
20
|
-
disabled: true | null;
|
|
21
|
-
formDataProvider: string;
|
|
22
|
-
ariaLabelledby?: string;
|
|
23
|
-
ariaLabel?: string;
|
|
24
|
-
_value: FormElementValue;
|
|
25
|
-
get value(): FormElementValue;
|
|
26
|
-
set value(value: FormElementValue);
|
|
27
|
-
_name: string;
|
|
28
|
-
get name(): string;
|
|
29
|
-
set name(value: string);
|
|
30
|
-
}
|
|
31
|
-
declare const Form: <T extends Constructor<SubscriberInterface<CoreJSType>>>(superClass: T) => Constructor<FormElementInterface> & T;
|
|
32
|
-
export default Form;
|