@lvce-editor/settings-view 1.8.0 → 1.10.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 +175 -72
- package/package.json +1 -1
|
@@ -914,17 +914,33 @@ const terminate = () => {
|
|
|
914
914
|
globalThis.close();
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
-
const
|
|
917
|
+
const isItemModified = (item, preferences) => {
|
|
918
|
+
return item.id in preferences;
|
|
919
|
+
};
|
|
920
|
+
const addModifiedProperty = (items, preferences) => {
|
|
921
|
+
return items.map(item => ({
|
|
922
|
+
...item,
|
|
923
|
+
modified: isItemModified(item, preferences)
|
|
924
|
+
}));
|
|
925
|
+
};
|
|
926
|
+
const filterByTab = (items, tabs) => {
|
|
918
927
|
const selectedTab = tabs.find(tab => tab.selected);
|
|
919
928
|
if (!selectedTab) {
|
|
920
929
|
return items;
|
|
921
930
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
931
|
+
return items.filter(item => item.category === selectedTab.id);
|
|
932
|
+
};
|
|
933
|
+
const filterBySearch = (items, searchValue) => {
|
|
934
|
+
if (!searchValue || !searchValue.trim()) {
|
|
935
|
+
return items;
|
|
925
936
|
}
|
|
926
937
|
const normalizedSearchValue = searchValue.toLowerCase().trim();
|
|
927
|
-
return
|
|
938
|
+
return items.filter(item => item.heading.toLowerCase().includes(normalizedSearchValue));
|
|
939
|
+
};
|
|
940
|
+
const getFilteredItems = (items, tabs, searchValue = '', preferences = {}) => {
|
|
941
|
+
const tabFilteredItems = filterByTab(items, tabs);
|
|
942
|
+
const itemsWithModifiedProperty = addModifiedProperty(tabFilteredItems, preferences);
|
|
943
|
+
return filterBySearch(itemsWithModifiedProperty, searchValue);
|
|
928
944
|
};
|
|
929
945
|
|
|
930
946
|
const User = 1;
|
|
@@ -933,10 +949,11 @@ const Script = 2;
|
|
|
933
949
|
const clear$1 = state => {
|
|
934
950
|
const {
|
|
935
951
|
items,
|
|
936
|
-
tabs
|
|
952
|
+
tabs,
|
|
953
|
+
preferences
|
|
937
954
|
} = state;
|
|
938
955
|
const newSearchValue = '';
|
|
939
|
-
const filteredItems = getFilteredItems(items, tabs, newSearchValue);
|
|
956
|
+
const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
|
|
940
957
|
return {
|
|
941
958
|
...state,
|
|
942
959
|
searchValue: newSearchValue,
|
|
@@ -972,29 +989,35 @@ const create$1 = (id, uri, x, y, width, height) => {
|
|
|
972
989
|
preferences: {},
|
|
973
990
|
inputSource: 0,
|
|
974
991
|
scrollOffset: 0,
|
|
975
|
-
filteredItemsCount: 0
|
|
992
|
+
filteredItemsCount: 0,
|
|
993
|
+
history: []
|
|
976
994
|
};
|
|
977
995
|
set$1(id, state, state);
|
|
978
996
|
};
|
|
979
997
|
|
|
980
|
-
const isEqual$
|
|
998
|
+
const isEqual$3 = (oldState, newState) => {
|
|
981
999
|
return oldState.focus === newState.focus;
|
|
982
1000
|
};
|
|
983
1001
|
|
|
984
|
-
const isEqual$
|
|
1002
|
+
const isEqual$2 = (oldState, newState) => {
|
|
985
1003
|
return oldState === newState;
|
|
986
1004
|
};
|
|
987
1005
|
|
|
1006
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1007
|
+
return oldState.filteredItems === newState.filteredItems;
|
|
1008
|
+
};
|
|
1009
|
+
|
|
988
1010
|
const RenderItems = 1;
|
|
989
1011
|
const RenderFocus = 2;
|
|
990
1012
|
const RenderValue = 3;
|
|
1013
|
+
const RenderSettingValues = 10;
|
|
991
1014
|
|
|
992
1015
|
const isEqual = (oldState, newState) => {
|
|
993
1016
|
return newState.inputSource === User || oldState.searchValue === newState.searchValue;
|
|
994
1017
|
};
|
|
995
1018
|
|
|
996
|
-
const modules = [isEqual$
|
|
997
|
-
const numbers = [RenderFocus, RenderItems, RenderValue];
|
|
1019
|
+
const modules = [isEqual$3, isEqual$2, isEqual, isEqual$1];
|
|
1020
|
+
const numbers = [RenderFocus, RenderItems, RenderValue, RenderSettingValues];
|
|
998
1021
|
|
|
999
1022
|
const diff = (oldState, newState) => {
|
|
1000
1023
|
const diffResult = [];
|
|
@@ -1044,10 +1067,11 @@ const handleClickTab = (state, name) => {
|
|
|
1044
1067
|
const {
|
|
1045
1068
|
items,
|
|
1046
1069
|
tabs,
|
|
1047
|
-
searchValue
|
|
1070
|
+
searchValue,
|
|
1071
|
+
preferences
|
|
1048
1072
|
} = state;
|
|
1049
1073
|
const updatedTabs = getUpdatedTabs(tabs, name);
|
|
1050
|
-
const filteredItems = getFilteredItems(items, updatedTabs, searchValue);
|
|
1074
|
+
const filteredItems = getFilteredItems(items, updatedTabs, searchValue, preferences);
|
|
1051
1075
|
return {
|
|
1052
1076
|
...state,
|
|
1053
1077
|
tabs: updatedTabs,
|
|
@@ -1058,9 +1082,10 @@ const handleClickTab = (state, name) => {
|
|
|
1058
1082
|
const handleInput = (state, value) => {
|
|
1059
1083
|
const {
|
|
1060
1084
|
items,
|
|
1061
|
-
tabs
|
|
1085
|
+
tabs,
|
|
1086
|
+
preferences
|
|
1062
1087
|
} = state;
|
|
1063
|
-
const filteredItems = getFilteredItems(items, tabs, value);
|
|
1088
|
+
const filteredItems = getFilteredItems(items, tabs, value, preferences);
|
|
1064
1089
|
return {
|
|
1065
1090
|
...state,
|
|
1066
1091
|
searchValue: value,
|
|
@@ -1123,7 +1148,7 @@ const FormatOnSave = 'Format on Save';
|
|
|
1123
1148
|
const FormatOnSaveDescription = 'Format code when saving';
|
|
1124
1149
|
const NumberValue = 'number value';
|
|
1125
1150
|
const SearchSettings = 'Search Settings';
|
|
1126
|
-
const SettingsContent = 'Settings Content';
|
|
1151
|
+
const SettingsContent$1 = 'Settings Content';
|
|
1127
1152
|
const SidebarPosition = 'Sidebar Position';
|
|
1128
1153
|
const SidebarPositionDescription = 'The position of the sidebar';
|
|
1129
1154
|
const Telemetry = 'Telemetry';
|
|
@@ -1137,6 +1162,7 @@ const WindowSizeDescription = 'The default window size';
|
|
|
1137
1162
|
const WindowTitle = 'Window Title';
|
|
1138
1163
|
const WindowTitleDescription = 'The title shown in the window';
|
|
1139
1164
|
const NoSettingsMatching = 'No settings matching "{PH1}" found';
|
|
1165
|
+
const MatchingSettings = '{PH1} matching settings';
|
|
1140
1166
|
|
|
1141
1167
|
// Text Editor Settings
|
|
1142
1168
|
const WordWrap = 'Word Wrap';
|
|
@@ -1428,7 +1454,7 @@ const searchSettings = () => {
|
|
|
1428
1454
|
return i18nString(SearchSettings);
|
|
1429
1455
|
};
|
|
1430
1456
|
const settingsContent = () => {
|
|
1431
|
-
return i18nString(SettingsContent);
|
|
1457
|
+
return i18nString(SettingsContent$1);
|
|
1432
1458
|
};
|
|
1433
1459
|
const sidebarPosition = () => {
|
|
1434
1460
|
return i18nString(SidebarPosition);
|
|
@@ -1471,6 +1497,11 @@ const noSettingsMatching = searchTerm => {
|
|
|
1471
1497
|
PH1: searchTerm
|
|
1472
1498
|
});
|
|
1473
1499
|
};
|
|
1500
|
+
const matchingSettings = count => {
|
|
1501
|
+
return i18nString(MatchingSettings, {
|
|
1502
|
+
PH1: count.toString()
|
|
1503
|
+
});
|
|
1504
|
+
};
|
|
1474
1505
|
|
|
1475
1506
|
// Text Editor Settings
|
|
1476
1507
|
const wordWrap = () => {
|
|
@@ -2162,7 +2193,7 @@ const wrappingIndentDescription = () => {
|
|
|
2162
2193
|
|
|
2163
2194
|
const getSettingItems = async () => {
|
|
2164
2195
|
return [{
|
|
2165
|
-
id: 'fontSize',
|
|
2196
|
+
id: 'Editor.fontSize',
|
|
2166
2197
|
heading: fontSize(),
|
|
2167
2198
|
description: fontSizeDescription(),
|
|
2168
2199
|
type: Number$1,
|
|
@@ -3173,8 +3204,8 @@ const loadContent = async (state, savedState) => {
|
|
|
3173
3204
|
const tabs = getTabs();
|
|
3174
3205
|
const newTabs = getUpdatedTabs(tabs, tabId);
|
|
3175
3206
|
const items = await getSettingItems();
|
|
3176
|
-
const filteredItems = getFilteredItems(items, newTabs, searchValue);
|
|
3177
3207
|
const preferences = await getPreferences();
|
|
3208
|
+
const filteredItems = getFilteredItems(items, newTabs, searchValue, preferences);
|
|
3178
3209
|
return {
|
|
3179
3210
|
...state,
|
|
3180
3211
|
tabs: newTabs,
|
|
@@ -3199,7 +3230,7 @@ const ClassNames = {
|
|
|
3199
3230
|
const mergeClassNames = (...classNames) => {
|
|
3200
3231
|
return classNames.filter(Boolean).join(' ');
|
|
3201
3232
|
};
|
|
3202
|
-
const Button = 1;
|
|
3233
|
+
const Button$1 = 1;
|
|
3203
3234
|
const Div = 4;
|
|
3204
3235
|
const H1 = 5;
|
|
3205
3236
|
const Input = 6;
|
|
@@ -3208,13 +3239,13 @@ const H3 = 23;
|
|
|
3208
3239
|
const Aside = 28;
|
|
3209
3240
|
const P = 50;
|
|
3210
3241
|
const Ul = 60;
|
|
3211
|
-
const Select = 63;
|
|
3242
|
+
const Select$1 = 63;
|
|
3212
3243
|
const Option = 64;
|
|
3213
3244
|
const Label = 66;
|
|
3214
3245
|
const VirtualDomElements = {
|
|
3215
3246
|
__proto__: null,
|
|
3216
3247
|
Aside,
|
|
3217
|
-
Button,
|
|
3248
|
+
Button: Button$1,
|
|
3218
3249
|
Div,
|
|
3219
3250
|
H1,
|
|
3220
3251
|
H3,
|
|
@@ -3222,7 +3253,7 @@ const VirtualDomElements = {
|
|
|
3222
3253
|
Label,
|
|
3223
3254
|
Option,
|
|
3224
3255
|
P,
|
|
3225
|
-
Select,
|
|
3256
|
+
Select: Select$1,
|
|
3226
3257
|
Ul};
|
|
3227
3258
|
const text = data => {
|
|
3228
3259
|
return {
|
|
@@ -3236,28 +3267,51 @@ const {
|
|
|
3236
3267
|
Viewlet
|
|
3237
3268
|
} = ClassNames;
|
|
3238
3269
|
const Settings = 'Settings';
|
|
3270
|
+
const SettingsInputWrapper = 'SettingsInputWrapper';
|
|
3271
|
+
const InputBox = 'InputBox';
|
|
3272
|
+
const SettingsSearchInput = 'SettingsSearchInput';
|
|
3273
|
+
const Button = 'Button';
|
|
3274
|
+
const InputButton = 'InputButton';
|
|
3275
|
+
const SearchFieldButton = 'SearchFieldButton';
|
|
3276
|
+
const MaskIcon = 'MaskIcon';
|
|
3277
|
+
const MaskIconClearAll = 'MaskIconClearAll';
|
|
3278
|
+
const SettingsItem = 'SettingsItem';
|
|
3279
|
+
const SettingsItemCheckBox = 'SettingsItemCheckBox';
|
|
3280
|
+
const CheckBox = 'CheckBox';
|
|
3281
|
+
const Select = 'Select';
|
|
3282
|
+
const SettingsItems = 'SettingsItems';
|
|
3283
|
+
const SettingsNoResults = 'SettingsNoResults';
|
|
3284
|
+
const SettingsMain = 'SettingsMain';
|
|
3285
|
+
const SettingsContent = 'SettingsContent';
|
|
3286
|
+
const SettingsContentHeading = 'SettingsContentHeading';
|
|
3287
|
+
const SettingsHeader = 'SettingsHeader';
|
|
3288
|
+
const SettingsSideBar = 'SettingsSideBar';
|
|
3289
|
+
const SettingsTabs = 'SettingsTabs';
|
|
3290
|
+
const Tab = 'Tab';
|
|
3291
|
+
const TabSelected = 'TabSelected';
|
|
3292
|
+
const Badge = 'Badge';
|
|
3293
|
+
|
|
3294
|
+
const getSettingsInputBadgeDom = (filteredSettingsCount, hasSearchValue) => {
|
|
3295
|
+
if (!hasSearchValue) {
|
|
3296
|
+
return [];
|
|
3297
|
+
}
|
|
3298
|
+
const badgeText = matchingSettings(filteredSettingsCount);
|
|
3299
|
+
return [{
|
|
3300
|
+
type: VirtualDomElements.Div,
|
|
3301
|
+
className: Badge,
|
|
3302
|
+
childCount: 1
|
|
3303
|
+
}, text(badgeText)];
|
|
3304
|
+
};
|
|
3239
3305
|
|
|
3240
3306
|
// TODo use numeric ids
|
|
3241
3307
|
const HandleClickClear = 'handleClickClear';
|
|
3242
3308
|
const HandleClickTab = 'handleClickTab';
|
|
3243
3309
|
const HandleInput = 'handleInput';
|
|
3244
3310
|
|
|
3245
|
-
const
|
|
3246
|
-
const placeholder = searchSettings();
|
|
3311
|
+
const getSettingsInputButtonsDom = () => {
|
|
3247
3312
|
return [{
|
|
3248
|
-
type: VirtualDomElements.Div,
|
|
3249
|
-
className: 'SettingsInputWrapper',
|
|
3250
|
-
childCount: 2
|
|
3251
|
-
}, {
|
|
3252
|
-
type: VirtualDomElements.Input,
|
|
3253
|
-
className: 'InputBox SettingsSearchInput',
|
|
3254
|
-
placeholder,
|
|
3255
|
-
childCount: 0,
|
|
3256
|
-
name: SettingsSearch,
|
|
3257
|
-
onInput: HandleInput
|
|
3258
|
-
}, {
|
|
3259
3313
|
type: VirtualDomElements.Button,
|
|
3260
|
-
className:
|
|
3314
|
+
className: mergeClassNames(Button, InputButton, SearchFieldButton),
|
|
3261
3315
|
childCount: 1,
|
|
3262
3316
|
ariaLabel: clear(),
|
|
3263
3317
|
name: Clear$1,
|
|
@@ -3265,17 +3319,38 @@ const getSettingsInputDom = () => {
|
|
|
3265
3319
|
onClick: HandleClickClear
|
|
3266
3320
|
}, {
|
|
3267
3321
|
type: VirtualDomElements.Div,
|
|
3268
|
-
className:
|
|
3322
|
+
className: mergeClassNames(MaskIcon, MaskIconClearAll),
|
|
3269
3323
|
childCount: 0
|
|
3270
3324
|
}];
|
|
3271
3325
|
};
|
|
3272
3326
|
|
|
3273
|
-
const
|
|
3327
|
+
const getSettingsInputDom = () => {
|
|
3328
|
+
const placeholder = searchSettings();
|
|
3329
|
+
return [{
|
|
3330
|
+
type: VirtualDomElements.Input,
|
|
3331
|
+
className: mergeClassNames(InputBox, SettingsSearchInput),
|
|
3332
|
+
placeholder,
|
|
3333
|
+
childCount: 0,
|
|
3334
|
+
name: SettingsSearch,
|
|
3335
|
+
onInput: HandleInput
|
|
3336
|
+
}];
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
const getChildCount = hasSearchValue => {
|
|
3340
|
+
return hasSearchValue ? 3 : 2;
|
|
3341
|
+
};
|
|
3342
|
+
const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
|
|
3343
|
+
const badgeDom = getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue);
|
|
3344
|
+
const childCount = getChildCount(hasSearchValue);
|
|
3274
3345
|
return [{
|
|
3275
3346
|
type: VirtualDomElements.Div,
|
|
3276
|
-
className:
|
|
3347
|
+
className: SettingsHeader,
|
|
3277
3348
|
childCount: 1
|
|
3278
|
-
},
|
|
3349
|
+
}, {
|
|
3350
|
+
type: VirtualDomElements.Div,
|
|
3351
|
+
className: SettingsInputWrapper,
|
|
3352
|
+
childCount
|
|
3353
|
+
}, ...getSettingsInputDom(), ...getSettingsInputButtonsDom(), ...badgeDom];
|
|
3279
3354
|
};
|
|
3280
3355
|
|
|
3281
3356
|
const getInputId = id => {
|
|
@@ -3291,21 +3366,22 @@ const getItemCheckBoxVirtualDom = item => {
|
|
|
3291
3366
|
const domId = getInputId(id);
|
|
3292
3367
|
return [{
|
|
3293
3368
|
type: VirtualDomElements.Div,
|
|
3294
|
-
className:
|
|
3369
|
+
className: SettingsItem,
|
|
3295
3370
|
childCount: 3
|
|
3296
3371
|
}, {
|
|
3297
3372
|
type: VirtualDomElements.H3,
|
|
3298
3373
|
childCount: 1
|
|
3299
3374
|
}, text(heading), {
|
|
3300
3375
|
type: VirtualDomElements.Div,
|
|
3301
|
-
className:
|
|
3376
|
+
className: SettingsItemCheckBox,
|
|
3302
3377
|
childCount: 2
|
|
3303
3378
|
}, {
|
|
3304
3379
|
type: VirtualDomElements.Input,
|
|
3305
|
-
className:
|
|
3380
|
+
className: CheckBox,
|
|
3306
3381
|
inputType: 'checkbox',
|
|
3307
3382
|
childCount: 0,
|
|
3308
|
-
id: domId
|
|
3383
|
+
id: domId,
|
|
3384
|
+
name: id
|
|
3309
3385
|
}, {
|
|
3310
3386
|
type: VirtualDomElements.Label,
|
|
3311
3387
|
childCount: 1,
|
|
@@ -3316,24 +3392,30 @@ const getItemCheckBoxVirtualDom = item => {
|
|
|
3316
3392
|
const getItemNumberVirtualDom = item => {
|
|
3317
3393
|
const {
|
|
3318
3394
|
heading,
|
|
3319
|
-
description
|
|
3395
|
+
description,
|
|
3396
|
+
id
|
|
3320
3397
|
} = item;
|
|
3398
|
+
const domId = getInputId(id);
|
|
3321
3399
|
return [{
|
|
3322
3400
|
type: VirtualDomElements.Div,
|
|
3323
|
-
className:
|
|
3401
|
+
className: SettingsItem,
|
|
3324
3402
|
childCount: 3
|
|
3325
3403
|
}, {
|
|
3326
3404
|
type: VirtualDomElements.H3,
|
|
3327
3405
|
childCount: 1
|
|
3328
3406
|
}, text(heading), {
|
|
3329
|
-
type: VirtualDomElements.
|
|
3330
|
-
|
|
3407
|
+
type: VirtualDomElements.Label,
|
|
3408
|
+
htmlFor: domId,
|
|
3409
|
+
childCount: 1,
|
|
3410
|
+
className: 'Label'
|
|
3331
3411
|
}, text(description), {
|
|
3332
3412
|
type: VirtualDomElements.Input,
|
|
3333
|
-
className:
|
|
3413
|
+
className: InputBox,
|
|
3334
3414
|
inputType: 'number',
|
|
3335
3415
|
placeholder: numberValue(),
|
|
3336
|
-
childCount: 0
|
|
3416
|
+
childCount: 0,
|
|
3417
|
+
id: domId,
|
|
3418
|
+
name: id
|
|
3337
3419
|
}];
|
|
3338
3420
|
};
|
|
3339
3421
|
|
|
@@ -3352,12 +3434,13 @@ const getOptionDom = option => {
|
|
|
3352
3434
|
const getItemSelectVirtualDom = item => {
|
|
3353
3435
|
const {
|
|
3354
3436
|
heading,
|
|
3355
|
-
description
|
|
3437
|
+
description,
|
|
3438
|
+
id
|
|
3356
3439
|
} = item;
|
|
3357
3440
|
const options = item.options || [];
|
|
3358
3441
|
return [{
|
|
3359
3442
|
type: VirtualDomElements.Div,
|
|
3360
|
-
className:
|
|
3443
|
+
className: SettingsItem,
|
|
3361
3444
|
childCount: 3
|
|
3362
3445
|
}, {
|
|
3363
3446
|
type: VirtualDomElements.H3,
|
|
@@ -3367,19 +3450,21 @@ const getItemSelectVirtualDom = item => {
|
|
|
3367
3450
|
childCount: 1
|
|
3368
3451
|
}, text(description), {
|
|
3369
3452
|
type: VirtualDomElements.Select,
|
|
3370
|
-
className:
|
|
3371
|
-
childCount: options.length
|
|
3453
|
+
className: Select,
|
|
3454
|
+
childCount: options.length,
|
|
3455
|
+
name: id
|
|
3372
3456
|
}, ...options.flatMap(getOptionDom)];
|
|
3373
3457
|
};
|
|
3374
3458
|
|
|
3375
3459
|
const getItemStringVirtualDom = item => {
|
|
3376
3460
|
const {
|
|
3377
3461
|
heading,
|
|
3378
|
-
description
|
|
3462
|
+
description,
|
|
3463
|
+
id
|
|
3379
3464
|
} = item;
|
|
3380
3465
|
return [{
|
|
3381
3466
|
type: VirtualDomElements.Div,
|
|
3382
|
-
className:
|
|
3467
|
+
className: SettingsItem,
|
|
3383
3468
|
childCount: 3
|
|
3384
3469
|
}, {
|
|
3385
3470
|
type: VirtualDomElements.H3,
|
|
@@ -3389,10 +3474,11 @@ const getItemStringVirtualDom = item => {
|
|
|
3389
3474
|
childCount: 1
|
|
3390
3475
|
}, text(description), {
|
|
3391
3476
|
type: VirtualDomElements.Input,
|
|
3392
|
-
className:
|
|
3477
|
+
className: InputBox,
|
|
3393
3478
|
inputType: 'text',
|
|
3394
3479
|
placeholder: numberValue(),
|
|
3395
|
-
childCount: 0
|
|
3480
|
+
childCount: 0,
|
|
3481
|
+
name: id
|
|
3396
3482
|
}];
|
|
3397
3483
|
};
|
|
3398
3484
|
|
|
@@ -3416,11 +3502,11 @@ const getItemVirtualDom = item => {
|
|
|
3416
3502
|
const getSettingsNoResultsDom = searchValue => {
|
|
3417
3503
|
return [{
|
|
3418
3504
|
type: VirtualDomElements.Div,
|
|
3419
|
-
className:
|
|
3505
|
+
className: SettingsItems,
|
|
3420
3506
|
childCount: 1
|
|
3421
3507
|
}, {
|
|
3422
|
-
type: VirtualDomElements.
|
|
3423
|
-
className:
|
|
3508
|
+
type: VirtualDomElements.P,
|
|
3509
|
+
className: SettingsNoResults,
|
|
3424
3510
|
childCount: 1
|
|
3425
3511
|
}, text(noSettingsMatching(searchValue))];
|
|
3426
3512
|
};
|
|
@@ -3431,7 +3517,7 @@ const getSettingsItemsDom = (items, searchValue) => {
|
|
|
3431
3517
|
}
|
|
3432
3518
|
return [{
|
|
3433
3519
|
type: VirtualDomElements.Div,
|
|
3434
|
-
className:
|
|
3520
|
+
className: SettingsItems,
|
|
3435
3521
|
childCount: items.length
|
|
3436
3522
|
}, ...items.flatMap(getItemVirtualDom)];
|
|
3437
3523
|
};
|
|
@@ -3441,17 +3527,17 @@ const getSettingsContentDom = (items, tabs, searchValue) => {
|
|
|
3441
3527
|
const headerText = selectedTab ? selectedTab.label : settingsContent();
|
|
3442
3528
|
return [{
|
|
3443
3529
|
type: VirtualDomElements.Div,
|
|
3444
|
-
className:
|
|
3530
|
+
className: SettingsContent,
|
|
3445
3531
|
childCount: 2
|
|
3446
3532
|
}, {
|
|
3447
3533
|
type: VirtualDomElements.H1,
|
|
3448
|
-
className:
|
|
3534
|
+
className: SettingsContentHeading,
|
|
3449
3535
|
childCount: 1
|
|
3450
3536
|
}, text(headerText), ...getSettingsItemsDom(items, searchValue)];
|
|
3451
3537
|
};
|
|
3452
3538
|
|
|
3453
3539
|
const getTabClassName = tab => {
|
|
3454
|
-
return tab.selected ? mergeClassNames(
|
|
3540
|
+
return tab.selected ? mergeClassNames(Tab, TabSelected) : Tab;
|
|
3455
3541
|
};
|
|
3456
3542
|
|
|
3457
3543
|
const getTabVirtualDom = tab => {
|
|
@@ -3470,7 +3556,7 @@ const getTabVirtualDom = tab => {
|
|
|
3470
3556
|
const getSettingsTabsDom = tabs => {
|
|
3471
3557
|
return [{
|
|
3472
3558
|
type: VirtualDomElements.Ul,
|
|
3473
|
-
className:
|
|
3559
|
+
className: SettingsTabs,
|
|
3474
3560
|
role: AriaRoles.TabList,
|
|
3475
3561
|
childCount: tabs.length,
|
|
3476
3562
|
onClick: HandleClickTab
|
|
@@ -3480,7 +3566,7 @@ const getSettingsTabsDom = tabs => {
|
|
|
3480
3566
|
const getSettingsSideBarDom = tabs => {
|
|
3481
3567
|
return [{
|
|
3482
3568
|
type: VirtualDomElements.Aside,
|
|
3483
|
-
className:
|
|
3569
|
+
className: SettingsSideBar,
|
|
3484
3570
|
childCount: 1
|
|
3485
3571
|
}, ...getSettingsTabsDom(tabs)];
|
|
3486
3572
|
};
|
|
@@ -3488,7 +3574,7 @@ const getSettingsSideBarDom = tabs => {
|
|
|
3488
3574
|
const getSettingsMainDom = (tabs, items, searchValue) => {
|
|
3489
3575
|
return [{
|
|
3490
3576
|
type: VirtualDomElements.Div,
|
|
3491
|
-
className:
|
|
3577
|
+
className: SettingsMain,
|
|
3492
3578
|
childCount: 2
|
|
3493
3579
|
}, ...getSettingsSideBarDom(tabs), ...getSettingsContentDom(items, tabs, searchValue)];
|
|
3494
3580
|
};
|
|
@@ -3497,13 +3583,15 @@ const getSettingsDom = state => {
|
|
|
3497
3583
|
const {
|
|
3498
3584
|
tabs,
|
|
3499
3585
|
filteredItems,
|
|
3500
|
-
searchValue
|
|
3586
|
+
searchValue,
|
|
3587
|
+
filteredItemsCount
|
|
3501
3588
|
} = state;
|
|
3589
|
+
const hasSearchValue = searchValue.trim().length > 0;
|
|
3502
3590
|
return [{
|
|
3503
3591
|
type: VirtualDomElements.Div,
|
|
3504
3592
|
childCount: 2,
|
|
3505
3593
|
className: mergeClassNames(Viewlet, Settings)
|
|
3506
|
-
}, ...getSettingsHeaderDom(), ...getSettingsMainDom(tabs, filteredItems, searchValue)];
|
|
3594
|
+
}, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...getSettingsMainDom(tabs, filteredItems, searchValue)];
|
|
3507
3595
|
};
|
|
3508
3596
|
|
|
3509
3597
|
const renderItems = (oldState, newState) => {
|
|
@@ -3511,6 +3599,19 @@ const renderItems = (oldState, newState) => {
|
|
|
3511
3599
|
return ['Viewlet.setDom2', newState.id, dom];
|
|
3512
3600
|
};
|
|
3513
3601
|
|
|
3602
|
+
const renderSettingValues = (oldState, newState) => {
|
|
3603
|
+
const {
|
|
3604
|
+
filteredItems,
|
|
3605
|
+
id
|
|
3606
|
+
} = newState;
|
|
3607
|
+
const numericSettings = filteredItems.filter(item => item.type === Number$1);
|
|
3608
|
+
const inputValues = numericSettings.map(item => ({
|
|
3609
|
+
name: item.id,
|
|
3610
|
+
value: item.value
|
|
3611
|
+
}));
|
|
3612
|
+
return ['Viewlet.setInputValues', id, inputValues];
|
|
3613
|
+
};
|
|
3614
|
+
|
|
3514
3615
|
const renderValue = (oldState, newState) => {
|
|
3515
3616
|
const {
|
|
3516
3617
|
id,
|
|
@@ -3525,6 +3626,8 @@ const getRenderer = diffType => {
|
|
|
3525
3626
|
return renderItems;
|
|
3526
3627
|
case RenderValue:
|
|
3527
3628
|
return renderValue;
|
|
3629
|
+
case RenderSettingValues:
|
|
3630
|
+
return renderSettingValues;
|
|
3528
3631
|
default:
|
|
3529
3632
|
throw new Error('unknown renderer');
|
|
3530
3633
|
}
|