@lvce-editor/explorer-view 2.37.0 → 2.39.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/explorerViewWorkerMain.js +71 -25
- package/package.json +1 -1
|
@@ -1653,6 +1653,7 @@ const cancelEditCreate = (state, keepFocus) => {
|
|
|
1653
1653
|
focused: keepFocus,
|
|
1654
1654
|
editingIndex: -1,
|
|
1655
1655
|
editingValue: '',
|
|
1656
|
+
editingErrorMessage: '',
|
|
1656
1657
|
editingType: None$5,
|
|
1657
1658
|
focus: List
|
|
1658
1659
|
};
|
|
@@ -1689,6 +1690,7 @@ const cancelEditRename = (state, keepFocus) => {
|
|
|
1689
1690
|
editingIndex: -1,
|
|
1690
1691
|
editingValue: '',
|
|
1691
1692
|
editingType: None$5,
|
|
1693
|
+
editingErrorMessage: '',
|
|
1692
1694
|
focus: List
|
|
1693
1695
|
};
|
|
1694
1696
|
};
|
|
@@ -4244,12 +4246,22 @@ const renderFocus = (oldState, newState) => {
|
|
|
4244
4246
|
return [];
|
|
4245
4247
|
};
|
|
4246
4248
|
|
|
4249
|
+
const getErrorMessagePosition = (itemHeight, focusedIndex, minLineY, depth, indent, fileIconWidth, padding) => {
|
|
4250
|
+
const top = itemHeight * (focusedIndex - minLineY + 1);
|
|
4251
|
+
const left = depth * indent + fileIconWidth + padding;
|
|
4252
|
+
return {
|
|
4253
|
+
top,
|
|
4254
|
+
left
|
|
4255
|
+
};
|
|
4256
|
+
};
|
|
4257
|
+
|
|
4247
4258
|
const Actions = 'Actions';
|
|
4248
4259
|
const Button$2 = 'Button';
|
|
4249
4260
|
const ButtonNarrow = 'ButtonNarrow';
|
|
4250
4261
|
const ButtonPrimary = 'ButtonPrimary';
|
|
4251
4262
|
const ButtonWide = 'ButtonWide';
|
|
4252
4263
|
const Chevron = 'Chevron';
|
|
4264
|
+
const ExplorerErrorMessage = 'ExplorerErrorMessage';
|
|
4253
4265
|
const Empty = '';
|
|
4254
4266
|
const Explorer = 'Explorer';
|
|
4255
4267
|
const ExplorerDropTarget = 'DropTarget';
|
|
@@ -4257,7 +4269,6 @@ const ExplorerInputBox = 'ExplorerInputBox';
|
|
|
4257
4269
|
const FileIcon = 'FileIcon';
|
|
4258
4270
|
const FocusOutline = 'FocusOutline';
|
|
4259
4271
|
const IconButton = 'IconButton';
|
|
4260
|
-
const InputBox = 'InputBox';
|
|
4261
4272
|
const InputValidationError = 'InputValidationError';
|
|
4262
4273
|
const Label = 'Label';
|
|
4263
4274
|
const ListItems = 'ListItems';
|
|
@@ -4284,20 +4295,6 @@ const WelcomeMessage = 'WelcomeMessage';
|
|
|
4284
4295
|
// only numbers are compared. it could also make rendering faster,
|
|
4285
4296
|
// since less data is transferred to renderer process
|
|
4286
4297
|
|
|
4287
|
-
const HandleClick = 'handleClick';
|
|
4288
|
-
const HandleClickOpenFolder = 'handleClickOpenFolder';
|
|
4289
|
-
const HandleContextMenu = 'handleContextMenu';
|
|
4290
|
-
const HandleDragLeave = 'handleDragLeave';
|
|
4291
|
-
const HandleDragOver = 'handleDragOver';
|
|
4292
|
-
const HandleDrop = 'handleDrop';
|
|
4293
|
-
const HandleEditingInput = 'handleEditingInput';
|
|
4294
|
-
const HandleInputBlur = 'handleInputBlur';
|
|
4295
|
-
const HandleInputClick = 'handleInputClick';
|
|
4296
|
-
const HandleListBlur = 'handleListBlur';
|
|
4297
|
-
const HandleListFocus = 'handleListFocus';
|
|
4298
|
-
const HandlePointerDown = 'handlePointerDown';
|
|
4299
|
-
const HandleWheel = 'handleWheel';
|
|
4300
|
-
|
|
4301
4298
|
const mergeClassNames = (...classNames) => {
|
|
4302
4299
|
return classNames.filter(Boolean).join(' ');
|
|
4303
4300
|
};
|
|
@@ -4322,6 +4319,33 @@ const Input = 6;
|
|
|
4322
4319
|
const Img = 17;
|
|
4323
4320
|
const P = 50;
|
|
4324
4321
|
|
|
4322
|
+
const getErrorMessageDom = (errorMessage, errorMessageLeft, errorMessageTop) => {
|
|
4323
|
+
if (!errorMessage) {
|
|
4324
|
+
return [];
|
|
4325
|
+
}
|
|
4326
|
+
const translateString = position(errorMessageLeft, errorMessageTop);
|
|
4327
|
+
return [{
|
|
4328
|
+
type: Div,
|
|
4329
|
+
className: mergeClassNames(ExplorerErrorMessage),
|
|
4330
|
+
childCount: 1,
|
|
4331
|
+
translate: translateString
|
|
4332
|
+
}, text(errorMessage)];
|
|
4333
|
+
};
|
|
4334
|
+
|
|
4335
|
+
const HandleClick = 'handleClick';
|
|
4336
|
+
const HandleClickOpenFolder = 'handleClickOpenFolder';
|
|
4337
|
+
const HandleContextMenu = 'handleContextMenu';
|
|
4338
|
+
const HandleDragLeave = 'handleDragLeave';
|
|
4339
|
+
const HandleDragOver = 'handleDragOver';
|
|
4340
|
+
const HandleDrop = 'handleDrop';
|
|
4341
|
+
const HandleEditingInput = 'handleEditingInput';
|
|
4342
|
+
const HandleInputBlur = 'handleInputBlur';
|
|
4343
|
+
const HandleInputClick = 'handleInputClick';
|
|
4344
|
+
const HandleListBlur = 'handleListBlur';
|
|
4345
|
+
const HandleListFocus = 'handleListFocus';
|
|
4346
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
4347
|
+
const HandleWheel = 'handleWheel';
|
|
4348
|
+
|
|
4325
4349
|
const getExplorerWelcomeVirtualDom = isWide => {
|
|
4326
4350
|
return [{
|
|
4327
4351
|
type: Div,
|
|
@@ -4378,9 +4402,9 @@ const getFileIconVirtualDom = icon => {
|
|
|
4378
4402
|
|
|
4379
4403
|
const getInputClassName = hasEditingError => {
|
|
4380
4404
|
if (hasEditingError) {
|
|
4381
|
-
return mergeClassNames(
|
|
4405
|
+
return mergeClassNames(ExplorerInputBox, InputValidationError);
|
|
4382
4406
|
}
|
|
4383
|
-
return
|
|
4407
|
+
return ExplorerInputBox;
|
|
4384
4408
|
};
|
|
4385
4409
|
|
|
4386
4410
|
const getInputDom = hasEditingError => {
|
|
@@ -4514,20 +4538,32 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
|
4514
4538
|
}];
|
|
4515
4539
|
};
|
|
4516
4540
|
|
|
4517
|
-
const
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4541
|
+
const getChildCount = (scrollBarDomLength, errorDomLength) => {
|
|
4542
|
+
let childCount = 1;
|
|
4543
|
+
if (scrollBarDomLength > 0) {
|
|
4544
|
+
childCount++;
|
|
4545
|
+
}
|
|
4546
|
+
if (errorDomLength > 0) {
|
|
4547
|
+
childCount++;
|
|
4548
|
+
}
|
|
4549
|
+
return childCount;
|
|
4522
4550
|
};
|
|
4523
|
-
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, scrollTop) => {
|
|
4551
|
+
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, scrollTop, errorMessage, errorMessageTop, errorMessageLeft) => {
|
|
4524
4552
|
if (!root) {
|
|
4525
4553
|
return getExplorerWelcomeVirtualDom(isWide);
|
|
4526
4554
|
}
|
|
4527
4555
|
const scrollBarHeight = getScrollBarSize(height, contentHeight, 20);
|
|
4528
4556
|
const scrollBarTop = Math.round(scrollTop / contentHeight * height);
|
|
4529
4557
|
const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarTop);
|
|
4530
|
-
const
|
|
4558
|
+
const errorDom = getErrorMessageDom(errorMessage, errorMessageLeft, errorMessageTop);
|
|
4559
|
+
const childCount = getChildCount(scrollBarDom.length, errorDom.length);
|
|
4560
|
+
const parentNode = {
|
|
4561
|
+
type: Div,
|
|
4562
|
+
childCount,
|
|
4563
|
+
className: mergeClassNames(Viewlet, Explorer),
|
|
4564
|
+
role: 'none'
|
|
4565
|
+
};
|
|
4566
|
+
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets), ...scrollBarDom, ...errorDom];
|
|
4531
4567
|
return dom;
|
|
4532
4568
|
};
|
|
4533
4569
|
|
|
@@ -4647,7 +4683,17 @@ const renderItems = (oldState, newState) => {
|
|
|
4647
4683
|
const visibleDirents = getVisibleExplorerItems(newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.editingIndex, newState.editingType, newState.editingValue, newState.editingErrorMessage, newState.icons, newState.useChevrons, newState.dropTargets, newState.editingIcon);
|
|
4648
4684
|
const isWide = newState.width > 450;
|
|
4649
4685
|
const contentHeight = newState.items.length * newState.itemHeight;
|
|
4650
|
-
const
|
|
4686
|
+
const depth = newState.items[newState.focusedIndex]?.depth || 0;
|
|
4687
|
+
const indent = 8;
|
|
4688
|
+
const padding = 10;
|
|
4689
|
+
const fileIconWidth = 16;
|
|
4690
|
+
const defaultPaddingLeft = 0;
|
|
4691
|
+
const chevronSpace = 22;
|
|
4692
|
+
const {
|
|
4693
|
+
top,
|
|
4694
|
+
left
|
|
4695
|
+
} = getErrorMessagePosition(newState.itemHeight, newState.focusedIndex, newState.minLineY, depth, indent, fileIconWidth, padding + defaultPaddingLeft + chevronSpace);
|
|
4696
|
+
const dom = getExplorerVirtualDom(visibleDirents, newState.focusedIndex, newState.root, isWide, newState.focused, newState.dropTargets, newState.height, contentHeight, newState.deltaY, newState.editingErrorMessage, top, left);
|
|
4651
4697
|
return ['Viewlet.setDom2', dom];
|
|
4652
4698
|
};
|
|
4653
4699
|
|