create-basicjs 0.1.4 → 0.1.5
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/README.md +2 -2
- package/bin/create-basicjs.js +31 -4
- package/bin/verify-package.js +1 -1
- package/package.json +2 -2
- package/payload/starter/AGENTS.md +11 -6
- package/payload/starter/README.md +1 -1
- package/payload/starter/_basic/VERSION +1 -1
- package/payload/starter/_basic/assets/cards/almond-blossom.png +0 -0
- package/payload/starter/_basic/assets/cards/blackberry.png +0 -0
- package/payload/starter/_basic/assets/cards/borage.png +0 -0
- package/payload/starter/_basic/assets/cards/chamomile.png +0 -0
- package/payload/starter/_basic/assets/cards/dill.png +0 -0
- package/payload/starter/_basic/assets/cards/eucalyptus.png +0 -0
- package/payload/starter/_basic/assets/cards/fennel.png +0 -0
- package/payload/starter/_basic/assets/cards/fig.png +0 -0
- package/payload/starter/_basic/assets/cards/juniper.png +0 -0
- package/payload/starter/_basic/assets/cards/lavender.png +0 -0
- package/payload/starter/_basic/assets/cards/lemon.png +0 -0
- package/payload/starter/_basic/assets/cards/olives.png +0 -0
- package/payload/starter/_basic/assets/cards/oregano.png +0 -0
- package/payload/starter/_basic/assets/cards/pepper.png +0 -0
- package/payload/starter/_basic/assets/cards/physalis.png +0 -0
- package/payload/starter/_basic/assets/cards/pomegranate.png +0 -0
- package/payload/starter/_basic/assets/cards/poppy.png +0 -0
- package/payload/starter/_basic/assets/cards/rosehip.png +0 -0
- package/payload/starter/_basic/assets/cards/saffron.png +0 -0
- package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
- package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
- package/payload/starter/_basic/assets/categories/coffee.png +0 -0
- package/payload/starter/_basic/assets/categories/frappe.png +0 -0
- package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
- package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
- package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
- package/payload/starter/_basic/assets/categories/tea.png +0 -0
- package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
- package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
- package/payload/starter/_basic/assets/fruids/domates.png +0 -0
- package/payload/starter/_basic/assets/fruids/elma.png +0 -0
- package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
- package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
- package/payload/starter/_basic/assets/fruids/limon.png +0 -0
- package/payload/starter/_basic/assets/fruids/muz.png +0 -0
- package/payload/starter/_basic/assets/fruids/nar.png +0 -0
- package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
- package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
- package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
- package/payload/starter/_basic/basic/LICENSE +1 -1
- package/payload/starter/_basic/basic/basic.css +3 -6
- package/payload/starter/_basic/basic/basic.js +154 -60
- package/payload/starter/_basic/basic/basic.min.js +19 -6
- package/payload/starter/_basic/basic/scroll-bar.js +4 -2
- package/payload/starter/_basic/basic/scroll-bar.min.js +1 -0
- package/payload/starter/_basic/comp/accordion.js +659 -0
- package/payload/starter/_basic/comp/action-button.js +22 -23
- package/payload/starter/_basic/comp/action-tab-bar.js +8 -8
- package/payload/starter/_basic/comp/app-bar.js +12 -11
- package/payload/starter/_basic/comp/{badge-v2.js → badge.js} +51 -5
- package/payload/starter/_basic/comp/bottom-bar.js +31 -23
- package/payload/starter/_basic/comp/breadcrumbs.js +4 -2
- package/payload/starter/_basic/comp/canvas.js +652 -0
- package/payload/starter/_basic/comp/chat-view.js +827 -0
- package/payload/starter/_basic/comp/check-box.js +137 -21
- package/payload/starter/_basic/comp/code-editor.js +953 -0
- package/payload/starter/_basic/comp/{select-color.js → color-picker.js} +62 -29
- package/payload/starter/_basic/comp/context-menu.js +342 -30
- package/payload/starter/_basic/comp/{currency-input-b.js → currency-field.js} +48 -29
- package/payload/starter/_basic/comp/data-table.js +114 -42
- package/payload/starter/_basic/comp/{select-date.js → date-picker.js} +104 -52
- package/payload/starter/_basic/comp/dialog.js +214 -76
- package/payload/starter/_basic/comp/email-field.js +65 -0
- package/payload/starter/_basic/comp/{select-file.js → file-picker.js} +245 -57
- package/payload/starter/_basic/comp/filters.js +374 -60
- package/payload/starter/_basic/comp/form.js +38 -26
- package/payload/starter/_basic/comp/full-screen-select.js +36 -33
- package/payload/starter/_basic/comp/gauge.js +12 -8
- package/payload/starter/_basic/comp/graph-box.js +3911 -0
- package/payload/starter/_basic/comp/grid-group.js +185 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button.js +16 -7
- package/payload/starter/_basic/comp/image-view.js +598 -0
- package/payload/starter/_basic/comp/item-list.js +507 -163
- package/payload/starter/_basic/comp/json-editor.js +3221 -0
- package/payload/starter/_basic/comp/json-view.js +597 -0
- package/payload/starter/_basic/comp/label-editor.js +22 -19
- package/payload/starter/_basic/comp/left-menu.js +89 -22
- package/payload/starter/_basic/comp/line-progress-bar.js +196 -45
- package/payload/starter/_basic/comp/loading-screen.js +49 -18
- package/payload/starter/_basic/comp/log-view.js +530 -0
- package/payload/starter/_basic/comp/{login-page-v2.js → login-page.js} +205 -106
- package/payload/starter/_basic/comp/markdown-view.js +1044 -0
- package/payload/starter/_basic/comp/menu-bar.js +624 -0
- package/payload/starter/_basic/comp/mini-graph-box.js +20 -11
- package/payload/starter/_basic/comp/minimal-accent.js +208 -0
- package/payload/starter/_basic/comp/notice.js +15 -13
- package/payload/starter/_basic/comp/{number-input-b.js → number-field.js} +26 -19
- package/payload/starter/_basic/comp/numeric-keyboard.js +15 -13
- package/payload/starter/_basic/comp/page-control.js +21 -4
- package/payload/starter/_basic/comp/page-header.js +7 -6
- package/payload/starter/_basic/comp/password-field.js +192 -0
- package/payload/starter/_basic/comp/period-bar.js +8 -7
- package/payload/starter/_basic/comp/{phone-input-b.js → phone-field.js} +80 -45
- package/payload/starter/_basic/comp/progress-bar.js +401 -85
- package/payload/starter/_basic/comp/property-panel.js +1022 -123
- package/payload/starter/_basic/comp/radio-button.js +79 -19
- package/payload/starter/_basic/comp/range-slider.js +569 -0
- package/payload/starter/_basic/comp/rich-text-editor.js +33 -30
- package/payload/starter/_basic/comp/scroll-area.js +308 -0
- package/payload/starter/_basic/comp/scrolling-text.js +10 -9
- package/payload/starter/_basic/comp/search-input.js +725 -0
- package/payload/starter/_basic/comp/search-results.js +60 -24
- package/payload/starter/_basic/comp/select-box.js +229 -107
- package/payload/starter/_basic/comp/settings-row.js +20 -19
- package/payload/starter/_basic/comp/side-panel.js +53 -10
- package/payload/starter/_basic/comp/slider-field.js +264 -88
- package/payload/starter/_basic/comp/slider.js +541 -86
- package/payload/starter/_basic/comp/smart-button.js +433 -352
- package/payload/starter/_basic/comp/smart-table.js +740 -185
- package/payload/starter/_basic/comp/sortable-list.js +47 -38
- package/payload/starter/_basic/comp/spark-line-box.js +25 -16
- package/payload/starter/_basic/comp/splitter.js +411 -0
- package/payload/starter/_basic/comp/status-bar.js +408 -0
- package/payload/starter/_basic/comp/step-bar.js +345 -0
- package/payload/starter/_basic/comp/stepper.js +77 -49
- package/payload/starter/_basic/comp/tabs.js +67 -18
- package/payload/starter/_basic/comp/tag-input.js +50 -10
- package/payload/starter/_basic/comp/tap-effect.js +6 -4
- package/payload/starter/_basic/comp/text-area-field.js +233 -0
- package/payload/starter/_basic/comp/text-field.js +1006 -0
- package/payload/starter/_basic/comp/time-line.js +102 -28
- package/payload/starter/_basic/comp/{select-time.js → time-picker.js} +104 -51
- package/payload/starter/_basic/comp/tiny-select.js +79 -39
- package/payload/starter/_basic/comp/tiny-table.js +12 -8
- package/payload/starter/_basic/comp/toast.js +87 -34
- package/payload/starter/_basic/comp/toggle.js +147 -27
- package/payload/starter/_basic/comp/tool-bar.js +760 -0
- package/payload/starter/_basic/comp/tooltip.js +80 -17
- package/payload/starter/_basic/comp/tree-view.js +124 -41
- package/payload/starter/_basic/comp/ui-effects.js +17 -11
- package/payload/starter/_basic/comp/ui-standards.js +5 -4
- package/payload/starter/_basic/comp/url-field.js +190 -0
- package/payload/starter/_basic/comp/web-view.js +70 -16
- package/payload/starter/_basic/docs/basic-js-animated-rules.md +15 -9
- package/payload/starter/_basic/docs/basic-js-code-rules.md +42 -5
- package/payload/starter/_basic/docs/basic-js-components.md +12 -17
- package/payload/starter/_basic/docs/basic-js-core.md +5 -4
- package/payload/starter/_basic/docs/component-index.md +245 -104
- package/payload/starter/_basic/docs/component-template.js +28 -24
- package/payload/starter/_basic/docs/handbook/00-introduction.md +6 -2
- package/payload/starter/_basic/docs/handbook/00-what-is-new.md +21 -0
- package/payload/starter/_basic/docs/handbook/01-label.md +4 -4
- package/payload/starter/_basic/docs/handbook/02-box.md +7 -7
- package/payload/starter/_basic/docs/handbook/03-image.md +4 -4
- package/payload/starter/_basic/docs/handbook/04-common-properties.md +6 -5
- package/payload/starter/_basic/docs/handbook/05-autolayout.md +8 -7
- package/payload/starter/_basic/docs/handbook/06-button.md +3 -3
- package/payload/starter/_basic/docs/handbook/07-input.md +3 -3
- package/payload/starter/_basic/docs/handbook/08-page.md +3 -3
- package/payload/starter/_basic/docs/handbook/09-useful-examples.md +39 -58
- package/payload/starter/_basic/docs/handbook/10-motion.md +6 -6
- package/payload/starter/_basic/docs/handbook/11-other-functions.md +1 -0
- package/payload/starter/_basic/docs/handbook/13-sound.md +3 -3
- package/payload/starter/_basic/docs/handbook/14-using-components.md +180 -0
- package/payload/starter/_basic/docs/handbook/15-making-a-component.md +338 -0
- package/payload/starter/_basic/docs/what-is-new.md +106 -0
- package/payload/starter/_basic/examples/accordion.htm +174 -0
- package/payload/starter/_basic/examples/action-button.htm +74 -32
- package/payload/starter/_basic/examples/action-tab-bar.htm +5 -6
- package/payload/starter/_basic/examples/app-bar.htm +63 -41
- package/payload/starter/_basic/examples/badge.htm +96 -0
- package/payload/starter/_basic/examples/bottom-bar-2.htm +61 -48
- package/payload/starter/_basic/examples/bottom-bar.htm +74 -16
- package/payload/starter/_basic/examples/breadcrumbs.htm +160 -150
- package/payload/starter/_basic/examples/canvas.htm +190 -0
- package/payload/starter/_basic/examples/chat-view.htm +143 -0
- package/payload/starter/_basic/examples/check-box-2.htm +71 -82
- package/payload/starter/_basic/examples/check-box-3.htm +72 -83
- package/payload/starter/_basic/examples/check-box.htm +207 -0
- package/payload/starter/_basic/examples/code-editor-2.htm +259 -0
- package/payload/starter/_basic/examples/code-editor.htm +225 -0
- package/payload/starter/_basic/examples/color-picker.htm +206 -0
- package/payload/starter/_basic/examples/context-menu.htm +180 -139
- package/payload/starter/_basic/examples/currency-field.htm +105 -0
- package/payload/starter/_basic/examples/data-table-2.htm +2 -1
- package/payload/starter/_basic/examples/data-table-3.htm +1 -1
- package/payload/starter/_basic/examples/data-table-4.htm +15 -12
- package/payload/starter/_basic/examples/data-table-5.htm +11 -3
- package/payload/starter/_basic/examples/data-table.htm +90 -40
- package/payload/starter/_basic/examples/date-picker.htm +239 -0
- package/payload/starter/_basic/examples/dialog-centered.htm +394 -40
- package/payload/starter/_basic/examples/dialog.htm +267 -46
- package/payload/starter/_basic/examples/email-field.htm +102 -0
- package/payload/starter/_basic/examples/file-picker.htm +296 -0
- package/payload/starter/_basic/examples/filters.htm +33 -22
- package/payload/starter/_basic/examples/{form-1.htm → form.htm} +18 -19
- package/payload/starter/_basic/examples/full-screen-select.htm +81 -58
- package/payload/starter/_basic/examples/gauge.htm +95 -81
- package/payload/starter/_basic/examples/graph-box.htm +365 -0
- package/payload/starter/_basic/examples/grid-group.htm +179 -0
- package/payload/starter/_basic/examples/hold-to-confirm-button.htm +102 -113
- package/payload/starter/_basic/examples/image-view.htm +195 -0
- package/payload/starter/_basic/examples/item-list-2.htm +138 -94
- package/payload/starter/_basic/examples/item-list.htm +191 -86
- package/payload/starter/_basic/examples/json-editor.htm +206 -0
- package/payload/starter/_basic/examples/json-view.htm +153 -0
- package/payload/starter/_basic/examples/label-editor.htm +85 -89
- package/payload/starter/_basic/examples/left-menu-2.htm +93 -0
- package/payload/starter/_basic/examples/left-menu.htm +42 -37
- package/payload/starter/_basic/examples/line-progress-bar.htm +155 -114
- package/payload/starter/_basic/examples/loading-screen.htm +149 -125
- package/payload/starter/_basic/examples/log-view.htm +175 -0
- package/payload/starter/_basic/examples/{login-page-dark-v2.htm → login-page-dark.htm} +265 -267
- package/payload/starter/_basic/examples/{login-page-v2.htm → login-page.htm} +266 -267
- package/payload/starter/_basic/examples/markdown-view.htm +220 -0
- package/payload/starter/_basic/examples/menu-bar-2.htm +225 -0
- package/payload/starter/_basic/examples/menu-bar.htm +145 -0
- package/payload/starter/_basic/examples/mini-graph-box.htm +98 -109
- package/payload/starter/_basic/examples/minimal-accent.htm +196 -0
- package/payload/starter/_basic/examples/minimal-theme.htm +432 -0
- package/payload/starter/_basic/examples/notice.htm +13 -4
- package/payload/starter/_basic/examples/number-field.htm +103 -0
- package/payload/starter/_basic/examples/numeric-keyboard.htm +44 -42
- package/payload/starter/_basic/examples/page-control.htm +181 -130
- package/payload/starter/_basic/examples/page-header.htm +57 -30
- package/payload/starter/_basic/examples/password-field.htm +117 -0
- package/payload/starter/_basic/examples/period-bar.htm +43 -29
- package/payload/starter/_basic/examples/phone-field-select-country.htm +292 -0
- package/payload/starter/_basic/examples/phone-field.htm +104 -0
- package/payload/starter/_basic/examples/progress-bar-ozden.htm +229 -92
- package/payload/starter/_basic/examples/progress-bar.htm +222 -174
- package/payload/starter/_basic/examples/property-panel.htm +152 -52
- package/payload/starter/_basic/examples/radio-button-2.htm +101 -109
- package/payload/starter/_basic/examples/radio-button-3.htm +81 -71
- package/payload/starter/_basic/examples/radio-button.htm +289 -0
- package/payload/starter/_basic/examples/range-slider.htm +171 -0
- package/payload/starter/_basic/examples/rich-text-editor.htm +115 -110
- package/payload/starter/_basic/examples/scroll-area.htm +293 -0
- package/payload/starter/_basic/examples/scrolling-text.htm +27 -6
- package/payload/starter/_basic/examples/search-input-2-light.htm +112 -0
- package/payload/starter/_basic/examples/search-input-3-dark.htm +105 -0
- package/payload/starter/_basic/examples/{search-input-v2-place.htm → search-input-place.htm} +25 -26
- package/payload/starter/_basic/examples/search-input.htm +159 -0
- package/payload/starter/_basic/examples/search-results.htm +85 -88
- package/payload/starter/_basic/examples/select-box-ozden-dark-text.htm +70 -0
- package/payload/starter/_basic/examples/select-box-ozden-item.htm +6 -5
- package/payload/starter/_basic/examples/select-box-ozden-text.htm +5 -3
- package/payload/starter/_basic/examples/select-box.htm +190 -159
- package/payload/starter/_basic/examples/settings-row.htm +92 -43
- package/payload/starter/_basic/examples/side-panel-2.htm +63 -25
- package/payload/starter/_basic/examples/side-panel.htm +84 -70
- package/payload/starter/_basic/examples/slider-2-classic.htm +152 -0
- package/payload/starter/_basic/examples/slider-field-ozden.htm +286 -0
- package/payload/starter/_basic/examples/slider-field.htm +174 -134
- package/payload/starter/_basic/examples/slider.htm +257 -180
- package/payload/starter/_basic/examples/smart-button-3-ozden.htm +170 -257
- package/payload/starter/_basic/examples/smart-button-4-dark.htm +86 -47
- package/payload/starter/_basic/examples/smart-button-5-features.htm +130 -125
- package/payload/starter/_basic/examples/smart-button-alternatif.htm +266 -0
- package/payload/starter/_basic/examples/smart-button.htm +207 -174
- package/payload/starter/_basic/examples/smart-table-2.htm +43 -56
- package/payload/starter/_basic/examples/smart-table-3.htm +148 -113
- package/payload/starter/_basic/examples/smart-table-4.htm +37 -50
- package/payload/starter/_basic/examples/{smart-table-1.htm → smart-table-5.htm} +37 -48
- package/payload/starter/_basic/examples/smart-table.htm +183 -0
- package/payload/starter/_basic/examples/sortable-list.htm +191 -142
- package/payload/starter/_basic/examples/spark-line-box.htm +149 -161
- package/payload/starter/_basic/examples/splitter.htm +164 -0
- package/payload/starter/_basic/examples/status-bar.htm +166 -0
- package/payload/starter/_basic/examples/step-bar.htm +129 -0
- package/payload/starter/_basic/examples/stepper-2.htm +71 -59
- package/payload/starter/_basic/examples/stepper.htm +146 -135
- package/payload/starter/_basic/examples/tabs-2.htm +58 -67
- package/payload/starter/_basic/examples/tabs.htm +197 -180
- package/payload/starter/_basic/examples/tag-input.htm +150 -153
- package/payload/starter/_basic/examples/tap-effect.htm +23 -19
- package/payload/starter/_basic/examples/text-area-field.htm +104 -0
- package/payload/starter/_basic/examples/text-field-2.htm +113 -0
- package/payload/starter/_basic/examples/text-field-3-style.htm +105 -0
- package/payload/starter/_basic/examples/text-field-4-custom-unit.htm +96 -0
- package/payload/starter/_basic/examples/{input-b-ex5-warning-icon.htm → text-field-5-warning-icon.htm} +19 -19
- package/payload/starter/_basic/examples/text-field-6-modern-dark.htm +114 -0
- package/payload/starter/_basic/examples/text-field-7-modern.htm +106 -0
- package/payload/starter/_basic/examples/text-field-8-light-dark.htm +159 -0
- package/payload/starter/_basic/examples/text-field.htm +163 -0
- package/payload/starter/_basic/examples/time-line.htm +180 -116
- package/payload/starter/_basic/examples/time-picker.htm +240 -0
- package/payload/starter/_basic/examples/tiny-select.htm +118 -86
- package/payload/starter/_basic/examples/tiny-table.htm +40 -34
- package/payload/starter/_basic/examples/toast.htm +145 -147
- package/payload/starter/_basic/examples/toggle-2.htm +99 -68
- package/payload/starter/_basic/examples/toggle-3.htm +104 -101
- package/payload/starter/_basic/examples/toggle.htm +161 -93
- package/payload/starter/_basic/examples/tool-bar.htm +172 -0
- package/payload/starter/_basic/examples/tooltip-2.htm +110 -60
- package/payload/starter/_basic/examples/tooltip-3.htm +124 -65
- package/payload/starter/_basic/examples/tooltip-4.htm +218 -0
- package/payload/starter/_basic/examples/tooltip.htm +206 -124
- package/payload/starter/_basic/examples/tree-view.htm +210 -182
- package/payload/starter/_basic/examples/ui-effects.htm +207 -185
- package/payload/starter/_basic/examples/ui-standards.htm +200 -139
- package/payload/starter/_basic/examples/url-field.htm +120 -0
- package/payload/starter/_basic/examples/web-view.htm +109 -110
- package/payload/starter/_basic/min/accordion.min.js +2 -0
- package/payload/starter/_basic/min/action-button.min.js +1 -1
- package/payload/starter/_basic/min/app-bar.min.js +1 -1
- package/payload/starter/_basic/min/badge.min.js +2 -0
- package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
- package/payload/starter/_basic/min/canvas.min.js +2 -0
- package/payload/starter/_basic/min/chat-view.min.js +2 -0
- package/payload/starter/_basic/min/check-box.min.js +1 -1
- package/payload/starter/_basic/min/code-editor.min.js +2 -0
- package/payload/starter/_basic/min/color-picker.min.js +2 -0
- package/payload/starter/_basic/min/context-menu.min.js +1 -1
- package/payload/starter/_basic/min/currency-field.min.js +2 -0
- package/payload/starter/_basic/min/data-table.min.js +1 -1
- package/payload/starter/_basic/min/date-picker.min.js +2 -0
- package/payload/starter/_basic/min/dialog.min.js +1 -1
- package/payload/starter/_basic/min/email-field.min.js +2 -0
- package/payload/starter/_basic/min/file-picker.min.js +2 -0
- package/payload/starter/_basic/min/filters.min.js +1 -1
- package/payload/starter/_basic/min/form.min.js +1 -1
- package/payload/starter/_basic/min/full-screen-select.min.js +1 -1
- package/payload/starter/_basic/min/gauge.min.js +1 -1
- package/payload/starter/_basic/min/graph-box.min.js +2 -0
- package/payload/starter/_basic/min/grid-group.min.js +2 -0
- package/payload/starter/_basic/min/hold-to-confirm-button.min.js +1 -1
- package/payload/starter/_basic/min/image-view.min.js +2 -0
- package/payload/starter/_basic/min/item-list.min.js +1 -1
- package/payload/starter/_basic/min/json-editor.min.js +2 -0
- package/payload/starter/_basic/min/json-view.min.js +2 -0
- package/payload/starter/_basic/min/label-editor.min.js +1 -1
- package/payload/starter/_basic/min/left-menu.min.js +1 -1
- package/payload/starter/_basic/min/line-progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/loading-screen.min.js +1 -1
- package/payload/starter/_basic/min/log-view.min.js +2 -0
- package/payload/starter/_basic/min/login-page.min.js +2 -0
- package/payload/starter/_basic/min/markdown-view.min.js +2 -0
- package/payload/starter/_basic/min/menu-bar.min.js +2 -0
- package/payload/starter/_basic/min/mini-graph-box.min.js +1 -1
- package/payload/starter/_basic/min/minimal-accent.min.js +2 -0
- package/payload/starter/_basic/min/notice.min.js +1 -1
- package/payload/starter/_basic/min/number-field.min.js +2 -0
- package/payload/starter/_basic/min/numeric-keyboard.min.js +1 -1
- package/payload/starter/_basic/min/page-control.min.js +1 -1
- package/payload/starter/_basic/min/password-field.min.js +2 -0
- package/payload/starter/_basic/min/phone-field.min.js +2 -0
- package/payload/starter/_basic/min/progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/property-panel.min.js +1 -1
- package/payload/starter/_basic/min/radio-button.min.js +1 -1
- package/payload/starter/_basic/min/range-slider.min.js +2 -0
- package/payload/starter/_basic/min/rich-text-editor.min.js +1 -1
- package/payload/starter/_basic/min/scroll-area.min.js +2 -0
- package/payload/starter/_basic/min/scrolling-text.min.js +1 -1
- package/payload/starter/_basic/min/search-input.min.js +2 -0
- package/payload/starter/_basic/min/search-results.min.js +1 -1
- package/payload/starter/_basic/min/select-box.min.js +1 -1
- package/payload/starter/_basic/min/settings-row.min.js +1 -1
- package/payload/starter/_basic/min/side-panel.min.js +1 -1
- package/payload/starter/_basic/min/slider-field.min.js +1 -1
- package/payload/starter/_basic/min/slider.min.js +1 -1
- package/payload/starter/_basic/min/smart-button.min.js +1 -1
- package/payload/starter/_basic/min/smart-table.min.js +1 -1
- package/payload/starter/_basic/min/sortable-list.min.js +1 -1
- package/payload/starter/_basic/min/spark-line-box.min.js +1 -1
- package/payload/starter/_basic/min/splitter.min.js +2 -0
- package/payload/starter/_basic/min/status-bar.min.js +2 -0
- package/payload/starter/_basic/min/step-bar.min.js +2 -0
- package/payload/starter/_basic/min/stepper.min.js +1 -1
- package/payload/starter/_basic/min/tabs.min.js +1 -1
- package/payload/starter/_basic/min/tag-input.min.js +1 -1
- package/payload/starter/_basic/min/text-area-field.min.js +2 -0
- package/payload/starter/_basic/min/text-field.min.js +2 -0
- package/payload/starter/_basic/min/time-line.min.js +1 -1
- package/payload/starter/_basic/min/time-picker.min.js +2 -0
- package/payload/starter/_basic/min/tiny-select.min.js +1 -1
- package/payload/starter/_basic/min/toast.min.js +1 -1
- package/payload/starter/_basic/min/toggle.min.js +1 -1
- package/payload/starter/_basic/min/tool-bar.min.js +2 -0
- package/payload/starter/_basic/min/tooltip.min.js +1 -1
- package/payload/starter/_basic/min/tree-view.min.js +1 -1
- package/payload/starter/_basic/min/ui-effects.min.js +1 -1
- package/payload/starter/_basic/min/url-field.min.js +2 -0
- package/payload/starter/_basic/min/web-view.min.js +1 -1
- package/payload/templates/booking/app/app.js +11 -8
- package/payload/templates/booking/app/settings.js +4 -4
- package/payload/templates/booking/index.htm +3 -3
- package/payload/templates/booking/pages/account.js +6 -6
- package/payload/templates/booking/pages/book.js +1 -1
- package/payload/templates/booking/pages/services.js +5 -4
- package/payload/templates/classic/app/app.js +15 -11
- package/payload/templates/classic/app/settings.js +22 -20
- package/payload/templates/classic/assets/_attribute.txt +2 -0
- package/payload/templates/classic/assets/cards/dill.png +0 -0
- package/payload/templates/classic/assets/cards/fennel.png +0 -0
- package/payload/templates/classic/assets/cards/juniper.png +0 -0
- package/payload/templates/classic/assets/cards/olives.png +0 -0
- package/payload/templates/classic/assets/cards/oregano.png +0 -0
- package/payload/templates/classic/assets/cards/pepper.png +0 -0
- package/payload/templates/classic/assets/cards/rosehip.png +0 -0
- package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
- package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
- package/payload/templates/classic/assets/categories/coffee.png +0 -0
- package/payload/templates/classic/assets/categories/frappe.png +0 -0
- package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
- package/payload/templates/classic/assets/categories/milkshake.png +0 -0
- package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
- package/payload/templates/classic/assets/categories/tea.png +0 -0
- package/payload/templates/classic/index.htm +2 -2
- package/payload/templates/classic/pages/example.js +10 -10
- package/payload/templates/classic/pages/examples.js +44 -43
- package/payload/templates/classic/pages/home.js +16 -15
- package/payload/templates/classic/pages/info-pages.js +5 -5
- package/payload/templates/classic/pages/search.js +8 -7
- package/payload/templates/classic/pages/settings.js +13 -13
- package/payload/templates/classic/pages/tasks.js +1 -0
- package/payload/templates/classic/pages/template-pages.js +12 -11
- package/payload/templates/coffee-shop/app/app.js +12 -8
- package/payload/templates/coffee-shop/app/settings.js +4 -4
- package/payload/templates/coffee-shop/index.htm +3 -3
- package/payload/templates/coffee-shop/pages/drink.js +1 -1
- package/payload/templates/coffee-shop/pages/menu.js +5 -4
- package/payload/templates/forms/TEMPLATE.md +1 -1
- package/payload/templates/forms/appointment-form.htm +55 -53
- package/payload/templates/forms/contact-form-to-mail.htm +38 -37
- package/payload/templates/forms/contact-form-to-supabase.htm +47 -46
- package/payload/templates/forms/dark-contact-form.htm +43 -40
- package/payload/templates/forms/event-registration-form.htm +80 -77
- package/payload/templates/forms/feedback-form.htm +54 -54
- package/payload/templates/forms/order-form.htm +88 -84
- package/payload/templates/forms/recruitment-form.htm +60 -60
- package/payload/templates/forms/service/readme.md +9 -8
- package/payload/templates/forms/service/send-form-mail.php +38 -21
- package/payload/templates/forms/support-ticket-form.htm +67 -65
- package/payload/templates/panel/common/module-page.js +2 -2
- package/payload/templates/panel/common/theme.js +37 -10
- package/payload/templates/panel/common/top-bar.js +45 -40
- package/payload/templates/panel/index.htm +59 -60
- package/payload/templates/panel/module10/greenhouse.htm +98 -113
- package/payload/templates/panel/module11/arduino-projects.htm +47 -58
- package/payload/templates/panel/module6/energy-hub.htm +71 -103
- package/payload/templates/panel/module7/3d-printers.htm +58 -81
- package/payload/templates/panel/module8/cold-rooms.htm +58 -79
- package/payload/templates/panel/module9/elevator-fleet.htm +72 -93
- package/payload/templates/panel/pages/activity.js +134 -152
- package/payload/templates/panel/pages/contents.js +291 -308
- package/payload/templates/panel/pages/customers.js +250 -267
- package/payload/templates/panel/pages/edit-user.js +31 -30
- package/payload/templates/panel/pages/home.js +39 -70
- package/payload/templates/panel/pages/media.js +166 -183
- package/payload/templates/panel/pages/notifications.js +7 -7
- package/payload/templates/panel/pages/orders.js +200 -217
- package/payload/templates/panel/pages/products.js +259 -278
- package/payload/templates/panel/pages/reports.js +74 -123
- package/payload/templates/panel/pages/roles.js +57 -60
- package/payload/templates/panel/pages/settings.js +127 -143
- package/payload/templates/panel/pages/user-actions.js +106 -110
- package/payload/templates/panel/pages/user-list.js +221 -238
- package/payload/templates/panel/pages/users.js +14 -29
- package/payload/templates/shop/TEMPLATE.md +1 -1
- package/payload/templates/shop/app/app.js +11 -8
- package/payload/templates/shop/app/settings.js +4 -4
- package/payload/templates/shop/index.htm +3 -3
- package/payload/templates/shop/pages/account.js +7 -7
- package/payload/templates/shop/pages/cart.js +1 -1
- package/payload/templates/shop/pages/checkout.js +2 -2
- package/payload/templates/shop/pages/product.js +2 -2
- package/payload/templates/shop/pages/shop.js +6 -5
- package/payload/templates/starter/TEMPLATE.md +1 -1
- package/payload/templates/starter/app/app.js +12 -8
- package/payload/templates/starter/app/settings.js +14 -11
- package/payload/templates/starter/index.htm +3 -3
- package/payload/templates/starter/pages/about.js +1 -1
- package/payload/templates/starter/pages/home.js +2 -2
- package/payload/templates/starter/pages/product.js +1 -1
- package/payload/templates/starter/pages/products.js +5 -5
- package/payload/templates/starter/pages/settings.js +1 -1
- package/payload/templates/starter/pages/tasks.js +8 -8
- package/payload/templates/starter/pages/website.js +1 -1
- package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +0 -13
- package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +0 -9
- package/payload/starter/_basic/comp/chart-box.js +0 -868
- package/payload/starter/_basic/comp/email-input-b.js +0 -57
- package/payload/starter/_basic/comp/input-b.js +0 -759
- package/payload/starter/_basic/comp/password-input-b.js +0 -164
- package/payload/starter/_basic/comp/search-input-v2.js +0 -427
- package/payload/starter/_basic/comp/textarea-b.js +0 -184
- package/payload/starter/_basic/comp/url-input-b.js +0 -145
- package/payload/starter/_basic/examples/badgeV2.htm +0 -68
- package/payload/starter/_basic/examples/chart-box.htm +0 -287
- package/payload/starter/_basic/examples/check-box-1.htm +0 -220
- package/payload/starter/_basic/examples/currency-input-b.htm +0 -71
- package/payload/starter/_basic/examples/email-input-b.htm +0 -67
- package/payload/starter/_basic/examples/input-b-ex1.htm +0 -132
- package/payload/starter/_basic/examples/input-b-ex2.htm +0 -136
- package/payload/starter/_basic/examples/input-b-ex3-style.htm +0 -113
- package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +0 -112
- package/payload/starter/_basic/examples/input-b-ex6-dark.htm +0 -108
- package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +0 -153
- package/payload/starter/_basic/examples/number-input-b.htm +0 -68
- package/payload/starter/_basic/examples/password-input-b.htm +0 -70
- package/payload/starter/_basic/examples/phone-input-b-select-country.htm +0 -298
- package/payload/starter/_basic/examples/phone-input-b.htm +0 -72
- package/payload/starter/_basic/examples/radio-button-1.htm +0 -264
- package/payload/starter/_basic/examples/search-input-v2-ozden.htm +0 -128
- package/payload/starter/_basic/examples/search-input-v2.htm +0 -65
- package/payload/starter/_basic/examples/select-color.htm +0 -215
- package/payload/starter/_basic/examples/select-date.htm +0 -244
- package/payload/starter/_basic/examples/select-file.htm +0 -268
- package/payload/starter/_basic/examples/select-time.htm +0 -249
- package/payload/starter/_basic/examples/smart-button-2.htm +0 -220
- package/payload/starter/_basic/examples/textarea-b.htm +0 -76
- package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +0 -221
- package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +0 -221
- package/payload/starter/_basic/examples/url-input-b.htm +0 -85
- package/payload/starter/_basic/min/badge-v2.min.js +0 -2
- package/payload/starter/_basic/min/chart-box.min.js +0 -2
- package/payload/starter/_basic/min/currency-input-b.min.js +0 -2
- package/payload/starter/_basic/min/email-input-b.min.js +0 -2
- package/payload/starter/_basic/min/input-b.min.js +0 -2
- package/payload/starter/_basic/min/login-page-v2.min.js +0 -2
- package/payload/starter/_basic/min/number-input-b.min.js +0 -2
- package/payload/starter/_basic/min/password-input-b.min.js +0 -2
- package/payload/starter/_basic/min/phone-input-b.min.js +0 -2
- package/payload/starter/_basic/min/search-input-v2.min.js +0 -2
- package/payload/starter/_basic/min/select-color.min.js +0 -2
- package/payload/starter/_basic/min/select-date.min.js +0 -2
- package/payload/starter/_basic/min/select-file.min.js +0 -2
- package/payload/starter/_basic/min/select-time.min.js +0 -2
- package/payload/starter/_basic/min/textarea-b.min.js +0 -2
- package/payload/starter/_basic/min/url-input-b.min.js +0 -2
- package/payload/templates/panel/common/bridge.min.js +0 -0
- package/payload/templates/panel/common/full-view.min.js +0 -1
- package/payload/templates/panel/common/main-view.min.js +0 -1
- package/payload/templates/panel/common/module-page.min.js +0 -1
- package/payload/templates/panel/common/right-view.min.js +0 -1
- package/payload/templates/panel/common/start-page.min.js +0 -1
- package/payload/templates/panel/common/top-bar-v25-07-29-1.js +0 -330
- package/payload/templates/panel/common/top-bar-v25-07-29-2.js +0 -265
- package/payload/templates/panel/common/top-bar.min.js +0 -1
- package/payload/templates/panel/common/ui-standards.min.js +0 -1
- package/payload/templates/panel/managers/database.min.js +0 -1
- package/payload/templates/panel/managers/login.min.js +0 -1
- package/payload/templates/panel/pages/_page-template.min.js +0 -1
- package/payload/templates/panel/pages/contents.min.js +0 -1
- package/payload/templates/panel/pages/edit-user.min.js +0 -1
- package/payload/templates/panel/pages/edit-users-table.min.js +0 -1
- package/payload/templates/panel/pages/home.min.js +0 -1
- package/payload/templates/panel/pages/notifications.min.js +0 -1
- package/payload/templates/panel/pages/reports.min.js +0 -1
- package/payload/templates/panel/pages/settings.min.js +0 -1
- package/payload/templates/panel/pages/user-actions.min.js +0 -2
- package/payload/templates/panel/pages/users.min.js +0 -1
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear-round.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/search.svg +0 -0
|
@@ -7,19 +7,26 @@ Filters - v26.11
|
|
|
7
7
|
UI COMPONENT
|
|
8
8
|
- A filter menu: a "Filters" button, and under it a panel with a search field, groups of options with check
|
|
9
9
|
boxes and a footer with the number of the selected options and "Clear all".
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- The groups (sections) open and close (a click, or Enter / Space on the title); the search shows the options with
|
|
11
|
+
the text; every change of the selection goes to onChange (not at create time, not with silent: 1).
|
|
12
|
+
- The fields of the kit: the search field is a SearchInput (comp/search-input.js, its
|
|
13
|
+
params: searchInputParams, "ozden" by default) and every option is a CheckBox (comp/check-box.js, its params:
|
|
14
|
+
checkBoxParams, "light" by default; the row is the check box, its checked mark takes the accent). Load them
|
|
15
|
+
before this file; without them a plain field and a plain check are drawn.
|
|
16
|
+
- animated: 1: the panel and an opened section come with a fade and a short slide (they go faster),
|
|
17
|
+
the arrows turn with a small spring, and the search field and the check boxes get their own motions (SearchInput,
|
|
18
|
+
CheckBox). Nothing moves at the first view; off when the system asks for reduced motion. setAnimated(0/1).
|
|
19
|
+
- The icon of the button is two-tone: sliders on a light box, in the accent (style.buttonIcon).
|
|
13
20
|
- Style packages: "light" (default). Select with styleName. (Filters.styles)
|
|
14
21
|
|
|
15
22
|
USAGE:
|
|
16
23
|
const filters = Filters({
|
|
17
24
|
sections: [
|
|
18
|
-
{ key: "type",
|
|
19
|
-
{ key: "car",
|
|
20
|
-
{ key: "truck",
|
|
25
|
+
{ key: "type", text: "Type", opened: 1, options: [
|
|
26
|
+
{ key: "car", text: "Car" },
|
|
27
|
+
{ key: "truck", text: "Truck", checked: 1 },
|
|
21
28
|
] },
|
|
22
|
-
{ key: "status",
|
|
29
|
+
{ key: "status", text: "Status", opened: 0, options: ["Online", "Offline"] }, // a text: its key is the text
|
|
23
30
|
],
|
|
24
31
|
onChange: function (self) { println(JSON.stringify(self.getSelected())); }, // { type: ["truck"], status: [] }
|
|
25
32
|
});
|
|
@@ -32,12 +39,16 @@ filters.setSections([...]); // new data (the selection comes fr
|
|
|
32
39
|
Filters({ panelOpened: 0 }); // only the button: a click opens the panel
|
|
33
40
|
Filters({ panelMode: "popup", panelOpened: 0 }); // the panel opens over the page; a click outside / Escape closes it
|
|
34
41
|
Filters({ style: { accentColor: "#2E7D5B" } }); // change only some keys of the style
|
|
42
|
+
Filters({ animated: 1 }); // the motions (filters.setAnimated(0) stops them)
|
|
43
|
+
Filters({ checkBoxParams: { styleName: "modern" }, searchInputParams: { styleName: "light" } });
|
|
35
44
|
|
|
36
45
|
Started Date: October 2026
|
|
37
|
-
Developer: Bugra Ozden
|
|
38
|
-
Email: bugra.ozden@gmail.com
|
|
39
46
|
Webpage: https://bug7a.github.io/js-components/
|
|
40
47
|
|
|
48
|
+
Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
|
|
49
|
+
Licensed under the Apache License, Version 2.0
|
|
50
|
+
SPDX-License-Identifier: Apache-2.0
|
|
51
|
+
|
|
41
52
|
*/
|
|
42
53
|
|
|
43
54
|
"use strict";
|
|
@@ -58,22 +69,32 @@ const FiltersDefaults = {
|
|
|
58
69
|
selectedText: "Selected",
|
|
59
70
|
clearText: "Clear all",
|
|
60
71
|
noResultText: "No results",
|
|
61
|
-
// [{ key,
|
|
72
|
+
// [{ key, text, opened, options: [{ key, text, checked }] or ["text"] }]
|
|
62
73
|
sections: [],
|
|
74
|
+
animated: 0, // 1: the panel and an opened section come in, the arrows turn (box.setAnimated(0/1))
|
|
75
|
+
// The search field: the params of its SearchInput (comp/search-input.js). Its
|
|
76
|
+
// placeholder is searchPlaceholder; its animated is the animated of Filters (unless it is given here).
|
|
77
|
+
searchInputParams: { styleName: "ozden", width: "100%", height: 50, fontSize: 18, searchIconSize: 20 },
|
|
78
|
+
// The check boxes: the params of every CheckBox (comp/check-box.js). The row look is
|
|
79
|
+
// style.row and the checked mark is the accent; a style given here wins. Their animated is the animated of
|
|
80
|
+
// Filters (unless it is given here).
|
|
81
|
+
checkBoxParams: { styleName: "light", style: {} },
|
|
63
82
|
onChange: function (self) { }, // The selection changed: self.getSelected(). (Not at create time, not with silent: 1)
|
|
64
83
|
onPanelToggle: function (self) { }, // The panel opened / closed: self.panelOpened
|
|
65
84
|
styleName: "light", // "light" or a name added to Filters.styles
|
|
66
85
|
style: { // Light style package (default)
|
|
67
|
-
accentColor: "#2F5BD3", // a checked box, "Clear all"
|
|
86
|
+
accentColor: "#2F5BD3", // a checked box, "Clear all", the icon of the button
|
|
68
87
|
textColor: "#1F1F1E",
|
|
69
88
|
softTextColor: "#8C8B88", // the titles of the sections, "Selected", the search icon
|
|
70
89
|
fontSize: 18,
|
|
71
90
|
button: { color: "#E2E1DD", height: 50, round: 12, padding: [16, 0], gap: 8 },
|
|
91
|
+
// The two-tone icon of the button: sliders on a light box. "": the accent, and a light tone of it.
|
|
92
|
+
buttonIcon: { strongColor: "", lightColor: "" },
|
|
72
93
|
panel: { color: "#F7F6F3", border: 1, borderColor: "#E4E3DF", round: 18, padding: 8, gap: 6, shadow: "0 10px 30px rgba(0, 0, 0, 0.08)" },
|
|
73
|
-
field: { color: "#EDECE8", height: 50, round: 12, padding: [14, 0], gap: 10 },
|
|
94
|
+
field: { color: "#EDECE8", height: 50, round: 12, padding: [14, 0], gap: 10 }, // the plain field (no SearchInput)
|
|
74
95
|
header: { height: 44, padding: [12, 0], gap: 8 },
|
|
75
96
|
row: { color: "white", height: 48, round: 12, padding: [12, 0], gap: 14, hoverColor: "#FBFBFA" },
|
|
76
|
-
check: { size: 22, round: 6, color: "#EDECE8", markColor: "white" },
|
|
97
|
+
check: { size: 22, round: 6, color: "#EDECE8", markColor: "white" }, // the plain check (no CheckBox)
|
|
77
98
|
badge: { color: "#E6E5E1", fontSize: 14, round: 11, padding: [8, 2] },
|
|
78
99
|
footer: { height: 56, padding: [12, 0], gap: 8 },
|
|
79
100
|
listGap: 6,
|
|
@@ -106,10 +127,23 @@ const Filters = function (params = {}) {
|
|
|
106
127
|
const PANEL_GAP = 10; // between the button and the panel
|
|
107
128
|
const PANEL_Z_INDEX = 1001; // a popup panel over the page (like the list of SelectBox)
|
|
108
129
|
const SCREEN_MARGIN = 8; // a popup panel stays this far from the edges of the screen
|
|
130
|
+
// MOTION (animated: 1; context/basic-js-animated-rules.md)
|
|
131
|
+
const MOTION_TIME = "0.25s";
|
|
132
|
+
const MOTION_EASE = "cubic-bezier(0.2, 0.8, 0.2, 1)"; // a fast start, a soft stop
|
|
133
|
+
const SPRING_TIME = "0.35s"; // WHY: an arrow that turns to show a new state ends with a small overshoot
|
|
134
|
+
const SPRING_EASE = "cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
135
|
+
const ARROW_MOTION = "transform " + SPRING_TIME + " " + SPRING_EASE;
|
|
136
|
+
const CLOSE_TIME = 150; // ms: a panel goes faster than it comes
|
|
137
|
+
const OPEN_MOVE = 6; // px: a panel and the options of an opened section come from here
|
|
138
|
+
const hasSearchInput = (typeof SearchInput !== "undefined");
|
|
139
|
+
const hasCheckBox = (typeof CheckBox !== "undefined");
|
|
109
140
|
let searchText = "";
|
|
141
|
+
let isCreated = 0; // WHY: nothing moves at the first view
|
|
142
|
+
let wasAnimated = 0;
|
|
143
|
+
let cancelPanelHide = null;
|
|
110
144
|
|
|
111
145
|
// *** PUBLIC VARIABLES:
|
|
112
|
-
box.sectionViews = []; // [{ section, header, lblCount, lblArrow, rows: [{ option, row, check, mark }] }]
|
|
146
|
+
box.sectionViews = []; // [{ section, header, lblCount, lblArrow, body, rows: [{ option, row, checkBox | check, mark }] }]
|
|
113
147
|
// NOTE: Default values are also public variables. (box.sections, box.panelOpened, box.buttonText...)
|
|
114
148
|
|
|
115
149
|
// *** PRIVATE FUNCTIONS:
|
|
@@ -141,11 +175,132 @@ const Filters = function (params = {}) {
|
|
|
141
175
|
|
|
142
176
|
const matchesSearch = function (option) {
|
|
143
177
|
if (!searchText) return true;
|
|
144
|
-
return option.
|
|
178
|
+
return option.text.toLocaleLowerCase().indexOf(searchText) !== -1;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// *** MOTION
|
|
182
|
+
|
|
183
|
+
const isMotionOn = function () {
|
|
184
|
+
if (box.animated != 1) return false;
|
|
185
|
+
return !(window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// An object comes: from a fade and a short slide (move px) to its place
|
|
189
|
+
const comeIn = function (obj, move) {
|
|
190
|
+
obj.setMotionNow("none");
|
|
191
|
+
obj.opacity = 0;
|
|
192
|
+
obj.css = { transform: "translateY(" + move + "px)" };
|
|
193
|
+
void obj.elem.offsetHeight; // WHY: the start look must be drawn before the motion is turned on
|
|
194
|
+
obj.setMotionNow("opacity " + MOTION_TIME + " " + MOTION_EASE + ", transform " + MOTION_TIME + " " + MOTION_EASE);
|
|
195
|
+
obj.opacity = 1;
|
|
196
|
+
obj.css = { transform: "none" };
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// An object goes, faster: it fades and slides away (the caller hides it after CLOSE_TIME)
|
|
200
|
+
const goOut = function (obj, move) {
|
|
201
|
+
obj.setMotionNow("opacity " + CLOSE_TIME + "ms " + MOTION_EASE + ", transform " + CLOSE_TIME + "ms " + MOTION_EASE);
|
|
202
|
+
obj.opacity = 0;
|
|
203
|
+
obj.css = { transform: "translateY(" + move + "px)" };
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// The still look (a hidden object comes in again from it)
|
|
207
|
+
const stopMotion = function (obj) {
|
|
208
|
+
obj.setMotionNow("none");
|
|
209
|
+
obj.opacity = 1;
|
|
210
|
+
obj.css = { transform: "none" };
|
|
145
211
|
};
|
|
146
212
|
|
|
147
|
-
//
|
|
148
|
-
const
|
|
213
|
+
// The arrows turn with a spring. (setMotion waits a moment: the first paint does not move.)
|
|
214
|
+
const setArrowMotions = function () {
|
|
215
|
+
if (!isMotionOn()) return;
|
|
216
|
+
box.sectionViews.forEach(function (view) { view.lblArrow.setMotion(ARROW_MOTION); });
|
|
217
|
+
box.lblButtonArrow.setMotion(ARROW_MOTION);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// The arrow of a section: animated, one down arrow that turns; still, an up or a down icon (as before)
|
|
221
|
+
const paintArrow = function (arrow, isOpened) {
|
|
222
|
+
if (isMotionOn()) {
|
|
223
|
+
if (!arrow.isTurningArrow) arrow.text = Filters.icon("down", ICON_SIZE);
|
|
224
|
+
arrow.isTurningArrow = 1;
|
|
225
|
+
arrow.css = { transform: (isOpened) ? "rotate(180deg)" : "none" };
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (arrow.isTurningArrow) arrow.css = { transform: "none" };
|
|
229
|
+
arrow.isTurningArrow = 0;
|
|
230
|
+
arrow.text = Filters.icon((isOpened) ? "up" : "down", ICON_SIZE);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// The arrow of the button turns while the panel is open (only animated: a still arrow always looks down)
|
|
234
|
+
const paintButtonArrow = function () {
|
|
235
|
+
if (isMotionOn()) {
|
|
236
|
+
box.lblButtonArrow.css = { transform: (box.panelOpened) ? "rotate(180deg)" : "none" };
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (wasAnimated) box.lblButtonArrow.css = { transform: "none" };
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const applyAnimated = function () {
|
|
243
|
+
if (box.searchInput) box.searchInput.setAnimated(box.animated);
|
|
244
|
+
box.sectionViews.forEach(function (view) {
|
|
245
|
+
view.rows.forEach(function (rowView) {
|
|
246
|
+
if (rowView.checkBox) rowView.checkBox.setAnimated(box.animated);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
if (isMotionOn()) {
|
|
250
|
+
setArrowMotions();
|
|
251
|
+
wasAnimated = 1;
|
|
252
|
+
} else if (wasAnimated) {
|
|
253
|
+
box.sectionViews.forEach(function (view) {
|
|
254
|
+
stopMotion(view.lblArrow);
|
|
255
|
+
stopMotion(view.body);
|
|
256
|
+
});
|
|
257
|
+
stopMotion(box.lblButtonArrow);
|
|
258
|
+
stopMotion(box.panel);
|
|
259
|
+
wasAnimated = 0;
|
|
260
|
+
}
|
|
261
|
+
paintButtonArrow();
|
|
262
|
+
paint();
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// *** ROWS AND SECTIONS
|
|
266
|
+
|
|
267
|
+
// The look of an option row over the check box params of the page (a style given there wins)
|
|
268
|
+
const getCheckBoxStyle = function () {
|
|
269
|
+
const style = JSON.parse(JSON.stringify(box.checkBoxParams.style || {}));
|
|
270
|
+
mergeIntoIfMissing(style, {
|
|
271
|
+
box: { color: _s.row.color, round: _s.row.round },
|
|
272
|
+
hoverBox: { color: _s.row.hoverColor },
|
|
273
|
+
hoverCheckedBox: { color: _s.row.hoverColor },
|
|
274
|
+
layout: { gap: _s.row.gap, padding: _s.row.padding, align: "left center" },
|
|
275
|
+
checkedMark: { color: _s.accentColor, borderColor: _s.accentColor },
|
|
276
|
+
label: { fontSize: _s.fontSize, textColor: _s.textColor },
|
|
277
|
+
});
|
|
278
|
+
return style;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// CHECK BOX: one option of a section; the check box is the row
|
|
282
|
+
const createCheckBoxRow = function (option, checkBoxStyle) {
|
|
283
|
+
const checkBox = CheckBox(Object.assign({}, box.checkBoxParams, {
|
|
284
|
+
width: "100%",
|
|
285
|
+
height: _s.row.height,
|
|
286
|
+
labelText: basic.escapeHtml(option.text), // WHY: the label of a CheckBox is HTML
|
|
287
|
+
checked: option.checked ? 1 : 0,
|
|
288
|
+
animated: (box.checkBoxParams.animated !== undefined) ? box.checkBoxParams.animated : box.animated,
|
|
289
|
+
style: checkBoxStyle,
|
|
290
|
+
onChange: function (self) {
|
|
291
|
+
option.checked = self.checked ? 1 : 0;
|
|
292
|
+
paint();
|
|
293
|
+
box.onChange(box);
|
|
294
|
+
},
|
|
295
|
+
}));
|
|
296
|
+
checkBox.shrink = 0;
|
|
297
|
+
// WHY: the content of a CheckBox stands at its top; it fills the height of the row (its align centers it)
|
|
298
|
+
checkBox.contentBox.height = "100%";
|
|
299
|
+
return { option: option, row: checkBox, checkBox: checkBox };
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
// GROUP: one option of a section without CheckBox: a plain check and its text
|
|
303
|
+
const createPlainRow = function (option) {
|
|
149
304
|
const row = HGroup({ width: "100%", height: _s.row.height, align: "left center", gap: _s.row.gap, padding: _s.row.padding, color: _s.row.color, round: _s.row.round });
|
|
150
305
|
row.shrink = 0;
|
|
151
306
|
row.clickable = 1;
|
|
@@ -157,47 +312,76 @@ const Filters = function (params = {}) {
|
|
|
157
312
|
check.shrink = 0;
|
|
158
313
|
const mark = createIcon(Filters.icon("check", MARK_SIZE, 3), _s.check.markColor);
|
|
159
314
|
endGroup();
|
|
160
|
-
Label({ plainText: option.
|
|
315
|
+
Label({ plainText: option.text, fontSize: _s.fontSize, textColor: _s.textColor });
|
|
161
316
|
endGroup();
|
|
162
317
|
const rowView = { option: option, row: row, check: check, mark: mark };
|
|
163
318
|
row.onHoverChange(function (self, isOver) { row.color = (isOver) ? _s.row.hoverColor : _s.row.color; });
|
|
164
|
-
row.on("click", function () { toggleOption(
|
|
319
|
+
row.on("click", function () { toggleOption(rowView); });
|
|
165
320
|
row.on("keydown", function (self, event) {
|
|
166
321
|
if (event.key !== " " && event.key !== "Enter") return;
|
|
167
322
|
event.preventDefault();
|
|
168
|
-
toggleOption(
|
|
323
|
+
toggleOption(rowView);
|
|
169
324
|
});
|
|
170
325
|
return rowView;
|
|
171
326
|
};
|
|
172
327
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
328
|
+
const toggleSection = function (section) {
|
|
329
|
+
box.setSectionOpened(section.key, !section.opened);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
// GROUP: the title of a section (its name, the number of the checked options, open / closed) and its options
|
|
333
|
+
const createSection = function (section, checkBoxStyle) {
|
|
334
|
+
const view = { section: section, rows: [], isClosing: 0, cancelClose: null };
|
|
176
335
|
view.header = HGroup({ width: "100%", height: _s.header.height, align: "left center", gap: _s.header.gap, padding: _s.header.padding });
|
|
177
336
|
view.header.shrink = 0;
|
|
178
337
|
view.header.clickable = 1;
|
|
179
338
|
view.header.cursor = "pointer";
|
|
180
339
|
view.header.role = "button";
|
|
181
|
-
|
|
340
|
+
view.header.tabIndex = 0;
|
|
341
|
+
Label({ plainText: section.text, fontSize: _s.fontSize, textColor: _s.softTextColor });
|
|
182
342
|
view.lblCount = createBadge();
|
|
183
343
|
createSpace();
|
|
184
344
|
view.lblArrow = createIcon("", _s.textColor);
|
|
185
345
|
endGroup();
|
|
186
|
-
view.header.on("click", function () {
|
|
187
|
-
view.
|
|
346
|
+
view.header.on("click", function () { toggleSection(section); });
|
|
347
|
+
view.header.on("keydown", function (self, event) {
|
|
348
|
+
if (event.key !== " " && event.key !== "Enter") return;
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
toggleSection(section);
|
|
351
|
+
});
|
|
352
|
+
// GROUP: the options (one group: it comes and goes as one)
|
|
353
|
+
view.body = VGroup({ width: "100%", height: "auto", align: "left top", gap: _s.listGap });
|
|
354
|
+
view.body.shrink = 0;
|
|
355
|
+
view.rows = section.options.map(function (option) {
|
|
356
|
+
return (hasCheckBox) ? createCheckBoxRow(option, checkBoxStyle) : createPlainRow(option);
|
|
357
|
+
});
|
|
358
|
+
endGroup();
|
|
188
359
|
return view;
|
|
189
360
|
};
|
|
190
361
|
|
|
191
362
|
// DATA: the sections and their options (made again in the list)
|
|
192
363
|
const createSections = function () {
|
|
193
364
|
if (box.listGroup) box.listGroup.remove();
|
|
365
|
+
const checkBoxStyle = (hasCheckBox) ? getCheckBoxStyle() : null;
|
|
194
366
|
box.listGroup = createIn(box.listBox, function () {
|
|
195
367
|
const group = VGroup({ width: "100%", height: "auto", align: "left top", gap: _s.listGap, position: "relative" });
|
|
196
|
-
box.sectionViews = box.sections.map(createSection);
|
|
368
|
+
box.sectionViews = box.sections.map(function (section) { return createSection(section, checkBoxStyle); });
|
|
197
369
|
box.lblNoResult = Label({ plainText: box.noResultText, fontSize: _s.fontSize, textColor: _s.softTextColor, padding: [12, 12] });
|
|
198
370
|
endGroup();
|
|
199
371
|
return group;
|
|
200
372
|
});
|
|
373
|
+
if (box.lblButtonArrow) setArrowMotions();
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const paintCheck = function (rowView) {
|
|
377
|
+
const isChecked = rowView.option.checked ? 1 : 0;
|
|
378
|
+
if (rowView.checkBox) {
|
|
379
|
+
if (rowView.checkBox.checked != isChecked) rowView.checkBox.setChecked(isChecked, 1);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
rowView.check.color = (isChecked) ? _s.accentColor : _s.check.color;
|
|
383
|
+
rowView.mark.visible = isChecked;
|
|
384
|
+
rowView.row.aria = { checked: isChecked ? "true" : "false" };
|
|
201
385
|
};
|
|
202
386
|
|
|
203
387
|
// PAINT: the checks, the counts, the arrows, what the search and the closed sections hide
|
|
@@ -207,19 +391,19 @@ const Filters = function (params = {}) {
|
|
|
207
391
|
const checkedCount = countChecked(view.section);
|
|
208
392
|
view.lblCount.plainText = String(checkedCount);
|
|
209
393
|
view.lblCount.visible = (checkedCount) ? 1 : 0;
|
|
210
|
-
view.lblArrow
|
|
394
|
+
paintArrow(view.lblArrow, view.section.opened);
|
|
211
395
|
view.header.aria = { expanded: view.section.opened ? "true" : "false" };
|
|
212
396
|
let sectionMatches = 0;
|
|
213
397
|
view.rows.forEach(function (rowView) {
|
|
214
|
-
|
|
215
|
-
rowView.check.color = (isChecked) ? _s.accentColor : _s.check.color;
|
|
216
|
-
rowView.mark.visible = (isChecked) ? 1 : 0;
|
|
217
|
-
rowView.row.aria = { checked: isChecked ? "true" : "false" };
|
|
398
|
+
paintCheck(rowView);
|
|
218
399
|
const isMatch = matchesSearch(rowView.option);
|
|
219
400
|
if (isMatch) sectionMatches++;
|
|
220
|
-
|
|
221
|
-
rowView.row.visible = (isMatch && (view.section.opened || searchText)) ? 1 : 0;
|
|
401
|
+
rowView.row.visible = (isMatch) ? 1 : 0;
|
|
222
402
|
});
|
|
403
|
+
// WHY: While searching, the matches are shown also in a closed section; a closing one stays until its
|
|
404
|
+
// options are gone.
|
|
405
|
+
const isBodyShown = (view.section.opened || searchText || view.isClosing);
|
|
406
|
+
view.body.visible = (isBodyShown && sectionMatches) ? 1 : 0;
|
|
223
407
|
view.header.visible = (!searchText || sectionMatches) ? 1 : 0;
|
|
224
408
|
shownCount += sectionMatches;
|
|
225
409
|
});
|
|
@@ -230,7 +414,7 @@ const Filters = function (params = {}) {
|
|
|
230
414
|
box.lblClear.opacity = (total) ? 1 : 0.4;
|
|
231
415
|
};
|
|
232
416
|
|
|
233
|
-
const toggleOption = function (
|
|
417
|
+
const toggleOption = function (rowView) {
|
|
234
418
|
rowView.option.checked = rowView.option.checked ? 0 : 1;
|
|
235
419
|
paint();
|
|
236
420
|
box.onChange(box);
|
|
@@ -240,6 +424,64 @@ const Filters = function (params = {}) {
|
|
|
240
424
|
return box.sections.find(function (section) { return section.key === sectionKey; }) || null;
|
|
241
425
|
};
|
|
242
426
|
|
|
427
|
+
const findView = function (sectionKey) {
|
|
428
|
+
return box.sectionViews.find(function (view) { return view.section.key === String(sectionKey); }) || null;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// The options of a section come (a fade and a short slide)
|
|
432
|
+
const openSection = function (view) {
|
|
433
|
+
if (view.cancelClose) view.cancelClose();
|
|
434
|
+
view.cancelClose = null;
|
|
435
|
+
view.isClosing = 0;
|
|
436
|
+
paint();
|
|
437
|
+
comeIn(view.body, -OPEN_MOVE);
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// The options of a section go (faster); the section is drawn closed when they are gone. (Its arrow turns at once.)
|
|
441
|
+
const closeSection = function (view) {
|
|
442
|
+
view.isClosing = 1;
|
|
443
|
+
paint();
|
|
444
|
+
goOut(view.body, -OPEN_MOVE);
|
|
445
|
+
view.cancelClose = view.body.after(CLOSE_TIME, function () {
|
|
446
|
+
view.cancelClose = null;
|
|
447
|
+
view.isClosing = 0;
|
|
448
|
+
stopMotion(view.body);
|
|
449
|
+
paint();
|
|
450
|
+
});
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// *** THE SEARCH FIELD
|
|
454
|
+
|
|
455
|
+
// A SearchInput (comp/search-input.js); without it, a plain field
|
|
456
|
+
const createSearchField = function () {
|
|
457
|
+
if (!hasSearchInput) {
|
|
458
|
+
createPlainSearchField();
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const searchParams = Object.assign({}, box.searchInputParams);
|
|
462
|
+
searchParams.placeholder = box.searchPlaceholder;
|
|
463
|
+
if (searchParams.animated === undefined) searchParams.animated = box.animated;
|
|
464
|
+
// WHY value, not getSearchText(): that one is in lower case, and the field must keep what is typed
|
|
465
|
+
searchParams.onChange = function () { box.search(box.searchInput.value); };
|
|
466
|
+
box.searchInput = SearchInput(searchParams);
|
|
467
|
+
box.searchInput.shrink = 0;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// GROUP: the plain field (without SearchInput): a search icon and an input on a rounded box
|
|
471
|
+
const createPlainSearchField = function () {
|
|
472
|
+
box.searchField = HGroup({ width: "100%", height: _s.field.height, align: "left center", gap: _s.field.gap, padding: _s.field.padding, color: _s.field.color, round: _s.field.round });
|
|
473
|
+
createIcon(Filters.icon("search", ICON_SIZE), _s.softTextColor);
|
|
474
|
+
box.inpSearch = Input({ height: _s.field.height - 10, fontSize: _s.fontSize, textColor: _s.textColor, minimal: 1, color: "transparent", placeholder: box.searchPlaceholder });
|
|
475
|
+
box.inpSearch.grow = 1;
|
|
476
|
+
endGroup();
|
|
477
|
+
box.listenTo(box.inpSearch.inputElement, "input", function () { box.search(box.inpSearch.text); });
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
const getSearchFieldHeight = function () {
|
|
481
|
+
if (box.searchInput) return box.searchInput.height;
|
|
482
|
+
return _s.field.height;
|
|
483
|
+
};
|
|
484
|
+
|
|
243
485
|
// GROUP: the panel: search field, the sections (they scroll), footer
|
|
244
486
|
const createPanel = function () {
|
|
245
487
|
|
|
@@ -256,15 +498,11 @@ const Filters = function (params = {}) {
|
|
|
256
498
|
boxShadow: _s.panel.shadow,
|
|
257
499
|
});
|
|
258
500
|
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
createIcon(Filters.icon("search", ICON_SIZE), _s.softTextColor);
|
|
262
|
-
box.inpSearch = Input({ height: _s.field.height - 10, fontSize: _s.fontSize, textColor: _s.textColor, minimal: 1, color: "transparent", placeholder: box.searchPlaceholder });
|
|
263
|
-
box.inpSearch.grow = 1;
|
|
264
|
-
endGroup();
|
|
501
|
+
// Search field
|
|
502
|
+
createSearchField();
|
|
265
503
|
|
|
266
504
|
// BOX: The sections (they scroll)
|
|
267
|
-
const listHeight = box.panelHeight -
|
|
505
|
+
const listHeight = box.panelHeight - getSearchFieldHeight() - _s.footer.height - _s.panel.padding * 2 - LIST_GAPS;
|
|
268
506
|
box.listBox = startBox(0, 0, "100%", listHeight, { color: "transparent", scrollY: 1 });
|
|
269
507
|
box.listBox.position = "relative";
|
|
270
508
|
endBox();
|
|
@@ -303,6 +541,34 @@ const Filters = function (params = {}) {
|
|
|
303
541
|
box.panel.top = Math.max(SCREEN_MARGIN, top);
|
|
304
542
|
};
|
|
305
543
|
|
|
544
|
+
// The panel comes from its button: down from it, or up when a popup opens above the button
|
|
545
|
+
const getPanelMove = function () {
|
|
546
|
+
if (!isPopup) return -OPEN_MOVE;
|
|
547
|
+
const buttonTop = withPageZoom(box.btnFilters.elem.getBoundingClientRect().top);
|
|
548
|
+
return (box.panel.top < buttonTop) ? OPEN_MOVE : -OPEN_MOVE;
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
const showPanel = function () {
|
|
552
|
+
if (cancelPanelHide) cancelPanelHide();
|
|
553
|
+
cancelPanelHide = null;
|
|
554
|
+
box.panel.visible = 1;
|
|
555
|
+
placePanel();
|
|
556
|
+
if (isCreated && isMotionOn()) comeIn(box.panel, getPanelMove());
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
const hidePanel = function () {
|
|
560
|
+
if (!isCreated || !isMotionOn()) {
|
|
561
|
+
box.panel.visible = 0;
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
goOut(box.panel, getPanelMove());
|
|
565
|
+
cancelPanelHide = box.panel.after(CLOSE_TIME, function () {
|
|
566
|
+
cancelPanelHide = null;
|
|
567
|
+
box.panel.visible = 0;
|
|
568
|
+
stopMotion(box.panel);
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
|
|
306
572
|
const isInside = function (obj, target) {
|
|
307
573
|
return obj.elem.contains(target);
|
|
308
574
|
};
|
|
@@ -326,6 +592,13 @@ const Filters = function (params = {}) {
|
|
|
326
592
|
placePanel();
|
|
327
593
|
};
|
|
328
594
|
|
|
595
|
+
// The two-tone icon of the button (style.buttonIcon; "": from the accent)
|
|
596
|
+
const getButtonIcon = function () {
|
|
597
|
+
const strongColor = _s.buttonIcon.strongColor || _s.accentColor;
|
|
598
|
+
const lightColor = _s.buttonIcon.lightColor || Filters.lightTone(strongColor);
|
|
599
|
+
return Filters.twoToneIcon("filter", ICON_SIZE, strongColor, lightColor);
|
|
600
|
+
};
|
|
601
|
+
|
|
329
602
|
// *** PUBLIC FUNCTIONS:
|
|
330
603
|
|
|
331
604
|
// { sectionKey: [optionKeys] } of the checked options
|
|
@@ -360,10 +633,18 @@ const Filters = function (params = {}) {
|
|
|
360
633
|
};
|
|
361
634
|
|
|
362
635
|
box.setSectionOpened = function (sectionKey, isOpened) {
|
|
363
|
-
const
|
|
364
|
-
if (!
|
|
365
|
-
|
|
366
|
-
|
|
636
|
+
const view = findView(sectionKey);
|
|
637
|
+
if (!view) return;
|
|
638
|
+
const value = (isOpened) ? 1 : 0;
|
|
639
|
+
const isChange = (value !== view.section.opened);
|
|
640
|
+
view.section.opened = value;
|
|
641
|
+
// WHY not while searching: the options of a closed section are shown then too (nothing comes or goes)
|
|
642
|
+
if (!isChange || !isCreated || !isMotionOn() || searchText) {
|
|
643
|
+
paint();
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (value) openSection(view);
|
|
647
|
+
else closeSection(view);
|
|
367
648
|
};
|
|
368
649
|
|
|
369
650
|
box.setSections = function (sections) {
|
|
@@ -373,8 +654,10 @@ const Filters = function (params = {}) {
|
|
|
373
654
|
};
|
|
374
655
|
|
|
375
656
|
box.search = function (text) {
|
|
376
|
-
|
|
377
|
-
|
|
657
|
+
const value = String(text || "");
|
|
658
|
+
searchText = value.trim().toLocaleLowerCase();
|
|
659
|
+
if (box.searchInput && box.searchInput.value !== value) box.searchInput.setValue(value, 1);
|
|
660
|
+
if (box.inpSearch && box.inpSearch.text !== value) box.inpSearch.text = value;
|
|
378
661
|
paint();
|
|
379
662
|
};
|
|
380
663
|
|
|
@@ -387,9 +670,11 @@ const Filters = function (params = {}) {
|
|
|
387
670
|
const value = (isOpened) ? 1 : 0;
|
|
388
671
|
if (value === box.panelOpened) return;
|
|
389
672
|
box.panelOpened = value;
|
|
390
|
-
box.panel.
|
|
673
|
+
if (value && isPopup) box.panel.zIndex = basic.zIndexAbove(box, PANEL_Z_INDEX); // WHY: over a Dialog that holds the filters
|
|
674
|
+
if (value) showPanel();
|
|
675
|
+
else hidePanel();
|
|
391
676
|
box.btnFilters.aria = { expanded: value ? "true" : "false" };
|
|
392
|
-
|
|
677
|
+
paintButtonArrow();
|
|
393
678
|
if (!silent) box.onPanelToggle(box);
|
|
394
679
|
};
|
|
395
680
|
|
|
@@ -398,6 +683,12 @@ const Filters = function (params = {}) {
|
|
|
398
683
|
box.lblButton.plainText = text;
|
|
399
684
|
};
|
|
400
685
|
|
|
686
|
+
box.setAnimated = function (value) {
|
|
687
|
+
box.animated = (value == 1) ? 1 : 0;
|
|
688
|
+
applyAnimated();
|
|
689
|
+
};
|
|
690
|
+
// USAGE: filters.setAnimated(1)
|
|
691
|
+
|
|
401
692
|
// *** OBJECT VIEW:
|
|
402
693
|
|
|
403
694
|
// GROUP: Layout (the button at the right; the panel under it in the "inline" mode)
|
|
@@ -411,9 +702,9 @@ const Filters = function (params = {}) {
|
|
|
411
702
|
box.btnFilters.cursor = "pointer";
|
|
412
703
|
box.btnFilters.role = "button";
|
|
413
704
|
box.btnFilters.tabIndex = 0;
|
|
414
|
-
createIcon(
|
|
705
|
+
createIcon(getButtonIcon(), _s.textColor);
|
|
415
706
|
box.lblButton = Label({ plainText: box.buttonText, fontSize: _s.fontSize, textColor: _s.textColor });
|
|
416
|
-
createIcon(Filters.icon("down", ICON_SIZE), _s.textColor);
|
|
707
|
+
box.lblButtonArrow = createIcon(Filters.icon("down", ICON_SIZE), _s.textColor);
|
|
417
708
|
endGroup();
|
|
418
709
|
|
|
419
710
|
if (!isPopup) createPanel();
|
|
@@ -436,7 +727,6 @@ const Filters = function (params = {}) {
|
|
|
436
727
|
box.togglePanel();
|
|
437
728
|
});
|
|
438
729
|
box.lblClear.on("click", function () { box.clearAll(); });
|
|
439
|
-
box.listenTo(box.inpSearch.inputElement, "input", function () { box.search(box.inpSearch.text); });
|
|
440
730
|
|
|
441
731
|
if (isPopup) {
|
|
442
732
|
box.listenTo(document, "pointerdown", closeOnOutsideClick, true);
|
|
@@ -446,10 +736,11 @@ const Filters = function (params = {}) {
|
|
|
446
736
|
}
|
|
447
737
|
|
|
448
738
|
createSections();
|
|
449
|
-
paint();
|
|
450
739
|
box.panelOpened = 0;
|
|
451
740
|
box.panel.visible = 0; // WHY: Hidden after its children are made.
|
|
452
741
|
box.setPanelOpened(params.panelOpened, 1);
|
|
742
|
+
applyAnimated(); // (it paints)
|
|
743
|
+
isCreated = 1;
|
|
453
744
|
|
|
454
745
|
return endObject(box);
|
|
455
746
|
|
|
@@ -457,20 +748,19 @@ const Filters = function (params = {}) {
|
|
|
457
748
|
|
|
458
749
|
// *** STATIC FUNCTIONS:
|
|
459
750
|
|
|
460
|
-
// The sections with every value filled: keys as texts, opened / checked as 1 / 0, a text option -> { key,
|
|
751
|
+
// The sections with every value filled: keys as texts, opened / checked as 1 / 0, a text option -> { key, text }.
|
|
461
752
|
Filters.normalizeSections = function (sections) {
|
|
462
753
|
return (Array.isArray(sections) ? sections : []).map(function (section, index) {
|
|
463
754
|
const options = (Array.isArray(section.options) ? section.options : []).map(function (option) {
|
|
464
|
-
if (typeof option !== "object") return { key: String(option),
|
|
465
|
-
return { key: String(option.key !== undefined ? option.key : option.
|
|
755
|
+
if (typeof option !== "object") return { key: String(option), text: String(option), checked: 0 };
|
|
756
|
+
return { key: String(option.key !== undefined ? option.key : option.text), text: String(option.text || ""), checked: option.checked ? 1 : 0 };
|
|
466
757
|
});
|
|
467
|
-
return { key: String(section.key !== undefined ? section.key : index),
|
|
758
|
+
return { key: String(section.key !== undefined ? section.key : index), text: String(section.text || ""), opened: section.opened ? 1 : 0, options: options };
|
|
468
759
|
});
|
|
469
760
|
};
|
|
470
761
|
|
|
471
|
-
// An icon: lines in the color of its label (currentColor). name: "
|
|
762
|
+
// An icon: lines in the color of its label (currentColor). name: "search", "down", "up", "check"
|
|
472
763
|
Filters.ICON_PATHS = {
|
|
473
|
-
filter: '<path d="M4 5h16l-6 7.5V19l-4-2v-4.5z"/>',
|
|
474
764
|
search: '<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4 4"/>',
|
|
475
765
|
down: '<path d="M6 9l6 6 6-6"/>',
|
|
476
766
|
up: '<path d="M6 15l6-6 6 6"/>',
|
|
@@ -481,6 +771,30 @@ Filters.icon = function (name, size, strokeWidth = 2) {
|
|
|
481
771
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="' + strokeWidth + '" stroke-linecap="round" stroke-linejoin="round">' + Filters.ICON_PATHS[name] + '</svg>';
|
|
482
772
|
};
|
|
483
773
|
|
|
774
|
+
// A two-tone icon (the style of _basic/examples/smart-button-alternatif.htm): a big LIGHT shape
|
|
775
|
+
// with STRONG details; the two colors are filled in. name: "filter" (sliders on a light box)
|
|
776
|
+
Filters.TWO_TONE_PATHS = {
|
|
777
|
+
filter: '<rect x="2.5" y="2.5" width="19" height="19" rx="3" fill="LIGHT"/>' +
|
|
778
|
+
'<path d="M7 8.5h10M7 15.5h10" fill="none" stroke="STRONG" stroke-width="2" stroke-linecap="round"/>' +
|
|
779
|
+
'<circle cx="10" cy="8.5" r="2.2" fill="STRONG"/><circle cx="14.5" cy="15.5" r="2.2" fill="STRONG"/>',
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
Filters.twoToneIcon = function (name, size, strongColor, lightColor) {
|
|
783
|
+
const body = Filters.TWO_TONE_PATHS[name].split("STRONG").join(strongColor).split("LIGHT").join(lightColor);
|
|
784
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24">' + body + '</svg>';
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// The light tone of a color for a two-tone icon: a hex color mixed with white; another color made transparent
|
|
788
|
+
Filters.LIGHT_TONE = 0.32; // the part of the color in its light tone
|
|
789
|
+
|
|
790
|
+
Filters.lightTone = function (color) {
|
|
791
|
+
const match = /^#([0-9a-f]{6})$/i.exec(String(color).trim());
|
|
792
|
+
if (!match) return Alpha(color, Filters.LIGHT_TONE);
|
|
793
|
+
const channels = [0, 2, 4].map(function (start) { return parseInt(match[1].substr(start, 2), 16); });
|
|
794
|
+
const mixed = channels.map(function (channel) { return Math.round(channel * Filters.LIGHT_TONE + 255 * (1 - Filters.LIGHT_TONE)); });
|
|
795
|
+
return "#" + mixed.map(function (channel) { return channel.toString(16).padStart(2, "0"); }).join("");
|
|
796
|
+
};
|
|
797
|
+
|
|
484
798
|
// *** STYLE PACKAGES:
|
|
485
799
|
// USAGE: Filters({ styleName: "light" })
|
|
486
800
|
// USAGE: Filters({ style: { accentColor: "#2E7D5B" } }) // Change only some keys.
|