@lowdefy/blocks-antd 5.6.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TagPillRow.js +88 -0
- package/dist/blocks/Affix/gallery.yaml +399 -0
- package/dist/blocks/Affix/tests/Affix.e2e.yaml +72 -0
- package/dist/blocks/Affix/tests.yaml +29 -0
- package/dist/blocks/Alert/gallery.yaml +701 -0
- package/dist/blocks/Alert/tests/Alert.e2e.yaml +161 -0
- package/dist/blocks/Alert/tests.yaml +261 -0
- package/dist/blocks/AutoComplete/gallery.yaml +713 -0
- package/dist/blocks/AutoComplete/tests/AutoComplete.e2e.yaml +330 -0
- package/dist/blocks/AutoComplete/tests.yaml +178 -0
- package/dist/blocks/Avatar/gallery.yaml +1037 -0
- package/dist/blocks/Avatar/tests/Avatar.e2e.yaml +125 -0
- package/dist/blocks/Avatar/tests.yaml +76 -0
- package/dist/blocks/Badge/gallery.yaml +1090 -0
- package/dist/blocks/Badge/tests/Badge.e2e.yaml +195 -0
- package/dist/blocks/Badge/tests.yaml +91 -0
- package/dist/blocks/Breadcrumb/gallery.yaml +484 -0
- package/dist/blocks/Breadcrumb/tests/Breadcrumb.e2e.yaml +165 -0
- package/dist/blocks/Breadcrumb/tests.yaml +106 -0
- package/dist/blocks/Button/Button.js +11 -2
- package/dist/blocks/Button/gallery.yaml +718 -0
- package/dist/blocks/Button/meta.js +4 -0
- package/dist/blocks/Button/tests/Button.e2e.yaml +246 -0
- package/dist/blocks/Button/tests.yaml +109 -0
- package/dist/blocks/ButtonSelector/gallery.yaml +891 -0
- package/dist/blocks/ButtonSelector/tests/ButtonSelector.e2e.yaml +188 -0
- package/dist/blocks/ButtonSelector/tests.yaml +167 -0
- package/dist/blocks/Calendar/gallery.yaml +128 -0
- package/dist/blocks/Calendar/tests/Calendar.e2e.yaml +136 -0
- package/dist/blocks/Calendar/tests.yaml +50 -0
- package/dist/blocks/Card/gallery.yaml +1035 -0
- package/dist/blocks/Card/tests/Card.e2e.yaml +209 -0
- package/dist/blocks/Card/tests.yaml +75 -0
- package/dist/blocks/Carousel/gallery.yaml +1971 -0
- package/dist/blocks/Carousel/tests/Carousel.e2e.yaml +211 -0
- package/dist/blocks/Carousel/tests.yaml +117 -0
- package/dist/blocks/CheckboxSelector/gallery.yaml +781 -0
- package/dist/blocks/CheckboxSelector/tests/CheckboxSelector.e2e.yaml +272 -0
- package/dist/blocks/CheckboxSelector/tests.yaml +325 -0
- package/dist/blocks/CheckboxSwitch/gallery.yaml +457 -0
- package/dist/blocks/CheckboxSwitch/tests/CheckboxSwitch.e2e.yaml +126 -0
- package/dist/blocks/CheckboxSwitch/tests.yaml +96 -0
- package/dist/blocks/Collapse/gallery.yaml +1079 -0
- package/dist/blocks/Collapse/tests/Collapse.e2e.yaml +206 -0
- package/dist/blocks/Collapse/tests.yaml +265 -0
- package/dist/blocks/ColorSelector/gallery.yaml +807 -0
- package/dist/blocks/ColorSelector/tests/ColorSelector.e2e.yaml +77 -0
- package/dist/blocks/ColorSelector/tests.yaml +84 -0
- package/dist/blocks/ConfigProvider/gallery.yaml +1003 -0
- package/dist/blocks/ConfigProvider/tests.yaml +62 -0
- package/dist/blocks/ConfirmModal/gallery.yaml +1043 -0
- package/dist/blocks/ConfirmModal/tests/ConfirmModal.e2e.yaml +410 -0
- package/dist/blocks/ConfirmModal/tests.yaml +95 -0
- package/dist/blocks/Content/gallery.yaml +528 -0
- package/dist/blocks/Content/tests/Content.e2e.yaml +71 -0
- package/dist/blocks/Content/tests.yaml +42 -0
- package/dist/blocks/ControlledList/ControlledList.js +1 -1
- package/dist/blocks/ControlledList/gallery.yaml +481 -0
- package/dist/blocks/ControlledList/{style.module.css → style.css} +3 -3
- package/dist/blocks/ControlledList/tests/ControlledList.e2e.yaml +161 -0
- package/dist/blocks/ControlledList/tests.yaml +57 -0
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +7 -0
- package/dist/blocks/DateRangeSelector/e2e.js +28 -2
- package/dist/blocks/DateRangeSelector/gallery.yaml +858 -0
- package/dist/blocks/DateRangeSelector/meta.js +2 -0
- package/dist/blocks/DateRangeSelector/tests/DateRangeSelector.e2e.yaml +204 -0
- package/dist/blocks/DateRangeSelector/tests.yaml +129 -0
- package/dist/blocks/DateSelector/DateSelector.js +6 -0
- package/dist/blocks/DateSelector/e2e.js +28 -2
- package/dist/blocks/DateSelector/gallery.yaml +691 -0
- package/dist/blocks/DateSelector/meta.js +6 -0
- package/dist/blocks/DateSelector/tests/DateSelector.e2e.yaml +229 -0
- package/dist/blocks/DateSelector/tests.yaml +117 -0
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +7 -0
- package/dist/blocks/DateTimeSelector/e2e.js +26 -2
- package/dist/blocks/DateTimeSelector/gallery.yaml +770 -0
- package/dist/blocks/DateTimeSelector/meta.js +2 -0
- package/dist/blocks/DateTimeSelector/tests/DateTimeSelector.e2e.yaml +163 -0
- package/dist/blocks/DateTimeSelector/tests.yaml +140 -0
- package/dist/blocks/Descriptions/gallery.yaml +839 -0
- package/dist/blocks/Descriptions/tests/Descriptions.e2e.yaml +143 -0
- package/dist/blocks/Descriptions/tests.yaml +256 -0
- package/dist/blocks/Divider/gallery.yaml +375 -0
- package/dist/blocks/Divider/tests/Divider.e2e.yaml +107 -0
- package/dist/blocks/Divider/tests.yaml +58 -0
- package/dist/blocks/Drawer/gallery.yaml +1257 -0
- package/dist/blocks/Drawer/tests/Drawer.e2e.yaml +562 -0
- package/dist/blocks/Drawer/tests.yaml +80 -0
- package/dist/blocks/DropdownButton/gallery.yaml +606 -0
- package/dist/blocks/DropdownButton/tests/DropdownButton.e2e.yaml +243 -0
- package/dist/blocks/DropdownMenu/gallery.yaml +578 -0
- package/dist/blocks/DropdownMenu/tests/DropdownMenu.e2e.yaml +267 -0
- package/dist/blocks/Flex/gallery.yaml +1416 -0
- package/dist/blocks/Flex/tests/Flex.e2e.yaml +95 -0
- package/dist/blocks/Flex/tests.yaml +92 -0
- package/dist/blocks/FloatButton/gallery.yaml +518 -0
- package/dist/blocks/FloatButton/tests/FloatButton.e2e.yaml +73 -0
- package/dist/blocks/FloatButton/tests.yaml +59 -0
- package/dist/blocks/Footer/gallery.yaml +355 -0
- package/dist/blocks/Footer/tests/Footer.e2e.yaml +70 -0
- package/dist/blocks/Footer/tests.yaml +28 -0
- package/dist/blocks/Header/gallery.yaml +249 -0
- package/dist/blocks/Header/tests/Header.e2e.yaml +77 -0
- package/dist/blocks/Header/tests.yaml +36 -0
- package/dist/blocks/Label/Label.js +1 -1
- package/dist/blocks/Label/gallery.yaml +762 -0
- package/dist/blocks/Label/{style.module.css → style.css} +28 -28
- package/dist/blocks/Label/tests/Label.e2e.yaml +247 -0
- package/dist/blocks/Label/tests.yaml +212 -0
- package/dist/blocks/Layout/gallery.yaml +548 -0
- package/dist/blocks/Layout/tests/Layout.e2e.yaml +86 -0
- package/dist/blocks/Layout/tests.yaml +28 -0
- package/dist/blocks/ListSelector/gallery.yaml +223 -0
- package/dist/blocks/Masonry/gallery.yaml +989 -0
- package/dist/blocks/Masonry/tests/Masonry.e2e.yaml +128 -0
- package/dist/blocks/Masonry/tests.yaml +42 -0
- package/dist/blocks/MasonryList/gallery.yaml +224 -0
- package/dist/blocks/MasonryList/tests/MasonryList.e2e.yaml +55 -0
- package/dist/blocks/MasonryList/tests.yaml +42 -0
- package/dist/blocks/Menu/gallery.yaml +974 -0
- package/dist/blocks/Menu/tests/Menu.e2e.yaml +484 -0
- package/dist/blocks/Menu/tests.yaml +1053 -0
- package/dist/blocks/Message/gallery.yaml +860 -0
- package/dist/blocks/Message/tests/Message.e2e.yaml +246 -0
- package/dist/blocks/Message/tests.yaml +54 -0
- package/dist/blocks/MobileMenu/gallery.yaml +1172 -0
- package/dist/blocks/MobileMenu/tests/MobileMenu.e2e.yaml +314 -0
- package/dist/blocks/MobileMenu/tests.yaml +359 -0
- package/dist/blocks/Modal/gallery.yaml +1039 -0
- package/dist/blocks/Modal/tests/Modal.e2e.yaml +493 -0
- package/dist/blocks/Modal/tests.yaml +75 -0
- package/dist/blocks/MonthSelector/MonthSelector.js +6 -0
- package/dist/blocks/MonthSelector/e2e.js +26 -2
- package/dist/blocks/MonthSelector/gallery.yaml +687 -0
- package/dist/blocks/MonthSelector/meta.js +6 -0
- package/dist/blocks/MonthSelector/tests/MonthSelector.e2e.yaml +167 -0
- package/dist/blocks/MonthSelector/tests.yaml +124 -0
- package/dist/blocks/MultipleSelector/gallery.yaml +1245 -0
- package/dist/blocks/MultipleSelector/tests/MultipleSelector.e2e.yaml +445 -0
- package/dist/blocks/MultipleSelector/tests.yaml +201 -0
- package/dist/blocks/Notification/gallery.yaml +1376 -0
- package/dist/blocks/Notification/tests/Notification.e2e.yaml +362 -0
- package/dist/blocks/Notification/tests.yaml +97 -0
- package/dist/blocks/NumberInput/gallery.yaml +753 -0
- package/dist/blocks/NumberInput/tests/NumberInput.e2e.yaml +228 -0
- package/dist/blocks/NumberInput/tests.yaml +116 -0
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +1 -1
- package/dist/blocks/PageHeaderMenu/gallery.yaml +480 -0
- package/dist/blocks/PageHeaderMenu/tests/PageHeaderMenu.e2e.yaml +110 -0
- package/dist/blocks/PageHeaderMenu/tests.yaml +173 -0
- package/dist/blocks/PageSidebarLayout/PageSidebarLayout.js +10 -1
- package/dist/blocks/PageSidebarLayout/gallery.yaml +302 -0
- package/dist/blocks/PageSidebarLayout/meta.js +1 -0
- package/dist/blocks/PageSidebarLayout/tests/PageSidebarLayout.e2e.yaml +216 -0
- package/dist/blocks/PageSidebarLayout/tests.yaml +174 -0
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +1 -1
- package/dist/blocks/PageSiderMenu/gallery.yaml +516 -0
- package/dist/blocks/PageSiderMenu/tests/PageSiderMenu.e2e.yaml +175 -0
- package/dist/blocks/PageSiderMenu/tests.yaml +211 -0
- package/dist/blocks/Pagination/gallery.yaml +503 -0
- package/dist/blocks/Pagination/tests/Pagination.e2e.yaml +159 -0
- package/dist/blocks/Pagination/tests.yaml +80 -0
- package/dist/blocks/Paragraph/gallery.yaml +458 -0
- package/dist/blocks/Paragraph/tests/Paragraph.e2e.yaml +153 -0
- package/dist/blocks/Paragraph/tests.yaml +176 -0
- package/dist/blocks/ParagraphInput/gallery.yaml +1483 -0
- package/dist/blocks/ParagraphInput/tests/ParagraphInput.e2e.yaml +189 -0
- package/dist/blocks/ParagraphInput/tests.yaml +163 -0
- package/dist/blocks/PasswordInput/gallery.yaml +420 -0
- package/dist/blocks/PasswordInput/tests/PasswordInput.e2e.yaml +188 -0
- package/dist/blocks/PasswordInput/tests.yaml +78 -0
- package/dist/blocks/PhoneNumberInput/gallery.yaml +677 -0
- package/dist/blocks/PhoneNumberInput/tests/PhoneNumberInput.e2e.yaml +279 -0
- package/dist/blocks/PhoneNumberInput/tests.yaml +25 -0
- package/dist/blocks/Popover/gallery.yaml +1301 -0
- package/dist/blocks/Popover/tests/Popover.e2e.yaml +249 -0
- package/dist/blocks/Popover/tests.yaml +105 -0
- package/dist/blocks/Progress/gallery.yaml +772 -0
- package/dist/blocks/Progress/tests/Progress.e2e.yaml +167 -0
- package/dist/blocks/Progress/tests.yaml +114 -0
- package/dist/blocks/QRCode/gallery.yaml +492 -0
- package/dist/blocks/QRCode/tests/QRCode.e2e.yaml +66 -0
- package/dist/blocks/QRCode/tests.yaml +113 -0
- package/dist/blocks/RadioSelector/gallery.yaml +816 -0
- package/dist/blocks/RadioSelector/tests/RadioSelector.e2e.yaml +269 -0
- package/dist/blocks/RadioSelector/tests.yaml +339 -0
- package/dist/blocks/RatingSlider/gallery.yaml +627 -0
- package/dist/blocks/RatingSlider/tests/RatingSlider.e2e.yaml +188 -0
- package/dist/blocks/RatingSlider/tests.yaml +116 -0
- package/dist/blocks/Result/gallery.yaml +925 -0
- package/dist/blocks/Result/tests/Result.e2e.yaml +126 -0
- package/dist/blocks/Result/tests.yaml +75 -0
- package/dist/blocks/Search/Search.js +1 -1
- package/dist/blocks/Search/SearchModal.js +18 -9
- package/dist/blocks/Search/gallery.yaml +170 -0
- package/dist/blocks/Search/meta.js +2 -1
- package/dist/blocks/Search/{style.module.css → style.css} +19 -12
- package/dist/blocks/Search/tests/Search.e2e.yaml +125 -0
- package/dist/blocks/Search/useSearchIndex.js +24 -2
- package/dist/blocks/SegmentedSelector/gallery.yaml +725 -0
- package/dist/blocks/SegmentedSelector/tests/SegmentedSelector.e2e.yaml +115 -0
- package/dist/blocks/SegmentedSelector/tests.yaml +141 -0
- package/dist/blocks/Selector/gallery.yaml +1055 -0
- package/dist/blocks/Selector/tests/Selector.e2e.yaml +427 -0
- package/dist/blocks/Selector/tests.yaml +196 -0
- package/dist/blocks/Sider/gallery.yaml +994 -0
- package/dist/blocks/Sider/tests/Sider.e2e.yaml +162 -0
- package/dist/blocks/Sider/tests.yaml +20 -0
- package/dist/blocks/Slider/gallery.yaml +600 -0
- package/dist/blocks/Slider/tests/Slider.e2e.yaml +190 -0
- package/dist/blocks/Slider/tests.yaml +68 -0
- package/dist/blocks/Splitter/gallery.yaml +1511 -0
- package/dist/blocks/Splitter/tests/Splitter.e2e.yaml +114 -0
- package/dist/blocks/Splitter/tests.yaml +79 -0
- package/dist/blocks/Statistic/gallery.yaml +460 -0
- package/dist/blocks/Statistic/tests/Statistic.e2e.yaml +137 -0
- package/dist/blocks/Statistic/tests.yaml +77 -0
- package/dist/blocks/Steps/gallery.yaml +550 -0
- package/dist/blocks/Switch/gallery.yaml +502 -0
- package/dist/blocks/Switch/tests/Switch.e2e.yaml +132 -0
- package/dist/blocks/Switch/tests.yaml +87 -0
- package/dist/blocks/Tabs/gallery.yaml +1353 -0
- package/dist/blocks/Tabs/tests/Tabs.e2e.yaml +370 -0
- package/dist/blocks/Tabs/tests.yaml +349 -0
- package/dist/blocks/Tag/gallery.yaml +598 -0
- package/dist/blocks/Tag/tests/Tag.e2e.yaml +173 -0
- package/dist/blocks/Tag/tests.yaml +51 -0
- package/dist/blocks/TagMultipleSelector/TagMultipleSelector.js +53 -0
- package/dist/blocks/TagMultipleSelector/e2e.js +36 -0
- package/dist/blocks/TagMultipleSelector/gallery.yaml +70 -0
- package/dist/blocks/TagMultipleSelector/meta.js +91 -0
- package/dist/blocks/TagMultipleSelector/tests/TagMultipleSelector.e2e.yaml +93 -0
- package/dist/blocks/TagSelector/TagSelector.js +49 -0
- package/dist/blocks/TagSelector/e2e.js +36 -0
- package/dist/blocks/TagSelector/gallery.yaml +70 -0
- package/dist/blocks/TagSelector/meta.js +91 -0
- package/dist/blocks/TagSelector/tests/TagSelector.e2e.yaml +93 -0
- package/dist/blocks/TextArea/gallery.yaml +618 -0
- package/dist/blocks/TextArea/tests/TextArea.e2e.yaml +218 -0
- package/dist/blocks/TextArea/tests.yaml +100 -0
- package/dist/blocks/TextInput/gallery.yaml +560 -0
- package/dist/blocks/TextInput/tests/TextInput.e2e.yaml +287 -0
- package/dist/blocks/TextInput/tests.yaml +114 -0
- package/dist/blocks/TimelineList/gallery.yaml +431 -0
- package/dist/blocks/TimelineList/tests/TimelineList.e2e.yaml +244 -0
- package/dist/blocks/TimelineList/tests.yaml +251 -0
- package/dist/blocks/Title/gallery.yaml +483 -0
- package/dist/blocks/Title/tests/Title.e2e.yaml +180 -0
- package/dist/blocks/Title/tests.yaml +175 -0
- package/dist/blocks/TitleInput/gallery.yaml +1006 -0
- package/dist/blocks/TitleInput/tests/TitleInput.e2e.yaml +195 -0
- package/dist/blocks/TitleInput/tests.yaml +181 -0
- package/dist/blocks/Tooltip/gallery.yaml +1214 -0
- package/dist/blocks/Tooltip/tests/Tooltip.e2e.yaml +195 -0
- package/dist/blocks/Tooltip/tests.yaml +92 -0
- package/dist/blocks/Tour/gallery.yaml +2305 -0
- package/dist/blocks/Tour/tests/Tour.e2e.yaml +90 -0
- package/dist/blocks/Tour/tests.yaml +151 -0
- package/dist/blocks/TreeInput/gallery.yaml +78 -0
- package/dist/blocks/TreeInput/tests/TreeInput.e2e.yaml +139 -0
- package/dist/blocks/TreeInput/tests.yaml +140 -0
- package/dist/blocks/TreeMultipleSelector/gallery.yaml +67 -0
- package/dist/blocks/TreeSelector/gallery.yaml +81 -0
- package/dist/blocks/Watermark/gallery.yaml +479 -0
- package/dist/blocks/Watermark/tests/Watermark.e2e.yaml +62 -0
- package/dist/blocks/Watermark/tests.yaml +86 -0
- package/dist/blocks/WeekSelector/WeekSelector.js +6 -0
- package/dist/blocks/WeekSelector/e2e.js +26 -2
- package/dist/blocks/WeekSelector/gallery.yaml +589 -0
- package/dist/blocks/WeekSelector/meta.js +6 -0
- package/dist/blocks/WeekSelector/tests/WeekSelector.e2e.yaml +154 -0
- package/dist/blocks/WeekSelector/tests.yaml +122 -0
- package/dist/blocks.js +2 -0
- package/dist/disabledDate.js +91 -19
- package/dist/e2e.js +2 -0
- package/dist/getPresets.js +151 -0
- package/dist/getTagColor.js +44 -0
- package/dist/getTagSelectorOptions.js +30 -0
- package/dist/metas.js +2 -0
- package/dist/pickerPresetsStyle.css +26 -0
- package/dist/schemas/disabledDates.js +6 -2
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/presets.js +111 -0
- package/dist/tagSelectorStyle.css +68 -0
- package/package.json +13 -13
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
id: weekselector
|
|
16
|
+
type: Box
|
|
17
|
+
|
|
18
|
+
events:
|
|
19
|
+
onInit:
|
|
20
|
+
- id: set_defaults
|
|
21
|
+
type: SetState
|
|
22
|
+
params:
|
|
23
|
+
ws_with_value:
|
|
24
|
+
_date: '2024-06-10'
|
|
25
|
+
ws_clearable:
|
|
26
|
+
_date: '2024-01-08'
|
|
27
|
+
|
|
28
|
+
blocks:
|
|
29
|
+
# ============================================
|
|
30
|
+
# BASIC RENDERING
|
|
31
|
+
# ============================================
|
|
32
|
+
|
|
33
|
+
- id: ws_basic
|
|
34
|
+
type: WeekSelector
|
|
35
|
+
properties:
|
|
36
|
+
title: Basic Week
|
|
37
|
+
|
|
38
|
+
- id: ws_with_value
|
|
39
|
+
type: WeekSelector
|
|
40
|
+
properties:
|
|
41
|
+
title: With Value
|
|
42
|
+
|
|
43
|
+
# ============================================
|
|
44
|
+
# PROPERTY TESTS
|
|
45
|
+
# ============================================
|
|
46
|
+
|
|
47
|
+
- id: ws_disabled
|
|
48
|
+
type: WeekSelector
|
|
49
|
+
properties:
|
|
50
|
+
title: Disabled
|
|
51
|
+
disabled: true
|
|
52
|
+
|
|
53
|
+
- id: ws_small
|
|
54
|
+
type: WeekSelector
|
|
55
|
+
properties:
|
|
56
|
+
title: Small Size
|
|
57
|
+
size: small
|
|
58
|
+
|
|
59
|
+
- id: ws_large
|
|
60
|
+
type: WeekSelector
|
|
61
|
+
properties:
|
|
62
|
+
title: Large Size
|
|
63
|
+
size: large
|
|
64
|
+
|
|
65
|
+
- id: ws_placeholder
|
|
66
|
+
type: WeekSelector
|
|
67
|
+
properties:
|
|
68
|
+
title: Custom Placeholder
|
|
69
|
+
placeholder: Pick a week...
|
|
70
|
+
|
|
71
|
+
- id: ws_borderless
|
|
72
|
+
type: WeekSelector
|
|
73
|
+
properties:
|
|
74
|
+
title: Borderless
|
|
75
|
+
bordered: false
|
|
76
|
+
|
|
77
|
+
- id: ws_no_allowclear
|
|
78
|
+
type: WeekSelector
|
|
79
|
+
properties:
|
|
80
|
+
title: No Allow Clear
|
|
81
|
+
allowClear: false
|
|
82
|
+
|
|
83
|
+
- id: ws_with_title
|
|
84
|
+
type: WeekSelector
|
|
85
|
+
properties:
|
|
86
|
+
title: Week with Title
|
|
87
|
+
|
|
88
|
+
- id: ws_with_label
|
|
89
|
+
type: WeekSelector
|
|
90
|
+
properties:
|
|
91
|
+
title: Week Label
|
|
92
|
+
label:
|
|
93
|
+
extra: Select a week from the calendar
|
|
94
|
+
|
|
95
|
+
# ============================================
|
|
96
|
+
# EVENT TESTS
|
|
97
|
+
# ============================================
|
|
98
|
+
|
|
99
|
+
- id: ws_onchange
|
|
100
|
+
type: WeekSelector
|
|
101
|
+
properties:
|
|
102
|
+
title: OnChange Test
|
|
103
|
+
events:
|
|
104
|
+
onChange:
|
|
105
|
+
- id: set_onchange
|
|
106
|
+
type: SetState
|
|
107
|
+
params:
|
|
108
|
+
ws_onchange_value:
|
|
109
|
+
_event: value
|
|
110
|
+
|
|
111
|
+
- id: ws_onchange_display
|
|
112
|
+
type: Span
|
|
113
|
+
properties:
|
|
114
|
+
content:
|
|
115
|
+
_if:
|
|
116
|
+
test:
|
|
117
|
+
_ne:
|
|
118
|
+
- _state: ws_onchange_value
|
|
119
|
+
- null
|
|
120
|
+
then: Week selected
|
|
121
|
+
else: ''
|
|
122
|
+
|
|
123
|
+
# ============================================
|
|
124
|
+
# INTERACTION TESTS
|
|
125
|
+
# ============================================
|
|
126
|
+
|
|
127
|
+
- id: ws_interaction
|
|
128
|
+
type: WeekSelector
|
|
129
|
+
properties:
|
|
130
|
+
title: Interaction Test
|
|
131
|
+
|
|
132
|
+
- id: ws_clearable
|
|
133
|
+
type: WeekSelector
|
|
134
|
+
properties:
|
|
135
|
+
title: Clearable
|
|
136
|
+
allowClear: true
|
|
137
|
+
|
|
138
|
+
# ============================================
|
|
139
|
+
# PRESETS
|
|
140
|
+
# ============================================
|
|
141
|
+
|
|
142
|
+
# Formatted as the start of the week, so the assertions read as dates rather
|
|
143
|
+
# than ordinal week numbers.
|
|
144
|
+
- id: ws_presets
|
|
145
|
+
type: WeekSelector
|
|
146
|
+
properties:
|
|
147
|
+
title: Presets
|
|
148
|
+
format: YYYY-MM-DD
|
|
149
|
+
presets:
|
|
150
|
+
- label: Week of mid 2024
|
|
151
|
+
value:
|
|
152
|
+
_date: '2024-06-15'
|
|
153
|
+
- label: Week of 15 January 2024
|
|
154
|
+
value: '2024-01-15'
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Copyright 2020-2026 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
- id: properties.title
|
|
16
|
+
type: WeekSelector
|
|
17
|
+
properties:
|
|
18
|
+
title: WeekSelector title
|
|
19
|
+
- id: 'property.allowClear: false'
|
|
20
|
+
type: WeekSelector
|
|
21
|
+
properties:
|
|
22
|
+
allowClear: false
|
|
23
|
+
- id: 'property.autoFocus: true'
|
|
24
|
+
type: WeekSelector
|
|
25
|
+
properties:
|
|
26
|
+
autoFocus: true
|
|
27
|
+
- id: 'properties.bordered: false'
|
|
28
|
+
type: WeekSelector
|
|
29
|
+
properties:
|
|
30
|
+
bordered: false
|
|
31
|
+
- id: 'properties.disabledDates.min'
|
|
32
|
+
type: WeekSelector
|
|
33
|
+
properties:
|
|
34
|
+
disabledDates:
|
|
35
|
+
min: 2020-10-20
|
|
36
|
+
- id: 'properties.disabledDates.max'
|
|
37
|
+
type: WeekSelector
|
|
38
|
+
properties:
|
|
39
|
+
disabledDates:
|
|
40
|
+
max: 2020-08-15
|
|
41
|
+
- id: 'properties.disabledDates.dates'
|
|
42
|
+
type: WeekSelector
|
|
43
|
+
properties:
|
|
44
|
+
disabledDates:
|
|
45
|
+
dates:
|
|
46
|
+
- _date: 2020-10-26
|
|
47
|
+
- 2020-10-01
|
|
48
|
+
- 2020-11-01
|
|
49
|
+
- id: 'properties.disabledDates.ranges'
|
|
50
|
+
type: WeekSelector
|
|
51
|
+
properties:
|
|
52
|
+
disabledDates:
|
|
53
|
+
ranges:
|
|
54
|
+
- ['2020-07-01', '2020-08-01']
|
|
55
|
+
- - 2020-10-01
|
|
56
|
+
- 2020-11-02
|
|
57
|
+
|
|
58
|
+
- id: 'property.disabled: true'
|
|
59
|
+
type: WeekSelector
|
|
60
|
+
properties:
|
|
61
|
+
disabled: true
|
|
62
|
+
- id: 'property.format: YYYY-WW'
|
|
63
|
+
type: WeekSelector
|
|
64
|
+
properties:
|
|
65
|
+
format: YYYY-WW
|
|
66
|
+
- id: 'property.placeholder: - Select this Week'
|
|
67
|
+
type: WeekSelector
|
|
68
|
+
properties:
|
|
69
|
+
placeholder: Select this Week
|
|
70
|
+
- id: 'property.size: small'
|
|
71
|
+
type: WeekSelector
|
|
72
|
+
properties:
|
|
73
|
+
size: small
|
|
74
|
+
- id: 'property.size: large'
|
|
75
|
+
type: WeekSelector
|
|
76
|
+
properties:
|
|
77
|
+
size: large
|
|
78
|
+
- id: 'property.suffixIcon: CalendarFilled'
|
|
79
|
+
type: WeekSelector
|
|
80
|
+
properties:
|
|
81
|
+
suffixIcon: CalendarFilled
|
|
82
|
+
- id: 'property.suffixIcon: CalendarFilled.blue'
|
|
83
|
+
type: WeekSelector
|
|
84
|
+
properties:
|
|
85
|
+
suffixIcon:
|
|
86
|
+
name: CalendarFilled
|
|
87
|
+
color: blue
|
|
88
|
+
- id: 'properties.inputStyle: CSS style applied'
|
|
89
|
+
type: WeekSelector
|
|
90
|
+
properties:
|
|
91
|
+
inputStyle:
|
|
92
|
+
border: 1px solid red
|
|
93
|
+
- id: 'property.label span: 5'
|
|
94
|
+
type: WeekSelector
|
|
95
|
+
properties:
|
|
96
|
+
label:
|
|
97
|
+
span: 5
|
|
98
|
+
- id: 'property.label align: right'
|
|
99
|
+
type: WeekSelector
|
|
100
|
+
properties:
|
|
101
|
+
label:
|
|
102
|
+
align: right
|
|
103
|
+
- id: 'property.label inline: true'
|
|
104
|
+
type: WeekSelector
|
|
105
|
+
properties:
|
|
106
|
+
label:
|
|
107
|
+
inline: true
|
|
108
|
+
- id: 'property.label disabled: true'
|
|
109
|
+
type: WeekSelector
|
|
110
|
+
properties:
|
|
111
|
+
label:
|
|
112
|
+
disabled: true
|
|
113
|
+
- id: 'property.label colon: false'
|
|
114
|
+
type: WeekSelector
|
|
115
|
+
properties:
|
|
116
|
+
label:
|
|
117
|
+
colon: false
|
|
118
|
+
- id: 'property.label extra: extra text added'
|
|
119
|
+
type: WeekSelector
|
|
120
|
+
properties:
|
|
121
|
+
label:
|
|
122
|
+
extra: extra text added
|
package/dist/blocks.js
CHANGED
|
@@ -81,6 +81,8 @@ export { default as Steps } from './blocks/Steps/Steps.js';
|
|
|
81
81
|
export { default as Switch } from './blocks/Switch/Switch.js';
|
|
82
82
|
export { default as Tabs } from './blocks/Tabs/Tabs.js';
|
|
83
83
|
export { default as Tag } from './blocks/Tag/Tag.js';
|
|
84
|
+
export { default as TagMultipleSelector } from './blocks/TagMultipleSelector/TagMultipleSelector.js';
|
|
85
|
+
export { default as TagSelector } from './blocks/TagSelector/TagSelector.js';
|
|
84
86
|
export { default as TimelineList } from './blocks/TimelineList/TimelineList.js';
|
|
85
87
|
export { default as TextArea } from './blocks/TextArea/TextArea.js';
|
|
86
88
|
export { default as TextInput } from './blocks/TextInput/TextInput.js';
|
package/dist/disabledDate.js
CHANGED
|
@@ -20,29 +20,101 @@ import { type } from '@lowdefy/helpers';
|
|
|
20
20
|
dayjs.extend(utc);
|
|
21
21
|
dayjs.extend(isSameOrBefore);
|
|
22
22
|
dayjs.extend(isSameOrAfter);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
// A picker calls disabledDate with the dayjs instance its panel works in, which is a UTC mode
|
|
24
|
+
// instance when the block reads its value as a UTC wall clock and a local mode instance when it
|
|
25
|
+
// does not. Both name the calendar date the user sees, so it is the wall clock that is compared and
|
|
26
|
+
// the bounds are read the same way. Comparing the instants instead makes the same calendar date
|
|
27
|
+
// disabled or allowed depending on which mode it arrives in.
|
|
28
|
+
const toWallClock = (date)=>{
|
|
29
|
+
// Wrap with our dayjs to ensure the utc plugin is available — antd v6's internal dayjs instance
|
|
30
|
+
// may not have it loaded.
|
|
31
|
+
const wrapped = dayjs(date);
|
|
32
|
+
return dayjs.utc(wrapped.format('YYYY-MM-DDTHH:mm:ss.SSS'));
|
|
33
|
+
};
|
|
34
|
+
function toConfiguredDate({ date, key }) {
|
|
35
|
+
if (type.isNone(date)) {
|
|
36
|
+
throw new Error(`disabledDates.${key} is missing.`);
|
|
37
|
+
}
|
|
38
|
+
if (!dayjs(date).isValid()) {
|
|
39
|
+
throw new Error(`disabledDates.${key} is not a date. Received ${JSON.stringify(date)}.`);
|
|
40
|
+
}
|
|
41
|
+
return toWallClock(date);
|
|
42
|
+
}
|
|
43
|
+
function toConfiguredArray({ key, value }) {
|
|
44
|
+
if (type.isNone(value)) return [];
|
|
45
|
+
if (!type.isArray(value)) {
|
|
46
|
+
throw new Error(`disabledDates.${key} is not an array. Received ${JSON.stringify(value)}.`);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
// A range is documented as { from, to }. An array of a from and a to date is the shape the block
|
|
51
|
+
// read before, so it is still accepted. Anything else is a config error: dropping it left a range
|
|
52
|
+
// that read as valid config but disabled nothing.
|
|
53
|
+
function toRangeBounds({ index, range }) {
|
|
54
|
+
if (type.isArray(range)) {
|
|
55
|
+
if (range.length !== 2) {
|
|
56
|
+
throw new Error(`disabledDates.ranges[${index}] is not an array of a from and a to date. Received ${JSON.stringify(range)}.`);
|
|
33
57
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
58
|
+
return {
|
|
59
|
+
from: range[0],
|
|
60
|
+
to: range[1]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (type.isObject(range)) {
|
|
64
|
+
return {
|
|
65
|
+
from: range.from,
|
|
66
|
+
to: range.to
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`disabledDates.ranges[${index}] is not an object with a from and a to date. Received ${JSON.stringify(range)}.`);
|
|
70
|
+
}
|
|
71
|
+
const disabledDate = (disabledDatesConfig)=>{
|
|
72
|
+
if (!type.isNone(disabledDatesConfig) && !type.isObject(disabledDatesConfig)) {
|
|
73
|
+
throw new Error(`disabledDates is not an object. Received ${JSON.stringify(disabledDatesConfig)}.`);
|
|
74
|
+
}
|
|
75
|
+
const disabledDates = disabledDatesConfig ?? {};
|
|
76
|
+
const min = type.isNone(disabledDates.min) ? undefined : toConfiguredDate({
|
|
77
|
+
date: disabledDates.min,
|
|
78
|
+
key: 'min'
|
|
79
|
+
}).startOf('day');
|
|
80
|
+
const max = type.isNone(disabledDates.max) ? undefined : toConfiguredDate({
|
|
81
|
+
date: disabledDates.max,
|
|
82
|
+
key: 'max'
|
|
83
|
+
}).endOf('day');
|
|
84
|
+
const dates = toConfiguredArray({
|
|
85
|
+
key: 'dates',
|
|
86
|
+
value: disabledDates.dates
|
|
87
|
+
}).map((date, index)=>toConfiguredDate({
|
|
88
|
+
date,
|
|
89
|
+
key: `dates[${index}]`
|
|
90
|
+
}).startOf('day'));
|
|
91
|
+
const ranges = toConfiguredArray({
|
|
92
|
+
key: 'ranges',
|
|
93
|
+
value: disabledDates.ranges
|
|
94
|
+
}).map((range, index)=>{
|
|
95
|
+
const { from, to } = toRangeBounds({
|
|
96
|
+
index,
|
|
97
|
+
range
|
|
98
|
+
});
|
|
99
|
+
return [
|
|
100
|
+
toConfiguredDate({
|
|
101
|
+
date: from,
|
|
102
|
+
key: `ranges[${index}].from`
|
|
103
|
+
}).startOf('day'),
|
|
104
|
+
toConfiguredDate({
|
|
105
|
+
date: to,
|
|
106
|
+
key: `ranges[${index}].to`
|
|
107
|
+
}).endOf('day')
|
|
108
|
+
];
|
|
109
|
+
});
|
|
36
110
|
return (currentDate)=>{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (max && utcCurrentData.isAfter(max)) return true;
|
|
42
|
-
let match = dates.find((date)=>date.isSame(utcCurrentData.startOf('day')));
|
|
111
|
+
const current = toWallClock(currentDate);
|
|
112
|
+
if (min && current.isBefore(min)) return true;
|
|
113
|
+
if (max && current.isAfter(max)) return true;
|
|
114
|
+
let match = dates.find((date)=>date.isSame(current.startOf('day')));
|
|
43
115
|
if (match) return true;
|
|
44
116
|
ranges.forEach((range)=>{
|
|
45
|
-
if (
|
|
117
|
+
if (current.startOf('day').isSameOrAfter(range[0]) && current.endOf('day').isSameOrBefore(range[1])) {
|
|
46
118
|
match = true;
|
|
47
119
|
}
|
|
48
120
|
});
|
package/dist/e2e.js
CHANGED
|
@@ -70,6 +70,8 @@ export { default as Steps } from './blocks/Steps/e2e.js';
|
|
|
70
70
|
export { default as Switch } from './blocks/Switch/e2e.js';
|
|
71
71
|
export { default as Tabs } from './blocks/Tabs/e2e.js';
|
|
72
72
|
export { default as Tag } from './blocks/Tag/e2e.js';
|
|
73
|
+
export { default as TagMultipleSelector } from './blocks/TagMultipleSelector/e2e.js';
|
|
74
|
+
export { default as TagSelector } from './blocks/TagSelector/e2e.js';
|
|
73
75
|
export { default as TextArea } from './blocks/TextArea/e2e.js';
|
|
74
76
|
export { default as TextInput } from './blocks/TextInput/e2e.js';
|
|
75
77
|
export { default as TimelineList } from './blocks/TimelineList/e2e.js';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import dayjs from 'dayjs';
|
|
17
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
18
|
+
import { renderHtml } from '@lowdefy/block-utils';
|
|
19
|
+
import { type } from '@lowdefy/helpers';
|
|
20
|
+
import disabledDate from './disabledDate.js';
|
|
21
|
+
import './pickerPresetsStyle.css';
|
|
22
|
+
dayjs.extend(utc);
|
|
23
|
+
// The picker hands a preset value straight to onChange, so a preset is read exactly as the block
|
|
24
|
+
// reads and writes its value: the date pickers work in a UTC wall clock (dayjs.utc(value)), and
|
|
25
|
+
// onChange normalises a UTC mode dayjs to the same instant a cell click produces. DateTimeSelector
|
|
26
|
+
// without selectUTC reads its value in local time, so there the date is used as the instant it is.
|
|
27
|
+
function toPickerDate({ date, local, preset }) {
|
|
28
|
+
// dayjs reads an undefined date as now, which would make a mistyped preset select today.
|
|
29
|
+
if (type.isNone(date)) {
|
|
30
|
+
throw new Error(`Preset value is missing. Received ${JSON.stringify(preset)}.`);
|
|
31
|
+
}
|
|
32
|
+
const pickerDate = local ? dayjs(date) : dayjs.utc(date);
|
|
33
|
+
if (!pickerDate.isValid()) {
|
|
34
|
+
throw new Error(`Preset value is not a date. Received ${JSON.stringify(preset)}.`);
|
|
35
|
+
}
|
|
36
|
+
return pickerDate;
|
|
37
|
+
}
|
|
38
|
+
// The picker does not check the arity of a preset value. A range picker commits a value of one date
|
|
39
|
+
// as a range of one date, and a single picker throws inside its formatter. The block knows which
|
|
40
|
+
// shape it takes, so the mismatch is caught here rather than inferred from the configured value.
|
|
41
|
+
function toPickerValue({ local, preset, range }) {
|
|
42
|
+
if (range) {
|
|
43
|
+
if (!type.isArray(preset.value) || preset.value.length !== 2) {
|
|
44
|
+
throw new Error(`Preset value is not an array of a start and an end date. Received ${JSON.stringify(preset)}.`);
|
|
45
|
+
}
|
|
46
|
+
return preset.value.map((date)=>toPickerDate({
|
|
47
|
+
date,
|
|
48
|
+
local,
|
|
49
|
+
preset
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
if (type.isArray(preset.value)) {
|
|
53
|
+
throw new Error(`Preset value is an array, but the block selects a single date. Received ${JSON.stringify(preset)}.`);
|
|
54
|
+
}
|
|
55
|
+
return toPickerDate({
|
|
56
|
+
date: preset.value,
|
|
57
|
+
local,
|
|
58
|
+
preset
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// The scan walks a day at a time from one end of the range towards the other, so it visits the
|
|
62
|
+
// range at most once and only runs at all when that end is disabled.
|
|
63
|
+
function firstSelectable({ from, isDisabledDate, step, to }) {
|
|
64
|
+
let date = from;
|
|
65
|
+
while(step > 0 ? !date.isAfter(to, 'day') : !date.isBefore(to, 'day')){
|
|
66
|
+
if (!isDisabledDate(date)) return date;
|
|
67
|
+
date = date.add(step, 'day');
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
// The picker validates a preset against disabledDate on click, and rejects it by writing the value
|
|
72
|
+
// to the input, marking it invalid and leaving the popup open without committing anything. Rather
|
|
73
|
+
// than offer a shortcut that does that, a range is narrowed to the dates it may select, and a
|
|
74
|
+
// preset left with nothing to select is disabled.
|
|
75
|
+
function toSelectableValue({ isDisabledDate, value }) {
|
|
76
|
+
if (!type.isArray(value)) {
|
|
77
|
+
if (isDisabledDate(value)) return undefined;
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
// The picker orders a reversed range itself, so the scan reads the range in calendar order.
|
|
81
|
+
const [from, to] = value[0].isAfter(value[1]) ? [
|
|
82
|
+
value[1],
|
|
83
|
+
value[0]
|
|
84
|
+
] : value;
|
|
85
|
+
const start = firstSelectable({
|
|
86
|
+
from,
|
|
87
|
+
isDisabledDate,
|
|
88
|
+
step: 1,
|
|
89
|
+
to
|
|
90
|
+
});
|
|
91
|
+
if (!start) return undefined;
|
|
92
|
+
const end = firstSelectable({
|
|
93
|
+
from: to,
|
|
94
|
+
isDisabledDate,
|
|
95
|
+
step: -1,
|
|
96
|
+
to: start
|
|
97
|
+
});
|
|
98
|
+
return [
|
|
99
|
+
start,
|
|
100
|
+
end
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
// The picker's preset panel has no disabled state and renders the label it is given inside its own
|
|
104
|
+
// list item, so the label carries the marker the stylesheet disables the list item by.
|
|
105
|
+
function toLabel({ disabled, label }) {
|
|
106
|
+
if (!disabled) return label;
|
|
107
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
108
|
+
className: "lf-picker-preset-disabled"
|
|
109
|
+
}, label);
|
|
110
|
+
}
|
|
111
|
+
const getPresets = ({ disabledDates, local, methods, presets, range })=>{
|
|
112
|
+
if (type.isNone(presets)) return undefined;
|
|
113
|
+
if (!type.isArray(presets)) {
|
|
114
|
+
throw new Error(`Presets is not an array. Received ${JSON.stringify(presets)}.`);
|
|
115
|
+
}
|
|
116
|
+
// Built from the same config as the picker's disabledDate prop, so a preset is offered on exactly
|
|
117
|
+
// the terms the calendar cells are.
|
|
118
|
+
const isDisabledDate = type.isNone(disabledDates) ? undefined : disabledDate(disabledDates);
|
|
119
|
+
return presets.map((preset)=>{
|
|
120
|
+
if (!type.isObject(preset)) {
|
|
121
|
+
throw new Error(`Preset is not an object. Received ${JSON.stringify(preset)}.`);
|
|
122
|
+
}
|
|
123
|
+
// renderHtml renders nothing for a missing label, which would list an empty shortcut.
|
|
124
|
+
if (!type.isString(preset.label)) {
|
|
125
|
+
throw new Error(`Preset label is not a string. Received ${JSON.stringify(preset)}.`);
|
|
126
|
+
}
|
|
127
|
+
const value = toPickerValue({
|
|
128
|
+
local,
|
|
129
|
+
preset,
|
|
130
|
+
range
|
|
131
|
+
});
|
|
132
|
+
const selectableValue = isDisabledDate ? toSelectableValue({
|
|
133
|
+
isDisabledDate,
|
|
134
|
+
value
|
|
135
|
+
}) : value;
|
|
136
|
+
const disabled = type.isNone(selectableValue);
|
|
137
|
+
return {
|
|
138
|
+
label: toLabel({
|
|
139
|
+
disabled,
|
|
140
|
+
label: renderHtml({
|
|
141
|
+
html: preset.label,
|
|
142
|
+
methods
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
// A disabled preset keeps its configured value. The stylesheet stops the list item receiving
|
|
146
|
+
// the click that would read it.
|
|
147
|
+
value: disabled ? value : selectableValue
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
export default getPresets;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ // Tableau-10 categorical palette — mid-saturation hues that read on both the
|
|
16
|
+
// light and dark canvas.
|
|
17
|
+
const PALETTE = [
|
|
18
|
+
'#4E79A7',
|
|
19
|
+
'#F28E2B',
|
|
20
|
+
'#E15759',
|
|
21
|
+
'#76B7B2',
|
|
22
|
+
'#59A14F',
|
|
23
|
+
'#EDC948',
|
|
24
|
+
'#B07AA1',
|
|
25
|
+
'#FF9DA7',
|
|
26
|
+
'#9C755F',
|
|
27
|
+
'#BAB0AC'
|
|
28
|
+
];
|
|
29
|
+
// djb2 — tiny, deterministic string hash for stable palette assignment.
|
|
30
|
+
function hashString(s) {
|
|
31
|
+
let h = 5381;
|
|
32
|
+
for(let i = 0; i < s.length; i += 1)h = (h << 5) + h + s.charCodeAt(i) | 0;
|
|
33
|
+
return Math.abs(h);
|
|
34
|
+
}
|
|
35
|
+
// Resolve the pill color for a tag option. An explicit option.color wins;
|
|
36
|
+
// otherwise a hash of the option value picks a stable palette color so a given
|
|
37
|
+
// value keeps the same hue on every render. Returns null in single-accent mode
|
|
38
|
+
// (colored: false) so the CSS primary look takes over.
|
|
39
|
+
function getTagColor({ option, colored }) {
|
|
40
|
+
if (option.color) return option.color;
|
|
41
|
+
if (!colored) return null;
|
|
42
|
+
return PALETTE[hashString(`${option.value}`) % PALETTE.length];
|
|
43
|
+
}
|
|
44
|
+
export default getTagColor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
// Normalize TagSelector / TagMultipleSelector options into a common
|
|
17
|
+
// { label, value, color, disabled } shape. Primitives become
|
|
18
|
+
// { label: `${value}`, value } so the rest of the pill rendering is uniform.
|
|
19
|
+
function getTagSelectorOptions({ options }) {
|
|
20
|
+
return (options ?? []).map((option)=>type.isPrimitive(option) ? {
|
|
21
|
+
label: `${option}`,
|
|
22
|
+
value: option
|
|
23
|
+
} : {
|
|
24
|
+
label: type.isNone(option.label) ? `${option.value}` : option.label,
|
|
25
|
+
value: option.value,
|
|
26
|
+
color: option.color,
|
|
27
|
+
disabled: option.disabled
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export default getTagSelectorOptions;
|
package/dist/metas.js
CHANGED
|
@@ -81,6 +81,8 @@ export { default as Steps } from './blocks/Steps/meta.js';
|
|
|
81
81
|
export { default as Switch } from './blocks/Switch/meta.js';
|
|
82
82
|
export { default as Tabs } from './blocks/Tabs/meta.js';
|
|
83
83
|
export { default as Tag } from './blocks/Tag/meta.js';
|
|
84
|
+
export { default as TagMultipleSelector } from './blocks/TagMultipleSelector/meta.js';
|
|
85
|
+
export { default as TagSelector } from './blocks/TagSelector/meta.js';
|
|
84
86
|
export { default as TextArea } from './blocks/TextArea/meta.js';
|
|
85
87
|
export { default as TextInput } from './blocks/TextInput/meta.js';
|
|
86
88
|
export { default as TimelineList } from './blocks/TimelineList/meta.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@layer components {
|
|
18
|
+
/* The picker's preset panel puts its click and hover handlers on the list item and takes only a
|
|
19
|
+
label from the block, so a preset that cannot be selected is marked in its label and the list
|
|
20
|
+
item around it is disabled here. The components layer is ordered after the antd layer, so this
|
|
21
|
+
wins over the panel's own list item styles. */
|
|
22
|
+
.ant-picker-presets li:has(.lf-picker-preset-disabled) {
|
|
23
|
+
color: var(--ant-color-text-disabled);
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
}
|