@lowdefy/blocks-antd 5.2.0 → 5.4.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/blocks/AutoComplete/AutoComplete.js +1 -0
- package/dist/blocks/AutoComplete/meta.js +2 -1
- package/dist/blocks/ButtonSelector/ButtonSelector.js +74 -27
- package/dist/blocks/ButtonSelector/meta.js +18 -4
- package/dist/blocks/Carousel/meta.js +16 -0
- package/dist/blocks/CheckboxSelector/CheckboxSelector.js +46 -14
- package/dist/blocks/CheckboxSelector/meta.js +7 -1
- package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +1 -0
- package/dist/blocks/CheckboxSwitch/meta.js +4 -1
- package/dist/blocks/ColorSelector/ColorSelector.js +1 -0
- package/dist/blocks/ColorSelector/meta.js +2 -1
- package/dist/blocks/ConfigProvider/ConfigProvider.js +1 -0
- package/dist/blocks/ConfigProvider/meta.js +7 -0
- package/dist/blocks/ConfirmModal/ConfirmModal.js +2 -2
- package/dist/blocks/ConfirmModal/meta.js +2 -4
- package/dist/blocks/DateRangeSelector/DateRangeSelector.js +4 -9
- package/dist/blocks/DateRangeSelector/meta.js +4 -8
- package/dist/blocks/DateSelector/DateSelector.js +4 -3
- package/dist/blocks/DateSelector/meta.js +4 -5
- package/dist/blocks/DateTimeSelector/DateTimeSelector.js +4 -3
- package/dist/blocks/DateTimeSelector/meta.js +4 -5
- package/dist/blocks/DropdownMenu/meta.js +46 -6
- package/dist/blocks/Label/Label.js +30 -5
- package/dist/blocks/Label/meta.js +8 -2
- package/dist/blocks/ListSelector/ListSelector.js +384 -0
- package/dist/blocks/ListSelector/e2e.js +40 -0
- package/dist/blocks/ListSelector/meta.js +215 -0
- package/dist/blocks/Menu/Menu.js +26 -80
- package/dist/blocks/Menu/meta.js +160 -64
- package/dist/blocks/MobileMenu/meta.js +50 -50
- package/dist/blocks/Modal/Modal.js +2 -2
- package/dist/blocks/Modal/meta.js +2 -4
- package/dist/blocks/MonthSelector/MonthSelector.js +4 -3
- package/dist/blocks/MonthSelector/meta.js +4 -5
- package/dist/blocks/MultipleSelector/MultipleSelector.js +41 -9
- package/dist/blocks/MultipleSelector/meta.js +24 -5
- package/dist/blocks/NumberInput/NumberInput.js +3 -1
- package/dist/blocks/NumberInput/meta.js +3 -3
- package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +12 -3
- package/dist/blocks/PageHeaderMenu/meta.js +8 -1
- package/dist/blocks/PageSidebarLayout/PageSidebarLayout.js +2 -1
- package/dist/blocks/PageSidebarLayout/meta.js +8 -1
- package/dist/blocks/PageSiderMenu/PageSiderMenu.js +2 -1
- package/dist/blocks/PageSiderMenu/meta.js +8 -1
- package/dist/blocks/PasswordInput/PasswordInput.js +1 -0
- package/dist/blocks/PasswordInput/meta.js +2 -1
- package/dist/blocks/PhoneNumberInput/PhoneNumberInput.js +1 -0
- package/dist/blocks/PhoneNumberInput/meta.js +2 -1
- package/dist/blocks/RadioSelector/RadioSelector.js +44 -14
- package/dist/blocks/RadioSelector/meta.js +7 -1
- package/dist/blocks/RatingSlider/meta.js +2 -1
- package/dist/blocks/SegmentedSelector/SegmentedSelector.js +10 -4
- package/dist/blocks/SegmentedSelector/meta.js +7 -4
- package/dist/blocks/Selector/Selector.js +55 -9
- package/dist/blocks/Selector/meta.js +24 -5
- package/dist/blocks/Slider/Slider.js +1 -0
- package/dist/blocks/Slider/meta.js +2 -1
- package/dist/blocks/Switch/Switch.js +1 -0
- package/dist/blocks/Switch/meta.js +2 -1
- package/dist/blocks/Tabs/Tabs.js +30 -43
- package/dist/blocks/Tabs/meta.js +8 -10
- package/dist/blocks/TextArea/TextArea.js +1 -0
- package/dist/blocks/TextArea/meta.js +2 -1
- package/dist/blocks/TextInput/TextInput.js +1 -0
- package/dist/blocks/TextInput/meta.js +2 -1
- package/dist/blocks/TreeInput/TreeInput.js +91 -0
- package/dist/blocks/TreeInput/e2e.js +33 -0
- package/dist/blocks/TreeInput/meta.js +68 -0
- package/dist/blocks/TreeMultipleSelector/TreeMultipleSelector.js +161 -0
- package/dist/blocks/TreeMultipleSelector/e2e.js +46 -0
- package/dist/blocks/TreeMultipleSelector/meta.js +128 -0
- package/dist/blocks/TreeSelector/TreeSelector.js +127 -88
- package/dist/blocks/TreeSelector/e2e.js +20 -9
- package/dist/blocks/TreeSelector/meta.js +70 -254
- package/dist/blocks/WeekSelector/WeekSelector.js +2 -1
- package/dist/blocks/WeekSelector/meta.js +3 -3
- package/dist/blocks/buildMenuItems.js +89 -26
- package/dist/blocks/headerActions.js +87 -3
- package/dist/blocks/normalizeItemClassAndStyle.js +77 -0
- package/dist/blocks.js +3 -0
- package/dist/e2e.js +3 -0
- package/dist/getContrastTextColor.js +45 -0
- package/dist/getOptionColorStyle.js +36 -0
- package/dist/getSelectedIndex.js +42 -0
- package/dist/getSelectorOptions.js +67 -0
- package/dist/getTreeData.js +94 -0
- package/dist/metas.js +3 -0
- package/dist/schemas/dataOptions.js +36 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/label.js +3 -1
- package/dist/schemas/labelTooltip.js +44 -0
- package/dist/schemas/options.js +7 -3
- package/dist/schemas/treeSelectTheme.js +125 -0
- package/dist/serializeSelectorValue.js +38 -0
- package/dist/useSelectorOptions.js +38 -0
- package/dist/useSetData.js +27 -0
- package/package.json +9 -7
|
@@ -12,98 +12,137 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import React, { useState
|
|
16
|
-
import {
|
|
15
|
+
*/ import React, { useState } from 'react';
|
|
16
|
+
import { TreeSelect } from 'antd';
|
|
17
17
|
import { renderHtml, withBlockDefaults } from '@lowdefy/block-utils';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
import Label from '../Label/Label.js';
|
|
18
20
|
import withTheme from '../withTheme.js';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
];
|
|
28
|
-
return {
|
|
29
|
-
children: children && transformData(children, valueMap, key),
|
|
30
|
-
disabled,
|
|
31
|
-
disableCheckbox,
|
|
32
|
-
key,
|
|
33
|
-
renderTitle: label
|
|
34
|
-
};
|
|
21
|
+
import useSelectorOptions from '../../useSelectorOptions.js';
|
|
22
|
+
import getSelectedIndex from '../../getSelectedIndex.js';
|
|
23
|
+
import getTreeData, { ROOT_PID } from '../../getTreeData.js';
|
|
24
|
+
const TreeSelector = ({ blockId, classNames = {}, components: { Icon }, events, loading, methods, properties, required, styles = {}, validation, value })=>{
|
|
25
|
+
const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
|
|
26
|
+
const entries = useSelectorOptions({
|
|
27
|
+
properties,
|
|
28
|
+
methods
|
|
35
29
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
return [];
|
|
47
|
-
};
|
|
48
|
-
const TreeSelector = ({ blockId, classNames = {}, properties, content, methods, styles = {}, value })=>{
|
|
49
|
-
const treeData = properties.options;
|
|
50
|
-
const valueMap = {};
|
|
51
|
-
const transformedData = transformData(treeData, valueMap);
|
|
52
|
-
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
53
|
-
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
54
|
-
useEffect(()=>{
|
|
55
|
-
let nextValue;
|
|
56
|
-
if (value === null || Array.isArray(value) && !value.length) {
|
|
57
|
-
nextValue = [];
|
|
58
|
-
} else {
|
|
59
|
-
nextValue = getValueKeys(value, valueMap);
|
|
60
|
-
}
|
|
61
|
-
setSelectedKeys([
|
|
62
|
-
nextValue[nextValue.length - 1]
|
|
63
|
-
]);
|
|
64
|
-
setExpandedKeys([
|
|
65
|
-
...new Set([
|
|
66
|
-
...nextValue.slice(0, nextValue.length - 1),
|
|
67
|
-
...expandedKeys
|
|
68
|
-
])
|
|
69
|
-
]);
|
|
70
|
-
}, [
|
|
71
|
-
value
|
|
72
|
-
]);
|
|
73
|
-
const onSelect = (selectedKeys)=>{
|
|
74
|
-
const val = selectedKeys.map((key)=>valueMap[key]).flat();
|
|
75
|
-
methods.setValue(val);
|
|
76
|
-
methods.triggerEvent({
|
|
77
|
-
name: 'onChange',
|
|
78
|
-
event: {
|
|
79
|
-
value: val
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
setSelectedKeys(selectedKeys);
|
|
83
|
-
};
|
|
84
|
-
const onExpand = (nextExpandedKeys)=>{
|
|
85
|
-
setExpandedKeys(nextExpandedKeys);
|
|
30
|
+
const treeData = getTreeData({
|
|
31
|
+
entries,
|
|
32
|
+
properties
|
|
33
|
+
});
|
|
34
|
+
// primaryKey / parentKey are structural (node id + parent ref); the stored value is the valueKey
|
|
35
|
+
// value, so selection is matched on valueKey — hide primaryKey from getSelectedIndex.
|
|
36
|
+
const matchProps = {
|
|
37
|
+
...properties,
|
|
38
|
+
primaryKey: undefined
|
|
86
39
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
40
|
+
let antdVariant = properties.variant;
|
|
41
|
+
if (properties.bordered === false) antdVariant = 'borderless';
|
|
42
|
+
return /*#__PURE__*/ React.createElement(Label, {
|
|
43
|
+
blockId: blockId,
|
|
44
|
+
methods: methods,
|
|
45
|
+
classNames: classNames,
|
|
46
|
+
components: {
|
|
47
|
+
Icon
|
|
48
|
+
},
|
|
49
|
+
events: events,
|
|
50
|
+
properties: {
|
|
51
|
+
title: properties.title,
|
|
52
|
+
size: properties.size,
|
|
53
|
+
...properties.label
|
|
54
|
+
},
|
|
55
|
+
required: required,
|
|
56
|
+
styles: styles,
|
|
57
|
+
validation: validation,
|
|
58
|
+
content: {
|
|
59
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
60
|
+
style: {
|
|
61
|
+
width: '100%'
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
64
|
+
id: `${blockId}_${elementId}_popup`
|
|
65
|
+
}), /*#__PURE__*/ React.createElement(TreeSelect, {
|
|
66
|
+
id: `${blockId}_input`,
|
|
67
|
+
variant: antdVariant,
|
|
68
|
+
className: classNames.element,
|
|
69
|
+
style: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
...styles.element
|
|
72
|
+
},
|
|
73
|
+
disabled: properties.disabled || loading,
|
|
74
|
+
allowClear: properties.allowClear !== false,
|
|
75
|
+
placeholder: properties.placeholder ?? methods.translate('blocks.treeSelector.placeholder'),
|
|
76
|
+
status: validation.status,
|
|
77
|
+
size: properties.size,
|
|
78
|
+
autoFocus: properties.autoFocus,
|
|
79
|
+
getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
|
|
80
|
+
treeDataSimpleMode: {
|
|
81
|
+
id: 'id',
|
|
82
|
+
pId: 'pId',
|
|
83
|
+
rootPId: ROOT_PID
|
|
84
|
+
},
|
|
85
|
+
treeData: treeData,
|
|
86
|
+
treeDefaultExpandAll: properties.treeDefaultExpandAll,
|
|
87
|
+
showSearch: properties.showSearch !== false,
|
|
88
|
+
treeNodeFilterProp: "title",
|
|
89
|
+
treeTitleRender: (node)=>renderHtml({
|
|
90
|
+
html: `${node.title}`,
|
|
91
|
+
methods
|
|
92
|
+
}),
|
|
93
|
+
notFoundContent: properties.notFoundContent ?? methods.translate('blocks.treeSelector.notFound'),
|
|
94
|
+
suffixIcon: properties.suffixIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
95
|
+
blockId: `${blockId}_suffixIcon`,
|
|
96
|
+
classNames: {
|
|
97
|
+
element: classNames.suffixIcon
|
|
98
|
+
},
|
|
99
|
+
events: events,
|
|
100
|
+
properties: properties.suffixIcon,
|
|
101
|
+
styles: {
|
|
102
|
+
element: styles.suffixIcon
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
clearIcon: properties.clearIcon && /*#__PURE__*/ React.createElement(Icon, {
|
|
106
|
+
blockId: `${blockId}_clearIcon`,
|
|
107
|
+
classNames: {
|
|
108
|
+
element: classNames.clearIcon
|
|
109
|
+
},
|
|
110
|
+
events: events,
|
|
111
|
+
properties: properties.clearIcon,
|
|
112
|
+
styles: {
|
|
113
|
+
element: styles.clearIcon
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
value: getSelectedIndex(value, entries, {
|
|
117
|
+
properties: matchProps
|
|
118
|
+
}),
|
|
119
|
+
onChange: (idx)=>{
|
|
120
|
+
const val = type.isNone(idx) ? null : entries[idx].value;
|
|
121
|
+
methods.setValue(val);
|
|
122
|
+
methods.triggerEvent({
|
|
123
|
+
name: 'onChange',
|
|
124
|
+
event: {
|
|
125
|
+
value: val
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
onBlur: ()=>methods.triggerEvent({
|
|
130
|
+
name: 'onBlur'
|
|
131
|
+
}),
|
|
132
|
+
onFocus: ()=>methods.triggerEvent({
|
|
133
|
+
name: 'onFocus'
|
|
134
|
+
}),
|
|
135
|
+
onClear: ()=>methods.triggerEvent({
|
|
136
|
+
name: 'onClear'
|
|
137
|
+
}),
|
|
138
|
+
onSearch: (v)=>methods.triggerEvent({
|
|
139
|
+
name: 'onSearch',
|
|
140
|
+
event: {
|
|
141
|
+
value: v
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
}))
|
|
145
|
+
}
|
|
107
146
|
});
|
|
108
147
|
};
|
|
109
148
|
export default withTheme('TreeSelect', withBlockDefaults(TreeSelector));
|
|
@@ -14,20 +14,31 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { createBlockHelper, escapeId } from '@lowdefy/e2e-utils';
|
|
16
16
|
import { expect } from '@playwright/test';
|
|
17
|
-
const locator = (page, blockId)=>page.locator(
|
|
17
|
+
const locator = (page, blockId)=>page.locator(`.ant-select:has(#${escapeId(blockId)}_input)`);
|
|
18
|
+
const openDropdown = (page)=>page.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
18
19
|
export default createBlockHelper({
|
|
19
20
|
locator,
|
|
20
21
|
do: {
|
|
21
|
-
|
|
22
|
+
select: async (page, blockId, label)=>{
|
|
23
|
+
await locator(page, blockId).click();
|
|
24
|
+
await openDropdown(page).locator('.ant-select-tree-node-content-wrapper').filter({
|
|
22
25
|
hasText: label
|
|
23
|
-
}).
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
}).click();
|
|
27
|
+
},
|
|
28
|
+
clear: async (page, blockId)=>{
|
|
29
|
+
const sel = locator(page, blockId);
|
|
30
|
+
await sel.hover();
|
|
31
|
+
await sel.locator('.ant-select-clear').click();
|
|
32
|
+
},
|
|
33
|
+
search: async (page, blockId, text)=>{
|
|
34
|
+
await locator(page, blockId).click();
|
|
35
|
+
await page.keyboard.type(text);
|
|
36
|
+
}
|
|
27
37
|
},
|
|
28
38
|
expect: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
disabled: (page, blockId)=>expect(locator(page, blockId)).toHaveClass(/ant-select-disabled/),
|
|
40
|
+
enabled: (page, blockId)=>expect(locator(page, blockId)).not.toHaveClass(/ant-select-disabled/),
|
|
41
|
+
value: (page, blockId, val)=>expect(locator(page, blockId).locator('.ant-select-selection-item')).toHaveText(val),
|
|
42
|
+
placeholder: (page, blockId, text)=>expect(locator(page, blockId).locator('.ant-select-selection-placeholder')).toHaveText(text)
|
|
32
43
|
}
|
|
33
44
|
});
|
|
@@ -12,282 +12,98 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
15
|
+
*/ import LabelMeta from '../Label/meta.js';
|
|
16
|
+
import label from '../../schemas/label.js';
|
|
17
|
+
import icon from '../../schemas/icon.js';
|
|
18
|
+
import options from '../../schemas/options.js';
|
|
19
|
+
import treeSelectTheme from '../../schemas/treeSelectTheme.js';
|
|
20
|
+
import { data, html, valueKey, primaryKey, parentKey } from '../../schemas/dataOptions.js';
|
|
21
|
+
import { disabled, placeholder, inputTitle, autoFocus, variant, bordered, allowClear, sizeSmallDefaultLarge } from '../../schemas/inputProperties.js';
|
|
22
|
+
export default {
|
|
16
23
|
category: 'input',
|
|
17
|
-
icons: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
icons: [
|
|
25
|
+
...LabelMeta.icons,
|
|
26
|
+
'AiOutlineCloseCircle',
|
|
27
|
+
'AiOutlineDown'
|
|
28
|
+
],
|
|
29
|
+
valueType: 'any',
|
|
22
30
|
cssKeys: {
|
|
23
|
-
element: 'The TreeSelector element.'
|
|
31
|
+
element: 'The TreeSelector element.',
|
|
32
|
+
label: 'The TreeSelector label.',
|
|
33
|
+
extra: 'The TreeSelector extra content.',
|
|
34
|
+
feedback: 'The TreeSelector validation feedback.',
|
|
35
|
+
suffixIcon: 'The suffix icon in the TreeSelector.',
|
|
36
|
+
clearIcon: 'The clear icon in the TreeSelector.'
|
|
24
37
|
},
|
|
25
38
|
events: {
|
|
39
|
+
onBlur: 'Trigger action when the selector loses focus.',
|
|
26
40
|
onChange: {
|
|
27
41
|
description: 'Trigger action when selection is changed.',
|
|
28
42
|
event: {
|
|
29
43
|
value: 'The selected value.'
|
|
30
44
|
}
|
|
31
|
-
}
|
|
45
|
+
},
|
|
46
|
+
onFocus: 'Trigger action when the selector gains focus.',
|
|
47
|
+
onClear: 'Trigger action when the selector is cleared.',
|
|
48
|
+
onSearch: {
|
|
49
|
+
description: 'Trigger action when the search input changes.',
|
|
50
|
+
event: {
|
|
51
|
+
value: 'The search input value.'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
|
|
32
55
|
},
|
|
33
56
|
properties: {
|
|
34
57
|
type: 'object',
|
|
35
58
|
additionalProperties: false,
|
|
36
59
|
properties: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
data,
|
|
61
|
+
html,
|
|
62
|
+
valueKey,
|
|
63
|
+
primaryKey,
|
|
64
|
+
parentKey,
|
|
65
|
+
options,
|
|
66
|
+
label,
|
|
67
|
+
disabled,
|
|
68
|
+
autoFocus,
|
|
69
|
+
allowClear: {
|
|
70
|
+
...allowClear,
|
|
71
|
+
default: true
|
|
72
|
+
},
|
|
73
|
+
bordered,
|
|
74
|
+
variant,
|
|
75
|
+
size: sizeSmallDefaultLarge,
|
|
76
|
+
title: inputTitle,
|
|
77
|
+
placeholder: {
|
|
78
|
+
...placeholder,
|
|
79
|
+
default: 'Select item'
|
|
41
80
|
},
|
|
42
|
-
|
|
81
|
+
showSearch: {
|
|
43
82
|
type: 'boolean',
|
|
44
|
-
default:
|
|
45
|
-
description: '
|
|
83
|
+
default: true,
|
|
84
|
+
description: 'Make the tree searchable.'
|
|
46
85
|
},
|
|
47
|
-
|
|
86
|
+
treeDefaultExpandAll: {
|
|
48
87
|
type: 'boolean',
|
|
49
88
|
default: false,
|
|
50
|
-
description: '
|
|
89
|
+
description: 'Expand all tree nodes by default.'
|
|
51
90
|
},
|
|
52
|
-
|
|
53
|
-
type: '
|
|
54
|
-
default:
|
|
55
|
-
description: '
|
|
91
|
+
notFoundContent: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
default: 'Not found',
|
|
94
|
+
description: 'Content shown when no nodes match the search.'
|
|
56
95
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type: 'array',
|
|
62
|
-
description: 'Options can either be an array of label, value pairs.',
|
|
63
|
-
items: {
|
|
64
|
-
type: 'object',
|
|
65
|
-
required: [
|
|
66
|
-
'value'
|
|
67
|
-
],
|
|
68
|
-
properties: {
|
|
69
|
-
label: {
|
|
70
|
-
type: 'string',
|
|
71
|
-
description: 'Value label shown to user - supports html.'
|
|
72
|
-
},
|
|
73
|
-
value: {
|
|
74
|
-
description: 'Value selected. Can be of any type.',
|
|
75
|
-
oneOf: [
|
|
76
|
-
{
|
|
77
|
-
type: 'string'
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'number'
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
type: 'boolean'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: 'object'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'array'
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
docs: {
|
|
93
|
-
displayType: 'yaml'
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
disabled: {
|
|
97
|
-
type: 'boolean',
|
|
98
|
-
description: 'Disable the node if true.',
|
|
99
|
-
default: false
|
|
100
|
-
},
|
|
101
|
-
disableCheckbox: {
|
|
102
|
-
type: 'boolean',
|
|
103
|
-
description: 'Disable the checkbox if true.',
|
|
104
|
-
default: false
|
|
105
|
-
},
|
|
106
|
-
style: {
|
|
107
|
-
type: 'object',
|
|
108
|
-
description: 'Css style to applied to option.',
|
|
109
|
-
docs: {
|
|
110
|
-
displayType: 'yaml'
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
children: {
|
|
114
|
-
type: 'array',
|
|
115
|
-
description: 'Options can either be an array of label, value pairs.',
|
|
116
|
-
items: {
|
|
117
|
-
type: 'object',
|
|
118
|
-
required: [
|
|
119
|
-
'value'
|
|
120
|
-
],
|
|
121
|
-
properties: {
|
|
122
|
-
label: {
|
|
123
|
-
type: 'string',
|
|
124
|
-
description: 'Value label shown to user - supports html.'
|
|
125
|
-
},
|
|
126
|
-
value: {
|
|
127
|
-
description: 'Value selected. Can be of any type.',
|
|
128
|
-
oneOf: [
|
|
129
|
-
{
|
|
130
|
-
type: 'string'
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
type: 'number'
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
type: 'boolean'
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
type: 'object'
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
type: 'array'
|
|
143
|
-
}
|
|
144
|
-
],
|
|
145
|
-
docs: {
|
|
146
|
-
displayType: 'yaml'
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
disabled: {
|
|
150
|
-
type: 'boolean',
|
|
151
|
-
description: 'Disable the node if true.',
|
|
152
|
-
default: false
|
|
153
|
-
},
|
|
154
|
-
disableCheckbox: {
|
|
155
|
-
type: 'boolean',
|
|
156
|
-
description: 'Disable the checkbox if true.',
|
|
157
|
-
default: false
|
|
158
|
-
},
|
|
159
|
-
style: {
|
|
160
|
-
type: 'object',
|
|
161
|
-
description: 'Css style to applied to option.',
|
|
162
|
-
docs: {
|
|
163
|
-
displayType: 'yaml'
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
]
|
|
96
|
+
suffixIcon: {
|
|
97
|
+
...icon,
|
|
98
|
+
default: 'AiOutlineDown',
|
|
99
|
+
description: 'Dropdown suffix icon.'
|
|
173
100
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
properties: {
|
|
182
|
-
nodeSelectedBg: {
|
|
183
|
-
type: 'string',
|
|
184
|
-
description: 'Background color of selected tree node.'
|
|
185
|
-
},
|
|
186
|
-
nodeHoverBg: {
|
|
187
|
-
type: 'string',
|
|
188
|
-
description: 'Background color of hovered tree node.'
|
|
189
|
-
},
|
|
190
|
-
titleHeight: {
|
|
191
|
-
type: 'number',
|
|
192
|
-
default: 24,
|
|
193
|
-
description: 'Height of tree node title.'
|
|
194
|
-
},
|
|
195
|
-
directoryNodeSelectedBg: {
|
|
196
|
-
type: 'string',
|
|
197
|
-
description: 'Background color of selected directory node.'
|
|
198
|
-
},
|
|
199
|
-
directoryNodeSelectedColor: {
|
|
200
|
-
type: 'string',
|
|
201
|
-
description: 'Text color of selected directory node.'
|
|
202
|
-
},
|
|
203
|
-
clearBg: {
|
|
204
|
-
type: 'string',
|
|
205
|
-
description: 'Background color of clear button.'
|
|
206
|
-
},
|
|
207
|
-
selectorBg: {
|
|
208
|
-
type: 'string',
|
|
209
|
-
description: 'Background color of the selector.'
|
|
210
|
-
},
|
|
211
|
-
hoverBorderColor: {
|
|
212
|
-
type: 'string',
|
|
213
|
-
description: 'Border color when hovered.'
|
|
214
|
-
},
|
|
215
|
-
activeBorderColor: {
|
|
216
|
-
type: 'string',
|
|
217
|
-
description: 'Border color when active/focused.'
|
|
218
|
-
},
|
|
219
|
-
activeOutlineColor: {
|
|
220
|
-
type: 'string',
|
|
221
|
-
description: 'Outline color when active/focused.'
|
|
222
|
-
},
|
|
223
|
-
optionSelectedBg: {
|
|
224
|
-
type: 'string',
|
|
225
|
-
description: 'Background of selected option.'
|
|
226
|
-
},
|
|
227
|
-
optionSelectedColor: {
|
|
228
|
-
type: 'string',
|
|
229
|
-
description: 'Text color of selected option.'
|
|
230
|
-
},
|
|
231
|
-
optionSelectedFontWeight: {
|
|
232
|
-
type: 'string',
|
|
233
|
-
description: 'Font weight of selected option.'
|
|
234
|
-
},
|
|
235
|
-
optionActiveBg: {
|
|
236
|
-
type: 'string',
|
|
237
|
-
description: 'Background of active (hovered) option.'
|
|
238
|
-
},
|
|
239
|
-
optionFontSize: {
|
|
240
|
-
type: 'number',
|
|
241
|
-
default: 14,
|
|
242
|
-
description: 'Font size of options.'
|
|
243
|
-
},
|
|
244
|
-
optionHeight: {
|
|
245
|
-
type: 'number',
|
|
246
|
-
default: 32,
|
|
247
|
-
description: 'Height of each option.'
|
|
248
|
-
},
|
|
249
|
-
optionLineHeight: {
|
|
250
|
-
type: 'string',
|
|
251
|
-
description: 'Line height of options.'
|
|
252
|
-
},
|
|
253
|
-
optionPadding: {
|
|
254
|
-
type: 'string',
|
|
255
|
-
description: 'Padding of options.'
|
|
256
|
-
},
|
|
257
|
-
multipleSelectorBgDisabled: {
|
|
258
|
-
type: 'string',
|
|
259
|
-
description: 'Background when disabled in multiple mode.'
|
|
260
|
-
},
|
|
261
|
-
multipleItemBg: {
|
|
262
|
-
type: 'string',
|
|
263
|
-
description: 'Background of tag items in multiple mode.'
|
|
264
|
-
},
|
|
265
|
-
multipleItemBorderColor: {
|
|
266
|
-
type: 'string',
|
|
267
|
-
description: 'Border color of tag items.'
|
|
268
|
-
},
|
|
269
|
-
multipleItemHeight: {
|
|
270
|
-
type: 'number',
|
|
271
|
-
default: 24,
|
|
272
|
-
description: 'Height of tag items.'
|
|
273
|
-
},
|
|
274
|
-
multipleItemHeightSM: {
|
|
275
|
-
type: 'number',
|
|
276
|
-
default: 16,
|
|
277
|
-
description: 'Height of tag items (small).'
|
|
278
|
-
},
|
|
279
|
-
multipleItemHeightLG: {
|
|
280
|
-
type: 'number',
|
|
281
|
-
default: 32,
|
|
282
|
-
description: 'Height of tag items (large).'
|
|
283
|
-
},
|
|
284
|
-
zIndexPopup: {
|
|
285
|
-
type: 'number',
|
|
286
|
-
default: 1050,
|
|
287
|
-
description: 'z-index of the dropdown.'
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
101
|
+
clearIcon: {
|
|
102
|
+
...icon,
|
|
103
|
+
default: 'AiOutlineCloseCircle',
|
|
104
|
+
description: 'Clear icon.'
|
|
105
|
+
},
|
|
106
|
+
theme: treeSelectTheme
|
|
291
107
|
}
|
|
292
108
|
}
|
|
293
109
|
};
|
|
@@ -30,6 +30,7 @@ const WeekSelector = ({ blockId, classNames = {}, components: { Icon, Link }, ev
|
|
|
30
30
|
const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
|
|
31
31
|
return /*#__PURE__*/ React.createElement(Label, {
|
|
32
32
|
blockId: blockId,
|
|
33
|
+
methods: methods,
|
|
33
34
|
classNames: classNames,
|
|
34
35
|
components: {
|
|
35
36
|
Icon,
|
|
@@ -66,7 +67,7 @@ const WeekSelector = ({ blockId, classNames = {}, components: { Icon, Link }, ev
|
|
|
66
67
|
disabledDate: disabledDate(properties.disabledDates),
|
|
67
68
|
format: properties.format ?? 'YYYY-wo',
|
|
68
69
|
getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
|
|
69
|
-
placeholder: properties.placeholder
|
|
70
|
+
placeholder: properties.placeholder,
|
|
70
71
|
size: properties.size,
|
|
71
72
|
status: validation.status,
|
|
72
73
|
suffixIcon: /*#__PURE__*/ React.createElement(Icon, {
|
|
@@ -38,7 +38,8 @@ export default {
|
|
|
38
38
|
event: {
|
|
39
39
|
value: 'The selected week value.'
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
|
|
42
43
|
},
|
|
43
44
|
properties: {
|
|
44
45
|
type: 'object',
|
|
@@ -72,8 +73,7 @@ export default {
|
|
|
72
73
|
description: 'Format in which to format the date value, eg. "wo-YYYY" will format a date value of 1999-12-26 as "52nd-1999". The format has to conform to dayjs formats.'
|
|
73
74
|
},
|
|
74
75
|
placeholder: {
|
|
75
|
-
...placeholder
|
|
76
|
-
default: 'Select Week'
|
|
76
|
+
...placeholder
|
|
77
77
|
},
|
|
78
78
|
label,
|
|
79
79
|
showToday: {
|