@lvce-editor/settings-view 2.28.0 → 2.29.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/settingsViewWorkerMain.js +23 -13
- package/package.json +1 -1
|
@@ -2431,6 +2431,7 @@ const VirtualDomElements = {
|
|
|
2431
2431
|
const ClientX = 'event.clientX';
|
|
2432
2432
|
const ClientY = 'event.clientY';
|
|
2433
2433
|
const DeltaY = 'event.deltaY';
|
|
2434
|
+
const TargetChecked = 'event.target.checked';
|
|
2434
2435
|
const TargetName = 'event.target.name';
|
|
2435
2436
|
const TargetValue = 'event.target.value';
|
|
2436
2437
|
|
|
@@ -3310,6 +3311,7 @@ const SettingsSideBar = 'SettingsSideBar';
|
|
|
3310
3311
|
const SettingsTabs = 'SettingsTabs';
|
|
3311
3312
|
const Tab = 'Tab';
|
|
3312
3313
|
const TabSelected = 'TabSelected';
|
|
3314
|
+
const Toggle = 'Toggle';
|
|
3313
3315
|
|
|
3314
3316
|
const getFilteredSchemaErrors = (errors, searchValue) => {
|
|
3315
3317
|
const search = searchValue.trim().toLowerCase();
|
|
@@ -3553,12 +3555,14 @@ const getItemArrayVirtualDom = item => {
|
|
|
3553
3555
|
};
|
|
3554
3556
|
|
|
3555
3557
|
const errorCheckBoxClassName = mergeClassNames(CheckBox, InputBoxError);
|
|
3558
|
+
const errorToggleClassName = mergeClassNames(Toggle, InputBoxError);
|
|
3559
|
+
const settingUseToggles = 'settings.useToggles';
|
|
3556
3560
|
const checkBoxWrapperNode = {
|
|
3557
3561
|
childCount: 2,
|
|
3558
3562
|
className: SettingsItemCheckBox,
|
|
3559
3563
|
type: Div
|
|
3560
3564
|
};
|
|
3561
|
-
const getItemCheckBoxVirtualDom = item => {
|
|
3565
|
+
const getItemCheckBoxVirtualDom = (item, preferences = {}) => {
|
|
3562
3566
|
const {
|
|
3563
3567
|
description,
|
|
3564
3568
|
errorMessage,
|
|
@@ -3569,9 +3573,14 @@ const getItemCheckBoxVirtualDom = item => {
|
|
|
3569
3573
|
value
|
|
3570
3574
|
} = item;
|
|
3571
3575
|
const domId = getInputId(id);
|
|
3572
|
-
const
|
|
3576
|
+
const useToggles = preferences[settingUseToggles] !== false && preferences[settingUseToggles] !== 'false';
|
|
3577
|
+
let checkBoxClassName = useToggles ? Toggle : CheckBox;
|
|
3578
|
+
if (hasError) {
|
|
3579
|
+
checkBoxClassName = useToggles ? errorToggleClassName : errorCheckBoxClassName;
|
|
3580
|
+
}
|
|
3573
3581
|
const errorChildCount = hasError ? 1 : 0;
|
|
3574
|
-
const
|
|
3582
|
+
const currentValue = preferences[id] ?? value;
|
|
3583
|
+
const isChecked = currentValue === true || currentValue === 'true';
|
|
3575
3584
|
return [{
|
|
3576
3585
|
childCount: 2 + errorChildCount,
|
|
3577
3586
|
className: SettingsItem,
|
|
@@ -3819,9 +3828,9 @@ const getItemRender = type => {
|
|
|
3819
3828
|
}
|
|
3820
3829
|
};
|
|
3821
3830
|
|
|
3822
|
-
const getItemVirtualDom = item => {
|
|
3831
|
+
const getItemVirtualDom = (item, preferences) => {
|
|
3823
3832
|
const fn = getItemRender(item.type);
|
|
3824
|
-
return fn(item);
|
|
3833
|
+
return fn(item, preferences);
|
|
3825
3834
|
};
|
|
3826
3835
|
|
|
3827
3836
|
const settingsItemsNode = {
|
|
@@ -3839,7 +3848,7 @@ const getSettingsNoResultsDom = searchValue => {
|
|
|
3839
3848
|
return [settingsItemsNode, noResultsNode, text(noSettingsMatching(searchValue))];
|
|
3840
3849
|
};
|
|
3841
3850
|
|
|
3842
|
-
const getSettingsItemsDom = (items, searchValue) => {
|
|
3851
|
+
const getSettingsItemsDom = (items, searchValue, preferences = {}) => {
|
|
3843
3852
|
if (items.length === 0 && searchValue && searchValue.trim()) {
|
|
3844
3853
|
return getSettingsNoResultsDom(searchValue);
|
|
3845
3854
|
}
|
|
@@ -3848,7 +3857,7 @@ const getSettingsItemsDom = (items, searchValue) => {
|
|
|
3848
3857
|
className: SettingsItems,
|
|
3849
3858
|
onContextMenu: HandleContextMenu,
|
|
3850
3859
|
type: Div
|
|
3851
|
-
}, ...items.flatMap(getItemVirtualDom)];
|
|
3860
|
+
}, ...items.flatMap(item => getItemVirtualDom(item, preferences))];
|
|
3852
3861
|
};
|
|
3853
3862
|
|
|
3854
3863
|
const settingsContentNode = {
|
|
@@ -3862,10 +3871,10 @@ const settingsItemWrapperNode = {
|
|
|
3862
3871
|
className: SettingsItemWrapper,
|
|
3863
3872
|
type: Div
|
|
3864
3873
|
};
|
|
3865
|
-
const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar, schemaErrors = []) => {
|
|
3874
|
+
const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar, schemaErrors = [], preferences = {}) => {
|
|
3866
3875
|
const selectedTab = tabs.find(tab => tab.selected);
|
|
3867
3876
|
const headerText = selectedTab ? selectedTab.label : settingsContent();
|
|
3868
|
-
return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...(selectedTab?.id === SchemaErrorsTab ? getSchemaErrorsDom(schemaErrors) : getSettingsItemsDom(visibleItems, searchValue)), ...getScrollBarDom(showScrollBar)];
|
|
3877
|
+
return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...(selectedTab?.id === SchemaErrorsTab ? getSchemaErrorsDom(schemaErrors) : getSettingsItemsDom(visibleItems, searchValue, preferences)), ...getScrollBarDom(showScrollBar)];
|
|
3869
3878
|
};
|
|
3870
3879
|
|
|
3871
3880
|
const selectedTabClassName = mergeClassNames(Tab, TabSelected);
|
|
@@ -3910,10 +3919,10 @@ const settingsMainNode = {
|
|
|
3910
3919
|
className: SettingsMain,
|
|
3911
3920
|
type: Div
|
|
3912
3921
|
};
|
|
3913
|
-
const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight, schemaErrors = []) => {
|
|
3922
|
+
const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight, schemaErrors = [], preferences = {}) => {
|
|
3914
3923
|
const totalHeight = totalItemCount * itemHeight;
|
|
3915
3924
|
const showScrollBar = totalHeight > height;
|
|
3916
|
-
return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar, schemaErrors)];
|
|
3925
|
+
return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar, schemaErrors, preferences)];
|
|
3917
3926
|
};
|
|
3918
3927
|
|
|
3919
3928
|
const parentNode = {
|
|
@@ -3932,6 +3941,7 @@ const getSettingsDom = state => {
|
|
|
3932
3941
|
filteredItems,
|
|
3933
3942
|
height,
|
|
3934
3943
|
itemHeight,
|
|
3944
|
+
preferences,
|
|
3935
3945
|
schemaErrors = [],
|
|
3936
3946
|
searchValue,
|
|
3937
3947
|
tabs,
|
|
@@ -3941,7 +3951,7 @@ const getSettingsDom = state => {
|
|
|
3941
3951
|
const hasSearchValue = searchValue.trim().length > 0;
|
|
3942
3952
|
const filteredSchemaErrors = getFilteredSchemaErrors(schemaErrors, searchValue);
|
|
3943
3953
|
const filteredItemsCount = getFilteredItemsCount(isSchemaErrorsTab, filteredSchemaErrors.length, filteredItems.length);
|
|
3944
|
-
const mainDom = getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, height, itemHeight, filteredSchemaErrors);
|
|
3954
|
+
const mainDom = getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, height, itemHeight, filteredSchemaErrors, preferences);
|
|
3945
3955
|
return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...mainDom];
|
|
3946
3956
|
};
|
|
3947
3957
|
|
|
@@ -4053,7 +4063,7 @@ const renderEventListeners = () => {
|
|
|
4053
4063
|
params: ['handleSettingInput', TargetName, TargetValue]
|
|
4054
4064
|
}, {
|
|
4055
4065
|
name: HandleSettingChecked,
|
|
4056
|
-
params: ['handleSettingChecked', TargetName,
|
|
4066
|
+
params: ['handleSettingChecked', TargetName, TargetChecked]
|
|
4057
4067
|
},
|
|
4058
4068
|
// {
|
|
4059
4069
|
// name: DomEventListenerFunctions.HandleScroll,
|