create-basicjs 0.1.3 → 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 +97 -25
- 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 +63 -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
|
@@ -2,26 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
|
|
5
|
-
SmartTable-
|
|
5
|
+
SmartTable - v26.11 - "Optimized for big data"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
WHEN TO USE IT: to show very big data well, in both directions: very many rows (only the rows
|
|
8
|
+
that are seen are made) and very many columns (it scrolls sideways). A table that looks better for data that is not so
|
|
9
|
+
big: comp/data-table.js (DataTable). A few rows inside a text: comp/tiny-table.js (TinyTable).
|
|
8
10
|
|
|
11
|
+
STYLE PACKAGES: "light" (default; the old name "classic" works too) and "dark" are the looks of DataTable (comp/data-table.js);
|
|
12
|
+
"minimal" / "minimalDark": the minimal theme (_designs/minimal-theme.htm);
|
|
13
|
+
new pages use "light" on a light page and "dark" on a dark page. "green" is the look of SmartTable before them (the
|
|
14
|
+
green title line, the dark edge). A package is a package of params: it also gives searchInputParams (the filter box is
|
|
15
|
+
a SearchInput package: "ozden" / "ozdenDark"), scrollBarParams and searchTitleMenuParams. (SmartTable.styles)
|
|
16
|
+
Sample: _basic/examples/smart-table.htm (the model page of SmartTable).
|
|
17
|
+
- SmartTable({ styleName: "dark" }), SmartTable({ styleName: "dark", style: { lblItemCell: { fontSize: 14 } } })
|
|
18
|
+
- A page with its own colors over the green look names it: SmartTable({ styleName: "green", style: {...} }) (the keys it
|
|
19
|
+
does not give come from that package, not from classic).
|
|
20
|
+
- A cut text: a cell whose text does not fit (its end is "...") shows all of it in a bubble over
|
|
21
|
+
the cell when the mouse rests on it (style.cellTooltip: the look; showCellTooltip: 0 turns it off). The bubble is
|
|
22
|
+
comp/tooltip.js (Tooltip.show); without that file the browser's own hint (the title of the cell) shows the text.
|
|
23
|
+
|
|
24
|
+
- SmartTable is a JavaScript table component designed to run smoothly even with millions of records. Thanks to its virtual scroll architecture, it only writes the visible rows to the DOM, eliminating memory and performance issues with large datasets. It makes data exploration easy with real-time filtering, multi-column sorting, and both horizontal and vertical scroll support. Custom cell designs can be created for each column via createCellView / updateCellView, allowing flexible visual content per column. Since column widths, heights, and colors are all configurable through parameters, it can be quickly adapted to different projects.
|
|
9
25
|
|
|
10
|
-
Started Date: Mar 2026
|
|
11
|
-
Developer: Bugra Ozden
|
|
12
|
-
Email: bugra.ozden@gmail.com
|
|
13
|
-
Webpage: https://bug7a.github.io/js-components/
|
|
14
26
|
|
|
27
|
+
Started Date: March 2026
|
|
28
|
+
Webpage: https://bug7a.github.io/js-components/
|
|
15
29
|
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
|
|
31
|
+
Licensed under the Apache License, Version 2.0
|
|
32
|
+
SPDX-License-Identifier: Apache-2.0
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- The search column: a press on the label at the right end of the search box (ALL) opens the list of the columns. The search looks only in the chosen column.
|
|
36
|
+
-- The chip is in the filter box at its right end; the clear icon shows at its left while
|
|
37
|
+
there is a text, and a narrow box shows no clear icon (searchInputParams.clearIconMinTextWidth: 80 px of text).
|
|
38
|
+
A narrow table gives the filter box the room up to the count (up to 240 px). Escape clears the filter
|
|
39
|
+
(searchInputParams.clearOnEscape: 1); in an empty filter it goes on to the page (a Dialog around closes).
|
|
40
|
+
-- searchTitleIndex: -1 (ALL: every column); showSearchTitleSelect: 0 hides the label.
|
|
41
|
+
-- The list needs comp/context-menu.js. Without it, every press on the label goes to the next column.
|
|
42
|
+
- fitLineCount: 1: the rows are about itemHeight px high and their count follows the height of the table
|
|
43
|
+
(style.height "100%" in a window that grows or shrinks). 0 (default): itemLineCount rows share the height of the table.
|
|
44
|
+
setItemLineCount(count) makes another count of rows.
|
|
45
|
+
- The keys (canSelect: 1 by default): a click selects a row and gives the table the focus. The selected
|
|
46
|
+
row: style.selectedItemCellColor (null: the color of the row under the mouse) and the line style.selectedBar at its
|
|
47
|
+
left. Then ↑ ↓ move one row, Page Up / Page Down one page, Home / End to the first / the last record, Enter runs
|
|
48
|
+
onSelect like a click. The selected row stays seen after a sort or a filter. The edge of the table shows the focus
|
|
49
|
+
of the keyboard (style.focusRingColor). selectItem(itemData), clearSelection(), getSelectedIndex(),
|
|
50
|
+
box.selectedItemData. canSelect: 0: no selection and no keys (a click only runs onSelect).
|
|
51
|
+
- locale: the language of the numbers of the info line. "": the language of the page (<html lang>); a page
|
|
52
|
+
with no language keeps "tr-TR". Ex: "en-US" -> 12,499, "tr-TR" -> 12.499. setLocale(locale).
|
|
53
|
+
- wheelScroll: 1: the mouse wheel scrolls the rows of the table (the page does not move). The default 0: the wheel scrolls the page; the rows move with the scroll bar and its buttons.
|
|
54
|
+
-- smartTable.setWheelScroll(1) turns it on later.
|
|
55
|
+
- allowHtml: 0 (default): the values of the cells are written as plain text (a name or a title a user wrote does not
|
|
56
|
+
run as HTML). 1: the values are written as HTML (Ex: "<b>12</b>"). Your own values written with cell.label.text in
|
|
57
|
+
createCellView / updateCellView are not touched.
|
|
25
58
|
|
|
26
59
|
|
|
27
60
|
*/
|
|
@@ -44,19 +77,23 @@ const SmartTableDefaults = {
|
|
|
44
77
|
searchTitleIndex: -1, // -1: Search in all columns (ALL). 0, 1...: Search only in this column.
|
|
45
78
|
showSearchTitleSelect: 1, // 0: Hide the column select box (ALL) next to the search input.
|
|
46
79
|
wheelScroll: 0, // 1: The mouse wheel scrolls the rows (and the page does not scroll). 0: The wheel is left to the page.
|
|
47
|
-
allowHtml: 0, // 1: The cell values are written as HTML. 0: As plain text (safe for the text of the users)
|
|
80
|
+
allowHtml: 0, // 1: The cell values, the titles of the columns and the texts are written as HTML. 0: As plain text (safe for the text of the users)
|
|
81
|
+
showCellTooltip: 1, // 1: a cell whose text does not fit shows all of it in a bubble (comp/tooltip.js). 0: no bubble
|
|
48
82
|
allTitlesText: "ALL",
|
|
83
|
+
canSelect: 1, // 1: a click or a key selects a row; Enter runs onSelect. 0: no selection, no keys
|
|
84
|
+
fitLineCount: 0, // 1: rows of about itemHeight px, as many as the height of the table holds
|
|
85
|
+
locale: "", // the numbers of the info line ("": the language of the page). Ex: "en-US", "tr-TR"
|
|
49
86
|
sortByTitleIndex: 0,
|
|
50
87
|
sortDirection: "A-Z", // "A-Z" or "Z-A"
|
|
51
88
|
fillTestData: 0,
|
|
52
|
-
onSelect: function (itemData) { },
|
|
53
|
-
|
|
54
|
-
|
|
89
|
+
onSelect: function (self, itemData) { },
|
|
90
|
+
createCellView: null, // function (cell, titleDataIndex, self) { } Once for every cell (a cell shows other rows as the table scrolls): objects created here go into the cell; cell.label is its text
|
|
91
|
+
updateCellView: null, // function (cell, titleDataIndex, value, self) { } Every time a cell shows a value: paint what createCellView made
|
|
55
92
|
titleDataList: [
|
|
56
|
-
{ name: "ID", dataTitle: "id", dataType: "integer", width: 100,
|
|
57
|
-
{ name: "NAME", dataTitle: "name", dataType: "string", width: 100,
|
|
58
|
-
{ name: "EMAIL", dataTitle: "email", dataType: "string", width: 290,
|
|
59
|
-
{ name: "", dataTitle: "active", dataType: "boolean", width: 40,
|
|
93
|
+
{ name: "ID", dataTitle: "id", dataType: "integer", width: 100, sortable: 1 },
|
|
94
|
+
{ name: "NAME", dataTitle: "name", dataType: "string", width: 100, sortable: 1 },
|
|
95
|
+
{ name: "EMAIL", dataTitle: "email", dataType: "string", width: 290, sortable: 0 },
|
|
96
|
+
{ name: "", dataTitle: "active", dataType: "boolean", width: 40, sortable: 0 },
|
|
60
97
|
],
|
|
61
98
|
itemDataList: [
|
|
62
99
|
{ id: 1, name: "Bugra", desc: "about", email: "emainil", active: 1 },
|
|
@@ -84,84 +121,117 @@ const SmartTableDefaults = {
|
|
|
84
121
|
neverHide: 0,
|
|
85
122
|
showDots: 0,
|
|
86
123
|
},
|
|
87
|
-
//
|
|
124
|
+
// The params of the list of the columns in the filter (ContextMenu): only its look, the component gives its onClick.
|
|
88
125
|
searchTitleMenuParams: {},
|
|
126
|
+
// The filter box (a SearchInput): its colors and edges come from the SearchInput package of styleName.
|
|
89
127
|
searchInputParams: {
|
|
128
|
+
styleName: "ozden", // a SearchInput package: "ozden" (a light page), "ozdenDark"
|
|
90
129
|
width: "50%",
|
|
91
130
|
height: 36,
|
|
92
|
-
|
|
93
|
-
round: 8,
|
|
94
|
-
color: "white",
|
|
131
|
+
fontSize: 15,
|
|
95
132
|
searchIconSize: 16,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
133
|
+
searchIconOpacity: 0.5,
|
|
134
|
+
placeholder: "Filter",
|
|
135
|
+
searchIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none" fill="#000000"><rect x="0" y="85" width="512" height="57"/><rect x="85" y="227" width="342" height="56"/><rect x="199" y="370" width="114" height="57"/></svg>'), // three bars
|
|
136
|
+
clearIconMinTextWidth: 80, // (a narrow filter box has no clear icon; its text keeps that place)
|
|
137
|
+
clearOnEscape: 1, // Escape clears the filter (a narrow box has no clear icon)
|
|
101
138
|
},
|
|
102
|
-
|
|
139
|
+
styleName: "light", // "light" ("classic": its old name), "dark", "green", "minimal", "minimalDark" or a name added to SmartTable.styles
|
|
140
|
+
style: { // Light style package (default): the look of DataTable "light"
|
|
103
141
|
|
|
104
142
|
width: "auto",
|
|
105
143
|
height: "auto",
|
|
106
144
|
round: 6,
|
|
107
145
|
line1Color: "white",
|
|
108
|
-
line2Color: "
|
|
109
|
-
|
|
110
|
-
|
|
146
|
+
line2Color: "#F7F7F7",
|
|
147
|
+
// WHY solid colors: the cells are painted over the stripes of the rows; DataTable's soft yellow
|
|
148
|
+
// (rgba(254, 193, 8, 0.08) / 0.18) is mixed with white here, so a row looks the same on every stripe.
|
|
149
|
+
highlightItemCellColor: "#FFFAEB",
|
|
150
|
+
selectedItemCellColor: "#FFF4D3", // null: highlightItemCellColor (the row under the mouse)
|
|
151
|
+
selectedBar: { width: 0, color: "rgba(95, 158, 160, 0.9)" }, // the line at the left of the selected row (width 0: none)
|
|
152
|
+
focusRingColor: "rgba(95, 158, 160, 0.6)", // the edge of the table when the keys move its rows
|
|
153
|
+
highlightTitleCellColor: "white",
|
|
154
|
+
titleUppercase: 1, // 1: the titles in capital letters (0: as titleDataList writes them)
|
|
111
155
|
verticalScrollWidth: 20,
|
|
112
156
|
verticalScrollMargin: 2,
|
|
113
|
-
btnScrollDownIconFile: "
|
|
114
|
-
btnScrollUpIconFile: "
|
|
115
|
-
btnScrollCenterIconFile: "
|
|
116
|
-
sortIconFile: "
|
|
117
|
-
loadingIconFile: "
|
|
157
|
+
btnScrollDownIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 84V116M27 103L40 116L53 103"/></svg>'),
|
|
158
|
+
btnScrollUpIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 116V84M27 97L40 84L53 97"/></svg>'),
|
|
159
|
+
btnScrollCenterIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#000000" stroke-opacity="0.4" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),
|
|
160
|
+
sortIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.71,9.88l-4.3-4.29a2,2,0,0,0-2.82,0L6.29,9.88a1,1,0,0,0,0,1.41,1,1,0,0,0,1.42,0L11,8V19a1,1,0,0,0,2,0V8l3.29,3.29a1,1,0,1,0,1.42-1.41Z"/></svg>'),
|
|
161
|
+
loadingIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none"><circle cx="256" cy="256" r="206" fill="#FFFFFF" stroke="#141414" stroke-width="20"/><path d="M256 113V256H358" fill="none" stroke="#141414" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/></svg>'),
|
|
118
162
|
searchTitleCheckIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),
|
|
119
|
-
invertIconColor: 0,
|
|
163
|
+
invertIconColor: 0, // 1: the sort and the scroll arrows are drawn light (a dark page)
|
|
164
|
+
sortIcon: { size: 16, opacity: 0.25, activeOpacity: 1 }, // the arrow of a title: not sorted / sorted
|
|
165
|
+
// The bubble of a cut text: the keys of Tooltip.BUBBLE_LOOK (comp/tooltip.js) and maxWidth (px: a longer
|
|
166
|
+
// text goes on more lines)
|
|
167
|
+
cellTooltip: { fontSize: 14, color: "white", textColor: Black(0.8), round: 6, border: 1, borderColor: Black(0.15), shadow: "0 6px 16px " + Black(0.12), arrow: 10, padding: [12, 8], maxWidth: 360 },
|
|
120
168
|
|
|
121
169
|
box: { color: "white" },
|
|
122
|
-
boxBorder: { border:
|
|
123
|
-
boxTitleLine: { color: "
|
|
124
|
-
boxTitleCell: { padding: [
|
|
125
|
-
lblTitleCell: { fontSize:
|
|
126
|
-
boxItemCell: { borderBottom: "1px solid
|
|
127
|
-
lblItemCell: { fontSize:
|
|
128
|
-
boxInfoLine: { color: "
|
|
129
|
-
lblBoxInfoLine: { fontSize:
|
|
130
|
-
lblNoDataFound: { color: "
|
|
131
|
-
//
|
|
132
|
-
lblSearchTitle: {},
|
|
133
|
-
btnScrollCenter: { color: "white", round: 100, borderColor:
|
|
134
|
-
btnScrollUp: { color: "
|
|
135
|
-
btnScrollDown: { color: "
|
|
136
|
-
boxSort: { color: "
|
|
170
|
+
boxBorder: { border: 1, borderColor: Black(0.15) },
|
|
171
|
+
boxTitleLine: { color: "whitesmoke" },
|
|
172
|
+
boxTitleCell: { padding: [10, 0], borderRight: "1px solid " + Black(0.08), borderBottom: "1px solid " + Black(0.2) },
|
|
173
|
+
lblTitleCell: { fontSize: 15, fontFamily: "opensans-bold", textColor: Black(0.8) },
|
|
174
|
+
boxItemCell: { borderBottom: "1px solid " + Black(0.08), borderRight: "none", padding: [10, 0] },
|
|
175
|
+
lblItemCell: { fontSize: 15, textColor: Black(0.7), fontFamily: "opensans" },
|
|
176
|
+
boxInfoLine: { color: "white", borderTop: "1px solid " + Black(0.2) },
|
|
177
|
+
lblBoxInfoLine: { fontSize: 14, textColor: Black(0.5) },
|
|
178
|
+
lblNoDataFound: { color: "transparent", textColor: Black(0.45), padding: [8, 2], fontSize: 15, round: 8, border: 0, borderColor: "transparent" },
|
|
179
|
+
// The label that chooses the column in the filter box (ALL), over the style of lblNoDataFound.
|
|
180
|
+
lblSearchTitle: { color: "white", textColor: Black(0.6), padding: [8, 2], fontSize: 12, round: 50, border: 1, borderColor: Black(0.12) },
|
|
181
|
+
btnScrollCenter: { color: "white", round: 100, border: 1, borderColor: Black(0.2) },
|
|
182
|
+
btnScrollUp: { color: "whitesmoke", round: 100, border: 1, borderColor: Black(0.15) },
|
|
183
|
+
btnScrollDown: { color: "whitesmoke", round: 100, border: 1, borderColor: Black(0.15) },
|
|
184
|
+
boxSort: { color: "transparent" },
|
|
137
185
|
|
|
138
186
|
},
|
|
139
187
|
};
|
|
140
188
|
|
|
141
189
|
const SmartTable = function (params = {}) {
|
|
142
190
|
|
|
191
|
+
// Merge style package: params.style > SmartTable.styles[styleName] (a package of params) > SmartTableDefaults (light)
|
|
192
|
+
basic.applyStylePackage(params, SmartTable.styles, SmartTableDefaults);
|
|
193
|
+
|
|
194
|
+
// Merge params:
|
|
143
195
|
mergeIntoIfMissing(params, SmartTableDefaults);
|
|
144
196
|
|
|
145
197
|
// BOX: Component container
|
|
146
198
|
let box = startObject(params);
|
|
147
199
|
|
|
148
|
-
// WHY: mergeIntoIfMissing
|
|
200
|
+
// WHY: mergeIntoIfMissing copies an array by reference. Without a copy, setTitleCellWidth would change SmartTableDefaults (and the other tables).
|
|
149
201
|
box.titleDataList = box.titleDataList.map(titleData => ({ ...titleData }));
|
|
150
202
|
box.itemDataList = [...box.itemDataList];
|
|
151
203
|
|
|
152
204
|
// *** PRIVATE VARIABLES:
|
|
153
205
|
const DEFAULT_CELL_WIDTH = 100;
|
|
154
|
-
const SORT_ICON_SIZE = 22;
|
|
155
206
|
const SCROLL_CENTER_HEIGHT = 50;
|
|
207
|
+
const CELL_TOOLTIP_DELAY = 300; // ms: the mouse rests on a cell before its bubble shows (no bubbles while it moves)
|
|
156
208
|
const LOADING_ICON_SIZE = 32;
|
|
157
209
|
const SEARCH_TITLE_MAX_WIDTH = "160px";
|
|
210
|
+
const SEARCH_TITLE_RIGHT = 6; // px: the chip (ALL) from the right side of the filter box
|
|
211
|
+
const SEARCH_TITLE_GAP = 6; // px: between the clear icon of the filter box and the chip
|
|
212
|
+
const SEARCH_MIN_WIDTH = 240; // px: a narrow table gives the filter box more than its share of the line, up to this
|
|
213
|
+
const TOOLBAR_PADDING = 8; // px: the filter box from the left side of the info line
|
|
214
|
+
const TOOLBAR_GAP = 12; // px: between the filter box and the count
|
|
215
|
+
const COUNT_RIGHT = 14; // px: the count from the right side of the info line
|
|
158
216
|
const FILTER_DELAY = 50; // ms
|
|
159
217
|
const RESIZE_DELAY = 3; // ms
|
|
160
|
-
const LOADING_MIN_ITEM_COUNT = 1000; // WHY:
|
|
218
|
+
const LOADING_MIN_ITEM_COUNT = 1000; // WHY: a short list must not flash the loading for a moment.
|
|
161
219
|
const TEST_DATA_REPEAT_COUNT = 100000;
|
|
220
|
+
const DEFAULT_LOCALE = "tr-TR"; // WHY: the numbers were always Turkish before; a page with no language keeps them
|
|
221
|
+
const targetItemHeight = box.itemHeight; // fitLineCount: the height of a row, before the rows share the height
|
|
222
|
+
let searchClearIconRight = 0; // the place of the clear icon of the filter box with no chip (its own)
|
|
223
|
+
let hoveredCell = null; // the cell under the mouse (the bubble of a cut text: showCellTooltip)
|
|
224
|
+
let cellTooltip = null; // the bubble of a cut text (Tooltip.show), null: none
|
|
225
|
+
let cancelCellTooltipTimer = null;
|
|
162
226
|
|
|
163
227
|
// *** PRIVATE FUNCTIONS:
|
|
164
228
|
|
|
229
|
+
const setText = function (label, text) {
|
|
230
|
+
const value = (text === undefined || text === null) ? "" : String(text);
|
|
231
|
+
if (box.allowHtml == 1) label.text = value;
|
|
232
|
+
else label.plainText = value;
|
|
233
|
+
};
|
|
234
|
+
|
|
165
235
|
// The last top index: the last page of rows ends with the last record.
|
|
166
236
|
const getMaxScrollIndex = function () {
|
|
167
237
|
return Math.max(0, box.visibleItemDataList.length - box.itemLineCount);
|
|
@@ -172,7 +242,7 @@ const SmartTable = function (params = {}) {
|
|
|
172
242
|
return Math.min(index, getMaxScrollIndex());
|
|
173
243
|
};
|
|
174
244
|
|
|
175
|
-
// WHY: isNaN("") false
|
|
245
|
+
// WHY: isNaN("") is false, so an empty value was taken as a number, and parseFloat("") gave NaN and broke the sorting.
|
|
176
246
|
const toSortNumber = function (value) {
|
|
177
247
|
if (typeof value === "number") return value;
|
|
178
248
|
if (typeof value === "string" && value.trim() !== "") return Number(value);
|
|
@@ -184,15 +254,19 @@ const SmartTable = function (params = {}) {
|
|
|
184
254
|
box.state = "normal";
|
|
185
255
|
// Created items by data [var]
|
|
186
256
|
box.visibleItemDataList = [...box.itemDataList];
|
|
257
|
+
// The SearchInput of the filter, made in createToolbar [var]. USAGE: table.searchInput.setValue("") (a new list)
|
|
258
|
+
box.searchInput = null;
|
|
259
|
+
// The selected record (canSelect: 1), null: none [var]. USAGE: table.selectItem(data), table.getSelectedIndex()
|
|
260
|
+
box.selectedItemData = null;
|
|
187
261
|
// [var]
|
|
188
262
|
box.titleCellList = [];
|
|
189
263
|
// [var]
|
|
190
264
|
box.titleCellCount = 0;
|
|
191
265
|
// [var]
|
|
192
266
|
box.itemLineList = [];
|
|
193
|
-
// [var]
|
|
267
|
+
// [var] the index of the record at the top
|
|
194
268
|
box.startedItemIndexForScrolling = 0;
|
|
195
|
-
//
|
|
269
|
+
// The variables of the scroll [var]
|
|
196
270
|
box.scrollVars = {};
|
|
197
271
|
// [var] if height not auto will recallItemHeight
|
|
198
272
|
box.recalcItemHeight = 0;
|
|
@@ -231,8 +305,9 @@ const SmartTable = function (params = {}) {
|
|
|
231
305
|
clearTimeout(box.refreshTimer);
|
|
232
306
|
clearTimeout(box.filterTimer);
|
|
233
307
|
|
|
234
|
-
// WHY:
|
|
308
|
+
// WHY: the menu is made on the page: box.remove() does not remove it. (Before the cascade: it detaches from its target label.)
|
|
235
309
|
if (box.searchTitleMenu) box.searchTitleMenu.remove();
|
|
310
|
+
closeCellTooltip(); // WHY: the bubble is on the page too
|
|
236
311
|
|
|
237
312
|
superRemove.call(box); // NOTE: basic.js remove(). It cleans all the events (listenTo too) and the objects inside.
|
|
238
313
|
box = null;
|
|
@@ -243,15 +318,18 @@ const SmartTable = function (params = {}) {
|
|
|
243
318
|
const hideItemLine = function (itemLine) {
|
|
244
319
|
itemLine.opacity = 0;
|
|
245
320
|
itemLine.clickable = 0;
|
|
321
|
+
itemLine.cursor = ""; // (its cells take the cursor of the row: no hand over the empty part of the table)
|
|
322
|
+
itemLine.itemData = null;
|
|
323
|
+
paintItemLine(itemLine);
|
|
246
324
|
};
|
|
247
325
|
|
|
248
326
|
const fillItemLine = function (itemLine, rowData) {
|
|
249
327
|
|
|
250
328
|
itemLine.opacity = 1;
|
|
251
329
|
itemLine.clickable = 1;
|
|
252
|
-
itemLine.
|
|
253
|
-
|
|
254
|
-
|
|
330
|
+
itemLine.cursor = "pointer";
|
|
331
|
+
itemLine.itemData = rowData; // WHY: a press on the row uses it
|
|
332
|
+
paintItemLine(itemLine);
|
|
255
333
|
|
|
256
334
|
for (let j = 0; j < box.titleCellCount; j++) {
|
|
257
335
|
|
|
@@ -259,16 +337,15 @@ const SmartTable = function (params = {}) {
|
|
|
259
337
|
const cell = itemLine["itemCell" + j];
|
|
260
338
|
const newValue = rowData[titleData.dataTitle] ?? "";
|
|
261
339
|
|
|
262
|
-
//
|
|
263
|
-
// WHY: label.text innerHTML (string)
|
|
264
|
-
if (!("lastValue" in cell) || cell.lastValue !== newValue) { // WHY:
|
|
340
|
+
// The DOM is touched only when the value changed
|
|
341
|
+
// WHY: label.text gives the innerHTML (a string): a number or a value with "&" was always different. The cell keeps the last value it wrote.
|
|
342
|
+
if (!("lastValue" in cell) || cell.lastValue !== newValue) { // WHY: without !==, 0 and "" were the same.
|
|
265
343
|
cell.lastValue = newValue;
|
|
266
344
|
// WHY plainText: a value from a user (a name, a title) ran as HTML in the cell
|
|
267
|
-
|
|
268
|
-
else cell.label.plainText = newValue;
|
|
345
|
+
setText(cell.label, newValue);
|
|
269
346
|
}
|
|
270
347
|
|
|
271
|
-
box.
|
|
348
|
+
if (box.updateCellView) box.updateCellView(cell, j, newValue, box);
|
|
272
349
|
|
|
273
350
|
}
|
|
274
351
|
|
|
@@ -296,6 +373,7 @@ const SmartTable = function (params = {}) {
|
|
|
296
373
|
|
|
297
374
|
box.setVerticalScrollEnabled(dataList.length > lineCount);
|
|
298
375
|
box.updateInfoLabel();
|
|
376
|
+
refreshCellTooltip();
|
|
299
377
|
|
|
300
378
|
};
|
|
301
379
|
|
|
@@ -306,7 +384,7 @@ const SmartTable = function (params = {}) {
|
|
|
306
384
|
|
|
307
385
|
box.setVerticalScrollEnabled = function (enabled) {
|
|
308
386
|
|
|
309
|
-
//
|
|
387
|
+
// It is enabled only when it can be used.
|
|
310
388
|
if (enabled && box.visibleItemDataList.length > box.itemLineCount) {
|
|
311
389
|
setScrollButtonState(box.btnScrollCenter, 1, 1);
|
|
312
390
|
setScrollButtonState(box.btnScrollUp, 1, 1);
|
|
@@ -333,7 +411,7 @@ const SmartTable = function (params = {}) {
|
|
|
333
411
|
|
|
334
412
|
}
|
|
335
413
|
|
|
336
|
-
//
|
|
414
|
+
// The row of the titles
|
|
337
415
|
box.createTitleLine = function () { // [GOOD]
|
|
338
416
|
|
|
339
417
|
box.titleCellList = [];
|
|
@@ -355,41 +433,43 @@ const SmartTable = function (params = {}) {
|
|
|
355
433
|
|
|
356
434
|
box.titleDataList = titleDataList.map(titleData => ({ ...titleData }));
|
|
357
435
|
box.createTitleLine();
|
|
358
|
-
// WHY:
|
|
436
|
+
// WHY: a row has as many cells as there are titles, or refreshData reaches a cell that is not there.
|
|
359
437
|
box.createItemLines();
|
|
360
438
|
if (box.recalcItemHeight) box.setItemHeight(box.itemHeight);
|
|
361
439
|
box.stretchLastCell(box.calcLastCellWidth());
|
|
362
440
|
if (!box.titleDataList[box.sortByTitleIndex]) box.sortByTitleIndex = 0;
|
|
363
441
|
box.updateSortIcon();
|
|
364
|
-
box.updateSearchTitleSelect(); // WHY:
|
|
442
|
+
box.updateSearchTitleSelect(); // WHY: the columns changed: the list is made again, and a chosen column that is gone becomes ALL.
|
|
365
443
|
box.filterAndSortData();
|
|
366
444
|
|
|
367
445
|
}
|
|
368
446
|
|
|
369
447
|
box.createSortIcon = function (titleCell) {
|
|
370
448
|
|
|
449
|
+
const iconSize = box.style.sortIcon.size;
|
|
450
|
+
|
|
371
451
|
startBox({
|
|
372
452
|
align: "right center",
|
|
373
453
|
color: box.style.boxSort.color,
|
|
374
454
|
round: 100,
|
|
375
455
|
border: 0,
|
|
376
456
|
borderColor: "rgba(0,0,0,0.1)",
|
|
377
|
-
width:
|
|
378
|
-
height:
|
|
457
|
+
width: iconSize,
|
|
458
|
+
height: iconSize,
|
|
379
459
|
right: 2,
|
|
380
460
|
padding: [4, 0],
|
|
381
461
|
position: "absolute",
|
|
382
462
|
});
|
|
383
|
-
if (titleCell.
|
|
463
|
+
if (titleCell.sortable == 0) that.opacity = 0;
|
|
384
464
|
titleCell.add(that);
|
|
385
465
|
that.center("top");
|
|
386
466
|
|
|
387
467
|
titleCell.icon = Icon({
|
|
388
|
-
width:
|
|
389
|
-
height:
|
|
468
|
+
width: iconSize,
|
|
469
|
+
height: iconSize,
|
|
390
470
|
left: 0,
|
|
391
471
|
top: 0,
|
|
392
|
-
opacity:
|
|
472
|
+
opacity: box.style.sortIcon.opacity,
|
|
393
473
|
});
|
|
394
474
|
that.setMotion("opacity 0.3s, transform 0.3s");
|
|
395
475
|
that.load(box.style.sortIconFile);
|
|
@@ -405,14 +485,14 @@ const SmartTable = function (params = {}) {
|
|
|
405
485
|
box.titleCellList.forEach(function (titleCell, titleCellIndex) {
|
|
406
486
|
if (titleCellIndex != currentTitleCell.titleCellIndex) {
|
|
407
487
|
titleCell.icon.rotate = 0;
|
|
408
|
-
titleCell.icon.opacity =
|
|
488
|
+
titleCell.icon.opacity = box.style.sortIcon.opacity;
|
|
409
489
|
titleCell.sortDirection = "";
|
|
410
490
|
}
|
|
411
491
|
});
|
|
412
492
|
|
|
413
493
|
};
|
|
414
494
|
|
|
415
|
-
//
|
|
495
|
+
// A title cell
|
|
416
496
|
box.createTitleCell = function (titleData, titleCellIndex) {
|
|
417
497
|
|
|
418
498
|
// TitleCell
|
|
@@ -435,13 +515,14 @@ const SmartTable = function (params = {}) {
|
|
|
435
515
|
// DATA IN OBJECT (titleCell)
|
|
436
516
|
that.titleCellIndex = titleCellIndex;
|
|
437
517
|
that.titleDataTitle = titleData.dataTitle;
|
|
438
|
-
that.
|
|
518
|
+
that.sortable = titleData.sortable;
|
|
439
519
|
|
|
440
520
|
titleCell.label = Label({
|
|
441
|
-
text: titleData.name,
|
|
442
521
|
...box.style.lblTitleCell,
|
|
443
522
|
});
|
|
523
|
+
setText(titleCell.label, titleData.name);
|
|
444
524
|
that.css.fontFamily = box.style.lblTitleCell.fontFamily;
|
|
525
|
+
if (box.style.titleUppercase == 1) that.css.textTransform = "uppercase";
|
|
445
526
|
|
|
446
527
|
endAutoLayout();
|
|
447
528
|
|
|
@@ -449,7 +530,7 @@ const SmartTable = function (params = {}) {
|
|
|
449
530
|
|
|
450
531
|
titleCell.on("click", function (self, event) {
|
|
451
532
|
|
|
452
|
-
if (self.
|
|
533
|
+
if (self.sortable != 1) return;
|
|
453
534
|
|
|
454
535
|
box.resetSortIcons(self);
|
|
455
536
|
box.sortByTitleIndex = self.titleCellIndex;
|
|
@@ -475,7 +556,7 @@ const SmartTable = function (params = {}) {
|
|
|
475
556
|
box.updateSortIcon = function() {
|
|
476
557
|
|
|
477
558
|
const titleCell = box.titleCellList[box.sortByTitleIndex];
|
|
478
|
-
if (!titleCell) return; // WHY:
|
|
559
|
+
if (!titleCell) return; // WHY: a sortByTitleIndex with no column must not throw.
|
|
479
560
|
|
|
480
561
|
if (box.sortDirection == "A-Z") {
|
|
481
562
|
titleCell.sortDirection = "A-Z";
|
|
@@ -485,7 +566,7 @@ const SmartTable = function (params = {}) {
|
|
|
485
566
|
titleCell.icon.rotate = 180;
|
|
486
567
|
}
|
|
487
568
|
|
|
488
|
-
titleCell.icon.opacity =
|
|
569
|
+
titleCell.icon.opacity = box.style.sortIcon.activeOpacity;
|
|
489
570
|
|
|
490
571
|
};
|
|
491
572
|
|
|
@@ -499,6 +580,7 @@ const SmartTable = function (params = {}) {
|
|
|
499
580
|
box.clearColumnHighlight = function (titleCell) {
|
|
500
581
|
if (!box.highlightTitle) return;
|
|
501
582
|
paintColumn(titleCell, "transparent", "transparent");
|
|
583
|
+
box.itemLineList.forEach(paintItemLine); // WHY: the selected row gets its color back
|
|
502
584
|
};
|
|
503
585
|
|
|
504
586
|
box.applyColumnHighlight = function (titleCell) {
|
|
@@ -506,11 +588,13 @@ const SmartTable = function (params = {}) {
|
|
|
506
588
|
paintColumn(titleCell, box.style.highlightTitleCellColor, box.style.highlightItemCellColor);
|
|
507
589
|
};
|
|
508
590
|
|
|
509
|
-
//
|
|
591
|
+
// All the rows.
|
|
510
592
|
box.createItemLines = function () {
|
|
511
593
|
|
|
594
|
+
setHoveredCell(null); // WHY: the cell under the mouse is removed with its row
|
|
595
|
+
// WHY remove(): the objects of the old rows (and of the cells of the page) are cleaned, not only taken off the page
|
|
596
|
+
box.itemLineList.forEach(function (itemLine) { itemLine.remove(); });
|
|
512
597
|
box.itemLineList = [];
|
|
513
|
-
box.boxItemLineGroup.html = "";
|
|
514
598
|
|
|
515
599
|
for (let i = 0; i < box.itemLineCount; i++) {
|
|
516
600
|
const itemLineIndex = i;
|
|
@@ -522,7 +606,7 @@ const SmartTable = function (params = {}) {
|
|
|
522
606
|
|
|
523
607
|
}
|
|
524
608
|
|
|
525
|
-
//
|
|
609
|
+
// A row
|
|
526
610
|
box.createItemLine = function (itemData, itemLineIndex) {
|
|
527
611
|
|
|
528
612
|
// GROUP: ItemLine
|
|
@@ -543,10 +627,16 @@ const SmartTable = function (params = {}) {
|
|
|
543
627
|
endGroup();
|
|
544
628
|
|
|
545
629
|
itemLine.on("click", function (self) {
|
|
546
|
-
|
|
630
|
+
// WHY: a row with no record is unseen, but its cells still take the mouse (their hover makes them clickable)
|
|
631
|
+
if (!self.itemData) return;
|
|
632
|
+
if (box.canSelect == 1) {
|
|
633
|
+
box.selectItem(self.itemData);
|
|
634
|
+
box.elem.focus({ preventScroll: true }); // WHY preventScroll: the page must not move to the table
|
|
635
|
+
}
|
|
636
|
+
box.onSelect(box, self.itemData);
|
|
547
637
|
});
|
|
548
638
|
|
|
549
|
-
if (box.style.height != "auto") itemLine.visible = 0; // WHY:
|
|
639
|
+
if (box.style.height != "auto") itemLine.visible = 0; // WHY: made hidden, so it is not seen cut while its height is measured again.
|
|
550
640
|
return itemLine;
|
|
551
641
|
|
|
552
642
|
};
|
|
@@ -557,7 +647,114 @@ const SmartTable = function (params = {}) {
|
|
|
557
647
|
}
|
|
558
648
|
};
|
|
559
649
|
|
|
560
|
-
//
|
|
650
|
+
// The color of the cells of a row: the selected record, else the row under the mouse (highlightLine), else none
|
|
651
|
+
const paintItemLine = function (itemLine) {
|
|
652
|
+
|
|
653
|
+
const isSelected = Boolean(itemLine.itemData) && itemLine.itemData === box.selectedItemData;
|
|
654
|
+
let color = "transparent";
|
|
655
|
+
if (itemLine.isHover && box.highlightLine) color = box.style.highlightItemCellColor;
|
|
656
|
+
if (isSelected) color = getSelectedColor();
|
|
657
|
+
paintItemLineCells(itemLine, color);
|
|
658
|
+
|
|
659
|
+
// WHY the bar: by default the selected row has the color of the row under the mouse; the bar tells them apart
|
|
660
|
+
const firstCell = itemLine["itemCell0"];
|
|
661
|
+
if (firstCell) firstCell.boxShadow = isSelected ? getSelectedBarShadow() : "none";
|
|
662
|
+
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
const getSelectedBarShadow = function () {
|
|
666
|
+
if (!box.style.selectedBar.width) return "none";
|
|
667
|
+
// WHY + the border: the edge of the table (style.boxBorder) is drawn over the first px of the row
|
|
668
|
+
const width = (basic.num(box.style.boxBorder.border) || 0) + box.style.selectedBar.width;
|
|
669
|
+
return "inset " + width + "px 0 0 " + box.style.selectedBar.color;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
const getSelectedColor = function () {
|
|
673
|
+
return box.style.selectedItemCellColor || box.style.highlightItemCellColor;
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// *** THE BUBBLE OF A CUT TEXT (showCellTooltip: 1):
|
|
677
|
+
|
|
678
|
+
const onCellHoverChange = function (cell, isOver) {
|
|
679
|
+
if (isOver) {
|
|
680
|
+
setHoveredCell(cell);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
if (hoveredCell === cell) setHoveredCell(null);
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
const setHoveredCell = function (cell) {
|
|
687
|
+
hoveredCell = cell;
|
|
688
|
+
planCellTooltip();
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// The bubble waits until the mouse rests on the cell
|
|
692
|
+
const planCellTooltip = function () {
|
|
693
|
+
closeCellTooltip();
|
|
694
|
+
if (!hoveredCell || box.showCellTooltip != 1) return;
|
|
695
|
+
cancelCellTooltipTimer = box.after(CELL_TOOLTIP_DELAY, openCellTooltip);
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
const openCellTooltip = function () {
|
|
699
|
+
|
|
700
|
+
cancelCellTooltipTimer = null;
|
|
701
|
+
const text = getCutText(hoveredCell);
|
|
702
|
+
|
|
703
|
+
// WHY: without comp/tooltip.js the browser's own hint (the title of the cell) shows the text
|
|
704
|
+
if (typeof Tooltip === "undefined") {
|
|
705
|
+
hoveredCell.elem.title = text;
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
if (!text) return;
|
|
710
|
+
cellTooltip = Tooltip.show(hoveredCell, text, box.style.cellTooltip, "top", function (bubble) {
|
|
711
|
+
createTooltipText(text, bubble.look);
|
|
712
|
+
});
|
|
713
|
+
cellTooltip.cellText = text;
|
|
714
|
+
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// The whole text of a cell whose text does not fit (its end is "..."). "": it fits, or the row has no record.
|
|
718
|
+
const getCutText = function (cell) {
|
|
719
|
+
// WHY itemData: a row with no record keeps the text of its last record, unseen
|
|
720
|
+
if (!cell.itemLine.itemData) return "";
|
|
721
|
+
const label = cell.label.elem;
|
|
722
|
+
// (a hidden label, Ex: a cell of createCellView, is 0 px wide: it fits)
|
|
723
|
+
if (label.scrollWidth <= label.clientWidth) return "";
|
|
724
|
+
return label.textContent;
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// LABEL: The whole text in the bubble (a long text goes on more lines: look.maxWidth)
|
|
728
|
+
const createTooltipText = function (text, look) {
|
|
729
|
+
Label({
|
|
730
|
+
plainText: text,
|
|
731
|
+
fontSize: look.fontSize,
|
|
732
|
+
textColor: look.textColor,
|
|
733
|
+
css: { whiteSpace: "normal", overflowWrap: "anywhere", width: "max-content", maxWidth: look.maxWidth + "px" },
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
const closeCellTooltip = function () {
|
|
738
|
+
if (cancelCellTooltipTimer) cancelCellTooltipTimer();
|
|
739
|
+
cancelCellTooltipTimer = null;
|
|
740
|
+
if (cellTooltip) cellTooltip.remove();
|
|
741
|
+
cellTooltip = null;
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// The rows were filled again (a scroll, a filter, a click): a bubble with an old text is made again
|
|
745
|
+
const refreshCellTooltip = function () {
|
|
746
|
+
if (!hoveredCell) return;
|
|
747
|
+
if (cellTooltip && cellTooltip.cellText === hoveredCell.label.elem.textContent) return;
|
|
748
|
+
planCellTooltip();
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
box.setShowCellTooltip = function (value) {
|
|
752
|
+
box.showCellTooltip = basic.isOn(value) ? 1 : 0;
|
|
753
|
+
planCellTooltip();
|
|
754
|
+
};
|
|
755
|
+
// USAGE: smartTable.setShowCellTooltip(0)
|
|
756
|
+
|
|
757
|
+
// A cell.
|
|
561
758
|
box.createItemCell = function (cellWidth, titleDataIndex, itemLine) {
|
|
562
759
|
|
|
563
760
|
// GROUP: ItemCell
|
|
@@ -573,7 +770,6 @@ const SmartTable = function (params = {}) {
|
|
|
573
770
|
borderBottom: box.style.boxItemCell.borderBottom,
|
|
574
771
|
borderRight: box.style.boxItemCell.borderRight,
|
|
575
772
|
};
|
|
576
|
-
that.cursor = "pointer";
|
|
577
773
|
|
|
578
774
|
itemCell.label = Label({
|
|
579
775
|
text: "",
|
|
@@ -588,16 +784,25 @@ const SmartTable = function (params = {}) {
|
|
|
588
784
|
endAutoLayout();
|
|
589
785
|
|
|
590
786
|
itemCell.on("mouseover", function (self, event) {
|
|
591
|
-
|
|
592
|
-
|
|
787
|
+
itemLine.isHover = 1;
|
|
788
|
+
paintItemLine(itemLine);
|
|
593
789
|
});
|
|
594
790
|
|
|
595
791
|
itemCell.on("mouseout", function (self, event) {
|
|
596
|
-
|
|
597
|
-
|
|
792
|
+
itemLine.isHover = 0;
|
|
793
|
+
paintItemLine(itemLine);
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
itemCell.itemLine = itemLine; // (a row with no record shows no bubble)
|
|
797
|
+
itemCell.onHoverChange(function (self, isOver) {
|
|
798
|
+
onCellHoverChange(itemCell, isOver);
|
|
598
799
|
});
|
|
599
800
|
|
|
600
|
-
|
|
801
|
+
if (box.createCellView) {
|
|
802
|
+
createIn(itemCell, function () {
|
|
803
|
+
box.createCellView(itemCell, titleDataIndex, box);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
601
806
|
|
|
602
807
|
return itemCell;
|
|
603
808
|
|
|
@@ -606,7 +811,7 @@ const SmartTable = function (params = {}) {
|
|
|
606
811
|
// RIGHT Scroll
|
|
607
812
|
box.initScrollMetrics = function () {
|
|
608
813
|
|
|
609
|
-
//
|
|
814
|
+
// Variables
|
|
610
815
|
box.scrollVars.minY = box.titleHeight;
|
|
611
816
|
box.scrollVars.scrollAreaHeight = box.height - box.titleHeight - box.infoHeight;
|
|
612
817
|
box.scrollVars.scrollIconHeight = box.btnScrollCenter.height;
|
|
@@ -640,7 +845,7 @@ const SmartTable = function (params = {}) {
|
|
|
640
845
|
// WHEEL: one row for each wheel step.
|
|
641
846
|
box.on("wheel", function (self, event) {
|
|
642
847
|
|
|
643
|
-
// WHY:
|
|
848
|
+
// WHY: the wheel is left to the page by default: the table must not stop the page from scrolling (wheelScroll: 1 turns it on).
|
|
644
849
|
if (box.wheelScroll != 1) return;
|
|
645
850
|
|
|
646
851
|
// WHY: A mostly horizontal move is left to the browser (the horizontal scroll of the columns).
|
|
@@ -690,7 +895,7 @@ const SmartTable = function (params = {}) {
|
|
|
690
895
|
|
|
691
896
|
box.btnScrollCenter.top = newTop;
|
|
692
897
|
|
|
693
|
-
// WHY:
|
|
898
|
+
// WHY: totalPath can be 0 in a very short table, and a division by 0 makes a NaN index.
|
|
694
899
|
if (box.scrollVars.totalPath <= 0) return;
|
|
695
900
|
|
|
696
901
|
const currentProgress = (newTop - box.scrollVars.minY) / box.scrollVars.totalPath;
|
|
@@ -712,7 +917,97 @@ const SmartTable = function (params = {}) {
|
|
|
712
917
|
|
|
713
918
|
};
|
|
714
919
|
|
|
715
|
-
|
|
920
|
+
// *** SELECTION AND KEYS (canSelect: 1):
|
|
921
|
+
|
|
922
|
+
// The index of the selected record in the records that are seen (filtered and sorted), -1: none
|
|
923
|
+
box.getSelectedIndex = function () {
|
|
924
|
+
if (!box.selectedItemData) return -1;
|
|
925
|
+
return box.visibleItemDataList.indexOf(box.selectedItemData);
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
// Selects a record (one of itemDataList, null: none) and scrolls the rows to it
|
|
929
|
+
box.selectItem = function (itemData) {
|
|
930
|
+
if (box.canSelect != 1) return;
|
|
931
|
+
box.selectedItemData = itemData || null;
|
|
932
|
+
scrollToSelected();
|
|
933
|
+
box.refreshData();
|
|
934
|
+
};
|
|
935
|
+
// USAGE: smartTable.selectItem(smartTable.visibleItemDataList[0])
|
|
936
|
+
|
|
937
|
+
box.clearSelection = function () {
|
|
938
|
+
box.selectItem(null);
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
box.setCanSelect = function (value) {
|
|
942
|
+
box.canSelect = basic.isOn(value) ? 1 : 0;
|
|
943
|
+
if (box.canSelect != 1) box.selectedItemData = null;
|
|
944
|
+
applyCanSelect();
|
|
945
|
+
box.refreshData();
|
|
946
|
+
};
|
|
947
|
+
// USAGE: smartTable.setCanSelect(0)
|
|
948
|
+
|
|
949
|
+
// The table takes the focus (Tab, a click on a row) only when it can select
|
|
950
|
+
const applyCanSelect = function () {
|
|
951
|
+
box.tabIndex = (box.canSelect == 1) ? 0 : null;
|
|
952
|
+
if (box.canSelect != 1) box.elem.blur();
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// The edge of the table shows the focus of the keyboard (:focus-visible), not of the mouse.
|
|
956
|
+
// WHY on boxBorder (not setFocusRing): the rows cover an outline that is drawn inside the table itself
|
|
957
|
+
const paintFocus = function () {
|
|
958
|
+
const hasKeyboardFocus = box.elem.matches(":focus-visible");
|
|
959
|
+
box.boxBorder.css.outline = hasKeyboardFocus ? "2px solid " + box.style.focusRingColor : "none";
|
|
960
|
+
box.boxBorder.css.outlineOffset = "-2px";
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
// The rows move as little as they can to show the selected record
|
|
964
|
+
const scrollToSelected = function () {
|
|
965
|
+
const index = box.getSelectedIndex();
|
|
966
|
+
if (index == -1) return;
|
|
967
|
+
let topIndex = box.startedItemIndexForScrolling;
|
|
968
|
+
if (index < topIndex) topIndex = index;
|
|
969
|
+
if (index >= topIndex + box.itemLineCount) topIndex = index - box.itemLineCount + 1;
|
|
970
|
+
box.startedItemIndexForScrolling = clampScrollIndex(topIndex);
|
|
971
|
+
box.syncScrollPosition();
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
// A step of rows from the selected record. Nothing selected: a step down starts before the first record, up after the last.
|
|
975
|
+
const moveSelection = function (step) {
|
|
976
|
+
const count = box.visibleItemDataList.length;
|
|
977
|
+
if (count == 0) return;
|
|
978
|
+
let index = box.getSelectedIndex();
|
|
979
|
+
if (index == -1) index = (step > 0) ? -1 : count;
|
|
980
|
+
box.selectItem(box.visibleItemDataList[basic.clamp(index + step, 0, count - 1)]);
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
// ↑ ↓ one row, Page Up / Page Down one page, Home / End to the first / the last record (0: not a key of the rows)
|
|
984
|
+
const getKeyStep = function (key) {
|
|
985
|
+
const pageStep = box.itemLineCount;
|
|
986
|
+
const count = box.visibleItemDataList.length;
|
|
987
|
+
const steps = { ArrowDown: 1, ArrowUp: -1, PageDown: pageStep, PageUp: -pageStep, Home: -count, End: count };
|
|
988
|
+
return steps[key] || 0;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
const onKeyDown = function (self, event) {
|
|
992
|
+
|
|
993
|
+
// WHY: only the table itself takes the keys (not its filter box); a key with Cmd / Ctrl / Alt is left to the page
|
|
994
|
+
if (box.canSelect != 1 || event.target != box.elem) return;
|
|
995
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return;
|
|
996
|
+
|
|
997
|
+
if (event.key == "Enter") {
|
|
998
|
+
if (box.selectedItemData) box.onSelect(box, box.selectedItemData);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
const step = getKeyStep(event.key);
|
|
1003
|
+
if (step == 0) return;
|
|
1004
|
+
event.preventDefault(); // WHY: the arrows and the page keys must not scroll the page
|
|
1005
|
+
moveSelection(step);
|
|
1006
|
+
paintFocus(); // WHY: a table that got the focus with a click shows it once the keys are used
|
|
1007
|
+
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
box.scrollPage = function (direction) { // +1: down (one page), -1: up
|
|
716
1011
|
|
|
717
1012
|
const newIndex = clampScrollIndex(box.startedItemIndexForScrolling + (direction * box.itemLineCount));
|
|
718
1013
|
if (newIndex === box.startedItemIndexForScrolling) return;
|
|
@@ -736,20 +1031,33 @@ const SmartTable = function (params = {}) {
|
|
|
736
1031
|
|
|
737
1032
|
box.lblNoDataFound.opacity = 0;
|
|
738
1033
|
|
|
739
|
-
//
|
|
1034
|
+
// The first index (+1: people count from 1, not from 0)
|
|
740
1035
|
const start = box.startedItemIndexForScrolling + 1;
|
|
741
1036
|
|
|
742
|
-
//
|
|
1037
|
+
// The last index (the end of the page or the count of the data)
|
|
743
1038
|
let end = box.startedItemIndexForScrolling + box.itemLineCount;
|
|
744
1039
|
if (end > totalData) end = totalData;
|
|
745
1040
|
|
|
746
|
-
// Sayıları binlik ayırıcı ile formatlamak (12499 -> 12.499)
|
|
747
|
-
const formatNumber = (number) => number.toLocaleString('tr-TR');
|
|
748
|
-
|
|
749
1041
|
box.boxInfoLine.label.text = `${formatNumber(start)} - ${formatNumber(end)} / ${formatNumber(totalData)}`;
|
|
750
1042
|
|
|
751
1043
|
};
|
|
752
1044
|
|
|
1045
|
+
// A number in the language of the numbers (locale): 12499 -> "12,499" (en) or "12.499" (tr)
|
|
1046
|
+
const formatNumber = function (number) {
|
|
1047
|
+
try {
|
|
1048
|
+
return number.toLocaleString(box.locale || document.documentElement.lang || DEFAULT_LOCALE);
|
|
1049
|
+
} catch (error) {
|
|
1050
|
+
// WHY: a wrong language tag (Ex: "en_US") throws a RangeError
|
|
1051
|
+
return number.toLocaleString(DEFAULT_LOCALE);
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
box.setLocale = function (locale) {
|
|
1056
|
+
box.locale = locale;
|
|
1057
|
+
box.updateInfoLabel();
|
|
1058
|
+
};
|
|
1059
|
+
// USAGE: smartTable.setLocale("en-US")
|
|
1060
|
+
|
|
753
1061
|
box.setScrollToTop = function () {
|
|
754
1062
|
box.startedItemIndexForScrolling = 0;
|
|
755
1063
|
box.btnScrollCenter.top = box.scrollVars.minY;
|
|
@@ -760,17 +1068,17 @@ const SmartTable = function (params = {}) {
|
|
|
760
1068
|
box.filterAndSortData();
|
|
761
1069
|
};
|
|
762
1070
|
|
|
763
|
-
// WHY: "value ?"
|
|
1071
|
+
// WHY: a "value ?" check made 0 and false impossible to find.
|
|
764
1072
|
const hasKeyword = function (value, searchKeyword) {
|
|
765
1073
|
if (value === undefined || value === null) return false;
|
|
766
|
-
return
|
|
1074
|
+
return SmartTable.toSearchText(value).includes(searchKeyword);
|
|
767
1075
|
};
|
|
768
1076
|
|
|
769
1077
|
const filterItems = function (itemList, searchKeyword) {
|
|
770
1078
|
|
|
771
1079
|
if (searchKeyword === "") return itemList;
|
|
772
1080
|
|
|
773
|
-
//
|
|
1081
|
+
// A chosen column: the search looks only in it; none (ALL): in every column.
|
|
774
1082
|
const searchTitleData = box.titleDataList[box.searchTitleIndex];
|
|
775
1083
|
const searchTitleList = (searchTitleData) ? [searchTitleData] : box.titleDataList;
|
|
776
1084
|
|
|
@@ -794,7 +1102,7 @@ const SmartTable = function (params = {}) {
|
|
|
794
1102
|
const sortItems = function (itemList, sortByTitleIndex, sortDirection) {
|
|
795
1103
|
|
|
796
1104
|
const titleData = box.titleDataList[sortByTitleIndex];
|
|
797
|
-
if (!titleData || titleData.
|
|
1105
|
+
if (!titleData || titleData.sortable === 0) return;
|
|
798
1106
|
|
|
799
1107
|
const key = titleData.dataTitle;
|
|
800
1108
|
|
|
@@ -809,11 +1117,11 @@ const SmartTable = function (params = {}) {
|
|
|
809
1117
|
|
|
810
1118
|
if (box.itemDataList.length > LOADING_MIN_ITEM_COUNT) box.showLoading(1);
|
|
811
1119
|
|
|
812
|
-
// WHY:
|
|
1120
|
+
// WHY: calls one after the other (a fast search): only the last one runs, an old result must not write over a new one.
|
|
813
1121
|
box.filterTimer = waitAndRun(box.filterTimer, function () {
|
|
814
1122
|
|
|
815
1123
|
box.filterTimer = null;
|
|
816
|
-
const searchKeyword =
|
|
1124
|
+
const searchKeyword = SmartTable.toSearchText(box.searchKeyword ?? "").trim();
|
|
817
1125
|
|
|
818
1126
|
// WHY: A copy; sort() must not change the order of box.itemDataList.
|
|
819
1127
|
const filteredList = filterItems([...box.itemDataList], searchKeyword);
|
|
@@ -822,6 +1130,9 @@ const SmartTable = function (params = {}) {
|
|
|
822
1130
|
box.visibleItemDataList = filteredList;
|
|
823
1131
|
|
|
824
1132
|
box.setScrollToTop();
|
|
1133
|
+
// WHY: the selected record stays selected and seen after a sort or a filter; a record that is gone is not
|
|
1134
|
+
if (box.getSelectedIndex() == -1) box.selectedItemData = null;
|
|
1135
|
+
scrollToSelected();
|
|
825
1136
|
box.refreshData();
|
|
826
1137
|
|
|
827
1138
|
box.showLoading(0);
|
|
@@ -835,10 +1146,10 @@ const SmartTable = function (params = {}) {
|
|
|
835
1146
|
let bigData = [];
|
|
836
1147
|
|
|
837
1148
|
for (let i = 0; i < TEST_DATA_REPEAT_COUNT; i++) {
|
|
838
|
-
//
|
|
1149
|
+
// The objects are copied: their ids must not repeat, and they must not share a reference
|
|
839
1150
|
const clonedBatch = box.itemDataList.map(item => ({
|
|
840
1151
|
...item,
|
|
841
|
-
id: bigData.length + item.id //
|
|
1152
|
+
id: bigData.length + item.id // a unique id
|
|
842
1153
|
}));
|
|
843
1154
|
|
|
844
1155
|
bigData.push(...clonedBatch);
|
|
@@ -901,62 +1212,76 @@ const SmartTable = function (params = {}) {
|
|
|
901
1212
|
|
|
902
1213
|
};
|
|
903
1214
|
|
|
1215
|
+
// A narrow table: the filter box is wider than its share of the line (searchInputParams.width, Ex: "50%"), up to
|
|
1216
|
+
// SEARCH_MIN_WIDTH and up to the count. A width in px stays as it is.
|
|
1217
|
+
const applySearchWidth = function () {
|
|
1218
|
+
const width = String(box.searchInputParams.width);
|
|
1219
|
+
box.searchInput.css.minWidth = "0px"; // WHY: a long count makes it narrower
|
|
1220
|
+
if (!width.endsWith("%")) return;
|
|
1221
|
+
box.searchInput.css.flexGrow = "1";
|
|
1222
|
+
box.searchInput.css.maxWidth = "max(" + width + ", " + SEARCH_MIN_WIDTH + "px)";
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
// The chip keeps the right end of the filter box: the clear icon and the text of SearchInput are at its left.
|
|
1226
|
+
const fitSearchToTitle = function () {
|
|
1227
|
+
const titleWidth = box.lblSelectedSortKey.elem.offsetWidth;
|
|
1228
|
+
const hasTitle = (titleWidth > 0);
|
|
1229
|
+
box.searchInput.setClearIconRight(hasTitle ? SEARCH_TITLE_RIGHT + titleWidth + SEARCH_TITLE_GAP : searchClearIconRight);
|
|
1230
|
+
};
|
|
1231
|
+
|
|
904
1232
|
box.createToolbar = function () {
|
|
905
1233
|
|
|
1234
|
+
// GROUP: The filter box and the count, in one line
|
|
1235
|
+
// WHY one line (flex): a narrow table gives the filter box the room up to the count, and a long count makes
|
|
1236
|
+
// it narrower (it never covers the count).
|
|
906
1237
|
HGroup({
|
|
907
1238
|
align: "left center",
|
|
908
|
-
|
|
1239
|
+
gap: TOOLBAR_GAP,
|
|
1240
|
+
padding: [TOOLBAR_PADDING, 0],
|
|
909
1241
|
});
|
|
910
1242
|
box.boxInfoLine.add(that);
|
|
911
1243
|
|
|
912
|
-
SearchInput(box.searchInputParams);
|
|
913
|
-
that.
|
|
914
|
-
that.
|
|
915
|
-
box.searchKeyword =
|
|
1244
|
+
box.searchInput = SearchInput(box.searchInputParams);
|
|
1245
|
+
that.setValue(box.searchKeyword, 1);
|
|
1246
|
+
that.onEnter = function (self) {
|
|
1247
|
+
box.searchKeyword = self.getSearchText();
|
|
916
1248
|
box.filterAndSortData();
|
|
917
1249
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
HGroup({
|
|
922
|
-
align: "right center",
|
|
923
|
-
padding: [14, 0],
|
|
924
|
-
});
|
|
925
|
-
box.boxInfoLine.add(that);
|
|
1250
|
+
searchClearIconRight = that.clearIconRight;
|
|
1251
|
+
applySearchWidth();
|
|
926
1252
|
|
|
927
1253
|
box.boxInfoLine.label = Label({
|
|
928
1254
|
text: "0 - 0 / 0",
|
|
929
1255
|
...box.style.lblBoxInfoLine,
|
|
930
1256
|
});
|
|
1257
|
+
that.css = { marginLeft: "auto", marginRight: (COUNT_RIGHT - TOOLBAR_PADDING) + "px", flexShrink: "0" };
|
|
931
1258
|
|
|
932
1259
|
endGroup();
|
|
933
1260
|
|
|
934
|
-
//
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
box.lblSelectedSortKey = Label({
|
|
944
|
-
text: box.allTitlesText,
|
|
945
|
-
opacity: 1,
|
|
946
|
-
clickable: 1,
|
|
947
|
-
...box.style.lblNoDataFound,
|
|
948
|
-
...box.style.lblSearchTitle, // WHY: Etiket filtre kutusunun içinde duruyor; "no data" etiketinden ayrı stil verilebilsin.
|
|
1261
|
+
// LABEL: The choice of the search column (ALL): in the filter box, at its right end
|
|
1262
|
+
box.lblSelectedSortKey = createIn(box.searchInput, function () {
|
|
1263
|
+
return Label({
|
|
1264
|
+
right: SEARCH_TITLE_RIGHT,
|
|
1265
|
+
opacity: 1,
|
|
1266
|
+
clickable: 1,
|
|
1267
|
+
...box.style.lblNoDataFound,
|
|
1268
|
+
...box.style.lblSearchTitle, // WHY: the label is in the filter box: it gets a look apart from the "no data" label.
|
|
1269
|
+
});
|
|
949
1270
|
});
|
|
1271
|
+
setText(box.lblSelectedSortKey, box.allTitlesText);
|
|
950
1272
|
that.cursor = "pointer";
|
|
951
1273
|
that.ellipsis = 1;
|
|
952
1274
|
that.css.maxWidth = SEARCH_TITLE_MAX_WIDTH;
|
|
1275
|
+
// WHY CSS: the chip stays in the middle of the box when its text or its font changes
|
|
1276
|
+
that.css.top = "50%";
|
|
1277
|
+
that.css.transform = "translateY(-50%)";
|
|
953
1278
|
that.setMotion("opacity 0.2s");
|
|
954
|
-
|
|
955
|
-
|
|
1279
|
+
// WHY onResize: a column name is wider than ALL; a hidden chip is 0 px (showSearchTitleSelect: 0)
|
|
1280
|
+
that.onResize(fitSearchToTitle);
|
|
956
1281
|
|
|
957
1282
|
if (typeof ContextMenu === "function") {
|
|
958
1283
|
|
|
959
|
-
// MENU:
|
|
1284
|
+
// MENU: The list of the columns (items: box.updateSearchTitleSelect)
|
|
960
1285
|
box.searchTitleMenu = ContextMenu({
|
|
961
1286
|
minWidth: 160,
|
|
962
1287
|
...box.searchTitleMenuParams,
|
|
@@ -968,7 +1293,7 @@ const SmartTable = function (params = {}) {
|
|
|
968
1293
|
|
|
969
1294
|
} else {
|
|
970
1295
|
|
|
971
|
-
// WHY: context-menu.js
|
|
1296
|
+
// WHY: without context-menu.js it still works: every press goes to the next column.
|
|
972
1297
|
box.lblSelectedSortKey.on("click", function () {
|
|
973
1298
|
box.selectNextSearchTitle();
|
|
974
1299
|
});
|
|
@@ -999,7 +1324,7 @@ const SmartTable = function (params = {}) {
|
|
|
999
1324
|
|
|
1000
1325
|
if (titleDataList.length == 0) return 0;
|
|
1001
1326
|
|
|
1002
|
-
// WHY: createTitleCell/createItemCell
|
|
1327
|
+
// WHY: createTitleCell / createItemCell use DEFAULT_CELL_WIDTH when there is no width: the same here, or basic.num(undefined) is NaN.
|
|
1003
1328
|
let totalWidth = 0;
|
|
1004
1329
|
titleDataList.forEach(function (titleData) {
|
|
1005
1330
|
totalWidth += basic.num(titleData.width || DEFAULT_CELL_WIDTH);
|
|
@@ -1009,7 +1334,7 @@ const SmartTable = function (params = {}) {
|
|
|
1009
1334
|
|
|
1010
1335
|
if (tableWidth > totalWidth) return tableWidth - totalWidth + lastCellWidth;
|
|
1011
1336
|
|
|
1012
|
-
// WHY:
|
|
1337
|
+
// WHY: when the table got narrower, the last cell kept its old wider size: back to its own width.
|
|
1013
1338
|
return lastCellWidth;
|
|
1014
1339
|
|
|
1015
1340
|
};
|
|
@@ -1020,14 +1345,14 @@ const SmartTable = function (params = {}) {
|
|
|
1020
1345
|
|
|
1021
1346
|
box.itemLineList.forEach(function (itemLine) {
|
|
1022
1347
|
itemLine.height = box.itemHeight;
|
|
1023
|
-
itemLine.visible = 1; // WHY:
|
|
1348
|
+
itemLine.visible = 1; // WHY: shown after its height is measured
|
|
1024
1349
|
});
|
|
1025
1350
|
|
|
1026
1351
|
};
|
|
1027
1352
|
|
|
1028
1353
|
box.setHeight = function (height) {
|
|
1029
1354
|
|
|
1030
|
-
//
|
|
1355
|
+
// When the height is not "auto", the height of the cells is measured on a resize.
|
|
1031
1356
|
box.recalcItemHeight = (height != "auto") ? 1 : 0;
|
|
1032
1357
|
box.height = height;
|
|
1033
1358
|
|
|
@@ -1035,7 +1360,7 @@ const SmartTable = function (params = {}) {
|
|
|
1035
1360
|
|
|
1036
1361
|
box.setWidth = function (width) {
|
|
1037
1362
|
|
|
1038
|
-
// WHY:
|
|
1363
|
+
// WHY: a number (width: 800) made .includes throw.
|
|
1039
1364
|
const isPercent = typeof width === "string" && width.includes("%");
|
|
1040
1365
|
|
|
1041
1366
|
if (!isPercent) {
|
|
@@ -1092,34 +1417,34 @@ const SmartTable = function (params = {}) {
|
|
|
1092
1417
|
HGroup();
|
|
1093
1418
|
|
|
1094
1419
|
box.lblNoDataFound = Label({
|
|
1095
|
-
text: box.noDataFoundAlert,
|
|
1096
1420
|
opacity: 0,
|
|
1097
1421
|
...box.style.lblNoDataFound,
|
|
1098
1422
|
});
|
|
1423
|
+
setText(box.lblNoDataFound, box.noDataFoundAlert);
|
|
1099
1424
|
that.setMotion("opacity 0.2s");
|
|
1100
1425
|
|
|
1101
1426
|
endGroup();
|
|
1102
1427
|
|
|
1103
1428
|
};
|
|
1104
1429
|
|
|
1105
|
-
//
|
|
1430
|
+
// The name of a column in the list (without HTML tags; its dataTitle when it has no name)
|
|
1106
1431
|
const getTitleText = function (titleData) {
|
|
1107
1432
|
const name = String(titleData.name ?? "").replace(/<[^>]*>/g, "").trim();
|
|
1108
1433
|
return name || String(titleData.dataTitle ?? "");
|
|
1109
1434
|
};
|
|
1110
1435
|
|
|
1111
|
-
//
|
|
1436
|
+
// The label of the search column and its list, as the choice is.
|
|
1112
1437
|
box.updateSearchTitleSelect = function () {
|
|
1113
1438
|
|
|
1114
1439
|
if (!box.titleDataList[box.searchTitleIndex]) box.searchTitleIndex = -1;
|
|
1115
1440
|
|
|
1116
1441
|
const selectedTitleData = box.titleDataList[box.searchTitleIndex];
|
|
1117
|
-
box.lblSelectedSortKey
|
|
1442
|
+
setText(box.lblSelectedSortKey, (selectedTitleData) ? getTitleText(selectedTitleData) : box.allTitlesText);
|
|
1118
1443
|
box.lblSelectedSortKey.visible = (box.showSearchTitleSelect == 1) ? 1 : 0;
|
|
1119
1444
|
|
|
1120
1445
|
if (!box.searchTitleMenu) return;
|
|
1121
1446
|
|
|
1122
|
-
// WHY:
|
|
1447
|
+
// WHY: only the chosen one has an icon; ContextMenu gives the others an empty place of an icon, so the texts stay in line.
|
|
1123
1448
|
const getCheckIcon = function (titleIndex) {
|
|
1124
1449
|
return (box.searchTitleIndex == titleIndex) ? box.style.searchTitleCheckIconFile : "";
|
|
1125
1450
|
};
|
|
@@ -1138,19 +1463,19 @@ const SmartTable = function (params = {}) {
|
|
|
1138
1463
|
|
|
1139
1464
|
};
|
|
1140
1465
|
|
|
1141
|
-
//
|
|
1466
|
+
// Choose the search column. -1: ALL (every column)
|
|
1142
1467
|
box.setSearchTitleIndex = function (titleIndex) {
|
|
1143
1468
|
|
|
1144
1469
|
box.searchTitleIndex = (box.titleDataList[titleIndex]) ? titleIndex : -1;
|
|
1145
1470
|
box.updateSearchTitleSelect();
|
|
1146
1471
|
|
|
1147
|
-
// WHY:
|
|
1472
|
+
// WHY: an empty search box changes no result: the scroll must not go back to the top for nothing.
|
|
1148
1473
|
if (String(box.searchKeyword ?? "").trim() !== "") box.filterAndSortData();
|
|
1149
1474
|
|
|
1150
1475
|
};
|
|
1151
1476
|
// USAGE: smartTable.setSearchTitleIndex(1) or smartTable.setSearchTitleIndex(-1)
|
|
1152
1477
|
|
|
1153
|
-
//
|
|
1478
|
+
// The next column: ALL -> 0 -> 1 -> ... -> ALL
|
|
1154
1479
|
box.selectNextSearchTitle = function () {
|
|
1155
1480
|
const nextIndex = box.searchTitleIndex + 1;
|
|
1156
1481
|
box.setSearchTitleIndex((nextIndex < box.titleDataList.length) ? nextIndex : -1);
|
|
@@ -1162,38 +1487,87 @@ const SmartTable = function (params = {}) {
|
|
|
1162
1487
|
};
|
|
1163
1488
|
// USAGE: smartTable.setShowSearchTitleSelect(0)
|
|
1164
1489
|
|
|
1165
|
-
//
|
|
1490
|
+
// The mouse wheel scrolls the rows. 0: the wheel is left to the page.
|
|
1166
1491
|
box.setWheelScroll = function (enabled) {
|
|
1167
1492
|
box.wheelScroll = basic.isOn(enabled) ? 1 : 0;
|
|
1168
1493
|
};
|
|
1169
1494
|
// USAGE: smartTable.setWheelScroll(1)
|
|
1170
1495
|
|
|
1171
|
-
|
|
1496
|
+
// The height the rows share: the table without its title line and its info line
|
|
1497
|
+
const getRowsHeight = function () {
|
|
1498
|
+
return box.height - box.titleHeight - box.infoHeight;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
// The parts that depend on the size of the table (onResize)
|
|
1502
|
+
const refreshLayout = function () {
|
|
1172
1503
|
|
|
1173
|
-
|
|
1504
|
+
if (box.recalcItemHeight && box.fitLineCount == 1) {
|
|
1174
1505
|
|
|
1175
|
-
|
|
1506
|
+
fitItemLines();
|
|
1176
1507
|
|
|
1177
|
-
|
|
1508
|
+
} else if (box.recalcItemHeight) {
|
|
1178
1509
|
|
|
1179
|
-
|
|
1180
|
-
if (box.itemHeight != itemHeight || (box.itemLineList[0] && !box.itemLineList[0].visible)) {
|
|
1181
|
-
box.setItemHeight(itemHeight);
|
|
1182
|
-
}
|
|
1510
|
+
const itemHeight = getRowsHeight() / box.itemLineCount;
|
|
1183
1511
|
|
|
1512
|
+
// WHY: when the measured height was the same as itemHeight, the rows were never shown.
|
|
1513
|
+
if (box.itemHeight != itemHeight || (box.itemLineList[0] && !box.itemLineList[0].visible)) {
|
|
1514
|
+
box.setItemHeight(itemHeight);
|
|
1184
1515
|
}
|
|
1185
1516
|
|
|
1186
|
-
|
|
1187
|
-
box.initScrollMetrics();
|
|
1188
|
-
box.syncScrollPosition();
|
|
1189
|
-
box.scrollBar.refreshScroll(); // Ekranı daraltırken, scroll gereksiz görünmesin diye.
|
|
1517
|
+
}
|
|
1190
1518
|
|
|
1191
|
-
|
|
1519
|
+
box.stretchLastCell(box.calcLastCellWidth());
|
|
1520
|
+
box.initScrollMetrics();
|
|
1521
|
+
box.syncScrollPosition();
|
|
1522
|
+
box.scrollBar.refreshScroll(); // WHY: a narrower window must not show a scroll bar it does not need
|
|
1192
1523
|
|
|
1193
|
-
|
|
1524
|
+
box.refreshData();
|
|
1525
|
+
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
// fitLineCount: 1 -> as many rows of about targetItemHeight as the table holds; they share its height exactly
|
|
1529
|
+
const fitItemLines = function () {
|
|
1530
|
+
const rowsHeight = getRowsHeight();
|
|
1531
|
+
if (rowsHeight <= 0) return; // WHY: the table is not drawn yet
|
|
1532
|
+
const lineCount = Math.max(1, Math.round(rowsHeight / targetItemHeight));
|
|
1533
|
+
if (lineCount != box.itemLineList.length) {
|
|
1534
|
+
box.setItemLineCount(lineCount);
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
box.setItemHeight(rowsHeight / lineCount);
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1540
|
+
// Makes count rows: only these rows exist, they show the records from startedItemIndexForScrolling.
|
|
1541
|
+
// (fitLineCount: 1 makes the count again when the size of the table changes.)
|
|
1542
|
+
box.setItemLineCount = function (count) {
|
|
1543
|
+
|
|
1544
|
+
box.itemLineCount = Math.max(1, Math.round(count));
|
|
1545
|
+
box.createItemLines();
|
|
1546
|
+
|
|
1547
|
+
const rowsHeight = getRowsHeight();
|
|
1548
|
+
const hasRowsHeight = box.recalcItemHeight && rowsHeight > 0;
|
|
1549
|
+
box.setItemHeight(hasRowsHeight ? rowsHeight / box.itemLineCount : box.itemHeight);
|
|
1550
|
+
|
|
1551
|
+
box.stretchLastCell(box.calcLastCellWidth());
|
|
1552
|
+
box.startedItemIndexForScrolling = clampScrollIndex(box.startedItemIndexForScrolling);
|
|
1553
|
+
scrollToSelected();
|
|
1554
|
+
box.initScrollMetrics();
|
|
1555
|
+
box.syncScrollPosition();
|
|
1556
|
+
box.refreshData();
|
|
1557
|
+
|
|
1558
|
+
};
|
|
1559
|
+
// USAGE: smartTable.setItemLineCount(20)
|
|
1560
|
+
|
|
1561
|
+
box.setFitLineCount = function (value) {
|
|
1562
|
+
box.fitLineCount = basic.isOn(value) ? 1 : 0;
|
|
1563
|
+
refreshLayout();
|
|
1564
|
+
};
|
|
1565
|
+
// USAGE: smartTable.setFitLineCount(1)
|
|
1566
|
+
|
|
1567
|
+
box.createResizeEvent = function () {
|
|
1194
1568
|
|
|
1195
1569
|
box.onResize(function (self) {
|
|
1196
|
-
box.resizeTimer = waitAndRun(box.resizeTimer,
|
|
1570
|
+
box.resizeTimer = waitAndRun(box.resizeTimer, refreshLayout, RESIZE_DELAY);
|
|
1197
1571
|
});
|
|
1198
1572
|
|
|
1199
1573
|
};
|
|
@@ -1213,7 +1587,7 @@ const SmartTable = function (params = {}) {
|
|
|
1213
1587
|
|
|
1214
1588
|
// CREATE the structure:
|
|
1215
1589
|
|
|
1216
|
-
//
|
|
1590
|
+
// Title and Item Line Group Container
|
|
1217
1591
|
box.boxHorizontalScrollable = VGroup({
|
|
1218
1592
|
align: "top left",
|
|
1219
1593
|
width: "auto",
|
|
@@ -1248,7 +1622,7 @@ const SmartTable = function (params = {}) {
|
|
|
1248
1622
|
|
|
1249
1623
|
endGroup();
|
|
1250
1624
|
|
|
1251
|
-
// Item
|
|
1625
|
+
// Item Line Group
|
|
1252
1626
|
box.boxItemLineGroup = VGroup({
|
|
1253
1627
|
align: "top left",
|
|
1254
1628
|
width: "auto",
|
|
@@ -1261,7 +1635,7 @@ const SmartTable = function (params = {}) {
|
|
|
1261
1635
|
|
|
1262
1636
|
endGroup();
|
|
1263
1637
|
|
|
1264
|
-
endGroup(); //
|
|
1638
|
+
endGroup(); // Title and Item Line Group Container
|
|
1265
1639
|
|
|
1266
1640
|
box.boxInfoLine = HGroup({
|
|
1267
1641
|
bottom: 0,
|
|
@@ -1309,13 +1683,194 @@ const SmartTable = function (params = {}) {
|
|
|
1309
1683
|
box.createTitleLine();
|
|
1310
1684
|
box.createItemLines();
|
|
1311
1685
|
box.createScrollEvents();
|
|
1686
|
+
box.on("keydown", onKeyDown);
|
|
1687
|
+
box.on("focus", paintFocus);
|
|
1688
|
+
box.on("blur", paintFocus);
|
|
1689
|
+
applyCanSelect();
|
|
1312
1690
|
box.stretchLastCell(box.calcLastCellWidth());
|
|
1313
1691
|
box.updateSortIcon();
|
|
1314
1692
|
box.updateSearchTitleSelect();
|
|
1315
|
-
// Add test data WHY
|
|
1693
|
+
// Add test data. WHY before filterAndSortData: the records are sorted before they are shown, and big data shows the loading.
|
|
1316
1694
|
if (box.fillTestData) box.generateTestData();
|
|
1317
1695
|
box.filterAndSortData();
|
|
1318
1696
|
|
|
1319
1697
|
return endObject(box);
|
|
1320
1698
|
|
|
1321
|
-
};
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
// The text of a cell (and of the keyword) for the filter: lowercase in Turkish ("İ" -> "i", not "i" + a dot), without
|
|
1702
|
+
// the marks of the letters, "ı" as "i" (as DataTable.toSearchText).
|
|
1703
|
+
// WHY: toLowerCase() made "İstanbul" "i̇stanbul": the keyword "istanbul" found nothing.
|
|
1704
|
+
// WHY the fast way: most texts have no letter outside ASCII after the lowercase, and a table can have 100 000 rows.
|
|
1705
|
+
SmartTable.toSearchText = function (value) {
|
|
1706
|
+
const text = String(value).toLocaleLowerCase("tr");
|
|
1707
|
+
if (!SmartTable.NOT_ASCII.test(text)) return text;
|
|
1708
|
+
return text.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/ı/g, "i");
|
|
1709
|
+
};
|
|
1710
|
+
SmartTable.NOT_ASCII = /[^\u0000-\u007f]/;
|
|
1711
|
+
|
|
1712
|
+
// *** STYLE PACKAGES:
|
|
1713
|
+
// USAGE: SmartTable({ styleName: "dark" })
|
|
1714
|
+
// USAGE: SmartTable({ styleName: "dark", style: { lblItemCell: { fontSize: 14 } } }) // Change only some keys.
|
|
1715
|
+
// NOTE: A package is a package of params (it has a "style" key): its other keys (searchInputParams, scrollBarParams,
|
|
1716
|
+
// searchTitleMenuParams) fill the params you did not give. A new package needs only the keys that differ from
|
|
1717
|
+
// the classic look (SmartTableDefaults).
|
|
1718
|
+
SmartTable.styles = {
|
|
1719
|
+
|
|
1720
|
+
// The look of DataTable "light": a light gray title line, striped rows, a soft yellow row under the mouse and
|
|
1721
|
+
// a stronger one for the selected row; the filter box is the SearchInput "ozden". (SmartTableDefaults)
|
|
1722
|
+
light: { style: {} },
|
|
1723
|
+
|
|
1724
|
+
// The look of DataTable "dark", for a dark page; the filter box is the SearchInput "ozdenDark", the column list
|
|
1725
|
+
// is the ContextMenu "dark".
|
|
1726
|
+
dark: {
|
|
1727
|
+
style: {
|
|
1728
|
+
line1Color: "#232428",
|
|
1729
|
+
line2Color: "#27292D",
|
|
1730
|
+
highlightItemCellColor: "#2E3035",
|
|
1731
|
+
selectedItemCellColor: "#24383A",
|
|
1732
|
+
focusRingColor: "rgba(95, 179, 181, 0.7)",
|
|
1733
|
+
highlightTitleCellColor: "#33353A",
|
|
1734
|
+
// WHY its own icon: invertIconColor turns only the sort and the up / down arrows
|
|
1735
|
+
btnScrollCenterIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#FFFFFF" stroke-opacity="0.5" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),
|
|
1736
|
+
searchTitleCheckIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#E6E6E6" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),
|
|
1737
|
+
invertIconColor: 1,
|
|
1738
|
+
sortIcon: { size: 16, opacity: 0.3, activeOpacity: 1 },
|
|
1739
|
+
cellTooltip: { color: "#2B2D31", textColor: "rgba(255, 255, 255, 0.88)", borderColor: "rgba(255, 255, 255, 0.14)", shadow: "0 8px 24px rgba(0, 0, 0, 0.5)" },
|
|
1740
|
+
box: { color: "#232428" },
|
|
1741
|
+
boxBorder: { border: 1, borderColor: "rgba(255, 255, 255, 0.12)" },
|
|
1742
|
+
boxTitleLine: { color: "#2B2D31" },
|
|
1743
|
+
boxTitleCell: { borderRight: "1px solid rgba(255, 255, 255, 0.08)", borderBottom: "1px solid rgba(255, 255, 255, 0.14)" },
|
|
1744
|
+
lblTitleCell: { textColor: "rgba(255, 255, 255, 0.85)" },
|
|
1745
|
+
boxItemCell: { borderBottom: "1px solid rgba(255, 255, 255, 0.06)" },
|
|
1746
|
+
lblItemCell: { textColor: "rgba(255, 255, 255, 0.75)" },
|
|
1747
|
+
boxInfoLine: { color: "#232428", borderTop: "1px solid rgba(255, 255, 255, 0.14)" },
|
|
1748
|
+
lblBoxInfoLine: { textColor: "rgba(255, 255, 255, 0.5)" },
|
|
1749
|
+
lblNoDataFound: { textColor: "rgba(255, 255, 255, 0.45)" },
|
|
1750
|
+
lblSearchTitle: { color: "#33353A", textColor: "rgba(255, 255, 255, 0.7)", borderColor: "rgba(255, 255, 255, 0.14)" },
|
|
1751
|
+
btnScrollCenter: { color: "#2B2D31", borderColor: "rgba(255, 255, 255, 0.2)" },
|
|
1752
|
+
btnScrollUp: { color: "#2B2D31", borderColor: "rgba(255, 255, 255, 0.14)" },
|
|
1753
|
+
btnScrollDown: { color: "#2B2D31", borderColor: "rgba(255, 255, 255, 0.14)" },
|
|
1754
|
+
},
|
|
1755
|
+
searchInputParams: { styleName: "ozdenDark" },
|
|
1756
|
+
scrollBarParams: { bar_color: "#A0A0A0", bar_mouseOverColor: "#D0D0D0" },
|
|
1757
|
+
searchTitleMenuParams: { styleName: "dark" },
|
|
1758
|
+
},
|
|
1759
|
+
|
|
1760
|
+
// The green title line, a dark edge, big texts. Every
|
|
1761
|
+
// key is here: a page that changes some of them over this look (styleName: "green") gets the rest from it.
|
|
1762
|
+
green: {
|
|
1763
|
+
style: {
|
|
1764
|
+
width: "auto",
|
|
1765
|
+
height: "auto",
|
|
1766
|
+
round: 6,
|
|
1767
|
+
line1Color: "white",
|
|
1768
|
+
line2Color: "whitesmoke",
|
|
1769
|
+
highlightItemCellColor: "#F3E7C2",
|
|
1770
|
+
selectedItemCellColor: null, // null: highlightItemCellColor (the row under the mouse)
|
|
1771
|
+
selectedBar: { width: 3, color: "rgba(95, 158, 160, 0.9)" },
|
|
1772
|
+
focusRingColor: "rgba(95, 158, 160, 0.6)",
|
|
1773
|
+
highlightTitleCellColor: White(0.2),
|
|
1774
|
+
titleUppercase: 0,
|
|
1775
|
+
verticalScrollWidth: 20,
|
|
1776
|
+
verticalScrollMargin: 2,
|
|
1777
|
+
btnScrollDownIconFile: SmartTableDefaults.style.btnScrollDownIconFile,
|
|
1778
|
+
btnScrollUpIconFile: SmartTableDefaults.style.btnScrollUpIconFile,
|
|
1779
|
+
btnScrollCenterIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#D96450" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 28V172M27 41L40 28L53 41M27 159L40 172L53 159"/></svg>'), // a red line with two heads
|
|
1780
|
+
sortIconFile: "data:image/svg+xml;utf8," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 24V56M27 43L40 56L53 43"/></svg>'), // an arrow down
|
|
1781
|
+
loadingIconFile: SmartTableDefaults.style.loadingIconFile,
|
|
1782
|
+
searchTitleCheckIconFile: "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),
|
|
1783
|
+
invertIconColor: 0,
|
|
1784
|
+
sortIcon: { size: 22, opacity: 0.5, activeOpacity: 1 },
|
|
1785
|
+
box: { color: "white" },
|
|
1786
|
+
boxBorder: { border: 2, borderColor: Black(0.8) },
|
|
1787
|
+
boxTitleLine: { color: "#65A293" },
|
|
1788
|
+
boxTitleCell: { padding: [8, 0], borderRight: "1px solid rgba(0, 0, 0, 0.5)", borderBottom: "2px solid #141414" },
|
|
1789
|
+
lblTitleCell: { fontSize: 20, fontFamily: "opensans", textColor: Black(0.8) },
|
|
1790
|
+
boxItemCell: { borderBottom: "1px solid darkgray", borderRight: "1px solid rgba(0, 0, 0, 0.05)", padding: [8, 0] },
|
|
1791
|
+
lblItemCell: { fontSize: 20, textColor: Black(0.75), fontFamily: "opensans" },
|
|
1792
|
+
boxInfoLine: { color: "#E4E4E4", borderTop: "1px solid rgba(0, 0, 0, 0)" },
|
|
1793
|
+
lblBoxInfoLine: { fontSize: 16, textColor: Black(0.85) },
|
|
1794
|
+
lblNoDataFound: { color: "lightgray", textColor: Black(0.8), padding: [8, 2], fontSize: 14, round: 8, border: 1, borderColor: Black(0.4) },
|
|
1795
|
+
// (whitesmoke, as the pale lines of the table; the edge of the filter box)
|
|
1796
|
+
lblSearchTitle: { color: "whitesmoke", textColor: Black(0.8), padding: [8, 2], fontSize: 14, round: 8, border: 1, borderColor: Black(0.15) },
|
|
1797
|
+
btnScrollCenter: { color: "white", round: 100, border: 1, borderColor: "rgba(0,0,0,0.4)" },
|
|
1798
|
+
btnScrollUp: { color: "lightgray", round: 100, border: 1, borderColor: "rgba(0, 0, 0, 0.6)" },
|
|
1799
|
+
btnScrollDown: { color: "lightgray", round: 100, border: 1, borderColor: "rgba(0, 0, 0, 0.6)" },
|
|
1800
|
+
boxSort: { color: "#65A293" },
|
|
1801
|
+
},
|
|
1802
|
+
searchInputParams: {
|
|
1803
|
+
styleName: "original", // the first look of SearchInput
|
|
1804
|
+
width: "50%",
|
|
1805
|
+
height: 36,
|
|
1806
|
+
border: 1,
|
|
1807
|
+
round: 8,
|
|
1808
|
+
color: "white",
|
|
1809
|
+
searchIconSize: 16,
|
|
1810
|
+
placeholder: "Filter",
|
|
1811
|
+
fontSize: 16,
|
|
1812
|
+
borderColor: Black(0.15), // (light edges in the filter)
|
|
1813
|
+
borderBottomStyle: "1px solid " + Black(0.15),
|
|
1814
|
+
searchIconFile: SmartTableDefaults.searchInputParams.searchIconFile,
|
|
1815
|
+
searchIconOpacity: 0.8, // (a softer filter icon, in tune with the edges)
|
|
1816
|
+
},
|
|
1817
|
+
},
|
|
1818
|
+
|
|
1819
|
+
};
|
|
1820
|
+
SmartTable.styles.classic = SmartTable.styles.light; // the old name of light: the pages made with it keep their look
|
|
1821
|
+
|
|
1822
|
+
// The minimal theme (_designs/minimal-theme.htm): small (28 px rows, 30 px titles, a 13 px text), on the ground of the
|
|
1823
|
+
// window with a line around it; no stripes, thin lines between the rows, a soft title over a line, a faint row under
|
|
1824
|
+
// the mouse, a 2 px ink line at the left of the selected row. minimalDark: the same on a dark window.
|
|
1825
|
+
// WHY faint fills for the rows: a row of SmartTable is its cells (a line around a row needs a row box).
|
|
1826
|
+
SmartTable.createMinimalStyle = function (colors) {
|
|
1827
|
+
return {
|
|
1828
|
+
titleHeight: 30,
|
|
1829
|
+
itemHeight: 28,
|
|
1830
|
+
infoHeight: 28,
|
|
1831
|
+
style: Object.assign({
|
|
1832
|
+
round: 4,
|
|
1833
|
+
line1Color: colors.ground,
|
|
1834
|
+
line2Color: colors.ground,
|
|
1835
|
+
highlightItemCellColor: colors.hover,
|
|
1836
|
+
selectedItemCellColor: colors.selected,
|
|
1837
|
+
selectedBar: { width: 2, color: colors.ink },
|
|
1838
|
+
focusRingColor: colors.focus,
|
|
1839
|
+
highlightTitleCellColor: colors.ground,
|
|
1840
|
+
titleUppercase: 0,
|
|
1841
|
+
invertIconColor: colors.invertIcons,
|
|
1842
|
+
sortIcon: { size: 14, opacity: 0.3, activeOpacity: 1 },
|
|
1843
|
+
cellTooltip: { fontSize: 12, color: colors.ground, textColor: colors.text, round: 4, border: 1, borderColor: colors.line, shadow: "none" },
|
|
1844
|
+
box: { color: colors.ground },
|
|
1845
|
+
boxBorder: { border: 1, borderColor: colors.line },
|
|
1846
|
+
boxTitleLine: { color: colors.ground },
|
|
1847
|
+
boxTitleCell: { padding: [10, 0], borderRight: "none", borderBottom: "1px solid " + colors.line },
|
|
1848
|
+
lblTitleCell: { fontSize: 12, fontFamily: "opensans-bold", textColor: colors.softText },
|
|
1849
|
+
boxItemCell: { borderBottom: "1px solid " + colors.track, borderRight: "none", padding: [10, 0] },
|
|
1850
|
+
lblItemCell: { fontSize: 13, textColor: colors.text, fontFamily: "opensans" },
|
|
1851
|
+
boxInfoLine: { color: colors.ground, borderTop: "1px solid " + colors.line },
|
|
1852
|
+
lblBoxInfoLine: { fontSize: 12, textColor: colors.softText },
|
|
1853
|
+
lblNoDataFound: { color: "transparent", textColor: colors.softText, fontSize: 12 },
|
|
1854
|
+
lblSearchTitle: { color: "transparent", textColor: colors.softText, fontSize: 11, border: 0, borderColor: "transparent" }, // WHY no edge: a pill in the 22 px filter box met its edge
|
|
1855
|
+
btnScrollCenter: { color: colors.ground, borderColor: colors.line },
|
|
1856
|
+
btnScrollUp: { color: colors.ground, borderColor: colors.line },
|
|
1857
|
+
btnScrollDown: { color: colors.ground, borderColor: colors.line },
|
|
1858
|
+
}, colors.icons),
|
|
1859
|
+
// WHY its sizes: the filter box of the default is 36 px high, more than the 28 px line of the minimal table
|
|
1860
|
+
searchInputParams: { styleName: colors.minimalName, height: 22, fontSize: 12, searchIconSize: 12, searchIconLeft: 8 },
|
|
1861
|
+
scrollBarParams: { bar_color: colors.scrollBar, bar_mouseOverColor: colors.scrollBar, bar_width: 3 },
|
|
1862
|
+
searchTitleMenuParams: { styleName: colors.minimalName },
|
|
1863
|
+
};
|
|
1864
|
+
};
|
|
1865
|
+
SmartTable.MINIMAL_COLORS = {
|
|
1866
|
+
ground: "#FFFFFF", text: Black(0.85), softText: Black(0.55), line: Black(0.2), track: Black(0.08), hover: Black(0.03),
|
|
1867
|
+
selected: Black(0.06), ink: "#1F1F1F", focus: "#3D8BD9", scrollBar: "#9A9A98", invertIcons: 0, minimalName: "minimal", icons: {},
|
|
1868
|
+
};
|
|
1869
|
+
SmartTable.styles.minimal = SmartTable.createMinimalStyle(SmartTable.MINIMAL_COLORS);
|
|
1870
|
+
SmartTable.MINIMAL_DARK_COLORS = {
|
|
1871
|
+
ground: "#1A1A19", text: White(0.88), softText: White(0.55), line: White(0.18), track: White(0.08), hover: White(0.04),
|
|
1872
|
+
selected: White(0.08), ink: "#EDEDEB", focus: "#7FB6DE", scrollBar: "#A0A0A0", invertIcons: 1, minimalName: "minimalDark",
|
|
1873
|
+
// WHY the icons of dark: invertIconColor turns only the sort and the up / down arrows
|
|
1874
|
+
icons: { btnScrollCenterIconFile: SmartTable.styles.dark.style.btnScrollCenterIconFile, searchTitleCheckIconFile: SmartTable.styles.dark.style.searchTitleCheckIconFile },
|
|
1875
|
+
};
|
|
1876
|
+
SmartTable.styles.minimalDark = SmartTable.createMinimalStyle(SmartTable.MINIMAL_DARK_COLORS);
|