@lvce-editor/settings-view 1.12.0 → 1.13.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.
@@ -1096,17 +1096,45 @@ const handleInput = (state, value, inputSource = User) => {
1096
1096
  };
1097
1097
 
1098
1098
  const handleSettingChecked = (state, name, value) => {
1099
+ const {
1100
+ modifiedSettings,
1101
+ items,
1102
+ tabs,
1103
+ searchValue
1104
+ } = state;
1105
+ const newModifiedSettings = {
1106
+ ...modifiedSettings,
1107
+ [name]: true
1108
+ };
1109
+ const filteredItems = getFilteredItems(items, tabs, searchValue, newModifiedSettings);
1110
+
1099
1111
  // TODO update value
1100
1112
  return {
1101
- ...state
1113
+ ...state,
1114
+ modifiedSettings: newModifiedSettings,
1115
+ filteredItems
1102
1116
  };
1103
1117
  };
1104
1118
 
1105
1119
  const handleSettingInput = (state, name, value, inputSource = User) => {
1106
1120
  // TODO update value
1121
+ const {
1122
+ modifiedSettings,
1123
+ items,
1124
+ tabs,
1125
+ searchValue
1126
+ } = state;
1127
+ const newModifiedSettings = {
1128
+ ...modifiedSettings,
1129
+ [name]: true
1130
+ };
1131
+
1132
+ // TODO don't need to update items if it was already modified
1133
+ const filteredItems = getFilteredItems(items, tabs, searchValue, newModifiedSettings);
1107
1134
  return {
1108
1135
  ...state,
1109
- inputSource
1136
+ inputSource,
1137
+ filteredItems
1110
1138
  };
1111
1139
  };
1112
1140
 
@@ -3306,31 +3334,31 @@ const text = data => {
3306
3334
  const {
3307
3335
  Viewlet
3308
3336
  } = ClassNames;
3309
- const Settings = 'Settings';
3310
- const SettingsInputWrapper = 'SettingsInputWrapper';
3311
- const InputBox = 'InputBox';
3312
- const SettingsSearchInput = 'SettingsSearchInput';
3337
+ const Badge = 'Badge';
3313
3338
  const Button = 'Button';
3314
- const InputButton = 'InputButton';
3315
- const SearchFieldButton = 'SearchFieldButton';
3339
+ const CheckBox = 'CheckBox';
3316
3340
  const Disabled = 'Disabled';
3341
+ const InputBox = 'InputBox';
3342
+ const InputButton = 'InputButton';
3317
3343
  const MaskIcon = 'MaskIcon';
3318
3344
  const MaskIconClearAll = 'MaskIconClearAll';
3319
- const SettingsItem = 'SettingsItem';
3320
- const SettingsItemCheckBox = 'SettingsItemCheckBox';
3321
- const CheckBox = 'CheckBox';
3345
+ const SearchFieldButton = 'SearchFieldButton';
3322
3346
  const Select = 'Select';
3323
- const SettingsItems = 'SettingsItems';
3324
- const SettingsNoResults = 'SettingsNoResults';
3325
- const SettingsMain = 'SettingsMain';
3347
+ const Settings = 'Settings';
3326
3348
  const SettingsContent = 'SettingsContent';
3327
3349
  const SettingsContentHeading = 'SettingsContentHeading';
3328
3350
  const SettingsHeader = 'SettingsHeader';
3351
+ const SettingsInputWrapper = 'SettingsInputWrapper';
3352
+ const SettingsItem = 'SettingsItem';
3353
+ const SettingsItemCheckBox = 'SettingsItemCheckBox';
3354
+ const SettingsItems = 'SettingsItems';
3355
+ const SettingsMain = 'SettingsMain';
3356
+ const SettingsNoResults = 'SettingsNoResults';
3357
+ const SettingsSearchInput = 'SettingsSearchInput';
3329
3358
  const SettingsSideBar = 'SettingsSideBar';
3330
3359
  const SettingsTabs = 'SettingsTabs';
3331
3360
  const Tab = 'Tab';
3332
3361
  const TabSelected = 'TabSelected';
3333
- const Badge = 'Badge';
3334
3362
 
3335
3363
  const getSettingsInputBadgeDom = (filteredSettingsCount, hasSearchValue) => {
3336
3364
  if (!hasSearchValue) {
@@ -3411,14 +3439,17 @@ const getItemCheckBoxVirtualDom = item => {
3411
3439
  const {
3412
3440
  heading,
3413
3441
  description,
3414
- id
3442
+ id,
3443
+ modified
3415
3444
  } = item;
3445
+ const isModified = modified || false;
3416
3446
  const domId = getInputId(id);
3417
3447
  return [{
3418
3448
  type: VirtualDomElements.Div,
3419
3449
  className: SettingsItem,
3420
3450
  childCount: 3,
3421
- role: 'group'
3451
+ role: 'group',
3452
+ dataModified: isModified
3422
3453
  }, {
3423
3454
  type: VirtualDomElements.H3,
3424
3455
  childCount: 1
@@ -3441,6 +3472,22 @@ const getItemCheckBoxVirtualDom = item => {
3441
3472
  }, text(description)];
3442
3473
  };
3443
3474
 
3475
+ const getItemHeadingDom = heading => {
3476
+ return [{
3477
+ type: VirtualDomElements.H3,
3478
+ childCount: 1
3479
+ }, text(heading)];
3480
+ };
3481
+
3482
+ const getItemLabelDom = (domId, label) => {
3483
+ return [{
3484
+ type: VirtualDomElements.Label,
3485
+ htmlFor: domId,
3486
+ childCount: 1,
3487
+ className: 'Label'
3488
+ }, text(label)];
3489
+ };
3490
+
3444
3491
  const getItemNumberVirtualDom = item => {
3445
3492
  const {
3446
3493
  heading,
@@ -3453,15 +3500,7 @@ const getItemNumberVirtualDom = item => {
3453
3500
  className: SettingsItem,
3454
3501
  childCount: 3,
3455
3502
  role: 'group'
3456
- }, {
3457
- type: VirtualDomElements.H3,
3458
- childCount: 1
3459
- }, text(heading), {
3460
- type: VirtualDomElements.Label,
3461
- htmlFor: domId,
3462
- childCount: 1,
3463
- className: 'Label'
3464
- }, text(description), {
3503
+ }, ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
3465
3504
  type: VirtualDomElements.Input,
3466
3505
  className: InputBox,
3467
3506
  inputType: 'number',
@@ -3492,22 +3531,18 @@ const getItemSelectVirtualDom = item => {
3492
3531
  id
3493
3532
  } = item;
3494
3533
  const options = item.options || [];
3534
+ const domId = getInputId(id);
3495
3535
  return [{
3496
3536
  type: VirtualDomElements.Div,
3497
3537
  className: SettingsItem,
3498
3538
  childCount: 3,
3499
3539
  role: 'group'
3500
- }, {
3501
- type: VirtualDomElements.H3,
3502
- childCount: 1
3503
- }, text(heading), {
3504
- type: VirtualDomElements.P,
3505
- childCount: 1
3506
- }, text(description), {
3540
+ }, ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
3507
3541
  type: VirtualDomElements.Select,
3508
3542
  className: Select,
3509
3543
  childCount: options.length,
3510
- name: id
3544
+ name: id,
3545
+ onChange: HandleSettingSelect
3511
3546
  }, ...options.flatMap(getOptionDom)];
3512
3547
  };
3513
3548
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",